From 86b3b2b9d4cb87a44e20a86858e13c3419acf659 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 17:37:21 +0500 Subject: [PATCH 01/21] docs: establish Workstream B implementation and validation contracts --- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++++++++ AGENTS.md | 20 +++++++++ decision.md | 31 ++++++++++++++ docs/CONTRACT_REQUESTS.md | 41 ++++++++++++++++++ docs/SETUP.md | 44 +++++++++++++++++++ docs/VALIDATION_PLAN.md | 56 ++++++++++++++++++++++++ docs/WORKSTREAM_B_PLAN.md | 87 ++++++++++++++++++++++++++++++++++++++ docs/post/notes.md | 19 +++++++++ docs/progress/bootstrap.md | 9 ++++ flow.md | 78 ++++++++++++++++++++++++++++++++++ infra/render/render.yaml | 16 +++++++ 11 files changed, 476 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 AGENTS.md create mode 100644 decision.md create mode 100644 docs/CONTRACT_REQUESTS.md create mode 100644 docs/SETUP.md create mode 100644 docs/VALIDATION_PLAN.md create mode 100644 docs/WORKSTREAM_B_PLAN.md create mode 100644 docs/post/notes.md create mode 100644 docs/progress/bootstrap.md create mode 100644 flow.md create mode 100644 infra/render/render.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9e73ef1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: + push: + branches: [main, "b/**"] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + python: + name: Python lint and tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + - name: Set up Python 3.12 + run: uv python install 3.12 + - name: Install every workspace package + run: uv sync --all-packages --locked + - name: Ruff + run: uv run --locked ruff check . + - name: Pytest + run: uv run --locked pytest --cov --cov-report=term-missing + + web: + name: Web lint, typecheck, build, and browser tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Run web checks when the app exists + shell: bash + run: | + if [[ ! -f apps/web/package.json ]]; then + echo "Web app not present yet; web checks are pending." + exit 0 + fi + if [[ ! -f apps/web/package-lock.json ]]; then + echo "apps/web/package-lock.json is required for reproducible CI." >&2 + exit 1 + fi + cd apps/web + npm ci + npm run lint + npm run typecheck + npm run build + if [[ -f playwright.config.ts || -f playwright.config.js || -f playwright.config.mts ]]; then + npx playwright install --with-deps chromium + npx playwright test + else + echo "Playwright configuration not present yet; browser checks are pending." + fi + + chr-templates: + name: CHR router template integration + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - name: Run Aun's real CHR harness when available + shell: bash + run: | + if [[ ! -f infra/chr/test_templates.py ]]; then + echo "PENDING: infra/chr/test_templates.py is not present. No router tests were run." + exit 0 + fi + uv sync --all-packages --locked + uv run --locked python infra/chr/test_templates.py diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..543c5ae --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,20 @@ +# Workstream B repository rules + +## Ownership + +- Workstream B owns only the root tooling/bootstrap files, `docs/`, `infra/render/`, `.github/`, `packages/simgen/`, `packages/detector/`, `packages/runbook/`, `packages/notify/`, `apps/web/`, `data/`, and `eval/` as assigned in the build plan. +- Aun owns `packages/core/`, `packages/agent/`, `packages/fixes/`, `services/api/`, `services/worker/`, `services/collector/`, shared schemas and Settings, Temporal workflows, and the router harness. Do not create, edit, or redefine those contracts. +- The future core import is `netcortex_core`, but its actual distribution/package name and interface are unresolved. Treat consuming it as blocked until Aun confirms the package name and contract. +- Workstream B distribution/import pairs are `netcortex-simgen` / `netcortex_simgen`, `netcortex-detector` / `netcortex_detector`, `netcortex-runbook` / `netcortex_runbook`, and `netcortex-notify` / `netcortex_notify`. +- Never copy shared types into a Workstream B package. Import them from the approved core package after it exists. +- Root files, `uv.lock`, integration wiring, and shared deployment decisions are owned by the workstream lead. Do not regenerate or edit `uv.lock` from a worker branch. + +## Implementation expectations + +- Every network call has a finite timeout and a mock/offline mode where applicable. +- Unit tests run offline with fixtures; do not depend on live credentials or services. +- Model or provider errors must be reported explicitly. Do not return fallback output that implies inference or a successful check occurred when it did not. +- Keep secrets in local environment variables or secret stores. Never commit `.env`, credentials, raw downloads, or generated Parquet. +- Use only approved cause and template identifiers from the shared build plan. Contract changes require Aun's approval. +- Keep package READMEs and progress notes current. State external integration gates plainly rather than claiming unfinished behavior works. +- Each agent must maintain `decision.md` and `flow.md` in its package/app (the lead maintains both at repository root). Explain material choices and reasons, and document actual CLI/Python/HTTP entry points, outputs, connected APIs, errors and fixture/live boundaries in plain language. diff --git a/decision.md b/decision.md new file mode 100644 index 0000000..6a95ffe --- /dev/null +++ b/decision.md @@ -0,0 +1,31 @@ +# Decisions made by the workstream lead + +This is the running record of what we chose, why, and what it means. Package +`decision.md` files explain implementation details. See [flow.md](flow.md) for +how the pieces connect and [the implementation plan](docs/WORKSTREAM_B_PLAN.md). + +| Decision | Reason | Consequence / alternative | +| --- | --- | --- | +| Build B1-B9 and B11; exclude Tinker | Agreed scope; establish the working product before optional fine-tuning | No fine-tuned planner is claimed | +| Start on `b/workstream-b`; isolate parallel workers in `b/data-simgen`, `b/runbook-notify`, `b/web-dashboard` worktrees | Keep main untouched and concurrent writes separate | Lead integrates owned paths and validates before pushing | +| Coding workers use `gpt-6-luna`, medium reasoning | User requested this model and lead/worker division | Lead specifies, reviews, tests and handles integration | +| Aun owns core, Settings, migrations, API, workflows, agent and router infrastructure | The shared build brief explicitly reserves those contracts | We write requests and use lazy imports; no replacement schemas | +| Build independent engines with plain data and explicit fixture modes | Core and external credentials are absent | Fixture success does not establish live integration | +| Gate heavy-user and DNS claims on new telemetry contracts | Aggregate interface stats cannot identify a subscriber, and ping is not DNS resolution timing | Never fabricate offending IPs or claim DNS diagnosis from ping alone | +| Separate training, validation and final evaluation | Tuning thresholds on final tests inflates measured quality | Freeze thresholds before held-out scoring and report actual denominators | +| Failure is unavailable, never an implicit normal result | A failed diagnostic must not tell the operator a broken network is healthy | Provider errors stay visible; live transport never silently falls back to fixtures | +| Use TabPFN Python adapters in the application; MCP only for experiments | The detector needs a stable callable and explicit configuration | Connecting an MCP does not replace the runtime integration | +| Use Render Node hosting for the Next.js dashboard | SSR routes and dynamic incident URLs require the actual Next server | Static `dist` hosting is unsuitable for this application | +| Keep the API deployment gated on Aun's backend | Creating a second backend would break ownership and integration | Infrastructure docs may be ready before a public complete demo | +| Use free tiers and credits only | User's chosen spending limit | Any purchase or paid upgrade needs separate authorization | +| Enable Entire before the first implementation commit | Capture coding provenance required by the brief | Hook installation is verified separately from transcript/checkpoint capture | +| Git author is `techieworld2` with the email the user supplied | User explicitly provided their commit identity | Repository-local identity; unrelated repositories are unchanged | +| Persist decisions, flow documentation and progress handoffs | User wants to understand the code and context must survive compaction | Every package/app has both documents; lead keeps these root documents current | +| Do not promise exact 60% compaction in this running session | Exposed agent controls do not set or trigger that threshold | Host compaction remains automatic; handoffs preserve state independently | + +## Current external gates + +As initially inspected, upstream main contains only README.md. Aun must publish +core/backend contracts. Database, tailnet, API keys, Sentry projects, Render and +domain access are not yet supplied. Their live checks remain pending until +verified; none are replaced with invented pass results. diff --git a/docs/CONTRACT_REQUESTS.md b/docs/CONTRACT_REQUESTS.md new file mode 100644 index 0000000..611c7ac --- /dev/null +++ b/docs/CONTRACT_REQUESTS.md @@ -0,0 +1,41 @@ +# Contract questions for Aun + +These are proposals and integration questions only. They do not change shared contracts. Aun must approve the answers and publish the source-of-truth definitions before Workstream B binds to them. + +## Core package and shared types + +- Confirm the distribution name and import name for `packages/core`; `netcortex_core` is the expected import namespace, but the distribution name is unresolved. +- Publish supported Python version, package exports, schema versions, and compatibility policy. +- Confirm exact types and field names for probe/interface metrics, forecasts, incidents, detection results, incident reports, fix plans, and template parameters. +- Clarify timestamp timezone/format, units, nullability, source labels, and identifier formats. + +## Settings and API + +- Confirm Settings field names, defaults, environment variable names, validation behavior, and secret handling. +- Confirm API base path, auth mechanism, owner/user role mapping, and how demo mode is represented. +- Provide request/response examples and explicit status/error payloads for incident list/detail, approval/rejection, history, and health endpoints. +- Define explicit failure semantics for upstream timeouts, unavailable model/provider, stale data, authorization failure, and partial results. Errors must remain distinguishable from a successful empty response. + +## SSE and subscriber telemetry + +- Confirm SSE endpoint, event envelope, event IDs/replay behavior, heartbeat cadence, reconnect expectations, and event names/payloads (`incident.opened`, `fix.tested`, and others). +- Specify whether subscriber identifiers/IPs are exposed, redacted, or role-gated in API events and the UI; identify retention and access policy. +- Clarify how a subscriber can be identified for heavy-user analysis without exposing unnecessary personal data. + +## Timing and role mapping + +- Confirm collection intervals, detector lookback/history window, forecast horizon, and freshness thresholds for probe and interface telemetry. +- Confirm role mapping for owner, operator, and read-only/demo viewers, including permissions for approve/reject and subscriber-level evidence. +- Confirm workflow timing and expiry behavior for approvals and for post-change observation/rollback. + +## Forecast persistence and injection lifecycle + +- Define a unique key and conflict/upsert policy for forecasts, including site, metric/target, model/version, and forecast timestamp dimensions as appropriate. +- Identify the sole forecast writer and the expected transactional behavior when a detection run retries. +- Define simulator injection start/end semantics, source labeling, scenario-label linkage, cleanup/expiry behavior, and whether injections can overlap. +- Clarify how generated/replayed rows differ from injected rows and which records are safe to retain in a hosted demo. + +## Router test integration + +- Confirm location and invocation contract for Aun's CHR harness, expected CHR image/license setup, and machine-readable result format. +- Workstream B CI will call `infra/chr/test_templates.py` only when Aun provides it. Until then, the router template CI gate is pending; no substitute test will be reported as a router test. diff --git a/docs/SETUP.md b/docs/SETUP.md new file mode 100644 index 0000000..9c8dfae --- /dev/null +++ b/docs/SETUP.md @@ -0,0 +1,44 @@ +# Development setup + +## Local development + +Install Python 3.12, uv, Node.js/npm for the web app, and Git. From the repository root: + +```powershell +uv sync --all-packages +uv run ruff check . +uv run pytest +``` + +`uv sync --all-packages` installs each workspace member in editable mode so tests import the installed packages. The workspace package directories are being created in parallel; run sync after they exist. The root does not own `uv.lock`; the workstream lead generates and commits it once all package manifests are present. + +For the web app, once `apps/web/package-lock.json` exists: + +```powershell +cd apps/web +npm ci +npm run lint +npm run typecheck +npm run build +npx playwright test +``` + +Playwright browser setup may also require `npx playwright install --with-deps` on Linux CI. + +## Local environment and secrets + +Copy `.env.example` to `.env` when the relevant integration modules provide it. Keep `.env` local; never add credentials to source control. Use mock/offline modes for unit tests. External credentials such as database, Sentry, TabPFN, ElevenLabs, and SerpApi keys are optional and should be supplied only for the corresponding integration. No credentials are required for linting or offline unit tests. + +Store secrets in the local shell environment or the hosting provider's encrypted environment settings. Do not place production secrets in frontend variables: values embedded into a browser bundle are public. + +## Account and sign-in steps + +The API authentication and role contract is awaiting Aun's decision, so there is no supported account-creation or login procedure yet. Once that contract is published, the operator setup guide must explain how to create the first owner account, sign in, invite or provision other roles, and recover access. Do not expose an unauthenticated hosted dashboard with real subscriber data while this gate is open; the planned demo should use simulated/replayed data and follow the eventual auth policy. + +## Free tiers and credits + +The hosted demo may use Render, Tiger Data, Sentry, and vendor trial/free credits if current eligibility and limits allow. Availability, quotas, and credit terms change; check each provider's current account dashboard before relying on a free tier. Do not put paid usage on an account without its owner's authorization. The local development and offline test path must not require a paid service. + +## Integration gates + +The core package name and shared schemas, Settings, API and SSE contract, role mapping, and CHR harness are awaiting Aun's confirmation. See [CONTRACT_REQUESTS.md](CONTRACT_REQUESTS.md). The Render blueprint currently describes only the static web app; an API service must not be added until Aun's backend exists and its deployment contract is known. diff --git a/docs/VALIDATION_PLAN.md b/docs/VALIDATION_PLAN.md new file mode 100644 index 0000000..1291aa9 --- /dev/null +++ b/docs/VALIDATION_PLAN.md @@ -0,0 +1,56 @@ +# Validation plan + +Tests must distinguish fixtures, real provider smoke tests and end-to-end checks. +Only the latter two establish external integration. No network in unit tests. + +## Scenarios + +| Cause | Distinguishing evidence | Expected template | +| --- | --- | --- | +| normal | ordinary peaks and isolated noise | none | +| uplink_congestion | high utilization, outside targets bad, gateway healthy | priority_queue | +| heavy_user | observed individual subscriber dominates traffic | queue_limit | +| upstream_degradation | external targets bad, local utilization normal | none | +| game_route_issue | only game target degrades | none | +| wireless_interference | evidence localized to a backhaul | none | +| uplink_down | primary fails, configured backup exists | failover_route | +| dns_slow | measured DNS resolution slow, other connectivity healthy | dns_servers | + +An uplink failure without a backup must never invent backup route parameters. +Heavy-user fix parameters must come from observed subscriber telemetry, not labels. + +## Required cases + +- Simulator: reproducibility, physical ranges/units, UTC and PK hour boundaries, + cadence/site isolation, overlaps, repeat-safe loads and time-correct replay. +- RIPE: complete packet loss, malformed/missing RTT values, bounded pagination, + cache hits, timeouts, rate limits and provenance. +- Detector: empty/sparse/out-of-order windows, total loss, missing interfaces, + insufficient history, cold starts, provider failures, finite bounded confidence, + ordered quantiles and strictly past-only features/training/forecasts. +- Evaluate 80 held-out cases (10 per cause including normal); split entire + incidents, seeds and time windows. Freeze thresholds on validation, not tests. +- Retrieval: correct top-three result for four fix topics; repeat-safe indexing; + dimension/model mismatch; missing database/model; official source attribution. +- Notifications: MP3 in English/Urdu, missing keys, timeout/rate limit, malformed + search results and unavailable checks distinct from confirmed no outage. +- UI: mobile layout; loading/empty/error states; approval/rejection confirmation; + duplicate clicks; failed CHR check; request errors; unavailable voice; + reconnect/refetch and duplicate SSE events; live mode must not fall back to mocks. +- Integration: inject -> detect -> investigate -> CHR check -> approve/reject -> + resolved/rolled_back. Verify workflow rejection and expiry with Aun. +- Deployment: HTTPS, deep links, replay disclosure, restart recovery, isolated + public demo actions and a visitor walkthrough. + +## Release targets + +- Every controlled scenario detected during a seven-day scenario run. +- Held-out event precision and recall >= 90%; sustained-event delay <= 3 minutes. +- <= 1 false alert/site/day in a normal-only run. +- Warm detector p95 < 5 seconds/site for every mode claimed as supported. +- Correct runbook page within top three for every fix topic. +- Every actionable fix has valid params and a passing CHR check before approval. + +Record actual counts, denominators, configuration, model/checkpoint identities, +hardware, cold/warm timing and unavailable checks in result reports. A passing +mock test cannot satisfy a database, provider, router or deployment gate. diff --git a/docs/WORKSTREAM_B_PLAN.md b/docs/WORKSTREAM_B_PLAN.md new file mode 100644 index 0000000..a636837 --- /dev/null +++ b/docs/WORKSTREAM_B_PLAN.md @@ -0,0 +1,87 @@ +# Workstream B implementation plan + +Approved 2026-10-18. Workstream B includes B1-B9 and B11; Tinker is excluded. +The supplied brief is preserved in PARTNER_PLAN.md. Aun owns core, API, agent, +workflows, collector, migrations and router infrastructure. Their merged code is +the source of truth. Never create replacement shared schemas or Settings. + +## Delivery and ownership + +Use short `b/` branches created before editing, isolated worktrees for +concurrent workers, and tested PRs for Aun to review and merge. The lead reviews, +integrates, manages shared manifests/lockfiles and reports actual validation. +Coding workers use `gpt-6-luna` with medium reasoning, at most three concurrently. +Every worker records its files, commands, results, decisions and blockers in a +handoff. Exact 60% compaction is controlled by the host; use token thresholds +where supported and persist handoffs regardless. + +## Prerequisites and contracts + +- Python 3.12, uv, Node LTS, Entire Codex hooks, GitHub authentication. +- Tailscale/Ollama/database/third-party setup may remain pending while independent + modules and serialized fixtures are built. Secrets never enter source control. +- Aun supplies core plus subscriber traffic/IP evidence, DNS resolution timing, + target/interface roles, backup topology, forecast write/upsert ownership, + replay/injection lifecycle and Settings/API/SSE/voice failure contracts. +- Require those additions before claiming affected features work. Never infer + subscriber IPs or causes from evaluation labels. +- Free tiers and credits only; no purchase or paid upgrade is authorized. + +## Implementation + +1. G0: initialize tooling/instructions, preserve brief, document contracts and + fixture mode. Enable Entire before the first implementation commit. +2. Data/simulator: discover RIPE Pakistan probes/measurements; bounded cached + downloads; correct RTT/jitter/loss; calibration with provenance; three sites; + daily/weekend demand and seven incident scenarios; deterministic Parquet and + labels; load/replay/inject/held-out-case CLIs. Raw/generated data stays ignored. + Live playback uses wall-clock timing; accelerated offline playback explicitly + advances a virtual clock. Do not leak future observations into live windows. +3. G1: valid deterministic scenarios and repeat-safe persistence; current metrics + appear within seconds of injection when the replay runtime is active. +4. Detector: past-only one-minute lag/rolling/calendar/utilization features; + TabPFN 3.5 cloud/local regression quantiles for 1-5 minutes, unsupervised + scoring, cause classification. Bound contexts, cache fits and batch requests. + Normalize scores on validation data; freeze thresholds before held-out tests. + Compare observations only to forecasts created earlier. Persist forecasts once. + Inference failures are unavailable, never healthy or silently mocked. +5. Retrieval: official RouterOS sources and headings, 300-500-word chunks, + EmbeddingGemma through Ollama, pgvector, source URLs and top-k search. Verify + 768 dimensions and matching model identity. Vector search first; hybrid optional. +6. Notifications: ElevenLabs English/Urdu MP3, short alerts, SerpApi recent + provider/target outage search. Finite deadlines and explicit unavailable states. +7. G2: offline module tests pass; actual service smoke results reported separately. +8. Dashboard: Next.js App Router/TypeScript/Tailwind/shadcn/Recharts; Overview, + Incidents, Incident Detail, Demo Panel; Settings waits for a backend interface. + Responsive dark UI with Pakistan times, forecast bands, evidence, commands, + rollback, CHR results, voice and timeline. Fixture/live transports share one + interface. Generate API types from Aun's OpenAPI. SSE reconnect/refetch and + duplicate-event handling. Confirm decisions and prevent duplicate submissions; + commands are applied only when the API confirms the corresponding state. +9. Hosting/CI: Render UI and Aun's demo API, HTTPS/domain, persistent replay + disclosure and recorded reports from real runs. Public actions only affect + demo resources. Ruff/pytest/frontend checks/browser flow CI. CHR workflow runs + Aun's harness on a pinned image with readiness polling, logs and VM cleanup; + absent infrastructure is pending, never a fabricated router pass. +10. G3: phone-width live approval flow passes on Aun's host; hosted replay demo + works; CI evidence exists. External accounts/contracts remain explicit gates. +11. Evaluation: 80 held-out cases, ten per cause including normal, independent + training/validation/test seeds/time windows. Report detection and agent cause, + template, params, CHR success and latency; missing metrics remain unavailable. +12. G4: post drafts include verified data provenance, target customer, open-model + benefits/limits, demo guide and actual user feedback. Never invent users, + measurements, sessions, report provenance or deployment claims. + +## Integrations + +Tiger MCP supports database inspection after Aun provisions it; app access uses +psycopg. TabPFN MCP supports experiments; runtime uses Python adapters. Use the +official Sentry Codex plugin for frontend monitoring and RouterOS QEMU skill for +CI. Authentication and a successful call are required before calling an MCP +connected. Keep Aun's private model/router services private. + +## Deadline and fallback + +Target 2026-10-19 10:00 Asia/Karachi; official submission deadline 11:59. +Defer Settings and hybrid search if necessary; retain saved-report hosting. +Do not cut meaningful validation, the incident walkthrough or post drafts. diff --git a/docs/post/notes.md b/docs/post/notes.md new file mode 100644 index 0000000..a167abe --- /dev/null +++ b/docs/post/notes.md @@ -0,0 +1,19 @@ +# Post research notes + +Keep only findings backed by a source, a reproducible run, or a clearly labeled team observation. Record the date, method, and limits with each result. Do not invent performance numbers, customer feedback, first users, or claims that the hosted demo is live. + +## Evidence log + +- 2026-10-18: Build plan identifies small WISPs, gaming cafes, and freelance network engineers as intended users. This is a target audience, not evidence of a customer interview or first user. +- 2026-10-18: The planned hosted demo uses replayed/simulated data. Any published demo must label that data clearly. +- Pending: measured detector evaluation, model/runtime details, real baseline provenance, first-user feedback, and hosted demo URL/status. + +## Draft post outline + +NetCortex is being built for small network operators who need an affordable way to spot deteriorating links and review a tested RouterOS fix. The intended flow collects or replays network metrics, detects unusual behavior, explains the evidence, tests a constrained fix on a virtual router, and waits for a human decision. + +Open-weight local inference is intended to keep network context on-site, support diagnosis during internet outages, and avoid per-token charges for the core workflow. These are design goals; claims about measured privacy, reliability, cost, or accuracy require implementation and evidence. + +The hosted demo is planned to use simulated/replayed telemetry. TabPFN cloud sends anonymized metrics to its provider and its current license terms may restrict commercial use; verify the applicable terms before making product claims. Cloud voice and outage-search integrations are optional and may require paid credentials. + +Before publication, replace this draft with verified implementation details, evaluation results, limitations, a working demo link if available, and an actual first-user account only if one exists and consents to being described. diff --git a/docs/progress/bootstrap.md b/docs/progress/bootstrap.md new file mode 100644 index 0000000..8ab3f11 --- /dev/null +++ b/docs/progress/bootstrap.md @@ -0,0 +1,9 @@ +# Bootstrap progress + +Date: 2026-10-18 + +Root tooling and partner-owned documentation scaffolding are in place. The Python workspace declares the four planned Workstream B distributions and requires Python 3.12. Package directories are being developed by parallel workers, so lock generation is intentionally deferred to the workstream lead. + +Integration gates still open: Aun's actual core distribution name and shared schemas, Settings/API/SSE contracts, subscriber telemetry and role policy, forecast key/writer semantics, injection lifecycle, and the CHR test harness. CI calls the real harness when it appears and marks its absence as pending rather than claiming router coverage. + +The Render blueprint includes only the static web app. The API remains a pending deployment integration. No user, evaluation, or live deployment claims have been fabricated in the post notes. diff --git a/flow.md b/flow.md new file mode 100644 index 0000000..340049a --- /dev/null +++ b/flow.md @@ -0,0 +1,78 @@ +# NetCortex: entry points, connections and exits + +This map distinguishes the partner's code from Aun's pending shared runtime. +Package `flow.md` files give exact implementation-level names and examples. +This document is updated as each component is integrated. + +```mermaid +flowchart TD + R[RIPE Atlas public API] --> S[Partner: simulator / calibration] + S --> P[Ignored Parquet datasets + evaluation cases] + S --> DB[(Aun: shared database contract)] + C[Aun: live collector] --> DB + DB --> W[Aun: monitor workflow] + W --> D[Partner: detect] + D --> F[Forecasts + detection evidence] + F --> A[Aun: investigate agent] + A --> K[Partner: search_runbook] + MD[Official MikroTik documentation] --> K + O[Ollama EmbeddingGemma] --> K + K <--> DB + A --> N[Partner: check_news] + N --> SE[SerpApi] + A --> X[Aun: template checker / isolated CHR] + X --> API[Aun: FastAPI + SSE] + A --> V[Partner: speak] + V --> EL[ElevenLabs MP3] + EL --> API + API <--> UI[Partner: Next.js dashboard] + UI --> Q{Human decision} + Q -->|approve| IW[Aun: incident workflow] + Q -->|reject| REJ[Rejected; no router apply] + IW --> VERIFY[Apply on demo CHR and verify] + VERIFY --> END[Resolved or rolled back] + END --> API +``` + +## Entry and exit points + +| Entry | Inputs | Connection / processing | Exit | +| --- | --- | --- | --- | +| `simgen ripe` | requested days, cache location | Discover PK probes/measurements; bounded RIPE downloads | Local raw dataset with source provenance; error on unavailable API | +| `simgen calibrate` | real baseline rows | Group baseline statistics by target role and local hour | Calibration file with coverage/default status | +| `simgen generate` | days, seed, scenario configuration | Seeded demand/noise and incident transforms | Probe/interface Parquet plus separate expected labels | +| `simgen replay` / `inject` | site, cause, duration, seed | Active simulator runtime; DB writes need Aun's keys/runtime agreement | Current metrics and scenario label; explicit missing-runtime/contract failure | +| `detect(site_id, window, history)` | observed shared MetricsWindow | Lag features -> TabPFN forecasts/anomaly/cause | Shared DetectionResult and approved forecast writes, or unavailable error | +| `search_runbook(query, k)` | question and result count | Ollama query embedding -> pgvector retrieval | Shared RunbookChunk objects with source URLs | +| `speak(text, lang)` | short text, en/ur | ElevenLabs with finite deadlines | MP3 bytes; empty bytes when audio unavailable | +| `check_news(provider, target)` | upstream provider/target | Recent SerpApi search | Shared NewsCheck with links; explicit unavailable summary on failure | +| Dashboard navigation | site/incident selection | Fixture transport or Aun's HTTP API | Rendered status/evidence, loading state or visible error | +| Dashboard decision | confirmed approve/reject | POST to Aun; workflow owns subsequent state | Acknowledged decision, followed by SSE/refetch; no assumed live success | +| Evaluation runner | held-out case directory and mode | Detector, then Aun's agent/checker when available | Markdown/structured results with actual measurements and pending gates | + +## HTTP boundary owned by Aun + +The draft API exposes `GET /sites`, `/metrics`, `/incidents`, +`/incidents/{id}`, `/incidents/{id}/voice`, `GET /stream`, +`POST /incidents/{id}/approve`, `/incidents/{id}/reject`, and +`POST /demo/scenarios`. Actual response types must come from Aun's OpenAPI. +SSE event names are `metric`, `incident.opened`, `incident.updated`, `fix.tested` +and `fix.applied`. Reconnect must refresh state; repeated event IDs must not +repeat effects. Settings reads/writes are a pending contract. + +## Fixture and live exits + +Fixture mode uses explicitly simulated data and transitions and displays +"Demo: replayed data". It does not apply router commands or establish provider, +model or API integration. Live mode reports a failed dependency instead of +switching to fixture data. Approval requires a valid actionable plan with a +passing CHR check and an appropriate incident state. + +## Hosting and validation boundary + +Render runs the dashboard's Node/Next.js server. Aun supplies the API service; +the browser does not hold database or provider secrets. Sentry receives optional +frontend monitoring when configured. CI checks offline Python/frontend behavior; +the separate CHR workflow can establish router validity only when Aun's actual +boot/test harness runs successfully. External authentication is setup, not an +automatic claim of a working connection. diff --git a/infra/render/render.yaml b/infra/render/render.yaml new file mode 100644 index 0000000..67bcb57 --- /dev/null +++ b/infra/render/render.yaml @@ -0,0 +1,16 @@ +# Hosted demo blueprint. The Next.js UI runs as a Node web service. +# Add an API service only after Aun's backend and deployment contract are available. +services: + - type: web + name: netcortex-demo + runtime: node + rootDir: apps/web + buildCommand: npm ci && npm run build + startCommand: npm run start -- --hostname 0.0.0.0 --port $PORT + healthCheckPath: / + envVars: + - key: NODE_VERSION + value: "22" + - key: NEXT_PUBLIC_API_MODE + value: mock + # Set API URLs and rebuild only after Aun's service contract is confirmed. From ae184cd483941edf6f4dc2ede250dc042519ec89 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 17:59:06 +0500 Subject: [PATCH 02/21] feat: add RouterOS runbook and fail-safe notification adapters --- docs/progress/retrieval_notify.md | 43 ++ packages/notify/README.md | 9 + packages/notify/decision.md | 11 + packages/notify/flow.md | 31 ++ packages/notify/pyproject.toml | 19 + .../notify/src/netcortex_notify/__init__.py | 5 + packages/notify/src/netcortex_notify/cli.py | 38 ++ .../notify/src/netcortex_notify/service.py | 282 +++++++++++++ packages/notify/tests/test_notify.py | 183 +++++++++ packages/runbook/README.md | 9 + packages/runbook/decision.md | 11 + packages/runbook/flow.md | 30 ++ packages/runbook/pyproject.toml | 19 + .../runbook/src/netcortex_runbook/__init__.py | 5 + packages/runbook/src/netcortex_runbook/cli.py | 44 +++ .../runbook/src/netcortex_runbook/service.py | 370 ++++++++++++++++++ packages/runbook/tests/test_runbook.py | 164 ++++++++ 17 files changed, 1273 insertions(+) create mode 100644 docs/progress/retrieval_notify.md create mode 100644 packages/notify/README.md create mode 100644 packages/notify/decision.md create mode 100644 packages/notify/flow.md create mode 100644 packages/notify/pyproject.toml create mode 100644 packages/notify/src/netcortex_notify/__init__.py create mode 100644 packages/notify/src/netcortex_notify/cli.py create mode 100644 packages/notify/src/netcortex_notify/service.py create mode 100644 packages/notify/tests/test_notify.py create mode 100644 packages/runbook/README.md create mode 100644 packages/runbook/decision.md create mode 100644 packages/runbook/flow.md create mode 100644 packages/runbook/pyproject.toml create mode 100644 packages/runbook/src/netcortex_runbook/__init__.py create mode 100644 packages/runbook/src/netcortex_runbook/cli.py create mode 100644 packages/runbook/src/netcortex_runbook/service.py create mode 100644 packages/runbook/tests/test_runbook.py diff --git a/docs/progress/retrieval_notify.md b/docs/progress/retrieval_notify.md new file mode 100644 index 0000000..9819d4a --- /dev/null +++ b/docs/progress/retrieval_notify.md @@ -0,0 +1,43 @@ +# B4/B5 runbook and notifications handoff + +## Owned files delivered + +- `packages/runbook/`: hatchling package `netcortex-runbook` / `netcortex_runbook`, official-doc ingestion, vector search adapter, fixture CLI, unit tests, README, decision guide, and flow guide. +- `packages/notify/`: hatchling package `netcortex-notify` / `netcortex_notify`, ElevenLabs and SerpApi helpers, unavailable-only fixture CLI, unit tests, README, decision guide, and flow guide. +- This handoff. + +No core schema, Settings, root manifest, lockfile, or other team-owned file was changed. No credentials, live embedding calls, database writes, TTS calls, or SerpApi calls were used. + +## Checks run + +Command: + +```powershell +python -m uv run --with-editable packages/runbook --with-editable packages/notify --with pytest pytest packages/runbook/tests packages/notify/tests +``` + +Result: **18 passed** on Python 3.12.0. These are offline unit tests using `httpx.MockTransport` and fixture data. Coverage includes four fixture topics with source metadata plus a canonical six-page allowlist/crawl-delay policy test, chunk boundaries, EmbeddingGemma identity/dimension/non-finite values, robots denial, model-specific idempotent persistence, body deadline, voice language/word validation, MP3 response, output-format query, voice rate limit and public failure handling, absent credentials, malformed news payloads, unsafe links, date filtering, outage relevance, and SerpApi rate limit/timeout. + +The smoke CLIs were run: + +```powershell +python -m uv run --with-editable packages/runbook runbook fixture "failover default route" --mock +python -m uv run --with-editable packages/notify notify speak "Uplink is degraded" --lang ur --mock +python -m uv run --with-editable packages/notify notify news ExampleISP game-server --mock +``` + +Runbook returned source-linked `fixture=true` excerpts with source titles and retrieval date. Notification fixtures returned unavailable outputs and made no provider calls. + +Ruff formatting and checks passed against `C:\Users\nigga\Documents\NetCortex\pyproject.toml` (Python 3.12, E/F/I/UP/B rules, 100-character lines). `git diff --check` passed. `uv build --wheel` built both distributions successfully. The ignored wheel outputs remain under each package's `.build-check` folder because cleanup commands were blocked by the execution policy. + +## Decisions and live gates + +- Official RouterOS sources are restricted to six canonical `help.mikrotik.com` pages: queues, route, failover, DNS, mangle, and interface stats/traffic. A one-time live source validation on 2026-10-18 got `robots.txt` HTTP 200 with `Crawl-delay: 5`; all six canonical pages returned HTTP 200 with expected titles. The indexer reads robots once, checks each URL, and honors its parsed delay between page fetches. The page fetches were not retained as a raw corpus. Responses stream with a 2 MB cap and finite HTTP timeouts. +- No Ollama tag is guessed. The shared configured value must be a full `embeddinggemma:`; responses are checked for exact identity and 768 finite dimensions. Aun still must confirm the shared tag and Settings fields before public search can use `netcortex_core`. +- Chunking targets 400 words, accepts a target from 300 through 500, balances page remainder, and preserves headings in section metadata. Source pages were validated but no raw corpus was retained. +- Existing `runbook_chunks` schema has no content uniqueness key. Indexing therefore takes a PostgreSQL transaction advisory lock and selects by source/title/section/text/model before inserting; the schema is not changed. A model change keeps a distinct embedding row. The database write path has not been exercised against PostgreSQL. +- Vector-only pgvector cosine search returns Aun's `RunbookChunk` objects and source URLs. Search quality is not measured until the shared DB/model is available. +- ElevenLabs `eleven_v3` was chosen because its current official model docs list Urdu; `eleven_multilingual_v2` does not support the API language-code parameter. MP3 format is an API query parameter. SerpApi Google search uses `tbs=qdr:d`; result dates, relevant outage wording, and HTTP(S) URLs are checked. These API/model choices are recorded in package docs. +- Public functions are contract-gated: `search_runbook` needs core `Settings` and `RunbookChunk`; `speak` needs core `Settings`; `check_news` needs core `Settings`, `NewsCheck`, and `NewsItem`. Internal functions support passed config and injected clients. There are no copied shared types or alternate Settings classes. + +Pending before integration claims: Aun publishes the core package/schema/settings fields and confirms the EmbeddingGemma tag; a real test database and Ollama host are available; run ingestion twice and verify idempotence; run all four retrieval topics and verify correct top-three hits; test real Urdu/English MP3 playback and SerpApi known/empty/error cases. No external integration or real retrieval/voice/news pass is claimed. diff --git a/packages/notify/README.md b/packages/notify/README.md new file mode 100644 index 0000000..65e9f9a --- /dev/null +++ b/packages/notify/README.md @@ -0,0 +1,9 @@ +# netcortex-notify + +` speak(text, lang)` generates a short MP3 through ElevenLabs `eleven_v3`, which lists Urdu support. ElevenLabs documents that `eleven_multilingual_v2` does not support `language_code`, so it is not selected. Missing voice credentials return empty bytes to represent unavailable voice; HTTP failures and rate limits remain errors. + +`check_news(provider, target)` uses SerpApi Google search with `tbs=qdr:d`, then validates result shape, relative/ISO dates, and safe HTTP(S) URLs. A failed lookup produces `available: false` explicitly and never claims there was no outage. The public functions await Aun's `netcortex_core.Settings` and `NewsCheck` contract. Internal helpers accept passed credentials and are usable offline without shadow settings. + +Fixture examples: `python -m netcortex_notify.cli speak "Uplink is degraded" --lang en --mock` and `python -m netcortex_notify.cli news ExampleISP game-server --mock`. They only report unavailable fixtures and make no network requests. `live-speak` and `live-news` invoke the public core-gated functions. + +Live smoke steps: configure test credentials through the eventual core Settings, make one short English and one Urdu alert and verify MP3 playback, then query a known provider and target. Exercise missing keys and rate limits separately. No live credentials or external calls were used on this branch. diff --git a/packages/notify/decision.md b/packages/notify/decision.md new file mode 100644 index 0000000..b4d07e5 --- /dev/null +++ b/packages/notify/decision.md @@ -0,0 +1,11 @@ +# Notification design decisions + +Voice uses ElevenLabs' HTTP text-to-speech endpoint with `eleven_v3`. Current official model documentation lists Urdu for v3; the API reference says `language_code` is unsupported by `eleven_multilingual_v2`, so v2 is not selected. The MP3 `output_format` is an endpoint query parameter. English and Urdu are the only accepted language values, and alerts are limited to 40 words. + +Missing voice credentials produce empty bytes. Provider timeouts, HTTP failures, rate limits, and malformed audio are logged by exception class only and produce empty bytes in the public `speak()` wrapper so an incident alert does not wait on voice. Input validation and missing shared Settings remain explicit errors. The internal adapter retains provider errors so tests and callers can inspect them. + +SerpApi Google Search uses `tbs=qdr:d`; returned relative or ISO dates are checked against a 24-hour window. A result must have an absolute HTTP(S) URL without embedded credentials. Recent results alone do not assert an outage: text must mention a supplied provider or target and contain outage language. Search text remains untrusted evidence and the summary asks the operator to verify. No HTML or result content is fetched. + +Missing news credentials, timeout, rate limit, provider/API error, malformed JSON, or malformed result structure returns an explicit unavailable summary. A valid search with no qualifying recent links is a successful check with a distinct no-reports summary. The shared draft `NewsCheck` carries `outage_reported`, `summary`, and `items`; unavailable state is spelled out in the summary while `outage_reported` remains false. + +Internal adapters accept explicit credentials and injected `httpx.Client` instances. Public functions read only the eventual `netcortex_core.Settings` and return Aun's shared schemas. There is no package-local Settings class or environment-variable fallback. Fixture commands make no HTTP calls and cannot claim real provider results. diff --git a/packages/notify/flow.md b/packages/notify/flow.md new file mode 100644 index 0000000..cb451ab --- /dev/null +++ b/packages/notify/flow.md @@ -0,0 +1,31 @@ +# Notification execution flow + +## Entry points + +- `python -m netcortex_notify.cli speak "Uplink is degraded" --lang en --mock` runs the offline unavailable-voice fixture. +- `python -m netcortex_notify.cli news ExampleISP game-server --mock` runs the offline unavailable-news fixture. +- `netcortex_notify.speak(text, lang)` is the public live voice function; it awaits `netcortex_core.Settings` fields `elevenlabs_api_key` and `elevenlabs_voice_id`. +- `netcortex_notify.check_news(provider, target)` is the public live search function; it awaits `Settings.serpapi_api_key` and core `NewsCheck` and `NewsItem` exports. +- Internal `_speak` and `_check_news` accept explicit credentials and optional injected `httpx.Client`; tests use `httpx.MockTransport` and do not access a network. + +## Voice path + +```mermaid +flowchart TD + A[text + en/ur] --> B{1-40 words?} + B -->|No| C[ValueError] + B -->|Yes| D{Key and voice ID?} + D -->|No| E[Return empty bytes: unavailable] + D -->|Yes| F[POST api.elevenlabs.io/v1/text-to-speech/{voice_id}] + F --> G[eleven_v3 + language_code + MP3 format] + G --> H[HTTP/status/content validation] + H --> I[MP3 bytes] +``` + +The call uses finite connection and per-operation timeouts plus a 12-second response-body deadline and 1 MB body cap, with no automatic retry or redirects. MP3 format is sent as the endpoint's `output_format` query parameter. The public wrapper catches provider/time-limit/audio-response failures, logs only the exception class, and returns empty bytes so alerts do not block an incident. Invalid caller inputs and missing core Settings still fail explicitly. The fixture path supplies no keys and sends no HTTP request. + +## News path + +The helper accepts optional provider and target values; both absent returns an unavailable result without a request. Otherwise it calls `https://serpapi.com/search.json` with Google engine, available query terms, `tbs=qdr:d`, and the passed API key. The key is sent as a request parameter per SerpApi's API contract and must never be logged. Result items are parsed defensively from a streamed response capped at 1 MB with an 8-second body deadline and finite connection/per-operation timeouts. Only recent (relative or ISO) dates and absolute safe HTTP(S) URLs survive. Up to five items are returned with title, URL, and published date. `outage_reported` requires supplied provider/target text and outage wording; recent dates alone do not assert an outage. Valid zero results produce a successful no-reports summary; any unavailable or malformed call returns `available=false` internally and an explicit unavailable summary. Public output is constructed from Aun's actual core `NewsItem` and `NewsCheck` types; no local schema is defined. + +Core imports are delayed until the public live entry point is called. Until the shared package and field names are published, those functions raise a clear `RuntimeError`. Fixture CLI outputs are dictionaries, visibly marked as fixture/unavailable, and never claim a provider was checked or an outage was confirmed. diff --git a/packages/notify/pyproject.toml b/packages/notify/pyproject.toml new file mode 100644 index 0000000..a5c83e2 --- /dev/null +++ b/packages/notify/pyproject.toml @@ -0,0 +1,19 @@ +[build-system] +requires = ["hatchling>=1.27,<2"] +build-backend = "hatchling.build" + +[project] +name = "netcortex-notify" +version = "0.1.0" +description = "Voice alerts and upstream outage checks for NetCortex" +requires-python = ">=3.12,<3.13" +dependencies = ["httpx>=0.27,<1"] + +[project.optional-dependencies] +test = ["pytest>=8,<9"] + +[project.scripts] +notify = "netcortex_notify.cli:main" + +[tool.hatch.build.targets.wheel] +packages = ["src/netcortex_notify"] diff --git a/packages/notify/src/netcortex_notify/__init__.py b/packages/notify/src/netcortex_notify/__init__.py new file mode 100644 index 0000000..0111c78 --- /dev/null +++ b/packages/notify/src/netcortex_notify/__init__.py @@ -0,0 +1,5 @@ +"""Voice and upstream-news helpers.""" + +from .service import check_news, speak + +__all__ = ["check_news", "speak"] diff --git a/packages/notify/src/netcortex_notify/cli.py b/packages/notify/src/netcortex_notify/cli.py new file mode 100644 index 0000000..53ab070 --- /dev/null +++ b/packages/notify/src/netcortex_notify/cli.py @@ -0,0 +1,38 @@ +import argparse +import json + +from .service import _check_news, _speak, check_news, speak + + +def main() -> None: + parser = argparse.ArgumentParser(description="Offline-safe notification fixture CLI") + sub = parser.add_subparsers(dest="command", required=True) + voice = sub.add_parser("speak") + voice.add_argument("text") + voice.add_argument("--lang", choices=["en", "ur"], default="en") + voice.add_argument("--mock", action="store_true", required=True) + news = sub.add_parser("news") + news.add_argument("provider", nargs="?") + news.add_argument("target", nargs="?") + news.add_argument("--mock", action="store_true", required=True) + live_voice = sub.add_parser("live-speak") + live_voice.add_argument("text") + live_voice.add_argument("--lang", choices=["en", "ur"], default="en") + live_news = sub.add_parser("live-news") + live_news.add_argument("provider", nargs="?") + live_news.add_argument("target", nargs="?") + args = parser.parse_args() + if args.command == "speak": + data = _speak(args.text, args.lang, api_key=None, voice_id=None) + print(json.dumps({"available": bool(data), "fixture": True, "bytes": len(data)})) + elif args.command == "news": + print(json.dumps(_check_news(args.provider, args.target, api_key=None), indent=2)) + elif args.command == "live-speak": + data = speak(args.text, args.lang) + print(json.dumps({"available": bool(data), "bytes": len(data)})) + else: + print(check_news(args.provider, args.target).model_dump_json(indent=2)) + + +if __name__ == "__main__": + main() diff --git a/packages/notify/src/netcortex_notify/service.py b/packages/notify/src/netcortex_notify/service.py new file mode 100644 index 0000000..59f3249 --- /dev/null +++ b/packages/notify/src/netcortex_notify/service.py @@ -0,0 +1,282 @@ +from __future__ import annotations + +import json +import logging +import re +import time +from datetime import UTC, datetime, timedelta +from typing import TYPE_CHECKING, Any +from urllib.parse import urlparse + +import httpx + +if TYPE_CHECKING: + from netcortex_core import NewsCheck # type: ignore[import-not-found] + +VOICE_MODEL = "eleven_v3" # official docs list Urdu for v3; multilingual_v2 lacks Urdu support +ELEVEN_URL = "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}" +SERP_URL = "https://serpapi.com/search.json" +logger = logging.getLogger(__name__) + + +def _read_body(response: httpx.Response, *, max_bytes: int, total_seconds: float) -> bytes: + started = time.monotonic() + body = bytearray() + for part in response.iter_bytes(): + body.extend(part) + if len(body) > max_bytes: + raise RuntimeError("provider response exceeded its size limit") + if time.monotonic() - started > total_seconds: + raise httpx.TimeoutException("provider response exceeded its total deadline") + return bytes(body) + + +def _load_settings() -> Any: + try: + from netcortex_core import Settings # type: ignore[import-not-found] + except ImportError as exc: + raise RuntimeError( + "live notification calls require Aun's published netcortex_core.Settings" + ) from exc + return Settings() + + +def _speak( + text: str, + lang: str, + *, + api_key: str | None, + voice_id: str | None, + client: httpx.Client | None = None, +) -> bytes: + if lang not in {"en", "ur"}: + raise ValueError("lang must be 'en' or 'ur'") + if not text.strip() or len(text.split()) > 40: + raise ValueError("voice alert must contain 1..40 words") + if not api_key or not voice_id: + return b"" + own = client is None + client = client or httpx.Client(timeout=httpx.Timeout(3, connect=2), follow_redirects=False) + try: + with client.stream( + "POST", + ELEVEN_URL.format(voice_id=voice_id), + params={"output_format": "mp3_44100_128"}, + headers={ + "xi-api-key": api_key, + "Accept": "audio/mpeg", + "Content-Type": "application/json", + }, + json={ + "text": text, + "model_id": VOICE_MODEL, + "language_code": "ur" if lang == "ur" else "en", + }, + ) as response: + if response.status_code == 429: + raise RuntimeError("ElevenLabs rate limit; voice is unavailable") + response.raise_for_status() + content_type = response.headers.get("content-type", "").lower() + if content_type and "audio/" not in content_type and "octet-stream" not in content_type: + raise RuntimeError("ElevenLabs returned a non-audio response") + audio = _read_body(response, max_bytes=1_000_000, total_seconds=12) + if not audio: + raise RuntimeError("ElevenLabs returned an empty audio response") + return audio + finally: + if own: + client.close() + + +def speak(text: str, lang: str) -> bytes: + """Return MP3 bytes; an unconfigured voice service is safely unavailable as b''.""" + settings = _load_settings() + try: + return _speak( + text, lang, api_key=settings.elevenlabs_api_key, voice_id=settings.elevenlabs_voice_id + ) + except (httpx.HTTPError, RuntimeError) as exc: + logger.warning("ElevenLabs voice unavailable (%s)", type(exc).__name__) + return b"" + + +def _safe_url(value: Any) -> str | None: + if not isinstance(value, str): + return None + parsed = urlparse(value) + if ( + parsed.scheme not in {"http", "https"} + or not parsed.hostname + or parsed.username + or parsed.password + ): + return None + return value + + +def _recent_date(value: Any, now: datetime) -> bool: + if not isinstance(value, str) or not value.strip(): + return False + # SerpApi commonly gives relative labels; accept explicit recent durations and ISO dates. + text = value.strip().lower() + if text in { + "today", + "1 hour ago", + "2 hours ago", + "3 hours ago", + "4 hours ago", + "5 hours ago", + "6 hours ago", + "12 hours ago", + }: + return True + try: + parsed = datetime.fromisoformat(text.replace("z", "+00:00")) + if parsed.tzinfo is None: + parsed = parsed.replace(tzinfo=UTC) + return now - timedelta(hours=24) <= parsed.astimezone(UTC) <= now + timedelta(minutes=5) + except ValueError: + pass + match = re.fullmatch(r"(\d+)\s*(minute|hour|day)s?\s+ago", text) + if match: + amount = int(match.group(1)) + return ( + (match.group(2) == "minute" and amount <= 1440) + or (match.group(2) == "hour" and amount <= 24) + or (match.group(2) == "day" and amount == 1) + ) + return False + + +def _check_news( + provider: str | None, + target: str | None, + *, + api_key: str | None, + client: httpx.Client | None = None, + now: datetime | None = None, +) -> dict[str, Any]: + provider = (provider or "").strip() + target = (target or "").strip() + if not provider and not target: + return { + "available": False, + "summary": "Upstream outage check unavailable: no provider or target was supplied.", + "links": [], + } + if not api_key: + return { + "available": False, + "summary": "Upstream outage check unavailable: SerpApi key is not configured.", + "links": [], + } + own = client is None + client = client or httpx.Client(timeout=httpx.Timeout(3, connect=2), follow_redirects=False) + try: + terms = " ".join(value for value in (provider, target) if value) + with client.stream( + "GET", + SERP_URL, + params={ + "engine": "google", + "q": f'"{terms}" outage', + "tbs": "qdr:d", + "api_key": api_key, + }, + ) as response: + if response.status_code == 429: + return { + "available": False, + "summary": "Upstream outage check unavailable: SerpApi rate limit.", + "links": [], + } + response.raise_for_status() + payload = json.loads(_read_body(response, max_bytes=1_000_000, total_seconds=8)) + if not isinstance(payload, dict) or payload.get("error"): + return { + "available": False, + "summary": "Upstream outage check unavailable: malformed search response.", + "links": [], + } + timestamp = now or datetime.now(UTC) + items = payload.get("news_results") or payload.get("organic_results") or [] + if not isinstance(items, list): + return { + "available": False, + "summary": "Upstream outage check unavailable: malformed search results.", + "links": [], + } + links: list[dict[str, str]] = [] + outage_reported = False + terms = [word.lower() for word in (provider, target) if word] + outage_pattern = re.compile( + r"\b(?:outages?|down|degraded|disruptions?|unavailable|failures?|incidents?|offline)\b" + ) + for item in items: + if not isinstance(item, dict) or not _recent_date(item.get("date"), timestamp): + continue + url = _safe_url(item.get("link")) + title = item.get("title") + if url and isinstance(title, str) and title.strip(): + links.append( + { + "title": title.strip()[:200], + "url": url, + "published": str(item.get("date", ""))[:100], + } + ) + snippet = str(item.get("snippet", "")) + description = f"{title} {snippet}".lower() + relevant = any(term in description for term in terms) + outage_reported = outage_reported or ( + relevant and bool(outage_pattern.search(description)) + ) + if links: + summary = ( + f"Recent outage-related reports may mention {terms}; " + "verify with the provider before treating this as an outage." + if outage_reported + else f"Recent search results mention {terms}, " + "but no relevant outage wording was found." + ) + return { + "available": True, + "outage_reported": outage_reported, + "summary": summary, + "links": links[:5], + } + return { + "available": True, + "outage_reported": False, + "summary": f"No qualifying outage reports found for {terms} in the past 24 hours.", + "links": [], + } + except (httpx.HTTPError, RuntimeError, ValueError): + return { + "available": False, + "summary": "Upstream outage check unavailable: search request failed or " + "returned invalid JSON.", + "links": [], + } + finally: + if own: + client.close() + + +def check_news(provider: str | None, target: str | None) -> NewsCheck: + """Search recent outage reports and return core NewsCheck once the shared contract exists.""" + settings = _load_settings() + result = _check_news(provider, target, api_key=settings.serpapi_api_key) + try: + from netcortex_core import NewsCheck, NewsItem # type: ignore[import-not-found] + except ImportError as exc: + raise RuntimeError( + "check_news requires Aun's published netcortex_core.NewsCheck and NewsItem contracts" + ) from exc + items = [ + NewsItem(title=item["title"], url=item["url"], published=item["published"]) + for item in result["links"] + ] + return NewsCheck( + outage_reported=result.get("outage_reported", False), summary=result["summary"], items=items + ) diff --git a/packages/notify/tests/test_notify.py b/packages/notify/tests/test_notify.py new file mode 100644 index 0000000..10f6a3b --- /dev/null +++ b/packages/notify/tests/test_notify.py @@ -0,0 +1,183 @@ +import sys +from datetime import UTC, datetime +from types import SimpleNamespace + +import httpx +import pytest +from netcortex_notify import service +from netcortex_notify.service import _check_news, _read_body, _recent_date, _safe_url, _speak + + +def test_speak_missing_keys_and_validation(): + assert _speak("alert", "en", api_key=None, voice_id=None) == b"" + with pytest.raises(ValueError): + _speak("hello", "fr", api_key=None, voice_id=None) + with pytest.raises(ValueError): + _speak("word " * 41, "en", api_key=None, voice_id=None) + + +def test_speak_validates_audio_and_propagates_rate_limit(): + def audio(request): + assert request.url.params["output_format"] == "mp3_44100_128" + return httpx.Response(200, headers={"content-type": "audio/mpeg"}, content=b"mp3") + + client = httpx.Client(transport=httpx.MockTransport(audio)) + assert _speak("short alert", "ur", api_key="test", voice_id="voice", client=client) == b"mp3" + client.close() + + +def test_speak_non_audio_timeout_and_public_failure_are_safe(monkeypatch): + client = httpx.Client( + transport=httpx.MockTransport( + lambda request: httpx.Response( + 200, headers={"content-type": "application/json"}, content=b"{}" + ) + ) + ) + with pytest.raises(RuntimeError, match="non-audio"): + _speak("short alert", "en", api_key="test", voice_id="voice", client=client) + client.close() + client = httpx.Client( + transport=httpx.MockTransport( + lambda request: (_ for _ in ()).throw(httpx.ReadTimeout("simulated")) + ) + ) + with pytest.raises(httpx.ReadTimeout): + _speak("short alert", "en", api_key="test", voice_id="voice", client=client) + client.close() + monkeypatch.setattr( + service, + "_load_settings", + lambda: SimpleNamespace(elevenlabs_api_key="test", elevenlabs_voice_id="voice"), + ) + monkeypatch.setattr( + service, + "_speak", + lambda *args, **kwargs: (_ for _ in ()).throw(httpx.ReadTimeout("simulated")), + ) + assert service.speak("short alert", "en") == b"" + + +def test_response_reader_enforces_total_deadline(monkeypatch): + ticks = iter([0.0, 2.0]) + monkeypatch.setattr(service.time, "monotonic", lambda: next(ticks)) + + class Response: + def iter_bytes(self): + yield b"piece" + + with pytest.raises(httpx.TimeoutException, match="total deadline"): + _read_body(Response(), max_bytes=100, total_seconds=1) + + +def test_news_does_not_flag_unrelated_or_non_outage_results(): + data = { + "news_results": [ + { + "title": "Unrelated story outage elsewhere", + "link": "https://news.example/a", + "date": "1 hour ago", + }, + { + "title": "ExampleISP service is degraded", + "link": "https://status.example/b", + "date": "1 hour ago", + }, + ] + } + client = httpx.Client( + transport=httpx.MockTransport(lambda request: httpx.Response(200, json=data)) + ) + result = _check_news("ExampleISP", "game", api_key="test", client=client) + assert result["outage_reported"] is True + client.close() + data["news_results"][1]["title"] = "ExampleISP launches new plans" + client = httpx.Client( + transport=httpx.MockTransport(lambda request: httpx.Response(200, json=data)) + ) + result = _check_news("ExampleISP", "game", api_key="test", client=client) + assert result["outage_reported"] is False + client.close() + client = httpx.Client(transport=httpx.MockTransport(lambda request: httpx.Response(429))) + with pytest.raises(RuntimeError, match="rate limit"): + _speak("short alert", "en", api_key="test", voice_id="voice", client=client) + client.close() + + +def test_news_timeout_is_unavailable(): + client = httpx.Client( + transport=httpx.MockTransport( + lambda request: (_ for _ in ()).throw(httpx.ReadTimeout("simulated")) + ) + ) + result = _check_news("isp", "target", api_key="test", client=client) + assert result["available"] is False + assert "unavailable" in result["summary"].lower() + client.close() + + +def test_news_missing_key_and_unsafe_urls_are_not_outages(): + assert _check_news("isp", "game", api_key=None)["available"] is False + assert _safe_url("javascript:alert(1)") is None + assert _safe_url("//evil.example") is None + assert _safe_url("https://example.com/outage") == "https://example.com/outage" + + +def test_public_check_news_preserves_unavailable_state(monkeypatch): + class NewsCheck: + def __init__(self, *, outage_reported, summary, items): + self.outage_reported = outage_reported + self.summary = summary + self.items = items + + class NewsItem: + def __init__(self, **fields): + self.fields = fields + + core = SimpleNamespace(NewsCheck=NewsCheck, NewsItem=NewsItem) + monkeypatch.setitem(sys.modules, "netcortex_core", core) + monkeypatch.setattr(service, "_load_settings", lambda: SimpleNamespace(serpapi_api_key=None)) + result = service.check_news("isp", None) + assert result.outage_reported is False + assert "unavailable" in result.summary.lower() + + +def test_recent_dates_and_malformed_search_response(): + now = datetime(2026, 10, 18, 12, tzinfo=UTC) + assert _recent_date("2 hours ago", now) + assert _recent_date("2026-10-18T01:00:00Z", now) + assert not _recent_date("3 days ago", now) + client = httpx.Client( + transport=httpx.MockTransport( + lambda request: httpx.Response(200, json={"organic_results": "bad"}) + ) + ) + assert _check_news("isp", "game", api_key="secret", client=client)["available"] is False + client.close() + + +def test_news_filters_malformed_items_and_relative_urls(): + data = { + "news_results": [ + {"title": "recent", "link": "https://status.example/a", "date": "1 hour ago"}, + {"title": "unsafe", "link": "javascript:evil", "date": "1 hour ago"}, + {"title": "old", "link": "https://status.example/old", "date": "3 days ago"}, + "bad", + ] + } + client = httpx.Client( + transport=httpx.MockTransport(lambda request: httpx.Response(200, json=data)) + ) + result = _check_news( + "isp", "target", api_key="secret", client=client, now=datetime(2026, 10, 18, 12, tzinfo=UTC) + ) + assert result["available"] is True + assert [x["title"] for x in result["links"]] == ["recent"] + client.close() + + +def test_news_rate_limit_is_unavailable(): + client = httpx.Client(transport=httpx.MockTransport(lambda request: httpx.Response(429))) + result = _check_news("isp", "target", api_key="secret", client=client) + assert result["available"] is False + client.close() diff --git a/packages/runbook/README.md b/packages/runbook/README.md new file mode 100644 index 0000000..c85def2 --- /dev/null +++ b/packages/runbook/README.md @@ -0,0 +1,9 @@ +# netcortex-runbook + +Official MikroTik RouterOS documentation ingestion and pgvector retrieval. The ingestion allowlist is limited to `help.mikrotik.com`, checks `robots.txt`, uses finite HTTP/database timeouts, caps downloads at 2 MB, and chunks source text with headings. The ingest transaction takes an advisory lock and checks approved content columns before inserting, because the shared schema has no natural uniqueness constraint. It does not change the shared schema. + +The exact Ollama model must be passed/configured as a full `embeddinggemma:` value. No default tag is guessed while Aun's shared tag decision is pending. Ingestion and search reject a different returned model and any embedding dimension other than 768. Search ranks by vector distance only. + +Offline illustration (fixture excerpts link to official pages and do not use EmbeddingGemma): `python -m netcortex_runbook.cli fixture "failover default route" --mock`. This CLI labels every item as a fixture and includes source titles and retrieval date. Live `search_runbook(query, k=5)` awaits Aun's `netcortex_core.Settings` and `RunbookChunk` exports; it fails explicitly until those exist. Live CLI operations are `runbook search QUERY` and `runbook ingest`; both consume only shared core Settings. + +Live smoke steps: provision approved core/schema and an isolated database; run Ollama with the agreed exact EmbeddingGemma tag; call `ingest`; repeat it and check row count is unchanged; query each of the four topics in the validation plan and verify the right page in top three. Those live checks have not been run on this branch. diff --git a/packages/runbook/decision.md b/packages/runbook/decision.md new file mode 100644 index 0000000..0345495 --- /dev/null +++ b/packages/runbook/decision.md @@ -0,0 +1,11 @@ +# Runbook design decisions + +The indexer reads only official MikroTik RouterOS pages from `help.mikrotik.com`. It checks that host's `robots.txt`, rejects redirects outside the official HTTPS host, and caps each page at 2 MB while streaming. The source set is finite: queues, route, failover, DNS, mangle, and interface stats/traffic. Every HTTP request has finite connect/read/write/pool timeouts. The indexer honors the crawl delay advertised by robots.txt between page fetches. + +Chunking targets 400 words and accepts configured sizes only from 300 through 500. Section titles remain in metadata. The vector model is supplied explicitly from the approved shared Settings; there is no guessed default while Aun's exact model tag decision is pending. The configured value must be a full `embeddinggemma:`, and Ollama's returned model must match it exactly. Every vector must contain 768 finite numbers. + +The current `runbook_chunks` schema has no natural unique key. Indexing therefore takes a transaction-scoped advisory lock and selects by source URL, title, section, text, and model before inserting. The model is part of the key so an approved model change cannot silently reuse the old embedding. Writes use only the shared columns; this package does not alter the schema. PostgreSQL connection and statement deadlines are both finite. + +Search uses pgvector cosine distance only. Keyword fallback is omitted so the order and score remain clear. Results are instantiated as Aun's `RunbookChunk` with source URL and higher-is-better score `1 - distance`. No local copy of that schema is defined. Live search waits for Aun's `netcortex_core.Settings` and `RunbookChunk` exports and fields. + +Fixture excerpts are manually written, source-linked paraphrases checked against official MikroTik docs. Each has source title, retrieval date, and `fixture=true`. They are lexical examples only; no model vectors are used and their tests do not establish live search quality. diff --git a/packages/runbook/flow.md b/packages/runbook/flow.md new file mode 100644 index 0000000..795ea70 --- /dev/null +++ b/packages/runbook/flow.md @@ -0,0 +1,30 @@ +# Runbook execution flow + +## Entry points + +- `python -m netcortex_runbook.cli fixture "failover default route" --mock [-k 3]` performs offline lexical fixture search. `--mock` is required by the CLI. +- `netcortex_runbook.service.fixture_search(query, k=3)` is the same fixture adapter in Python. +- `netcortex_runbook.search_runbook(query, k=5)` is the public live function. It requires Aun's published `netcortex_core.Settings` and `netcortex_core.RunbookChunk` and settings fields `database_url`, `ollama_base_url`, `embed_model`. +- `netcortex_runbook.ingest(database_url=..., ollama_base_url=..., embed_model=...)` fetches and indexes the finite source allowlist. It can take an injected `httpx.Client` for tests. The model argument is required; no default tag is assumed before Aun confirms it. + +## Live indexing path + +```mermaid +flowchart TD + A[Approved MikroTik URL] --> B[GET official robots.txt] + B --> C[GET page: HTTPS, max 2 MB, finite timeout] + C --> D[Extract title, headings, paragraphs, list items] + D --> E[300-500 word chunks with section] + E --> F[Ollama POST /api/embed] + F --> G[Check configured model identity and 768 finite values] + G --> H[Postgres transaction + advisory lock] + H --> I[Select by source/title/section/text/model; insert if absent] +``` + +Only `help.mikrotik.com` URLs are accepted. Current source areas are queues, route, DNS, and mangle. Ollama is called at `/api/embed` with `{model, input}` using the explicit configured full model tag. The tag must be in the `embeddinggemma` family, the response tag must match exactly, and the first embedding must have 768 finite numeric values. PostgreSQL writes only `runbook_chunks(id, source_url, title, section, text, embedding, embed_model)`; the vector is serialized for pgvector. Same-content rows with the same model tag are left untouched; another tag is a distinct row. The batch is one transaction with a 5-second statement timeout and connect timeout and rolls back on failure. + +## Live query path + +`search_runbook` validates non-empty query and `k` from 1 through 20, imports the actual core contracts, checks the configured tag, embeds the query, and selects the nearest rows with `ORDER BY embedding <=> query_vector LIMIT k`. It returns a list of core `RunbookChunk` objects with source URL and `score=1-distance`. There is no keyword mode. + +Input validation raises `ValueError`; blocked robots, HTTP/database/model errors, dimension mismatch, or tag mismatch fail explicitly. Missing core exports/settings raise `RuntimeError` naming the unavailable contract. No fallback fixture result is returned from the live function. The offline CLI makes no network or database request and marks every result as a fixture. diff --git a/packages/runbook/pyproject.toml b/packages/runbook/pyproject.toml new file mode 100644 index 0000000..2fee871 --- /dev/null +++ b/packages/runbook/pyproject.toml @@ -0,0 +1,19 @@ +[build-system] +requires = ["hatchling>=1.27,<2"] +build-backend = "hatchling.build" + +[project] +name = "netcortex-runbook" +version = "0.1.0" +description = "Official RouterOS documentation retrieval for NetCortex" +requires-python = ">=3.12,<3.13" +dependencies = ["beautifulsoup4>=4.12,<5", "httpx>=0.27,<1", "psycopg[binary]>=3.2,<4"] + +[project.optional-dependencies] +test = ["pytest>=8,<9"] + +[project.scripts] +runbook = "netcortex_runbook.cli:main" + +[tool.hatch.build.targets.wheel] +packages = ["src/netcortex_runbook"] diff --git a/packages/runbook/src/netcortex_runbook/__init__.py b/packages/runbook/src/netcortex_runbook/__init__.py new file mode 100644 index 0000000..9ed1a73 --- /dev/null +++ b/packages/runbook/src/netcortex_runbook/__init__.py @@ -0,0 +1,5 @@ +"""RouterOS documentation ingestion and retrieval.""" + +from .service import ingest, search_runbook + +__all__ = ["ingest", "search_runbook"] diff --git a/packages/runbook/src/netcortex_runbook/cli.py b/packages/runbook/src/netcortex_runbook/cli.py new file mode 100644 index 0000000..a35dd2f --- /dev/null +++ b/packages/runbook/src/netcortex_runbook/cli.py @@ -0,0 +1,44 @@ +import argparse +import json + +from .service import fixture_search, ingest, search_runbook + + +def main() -> None: + parser = argparse.ArgumentParser(description="RouterOS runbook indexing and search") + commands = parser.add_subparsers(dest="command", required=True) + fixture = commands.add_parser("fixture", help="offline cited fixture lookup") + fixture.add_argument("query") + fixture.add_argument("--mock", action="store_true", required=True) + fixture.add_argument("-k", type=int, default=3) + search = commands.add_parser("search", help="live pgvector search via shared core Settings") + search.add_argument("query") + search.add_argument("-k", type=int, default=5) + commands.add_parser( + "ingest", help="fetch approved official pages and index using shared core Settings" + ) + args = parser.parse_args() + if args.command == "fixture": + output = fixture_search(args.query, args.k) + elif args.command == "search": + output = [item.model_dump() for item in search_runbook(args.query, args.k)] + else: + try: + from netcortex_core import Settings # type: ignore[import-not-found] + except ImportError as exc: + raise RuntimeError( + "live indexing requires Aun's published netcortex_core.Settings" + ) from exc + settings = Settings() + output = { + "indexed_chunks": ingest( + database_url=settings.database_url, + ollama_base_url=settings.ollama_base_url, + embed_model=settings.embed_model, + ) + } + print(json.dumps(output, indent=2, default=str)) + + +if __name__ == "__main__": + main() diff --git a/packages/runbook/src/netcortex_runbook/service.py b/packages/runbook/src/netcortex_runbook/service.py new file mode 100644 index 0000000..3ba919d --- /dev/null +++ b/packages/runbook/src/netcortex_runbook/service.py @@ -0,0 +1,370 @@ +from __future__ import annotations + +import math +import re +import time +import urllib.robotparser +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any +from urllib.parse import urlparse + +import httpx +from bs4 import BeautifulSoup + +if TYPE_CHECKING: + from netcortex_core import RunbookChunk # type: ignore[import-not-found] + +SOURCES = { + "queues": "https://help.mikrotik.com/docs/spaces/ROS/pages/328088/Queues", + "routing": "https://help.mikrotik.com/docs/spaces/ROS/pages/59965493/routing%2Broute", + "failover": "https://help.mikrotik.com/docs/spaces/ROS/pages/26476608/Failover%2BWAN%2BBackup", + "dns": "https://help.mikrotik.com/docs/spaces/ROS/pages/37748767/DNS", + "mangle": "https://help.mikrotik.com/docs/spaces/ROS/pages/48660587/Mangle", + "interface": "https://help.mikrotik.com/docs/spaces/ROS/pages/139526175/Interface%20stats%20and%20monitor-traffic", +} +USER_AGENT = "NetCortexRunbook/0.1 (documentation retrieval; contact: project maintainers)" +MAX_PAGE_BYTES = 2_000_000 + + +@dataclass(frozen=True) +class Chunk: + source_url: str + title: str + section: str + text: str + + +def chunk_text(title: str, source_url: str, text: str, *, words: int = 400) -> list[Chunk]: + """Split text into bounded 300-500 word chunks while retaining section labels.""" + if not 300 <= words <= 500: + raise ValueError("chunk size must be 300..500 words") + sections: list[tuple[str, list[str]]] = [] + section = title + for line in text.splitlines(): + line = re.sub(r"\s+", " ", line).strip() + if not line: + continue + if line.startswith("#"): + section = line.lstrip("# ") or title + sections.append((section, [])) + else: + if not sections: + sections.append((section, [])) + sections[-1][1].append(line) + section_words = [ + (heading, word) for heading, lines in sections for word in " ".join(lines).split() + ] + total = len(section_words) + if not total: + return [] + count = 1 if total <= 500 else (total + words - 1) // words + base, extra = divmod(total, count) + output: list[Chunk] = [] + offset = 0 + for index in range(count): + size = base + (1 if index < extra else 0) + part = section_words[offset : offset + size] + offset += size + headings = list(dict.fromkeys(heading for heading, _ in part)) + output.append( + Chunk(source_url, title, " / ".join(headings), " ".join(word for _, word in part)) + ) + return output + + +def _robots_allowed(client: httpx.Client, url: str) -> bool: + parser = _robots_policy(client, url) + return parser.can_fetch(USER_AGENT, url) + + +def _robots_policy(client: httpx.Client, url: str) -> urllib.robotparser.RobotFileParser: + parsed = urlparse(url) + robots_url = f"{parsed.scheme}://{parsed.netloc}/robots.txt" + response = client.get(robots_url, headers={"User-Agent": USER_AGENT}) + response.raise_for_status() + if len(response.content) > 256_000: + raise ValueError("robots.txt exceeds the 256 KB size limit") + parser = urllib.robotparser.RobotFileParser() + parser.set_url(robots_url) + parser.parse(response.text.splitlines()) + return parser + + +def _download( + client: httpx.Client, + url: str, + *, + robots: urllib.robotparser.RobotFileParser | None = None, +) -> tuple[str, str]: + if urlparse(url).scheme != "https" or urlparse(url).hostname != "help.mikrotik.com": + raise ValueError("only official MikroTik help pages over HTTPS are allowed") + robots = robots or _robots_policy(client, url) + if not robots.can_fetch(USER_AGENT, url): + raise RuntimeError(f"robots.txt disallows {url}") + with client.stream("GET", url, headers={"User-Agent": USER_AGENT}) as response: + response.raise_for_status() + final_url = urlparse(str(response.url)) + if final_url.scheme != "https" or final_url.hostname != "help.mikrotik.com": + raise ValueError("documentation request redirected outside the official HTTPS host") + body = bytearray() + for piece in response.iter_bytes(): + body.extend(piece) + if len(body) > MAX_PAGE_BYTES: + raise ValueError("documentation page exceeds the 2 MB size limit") + soup = BeautifulSoup(bytes(body), "html.parser") + title = soup.title.get_text(" ", strip=True) if soup.title else url + main = soup.select_one("main") or soup.select_one("#main-content") or soup.body + if main is None: + raise ValueError("documentation page has no readable body") + for element in main.select("script,style,nav,footer,header,aside"): + element.decompose() + lines: list[str] = [] + for element in main.select("h1,h2,h3,h4,p,li"): + value = element.get_text(" ", strip=True) + if element.name.startswith("h"): + lines.append("# " + value) + elif value: + lines.append(value) + return title, "\n".join(lines) + + +def _embed(client: httpx.Client, text: str, base_url: str, model: str) -> list[float]: + _validate_model(model) + response = client.post( + f"{base_url.rstrip('/')}/api/embed", json={"model": model, "input": text} + ) + response.raise_for_status() + payload = response.json() + if not isinstance(payload, dict): + raise TypeError("Ollama returned a malformed embedding response") + if payload.get("model") != model: + raise ValueError( + f"Ollama model mismatch: requested {model!r}, received {payload.get('model')!r}" + ) + embeddings = payload.get("embeddings") + vector = embeddings[0] if isinstance(embeddings, list) and embeddings else None + if not isinstance(vector, list) or len(vector) != 768: + size = len(vector) if isinstance(vector, list) else "invalid" + raise ValueError(f"EmbeddingGemma must return 768 dimensions; got {size}") + if any( + isinstance(value, bool) or not isinstance(value, (float, int)) or not math.isfinite(value) + for value in vector + ): + raise ValueError("embedding contains invalid or non-finite values") + return [float(value) for value in vector] + + +def _validate_model(model: str) -> None: + if ( + not isinstance(model, str) + or not model.startswith("embeddinggemma:") + or not model.split(":", 1)[1] + ): + raise ValueError("embed_model must be an explicitly configured full embeddinggemma tag") + + +def _store_chunks(conn: Any, chunks: list[tuple[Chunk, list[float]]], embed_model: str) -> None: + with conn.cursor() as cur: + # The current schema has no natural unique key; serialize writers and safely select/insert. + cur.execute("SELECT pg_advisory_xact_lock(hashtext('netcortex.runbook_chunks.v1'))") + for chunk, vector in chunks: + cur.execute( + "SELECT id FROM runbook_chunks WHERE source_url=%s AND title=%s " + "AND section=%s AND text=%s AND embed_model=%s LIMIT 1", + (chunk.source_url, chunk.title, chunk.section, chunk.text, embed_model), + ) + if cur.fetchone() is None: + cur.execute( + "INSERT INTO runbook_chunks (id,source_url,title,section,text,embedding," + "embed_model) " + "VALUES (gen_random_uuid(),%s,%s,%s,%s,%s::vector,%s)", + ( + chunk.source_url, + chunk.title, + chunk.section, + chunk.text, + "[" + ",".join(map(str, vector)) + "]", + embed_model, + ), + ) + + +def ingest( + *, + database_url: str, + ollama_base_url: str, + embed_model: str, + sources: dict[str, str] | None = None, + client: httpx.Client | None = None, +) -> int: + """Fetch official pages and transactionally upsert chunks into approved runbook columns.""" + _validate_model(embed_model) + own = client is None + client = client or httpx.Client(timeout=httpx.Timeout(15, connect=5), follow_redirects=False) + try: + chunks: list[tuple[Chunk, list[float]]] = [] + topic_urls = list((sources or SOURCES).values()) + if not topic_urls: + return 0 + robots = _robots_policy(client, topic_urls[0]) + delay = robots.crawl_delay(USER_AGENT) or 0 + last_request = time.monotonic() + for topic_url in topic_urls: + if not robots.can_fetch(USER_AGENT, topic_url): + raise RuntimeError(f"robots.txt disallows {topic_url}") + wait = delay - (time.monotonic() - last_request) + if wait > 0: + time.sleep(wait) + title, body = _download(client, topic_url, robots=robots) + last_request = time.monotonic() + for chunk in chunk_text(title, topic_url, body): + chunks.append((chunk, _embed(client, chunk.text, ollama_base_url, embed_model))) + import psycopg + + with psycopg.connect( + database_url, connect_timeout=5, options="-c statement_timeout=5000" + ) as conn: + _store_chunks(conn, chunks, embed_model) + return len(chunks) + finally: + if own: + client.close() + + +def _settings_and_contract() -> tuple[Any, Any]: + try: + from netcortex_core import RunbookChunk, Settings # type: ignore[import-not-found] + except ImportError as exc: + raise RuntimeError( + "live search requires Aun's published netcortex_core Settings and RunbookChunk contract" + ) from exc + return Settings, RunbookChunk + + +def search_runbook(query: str, k: int = 5) -> list[RunbookChunk]: + """Search pgvector; return core RunbookChunk items after its contract is published.""" + if not query.strip() or not 1 <= k <= 20: + raise ValueError("query must be non-empty and k must be 1..20") + Settings, RunbookChunk = _settings_and_contract() + settings = Settings() + model = settings.embed_model + try: + _validate_model(model) + except ValueError as exc: + raise RuntimeError(str(exc)) from exc + with httpx.Client(timeout=httpx.Timeout(15, connect=5)) as client: + vector = _embed(client, query, settings.ollama_base_url, model) + import psycopg + + with ( + psycopg.connect( + settings.database_url, connect_timeout=5, options="-c statement_timeout=5000" + ) as conn, + conn.cursor() as cur, + ): + cur.execute( + "SELECT source_url,title,section,text,embedding <=> %s::vector AS distance " + "FROM runbook_chunks WHERE embed_model=%s ORDER BY embedding <=> %s::vector " + "LIMIT %s", + ( + "[" + ",".join(map(str, vector)) + "]", + model, + "[" + ",".join(map(str, vector)) + "]", + k, + ), + ) + rows = cur.fetchall() + return [ + RunbookChunk(source_url=r[0], title=r[1], section=r[2], text=r[3], score=1.0 - float(r[4])) + for r in rows + ] + + +def fixture_search(query: str, k: int = 3) -> list[dict[str, str]]: + """Small source-linked offline examples, explicitly lexical rather than model retrieval.""" + if not query.strip() or not 1 <= k <= 20: + raise ValueError("query must be non-empty and k must be 1..20") + q = query.lower() + topics = [ + ( + "limit bandwidth", + "Simple Queues", + "Simple Queues and Queue Trees are RouterOS queue facilities for traffic shaping " + "and limits.", + SOURCES["queues"], + "Queues", + ), + ( + "one ip", + "Simple Queues", + "RouterOS Simple Queues are a queue facility for applying traffic limits to " + "selected traffic.", + SOURCES["queues"], + "Queues", + ), + ( + "priority gaming", + "Queue Tree", + "RouterOS queues use hierarchical token bucket; Simple Queues and Queue Trees " + "provide traffic shaping and priority controls.", + SOURCES["queues"], + "Queues", + ), + ( + "failover", + "Failover WAN Backup", + "RouterOS route entries support check-gateway (ping, arp, or bfd) to monitor " + "gateway reachability.", + SOURCES["failover"], + "Failover WAN Backup", + ), + ( + "default route", + "Routing Route", + "RouterOS route entries support check-gateway (ping, arp, or bfd), including " + "for monitored default routes.", + SOURCES["routing"], + "Routing Route", + ), + ( + "dns", + "DNS", + "RouterOS DNS provides name resolution and can use configured static and dynamic " + "DNS servers.", + SOURCES["dns"], + "DNS", + ), + ( + "mangle", + "Mangle", + "RouterOS mangle rules mark packets for later processing by queues, NAT, or " + "routing facilities.", + SOURCES["mangle"], + "Mangle", + ), + ( + "interface monitoring", + "Interface stats and monitor-traffic", + "RouterOS interface statistics include receive/transmit counters, link downs, " + "and queue drops; monitor-traffic reports traffic rates.", + SOURCES["interface"], + "Interface stats and monitor-traffic", + ), + ] + matches = [x for x in topics if x[0] in q or x[1].lower() in q] + if not matches and "queue" in q: + matches = [topics[2], topics[0], topics[1]] + if not matches: + matches = topics + return [ + { + "source_url": x[3], + "title": "RouterOS " + x[1], + "section": x[1], + "text": x[2], + "source_title": x[4], + "retrieved_on": "2026-10-18", + "fixture": "true", + } + for x in matches[:k] + ] diff --git a/packages/runbook/tests/test_runbook.py b/packages/runbook/tests/test_runbook.py new file mode 100644 index 0000000..6876306 --- /dev/null +++ b/packages/runbook/tests/test_runbook.py @@ -0,0 +1,164 @@ +import httpx +import pytest +from netcortex_runbook.service import ( + SOURCES, + USER_AGENT, + Chunk, + _embed, + _robots_allowed, + _robots_policy, + _store_chunks, + chunk_text, + fixture_search, +) + +MODEL = "embeddinggemma:300m" + + +def test_fixture_topics_have_official_source_and_are_explicit(): + queries = [ + ("limit bandwidth for one IP", "Queues"), + ("failover default route", "Failover WAN Backup"), + ("priority queue for gaming", "Queues"), + ("DNS resolver", "DNS"), + ] + for query, expected_title in queries: + result = fixture_search(query, 3) + assert result[0]["source_title"] == expected_title + assert result[0]["fixture"] == "true" + assert result[0]["retrieved_on"] == "2026-10-18" + assert result[0]["source_url"].startswith("https://help.mikrotik.com/") + + +def test_chunk_boundaries_keep_section_titles(): + text = "# Queue limits\n" + "word " * 610 + chunks = chunk_text("RouterOS", "https://help.mikrotik.com/docs/x", text) + assert [len(chunk.text.split()) for chunk in chunks] == [305, 305] + assert all(chunk.section == "Queue limits" for chunk in chunks) + with pytest.raises(ValueError): + chunk_text("x", "u", "body", words=299) + + +def test_embed_enforces_model_dimensions_and_finite_values(): + def valid(request): + assert request.url.path == "/api/embed" + return httpx.Response(200, json={"model": MODEL, "embeddings": [[0.1] * 768]}) + + with httpx.Client(transport=httpx.MockTransport(valid)) as client: + assert len(_embed(client, "query", "http://ollama", MODEL)) == 768 + + def wrong_model(request): + return httpx.Response( + 200, json={"model": "embeddinggemma:other", "embeddings": [[0.1] * 768]} + ) + + with ( + httpx.Client(transport=httpx.MockTransport(wrong_model)) as client, + pytest.raises(ValueError, match="model mismatch"), + ): + _embed(client, "query", "http://ollama", MODEL) + + def wrong_size(request): + return httpx.Response(200, json={"model": MODEL, "embeddings": [[0.1] * 767]}) + + with ( + httpx.Client(transport=httpx.MockTransport(wrong_size)) as client, + pytest.raises(ValueError, match="768"), + ): + _embed(client, "query", "http://ollama", MODEL) + + for invalid in [float("nan"), float("inf"), True]: + + def nonfinite(request, invalid=invalid): + invalid_json = ( + "true" if invalid is True else ("NaN" if invalid != invalid else "Infinity") + ) + values = ",".join([invalid_json] + ["0.1"] * 767) + return httpx.Response(200, content=f'{{"model":"{MODEL}","embeddings":[[{values}]]}}') + + with ( + httpx.Client(transport=httpx.MockTransport(nonfinite)) as client, + pytest.raises(ValueError, match="non-finite"), + ): + _embed(client, "query", "http://ollama", MODEL) + + +def test_ingestion_respects_robots_rules(): + client = httpx.Client( + transport=httpx.MockTransport( + lambda request: httpx.Response(200, text="User-agent: *\nDisallow: /docs/") + ) + ) + assert not _robots_allowed(client, "https://help.mikrotik.com/docs/example") + client.close() + + +def test_source_allowlist_is_canonical_and_honors_published_crawl_delay(): + assert len(SOURCES) == 6 + assert all( + url.startswith("https://help.mikrotik.com/docs/spaces/ROS/pages/") + for url in SOURCES.values() + ) + assert all("/display/" not in url for url in SOURCES.values()) + client = httpx.Client( + transport=httpx.MockTransport( + lambda request: httpx.Response( + 200, + text="User-agent: *\nAllow: /docs/spaces/\nCrawl-delay: 5\n", + ) + ) + ) + rules = _robots_policy(client, next(iter(SOURCES.values()))) + assert rules.crawl_delay(USER_AGENT) == 5 + assert all(rules.can_fetch(USER_AGENT, url) for url in SOURCES.values()) + client.close() + + +def test_embed_timeout_is_a_provider_failure(): + def slow(request): + raise httpx.ReadTimeout("simulated timeout") + + with ( + httpx.Client(transport=httpx.MockTransport(slow)) as client, + pytest.raises(httpx.ReadTimeout), + ): + _embed(client, "query", "http://ollama", MODEL) + + +class FakeCursor: + def __init__(self, rows): + self.rows = rows + self.found = None + + def __enter__(self): + return self + + def __exit__(self, *args): + return False + + def execute(self, sql, params=None): + if sql.startswith("SELECT id"): + key = tuple(params) + self.found = key if key in self.rows else None + elif sql.startswith("INSERT"): + self.rows.add((params[0], params[1], params[2], params[3], params[-1])) + + def fetchone(self): + return ("existing",) if self.found else None + + +class FakeConnection: + def __init__(self): + self.rows = set() + + def cursor(self): + return FakeCursor(self.rows) + + +def test_database_upsert_is_repeat_safe_per_model(): + conn = FakeConnection() + chunk = Chunk("https://help.mikrotik.com/docs/example", "title", "section", "body") + _store_chunks(conn, [(chunk, [0.0] * 768)], MODEL) + _store_chunks(conn, [(chunk, [0.0] * 768)], MODEL) + _store_chunks(conn, [(chunk, [0.0] * 768)], "embeddinggemma:other") + assert len(conn.rows) == 2 From 2e0490117f583377ac90e2b75f70d9986773dabd Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 17:59:31 +0500 Subject: [PATCH 03/21] chore: normalize text across Windows and Linux tooling --- docs/progress/retrieval_notify.md | 86 +++++++++++++++---------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/docs/progress/retrieval_notify.md b/docs/progress/retrieval_notify.md index 9819d4a..df0aebd 100644 --- a/docs/progress/retrieval_notify.md +++ b/docs/progress/retrieval_notify.md @@ -1,43 +1,43 @@ -# B4/B5 runbook and notifications handoff - -## Owned files delivered - -- `packages/runbook/`: hatchling package `netcortex-runbook` / `netcortex_runbook`, official-doc ingestion, vector search adapter, fixture CLI, unit tests, README, decision guide, and flow guide. -- `packages/notify/`: hatchling package `netcortex-notify` / `netcortex_notify`, ElevenLabs and SerpApi helpers, unavailable-only fixture CLI, unit tests, README, decision guide, and flow guide. -- This handoff. - -No core schema, Settings, root manifest, lockfile, or other team-owned file was changed. No credentials, live embedding calls, database writes, TTS calls, or SerpApi calls were used. - -## Checks run - -Command: - -```powershell -python -m uv run --with-editable packages/runbook --with-editable packages/notify --with pytest pytest packages/runbook/tests packages/notify/tests -``` - -Result: **18 passed** on Python 3.12.0. These are offline unit tests using `httpx.MockTransport` and fixture data. Coverage includes four fixture topics with source metadata plus a canonical six-page allowlist/crawl-delay policy test, chunk boundaries, EmbeddingGemma identity/dimension/non-finite values, robots denial, model-specific idempotent persistence, body deadline, voice language/word validation, MP3 response, output-format query, voice rate limit and public failure handling, absent credentials, malformed news payloads, unsafe links, date filtering, outage relevance, and SerpApi rate limit/timeout. - -The smoke CLIs were run: - -```powershell -python -m uv run --with-editable packages/runbook runbook fixture "failover default route" --mock -python -m uv run --with-editable packages/notify notify speak "Uplink is degraded" --lang ur --mock -python -m uv run --with-editable packages/notify notify news ExampleISP game-server --mock -``` - -Runbook returned source-linked `fixture=true` excerpts with source titles and retrieval date. Notification fixtures returned unavailable outputs and made no provider calls. - -Ruff formatting and checks passed against `C:\Users\nigga\Documents\NetCortex\pyproject.toml` (Python 3.12, E/F/I/UP/B rules, 100-character lines). `git diff --check` passed. `uv build --wheel` built both distributions successfully. The ignored wheel outputs remain under each package's `.build-check` folder because cleanup commands were blocked by the execution policy. - -## Decisions and live gates - -- Official RouterOS sources are restricted to six canonical `help.mikrotik.com` pages: queues, route, failover, DNS, mangle, and interface stats/traffic. A one-time live source validation on 2026-10-18 got `robots.txt` HTTP 200 with `Crawl-delay: 5`; all six canonical pages returned HTTP 200 with expected titles. The indexer reads robots once, checks each URL, and honors its parsed delay between page fetches. The page fetches were not retained as a raw corpus. Responses stream with a 2 MB cap and finite HTTP timeouts. -- No Ollama tag is guessed. The shared configured value must be a full `embeddinggemma:`; responses are checked for exact identity and 768 finite dimensions. Aun still must confirm the shared tag and Settings fields before public search can use `netcortex_core`. -- Chunking targets 400 words, accepts a target from 300 through 500, balances page remainder, and preserves headings in section metadata. Source pages were validated but no raw corpus was retained. -- Existing `runbook_chunks` schema has no content uniqueness key. Indexing therefore takes a PostgreSQL transaction advisory lock and selects by source/title/section/text/model before inserting; the schema is not changed. A model change keeps a distinct embedding row. The database write path has not been exercised against PostgreSQL. -- Vector-only pgvector cosine search returns Aun's `RunbookChunk` objects and source URLs. Search quality is not measured until the shared DB/model is available. -- ElevenLabs `eleven_v3` was chosen because its current official model docs list Urdu; `eleven_multilingual_v2` does not support the API language-code parameter. MP3 format is an API query parameter. SerpApi Google search uses `tbs=qdr:d`; result dates, relevant outage wording, and HTTP(S) URLs are checked. These API/model choices are recorded in package docs. -- Public functions are contract-gated: `search_runbook` needs core `Settings` and `RunbookChunk`; `speak` needs core `Settings`; `check_news` needs core `Settings`, `NewsCheck`, and `NewsItem`. Internal functions support passed config and injected clients. There are no copied shared types or alternate Settings classes. - -Pending before integration claims: Aun publishes the core package/schema/settings fields and confirms the EmbeddingGemma tag; a real test database and Ollama host are available; run ingestion twice and verify idempotence; run all four retrieval topics and verify correct top-three hits; test real Urdu/English MP3 playback and SerpApi known/empty/error cases. No external integration or real retrieval/voice/news pass is claimed. +# B4/B5 runbook and notifications handoff + +## Owned files delivered + +- `packages/runbook/`: hatchling package `netcortex-runbook` / `netcortex_runbook`, official-doc ingestion, vector search adapter, fixture CLI, unit tests, README, decision guide, and flow guide. +- `packages/notify/`: hatchling package `netcortex-notify` / `netcortex_notify`, ElevenLabs and SerpApi helpers, unavailable-only fixture CLI, unit tests, README, decision guide, and flow guide. +- This handoff. + +No core schema, Settings, root manifest, lockfile, or other team-owned file was changed. No credentials, live embedding calls, database writes, TTS calls, or SerpApi calls were used. + +## Checks run + +Command: + +```powershell +python -m uv run --with-editable packages/runbook --with-editable packages/notify --with pytest pytest packages/runbook/tests packages/notify/tests +``` + +Result: **18 passed** on Python 3.12.0. These are offline unit tests using `httpx.MockTransport` and fixture data. Coverage includes four fixture topics with source metadata plus a canonical six-page allowlist/crawl-delay policy test, chunk boundaries, EmbeddingGemma identity/dimension/non-finite values, robots denial, model-specific idempotent persistence, body deadline, voice language/word validation, MP3 response, output-format query, voice rate limit and public failure handling, absent credentials, malformed news payloads, unsafe links, date filtering, outage relevance, and SerpApi rate limit/timeout. + +The smoke CLIs were run: + +```powershell +python -m uv run --with-editable packages/runbook runbook fixture "failover default route" --mock +python -m uv run --with-editable packages/notify notify speak "Uplink is degraded" --lang ur --mock +python -m uv run --with-editable packages/notify notify news ExampleISP game-server --mock +``` + +Runbook returned source-linked `fixture=true` excerpts with source titles and retrieval date. Notification fixtures returned unavailable outputs and made no provider calls. + +Ruff formatting and checks passed against `C:\Users\nigga\Documents\NetCortex\pyproject.toml` (Python 3.12, E/F/I/UP/B rules, 100-character lines). `git diff --check` passed. `uv build --wheel` built both distributions successfully. The ignored wheel outputs remain under each package's `.build-check` folder because cleanup commands were blocked by the execution policy. + +## Decisions and live gates + +- Official RouterOS sources are restricted to six canonical `help.mikrotik.com` pages: queues, route, failover, DNS, mangle, and interface stats/traffic. A one-time live source validation on 2026-10-18 got `robots.txt` HTTP 200 with `Crawl-delay: 5`; all six canonical pages returned HTTP 200 with expected titles. The indexer reads robots once, checks each URL, and honors its parsed delay between page fetches. The page fetches were not retained as a raw corpus. Responses stream with a 2 MB cap and finite HTTP timeouts. +- No Ollama tag is guessed. The shared configured value must be a full `embeddinggemma:`; responses are checked for exact identity and 768 finite dimensions. Aun still must confirm the shared tag and Settings fields before public search can use `netcortex_core`. +- Chunking targets 400 words, accepts a target from 300 through 500, balances page remainder, and preserves headings in section metadata. Source pages were validated but no raw corpus was retained. +- Existing `runbook_chunks` schema has no content uniqueness key. Indexing therefore takes a PostgreSQL transaction advisory lock and selects by source/title/section/text/model before inserting; the schema is not changed. A model change keeps a distinct embedding row. The database write path has not been exercised against PostgreSQL. +- Vector-only pgvector cosine search returns Aun's `RunbookChunk` objects and source URLs. Search quality is not measured until the shared DB/model is available. +- ElevenLabs `eleven_v3` was chosen because its current official model docs list Urdu; `eleven_multilingual_v2` does not support the API language-code parameter. MP3 format is an API query parameter. SerpApi Google search uses `tbs=qdr:d`; result dates, relevant outage wording, and HTTP(S) URLs are checked. These API/model choices are recorded in package docs. +- Public functions are contract-gated: `search_runbook` needs core `Settings` and `RunbookChunk`; `speak` needs core `Settings`; `check_news` needs core `Settings`, `NewsCheck`, and `NewsItem`. Internal functions support passed config and injected clients. There are no copied shared types or alternate Settings classes. + +Pending before integration claims: Aun publishes the core package/schema/settings fields and confirms the EmbeddingGemma tag; a real test database and Ollama host are available; run ingestion twice and verify idempotence; run all four retrieval topics and verify correct top-three hits; test real Urdu/English MP3 playback and SerpApi known/empty/error cases. No external integration or real retrieval/voice/news pass is claimed. From c8b84c0e2a973659a4afbcec2599adbf0dec5d6f Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:18:31 +0500 Subject: [PATCH 04/21] feat: add operator dashboard with fixture and live API transports --- apps/web/.gitignore | 4 + apps/web/AGENTS.md | 9 + apps/web/README.md | 18 + apps/web/app/demo/page.tsx | 4 + apps/web/app/globals.css | 1883 ++++ apps/web/app/incidents/[id]/page.tsx | 9 + apps/web/app/incidents/page.tsx | 9 + apps/web/app/layout.tsx | 20 + apps/web/app/page.tsx | 4 + apps/web/app/settings/page.tsx | 16 + apps/web/components/dashboard.tsx | 307 + apps/web/components/demo-panel.tsx | 176 + apps/web/components/incident-detail.tsx | 360 + apps/web/components/incident-list.tsx | 129 + apps/web/components/latency-chart.tsx | 95 + apps/web/components/shell.tsx | 142 + apps/web/components/ui.tsx | 123 + apps/web/decision.md | 16 + apps/web/e2e/dashboard.spec.ts | 128 + apps/web/e2e/live-mode.spec.ts | 214 + apps/web/eslint.config.mjs | 16 + apps/web/flow.md | 56 + apps/web/instrumentation-client.ts | 6 + apps/web/instrumentation.ts | 6 + apps/web/lib/fixtures.ts | 197 + apps/web/lib/transport.ts | 426 + apps/web/lib/types.ts | 62 + apps/web/next-env.d.ts | 7 + apps/web/next.config.ts | 3 + apps/web/package-lock.json | 9782 +++++++++++++++++++ apps/web/package.json | 42 + apps/web/playwright.config.ts | 18 + apps/web/playwright.live.config.ts | 22 + apps/web/postcss.config.mjs | 2 + apps/web/scripts/generate-openapi-types.mjs | 25 + apps/web/sentry.server.config.ts | 3 + apps/web/tsconfig.json | 33 + docs/progress/web_dashboard.md | 26 + 38 files changed, 14398 insertions(+) create mode 100644 apps/web/.gitignore create mode 100644 apps/web/AGENTS.md create mode 100644 apps/web/README.md create mode 100644 apps/web/app/demo/page.tsx create mode 100644 apps/web/app/globals.css create mode 100644 apps/web/app/incidents/[id]/page.tsx create mode 100644 apps/web/app/incidents/page.tsx create mode 100644 apps/web/app/layout.tsx create mode 100644 apps/web/app/page.tsx create mode 100644 apps/web/app/settings/page.tsx create mode 100644 apps/web/components/dashboard.tsx create mode 100644 apps/web/components/demo-panel.tsx create mode 100644 apps/web/components/incident-detail.tsx create mode 100644 apps/web/components/incident-list.tsx create mode 100644 apps/web/components/latency-chart.tsx create mode 100644 apps/web/components/shell.tsx create mode 100644 apps/web/components/ui.tsx create mode 100644 apps/web/decision.md create mode 100644 apps/web/e2e/dashboard.spec.ts create mode 100644 apps/web/e2e/live-mode.spec.ts create mode 100644 apps/web/eslint.config.mjs create mode 100644 apps/web/flow.md create mode 100644 apps/web/instrumentation-client.ts create mode 100644 apps/web/instrumentation.ts create mode 100644 apps/web/lib/fixtures.ts create mode 100644 apps/web/lib/transport.ts create mode 100644 apps/web/lib/types.ts create mode 100644 apps/web/next-env.d.ts create mode 100644 apps/web/next.config.ts create mode 100644 apps/web/package-lock.json create mode 100644 apps/web/package.json create mode 100644 apps/web/playwright.config.ts create mode 100644 apps/web/playwright.live.config.ts create mode 100644 apps/web/postcss.config.mjs create mode 100644 apps/web/scripts/generate-openapi-types.mjs create mode 100644 apps/web/sentry.server.config.ts create mode 100644 apps/web/tsconfig.json create mode 100644 docs/progress/web_dashboard.md diff --git a/apps/web/.gitignore b/apps/web/.gitignore new file mode 100644 index 0000000..8a15fd9 --- /dev/null +++ b/apps/web/.gitignore @@ -0,0 +1,4 @@ +.next/ +node_modules/ +playwright-report/ +test-results/ diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md new file mode 100644 index 0000000..af3b7c8 --- /dev/null +++ b/apps/web/AGENTS.md @@ -0,0 +1,9 @@ + + +## This is NOT the Next.js you know + +This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices. + +This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean. + + diff --git a/apps/web/README.md b/apps/web/README.md new file mode 100644 index 0000000..c5b4bbd --- /dev/null +++ b/apps/web/README.md @@ -0,0 +1,18 @@ +# NetCortex web dashboard + +Next.js App Router dashboard for the NetCortex operator. It supports a deterministic local fixture mode and a live API mode. + +## Run locally + +```powershell +cd apps/web +npm ci +$env:NEXT_PUBLIC_API_MODE = 'mock' +npm run dev +``` + +Use `NEXT_PUBLIC_API_MODE=live` and `NEXT_PUBLIC_API_BASE_URL` to connect to Aun's API. Live mode calls the draft routes in `decision.md`; request timeouts and errors appear in the UI and never switch to fixtures. Those API payload types remain provisional until Aun publishes OpenAPI and shared contracts. The fixture values and CHR outcomes are invented demo records; the UI labels them “Demo: replayed data.” Mock approval simulates workflow states in browser memory only. No router is contacted. Voice playback displays an unavailable state because fixture audio is not real audio. + +`NEXT_PUBLIC_SENTRY_DSN` enables browser monitoring; server monitoring reads `SENTRY_DSN`. No DSN is committed. Sentry setup is code-ready but not connected or verified without the project DSN. + +For production, run `npm run build` then `npm run start -- --hostname 0.0.0.0 --port 3000`. Render should run the app as a Node web service, not a static export. When Aun publishes the schema, run `$env:OPENAPI_URL = 'http://…/openapi.json'; npm run api:types`. The generator requires that URL, uses a bounded fetch, and writes `lib/generated/openapi.d.ts`. No generated API types are included until the actual schema is available. diff --git a/apps/web/app/demo/page.tsx b/apps/web/app/demo/page.tsx new file mode 100644 index 0000000..2012202 --- /dev/null +++ b/apps/web/app/demo/page.tsx @@ -0,0 +1,4 @@ +import { DemoPanel } from "@/components/demo-panel"; +export default function Page() { + return ; +} diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css new file mode 100644 index 0000000..0769293 --- /dev/null +++ b/apps/web/app/globals.css @@ -0,0 +1,1883 @@ +@import "tailwindcss"; +:root { + --bg: #0b1117; + --panel: #101921; + --panel2: #131e27; + --border: #26343e; + --text: #e7eff2; + --muted: #8899a4; + --dim: #62737e; + --teal: #19c8b8; + --amber: #e9ad5b; + --red: #f07478; + --blue: #78aee8; + --font-sans: Arial, Helvetica, sans-serif; + --font-mono: "Cascadia Code", Consolas, monospace; +} +* { + box-sizing: border-box; +} +html, +body { + margin: 0; + background: var(--bg); + color: var(--text); + font-family: var(--font-sans); + font-size: 14px; +} +body { + min-height: 100vh; +} +a { + color: inherit; + text-decoration: none; +} +button, +input, +select { + font: inherit; +} +button { + color: inherit; + cursor: pointer; +} +button:disabled { + opacity: 0.58; + cursor: wait; +} +button:focus-visible, +a:focus-visible, +input:focus-visible, +select:focus-visible { + outline: 2px solid var(--teal); + outline-offset: 2px; +} +.app-shell { + min-height: 100vh; +} +.sidebar { + position: fixed; + inset: 0 auto 0 0; + width: 238px; + background: #0c141b; + border-right: 1px solid #1e2b34; + display: flex; + flex-direction: column; + padding: 23px 15px; + z-index: 30; +} +.brand { + display: flex; + align-items: center; + gap: 10px; + padding: 0 8px 26px; +} +.brand-mark { + width: 34px; + height: 34px; + display: grid; + place-items: center; + color: #081416; + background: var(--teal); + border-radius: 9px; +} +.brand strong { + font-size: 16px; + letter-spacing: -0.4px; + display: block; +} +.brand small { + font-family: var(--font-mono); + font-size: 8px; + letter-spacing: 1.2px; + color: #758793; + display: block; + margin-top: 3px; +} +.workspace-select { + height: 40px; + border: 1px solid #293640; + border-radius: 7px; + margin: 0 1px 27px; + padding: 0 10px; + display: flex; + align-items: center; + gap: 9px; + color: #c7d3d9; + font-size: 12px; +} +.workspace-select svg { + margin-left: auto; + color: #81919a; +} +.workspace-dot, +.status-orb { + width: 8px; + height: 8px; + border-radius: 50%; + background: #27c4a5; + box-shadow: 0 0 10px #27c4a577; +} +.nav-label, +.eyebrow { + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 1.1px; + color: #80909a; +} +.nav-label { + padding: 0 10px 9px; +} +.sidebar nav { + display: grid; + gap: 4px; +} +.nav-link { + height: 41px; + display: flex; + align-items: center; + gap: 11px; + padding: 0 11px; + color: #91a1ab; + border-radius: 6px; + font-size: 13px; + transition: 0.15s; +} +.nav-link:hover { + background: #15222b; + color: #d9e5e9; +} +.nav-link.active { + background: #13272b; + color: #58d7ca; +} +.nav-count { + margin-left: auto; + font-size: 10px; + font-family: var(--font-mono); + background: #53382b; + color: #edb76a; + border-radius: 10px; + padding: 3px 7px; +} +.sidebar-bottom { + margin-top: auto; +} +.connection-card { + display: flex; + align-items: center; + gap: 9px; + padding: 12px 9px; + border: 1px solid #25343d; + border-radius: 7px; + margin-bottom: 15px; + background: #101a21; +} +.connection-card strong, +.connection-card small, +.operator strong, +.operator small { + display: block; +} +.connection-card strong, +.operator strong { + font-size: 11px; + font-weight: 600; +} +.connection-card small, +.operator small { + font-size: 10px; + color: #7f909a; + margin-top: 3px; +} +.operator { + border-top: 1px solid #202e37; + padding: 16px 4px 0; + display: flex; + align-items: center; + gap: 9px; +} +.operator > svg { + margin-left: auto; + color: #80919b; +} +.avatar { + width: 30px; + height: 30px; + display: grid; + place-items: center; + background: #284451; + color: #b0d7e0; + border-radius: 50%; + font-size: 10px; + font-weight: 700; +} +.main-area { + margin-left: 238px; + min-height: 100vh; + display: flex; + flex-direction: column; +} +.topbar { + height: 61px; + border-bottom: 1px solid #202d36; + padding: 0 34px; + display: flex; + align-items: center; + justify-content: space-between; + background: #0c141a; +} +.breadcrumb { + display: flex; + align-items: center; + gap: 10px; + color: #83939e; + font-size: 12px; +} +.crumb-slash { + color: #45545e; +} +.crumb-current { + color: #d6e0e4; +} +.topbar-right { + display: flex; + align-items: center; + gap: 20px; +} +.demo-badge { + display: flex; + align-items: center; + gap: 7px; + padding: 6px 9px; + background: #112720; + border: 1px solid #244638; + border-radius: 4px; + color: #a4d5bb; + font-size: 10px; + white-space: nowrap; +} +.demo-badge > span { + width: 6px; + height: 6px; + background: #63c893; + border-radius: 50%; +} +.live-indicator { + display: flex; + align-items: center; + gap: 7px; + color: #99aaa9; + font-size: 11px; +} +.pulse { + width: 7px; + height: 7px; + background: #23c99b; + border-radius: 50%; + box-shadow: 0 0 0 3px #23c99b20; +} +.operator-chip { + display: flex; + align-items: center; + gap: 8px; + background: transparent; + border: 0; + color: #b8c5ca; + font-size: 11px; +} +.avatar-small { + width: 25px; + height: 25px; + font-size: 9px; +} +.operator-chip svg { + color: #83939b; +} +.main-area main { + flex: 1; +} +.page { + max-width: 1440px; + margin: 0 auto; + padding: 31px 34px 42px; +} +.section-title { + display: flex; + justify-content: space-between; + align-items: end; + margin-bottom: 24px; +} +.section-title h1 { + font-size: 26px; + letter-spacing: -0.8px; + margin: 7px 0 0; + font-weight: 620; +} +.eyebrow { + color: #7f919b; +} +.updated-label { + display: flex; + align-items: center; + gap: 8px; + color: #82939c; + font-size: 11px; +} +.updated-label svg { + margin-left: 8px; +} +.summary-strip { + display: grid; + grid-template-columns: repeat(4, 1fr); + border: 1px solid var(--border); + background: #101820; + border-radius: 8px; + margin-bottom: 34px; +} +.summary-strip > div { + display: flex; + align-items: center; + gap: 12px; + padding: 17px 20px; + border-right: 1px solid var(--border); +} +.summary-strip > div:last-child { + border: 0; +} +.summary-icon { + width: 33px; + height: 33px; + display: grid; + place-items: center; + border-radius: 7px; +} +.summary-icon.teal { + color: #4fd5c9; + background: #14312e; +} +.summary-icon.amber { + color: #e8b66c; + background: #30271c; +} +.summary-icon.blue { + color: #8cbaf0; + background: #1c2939; +} +.summary-icon.violet { + color: #c7a1ef; + background: #2b2339; +} +.summary-strip small { + display: block; + color: #85959e; + font-size: 10px; + margin-bottom: 5px; +} +.summary-strip strong { + font-size: 17px; + letter-spacing: -0.3px; +} +.summary-strip em { + font-style: normal; + color: #83939c; + font-size: 10px; + font-weight: 400; + margin-left: 4px; + letter-spacing: 0; +} +.section-heading, +.panel-heading { + display: flex; + align-items: center; + justify-content: space-between; +} +.section-heading { + margin-bottom: 13px; +} +.section-heading h2, +.panel-heading h2 { + margin: 0; + font-size: 15px; + font-weight: 600; + letter-spacing: -0.15px; +} +.section-heading p, +.panel-heading p { + margin: 5px 0 0; + font-size: 11px; + color: #83939c; +} +.text-link { + display: flex; + align-items: center; + gap: 6px; + color: #55d2c6; + font-size: 11px; +} +.site-grid { + display: grid; + grid-template-columns: repeat(3, minmax(0, 1fr)); + gap: 13px; + margin-bottom: 18px; +} +.panel { + background: var(--panel); + border: 1px solid var(--border); + border-radius: 8px; +} +.site-card { + padding: 17px 17px 0; + transition: + border 0.15s, + transform 0.15s; +} +.site-card:hover { + border-color: #3a525d; + transform: translateY(-1px); +} +.site-top { + display: flex; + align-items: center; + justify-content: space-between; +} +.site-top > div { + display: flex; + align-items: center; + gap: 7px; +} +.health-indicator { + width: 7px; + height: 7px; + border-radius: 50%; + display: inline-block; +} +.health-ok { + background: #39c993; + box-shadow: 0 0 8px #39c99366; +} +.health-degraded { + background: #e9ad5b; + box-shadow: 0 0 8px #e9ad5b55; +} +.health-down { + background: #ec7177; + box-shadow: 0 0 8px #ec717755; +} +.site-health-label { + font-size: 10px; + color: #9eacb3; + text-transform: capitalize; +} +.more-button, +.icon-button { + border: 0; + background: none; + color: #73838e; + display: grid; + place-items: center; + padding: 5px; +} +.site-card h3 { + font-size: 17px; + margin: 11px 0 3px; + letter-spacing: -0.25px; +} +.site-location { + font-size: 10px; + color: #84949e; + margin: 0; +} +.site-location span { + padding: 0 4px; + color: #5b6b75; +} +.site-metrics { + display: grid; + grid-template-columns: 1.15fr 0.85fr; + padding: 19px 0 15px; +} +.site-metrics > div + div { + border-left: 1px solid #27343d; + padding-left: 17px; +} +.site-metrics small { + font-family: var(--font-mono); + font-size: 8px; + letter-spacing: 0.7px; + color: #81919b; + display: block; + margin-bottom: 7px; +} +.site-metrics strong { + font-family: var(--font-mono); + font-size: 23px; + font-weight: 500; + letter-spacing: -1px; +} +.site-metrics strong i { + font-size: 11px; + color: #91a1a9; + font-style: normal; + margin-left: 2px; + letter-spacing: 0; +} +.meter { + height: 3px; + background: #25343c; + border-radius: 4px; + margin-top: 8px; + overflow: hidden; + max-width: 125px; +} +.meter span { + height: 100%; + display: block; + background: var(--teal); + border-radius: 4px; +} +.meter span.meter-red { + background: var(--red); +} +.site-footer { + border-top: 1px solid #25333c; + display: flex; + align-items: center; + justify-content: space-between; + height: 38px; + color: #84949c; + font-size: 9px; +} +.site-footer > span { + display: flex; + align-items: center; + gap: 6px; +} +.site-footer > svg { + color: #65757f; +} +.content-grid { + display: grid; + grid-template-columns: 1.55fr 1fr; + gap: 14px; +} +.chart-panel, +.incident-panel { + padding: 18px 18px 0; +} +.chart-units, +.chart-foot, +.code-heading { + font-family: var(--font-mono); + font-size: 8px; + letter-spacing: 0.8px; + color: #778993; +} +.chart-legend { + display: flex; + gap: 16px; + margin-top: 20px; + color: #9baab0; + font-size: 9px; +} +.chart-legend span { + display: flex; + align-items: center; + gap: 6px; +} +.chart-legend i { + display: inline-block; + width: 13px; + height: 2px; +} +.legend-actual { + background: #e7eff2; +} +.legend-forecast { + background: #19c8b8; +} +.legend-band { + height: 8px !important; + background: #19c8b833; + border: 1px solid #19c8b855; +} +.chart-wrap { + height: 233px; + width: 100%; + margin-top: 7px; +} +.chart-compact { + height: 140px; +} +.chart-foot { + display: flex; + justify-content: space-between; + border-top: 1px solid #25333c; + height: 37px; + align-items: center; + font-size: 8px; +} +.chart-foot b { + color: #afbdc2; + font-weight: 500; + letter-spacing: 0; + margin-left: 4px; +} +.compact-list { + padding: 6px 0; +} +.compact-incident { + display: flex; + align-items: center; + gap: 10px; + padding: 12px 0; + border-bottom: 1px solid #24323b; +} +.compact-incident:last-child { + border-bottom: 0; +} +.incident-icon { + width: 29px; + height: 29px; + display: grid; + place-items: center; + border-radius: 6px; + background: #392d1d; + color: #e6b262; + flex: none; +} +.incident-icon.incident-danger { + color: #f08084; + background: #392126; +} +.compact-copy { + min-width: 0; + flex: 1; +} +.compact-copy strong { + display: block; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 11px; + font-weight: 550; +} +.compact-copy small { + display: block; + color: #80919b; + font-size: 9px; + margin-top: 4px; +} +.compact-copy small i { + font-style: normal; + padding: 0 3px; +} +.status-pill { + display: inline-flex; + align-items: center; + gap: 5px; + border-radius: 4px; + padding: 5px 7px; + text-transform: capitalize; + white-space: nowrap; + font-size: 9px; + font-weight: 550; + background: #1a2930; + color: #a7b7be; +} +.status-dot { + width: 5px; + height: 5px; + border-radius: 50%; + background: currentColor; +} +.status-awaiting_approval { + background: #382c1b; + color: #edbd72; +} +.status-open { + background: #352322; + color: #f18b83; +} +.status-applying, +.status-verifying { + background: #1b2d3d; + color: #87b7e6; +} +.status-resolved { + background: #163128; + color: #74c99d; +} +.status-rolled_back, +.status-rejected { + background: #29292d; + color: #acb0b4; +} +.status-awaiting_approval .status-dot, +.status-open .status-dot { + animation: blink 2s infinite; +} +@keyframes blink { + 50% { + opacity: 0.35; + } +} +.panel-link { + height: 41px; + border-top: 1px solid #27353e; + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + color: #55d2c6; + font-size: 10px; +} +.count-badge { + background: #392c1b; + color: #edbd72; + padding: 4px 8px; + border-radius: 12px; + font-family: var(--font-mono); + font-size: 10px; +} +.empty-state { + color: #82939d; + text-align: center; + padding: 36px 12px; + font-size: 12px; +} +.footer { + display: flex; + justify-content: space-between; + color: #64757f; + font-size: 9px; + padding: 15px 34px; + border-top: 1px solid #1d2a33; +} +.footer span { + display: flex; + align-items: center; + gap: 5px; +} +.footer svg { + color: #4aa991; +} +.footer i { + font-style: normal; + padding: 0 3px; +} +.mobile-menu, +.mobile-close { + display: none; +} +.inline-error { + padding: 10px 13px; + border: 1px solid #704047; + background: #301e23; + color: #f3a3a4; + border-radius: 6px; + margin: -10px 0 18px; + font-size: 11px; +} +.inline-error button, +.error-box button { + margin-left: auto; + color: #6ed7cb; + background: none; + border: 0; +} +.page .section-title + .inline-error { + margin-top: -8px; +} +.back-link { + display: inline-flex; + align-items: center; + gap: 7px; + color: #8d9da6; + font-size: 11px; + margin: -5px 0 19px; +} +.back-link:hover { + color: #dce8eb; +} +.detail-title { + display: flex; + align-items: start; + justify-content: space-between; + margin-bottom: 21px; +} +.detail-title h1 { + font-size: 24px; + letter-spacing: -0.7px; + margin: 7px 0 5px; +} +.detail-title p { + margin: 0; + color: #8697a0; + font-size: 11px; + text-transform: capitalize; +} +.detail-title p span { + padding: 0 4px; +} +.detail-title > .status-pill { + margin-top: 4px; +} +.detail-grid { + display: grid; + grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr); + gap: 15px; + align-items: start; +} +.detail-main, +.detail-aside { + display: grid; + gap: 13px; +} +.narrative-panel { + padding: 19px; +} +.narrative-head { + display: flex; + align-items: center; + gap: 10px; +} +.agent-avatar { + width: 32px; + height: 32px; + background: #163d3a; + color: #4de0d2; + border-radius: 8px; + display: grid; + place-items: center; + font-family: var(--font-mono); + font-weight: bold; +} +.narrative-head strong { + font-size: 12px; + display: block; +} +.narrative-head small { + font-size: 9px; + color: #81929b; + display: block; + margin-top: 3px; +} +.narrative-head small span { + padding: 0 3px; +} +.agent-tag { + margin-left: auto; + font-family: var(--font-mono); + font-size: 8px; + letter-spacing: 0.8px; + color: #65bcb2; + background: #14312e; + padding: 5px 7px; + border-radius: 3px; +} +.summary-copy { + font-size: 12px; + line-height: 1.7; + color: #c5d1d5; + margin: 19px 0; +} +.evidence-block { + border-top: 1px solid #283740; + padding-top: 14px; +} +.evidence-block h3 { + font-size: 10px; + color: #b9c8cd; + margin: 0 0 11px; + display: flex; + align-items: center; + gap: 6px; +} +.evidence-block h3 svg { + color: #60cdb1; +} +.evidence-row { + display: flex; + align-items: center; + gap: 8px; + color: #a5b4ba; + font-size: 10px; + margin: 9px 0; +} +.evidence-check { + display: grid; + place-items: center; + width: 17px; + height: 17px; + background: #19322e; + color: #57cda7; + border-radius: 50%; +} +.timeline-panel { + padding: 18px 19px; +} +.timeline { + padding: 17px 0 1px 5px; +} +.timeline-item { + display: flex; + gap: 11px; + position: relative; + padding-bottom: 20px; +} +.timeline-item:not(:last-child):before { + content: ""; + position: absolute; + left: 6px; + top: 14px; + bottom: 0; + width: 1px; + background: #2d4148; +} +.timeline-marker { + z-index: 1; + width: 14px; + height: 14px; + flex: none; + display: grid; + place-items: center; + border-radius: 50%; + border: 1px solid #43525a; + background: #111b22; + color: #59caaa; +} +.timeline-active .timeline-marker { + border-color: #d69f52; + box-shadow: 0 0 0 3px #d69f5219; + color: #e9ad5b; +} +.timeline-active .timeline-marker > span { + width: 5px; + height: 5px; + background: currentColor; + border-radius: 50%; +} +.timeline-pending .timeline-marker { + border-color: #33424a; +} +.timeline-item strong { + font-size: 10px; + font-weight: 600; +} +.timeline-item p { + font-size: 10px; + color: #8fa0a8; + margin: 4px 0; +} +.timeline-item small { + font-size: 9px; + color: #697b85; +} +.news-panel { + padding: 15px; + display: flex; + gap: 10px; +} +.news-icon { + width: 27px; + height: 27px; + display: grid; + place-items: center; + background: #1b2b36; + color: #85b8d8; + border-radius: 6px; + flex: none; +} +.news-panel h3 { + margin: 1px 0 5px; + font-size: 11px; +} +.news-panel p { + margin: 0 0 7px; + color: #9eafb7; + font-size: 10px; +} +.news-panel a { + display: inline-flex; + align-items: center; + gap: 4px; + color: #69c9bf; + font-size: 9px; +} +.news-panel small { + display: block; + color: #657780; + font-size: 8px; + margin-top: 7px; +} +.fix-panel { + padding: 17px; +} +.fix-panel .panel-heading { + align-items: start; + margin-bottom: 14px; +} +.fix-panel .panel-heading h2 { + text-transform: capitalize; + margin-top: 6px; +} +.test-result { + display: flex; + align-items: start; + gap: 8px; + border: 1px solid #285040; + background: #142820; + border-radius: 5px; + padding: 10px; + margin-bottom: 14px; +} +.test-check, +.test-failed { + width: 19px; + height: 19px; + display: grid; + place-items: center; + flex: none; + background: #1d583e; + color: #7cdaa9; + border-radius: 50%; +} +.test-failed { + background: #4a252a; + color: #f09594; +} +.test-result strong { + font-size: 9px; + color: #a9d8b9; +} +.test-result p { + font-size: 9px; + line-height: 1.5; + color: #8da99a; + margin: 3px 0 0; +} +.code-heading { + display: flex; + align-items: center; + justify-content: space-between; + margin: 12px 0 6px; +} +.copy-button { + display: flex; + align-items: center; + gap: 4px; + background: transparent; + border: 1px solid #34434c; + color: #a4b3ba; + border-radius: 4px; + padding: 4px 7px; + font-size: 9px; + letter-spacing: 0; +} +.command-block { + margin: 0; + padding: 10px; + background: #0a1116; + border: 1px solid #22313a; + border-radius: 5px; + color: #b2d9d2; + font: 9px/1.7 var(--font-mono); + white-space: pre-wrap; + overflow-wrap: anywhere; +} +.rollback-heading { + color: #89959b; +} +.rollback-heading span { + display: flex; + align-items: center; + gap: 5px; +} +.rollback-block { + color: #cbb7a0; +} +.code-empty { + font-size: 9px; + color: #7e8e97; + padding: 11px; + background: #0a1116; + border-radius: 5px; +} +.approval-note { + display: flex; + align-items: center; + gap: 7px; + color: #9caeb4; + background: #151f25; + border: 1px solid #2b383f; + padding: 9px; + border-radius: 5px; + margin-top: 13px; + font-size: 9px; +} +.approval-note svg { + color: #6fc4a3; + flex: none; +} +.decision-actions { + display: grid; + grid-template-columns: 1fr 1.2fr; + gap: 8px; + margin-top: 11px; +} +.button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 7px; + border-radius: 5px; + padding: 10px 13px; + font-size: 10px; + font-weight: 600; + border: 1px solid transparent; + transition: 0.15s; +} +.button-primary { + background: #21b7a9; + color: #07201e; +} +.button-primary:hover { + background: #42d0c0; +} +.button-secondary { + background: #18232a; + border-color: #33414a; + color: #c5d0d5; +} +.button-secondary:hover { + background: #202d35; +} +.button-danger { + background: #a94750; + color: white; +} +.button-danger:hover { + background: #bc535b; +} +.full-button { + width: 100%; +} +.terminal-state { + font-size: 10px; + color: #91a19f; + background: #151e23; + border: 1px solid #2a373c; + border-radius: 5px; + padding: 10px; + margin-top: 12px; +} +.notify-note { + font-size: 10px; + line-height: 1.6; + color: #a2b1b5; + padding: 12px; + background: #151f25; + border: 1px solid #293841; + border-radius: 5px; +} +.voice-panel { + padding: 12px; + display: flex; + align-items: center; + gap: 9px; + flex-wrap: wrap; +} +.voice-icon { + width: 28px; + height: 28px; + display: grid; + place-items: center; + color: #8cb8d7; + background: #1b2934; + border-radius: 6px; +} +.voice-copy { + flex: 1; +} +.voice-copy strong, +.voice-copy small { + display: block; +} +.voice-copy strong { + font-size: 10px; +} +.voice-copy small { + font-size: 9px; + color: #788993; + margin-top: 3px; +} +.play-button { + width: 27px; + height: 27px; + border: 1px solid #34434c; + border-radius: 50%; + display: grid; + place-items: center; + color: #a3b7bf; + background: #111a20; +} +.voice-error { + width: 100%; + font-size: 9px; + color: #e2a3a0; + margin: 0 0 0 37px; +} +.dialog-overlay { + position: fixed; + inset: 0; + background: #020609bb; + z-index: 80; + backdrop-filter: blur(2px); +} +.dialog-content { + position: fixed; + z-index: 81; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: min(420px, calc(100% - 32px)); + padding: 24px; + background: #121d25; + border: 1px solid #33434c; + border-radius: 10px; + box-shadow: 0 25px 80px #0009; +} +.dialog-close { + position: absolute; + right: 12px; + top: 12px; + border: 0; + background: none; + color: #83939c; +} +.dialog-icon { + width: 36px; + height: 36px; + display: grid; + place-items: center; + color: #e4b362; + background: #352b1d; + border-radius: 8px; + margin-bottom: 15px; +} +.dialog-danger { + color: #f08d8c; + background: #392226; +} +.dialog-content h2 { + font-size: 17px; + margin: 0 0 7px; +} +.dialog-content p { + color: #9babb2; + font-size: 11px; + line-height: 1.6; + margin: 0; +} +.dialog-actions { + display: flex; + justify-content: end; + gap: 8px; + margin-top: 23px; +} +.error-box { + display: flex; + align-items: center; + gap: 8px; + padding: 12px; + background: #301f23; + border: 1px solid #704148; + color: #efb0ad; + border-radius: 6px; + font-size: 11px; +} +.loading { + padding: 40px; + text-align: center; + color: #8c9da5; +} +.muted-caption { + font-size: 10px; + color: #84949d; +} +.table-panel { + overflow: hidden; +} +.filter-row { + display: flex; + gap: 9px; + padding: 14px; + border-bottom: 1px solid #293740; +} +.search-box, +.select-wrap { + height: 34px; + display: flex; + align-items: center; + gap: 8px; + background: #0d161c; + border: 1px solid #2d3b44; + border-radius: 5px; + padding: 0 9px; + color: #788993; +} +.search-box { + flex: 1; + max-width: 310px; +} +.search-box input { + background: none; + border: 0; + outline: none; + min-width: 0; + width: 100%; + font-size: 10px; + color: #dae3e6; +} +.search-box input::placeholder { + color: #687983; +} +.select-wrap select, +.status-select, +.form-field select { + background: none; + border: 0; + outline: none; + color: #c5d0d5; + font-size: 10px; + cursor: pointer; +} +.select-wrap select option, +.status-select option, +.form-field select option { + background: #152129; + color: #dce7ea; +} +.status-select { + height: 34px; + padding: 0 10px; + background: #0d161c; + border: 1px solid #2d3b44; + border-radius: 5px; +} +.incident-table { + min-width: 690px; +} +.table-panel { + overflow-x: auto; +} +.table-head, +.table-row { + display: grid; + grid-template-columns: minmax(230px, 1.8fr) 1fr 1.1fr 0.8fr 22px; + gap: 12px; + align-items: center; + padding: 0 17px; +} +.table-head { + height: 35px; + background: #111c23; + color: #71828b; + font: 8px var(--font-mono); + letter-spacing: 0.8px; +} +.table-row { + min-height: 59px; + border-top: 1px solid #25323b; + color: #adbbc0; + font-size: 10px; +} +.table-row:hover { + background: #142129; +} +.table-row > span:first-child strong, +.table-row > span:first-child small { + display: block; +} +.table-row > span:first-child strong { + color: #d5dfe2; + font-size: 10px; + font-weight: 550; +} +.table-row > span:first-child small { + color: #82929a; + font-size: 9px; + margin-top: 4px; + text-transform: capitalize; +} +.table-row > span:first-child i { + font-style: normal; + padding: 0 4px; +} +.settings-note { + max-width: 630px; + padding: 22px; +} +.settings-note h2 { + font-size: 14px; + margin: 0 0 9px; +} +.settings-note p { + font-size: 11px; + color: #a0aeb4; + line-height: 1.6; + margin: 0 0 7px; +} +.settings-note p.muted { + color: #798993; +} +.demo-layout { + display: grid; + grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.8fr); + gap: 16px; + align-items: start; +} +.demo-form { + padding: 22px; +} +.demo-intro { + display: flex; + gap: 12px; + align-items: start; + margin-bottom: 22px; +} +.demo-icon { + width: 35px; + height: 35px; + display: grid; + place-items: center; + color: #53d3c6; + background: #14332f; + border-radius: 8px; + flex: none; +} +.demo-intro h2 { + font-size: 14px; + margin: 1px 0 5px; +} +.demo-intro p { + font-size: 10px; + line-height: 1.5; + color: #85969f; + margin: 0; +} +.form-field { + display: block; + margin: 17px 0; +} +.form-field > span { + display: block; + font: 8px var(--font-mono); + letter-spacing: 0.9px; + color: #83939c; + margin-bottom: 7px; +} +.form-field select { + width: 100%; + height: 38px; + border: 1px solid #30404a; + border-radius: 5px; + background: #0d161c; + padding: 0 10px; + color: #d4dfe2; + font-size: 11px; +} +.form-field small { + display: block; + font-size: 9px; + color: #758690; + margin: 6px 0; +} +.demo-safety { + display: flex; + align-items: start; + gap: 8px; + padding: 10px; + background: #13271f; + border: 1px solid #28503c; + border-radius: 5px; + color: #9bc9ae; + font-size: 9px; + line-height: 1.5; +} +.demo-safety svg { + flex: none; + color: #61c792; +} +.inject-button { + width: 100%; + margin-top: 15px; +} +.demo-aside { + padding: 7px 4px; +} +.demo-step { + display: flex; + gap: 12px; + padding: 14px 5px; + border-bottom: 1px solid #25343d; +} +.demo-step > span { + font: 11px var(--font-mono); + color: #40c9bb; + margin-top: 1px; +} +.demo-step strong { + font-size: 11px; +} +.demo-step p { + font-size: 10px; + color: #84959d; + line-height: 1.5; + margin: 5px 0 0; +} +.demo-result { + margin-top: 14px; + padding: 13px 15px; + display: flex; + align-items: center; + gap: 9px; + color: #9ed5b9; + font-size: 10px; +} +.demo-result > svg { + color: #5ecc93; +} +.demo-result a { + margin-left: auto; + color: #5ed5c9; + display: flex; + align-items: center; + gap: 5px; +} +.sidebar-scrim { + display: none; +} +@media (max-width: 1100px) { + .sidebar { + width: 210px; + } + .main-area { + margin-left: 210px; + } + .page { + padding-left: 24px; + padding-right: 24px; + } + .topbar { + padding: 0 24px; + } + .summary-strip > div { + padding: 15px 13px; + } + .content-grid { + grid-template-columns: 1.3fr 1fr; + } + .detail-grid { + grid-template-columns: minmax(0, 1.25fr) minmax(290px, 0.9fr); + } +} +@media (max-width: 820px) { + .sidebar { + transform: translateX(-100%); + transition: transform 0.2s ease; + width: 258px; + } + .sidebar.sidebar-open { + transform: translateX(0); + } + .sidebar-scrim { + display: block; + position: fixed; + inset: 0; + border: 0; + background: #0008; + z-index: 25; + } + .main-area { + margin-left: 0; + } + .mobile-menu { + display: grid; + margin-left: -6px; + } + .mobile-close { + display: grid; + margin-left: auto; + } + .brand { + align-items: center; + } + .topbar { + height: 56px; + padding: 0 18px; + justify-content: start; + gap: 12px; + } + .topbar-right { + margin-left: auto; + gap: 12px; + } + .operator-chip span:not(.avatar) { + display: none; + } + .page { + padding: 25px 20px 34px; + } + .footer { + padding: 13px 20px; + } + .summary-strip { + grid-template-columns: repeat(2, 1fr); + } + .summary-strip > div:nth-child(2) { + border-right: 0; + } + .summary-strip > div:nth-child(-n + 2) { + border-bottom: 1px solid var(--border); + } + .site-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + .content-grid { + grid-template-columns: 1fr; + } + .detail-grid { + grid-template-columns: 1fr; + } + .detail-aside { + grid-row: 1; + } + .demo-layout { + grid-template-columns: 1fr; + } + .demo-aside { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 8px; + } + .demo-step { + border: 1px solid var(--border); + border-radius: 6px; + padding: 11px; + } + .breadcrumb { + gap: 7px; + } + .detail-aside { + grid-template-columns: 1fr; + } + .table-panel { + margin-left: -2px; + margin-right: -2px; + } +} +@media (max-width: 560px) { + .topbar { + padding: 0 13px; + } + .topbar-right { + gap: 9px; + } + .demo-badge { + font-size: 8px; + padding: 6px 7px; + } + .demo-badge > span { + width: 6px; + height: 6px; + } + .live-indicator { + font-size: 0; + gap: 0; + } + .live-indicator .pulse { + width: 8px; + height: 8px; + } + .operator-chip { + padding: 0; + } + .operator-chip svg { + display: none; + } + .breadcrumb { + font-size: 10px; + gap: 5px; + } + .breadcrumb svg { + width: 13px; + } + .page { + padding: 21px 14px 28px; + } + .section-title { + align-items: start; + } + .section-title h1 { + font-size: 23px; + } + .section-title .updated-label { + font-size: 0; + margin-top: 5px; + } + .updated-label svg { + display: none; + } + .summary-strip { + margin-bottom: 26px; + } + .summary-strip > div { + gap: 9px; + padding: 13px 10px; + } + .summary-icon { + width: 29px; + height: 29px; + } + .summary-strip small { + font-size: 9px; + } + .summary-strip strong { + font-size: 15px; + } + .summary-strip em { + font-size: 9px; + } + .site-grid { + grid-template-columns: 1fr; + gap: 9px; + } + .site-card { + padding: 14px 14px 0; + } + .site-metrics { + padding: 14px 0 12px; + } + .content-grid { + gap: 10px; + } + .chart-panel, + .incident-panel { + padding: 15px 13px 0; + } + .chart-wrap { + height: 205px; + } + .chart-legend { + gap: 10px; + font-size: 8px; + } + .chart-units { + font-size: 7px; + } + .chart-foot { + font-size: 7px; + } + .compact-incident { + gap: 7px; + } + .compact-copy strong { + font-size: 10px; + } + .compact-incident .status-pill { + font-size: 8px; + padding: 4px 5px; + } + .footer { + padding: 12px 14px; + font-size: 8px; + } + .footer span:last-child { + display: none; + } + .detail-title { + display: block; + } + .detail-title > .status-pill { + display: inline-flex; + margin-top: 10px; + } + .detail-title h1 { + font-size: 21px; + line-height: 1.25; + } + .narrative-panel, + .timeline-panel { + padding: 15px; + } + .agent-tag { + font-size: 7px; + } + .summary-copy { + font-size: 11px; + } + .fix-panel { + padding: 14px; + } + .decision-actions { + grid-template-columns: 1fr 1.15fr; + } + .table-panel { + overflow-x: auto; + } + .filter-row { + padding: 10px; + gap: 6px; + flex-wrap: wrap; + } + .search-box { + max-width: none; + flex-basis: 100%; + } + .select-wrap, + .status-select { + flex: 1; + justify-content: center; + } + .table-head, + .table-row { + padding-left: 11px; + padding-right: 11px; + } + .demo-form { + padding: 16px; + } + .demo-aside { + grid-template-columns: 1fr; + } + .demo-step { + padding: 10px; + } + .demo-result { + align-items: start; + flex-wrap: wrap; + } + .demo-result a { + margin-left: 27px; + } + .section-title > .demo-badge { + font-size: 8px; + padding: 6px 7px; + margin-top: 5px; + } + .section-title > .demo-badge > span { + width: 7px; + height: 7px; + } + .error-box { + align-items: start; + } + .error-box button { + white-space: nowrap; + } + .dialog-content { + padding: 21px; + } +} diff --git a/apps/web/app/incidents/[id]/page.tsx b/apps/web/app/incidents/[id]/page.tsx new file mode 100644 index 0000000..2dea0a0 --- /dev/null +++ b/apps/web/app/incidents/[id]/page.tsx @@ -0,0 +1,9 @@ +import { IncidentDetail } from "@/components/incident-detail"; +export default async function Page({ + params, +}: { + params: Promise<{ id: string }>; +}) { + const { id } = await params; + return ; +} diff --git a/apps/web/app/incidents/page.tsx b/apps/web/app/incidents/page.tsx new file mode 100644 index 0000000..1c21d8e --- /dev/null +++ b/apps/web/app/incidents/page.tsx @@ -0,0 +1,9 @@ +import { IncidentList } from "@/components/incident-list"; +export default async function Page({ + searchParams, +}: { + searchParams: Promise<{ site?: string }>; +}) { + const { site } = await searchParams; + return ; +} diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx new file mode 100644 index 0000000..2451f51 --- /dev/null +++ b/apps/web/app/layout.tsx @@ -0,0 +1,20 @@ +import type { Metadata } from "next"; +import "./globals.css"; +import { Shell } from "@/components/shell"; +export const metadata: Metadata = { + title: "NetCortex · Network operations", + description: "Network health and incident response for independent ISPs.", +}; +export default function RootLayout({ + children, +}: { + children: React.ReactNode; +}) { + return ( + + + {children} + + + ); +} diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx new file mode 100644 index 0000000..22219e8 --- /dev/null +++ b/apps/web/app/page.tsx @@ -0,0 +1,4 @@ +import { Dashboard } from "@/components/dashboard"; +export default function Page() { + return ; +} diff --git a/apps/web/app/settings/page.tsx b/apps/web/app/settings/page.tsx new file mode 100644 index 0000000..2b110c2 --- /dev/null +++ b/apps/web/app/settings/page.tsx @@ -0,0 +1,16 @@ +export default function Page() { + return ( +
+
Workspace
+

Settings

+
+

Settings will be available when the service is connected

+

+ Site targets and provider switches are managed by the network service. + This dashboard does not save configuration yet. +

+

No configuration changes can be made here.

+
+
+ ); +} diff --git a/apps/web/components/dashboard.tsx b/apps/web/components/dashboard.tsx new file mode 100644 index 0000000..b36ed17 --- /dev/null +++ b/apps/web/components/dashboard.tsx @@ -0,0 +1,307 @@ +"use client"; +import Link from "next/link"; +import { useEffect, useState } from "react"; +import { + ArrowDownRight, + ArrowRight, + ArrowUpRight, + Clock3, + Globe2, + MoreHorizontal, + RadioTower, + Signal, + Wifi, +} from "lucide-react"; +import { apiMode, transport } from "@/lib/transport"; +import { makeSeries, sites as seedSites } from "@/lib/fixtures"; +import type { Incident, Point, Site } from "@/lib/types"; +import { LatencyChart } from "./latency-chart"; +import { SectionTitle, Status } from "./ui"; +function Pst({ date }: { date: string }) { + const [value, setValue] = useState("—"); + useEffect(() => { + const timer = window.setTimeout( + () => + setValue( + new Intl.DateTimeFormat("en-PK", { + timeZone: "Asia/Karachi", + hour: "2-digit", + minute: "2-digit", + hour12: false, + }).format(new Date(date)) + " PKT", + ), + 0, + ); + return () => window.clearTimeout(timer); + }, [date]); + return <>{value}; +} +export function Dashboard() { + const [sites, setSites] = useState( + apiMode === "mock" ? seedSites : [], + ), + [incidents, setIncidents] = useState([]), + [series, setSeries] = useState( + apiMode === "mock" ? makeSeries() : [], + ), + [error, setError] = useState(""); + const refresh = async () => { + try { + const [s, i, m] = await Promise.all([ + transport.sites(), + transport.incidents(), + transport.metrics("north-tower"), + ]); + setSites(s); + setIncidents(i); + setSeries(m); + setError(""); + } catch (e) { + setError(e instanceof Error ? e.message : "Could not load network data."); + } + }; + useEffect(() => { + const timer = window.setTimeout(() => void refresh(), 0); + const unsubscribe = transport.subscribe( + () => void refresh(), + () => void refresh(), + ); + return () => { + window.clearTimeout(timer); + unsubscribe(); + }; + }, []); + const urgent = incidents.filter((i) => + ["open", "awaiting_approval", "applying", "verifying"].includes(i.status), + ); + return ( +
+ +
+ Updating every minute{" "} + +
+
+ {error && ( +
+ {error} +
+ )} +
+
+ + + +
+ Sites monitored + + {sites.length} of 3 + +
+
+
+ + + +
+ Active incidents + + {urgent.length} need attention + +
+
+
+ + + +
+ Network availability + + {apiMode === "mock" ? "99.92" : "—"} + + {apiMode === "mock" ? "% · replay sample" : "API field pending"} + + +
+
+
+ + + +
+ Avg. response time + + {apiMode === "mock" ? "4.2" : "—"}{" "} + + {apiMode === "mock" + ? "min · replay sample" + : "API field pending"} + + +
+
+
+
+
+

Site health

+

Current service conditions across your network

+
+ + All incidents + +
+
+ {sites.map((s) => ( + +
+
+ + + {s.health === "ok" + ? "Operational" + : s.health === "degraded" + ? "Degraded" + : "Down"} + +
+ +
+

{s.name}

+

+ {s.location} · {s.subscribers} subscribers +

+
+
+ UPLINK USAGE + + {s.utilization} + % + +
+ +
+
+
+ WORST LATENCY + + {s.latency} + ms + +
+
+
+ + + {s.uplink} + + +
+ + ))} + {sites.length === 0 && !error && ( +
+ Waiting for site data from the API. +
+ )} +
+
+
+
+
+

Latency forecast

+

North Tower · external probe · past 24 hours, Pakistan time

+
+ MILLISECONDS +
+
+ + Actual + + + Expected + + + Forecast range + +
+ {series.length > 0 ? ( + + ) : ( +
+ No latency forecast data is available yet. +
+ )} +
+ + FORECAST DATA{" "} + {apiMode === "mock" ? "Replay fixture" : "API response"} + + + UPDATED{" "} + + + + +
+
+
+
+
+

Needs attention

+

Incidents that may need a decision

+
+ {urgent.length} +
+
+ {urgent.slice(0, 3).map((i) => ( + + + {i.cause === "uplink_down" ? ( + + ) : ( + + )} + + + {i.title} + + {i.siteName} · + + + + + ))} + {urgent.length === 0 && ( +
+ {apiMode === "mock" + ? "No active incidents in the replay sample." + : "No incident data available yet."} +
+ )} +
+ + View incident history + +
+
+
+ ); +} diff --git a/apps/web/components/demo-panel.tsx b/apps/web/components/demo-panel.tsx new file mode 100644 index 0000000..f6a3d0d --- /dev/null +++ b/apps/web/components/demo-panel.tsx @@ -0,0 +1,176 @@ +"use client"; + +import { useState } from "react"; +import Link from "next/link"; +import { ArrowRight, CheckCircle2, Play, RadioTower } from "lucide-react"; +import { scenarios, sites } from "@/lib/fixtures"; +import { apiMode, transport } from "@/lib/transport"; +import type { Incident, Scenario } from "@/lib/types"; +import { ErrorBox, SectionTitle } from "./ui"; + +const labels: Record = { + uplink_congestion: "Uplink congestion", + heavy_user: "Heavy user", + upstream_degradation: "Upstream degradation", + game_route_issue: "Game route issue", + wireless_interference: "Wireless interference", + uplink_down: "Uplink down", + dns_slow: "Slow DNS", + normal: "Normal traffic", +}; + +export function DemoPanel() { + const [site, setSite] = useState("north-tower"); + const [scenario, setScenario] = useState("uplink_congestion"); + const [duration, setDuration] = useState(10); + const [busy, setBusy] = useState(false); + const [incident, setIncident] = useState(null); + const [message, setMessage] = useState(""); + const [error, setError] = useState(""); + + const run = async () => { + setBusy(true); + setError(""); + setMessage(""); + setIncident(null); + try { + const result = await transport.inject(site, scenario, duration); + setIncident(result.incident ?? null); + setMessage(result.message); + } catch (cause) { + setError( + cause instanceof Error + ? cause.message + : "The scenario could not be replayed.", + ); + } finally { + setBusy(false); + } + }; + + return ( +
+ + + + {apiMode === "mock" ? "Demo: replayed data" : "Live network data"} + + +
+
+
+ + + +
+

Replay a network scenario

+

+ Choose a site and situation to see how NetCortex investigates an + incident. +

+
+
+ + + +
+ + + This demo uses replayed data. Actions stay in the local simulation + and do not reach a router. + +
+ {error && } + +
+ +
+ {message && ( +
+ + {message} + {incident ? ( + + Open incident + + ) : apiMode === "live" ? ( + + View incidents + + ) : null} +
+ )} +
+ ); +} diff --git a/apps/web/components/incident-detail.tsx b/apps/web/components/incident-detail.tsx new file mode 100644 index 0000000..d5b7a64 --- /dev/null +++ b/apps/web/components/incident-detail.tsx @@ -0,0 +1,360 @@ +"use client"; +import Link from "next/link"; +import { useCallback, useEffect, useRef, useState } from "react"; +import { + ArrowLeft, + Check, + ChevronRight, + ExternalLink, + Info, + Play, + RotateCcw, + ShieldCheck, + Volume2, +} from "lucide-react"; +import { transport } from "@/lib/transport"; +import type { Incident } from "@/lib/types"; +import { Confirm, CopyButton, ErrorBox, Status } from "./ui"; +function Pst({ date }: { date: string }) { + return ( + + ); +} +export function IncidentDetail({ id }: { id: string }) { + const [item, setItem] = useState(null), + [err, setErr] = useState(""), + [dialog, setDialog] = useState<"approve" | "reject" | null>(null), + [busy, setBusy] = useState(false), + [voiceErr, setVoiceErr] = useState(""), + [voiceUrl, setVoiceUrl] = useState(""); + const busyRef = useRef(false); + const load = useCallback( + () => + transport + .incident(id) + .then(setItem) + .catch((e) => setErr(e.message)), + [id], + ); + useEffect(() => { + const timer = window.setTimeout(() => void load(), 0); + const unsubscribe = transport.subscribe( + () => void load(), + () => void load(), + ); + return () => { + window.clearTimeout(timer); + unsubscribe(); + }; + }, [load]); + const decide = async () => { + if (!dialog || !item || busyRef.current) return; + busyRef.current = true; + setBusy(true); + setErr(""); + try { + const updated = await transport.decide(item.id, dialog, setItem); + setItem(updated); + setDialog(null); + } catch (e) { + setErr( + e instanceof Error ? e.message : "The decision could not be recorded.", + ); + } finally { + busyRef.current = false; + setBusy(false); + } + }; + if (!item) + return ( +
+ {err ? ( + + ) : ( +
Loading incident…
+ )} +
+ ); + const canApprove = + item.status === "awaiting_approval" && + item.dryRun === "passed" && + item.template !== "none" && + item.fix.length > 0; + const canReject = + item.status === "awaiting_approval" || item.status === "open"; + return ( +
+ + All incidents + + {err && } +
+
+
+ {item.id} · +
+

{item.title}

+

+ {item.siteName} · {item.cause.replaceAll("_", " ")} +

+
+ +
+
+
+
+
+
N
+
+ Network summary + + Investigation complete ·{" "} + {Math.round(item.confidence * 100)}% confidence + +
+ AGENT REPORT +
+

{item.summary}

+
+

+ What we observed +

+ {item.evidence.map((e) => ( +
+ + + + {e} +
+ ))} +
+
+
+
+
+

Incident timeline

+

Events recorded for this incident

+
+
+
+ {item.timeline.map((t, idx) => ( +
+ + {t.state === "done" ? : } + +
+ {t.label} +

{t.detail}

+ + + +
+
+ ))} +
+
+ {item.news && ( +
+
+ +
+
+

Upstream check

+

{item.news.label}

+ + View source + + + News links are external references and may not reflect your + network. + +
+
+ )} +
+ +
+ !v && setDialog(null)} + title="Approve this router change?" + description="The approved commands will be sent to the network service. You can review the rollback commands above." + confirmLabel="Approve change" + onConfirm={decide} + busy={busy} + /> + !v && setDialog(null)} + title="Reject this router change?" + description="The proposed commands will not be applied. This decision will be recorded on the incident." + confirmLabel="Reject change" + onConfirm={decide} + destructive + busy={busy} + /> +
+ ); +} diff --git a/apps/web/components/incident-list.tsx b/apps/web/components/incident-list.tsx new file mode 100644 index 0000000..2a67084 --- /dev/null +++ b/apps/web/components/incident-list.tsx @@ -0,0 +1,129 @@ +"use client"; +import Link from "next/link"; +import { useCallback, useEffect, useState } from "react"; +import { ArrowRight, Filter, Search } from "lucide-react"; +import { transport } from "@/lib/transport"; +import type { Incident } from "@/lib/types"; +import { SectionTitle, Status, ErrorBox } from "./ui"; +export function IncidentList({ initialSite = "" }: { initialSite?: string }) { + const [items, setItems] = useState([]), + [status, setStatus] = useState(""), + [site, setSite] = useState(initialSite), + [query, setQuery] = useState(""), + [err, setErr] = useState(""); + const load = useCallback( + () => + transport + .incidents(status || undefined, site || undefined) + .then(setItems) + .catch((e) => setErr(e.message)), + [status, site], + ); + useEffect(() => { + const timer = window.setTimeout(() => void load(), 0); + const unsubscribe = transport.subscribe( + () => void load(), + () => void load(), + ); + return () => { + window.clearTimeout(timer); + unsubscribe(); + }; + }, [load]); + const filtered = items.filter((i) => + `${i.title} ${i.siteName} ${i.cause}` + .toLowerCase() + .includes(query.toLowerCase()), + ); + return ( +
+ + {items.length} total + + {err && } +
+
+ + + +
+
+
+ INCIDENT + SITE + STATUS + OPENED + +
+ {filtered.map((i) => ( + + + {i.title} + + {i.id} · {i.cause.replaceAll("_", " ")} + + + {i.siteName} + + + + + {new Intl.DateTimeFormat("en-PK", { + timeZone: "Asia/Karachi", + hour: "2-digit", + minute: "2-digit", + hour12: false, + }).format(new Date(i.openedAt))}{" "} + PKT + + + + ))} + {!filtered.length && ( +
No incidents match these filters.
+ )} +
+
+
+ ); +} diff --git a/apps/web/components/latency-chart.tsx b/apps/web/components/latency-chart.tsx new file mode 100644 index 0000000..4d02b18 --- /dev/null +++ b/apps/web/components/latency-chart.tsx @@ -0,0 +1,95 @@ +"use client"; +import { + Area, + AreaChart, + CartesianGrid, + Line, + XAxis, + YAxis, + Tooltip, + ResponsiveContainer, +} from "recharts"; +import type { Point } from "@/lib/types"; +export function LatencyChart({ + data, + compact = false, +}: { + data: Point[]; + compact?: boolean; +}) { + return ( +
+ + + + + + + + + + + + + + + + + + +
+ ); +} diff --git a/apps/web/components/shell.tsx b/apps/web/components/shell.tsx new file mode 100644 index 0000000..dea5e61 --- /dev/null +++ b/apps/web/components/shell.tsx @@ -0,0 +1,142 @@ +"use client"; +import Link from "next/link"; +import { usePathname } from "next/navigation"; +import { + Activity, + AlertTriangle, + ChevronDown, + Command, + LayoutDashboard, + Menu, + RadioTower, + Settings, + ShieldCheck, + X, +} from "lucide-react"; +import { useState } from "react"; +import { apiMode } from "@/lib/transport"; +const nav = [ + { href: "/", label: "Overview", icon: LayoutDashboard }, + { href: "/incidents", label: "Incidents", icon: AlertTriangle }, + { href: "/demo", label: "Demo panel", icon: Command }, + { href: "/settings", label: "Settings", icon: Settings }, +]; +export function Shell({ children }: { children: React.ReactNode }) { + const path = usePathname(); + const [open, setOpen] = useState(false); + return ( +
+ + {open && ( + +
+ + Operations + / + + {path === "/" + ? "Overview" + : path.split("/")[1]?.replace(/^./, (s) => s.toUpperCase())} + +
+
+
+ + {apiMode === "mock" ? "Demo: replayed data" : "Live network data"} +
+
+ + {apiMode === "mock" ? "Replay" : "Live mode"} +
+ +
+ +
{children}
+
+ + Changes require operator approval + + + NetCortex · Pakistan Standard Time + +
+
+ + ); +} diff --git a/apps/web/components/ui.tsx b/apps/web/components/ui.tsx new file mode 100644 index 0000000..04af8d7 --- /dev/null +++ b/apps/web/components/ui.tsx @@ -0,0 +1,123 @@ +"use client"; +import * as Dialog from "@radix-ui/react-dialog"; +import { AlertCircle, Check, Copy, X } from "lucide-react"; +import { useState } from "react"; +export function SectionTitle({ + eyebrow, + title, + children, +}: { + eyebrow: string; + title: string; + children?: React.ReactNode; +}) { + return ( +
+
+
{eyebrow}
+

{title}

+
+ {children &&
{children}
} +
+ ); +} +export function Status({ status }: { status: string }) { + const label = status.replaceAll("_", " "); + return ( + + {status === "resolved" ? ( + + ) : status === "rolled_back" ? ( + + ) : ( + + )} + {label} + + ); +} +export function CopyButton({ text }: { text: string }) { + const [done, setDone] = useState(false); + return ( + + ); +} +export function Confirm({ + open, + onOpenChange, + title, + description, + confirmLabel, + onConfirm, + destructive = false, + busy = false, +}: { + open: boolean; + onOpenChange: (v: boolean) => void; + title: string; + description: string; + confirmLabel: string; + onConfirm: () => void; + destructive?: boolean; + busy?: boolean; +}) { + return ( + + + + + + + +
+ +
+ {title} + {description} +
+ + Go back + + +
+
+
+
+ ); +} +export function ErrorBox({ + message, + onRetry, +}: { + message: string; + onRetry?: () => void; +}) { + return ( +
+ + {message} + {onRetry && } +
+ ); +} diff --git a/apps/web/decision.md b/apps/web/decision.md new file mode 100644 index 0000000..c56aa6b --- /dev/null +++ b/apps/web/decision.md @@ -0,0 +1,16 @@ +# Web dashboard decisions + +- **Next.js App Router with TypeScript and Tailwind CSS v4.** This matches the build brief and current Next.js installation guidance. Versions are pinned in `package.json` and `package-lock.json`; Next.js 16.4.2 is the stable version selected during this build. Tradeoff: the App Router and React 19 are newer than the root CI runtime, so the root pipeline must use supported Node 20.9+ (the requested CI Node 22 is suitable). +- **Fixture-first typed transport boundary.** `Transport` centralizes sites, incidents, metrics, injection, decisions and stream subscription in `lib/transport.ts`. `NEXT_PUBLIC_API_MODE` selects fixture or live mode at build/runtime. This makes the interface work offline while keeping live errors visible. Fixture DTOs are provisional and do not claim to implement OpenAPI. Regenerate or replace types after Aun publishes the API schema. +- **Exact draft endpoints from the partner plan.** Live requests use `/sites`, `/metrics?site_id&from&to&series`, `/incidents?status`, `/incidents/{id}`, `/incidents/{id}/voice`, `/incidents/{id}/approve`, `/incidents/{id}/reject`, `/demo/scenarios`, and `/stream`. The provisional metrics series is `probe:1.1.1.1:rtt_ms`. Decision POST responses are acknowledgements only, followed by a GET of the incident; injection POST responses only confirm queued diagnosis and never become an incident record. Field mappings need validation against the eventual OpenAPI contract. +- **Explicit fixture provenance.** Persistent `Demo: replayed data` badge appears in every route. Fixture dry-run and apply states say they are simulated; mock mode does not contact a router. The voice control displays an unavailable message because there is no real bundled audio or voice endpoint contract yet. +- **Simulator topology source with a fixture boundary.** Subscriber counts, primary capacities and backup capacities in `lib/fixtures.ts` mirror the canonical `data/sites.yaml`: North Tower 120 / 180 Mbps / 80 Mbps backup, Market Cafe 48 / 100 Mbps / no backup, and East Relay 165 / 250 Mbps / 100 Mbps backup. The dashboard’s health, utilization, latency and loss remain illustrative replay samples, not live simulator readings. Keeping the split avoids contradicting topology while preserving the demo-only telemetry disclosure. +- **Approval guard and confirmation.** Approval is enabled only for `awaiting_approval`, `dryRun === passed`, a non-`none` template and non-empty commands. Rejection remains possible for `open` or `awaiting_approval`. Radix confirmation dialogs, a busy flag and transport state guards prevent accidental or repeated decisions. Fixture approval visibly advances through applying, verifying and then resolved or rolled back; fixture rejection becomes rejected. +- **Local incident fixture store.** Injection creates a browser-memory incident for actionable scenarios and a no-router-change message for normal/notify-only scenarios. Market Cafe has no configured backup, so an uplink-down replay there is notify-only. Queue, DNS and failover rollback commands match their proposed changes. Simulated CHR results are labeled as fixture-only. A refresh resets this memory state. There is no persistence claim. +- **SSE refresh strategy.** Named `metric`, `incident.opened`, `incident.updated`, `fix.tested`, and `fix.applied` events trigger a data refetch. `lastEventId` values are deduplicated within one EventSource connection; `onerror` and a subsequent `onopen` request refreshes as the stream recovers. Cleanup removes listeners and closes the source. Event envelope and ID replay semantics await Aun's confirmation. +- **Pakistan time without hydration mismatch.** The overview renders a placeholder for the live clock and formats timestamps after mount with `Intl.DateTimeFormat` and `Asia/Karachi`. This avoids server/client locale mismatch. +- **Settings deferred.** The settings route explains that configuration is managed by the service and does not show a fake save action while the Settings/API contract is unresolved. +- **Sentry SDK is optional and unverified.** Browser and Node configuration only initialize when a DSN exists. The installed SDK's current options omit `sendDefaultPii`; no PII capture is enabled in this app. Aun/lead must provide a project DSN and verify delivery before claiming monitoring is connected. No project provisioning or external event was done here. +- **Render runs SSR as a Node service.** The package `start` script runs `next start` and accepts Render's `--hostname`/`--port` arguments. `output: 'standalone'` is omitted because Next.js documents that `next start` cannot be used with standalone output. Static export would not match the requested Render SSR deployment. +- **OpenAPI types are generated only from a supplied schema URL.** `npm run api:types` requires `OPENAPI_URL`, downloads it with a ten-second deadline, checks it is an OpenAPI object, and writes a separate `lib/generated/openapi.d.ts`. There is no schema in this branch, so no generated types are claimed. +- **Unpatched development-tool advisory retained rather than forcing a breaking downgrade.** `npm audit` currently reports five high findings that all resolve to the same transitive `braces@3.0.3` advisory via `micromatch@4.0.8` → `fast-glob@3.3.1` → `@next/eslint-plugin-next@16.4.2` → `eslint-config-next@16.4.2`. The advisory is stack-exhaustion from deeply nested brace patterns; it lists no patched release, and the npm registry has no `braces` version beyond 3.0.3. `npm audit fix --dry-run` offers only the incompatible major downgrade to `eslint-config-next@14.2.35`, so no override or forced downgrade was applied. The dependency is in the lint toolchain only, not production dependencies; `npm audit --omit=dev` reports zero vulnerabilities. Recheck when upstream publishes a compatible fix. See [GHSA-vfj7-8cjw-p6xm](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm) and [upstream braces discussion](https://github.com/micromatch/braces/issues/84). diff --git a/apps/web/e2e/dashboard.spec.ts b/apps/web/e2e/dashboard.spec.ts new file mode 100644 index 0000000..0635924 --- /dev/null +++ b/apps/web/e2e/dashboard.spec.ts @@ -0,0 +1,128 @@ +import { expect, test } from "@playwright/test"; +import path from "node:path"; + +test("overview and site layout render at desktop and phone widths", async ({ + page, +}, testInfo) => { + await page.goto("/"); + await expect( + page.getByRole("heading", { name: "Network overview" }), + ).toBeVisible(); + await expect(page.getByText("Demo: replayed data").first()).toBeVisible(); + await expect( + page.getByRole("heading", { name: "North Tower" }), + ).toBeVisible(); + await expect(page.getByText("Rawalpindi · 120 subscribers")).toBeVisible(); + await expect(page.getByText("ether1 · 180 Mbps")).toBeVisible(); + await expect(page.getByText("Lahore · 48 subscribers")).toBeVisible(); + await expect(page.getByText("ether1 · 100 Mbps")).toBeVisible(); + await expect(page.getByText("Islamabad · 165 subscribers")).toBeVisible(); + await expect(page.getByText("ether1 · 250 Mbps")).toBeVisible(); + await expect( + page.getByRole("heading", { name: "Latency forecast" }), + ).toBeVisible(); + await page.addStyleTag({ + content: "nextjs-portal { display: none !important; }", + }); + await page.screenshot({ + path: path.resolve( + process.cwd(), + "test-results", + `overview-${testInfo.project.name}.png`, + ), + fullPage: true, + }); +}); + +test("approval needs confirmation and visibly simulates each stage", async ({ + page, +}) => { + await page.goto("/incidents/INC-2084"); + await page.getByRole("button", { name: "Approve change" }).first().click(); + await expect(page.getByRole("dialog")).toBeVisible(); + await page.getByRole("button", { name: "Go back" }).click(); + await expect(page.getByRole("dialog")).toBeHidden(); + await page.getByRole("button", { name: "Approve change" }).first().click(); + await page + .getByRole("dialog") + .getByRole("button", { name: "Approve change" }) + .dblclick(); + await expect(page.getByText("applying", { exact: true })).toBeVisible(); + await expect(page.getByText("verifying", { exact: true })).toBeVisible(); + await expect(page.getByText("resolved", { exact: true })).toBeVisible(); +}); + +test("failed router check blocks approval and rejection is confirmed", async ({ + page, +}) => { + await page.goto("/incidents/INC-2083"); + await expect(page.getByText("Router test failed").first()).toBeVisible(); + await expect( + page.getByRole("button", { name: "Approve change" }), + ).toHaveCount(0); + await page.getByRole("button", { name: "Reject change" }).click(); + await expect(page.getByRole("dialog")).toBeVisible(); + await page + .getByRole("dialog") + .getByRole("button", { name: "Reject change" }) + .click(); + await expect(page.getByText("rejected", { exact: true })).toBeVisible(); +}); + +test("demo injection opens a new coherent incident", async ({ page }) => { + await page.goto("/demo"); + await page.getByLabel("Scenario", { exact: true }).selectOption("dns_slow"); + await page.getByRole("button", { name: "Replay scenario" }).click(); + await expect( + page.getByText("Scenario replayed. A reviewable incident is ready."), + ).toBeVisible(); + await page.getByRole("link", { name: "Open incident" }).click(); + await expect( + page.getByText( + "CHR test simulated · replay fixture only · no router command was sent", + ), + ).toBeVisible(); +}); + +test("uplink down at a site without backup is notify-only", async ({ + page, +}) => { + await page.goto("/demo"); + await page.getByLabel("Network site").selectOption("market-cafe"); + await page + .getByLabel("Scenario", { exact: true }) + .selectOption("uplink_down"); + await page.getByRole("button", { name: "Replay scenario" }).click(); + await expect(page.getByText(/no router change is proposed/i)).toBeVisible(); + await page.getByRole("link", { name: "Open incident" }).click(); + await expect(page.getByText(/no backup uplink is configured/i)).toBeVisible(); + await expect( + page.getByRole("button", { name: "Approve change" }), + ).toHaveCount(0); +}); + +test("an approved backup failover can simulate rollback", async ({ page }) => { + await page.goto("/demo"); + await page + .getByLabel("Scenario", { exact: true }) + .selectOption("uplink_down"); + await page.getByRole("button", { name: "Replay scenario" }).click(); + await page.getByRole("link", { name: "Open incident" }).click(); + await page.getByRole("button", { name: "Approve change" }).first().click(); + await page + .getByRole("dialog") + .getByRole("button", { name: "Approve change" }) + .click(); + await expect(page.getByText("applying", { exact: true })).toBeVisible(); + await expect(page.getByText("verifying", { exact: true })).toBeVisible(); + await expect(page.getByText("rolled back", { exact: true })).toBeVisible(); +}); + +test("unknown incident reports an explicit missing record", async ({ + page, +}) => { + await page.goto("/incidents/unknown"); + await expect( + page.getByText("Incident not found. Refresh the list and try again."), + ).toBeVisible(); +}); diff --git a/apps/web/e2e/live-mode.spec.ts b/apps/web/e2e/live-mode.spec.ts new file mode 100644 index 0000000..e5a09dc --- /dev/null +++ b/apps/web/e2e/live-mode.spec.ts @@ -0,0 +1,214 @@ +import { expect, test } from "@playwright/test"; + +test("live API errors remain visible and never show fixture records", async ({ + page, +}) => { + await page.route("http://127.0.0.1:3137/**", (route) => + route.fulfill({ + status: 503, + contentType: "application/json", + body: JSON.stringify({ detail: "service unavailable" }), + }), + ); + await page.goto("/"); + await expect( + page.getByText("API request failed (503). Try again."), + ).toBeVisible(); + await expect(page.getByRole("heading", { name: "North Tower" })).toHaveCount( + 0, + ); + await expect( + page.getByText("No latency forecast data is available yet."), + ).toBeVisible(); + await expect(page.getByText("Live network data")).toBeVisible(); + await expect(page.getByText("Demo: replayed data")).toHaveCount(0); +}); + +test("named stream events refetch data, duplicate ids are ignored, and listeners close with the page", async ({ + page, +}) => { + let siteReads = 0; + await page.route("http://127.0.0.1:3137/**", async (route) => { + const url = new URL(route.request().url()); + if (url.pathname === "/sites") { + siteReads += 1; + await route.fulfill({ + json: [ + { + id: "demo-live", + name: "Live Test Site", + location: "Lahore", + subscribers: 12, + health: "ok", + utilization: 20, + latency: 15, + loss: 0, + uplink: "ether1", + }, + ], + }); + } else if (url.pathname === "/incidents") { + await route.fulfill({ json: [] }); + } else if (url.pathname === "/metrics") { + await route.fulfill({ + json: [{ time: "10:00", actual: 15, p10: 10, p50: 14, p90: 19 }], + }); + } else { + await route.fulfill({ status: 204, body: "" }); + } + }); + await page.addInitScript(() => { + const listeners = new Map void>>(); + class FakeEventSource { + onerror: ((event: Event) => void) | null = null; + onopen: (() => void) | null = null; + constructor() { + Object.assign(window, { netCortexSource: this }); + } + addEventListener(type: string, callback: (event: Event) => void) { + if (!listeners.has(type)) listeners.set(type, new Set()); + listeners.get(type)?.add(callback); + } + removeEventListener(type: string, callback: (event: Event) => void) { + listeners.get(type)?.delete(callback); + } + close() { + Object.assign(window, { streamClosed: true }); + } + } + Object.assign(window, { + EventSource: FakeEventSource, + dispatchNetCortexEvent: (type: string, id: string) => + listeners + .get(type) + ?.forEach((callback) => + callback(new MessageEvent(type, { lastEventId: id })), + ), + }); + }); + await page.goto("/"); + await expect( + page.getByRole("heading", { name: "Live Test Site" }), + ).toBeVisible(); + await expect.poll(() => siteReads).toBe(1); + await page.evaluate(() => + ( + window as unknown as Window & { + netCortexSource: { onopen: (() => void) | null }; + } + ).netCortexSource.onopen?.(), + ); + await page.evaluate(() => + ( + window as unknown as Window & { + dispatchNetCortexEvent: (type: string, id: string) => void; + } + ).dispatchNetCortexEvent("incident.opened", "event-17"), + ); + await expect.poll(() => siteReads).toBe(2); + await page.evaluate(() => + ( + window as unknown as Window & { + dispatchNetCortexEvent: (type: string, id: string) => void; + } + ).dispatchNetCortexEvent("incident.opened", "event-17"), + ); + await page.waitForTimeout(150); + expect(siteReads).toBe(2); + await page.evaluate(() => + ( + window as unknown as Window & { + netCortexSource: { onerror: ((event: Event) => void) | null }; + } + ).netCortexSource.onerror?.(new Event("error")), + ); + await expect.poll(() => siteReads).toBe(3); + await page.evaluate(() => + ( + window as unknown as Window & { + netCortexSource: { onopen: (() => void) | null }; + } + ).netCortexSource.onopen?.(), + ); + await expect.poll(() => siteReads).toBe(4); + await page.getByRole("link", { name: "Settings" }).click(); + await expect( + page.getByRole("heading", { name: "Settings", exact: true }), + ).toBeVisible(); + await expect + .poll(() => + page.evaluate( + () => + (window as unknown as Window & { streamClosed?: boolean }) + .streamClosed, + ), + ) + .toBe(true); +}); + +test("live approval treats POST as an acknowledgement and reloads incident state", async ({ + page, +}) => { + const incident = { + id: "LIVE-1", + siteId: "live-site", + siteName: "Live Site", + cause: "uplink_congestion", + title: "Live uplink congestion", + status: "awaiting_approval", + confidence: 0.9, + openedAt: "2026-10-18T10:00:00Z", + summary: "Live record", + evidence: ["Recorded probe evidence"], + template: "priority_queue", + fix: ["/queue tree add name=priority"], + rollback: ["/queue tree remove priority"], + dryRun: "passed", + dryRunMessage: "Passed", + timeline: [], + }; + let reads = 0; + let posted = false; + await page.route("http://127.0.0.1:3137/**", async (route) => { + const request = route.request(); + const url = new URL(request.url()); + if (url.pathname === "/incidents/LIVE-1" && request.method() === "GET") { + reads += 1; + await route.fulfill({ + json: { + ...incident, + status: posted ? "applying" : "awaiting_approval", + timeline: posted + ? [ + { + at: "2026-10-18T10:01:00Z", + label: "Accepted", + detail: "Server update", + state: "active", + }, + ] + : [], + }, + }); + } else if ( + url.pathname === "/incidents/LIVE-1/approve" && + request.method() === "POST" + ) { + posted = true; + await route.fulfill({ + status: 202, + json: { accepted: true, message: "queued" }, + }); + } else { + await route.fulfill({ status: 204, body: "" }); + } + }); + await page.goto("/incidents/LIVE-1"); + await page.getByRole("button", { name: "Approve change" }).first().click(); + await page + .getByRole("dialog") + .getByRole("button", { name: "Approve change" }) + .click(); + await expect(page.getByText("applying", { exact: true })).toBeVisible(); + expect(reads).toBeGreaterThanOrEqual(2); +}); diff --git a/apps/web/eslint.config.mjs b/apps/web/eslint.config.mjs new file mode 100644 index 0000000..7ad8129 --- /dev/null +++ b/apps/web/eslint.config.mjs @@ -0,0 +1,16 @@ +import { defineConfig, globalIgnores } from "eslint/config"; +import nextVitals from "eslint-config-next/core-web-vitals"; +import nextTs from "eslint-config-next/typescript"; +export default defineConfig([ + ...nextVitals, + ...nextTs, + globalIgnores([ + ".next/**", + "out/**", + "build/**", + "next-env.d.ts", + "node_modules/**", + "test-results/**", + "playwright-report/**", + ]), +]); diff --git a/apps/web/flow.md b/apps/web/flow.md new file mode 100644 index 0000000..d335930 --- /dev/null +++ b/apps/web/flow.md @@ -0,0 +1,56 @@ +# Dashboard routes and walkthrough + +```mermaid +flowchart TD + Browser[Operator browser] --> App[Next.js App Router] + App --> Home[Overview /] + App --> List[Incident list /incidents] + App --> Detail[Incident detail /incidents/id] + App --> Demo[Demo panel /demo] + App --> Settings[Settings /settings read only] + Home --> T[Typed transport] + List --> T + Detail --> T + Demo --> T + T --> Mode{NEXT_PUBLIC_API_MODE} + Mode -->|mock| Store[In-memory fixture store] + Mode -->|live| API[FastAPI draft API] + API --> SSE[/stream named events/] + SSE --> T + Store --> Views[Render fixture records with replay disclosure] + API --> Views + Detail --> Guard{Awaiting approval + passed dry run + valid fix?} + Guard -->|yes| Confirm[Approve confirmation] + Guard -->|reject eligible| Reject[Reject confirmation] + Confirm --> Decide[POST approve] + Reject --> Decide2[POST reject] + Decide -->|mock| Sim[Applying → verifying → resolved or rolled back] + Decide2 -->|mock| Rejected[rejected] + Decide -->|live| API + Decide2 -->|live| API + App -. optional DSN .-> Sentry[Sentry browser and server SDK] +``` + +## Route entry points and inputs + +| Route | Entry point | User inputs | Transport calls | Visible result and errors | +| ----------------- | ------------------------------------------------ | -------------------------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | +| `/` | `app/page.tsx` → `Dashboard` | Choose a site card or incident | `sites()`, `incidents()`, `metrics(siteId)`, `subscribe()` | Site health, forecast chart, active incident links. Request failures show a retryable inline error. | +| `/incidents` | `app/incidents/page.tsx` → `IncidentList` | Search text, site filter, status filter | `incidents(status, siteId)` | Newest-first incident table; error and empty states are distinct. | +| `/incidents/[id]` | `app/incidents/[id]/page.tsx` → `IncidentDetail` | Copy commands, request voice alert, approve/reject | `incident(id)`, `voice(id)`, `decide(id, decision)` | Evidence, timeline, fix/rollback, test result, optional upstream link. Mock voice clearly reports unavailable; live voice requests the API MP3. | +| `/demo` | `app/demo/page.tsx` → `DemoPanel` | Site, one of seven scenarios or normal traffic, duration | `inject(siteId, scenario, duration)` | Fixture creates a reviewable incident or an advice-only message. Failure stays visible. | +| `/settings` | `app/settings/page.tsx` | None | None | Read-only explanation until backend settings contract exists; there is no fake save button. | + +## Transport and lifecycle + +`lib/transport.ts` implements the `Transport` interface. Live mode uses GET `/sites`, GET `/metrics?site_id=…&series=probe%3A1.1.1.1%3Artt_ms&from=&to=`, GET `/incidents?status=…`, GET `/incidents/{id}`, GET `/incidents/{id}/voice` (audio blob), POST `/demo/scenarios`, POST `/incidents/{id}/approve`, POST `/incidents/{id}/reject`, and EventSource GET `/stream`. Decision POST bodies are treated only as acknowledgements: the app immediately GETs `/incidents/{id}` and renders that authoritative record. Scenario injection POST is also treated as an acknowledgement; the app says diagnosis is queued and links to the incident list rather than treating the response as an incident. Each fetch has a seven-second abort timeout; OpenAPI download is separately bounded to ten seconds. A failed live request raises an error; there is no fixture fallback. These payload mappings are provisional until OpenAPI is available. The metrics key currently uses the documented `probe::rtt_ms` pattern and remains provisional until the published schema confirms it. Run `OPENAPI_URL= npm run api:types` to generate a separate type file once Aun publishes the schema. No generated types are currently present. + +The stream subscribes to `metric`, `incident.opened`, `incident.updated`, `fix.tested`, and `fix.applied`. Any event causes a route refresh. Repeated event IDs are ignored in the current connection. EventSource reconnects itself; both `onerror` and a later `onopen` trigger a refresh so recovery is reflected. Component cleanup removes listeners and closes the connection. Server event IDs, replay and heartbeat behavior remain an integration question. + +In mock mode, injection adds a browser-memory incident for each of the seven catalog scenarios; normal traffic produces no incident. The three notify-only causes and an uplink failure at Market Cafe (which has no configured backup) use `template: none`, have no router commands, and cannot be approved. Actionable mock incidents show clearly simulated test evidence. Approval is possible only when the status is `awaiting_approval`, the test passed, and the template and command list are valid. A confirmation dialog precedes approve/reject, and a synchronous busy guard prevents repeat submissions. Mock approval exposes applying, verifying, then either resolved or rolled-back states according to the chosen scenario; rejection records rejected. Site cards reflect active replayed incidents. These timers model a workflow and do not contact CHR or a physical router. + +The optional Sentry SDK is initialized from `NEXT_PUBLIC_SENTRY_DSN` in the browser and `SENTRY_DSN` on the server. No PII capture is enabled in the app. Without a DSN no event is sent; the UI does not claim connection or verification. + +## Dependency audit boundary + +`npm audit` reports five high findings for one advisory: `braces@3.0.3` (stack exhaustion on deeply nested brace patterns), pulled only through the Next.js ESLint toolchain (`eslint-config-next` → `@next/eslint-plugin-next` → `fast-glob` → `micromatch` → `braces`). The advisory has no patched package version. npm's suggested fix is the incompatible `eslint-config-next@14.2.35` downgrade from the app's Next.js 16 setup, so the lockfile is left intact. This toolchain is a development dependency; `npm audit --omit=dev` reports zero vulnerabilities. See [the advisory](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm) and [upstream issue](https://github.com/micromatch/braces/issues/84). Recheck after an upstream release or dependency chain change. diff --git a/apps/web/instrumentation-client.ts b/apps/web/instrumentation-client.ts new file mode 100644 index 0000000..2f85c7a --- /dev/null +++ b/apps/web/instrumentation-client.ts @@ -0,0 +1,6 @@ +import * as Sentry from "@sentry/nextjs"; +if (process.env.NEXT_PUBLIC_SENTRY_DSN) + Sentry.init({ + dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, + tracesSampleRate: 0.1, + }); diff --git a/apps/web/instrumentation.ts b/apps/web/instrumentation.ts new file mode 100644 index 0000000..c6ba595 --- /dev/null +++ b/apps/web/instrumentation.ts @@ -0,0 +1,6 @@ +import * as Sentry from "@sentry/nextjs"; +export async function register() { + if (process.env.NEXT_RUNTIME === "nodejs") + await import("./sentry.server.config"); +} +export const onRequestError = Sentry.captureRequestError; diff --git a/apps/web/lib/fixtures.ts b/apps/web/lib/fixtures.ts new file mode 100644 index 0000000..7b8797c --- /dev/null +++ b/apps/web/lib/fixtures.ts @@ -0,0 +1,197 @@ +import type { Incident, Point, Scenario, Site } from "./types"; +// Subscriber counts and link capacities mirror data/sites.yaml. Health, utilization, latency, and loss below are illustrative replay samples. +export const sites: Site[] = [ + { + id: "north-tower", + name: "North Tower", + location: "Rawalpindi", + subscribers: 120, + health: "degraded", + utilization: 91, + latency: 64, + loss: 1.2, + uplink: "ether1 · 180 Mbps", + backupUplink: "ether2 · 80 Mbps", + }, + { + id: "market-cafe", + name: "Market Cafe", + location: "Lahore", + subscribers: 48, + health: "ok", + utilization: 48, + latency: 22, + loss: 0, + uplink: "ether1 · 100 Mbps", + }, + { + id: "east-relay", + name: "East Relay", + location: "Islamabad", + subscribers: 165, + health: "down", + utilization: 18, + latency: 184, + loss: 32, + uplink: "ether1 · 250 Mbps", + backupUplink: "ether2 · 100 Mbps", + }, +]; +export const scenarios: Scenario[] = [ + "uplink_congestion", + "heavy_user", + "upstream_degradation", + "game_route_issue", + "wireless_interference", + "uplink_down", + "dns_slow", + "normal", +]; +const now = Date.now(); +export const initialIncidents: Incident[] = [ + { + id: "INC-2084", + siteId: "north-tower", + siteName: "North Tower", + cause: "uplink_congestion", + title: "Uplink congestion on ether1", + status: "awaiting_approval", + confidence: 0.94, + openedAt: new Date(now - 12 * 60000).toISOString(), + summary: + "Latency is rising across external targets while ether1 remains above 90% utilization. The gateway is healthy, which points to a saturated uplink rather than a local radio issue.", + evidence: [ + "ether1 at 91% utilization for 8 minutes", + "1.1.1.1 latency reached 64 ms (baseline 24 ms)", + "Gateway latency remains steady at 2 ms", + ], + template: "priority_queue", + fix: [ + "/queue tree add name=priority-traffic parent=global packet-mark=priority", + "/queue tree set priority-traffic priority=1 limit-at=20M max-limit=35M", + ], + rollback: ['/queue tree remove [find name="priority-traffic"]'], + dryRun: "passed", + dryRunMessage: + "Demo fixture: router test passed in a recorded sample; no CHR was contacted.", + news: { + label: + "Demo fixture: placeholder upstream result; no live check was made.", + url: "https://status.example.net", + }, + timeline: [ + { + at: new Date(now - 12 * 60000).toISOString(), + label: "Incident detected", + detail: "Latency exceeded forecast range for 3 consecutive samples.", + state: "done", + }, + { + at: new Date(now - 10 * 60000).toISOString(), + label: "Investigation complete", + detail: "Agent found uplink saturation across all external targets.", + state: "done", + }, + { + at: new Date(now - 8 * 60000).toISOString(), + label: "Router test passed", + detail: "Recorded fixture result; no virtual router was contacted.", + state: "done", + }, + { + at: new Date(now - 7 * 60000).toISOString(), + label: "Waiting for your decision", + detail: "Review the tested change before it is applied.", + state: "active", + }, + ], + }, + { + id: "INC-2083", + siteId: "east-relay", + siteName: "East Relay", + cause: "uplink_down", + title: "Primary uplink unreachable", + status: "open", + confidence: 0.99, + openedAt: new Date(now - 28 * 60000).toISOString(), + summary: + "The primary uplink has stopped responding. Loss is confirmed across external targets.", + evidence: [ + "Primary uplink loss at 100% for 6 minutes", + "Configured backup uplink detected", + ], + template: "failover_route", + fix: ['/ip route set [find comment="primary"] distance=2'], + rollback: ['/ip route set [find comment="primary"] distance=1'], + dryRun: "failed", + dryRunMessage: + "Demo fixture: router test failed in a recorded sample; no CHR was contacted.", + timeline: [ + { + at: new Date(now - 28 * 60000).toISOString(), + label: "Incident detected", + detail: "No response from primary uplink.", + state: "done", + }, + { + at: new Date(now - 27 * 60000).toISOString(), + label: "Router test failed", + detail: "Backup gateway could not be reached in CHR.", + state: "active", + }, + ], + }, + { + id: "INC-2082", + siteId: "market-cafe", + siteName: "Market Cafe", + cause: "upstream_degradation", + title: "Upstream provider latency", + status: "resolved", + confidence: 0.82, + openedAt: new Date(now - 95 * 60000).toISOString(), + summary: + "External targets showed elevated latency while local utilization stayed within normal range. No router change was required.", + evidence: [ + "External latency elevated on 4 targets", + "Uplink utilization at 48%", + ], + template: "none", + fix: [], + rollback: [], + dryRun: "pending", + dryRunMessage: "No router change proposed for this incident.", + news: { + label: + "Demo fixture: placeholder provider result; no live outage check was made.", + url: "https://status.example.net", + }, + timeline: [ + { + at: new Date(now - 95 * 60000).toISOString(), + label: "Incident detected", + detail: "External latency rose.", + state: "done", + }, + { + at: new Date(now - 83 * 60000).toISOString(), + label: "Resolved", + detail: "Provider service recovered.", + state: "done", + }, + ], + }, +]; +export function makeSeries(): Point[] { + return Array.from({ length: 24 }, (_, i) => { + const base = 27 + Math.sin(i / 3) * 4 + (i > 16 ? (i - 16) * 5 : 0); + return { + time: `${String(i).padStart(2, "0")}:00`, + actual: Math.round(base + Math.sin(i * 2.2) * 5), + p10: Math.round(base - 7), + p50: Math.round(base), + p90: Math.round(base + 8), + }; + }); +} diff --git a/apps/web/lib/transport.ts b/apps/web/lib/transport.ts new file mode 100644 index 0000000..4ef91e9 --- /dev/null +++ b/apps/web/lib/transport.ts @@ -0,0 +1,426 @@ +import { + initialIncidents, + makeSeries, + sites as fixtureSites, +} from "./fixtures"; +import type { Incident, IncidentStatus, Scenario, Site } from "./types"; + +export interface InjectionResult { + incident?: Incident; + message: string; +} + +export interface Transport { + sites(): Promise; + incidents(status?: string, siteId?: string): Promise; + incident(id: string): Promise; + metrics(siteId: string): Promise>; + voice(id: string): Promise; + inject( + siteId: string, + scenario: Scenario, + duration: number, + ): Promise; + decide( + id: string, + decision: "approve" | "reject", + onUpdate?: (incident: Incident) => void, + ): Promise; + subscribe( + onEvent: (event: MessageEvent) => void, + onReconnect: () => void, + ): () => void; +} + +const mode = process.env.NEXT_PUBLIC_API_MODE ?? "mock"; +const base = process.env.NEXT_PUBLIC_API_BASE_URL ?? ""; + +async function request(path: string, init?: RequestInit): Promise { + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), 7000); + try { + const response = await fetch(`${base}${path}`, { + ...init, + signal: controller.signal, + headers: { "Content-Type": "application/json", ...init?.headers }, + }); + if (!response.ok) + throw new Error(`API request failed (${response.status}). Try again.`); + return (await response.json()) as T; + } catch (error) { + if (error instanceof Error) throw error; + throw new Error( + "The API could not be reached. Check the connection and try again.", + ); + } finally { + clearTimeout(timer); + } +} + +async function requestAck(path: string, init?: RequestInit): Promise { + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), 7000); + try { + const response = await fetch(`${base}${path}`, { + ...init, + signal: controller.signal, + headers: { "Content-Type": "application/json", ...init?.headers }, + }); + if (!response.ok) + throw new Error(`API request failed (${response.status}). Try again.`); + } catch (error) { + if (error instanceof Error) throw error; + throw new Error( + "The API could not be reached. Check the connection and try again.", + ); + } finally { + clearTimeout(timer); + } +} + +let mockIncidents = initialIncidents.map((incident) => ({ ...incident })); +const pause = (ms = 100) => new Promise((resolve) => setTimeout(resolve, ms)); + +function update( + id: string, + status: IncidentStatus, + label: string, + detail = "Recorded by the local replay.", +) { + mockIncidents = mockIncidents.map((incident) => + incident.id === id + ? { + ...incident, + status, + timeline: [ + ...incident.timeline, + { at: new Date().toISOString(), label, detail, state: "done" }, + ], + } + : incident, + ); +} + +function currentSites(): Site[] { + return fixtureSites.map((site) => { + const active = mockIncidents.filter( + (incident) => + incident.siteId === site.id && + ["open", "awaiting_approval", "applying", "verifying"].includes( + incident.status, + ), + ); + const severe = active.some((incident) => incident.cause === "uplink_down"); + if (!active.length) return site; + return { ...site, health: severe ? "down" : "degraded" }; + }); +} + +function newMockIncident( + site: Site, + scenario: Scenario, + duration: number, +): Incident { + const noFix = [ + "upstream_degradation", + "game_route_issue", + "wireless_interference", + ].includes(scenario); + const noBackup = scenario === "uplink_down" && !site.backupUplink; + const adviceOnly = noFix || noBackup; + const templates: Partial> = { + uplink_congestion: "priority_queue", + heavy_user: "queue_limit", + uplink_down: "failover_route", + dns_slow: "dns_servers", + }; + const commands: Partial> = { + uplink_congestion: [ + "/queue tree add name=demo-priority parent=global packet-mark=priority priority=1", + ], + heavy_user: [ + "/queue simple add name=demo-user target=192.0.2.8/32 max-limit=10M/10M", + ], + uplink_down: ['/ip route set [find comment="primary"] distance=2'], + dns_slow: ["/ip dns set servers=1.1.1.1,8.8.8.8"], + }; + const rollback: Partial> = { + uplink_congestion: ['/queue tree remove [find name="demo-priority"]'], + heavy_user: ['/queue simple remove [find name="demo-user"]'], + uplink_down: ['/ip route set [find comment="primary"] distance=1'], + dns_slow: ["/ip dns set servers=192.0.2.53"], + }; + const timestamp = new Date().toISOString(); + const id = `INC-${2085 + mockIncidents.length}`; + return { + ...mockIncidents[0], + id, + siteId: site.id, + siteName: site.name, + cause: scenario === "normal" ? "upstream_degradation" : scenario, + title: + scenario === "normal" + ? `Normal traffic at ${site.name}` + : `${scenario.replaceAll("_", " ")} at ${site.name}`, + status: "awaiting_approval", + openedAt: timestamp, + summary: noBackup + ? `The primary uplink is down at ${site.name}, which has no configured backup uplink. The replay provides notify-only guidance; no route change is proposed.` + : `A ${scenario.replaceAll("_", " ")} replay was injected at ${site.name}. Review the recorded evidence${adviceOnly ? " and service guidance" : " and router test"} before deciding.`, + template: adviceOnly ? "none" : (templates[scenario] ?? "none"), + fix: adviceOnly ? [] : (commands[scenario] ?? []), + rollback: adviceOnly ? [] : (rollback[scenario] ?? []), + dryRun: adviceOnly ? "pending" : "passed", + dryRunMessage: noBackup + ? "No backup uplink is configured. Notify-only guidance; no router change or CHR test is available." + : adviceOnly + ? "No router change proposed for this scenario." + : "CHR test simulated · replay fixture only · no router command was sent", + simulatedOutcome: + scenario === "uplink_down" && !noBackup ? "rolled_back" : "resolved", + evidence: noBackup + ? [ + `Primary uplink down for ${duration} minutes`, + "No backup uplink is configured for this site", + ] + : [ + `${scenario.replaceAll("_", " ")} signal replayed for ${duration} minutes`, + `Sample evidence recorded at ${site.name}`, + ], + timeline: [ + { + at: timestamp, + label: "Demo incident replayed", + detail: "Scenario and evidence generated from the local fixture.", + state: "done", + }, + ...(!adviceOnly + ? [ + { + at: timestamp, + label: "Router test passed", + detail: "Fixture result only. No CHR was contacted.", + state: "done" as const, + }, + ] + : []), + { + at: timestamp, + label: "Waiting for your decision", + detail: "Approval advances the local simulation only.", + state: "active", + }, + ], + }; +} + +export const transport: Transport = { + async sites() { + return mode === "live" + ? request("/sites") + : (await pause(), currentSites()); + }, + async incidents(status, siteId) { + const list = + mode === "live" + ? await request( + `/incidents${status ? `?status=${encodeURIComponent(status)}` : ""}`, + ) + : (await pause(), mockIncidents); + return list + .filter( + (incident) => + (!status || incident.status === status) && + (!siteId || incident.siteId === siteId), + ) + .sort((a, b) => Date.parse(b.openedAt) - Date.parse(a.openedAt)); + }, + async incident(id) { + const result = + mode === "live" + ? await request(`/incidents/${encodeURIComponent(id)}`) + : (await pause(), mockIncidents.find((incident) => incident.id === id)); + if (!result) + throw new Error("Incident not found. Refresh the list and try again."); + return result; + }, + async metrics(siteId) { + const to = new Date(); + const from = new Date(to.getTime() - 24 * 60 * 60 * 1000); + const series = `probe:1.1.1.1:rtt_ms`; + const query = new URLSearchParams({ + site_id: siteId, + series, + from: from.toISOString(), + to: to.toISOString(), + }); + return mode === "live" + ? request(`/metrics?${query}`) + : (await pause(), makeSeries()); + }, + async voice(id) { + if (mode === "mock") + throw new Error( + "Voice alert unavailable in replay fixtures. No audio has been generated.", + ); + const controller = new AbortController(); + const timer = setTimeout(() => controller.abort(), 7000); + try { + const response = await fetch( + `${base}/incidents/${encodeURIComponent(id)}/voice`, + { signal: controller.signal }, + ); + if (!response.ok) + throw new Error( + response.status === 404 + ? "No voice alert is available for this incident." + : `Voice alert request failed (${response.status}).`, + ); + return URL.createObjectURL(await response.blob()); + } catch (error) { + if (error instanceof Error) throw error; + throw new Error("Voice alert could not be reached."); + } finally { + clearTimeout(timer); + } + }, + async inject(siteId, scenario, duration) { + if (mode === "live") { + await requestAck("/demo/scenarios", { + method: "POST", + body: JSON.stringify({ + site_id: siteId, + scenario_type: scenario, + duration_min: duration, + }), + }); + return { + message: + "Diagnosis queued. Refresh the incident list shortly to review results.", + }; + } + await pause(250); + const site = currentSites().find((item) => item.id === siteId); + if (!site) throw new Error("Choose a site before replaying a scenario."); + if (scenario === "normal") + return { + message: + "Normal traffic replayed. No incident or router change was created.", + }; + const incident = newMockIncident(site, scenario, duration); + mockIncidents = [incident, ...mockIncidents]; + return { + incident, + message: + incident.template === "none" + ? "Scenario replayed. It provides guidance only; no router change is proposed." + : "Scenario replayed. A reviewable incident is ready.", + }; + }, + async decide(id, decision, onUpdate) { + if (mode === "live") { + await requestAck(`/incidents/${encodeURIComponent(id)}/${decision}`, { + method: "POST", + body: "{}", + }); + const authoritative = await this.incident(id); + onUpdate?.(authoritative); + return authoritative; + } + await pause(250); + const current = mockIncidents.find((incident) => incident.id === id); + if (!current) throw new Error("Incident not found."); + if ( + (decision === "approve" && current.status !== "awaiting_approval") || + (decision === "reject" && + !["awaiting_approval", "open"].includes(current.status)) + ) { + throw new Error( + "This incident is no longer available for that decision.", + ); + } + if (decision === "reject") { + update(id, "rejected", "Change rejected"); + return this.incident(id); + } + if ( + current.template === "none" || + current.dryRun !== "passed" || + !current.fix.length + ) { + throw new Error("This incident is not eligible for approval."); + } + update( + id, + "applying", + "Applying simulated change", + "Local fixture only; no router command was sent.", + ); + onUpdate?.(await this.incident(id)); + await pause(400); + update( + id, + "verifying", + "Verifying simulated change", + "Local fixture only; outcome is illustrative.", + ); + onUpdate?.(await this.incident(id)); + await pause(500); + const outcome = current.simulatedOutcome ?? "resolved"; + update( + id, + outcome, + outcome === "rolled_back" + ? "Simulated check failed; rollback completed" + : "Simulation resolved", + "Simulated replay outcome; no router command was sent.", + ); + return this.incident(id); + }, + subscribe(onEvent, onReconnect) { + if (mode === "live") { + const source = new EventSource(`${base}/stream`); + const seen = new Set(); + const events = [ + "metric", + "incident.opened", + "incident.updated", + "fix.tested", + "fix.applied", + ]; + const listeners = events.map((name) => { + const listener = (raw: Event) => { + const event = raw as MessageEvent; + const key = event.lastEventId + ? `${event.type}:${event.lastEventId}` + : ""; + if (key && seen.has(key)) return; + if (key) { + seen.add(key); + if (seen.size > 500) + seen.delete(seen.values().next().value as string); + } + onEvent(event); + }; + source.addEventListener(name, listener); + return [name, listener] as const; + }); + let opened = false; + source.onopen = () => { + if (opened) onReconnect(); + opened = true; + }; + source.onerror = () => onReconnect(); + return () => { + listeners.forEach(([name, listener]) => + source.removeEventListener(name, listener), + ); + source.close(); + }; + } + const timer = setTimeout(onReconnect, 45000); + return () => clearTimeout(timer); + }, +}; + +export const apiMode = mode; diff --git a/apps/web/lib/types.ts b/apps/web/lib/types.ts new file mode 100644 index 0000000..b74c3d3 --- /dev/null +++ b/apps/web/lib/types.ts @@ -0,0 +1,62 @@ +export type Health = "ok" | "degraded" | "down"; +export type IncidentStatus = + | "open" + | "awaiting_approval" + | "applying" + | "verifying" + | "resolved" + | "rolled_back" + | "rejected"; +export type Cause = + | "uplink_congestion" + | "heavy_user" + | "upstream_degradation" + | "game_route_issue" + | "wireless_interference" + | "uplink_down" + | "dns_slow"; +export type Site = { + id: string; + name: string; + location: string; + subscribers: number; + health: Health; + utilization: number; + latency: number; + loss: number; + uplink: string; + backupUplink?: string; +}; +export type Point = { + time: string; + actual: number | null; + p10: number | null; + p50: number | null; + p90: number | null; +}; +export type Incident = { + id: string; + siteId: string; + siteName: string; + cause: Cause; + title: string; + status: IncidentStatus; + confidence: number; + openedAt: string; + summary: string; + evidence: string[]; + template: string; + fix: string[]; + rollback: string[]; + dryRun: "passed" | "failed" | "pending"; + dryRunMessage: string; + simulatedOutcome?: "resolved" | "rolled_back"; + news?: { label: string; url: string }; + timeline: { + at: string; + label: string; + detail: string; + state: "done" | "active" | "pending"; + }[]; +}; +export type Scenario = Cause | "normal"; diff --git a/apps/web/next-env.d.ts b/apps/web/next-env.d.ts new file mode 100644 index 0000000..a419cbe --- /dev/null +++ b/apps/web/next-env.d.ts @@ -0,0 +1,7 @@ +/// +/// +import "./.next/dev/types/routes.d.ts"; +import "./.next/dev/types/root-params.d.ts"; + +// NOTE: This file should not be edited +// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts new file mode 100644 index 0000000..442a132 --- /dev/null +++ b/apps/web/next.config.ts @@ -0,0 +1,3 @@ +import type { NextConfig } from "next"; +const nextConfig: NextConfig = {}; +export default nextConfig; diff --git a/apps/web/package-lock.json b/apps/web/package-lock.json new file mode 100644 index 0000000..5998d32 --- /dev/null +++ b/apps/web/package-lock.json @@ -0,0 +1,9782 @@ +{ + "name": "@netcortex/web", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@netcortex/web", + "version": "0.1.0", + "dependencies": { + "@radix-ui/react-dialog": "^1.3.1", + "@radix-ui/react-select": "^2.4.1", + "@sentry/nextjs": "^11.8.0", + "clsx": "^2.1.1", + "lucide-react": "^1.59.0", + "next": "^16.4.2", + "react": "^19.2.3", + "react-dom": "^19.2.3", + "recharts": "^3.10.1", + "tailwind-merge": "^3.7.0" + }, + "devDependencies": { + "@playwright/test": "^1.58.2", + "@tailwindcss/postcss": "^4.2.1", + "@types/node": "^25.3.0", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "eslint": "^9.39.2", + "eslint-config-next": "^16.4.2", + "openapi-typescript": "^7.13.0", + "prettier": "^3.9.10", + "tailwindcss": "^4.2.1", + "typescript": "^5.9.3" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.3.0.tgz", + "integrity": "sha512-U4+70Pc5ZS9osnCBCE5Jha/ciHM+Yp+CNMNC/7HvYbNRk1Ldd+f7qO65W5qfhu/TCv+/ozljlXXe9Nj8419DMA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "devOptional": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", + "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@babel/types": "^7.29.8", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "devOptional": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/@babel/helper-compilation-targets/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "devOptional": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz", + "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.10.tgz", + "integrity": "sha512-EMCx3AGZ3WfAl6ht7AyQoPm2Lh+BGYEMdc4Q6Hf7uSCDOZFuLq44qNwL+iaim8VlyYhRAo4X43+weadK8ZB4Yg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.9.tgz", + "integrity": "sha512-CjXrNHTnvqBVqHgdBysY3vk2T8tpJHb5/RMeHJBTyVa9xgugCB0CJTx/3oO8RV2QRQP391RWpB7D6hLjm8V9uA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.8" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.10.tgz", + "integrity": "sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.8", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.9", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.8.tgz", + "integrity": "sha512-Vj1jF3cPfxg7OAfoI7QnVKLoILlm2JF9pnVHrX8qx7AHMiYWT+NDAA7jChlNgRS4WTLc/fD1lXLmPixluj+3Gg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@emnapi/core": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.10.0.tgz", + "integrity": "sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.1", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.1.tgz", + "integrity": "sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz", + "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.5" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-array/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@eslint/config-array/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/config-array/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.7.tgz", + "integrity": "sha512-F42g89Qd5oAWtp0k0nnSrjziAKza7w8SVT4mStc18LZMaRb4J1HQAHLCalEtDCxrTuksx7NU9qsmeLwpOfPqWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.14.0", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.3.2", + "minimatch": "^3.1.5", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.5", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.5.tgz", + "integrity": "sha512-QywQuszQh77pIXCsq998c8hbhSTI/azTty1Z6N53dmAudKHhy573j3yvRLsX2BSp8YpLtoCEG8E9DJe+8zUh4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@floating-ui/core": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.8.0.tgz", + "integrity": "sha512-0CIZ5itps/8x7BG8dEIhs53BvCUH2PCoogtakwRTut+Arm58sJooJ0AuZhLw2HJYIR5cMLNPBSS728sPho2khQ==", + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.8.0.tgz", + "integrity": "sha512-yXSrzeHZBTZadLOlfyhCkJHNeLJnHRnRInwdZ40L7ZiaAtrBwoYlsDrX3v5zB1Utk7CLfzcOVnVVWoXEky7Ceg==", + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.8.0", + "@floating-ui/utils": "^0.2.12" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.9", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.9.tgz", + "integrity": "sha512-JDjEFGCpImxDCA7JJKviA0M9+RtmJdj0m/NVU5IMgBK+AmZouAQQ7/+2GLH0GXXY0YMw9oXPB8hKdbPYg5QLYg==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.8.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.12.tgz", + "integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==", + "license": "MIT" + }, + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/types": "^0.15.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "license": "MIT", + "optional": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.5.tgz", + "integrity": "sha512-HshSvXzmBxNzqejd3k/KemgQ3hdREUYFRRrgxOZ+gPljDIsO2SDZrVZMd4Z/HsxudQbE62OVyVFE8z9BCurfjA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", + "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" + } + }, + "node_modules/@next/env": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/env/-/env-16.4.2.tgz", + "integrity": "sha512-nTUTFH7G5/J/fmpkjVLegOkqyKOP0CEsJcMsyO4UCYeN1su+YMW/MfaSErnJskL7XM+UDK6aTvslxsRCyya/sA==", + "license": "MIT" + }, + "node_modules/@next/eslint-plugin-next": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/eslint-plugin-next/-/eslint-plugin-next-16.4.2.tgz", + "integrity": "sha512-gCTWlw0e+Y6kajpFyKKgA195jUJCRhlzJE0lV7ufe8a+ghIsANWZ0/FiJwg6DuOG1+OvRbcZDcFBoRh3mNJx0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "4.9.1", + "fast-glob": "3.3.1" + } + }, + "node_modules/@next/eslint-plugin-next/node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@next/eslint-plugin-next/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@next/swc-darwin-arm64": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-16.4.2.tgz", + "integrity": "sha512-ONkhFvZNFWlsEHOM/81AtxdyuJP2KRYKYR0JxPwvcu1AuPMMMgcL+wW2luldJvMtZwKtUxoSkCychW5wIeoYSw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-darwin-x64": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-16.4.2.tgz", + "integrity": "sha512-luPCMbOsCoaF+kXJEUjmjmOZg1lC3BflhmUu+ZmW4tBu2vW/4AXak8JBFvePizGkxVmNiAw/r9ra+6UviCWtWQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-gnu": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-16.4.2.tgz", + "integrity": "sha512-xhwFTAncJyaCNy5KqKKuKaIIdCy1/1ZV1s5S1G0hhT7wGMkDTlfJ6aQbfRFnIG/s3/kDrxQ8aycVe+c5QnP8ow==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-arm64-musl": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-16.4.2.tgz", + "integrity": "sha512-T1PNmfbPcxr5ndtWUL/3wQtLXsz808lq6sc2GrNT5k2oquF7UyqZddHSuAewHVsWsGXe6nsl9HoN1YNriVjuSg==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-gnu": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-16.4.2.tgz", + "integrity": "sha512-N9cDUOCGtkJG5PNKDFZUF3xXndrJJcpLp121uAGjIGvO/U2p9tfdNOM9htj7+5f72l0m8rMw/cvYacUJBQoudg==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-linux-x64-musl": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-16.4.2.tgz", + "integrity": "sha512-yY2uh1YhX6ufuYy2FCbw1dqblbhI57GLYAJfCkqD9auTv6pLrH67Uccjc3QMKBeCYAG6lkgu08ExmX1bbjejjQ==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-arm64-msvc": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-16.4.2.tgz", + "integrity": "sha512-j/ArWRIHpMMB6wYLMhr2puTguBt70lNU/Cmjl9p6dTDE8DGknYJMP9PdwPk2dqpCNL/KIX9yfngDvIesxJPmsg==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@next/swc-win32-x64-msvc": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-16.4.2.tgz", + "integrity": "sha512-AA4edyWHDko3NCSo0x6GomsdgFb0oR1J3MXU1b5xt6FRFg4AucrMPW3S0hCe/9onU0O1BbpGQBsqo1r0Gneu1g==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nolyfill/is-core-module": { + "version": "1.0.39", + "resolved": "https://registry.npmjs.org/@nolyfill/is-core-module/-/is-core-module-1.0.39.tgz", + "integrity": "sha512-nn5ozdjYQpUCZlWGuxcJY/KpxkWQs4DcbMCmKojjyrYDEAGy4Ce19NN4v5MduafTwJlbKc99UA8YhSVqq9yPZA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.4.0" + } + }, + "node_modules/@opentelemetry/api": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.1.tgz", + "integrity": "sha512-gLyJlPHPZYdAk1JENA9LeHejZe1Ti77/pTeFm/nMXmQH/HFZlcS/O2XJB+L8fkbrNSqhdtlvjBVjxwUYanNH5Q==", + "license": "Apache-2.0", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/@oxc-parser/binding-android-arm-eabi": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm-eabi/-/binding-android-arm-eabi-0.152.0.tgz", + "integrity": "sha512-393VtirINkae4XHBTkq/yQxhOwEr4V+r0et37P2fp+sYZSdYgZTRDPo5Um8vBh0QjMZ+RmaMy4PP0qwr4cTMwA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-android-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.152.0.tgz", + "integrity": "sha512-iYFcExATJNZ0rZj0o02THbD1Nc9jAW0nVgIQPee6ejbSASpbZXlIMw8jxtpzaG14JQTWwGSZ6U5dEtRJXE6V3Q==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.152.0.tgz", + "integrity": "sha512-fnU+DfUzi5/rFy0LzmipYRz06PAUUkOS8kCJQ3Eg6oqlunC1XZXoffFqxmdL51RmcbYtUG3P8DVG1U5fckoa2A==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-x64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.152.0.tgz", + "integrity": "sha512-Y3U2okryWTs7hDld6UhjJwLNf8/do+x4g4C+1U5SiGwrTLwbO83WJYJA8+l9iFSilWBgnfpd/+U76tfeNxUHzA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-freebsd-x64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.152.0.tgz", + "integrity": "sha512-XkhkRrrPffEw+ZLv/d/5pEni0buxinm/E/N6fLbJCunD1DBbeCTtVP23ESV+4CWCWdSz397asks1ViGslpmWiQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-gnueabihf": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.152.0.tgz", + "integrity": "sha512-MLzsRRbdfmdzo6JEhbC1yKU9ItfvM8tEf18HM32jCiNYZEz6J3bRBRl3cTkKR0vBdrk9ZVlcARXtwHccs+epDA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-musleabihf": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.152.0.tgz", + "integrity": "sha512-HHerTEJz7Iy10Ji6BGsk4gqG6PU0UzFuBu91jIEOX89FnrI5ECWSEr7BLpkYQhp7U0QFtMnBhNfQKI0hYZK78w==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.152.0.tgz", + "integrity": "sha512-9Bb8GyzZ2uSLzRDZ27usaKokr07mxiBe2dDF5b6bd2janmaJTT1gL51UfP7AU30yFiXrJvcRyFKREAgKwZYs0w==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.152.0.tgz", + "integrity": "sha512-om7iDMUroI74A/lfRRWY9/Ev3VWrVsrUZ4tyvyh8raBey/sdcfyAD7tYWc+iykAiotnmftyKTpUKFr1QnaBrAQ==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-ppc64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.152.0.tgz", + "integrity": "sha512-Lf1OL2lMTqwDMFC6jnRb30B+WYHKV0XT+bPHcFM6xHtNVwxpobiTzUIvKH6a0LWpvfwyru8Yu6zCGHqqFHH+gg==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.152.0.tgz", + "integrity": "sha512-BYWSMQK+YJ9ZILStPcmmiSVq8KEG9Qdq/c4BHPC3rUEq/fEDCVjUIwdj5ZzjgZ9P9is9PKu0tcAXzq1ZXg4urQ==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.152.0.tgz", + "integrity": "sha512-d2LqHNNNqdH185sRK5dPKWZu201JrNu9/CRFuVEuT+ht7n/QaVblEMWT9MALQPrDWYvhG10P+NSKJFquDWZ09w==", + "cpu": [ + "riscv64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-s390x-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.152.0.tgz", + "integrity": "sha512-8gBeHt5rA/8+pKhHl+zLggfa3L/V/L2at96p7ty6pBE7id6lFO19nFUc15u2PcjC4OYeYK465MKy1fhhbpFIGw==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-gnu": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.152.0.tgz", + "integrity": "sha512-ltgrSF6L+yPTVsIdaAyqKq3zTqzj/1VlNbxWZuxAe8flR3sWdyNsKvdXukoO8/ucJbLickhmieRBge+o/e8Ugw==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-musl": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.152.0.tgz", + "integrity": "sha512-LcMp6BvrBnewSfdkLHoSqidhoAq4syKOTBV5TYHWd+2VnGkfD/nPRRVIzTBt/Lkbt7pfOFDGtkiTntFS0p6sQQ==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-openharmony-arm64": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-openharmony-arm64/-/binding-openharmony-arm64-0.152.0.tgz", + "integrity": "sha512-jbhoMCslVxzRCRNQ8TSHxjYdSKRvk8O6ciLVDkahJvmyHDzBqba/bMQHM6ULKj/rgHNNbSzlIiakdx8SEfkJzA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-arm64-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.152.0.tgz", + "integrity": "sha512-JZYVlhv36mr/nertnRB7vchJECOBb1Lz6lltalILsB+o9M/is+H6BEDRLQKdqA4JKs6NjJszo46+iM5sfwj6jQ==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-ia32-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.152.0.tgz", + "integrity": "sha512-1X9oganvVsunRH0lH10UU05N+H9atpX6WsOybByUjwnfcd3h/0tYwvuv16XuHglrIUOnxV2TodbLVEwwafd64g==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-win32-x64-msvc": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.152.0.tgz", + "integrity": "sha512-sw0M80/dn9rcpu+Rqqph/C+MjvDDce6MlXmFjsNQtPEymha0eJy3ml6+foSUTqFfpDIDyHZZ4eoJ43IoMe8bJw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.152.0.tgz", + "integrity": "sha512-oM/5rLBm2tPkg0iBgkH/FOeR3PCDpY19GTgAZjMFM8h9WI9VW7cLgzp6nwtarYKmovavIQZ+Fe/RKX/8C8O/Rw==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/@playwright/test": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.64.1.tgz", + "integrity": "sha512-IaYGml/nSOiZWROfPtuIL7neuu9qDOZ3TNvNljUIrhDMxiGTgPjzj/g9p9RxpS2tSepPDRY+UwAaEeiKtUvIAg==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@radix-ui/number": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/number/-/number-1.1.3.tgz", + "integrity": "sha512-Road2bidD0uu/1BGDOWNdPI06g0lIRy6IF9GZcIrDK2KGItfor8IQwQa+yM2ERgHM1MmHxaxpTzk0/Jp42lNfA==", + "license": "MIT" + }, + "node_modules/@radix-ui/primitive": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/primitive/-/primitive-1.2.0.tgz", + "integrity": "sha512-KABY+VMIRPJL+Vyzv/335FEhXXD/xDv8BMb1kl48/aXJZMH0LtHCTx5ga5RnxaEP3nZHtmTLf1P9vanmFX46bw==", + "license": "MIT" + }, + "node_modules/@radix-ui/react-arrow": { + "version": "1.1.17", + "resolved": "https://registry.npmjs.org/@radix-ui/react-arrow/-/react-arrow-1.1.17.tgz", + "integrity": "sha512-67jjcVvxjXCCStnTW3Z+M7jmaFMuMR7M2JgpDzH4w7JSRrikmzhjfYgP/09ECb8n7whnsgh1ifJ+Ie96qEj+pQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.2.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-collection": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-collection/-/react-collection-1.2.0.tgz", + "integrity": "sha512-+yiQzqcc7Sy7/5s0jrMCjpPRFB3538VNrXPWdTLZhE/SCfgEws4aI6lHWN/vvcnyhHndROWBzqmqB4QBrITZ9Q==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-slot": "1.5.0", + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-compose-refs": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-compose-refs/-/react-compose-refs-1.1.5.tgz", + "integrity": "sha512-+48PbAAbq3didjJxa+OaWY2ZwgAKsNiRGyeHKszblZMQ+kcpd9pAaT11cMkGEie0vsOi3QdeTE6d5Fe3Gn61kA==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-context": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-context/-/react-context-1.3.0.tgz", + "integrity": "sha512-v5AYEocMISkbJ+1fTXzZpiFv7NRr3D2WiYbLIKf+FkmJ8VkP6d503eV2n34MFussHXY1pcoq3yfJiQH77dc4Mg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dialog": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dialog/-/react-dialog-1.3.1.tgz", + "integrity": "sha512-+0E4qvVTwjAWra9sEhJ+9BTsvHE00zkUuNw1VGh7S+Gc13dfYk+S1PVQdchWDj+XYHhAai7Z7IpzXVDCGsDplg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-dismissable-layer": "1.2.1", + "@radix-ui/react-focus-guards": "1.2.0", + "@radix-ui/react-focus-scope": "1.3.1", + "@radix-ui/react-id": "1.1.4", + "@radix-ui/react-portal": "1.2.0", + "@radix-ui/react-presence": "1.1.11", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-slot": "1.5.0", + "@radix-ui/react-use-controllable-state": "1.3.0", + "@radix-ui/react-use-layout-effect": "1.1.4", + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.7.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-direction": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-direction/-/react-direction-1.2.0.tgz", + "integrity": "sha512-FtRA52a/r+LKStFT+neLUm+8vSe7wbzkbQGGeU8ixFiwC8NU14Evoq9ATECqL3eGbcUzJR4fyfA4KkK/q6dfqg==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-dismissable-layer": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-dismissable-layer/-/react-dismissable-layer-1.2.1.tgz", + "integrity": "sha512-KIfDcAsx+oVylFZ4xryVKusJUrLLhTQmfnJW4kwk4Km5myvhHCrj04hnWWUC166+xD4DHdH8tQGylwYX1h6+Pg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-callback-ref": "1.1.5", + "@radix-ui/react-use-effect-event": "0.0.5" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-guards": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-guards/-/react-focus-guards-1.2.0.tgz", + "integrity": "sha512-MPm5R0iRGUDrDnPNxmLBkv+X7pN4XKzt+MbWJEuJQsH3NFH4omrbpXpucyYCCKTSt+na/ZxGhEWQrWTZ0285cA==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-focus-scope": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-focus-scope/-/react-focus-scope-1.3.1.tgz", + "integrity": "sha512-ugeMhbXt4y5S2T1GnIqbWDKEN962PDwnX1fN0eKOOgf5f63Dh2mn8F1FUySlgW0iF6GiVsRF32DzuDIWTUyQJg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-callback-ref": "1.1.5" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-id": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-id/-/react-id-1.1.4.tgz", + "integrity": "sha512-TMQp2llA+RYn7JcjnrMnz7wN4pcVttPZnRZo52PLQsoLVKzNlVwUeHmfePgTgRluXFvlD3GD5g5MOVVTJCO0qA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-popper": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-popper/-/react-popper-1.4.0.tgz", + "integrity": "sha512-yCWRvLeGv9Pz3+efwHqGPp70mZ56r3kfIgQVF56Oj2aAa4uP/Tb+IE59wNcc+758rctqbCKx4LbK8II/r7Bn0Q==", + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.0.0", + "@radix-ui/react-arrow": "1.1.17", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-callback-ref": "1.1.5", + "@radix-ui/react-use-layout-effect": "1.1.4", + "@radix-ui/react-use-rect": "1.1.4", + "@radix-ui/react-use-size": "1.1.5", + "@radix-ui/rect": "1.1.3" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-portal": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-portal/-/react-portal-1.2.0.tgz", + "integrity": "sha512-StX7xXnaRU41VvFtMm9zlhVGz8XF6GmWWTXftkQaY+tqVkbs/R9UmAp5mLzHHapk5hM9RMZQvO/3usyIP/g42g==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-presence": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/@radix-ui/react-presence/-/react-presence-1.1.11.tgz", + "integrity": "sha512-Z7/atlkab36Z8hm+V8zYc79r0W+tiOB1o0tun1By94JyadkekLQmtEAnBSP9XKXBNQsStoStS4+gX10JpS5akA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-primitive": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-primitive/-/react-primitive-2.2.0.tgz", + "integrity": "sha512-HCTSPMNqv55Qk0IX4geJbpyXazmqulcimwuyjxTkKi29v+QZbG2Zho9BnbBq4YS2PF+KlNb2CXoLz66uUmblkg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-slot": "1.5.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-select": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@radix-ui/react-select/-/react-select-2.4.1.tgz", + "integrity": "sha512-888ZwW0Md6GyptuqYABRX9nLKgoYfcooCyBBvVaX5Jp3e+8Jp2i4Zo/Uy50Hm+Ysn2JfloQXstW4U36w8teVtg==", + "license": "MIT", + "dependencies": { + "@radix-ui/number": "1.1.3", + "@radix-ui/primitive": "1.2.0", + "@radix-ui/react-collection": "1.2.0", + "@radix-ui/react-compose-refs": "1.1.5", + "@radix-ui/react-context": "1.3.0", + "@radix-ui/react-direction": "1.2.0", + "@radix-ui/react-dismissable-layer": "1.2.1", + "@radix-ui/react-focus-guards": "1.2.0", + "@radix-ui/react-focus-scope": "1.3.1", + "@radix-ui/react-id": "1.1.4", + "@radix-ui/react-popper": "1.4.0", + "@radix-ui/react-portal": "1.2.0", + "@radix-ui/react-presence": "1.1.11", + "@radix-ui/react-primitive": "2.2.0", + "@radix-ui/react-slot": "1.5.0", + "@radix-ui/react-use-callback-ref": "1.1.5", + "@radix-ui/react-use-controllable-state": "1.3.0", + "@radix-ui/react-use-layout-effect": "1.1.4", + "@radix-ui/react-visually-hidden": "1.2.13", + "aria-hidden": "^1.2.4", + "react-remove-scroll": "^2.7.2" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-slot": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.5.0.tgz", + "integrity": "sha512-tyYd9ddPXAysAbdbD9eYxgwpCSv6f3PncqVSNKQFSR5lcJVLz3cb/pANDoYrLiHBpXv7skortyUgGUWsYuPPFQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-compose-refs": "1.1.5" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-callback-ref": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-callback-ref/-/react-use-callback-ref-1.1.5.tgz", + "integrity": "sha512-Y5GBf4NKeADoXI1geiMlMuMoURT3k9MizzzKhGb/m55H94aGigZ01PIpkvsO6lML13BA6XYAXSJ6gza7vTn5nw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-controllable-state": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-controllable-state/-/react-use-controllable-state-1.3.0.tgz", + "integrity": "sha512-TAcBI7bw2ljYCbv4+zuTSd6zICu8pRt6SDN2vJ/Z06K2MXh6I9WYFe/A9ovlFDtR5HVHGm5iDxDoABm/++dbKg==", + "license": "MIT", + "dependencies": { + "@radix-ui/primitive": "1.2.0", + "@radix-ui/react-use-effect-event": "0.0.5", + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-effect-event": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-effect-event/-/react-use-effect-event-0.0.5.tgz", + "integrity": "sha512-7cshFL8HGS/7HEiHH+9kL9HBwp2sa9yX18Knwek6KYWmXwM7pegMgta2AXMQKI+rq3JnfSj9x8wYqFMTdG1Jgg==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-layout-effect": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-layout-effect/-/react-use-layout-effect-1.1.4.tgz", + "integrity": "sha512-K20DkRkUwDnxEYMBPcg3Y6voLkEy5p5QQmszZgLngKKiC7dzBR/aEuK3w1qlx2JWDUNH6FluahYdgR3BP+QbYw==", + "license": "MIT", + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-rect": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-rect/-/react-use-rect-1.1.4.tgz", + "integrity": "sha512-cSOCh6JlkmfjLyNcLiu2nB4v+nm+dkZ+Q5KHWk/soo4U7ZLiEQFKHK9/YmtBHjfCEaU43IBKQOc4/uJmCaiCTQ==", + "license": "MIT", + "dependencies": { + "@radix-ui/rect": "1.1.3" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-use-size": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@radix-ui/react-use-size/-/react-use-size-1.1.5.tgz", + "integrity": "sha512-V1McDQkMGzgivwqdu7u96APs7oi0Jvj9LTzgq3WWrDZqxWdAqU9yZnZQqk5OizGFR8badUQwZsrlao7MOlWYOA==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-use-layout-effect": "1.1.4" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/@radix-ui/react-visually-hidden": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/@radix-ui/react-visually-hidden/-/react-visually-hidden-1.2.13.tgz", + "integrity": "sha512-feijiN1oPk4rck4u9Dm9tsU4mT6Wp9oeEEhaz1WUEs1VuqLf8xzsFG+Qk+uWq6TnMH9O+WRECRg0NftyP9E4Fw==", + "license": "MIT", + "dependencies": { + "@radix-ui/react-primitive": "2.2.0" + }, + "peerDependencies": { + "@types/react": "*", + "@types/react-dom": "*", + "react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc", + "react-dom": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "@types/react-dom": { + "optional": true + } + } + }, + "node_modules/@radix-ui/rect": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@radix-ui/rect/-/rect-1.1.3.tgz", + "integrity": "sha512-JtyZR+mqgBibTo8xea3B6ZRmzZiM/YeVBtUkas6zMuXjAlfIFIW2FgqeM9eLyvEaYX66vr6DJMK+4U6LV0KhNw==", + "license": "MIT" + }, + "node_modules/@redocly/ajv": { + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.11.2.tgz", + "integrity": "sha512-io1JpnwtIcvojV7QKDUSIuMN/ikdOUd1ReEnUnMKGfDVridQZ31J0MmIuqwuRjWDZfmvr+Q0MqCcfHM2gTivOg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js-replace": "^1.0.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@redocly/ajv/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, + "node_modules/@redocly/config": { + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/@redocly/config/-/config-0.22.0.tgz", + "integrity": "sha512-gAy93Ddo01Z3bHuVdPWfCwzgfaYgMdaZPcfL7JZ7hWJoK9V0lXDbigTWkhiPFAaLWzbOJ+kbUQG1+XwIm0KRGQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@redocly/openapi-core": { + "version": "1.34.21", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.21.tgz", + "integrity": "sha512-yXMiBFYJbP5JOaxPzx2tJhK+v8h2Wu2uhad1Ro6GzVT8E3F4GcQ7sbLPJ9w4zvGjfxroD0bIh5B0pDtnLV/qUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@redocly/ajv": "8.11.2", + "@redocly/config": "0.22.0", + "colorette": "1.4.0", + "https-proxy-agent": "7.0.6", + "js-levenshtein": "1.1.6", + "js-yaml": "4.3.2", + "minimatch": "5.1.9", + "pluralize": "8.0.0", + "yaml-ast-parser": "0.0.43" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=9.5.0" + } + }, + "node_modules/@redocly/openapi-core/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@redocly/openapi-core/node_modules/brace-expansion": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", + "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@redocly/openapi-core/node_modules/minimatch": { + "version": "5.1.9", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.9.tgz", + "integrity": "sha512-7o1wEA2RyMP7Iu7GNba9vc0RWWGACJOCZBJX2GJWip0ikV+wcOsgVuY9uE8CPiyQhkGFSlhuSkZPavN7u1c2Fw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@reduxjs/toolkit": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.13.0.tgz", + "integrity": "sha512-f6jwVRfwW30+tnllz4YcsHHpPYYOE7abcHkyUCovD+P7DyhdAI5prz2Fh/8TLhakjpN+7aIEion1s5L/tvlYlA==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", + "immer": "^11.0.0", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@rollup/plugin-commonjs": { + "version": "28.0.1", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.1.tgz", + "integrity": "sha512-+tNWdlWKbpB3WgBN7ijjYkq9X5uhjmcvyjEght4NmH5fAU++zfQzAJ6wumLS+dNcvwEZhKx2Z+skY8m7v0wGSA==", + "license": "MIT", + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "commondir": "^1.0.1", + "estree-walker": "^2.0.2", + "fdir": "^6.2.0", + "is-reference": "1.2.1", + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=16.0.0 || 14 >= 14.17" + }, + "peerDependencies": { + "rollup": "^2.68.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/pluginutils": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz", + "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==", + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.64.9.tgz", + "integrity": "sha512-qJmhckvOleXp8R+BaXiVW/S34/3M7pvN17/QcG90A74BDaSvKv8ffY+GYG+a/xU0vEoITzdMSiM7o9HZSQWbfA==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.64.9.tgz", + "integrity": "sha512-dqQgds39BNWGB2ughJ6n2LTQFXk8RAOwnXj6m387OHpygfD93QRS1ODIfpiWyAa9gsFB9l34pSqeLmA0Xk/VBw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.64.9.tgz", + "integrity": "sha512-scrMx4SGikOSbWknLmPD0v6OeJ1Wih3kyRLdNZnlVbBeKVWp1nRTVcpM0IxDJdc3u8UjesPHTmnX649u8cQpBw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.64.9.tgz", + "integrity": "sha512-fkwi2OQR+QWoViRFt08Bsca6G0e9pk/4z+JgmqHq6jSRTT0LtI27KRVK8bu++6L/CBtQ3OZePbqC3bcrwGzTqQ==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.64.9.tgz", + "integrity": "sha512-8Apr0Khn0r2MUsDtcOMbp85fDdXsX/E+iLhO17WUjG24m3O8ChArqI0isI7CAdj9Ouq177PHtVtEUpMNE1C4Gw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.64.9.tgz", + "integrity": "sha512-H+upy4DhBcBZlUsCAMyr8wR0Dg9kj8sGloVZdZ7va2heJM/5jnROxI47dtXseJjlD/VoQe6MrXhY3b5ikOq/Vw==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.64.9.tgz", + "integrity": "sha512-b50NS9TbAEK/b16vBoKrkeNwy+HvGBXmtBbzX4wcodWOh9dQZvRTN9rUyElIXa36QnwXhU9PAVVkZpqRzSi2Tg==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.64.9.tgz", + "integrity": "sha512-SdqcudB/FzjLESsRMgXhV+FXGtf6usxXwlMoRW7D/XS3f9CZ4T4wycRBu2h9bVl2AOaPpunoA8ftAM/MF4altQ==", + "cpu": [ + "arm" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.64.9.tgz", + "integrity": "sha512-dg19FFRoovN+KZ+gMHBAq4Do8PgQmBcxpuhux57OuiR0QLavfn8uPBY8CP+UO50bO+xf0tK0GlqI/jld++5E6g==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.64.9.tgz", + "integrity": "sha512-+jyv5ofGmpAvtrzLjSr/e4syskeikEp5L82bUzB76auwOgK1VNVwZV/F2g1Pes9bhTznbejOefAqPglHSKYmTA==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.64.9.tgz", + "integrity": "sha512-MKFXxqmkzCbtNvx/vjiJdss44eRtVabhCtDWcCFD9NHGwP+YkqnM/slnEsv/3fsoq9ukTtudraAjGhptrUPCVg==", + "cpu": [ + "loong64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.64.9.tgz", + "integrity": "sha512-lhARcOT6n7Ni9hpQRq8LZjbuoW+G/GXaW4Jfhx2MbmjnCj9XxLMRTceJIMpiMLQVWm+qxe7oq1sYvlIGOAW34Q==", + "cpu": [ + "loong64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.64.9.tgz", + "integrity": "sha512-oORQzGxZ1oHghJwLdwc8Ni0SY9otILAeXsWdiImTF4F5HkWJUwh5s/269PF5tYILNC1z/3RwFsrgcHPguBcb0g==", + "cpu": [ + "ppc64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.64.9.tgz", + "integrity": "sha512-J2JQHQt7oR1uutd2OSwbV2Qpb2LI5gggPolbkUwDe7vn/0dnduZ0w6EIbGnZUAw7uIKaMgfVylcH6V+Aov8kRA==", + "cpu": [ + "ppc64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.64.9.tgz", + "integrity": "sha512-bWaKLrfzeQ9mOzJJxXbPgw2RH6VAaTJrb/60Tqf7YSMxubG8780Hzm7Us+D6qVW8QRGJYl4VUvVXxnRB0o9zvQ==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.64.9.tgz", + "integrity": "sha512-TFJyaCB9NsvSyvVGQgTSRD9XgxsAq99ivDDkt9KAySlrNW5Obsd1kQpvoCvBCOLq+JlJTjmtroLH0wp8M8mEsA==", + "cpu": [ + "riscv64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.64.9.tgz", + "integrity": "sha512-DvmOM5xz/wDnUJFVjqP32ahalxn7BDuvO25bpuFOrb50AIFCCcFPN4lWWUDD1c8Ddv9sMO9SXyqtOet8G8u9cQ==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.64.9.tgz", + "integrity": "sha512-aFzokHK3yE00mzAvKm/PY76OsOOTjvoTGE82Vp89iBDyD2wUBlV4ZsR2tWkRECTEFk6TC4Yc3zaEWjPqq1vstQ==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.64.9.tgz", + "integrity": "sha512-t/yMdeaaQUuNNpmT7taBmH2VvHzgT4YA/IaKVE3qVr4PYQemn/kmJkL4uG4UvTLcWXQd0MSoOa/3URYSWGmUEg==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.64.9.tgz", + "integrity": "sha512-4dnxKQ8GHARyjqAU87q5UWhywZTpIbR2VWhtACdC37GD1SGszmvb3TaBFVA4n+fnDHSKMut4ZJ63hVFwgnxVtg==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.64.9.tgz", + "integrity": "sha512-1qdQj6IrNoR0xFvrCQHmhBXe9HMbBGNTFi+3n4jKMt2rTx4k0aeAdraZU4WDOMfL9tAwS8/TRSuquvNuPQ+Gpw==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.64.9.tgz", + "integrity": "sha512-yc1GSEHIYhKGN5WSaJc+eMy8bZvzcvAmflEgFh8L3xcy8dYxGmfrudyBnBFde9f6JzOa1kFqocF8BHaWybjQoA==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.64.9.tgz", + "integrity": "sha512-VzHGvosAkLIzrwqvSgJBPDmGFTF/yE8OtMT4H5z8pM1NA0NiPpvTYnUh+9xPd+d5oy/wqF317FmJ1I8Kk8pp0Q==", + "cpu": [ + "ia32" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.64.9.tgz", + "integrity": "sha512-FB77txy1PiAcJgG72nOLA6R0S3PRZahs8Spx0z2yseDUkoMmJcrQghiebJ2JHZ74cCOVlX/MYd4dUbJtJJ8fow==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.64.9.tgz", + "integrity": "sha512-IoIgQLpK1DbOcQf1vX+i5oe5LXypsCVb1j/mU6BLAbOGmXH4E+j4kMfgZRwPYUohVBurNyVMgIKVM5dR6xA0kA==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rtsao/scc": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@rtsao/scc/-/scc-1.1.0.tgz", + "integrity": "sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sentry/browser": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-11.8.0.tgz", + "integrity": "sha512-uBC1k2ESZErHv+RfG6p9siHrtxv+QErDxL/jvEBZnoMV6OcWdZyWTGKcqrW7EjwlBiWkgVve1W7z8tNDDuVQxw==", + "license": "MIT", + "dependencies": { + "@sentry/browser-utils": "11.8.0", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0", + "@sentry/feedback": "11.8.0", + "@sentry/replay": "11.8.0", + "@sentry/replay-canvas": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/browser-utils": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/browser-utils/-/browser-utils-11.8.0.tgz", + "integrity": "sha512-tTqJmnfuJaQy9LyInCWJtJ0L+VnOq+L9+lTMkQH+pptXBAuHfdJyEl2IhGqO4QmsfKyZpHa2GVd3HKpEQsVYeg==", + "license": "MIT", + "dependencies": { + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0", + "web-vitals": "^6.2.3" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/bundler-plugins": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/bundler-plugins/-/bundler-plugins-11.8.0.tgz", + "integrity": "sha512-rQrbL2lYPyiiO6ngdpbbfPKyEzVVQsz1FG+aE8jUiUYs72gvmDmZmRyl9VDCGLrHZfIEwaQMT1t6WQH5nopu5A==", + "license": "MIT", + "dependencies": { + "@sentry/core": "11.8.0", + "dotenv": "^17.4.2", + "glob": "^13.0.6", + "magic-string": "~0.30.8 || ^1.0.0", + "oxc-parser": "^0.152.0", + "sentry": "^0.45.0", + "supports-color": "^8.1.1" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "@babel/core": "^7.18.5", + "rollup": ">=3.2.0", + "webpack": ">=5.1.0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "rollup": { + "optional": true + }, + "webpack": { + "optional": true + } + } + }, + "node_modules/@sentry/cloudflare": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/cloudflare/-/cloudflare-11.8.0.tgz", + "integrity": "sha512-Xcj2ofSWL/p3IC+2K/Y2keu+hPgY8v08nnsXnpRm+iMoOoNC6x5pbdk6T8smoiFPPghAUBWNBYNqBaKWsgfipg==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0", + "@sentry/opentelemetry": "11.8.0", + "@sentry/server-utils": "11.8.0", + "magic-string": "~0.30.21" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "@cloudflare/workers-types": "^4.x || ^5.x", + "vite": "^6.1.0 || ^7.0.0 || ^8.0.0", + "wrangler": "^4.x" + }, + "peerDependenciesMeta": { + "@cloudflare/workers-types": { + "optional": true + }, + "vite": { + "optional": true + }, + "wrangler": { + "optional": true + } + } + }, + "node_modules/@sentry/conventions": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/@sentry/conventions/-/conventions-0.27.0.tgz", + "integrity": "sha512-Mrqd/o7n/z7qWSYfQQA7x4fFTA0IqOG6JNsbBpnC97khPwZk7n6DPtOO7YgaYplSl8R8QLRbBz9Xv2lVhToSAg==", + "license": "MIT", + "engines": { + "node": ">=14" + } + }, + "node_modules/@sentry/core": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-11.8.0.tgz", + "integrity": "sha512-4MVTthk6C/1oQFjbVIfygHyNkx2YGbwNLml0kJji0vjJXy6ZNls9zdIp0FTBTi4e3189IcSc5OXD4qcJdmEeKA==", + "license": "MIT", + "dependencies": { + "@sentry/conventions": "^0.27.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/feedback": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/feedback/-/feedback-11.8.0.tgz", + "integrity": "sha512-t8MSpbPoOcPOkywcv0Hwh97A82jWFZju5NU/a6pHmn2pKFktgCgnHKNHvlYp8QUaDNYijYpLv58NIM5Dg7by7A==", + "license": "MIT", + "dependencies": { + "@sentry/core": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/nextjs": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/nextjs/-/nextjs-11.8.0.tgz", + "integrity": "sha512-U0EGZ0XZVP805HAZUZX6SKFtk968X4bCWpSUcK1QJig73fqf5uttJ2U5/bgsrCUL3t5f7wsICR9m8uVnXpEhQw==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@rollup/plugin-commonjs": "28.0.1", + "@sentry/browser-utils": "11.8.0", + "@sentry/bundler-plugins": "11.8.0", + "@sentry/cloudflare": "11.8.0", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0", + "@sentry/node": "11.8.0", + "@sentry/opentelemetry": "11.8.0", + "@sentry/react": "11.8.0", + "@sentry/server-runtime-injection": "11.8.0", + "@sentry/server-utils": "11.8.0", + "@sentry/vercel-edge": "11.8.0", + "rollup": "^4.60.3", + "stacktrace-parser": "^0.1.11" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "next": "^14.0 || ^15.0.0-rc.0 || ^16.0.0-0" + } + }, + "node_modules/@sentry/nextjs/node_modules/@sentry/react": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/react/-/react-11.8.0.tgz", + "integrity": "sha512-8+RCBT4kZ954QpkKvHsQpBkFI3Tg0KShZLFRV4WVzocaRJL+iQA9Y2FV1bxQ12meC9BawaTbI8eX/uUIFDjwMA==", + "license": "MIT", + "dependencies": { + "@sentry/browser": "11.8.0", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "react": "17.x || 18.x || 19.x", + "react-router": "6.x || 7.x || 8.x" + }, + "peerDependenciesMeta": { + "react-router": { + "optional": true + } + } + }, + "node_modules/@sentry/node": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-11.8.0.tgz", + "integrity": "sha512-8vFPfCRYoUYmsno+OYdvtf5akIUUvd7FvcuIGcfrge8S/bSLFRKq58YtFmX25JFcrMNZ2oQD8r0jkgZfm/2iuA==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/bundler-plugins": "11.8.0", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0", + "@sentry/opentelemetry": "11.8.0", + "@sentry/server-runtime-injection": "11.8.0", + "@sentry/server-utils": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/opentelemetry": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/opentelemetry/-/opentelemetry-11.8.0.tgz", + "integrity": "sha512-wKuG2SbHHiGDT/fgT4X5n2usO4AjVkYfAj41002mZ18JZU3mNLeCq+qw/nnDIYbcsfIMOUm/eMh3ShKCE+DpXQ==", + "license": "MIT", + "dependencies": { + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.9.0" + } + }, + "node_modules/@sentry/replay": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-11.8.0.tgz", + "integrity": "sha512-0jXMLd9XCBEZ5tu0VJa1uj1HYCpsjuNjbEBhF5pUw4FHyIH5hz01WuI20SH2Ct0pP1mykTzJLPGjZ8sUiAmMnQ==", + "license": "MIT", + "dependencies": { + "@sentry/browser-utils": "11.8.0", + "@sentry/core": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/replay-canvas": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/replay-canvas/-/replay-canvas-11.8.0.tgz", + "integrity": "sha512-/MiivHLdDv3ot5uJmWcPhIOubec54hPd4U/c2OE5oNyhM3zrd/S6b2FEfwke/V120QGEdZcuzGatwNJ2jNSkgQ==", + "license": "MIT", + "dependencies": { + "@sentry/core": "11.8.0", + "@sentry/replay": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/server-runtime-injection": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/server-runtime-injection/-/server-runtime-injection-11.8.0.tgz", + "integrity": "sha512-4uB4E8+9ni5NcJ463aYK/+n1hTMw/vSt4s+AkQ84CKigRDwv2FNNnD1AWpipWNj/xEQ6eQbUitGl7wg7/Ri8Pg==", + "license": "MIT", + "dependencies": { + "@sentry/core": "11.8.0", + "@sentry/server-utils": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/server-utils": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/server-utils/-/server-utils-11.8.0.tgz", + "integrity": "sha512-2MRFz1rXxnuDGafl6o/itwKHZeZn5hUZYeXNbQK012uO/a2pXhEc8Zh3FeO5L4tjGrIWHx419saAFnKwbVC2IQ==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/conventions": "^0.27.0", + "@sentry/core": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@sentry/vercel-edge": { + "version": "11.8.0", + "resolved": "https://registry.npmjs.org/@sentry/vercel-edge/-/vercel-edge-11.8.0.tgz", + "integrity": "sha512-Gc9Ej4P5BRBcVtZzNWW1WzjeoH2lakYXdw7gxS2dLyPATkTYnMVFmd/i0NyJdAjYBCUFlnSHtnGwqVku9Jrqvw==", + "license": "MIT", + "dependencies": { + "@opentelemetry/api": "^1.9.1", + "@sentry/core": "11.8.0", + "@sentry/server-utils": "11.8.0" + }, + "engines": { + "node": ">=20.19.0 <22.0.0 || >=22.12.0 <23.0.0 || >=23.2.0" + } + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "license": "MIT" + }, + "node_modules/@standard-schema/utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", + "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", + "license": "MIT" + }, + "node_modules/@swc/helpers": { + "version": "0.5.23", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.23.tgz", + "integrity": "sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==", + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@tailwindcss/node": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.3.3.tgz", + "integrity": "sha512-/T8IKEsf9VTU6tLjgC7+sv2mOPtQxzE2jMw7u4Tt40Tx+QSZxpzh95/H6cMKoja9XuW7iMdLJYBB0o9G1CaAgg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/remapping": "^2.3.5", + "enhanced-resolve": "^5.24.1", + "jiti": "^2.7.0", + "lightningcss": "1.32.0", + "magic-string": "^0.30.21", + "source-map-js": "^1.2.1", + "tailwindcss": "4.3.3" + } + }, + "node_modules/@tailwindcss/oxide": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide/-/oxide-4.3.3.tgz", + "integrity": "sha512-krXjAikiaFSPaK/FkAQT5UTx3VormQaiZ5hBFlJZ9UFQGB/rwg1MZIhHAG9smMQRTdyJxP6Qt5MwMtdyU5FWrA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 20" + }, + "optionalDependencies": { + "@tailwindcss/oxide-android-arm64": "4.3.3", + "@tailwindcss/oxide-darwin-arm64": "4.3.3", + "@tailwindcss/oxide-darwin-x64": "4.3.3", + "@tailwindcss/oxide-freebsd-x64": "4.3.3", + "@tailwindcss/oxide-linux-arm-gnueabihf": "4.3.3", + "@tailwindcss/oxide-linux-arm64-gnu": "4.3.3", + "@tailwindcss/oxide-linux-arm64-musl": "4.3.3", + "@tailwindcss/oxide-linux-x64-gnu": "4.3.3", + "@tailwindcss/oxide-linux-x64-musl": "4.3.3", + "@tailwindcss/oxide-wasm32-wasi": "4.3.3", + "@tailwindcss/oxide-win32-arm64-msvc": "4.3.3", + "@tailwindcss/oxide-win32-x64-msvc": "4.3.3" + } + }, + "node_modules/@tailwindcss/oxide-android-arm64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-android-arm64/-/oxide-android-arm64-4.3.3.tgz", + "integrity": "sha512-Y85A2gmPSkl5Ve5qR86GL4HT509cFqQh1aes9p3sSkyTPwt0Pppf3GkwGe4JPACcRYjgJIEhQgM6dBClnr0NYw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-arm64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-arm64/-/oxide-darwin-arm64-4.3.3.tgz", + "integrity": "sha512-BiaWatpBcERQFDlOjRDpIVXuFK5PJez5SA4JMg6VYZdBYU+qKfV/vqjcIs+IYmtitf1xYQZTwXvU/8y4lfZUGw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-darwin-x64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-darwin-x64/-/oxide-darwin-x64-4.3.3.tgz", + "integrity": "sha512-fAeUqfV5ndhxRwai8cXGzdLvul9utWOmeTkv69unv4ZXixjn61Z+p9lCWdwOwA3TYboG3BwdVuN/RDjhBRl0mw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-freebsd-x64": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-freebsd-x64/-/oxide-freebsd-x64-4.3.3.tgz", + "integrity": "sha512-iyf5bV6+wnAlflVeEy7R25dupxTNECZN5QMI0qNT6eT+EgaGdZcKhGkr5SdoaWiLJ3spLqIY9VCeSGrwmtg4kw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm-gnueabihf": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm-gnueabihf/-/oxide-linux-arm-gnueabihf-4.3.3.tgz", + "integrity": "sha512-aAYUprJAJQWWbRrPvtjdroZ56Md+JM8pMiopS6xGEwDfLhqj+2ver2p4nU4Mb3CRqcMmNBjo8KkUgcxhkzVQGQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-gnu": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-gnu/-/oxide-linux-arm64-gnu-4.3.3.tgz", + "integrity": "sha512-nDxldcEENOxZRzC2uu9jrutZdAAQtb+8WWDCSnWL1zvBk1+FN+x6MtDViPB5AJMfttVCUhehGWus3XBPgatM/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-arm64-musl": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-arm64-musl/-/oxide-linux-arm64-musl-4.3.3.tgz", + "integrity": "sha512-Md44bD6veX/PC5iyF8cDVnw4HBIANZepRZZ7a8DQOvkfo5WUBwcp6iAuCUz23u+4SUkhJlD3eL7hNdW8ezd/kA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-gnu": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-gnu/-/oxide-linux-x64-gnu-4.3.3.tgz", + "integrity": "sha512-tx7us1muwOKAKWao2v/GaafFeQboE6aj88vC6ziN2NCGcRm8gWUhwjzg+YdVB1e4boAtdtma4L43onunI6NS4w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-linux-x64-musl": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-linux-x64-musl/-/oxide-linux-x64-musl-4.3.3.tgz", + "integrity": "sha512-SJxX60smvHgasZoBy11dX6YRjXJFovwWBoedhbQPOBzgFWBHGB+TVPWB9BxzR7TTxU8FQZAI2AyiNCMzFm8Img==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-wasm32-wasi": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-wasm32-wasi/-/oxide-wasm32-wasi-4.3.3.tgz", + "integrity": "sha512-jx1+rPhY/5Ympkktd656HBWEBLxP7dH06losBLjjf5vgCODXvi9KhtftWcMIwTFIDqBr7cRnQkdLnAG+IOlGvQ==", + "bundleDependencies": [ + "@napi-rs/wasm-runtime", + "@emnapi/core", + "@emnapi/runtime", + "@tybys/wasm-util", + "@emnapi/wasi-threads", + "tslib" + ], + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.11.1", + "@emnapi/runtime": "^1.11.1", + "@emnapi/wasi-threads": "^1.2.2", + "@napi-rs/wasm-runtime": "^1.1.4", + "@tybys/wasm-util": "^0.10.2", + "tslib": "^2.8.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@tailwindcss/oxide-win32-arm64-msvc": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-arm64-msvc/-/oxide-win32-arm64-msvc-4.3.3.tgz", + "integrity": "sha512-3rc292Ca2ceK6Ulcc/bAVnTs/3nDtoPhyEKlgPv+yQJQi/JS/AMJlqzxvlDacL1nekbrcf6bTqp/jV4qgnPxNQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/oxide-win32-x64-msvc": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/oxide-win32-x64-msvc/-/oxide-win32-x64-msvc-4.3.3.tgz", + "integrity": "sha512-yJ0pwIVc/nYeGoV02WtsN8KYyLQv7kyI2wDnkezyJlGGjkd4QLwDGAwl47YpPJeuI0M0ObaXGSPjvWDPeTPggw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 20" + } + }, + "node_modules/@tailwindcss/postcss": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/@tailwindcss/postcss/-/postcss-4.3.3.tgz", + "integrity": "sha512-JTSZZGQi1AyKirbLN3azmjVzef92tcX7h+iSqPdaeStyFpGpDlKvvpxeOE8njhbUanbRwr3z8DyzhICWnMtQeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "@tailwindcss/node": "4.3.3", + "@tailwindcss/oxide": "4.3.3", + "postcss": "^8.5.16", + "tailwindcss": "4.3.3" + } + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.4.tgz", + "integrity": "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/d3-array": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz", + "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", + "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", + "license": "MIT" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", + "license": "MIT" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-kVd74ta9eof3eJOvbNd1vGKS/XERRyQbT26Og63hIsvDO84cjD5gEOhsXf26w3FSoNlPVz84DOFcKv/oou+fMw==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", + "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", + "license": "MIT" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "25.9.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.9.tgz", + "integrity": "sha512-b4e2xxj/yMeT2hNlD6x7zNFiQK2Dlmkb9CQ6v3/1G2RezKN4YS2lcEv8lzGm1mhs4f2lM4yNAMI/zUDBZBBt7w==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": ">=7.24.0 <7.24.7" + } + }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "devOptional": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", + "license": "MIT" + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.71.2.tgz", + "integrity": "sha512-K72/pvT7qpm8q3k8G5u93NCSN1RcLxX5h7Gw0bQpbMXviBHeY6Nx1WEwmk9wP+eKTSQ8ecxvcgt/ZX/rB938xQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.71.2", + "@typescript-eslint/type-utils": "8.71.2", + "@typescript-eslint/utils": "8.71.2", + "@typescript-eslint/visitor-keys": "8.71.2", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.71.2", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.12.tgz", + "integrity": "sha512-/8UvqAPU9DGTI9k4mxtf49U37Isfwr8Uts96+SBHIkFxPJnHS0Ew4f00sM4Scd8V8EjM0jUNtVDdv1kPdt35lg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.71.2.tgz", + "integrity": "sha512-aTtmZjp/x3gsGHkDs04/1I8kNogBJkpQaeGaN0PfiG43NzDEmW2n+OP5im9wfsvyX0yP1UZWBrAGtDBfH9jEVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.71.2", + "@typescript-eslint/types": "8.71.2", + "@typescript-eslint/typescript-estree": "8.71.2", + "@typescript-eslint/visitor-keys": "8.71.2", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.71.2.tgz", + "integrity": "sha512-Pd68GsLVh5ZXlcEccFPdhSOvtHZ/2WU0XsA8zmXOS3F158lVlcTLhfQ6qvtL1RzbMie0Kp8xtbVwAg4nejKPHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.71.2", + "@typescript-eslint/types": "^8.71.2", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.71.2.tgz", + "integrity": "sha512-YF4wgg5iUX5Obywoac27B56FhozMNFhdJSbh11H5GBAwmBtfyRhmgTQqW9tRNNmHDvsZ2CX6UGzoz+YfYn2Leg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.71.2", + "@typescript-eslint/visitor-keys": "8.71.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.71.2.tgz", + "integrity": "sha512-jz49TAWokm/7yWD9/o837nYax9DyALxIPOImdImvVzo6canBCZYzin8zJyqNR5k1j9K1DE0bVvr0XYB+99uAdg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.71.2.tgz", + "integrity": "sha512-cC8UaalCViJkb3rH/xLIvidEwoFRtMZMUqDjjJMGEKaTFwYRHYBcoczlEGHuvkHEO8svRDrgZ0yQgOArFmwang==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.71.2", + "@typescript-eslint/typescript-estree": "8.71.2", + "@typescript-eslint/utils": "8.71.2", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.71.2.tgz", + "integrity": "sha512-y5Ukl3oVp7e/VGxqIoEXoeb/Roj71PAJ4WG/N/RGj+eeDvKRLM15kGr9MijLbN0i03S52zxu31Z98E5gWChJKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.71.2.tgz", + "integrity": "sha512-DgNOEsl4pdYzwSL+N/Cl33tX1Hlw3FvId73LnKXfq7jnrF2viOEn7X+P7RBkkSWCVm92gnWd28GIC5vJuLREeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.71.2", + "@typescript-eslint/tsconfig-utils": "8.71.2", + "@typescript-eslint/types": "8.71.2", + "@typescript-eslint/visitor-keys": "8.71.2", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.71.2.tgz", + "integrity": "sha512-RyKa1G1M9rKHDhrk+HJtiF1MvLD5Ux2JW3TSkzw+02pRALdpJb+QzG1Y5em+LvCgzGwgg8H7mBRFKljNz7ImPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.71.2", + "@typescript-eslint/types": "8.71.2", + "@typescript-eslint/typescript-estree": "8.71.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.71.2.tgz", + "integrity": "sha512-zozlN0UA32bSG2zkKAgQyRYSbEISVoyU6vvkKYo2aSny74D8Jh4e+POkJ6Lk0dlezZi5x7TtD+88Xb06IB8nhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.71.2", + "eslint-visitor-keys": "^5.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@unrs/resolver-binding-android-arm-eabi": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm-eabi/-/resolver-binding-android-arm-eabi-1.12.2.tgz", + "integrity": "sha512-g5T90pqg1bo/7mytQx6F4iBNC0Wsh9cu+z9veDbFjc7HjpesJFWD7QMS0NGStXM075+7dJPPVvBbpZlnrdpi/w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-android-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-android-arm64/-/resolver-binding-android-arm64-1.12.2.tgz", + "integrity": "sha512-YGCRZv/9GLhwmz6mYDeTsm/92BAyR28l6c2ReweVW5pWgfsitWLY8upvfRlGdoyD8HjeTHSYJWyZGD4KJA/nFQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-arm64/-/resolver-binding-darwin-arm64-1.12.2.tgz", + "integrity": "sha512-u9DiNT1auQMO20A9SyTuG3wUgQWB9Z7KjAg0uFuCDR1FsAY8A0CG2S6JpHS1xwm/w1G08bjXZDcyOCjv1WAm2w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-darwin-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-darwin-x64/-/resolver-binding-darwin-x64-1.12.2.tgz", + "integrity": "sha512-f7rPLi/T1HVKZu/u6t87lroib16n8vrSzcyxI7lg4BGO9UF26KhQL44sd9eOUgrTYhvRXtWOIZT5PejdPyJfUA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@unrs/resolver-binding-freebsd-x64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-freebsd-x64/-/resolver-binding-freebsd-x64-1.12.2.tgz", + "integrity": "sha512-BpcOjWCJub6nRZUS2zA20pmLvjtqAtGejETaIyRLiZiQf++cbrjltLA5NN/xaXfqeOBOSlMFbemIl5/S5tljmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-gnueabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-gnueabihf/-/resolver-binding-linux-arm-gnueabihf-1.12.2.tgz", + "integrity": "sha512-vZTDvdSISZjJx66OzJqtsOhzifbqRjbmI1Mnu49fQDwog5GtDI4QidRiEAYbZCRj9C8YZEW+3ZjqsyS9GR4k2A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm-musleabihf": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm-musleabihf/-/resolver-binding-linux-arm-musleabihf-1.12.2.tgz", + "integrity": "sha512-BiPI+IrIlwcW4nLLMM21+B1dFPzd55yAVgVGrdgDjNef+ch03GdxrcyaIz8X9SsQirh/kCQ7mviyWlMxdh2D7g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-gnu/-/resolver-binding-linux-arm64-gnu-1.12.2.tgz", + "integrity": "sha512-zJc0H99FEPoFfSrNpa91HYfxzfAJCr502oxNK1cfdC9hlaFI43RT+JFCann9JUgZmLzzntChHyn13Sgn9ljHNg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-arm64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-arm64-musl/-/resolver-binding-linux-arm64-musl-1.12.2.tgz", + "integrity": "sha512-KQ3Lki6l+Pz1k/eBipN41ES+YUK30beLGb9YqcB1O542cyLCNE6GaxrfcY3T6EezmGGk84wb5XyO9loTM9tkcA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-loong64-gnu/-/resolver-binding-linux-loong64-gnu-1.12.2.tgz", + "integrity": "sha512-3SJGEh1DborhG6pyxvhPzCT4bbSIVihsvgJc13P1bHG7KLdNDaF9T3gsTwFc7Jw/5Y5/iWOjkEx7Zy0NvCGX3Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-loong64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-loong64-musl/-/resolver-binding-linux-loong64-musl-1.12.2.tgz", + "integrity": "sha512-jiuG/Obbel7uw1PwHNFfrkiKhLAF6mnyZ6aWlOAVN9WqKm8v0OFGnciJIHu8+CMvXLQ8AD51LPzAoUfT21D5Ew==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-ppc64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-ppc64-gnu/-/resolver-binding-linux-ppc64-gnu-1.12.2.tgz", + "integrity": "sha512-q7xRvVpmcfeL+LlZg8Pbbo6QaTZwDU5BaGZbwfhkEsXJn3Was8xYfE0RBH266xZt0rM6B7i8xAYIvjthuUIWHg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-gnu/-/resolver-binding-linux-riscv64-gnu-1.12.2.tgz", + "integrity": "sha512-0CVdx6lcnT3Q9inOH8tsMIOJ6ImndllMjqJHg8RLVdB7Vq4SfkEXl9mCSsVNuNA4MCYycRicCUxPCabVHJRr6A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-riscv64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-riscv64-musl/-/resolver-binding-linux-riscv64-musl-1.12.2.tgz", + "integrity": "sha512-iOwlRo9vnp6R6ohHQS11n0NnfdXx/omhkocmIfaPRpQhKZ+3BDMkkdRVh53qjkFkpPddf+FETA28NwGN7l5l+w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-s390x-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-s390x-gnu/-/resolver-binding-linux-s390x-gnu-1.12.2.tgz", + "integrity": "sha512-HYJtLfXq94q8iZNFT1lknx258wlkkWhZeUXJRqzKBBUJ00CvZ+N33zgbCqimLjsyw5Va6uUxhVa12mI+kaveEw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-gnu": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-gnu/-/resolver-binding-linux-x64-gnu-1.12.2.tgz", + "integrity": "sha512-mPsUhunKKDih5O96Y6enDQyHc1SqBPlY1E/SfMWDM3EdJ95Z9CArPeCVwCCqbP45ljvivdEk8Fxn+SIb1rDAJQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-linux-x64-musl": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-linux-x64-musl/-/resolver-binding-linux-x64-musl-1.12.2.tgz", + "integrity": "sha512-azrt6+5ydLd8Vt210AAFis/lZevSfPw93EJRIJG+xPu4WCJ8K0kppCTpMyLPcKT7H15M4Jnt2tMp5bOvCkRC6A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@unrs/resolver-binding-openharmony-arm64": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-openharmony-arm64/-/resolver-binding-openharmony-arm64-1.12.2.tgz", + "integrity": "sha512-YZ9hP4O0X9PQb8eO980qmLNGH4zT3I9+SZTdt0Pr0YyuGQhYKoOZkV02VzrzyOZJ5xIJ3UFIenKkUkGg8GjgWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-wasm32-wasi/-/resolver-binding-wasm32-wasi-1.12.2.tgz", + "integrity": "sha512-tYFDIkMxSflfEc/h92ZWNsZlHSwgimbNHSO3PL2JWQHfCuC2q316jMyYU9TIWZsFK2bQwyK5VAdYgn8ygPj69A==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "1.10.0", + "@emnapi/runtime": "1.10.0", + "@napi-rs/wasm-runtime": "^1.1.4" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@unrs/resolver-binding-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz", + "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@unrs/resolver-binding-win32-arm64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-arm64-msvc/-/resolver-binding-win32-arm64-msvc-1.12.2.tgz", + "integrity": "sha512-qzNyg3xL0VPQmCaUh+N5jSitce6k+uCBfMDesWRnlULOZaqUkaJ0ybdT+UqlAWJoQjuqfIU/0Ptx9bteN4D82g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-ia32-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-ia32-msvc/-/resolver-binding-win32-ia32-msvc-1.12.2.tgz", + "integrity": "sha512-WD9sY00OfpHVGfsnHZoA8jVT+esS/Bg8z8jzxp5BnDCjjwsuKsPQrzswwpFy4J1AUJbXPRfkpcX0mXrzeXW79g==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@unrs/resolver-binding-win32-x64-msvc": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/@unrs/resolver-binding-win32-x64-msvc/-/resolver-binding-win32-x64-msvc-1.12.2.tgz", + "integrity": "sha512-nAB74NfSNKknqQ1RrYj6uz8FcXEomu/MATJZxh/x+BArzN2U3JbOYC0APYzUIGhVY3m5hRxA8VPNdPBoG8txlA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/aria-hidden": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", + "integrity": "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/aria-query": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz", + "integrity": "sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/array-buffer-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz", + "integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "is-array-buffer": "^3.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-includes": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.2.0.tgz", + "integrity": "sha512-VXY5eFRarnXcYxwBjJzPmEhH55+rmP79/+ueDhi0F+TuqfHCItagIHqxeUZrmgrOPa31QTh9H85DjX3FfJ0FTg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-object-atoms": "^1.1.2", + "es-shim-unscopables": "^1.1.0", + "is-string": "^1.1.1", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlast": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", + "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.findlastindex": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz", + "integrity": "sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-shim-unscopables": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.3.tgz", + "integrity": "sha512-rwG/ja1neyLqCuGZ5YYrznA62D4mZXg0i1cIskIUKSiqF3Cje9/wXAls9B9s1Wa2fomMsIv8czB8jZcPmxCXFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.flatmap": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.3.tgz", + "integrity": "sha512-Y7Wt51eKJSyi80hFrJCePGGNo5ktJCslFuboqJsbf57CCPcm5zztluPlc4/aD8sWsKvlwatezpV4U1efk8kpjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array.prototype.tosorted": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", + "integrity": "sha512-p6Fx8B7b7ZhL/gmUsAy0D15WhvDccw3mnGNbZpi3pmeJdxtWsj2jEaI4Y6oo3XiHfzuSgPwKc04MYt6KgvC/wA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3", + "es-errors": "^1.3.0", + "es-shim-unscopables": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/arraybuffer.prototype.slice": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.4.tgz", + "integrity": "sha512-BNoCY6SXXPQ7gF2opIP4GBE+Xw7U+pHMYKuzjgCN3GwiaIR09UUeKfheyIry77QtrCBlC0KK0q5/TER/tYh3PQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.1", + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.5", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "is-array-buffer": "^3.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/ast-types-flow": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz", + "integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/async-function": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/async-function/-/async-function-1.0.0.tgz", + "integrity": "sha512-hsU18Ae8CDTR6Kgu9DYf0EbCr/a5iGL0rytQDobUcdpYOKokk8LEjVphnXkDkgpi0wYVsqrXuP0bZxJaTqdgoA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz", + "integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/axe-core": { + "version": "4.14.0", + "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.14.0.tgz", + "integrity": "sha512-9WTZxEjsZ7b13TH8JPmbV2z8CHbl80/2hm3XPEG4JgNdQLK81IBRXmSxHfMAOkSqQeRxT/0dwNDz2GOm3zzpcQ==", + "dev": true, + "license": "MPL-2.0", + "engines": { + "node": ">=4" + } + }, + "node_modules/axobject-query": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-4.1.0.tgz", + "integrity": "sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.29", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.29.tgz", + "integrity": "sha512-YeesxhUmR4h5y5V8KF8iBCqJb8YFrBJ++XBTeGcWIaQOYXGN19JM0FoiOjAhwuDoln8owMgXcWBmgHtYSkky2w==", + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.29.3", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.3.tgz", + "integrity": "sha512-1R4kiYKXGViqEN0CnoDrXc1StD9niAwu+j2dukWzrD4bJgsD4lDmEp0CRbc6E/vYJIfTHwPmwyaKtVSudICdPA==", + "devOptional": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.11.26", + "caniuse-lite": "^1.0.30001813", + "electron-to-chromium": "^1.5.439", + "node-releases": "^2.0.57", + "update-browserslist-db": "^1.3.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/call-bind": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.9.tgz", + "integrity": "sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "get-intrinsic": "^1.3.0", + "set-function-length": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001816", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001816.tgz", + "integrity": "sha512-+8Yx7BXCoqk6IF8yTicjfUR6D/ldJzdlsodlEOiOSPmhK844WIgk67/zIQaGAOxNkZyyvBlrRFnLvqKIoqbAFw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/change-case": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", + "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", + "dev": true, + "license": "MIT" + }, + "node_modules/client-only": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/client-only/-/client-only-0.0.1.tgz", + "integrity": "sha512-IV3Ou0jSMzZrd3pZ48nLkT9DA7Ag1pnPzaiQhpW7c3RbcqqzvzzVu+L8gfqMp/8IM2MQtSiqaCxrrcfu8I8rMA==", + "license": "MIT" + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true, + "license": "MIT" + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", + "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/damerau-levenshtein": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", + "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", + "dev": true, + "license": "BSD-2-Clause" + }, + "node_modules/data-view-buffer": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-buffer/-/data-view-buffer-1.0.2.tgz", + "integrity": "sha512-EmKO5V3OLXh1rtK2wgXRansaK1/mtVdTUEiEI0W8RkvgT05kfxaH29PliLnpLP73yYO6142Q72QNa8Wx/A5CqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/data-view-byte-length": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/data-view-byte-length/-/data-view-byte-length-1.0.2.tgz", + "integrity": "sha512-tuhGbE6CfTM9+5ANGf+oQb72Ky/0+s3xKUpHvShfiz2RxMFgFPjsXuRLBVMtvMs15awe45SRb83D6wH4ew6wlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/inspect-js" + } + }, + "node_modules/data-view-byte-offset": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/data-view-byte-offset/-/data-view-byte-offset-1.0.1.tgz", + "integrity": "sha512-BS8PfmtDGnrgYdOonGZQdLZslWIeCGFP9tpan0hi1Co2Zr2NKADsvGYA8XxuG/4UWgJ6Cjtv+YJnB6MM69QGlQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-data-view": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js-light": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", + "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", + "license": "MIT" + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", + "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz", + "integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "devOptional": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/detect-node-es": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/detect-node-es/-/detect-node-es-1.1.0.tgz", + "integrity": "sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==", + "license": "MIT" + }, + "node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/dotenv": { + "version": "17.4.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz", + "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.459", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.459.tgz", + "integrity": "sha512-4SC9HHSFjO/liAhifpdOL5hG9b4BP7/5G3y3UPZVO8trlAXr1CaUEEJL0gWK3kOcYcZrOA5rkwG45Gra/lTIgg==", + "devOptional": true, + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/enhanced-resolve": { + "version": "5.26.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.26.0.tgz", + "integrity": "sha512-9vhedylFonb2YGogzUKX6+Ja72gOJbN1QHAqdrvqLwhdl/QWbKopzoUC9EbQNVsAns/bx/4uyqalrQAoy1IByw==", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "tapable": "^2.3.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/es-abstract": { + "version": "1.24.2", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.24.2.tgz", + "integrity": "sha512-2FpH9Q5i2RRwyEP1AylXe6nYLR5OhaJTZwmlcP0dL/+JCbgg7yyEo/sEK6HeGZRf3dFpWwThaRHVApXSkW3xeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-buffer-byte-length": "^1.0.2", + "arraybuffer.prototype.slice": "^1.0.4", + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "data-view-buffer": "^1.0.2", + "data-view-byte-length": "^1.0.2", + "data-view-byte-offset": "^1.0.1", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "es-set-tostringtag": "^2.1.0", + "es-to-primitive": "^1.3.0", + "function.prototype.name": "^1.1.8", + "get-intrinsic": "^1.3.0", + "get-proto": "^1.0.1", + "get-symbol-description": "^1.1.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "internal-slot": "^1.1.0", + "is-array-buffer": "^3.0.5", + "is-callable": "^1.2.7", + "is-data-view": "^1.0.2", + "is-negative-zero": "^2.0.3", + "is-regex": "^1.2.1", + "is-set": "^2.0.3", + "is-shared-array-buffer": "^1.0.4", + "is-string": "^1.1.1", + "is-typed-array": "^1.1.15", + "is-weakref": "^1.1.1", + "math-intrinsics": "^1.1.0", + "object-inspect": "^1.13.4", + "object-keys": "^1.1.1", + "object.assign": "^4.1.7", + "own-keys": "^1.0.1", + "regexp.prototype.flags": "^1.5.4", + "safe-array-concat": "^1.1.3", + "safe-push-apply": "^1.0.0", + "safe-regex-test": "^1.1.0", + "set-proto": "^1.0.0", + "stop-iteration-iterator": "^1.1.0", + "string.prototype.trim": "^1.2.10", + "string.prototype.trimend": "^1.0.9", + "string.prototype.trimstart": "^1.0.8", + "typed-array-buffer": "^1.0.3", + "typed-array-byte-length": "^1.0.3", + "typed-array-byte-offset": "^1.0.4", + "typed-array-length": "^1.0.7", + "unbox-primitive": "^1.1.0", + "which-typed-array": "^1.1.19" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-abstract-get": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-abstract-get/-/es-abstract-get-1.0.0.tgz", + "integrity": "sha512-6PMWXpdhshVvFp+FoWYs1EvG1Nj0tvk0dZM+XcK0xMEM1czRVcP6ohqPWHy6qPagSpC8j4+p89WXlT+xXJs/fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.2", + "is-callable": "^1.2.7", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-iterator-helpers": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.4.0.tgz", + "integrity": "sha512-c/A0P0oxkACDc+cKWw8evLXK83oBKgn0qPOqCYT4x9uolpCIJAcYvJC9QYKNDRPsTeGyCrQ326jrvgZWdCdK5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-errors": "^1.3.0", + "es-set-tostringtag": "^2.1.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.3.0", + "globalthis": "^1.0.4", + "gopd": "^1.2.0", + "has-property-descriptors": "^1.0.2", + "has-proto": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "iterator.prototype": "^1.1.5", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-shim-unscopables": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz", + "integrity": "sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-to-primitive": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.3.4.tgz", + "integrity": "sha512-yPDz7wqpg1/mmHLmS3tcfTfbw5f1eryXvyghYBffGdERwe+mV7ZcWzTR8LR17Kvqt3qfPurjlonmnq3MKXIOXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-abstract-get": "^1.0.0", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "is-callable": "^1.2.7", + "is-date-object": "^1.1.0", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-toolkit": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.52.0.tgz", + "integrity": "sha512-XTNEJQh1tY1ZJVcf6ayP/2n4ZPyaHlW2FWs7xvw5ddPuhUVjLD3olQVQS7kf58JbAB48iL0uL/jerTrjtV3lDA==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks", + "tests/types", + "tests/browser-compat" + ] + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.5", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.5.tgz", + "integrity": "sha512-DgZS62aPLXKlnxILS/AYCoRvHaZeXceIzlXPkkGGzJWSow1aEk0lbTlxUSlyjC8jcaKxAdOnTDz+o1JFSBsyjw==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.2", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.6", + "@eslint/js": "9.39.5", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.5", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-next": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-16.4.2.tgz", + "integrity": "sha512-P33vjcETMXc+qBjpF77TeJHZLzk6cPcTy8KjpxLucYB3mCIFIORMcZ+cBXcAiIYjE5RM7jyknEEOwMNdnx/ADQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@next/eslint-plugin-next": "16.4.2", + "eslint-import-resolver-node": "^0.3.6", + "eslint-import-resolver-typescript": "^3.5.2", + "eslint-plugin-import": "^2.32.0", + "eslint-plugin-jsx-a11y": "^6.10.0", + "eslint-plugin-react": "^7.37.0", + "eslint-plugin-react-hooks": "^7.1.0", + "globals": "16.4.0", + "typescript-eslint": "^8.56.0" + }, + "peerDependencies": { + "eslint": ">=9.0.0", + "typescript": ">=3.3.1" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/eslint-config-next/node_modules/globals": { + "version": "16.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz", + "integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.10", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.10.tgz", + "integrity": "sha512-tRrKqFyCaKict5hOd244sL6EQFNycnMQnBe+j8uqGNXYzsImGbGUU4ibtoaBmv5FLwJwcFJNeg1GeVjQfbMrDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7", + "is-core-module": "^2.16.1", + "resolve": "^2.0.0-next.6" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-import-resolver-typescript": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-typescript/-/eslint-import-resolver-typescript-3.10.1.tgz", + "integrity": "sha512-A1rHYb06zjMGAxdLSkN2fXPBwuSaQ0iO5M/hdyS0Ajj1VBaRp0sPD3dn1FhME3c/JluGFbwSxyCfqdSbtQLAHQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "@nolyfill/is-core-module": "1.0.39", + "debug": "^4.4.0", + "get-tsconfig": "^4.10.0", + "is-bun-module": "^2.0.0", + "stable-hash": "^0.0.5", + "tinyglobby": "^0.2.13", + "unrs-resolver": "^1.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint-import-resolver-typescript" + }, + "peerDependencies": { + "eslint": "*", + "eslint-plugin-import": "*", + "eslint-plugin-import-x": "*" + }, + "peerDependenciesMeta": { + "eslint-plugin-import": { + "optional": true + }, + "eslint-plugin-import-x": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.14.0.tgz", + "integrity": "sha512-W2WCRZ9Dqntd+2u8jJcVMV2PKulc6RdLgUUoh/yQr3uB6lo/ZOeGx11sv60/8S4QFFKNslAlWhr9u0Ef7ZW6Ig==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "^3.2.7" + }, + "engines": { + "node": ">=4" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true + } + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.32.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz", + "integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rtsao/scc": "^1.1.0", + "array-includes": "^3.1.9", + "array.prototype.findlastindex": "^1.2.6", + "array.prototype.flat": "^1.3.3", + "array.prototype.flatmap": "^1.3.3", + "debug": "^3.2.7", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.9", + "eslint-module-utils": "^2.12.1", + "hasown": "^2.0.2", + "is-core-module": "^2.16.1", + "is-glob": "^4.0.3", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "object.groupby": "^1.0.3", + "object.values": "^1.2.1", + "semver": "^6.3.1", + "string.prototype.trimend": "^1.0.9", + "tsconfig-paths": "^3.15.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-import/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-import/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-plugin-import/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-import/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-plugin-jsx-a11y": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.10.2.tgz", + "integrity": "sha512-scB3nz4WmG75pV8+3eRUQOHZlNSUhFNq37xnpgRkCCELU3XMvXAxLk1eqWWyE22Ki4Q01Fnsw9BA3cJHDPgn2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "aria-query": "^5.3.2", + "array-includes": "^3.1.8", + "array.prototype.flatmap": "^1.3.2", + "ast-types-flow": "^0.0.8", + "axe-core": "^4.10.0", + "axobject-query": "^4.1.0", + "damerau-levenshtein": "^1.0.8", + "emoji-regex": "^9.2.2", + "hasown": "^2.0.2", + "jsx-ast-utils": "^3.3.5", + "language-tags": "^1.0.9", + "minimatch": "^3.1.2", + "object.fromentries": "^2.0.8", + "safe-regex-test": "^1.0.3", + "string.prototype.includes": "^2.0.1" + }, + "engines": { + "node": ">=4.0" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9" + } + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-jsx-a11y/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-react": { + "version": "7.37.5", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.37.5.tgz", + "integrity": "sha512-Qteup0SqU15kdocexFNAJMvCJEfa2xUKNV4CC1xsVMrIIqEy3SQ/rqyxCWNzfrd3/ldy6HMlD2e0JDVpDg2qIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.8", + "array.prototype.findlast": "^1.2.5", + "array.prototype.flatmap": "^1.3.3", + "array.prototype.tosorted": "^1.1.4", + "doctrine": "^2.1.0", + "es-iterator-helpers": "^1.2.1", + "estraverse": "^5.3.0", + "hasown": "^2.0.2", + "jsx-ast-utils": "^2.4.1 || ^3.0.0", + "minimatch": "^3.1.2", + "object.entries": "^1.1.9", + "object.fromentries": "^2.0.8", + "object.values": "^1.2.1", + "prop-types": "^15.8.1", + "resolve": "^2.0.0-next.5", + "semver": "^6.3.1", + "string.prototype.matchall": "^4.0.12", + "string.prototype.repeat": "^1.0.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7" + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-7.1.1.tgz", + "integrity": "sha512-f2I7Gw6JbvCexzIInuSbZpfdQ44D7iqdWX01FKLvrPgqxoE7oMj8clOfto8U6vYiz4yd5oKu39rRSVOe1zRu0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.24.4", + "@babel/parser": "^7.24.4", + "hermes-parser": "^0.25.1", + "zod": "^3.25.0 || ^4.0.0", + "zod-validation-error": "^3.5.0 || ^4.0.0" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0 || ^10.0.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint-plugin-react/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint-plugin-react/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/eslint-plugin-react/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.21", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz", + "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estree-walker": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", + "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", + "license": "MIT" + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "license": "MIT" + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fastq": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", + "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", + "dev": true, + "license": "ISC" + }, + "node_modules/for-each": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz", + "integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-callable": "^1.2.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/function.prototype.name": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.2.0.tgz", + "integrity": "sha512-jObKIik1P2QjPHP5nz5BaOtUlfgS0fWo8IUByNXkM+o+02sJOi94em77GwJKQSJ3gfPHdgzLNrHc1uokV4P/ew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2", + "hasown": "^2.0.4", + "is-callable": "^1.2.7", + "is-document.all": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/functions-have-names": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/generator-function": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/generator-function/-/generator-function-2.0.1.tgz", + "integrity": "sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-nonce": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-nonce/-/get-nonce-1.0.1.tgz", + "integrity": "sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-symbol-description": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.1.0.tgz", + "integrity": "sha512-w9UMqWwJxHNOvoNzSJ2oPF5wvYcvP7jUvYzhp67yEhTi17ZDBBC1z9pTdGuzjD+EFIqLSYRweZjqfiPzQ06Ebg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-tsconfig": { + "version": "4.14.3", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.14.3.tgz", + "integrity": "sha512-++QEw4DIY7WGoukz+/+A/8dGYPT9l9yIadnmSgZ8Rjr3YVSVDipQSO9CdnJo9ePqFqUUqh+wk9uIaoiAwsiPkA==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/glob": { + "version": "13.0.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz", + "integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==", + "license": "BlueOak-1.0.0", + "dependencies": { + "minimatch": "^10.2.2", + "minipass": "^7.1.3", + "path-scurry": "^2.0.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/globalthis": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.4.tgz", + "integrity": "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.2.1", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/has-bigints": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", + "integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", + "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.2.0.tgz", + "integrity": "sha512-KIL7eQPfHQRC8+XluaIw7BHUwwqL19bQn4hzNgdr+1wXoU0KKj6rufu47lhY7KbJR2C6T6+PfyN0Ea7wkSS+qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hermes-estree": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-estree/-/hermes-estree-0.25.1.tgz", + "integrity": "sha512-0wUoCcLp+5Ev5pDW2OriHC2MJCbwLwuRx+gAqMTOkGKJJiBCLjtrvy4PWUGn6MIVefecRpzoOZ/UV6iGdOr+Cw==", + "dev": true, + "license": "MIT" + }, + "node_modules/hermes-parser": { + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/hermes-parser/-/hermes-parser-0.25.1.tgz", + "integrity": "sha512-6pEjquH3rqaI6cYAXYPcz9MS4rY6R4ngRgrgfDshRptUZIc3lw0MCIJIGDj9++mfySOuPTHB4nrSW99BCvOPIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hermes-estree": "0.25.1" + } + }, + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/immer": { + "version": "11.1.21", + "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.21.tgz", + "integrity": "sha512-bZSadeCPGdaY5/qRLgr6mDSH1ra21rD3rqpiWk7+QTr4ayYPTE9qZYdLh/NdPhMe0wSrTvHD/Lk8q5EwhUs0aw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/index-to-position": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/index-to-position/-/index-to-position-1.2.0.tgz", + "integrity": "sha512-Yg7+ztRkqslMAS2iFaU+Oa4KTSidr63OsFGlOrJoW981kIYO3CGCS3wA95P1mUi/IVSJkn0D479KTJpVpvFNuw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/internal-slot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", + "integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "hasown": "^2.0.2", + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-array-buffer": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz", + "integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-async-function": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.1.1.tgz", + "integrity": "sha512-9dgM/cZBnNvjzaMYHVoxxfPj2QXt22Ev7SuuPrs+xav0ukGB0S6d4ydZdEiM48kLx5kDV+QBPrpVnFyefL8kkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "async-function": "^1.0.0", + "call-bound": "^1.0.3", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bigint": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz", + "integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-bigints": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-boolean-object": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz", + "integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-bun-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-bun-module/-/is-bun-module-2.0.0.tgz", + "integrity": "sha512-gNCGbnnnnFAUGKeZ9PdbyeGYJqewpmc2aKHUEMO5nQPWU9lOmv7jcmQIv+qHD8fXW6W7qfuCwX4rY9LNRjXrkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.7.1" + } + }, + "node_modules/is-callable": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", + "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz", + "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-data-view": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-data-view/-/is-data-view-1.0.2.tgz", + "integrity": "sha512-RKtWF8pGmS87i2D6gqQu/l7EYRlVdfzemCJN/P3UOs//x1QE7mfhvzHIApBTRf7axvT6DMGwSwBXYCT0nfB9xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "get-intrinsic": "^1.2.6", + "is-typed-array": "^1.1.13" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz", + "integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-document.all": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-document.all/-/is-document.all-1.0.0.tgz", + "integrity": "sha512-+XSoyS05OdBbhFuELhgTCpFNHkpBOJqtsZfUFFpe5QTw+9Sjbh8zitxhQkYAo6wV7e1Vb8cAPvpCk9jGam/82g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-finalizationregistry": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.1.1.tgz", + "integrity": "sha512-1pC6N8qWJbWoPtEjgcL2xyhQOP491EQjeUo3qTKcmV8YSDDJrOepfG8pcC7h/QgnQHYSv0mJ3Z/ZWxmatVrysg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-generator-function": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.1.2.tgz", + "integrity": "sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "generator-function": "^2.0.0", + "get-proto": "^1.0.1", + "has-tostringtag": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", + "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", + "integrity": "sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz", + "integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-reference": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", + "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", + "license": "MIT", + "dependencies": { + "@types/estree": "*" + } + }, + "node_modules/is-regex": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz", + "integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-set": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", + "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz", + "integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz", + "integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz", + "integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "has-symbols": "^1.1.0", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.15.tgz", + "integrity": "sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakmap": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", + "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakref": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.1.1.tgz", + "integrity": "sha512-6i9mGWSlqzNMEqpCp93KwRS1uUOodk2OJ6b+sq7ZPDSy2WuI5NFIxp/254TytR8ftefexkWn5xNiHUNpPOfSew==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-weakset": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz", + "integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "get-intrinsic": "^1.2.6" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true, + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/iterator.prototype": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.5.tgz", + "integrity": "sha512-H0dkQoCa3b2VEeKQBOxFph+JAbcrQdE7KC0UkqwpLmv2EC4P41QXP+rqo9wYodACiG5/WM5s9oDApTU8utwj9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.6", + "get-proto": "^1.0.0", + "has-symbols": "^1.1.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/jiti": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", + "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, + "node_modules/js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.2.tgz", + "integrity": "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/puzrin" + }, + { + "type": "github", + "url": "https://github.com/sponsors/nodeca" + } + ], + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "devOptional": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "devOptional": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsx-ast-utils": { + "version": "3.3.5", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", + "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-includes": "^3.1.6", + "array.prototype.flat": "^1.3.1", + "object.assign": "^4.1.4", + "object.values": "^1.1.6" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/language-subtag-registry": { + "version": "0.3.23", + "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.23.tgz", + "integrity": "sha512-0K65Lea881pHotoGEa5gDlMxt3pctLi2RplBb7Ezh4rRdLEOtgi7n4EwK9lamnUCkKBqaeKRVebTq6BAxSkpXQ==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/language-tags": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.9.tgz", + "integrity": "sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==", + "dev": true, + "license": "MIT", + "dependencies": { + "language-subtag-registry": "^0.3.20" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/lucide-react": { + "version": "1.59.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.59.0.tgz", + "integrity": "sha512-5qgMyyCPU6OvnKpLS2t693+ZtiqA8oaSweWoUows0BLFKFf6V75m4+CptpmohZHpD5IuOVIBXHBBiv2vpLJmtw==", + "license": "ISC", + "peerDependencies": { + "@types/react": "*", + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/magic-string": { + "version": "0.30.21", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", + "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.5" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/napi-postinstall": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/napi-postinstall/-/napi-postinstall-0.3.4.tgz", + "integrity": "sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==", + "dev": true, + "license": "MIT", + "bin": { + "napi-postinstall": "lib/cli.js" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/napi-postinstall" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/next": { + "version": "16.4.2", + "resolved": "https://registry.npmjs.org/next/-/next-16.4.2.tgz", + "integrity": "sha512-r+oBJojfefUjOiWkBhXgLS+igxX/7BWyK59uHnyOyplMSLtBZ+QLP3okrdYTbrfrbrmNTVWLBPaHDX9KRaIt3w==", + "license": "MIT", + "dependencies": { + "@next/env": "16.4.2", + "@swc/helpers": "0.5.23", + "baseline-browser-mapping": "^2.9.19", + "caniuse-lite": "^1.0.30001579", + "postcss": "8.5.23", + "styled-jsx": "5.1.6" + }, + "bin": { + "next": "dist/bin/next" + }, + "engines": { + "node": ">=20.9.0" + }, + "optionalDependencies": { + "@next/swc-darwin-arm64": "16.4.2", + "@next/swc-darwin-x64": "16.4.2", + "@next/swc-linux-arm64-gnu": "16.4.2", + "@next/swc-linux-arm64-musl": "16.4.2", + "@next/swc-linux-x64-gnu": "16.4.2", + "@next/swc-linux-x64-musl": "16.4.2", + "@next/swc-win32-arm64-msvc": "16.4.2", + "@next/swc-win32-x64-msvc": "16.4.2", + "sharp": "^0.35.5" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.1.0", + "@playwright/test": "^1.51.1", + "babel-plugin-react-compiler": "*", + "react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "react-dom": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0", + "sass": "^1.3.0" + }, + "peerDependenciesMeta": { + "@opentelemetry/api": { + "optional": true + }, + "@playwright/test": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + }, + "sass": { + "optional": true + } + } + }, + "node_modules/node-exports-info": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/node-exports-info/-/node-exports-info-1.6.2.tgz", + "integrity": "sha512-kXs9Go0cah0qHVV2v389IXQLdLCeE1xfFtjOAF+iobu0OIoG1pje8At2vMHyaPMiPMnG/LWP50twML21eMcAag==", + "dev": true, + "license": "MIT", + "dependencies": { + "array.prototype.flatmap": "^1.3.3", + "es-errors": "^1.3.0", + "object.entries": "^1.1.9", + "semver": "^6.3.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/node-exports-info/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/node-releases": { + "version": "2.0.59", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.59.tgz", + "integrity": "sha512-5qr2okC4ItAI0hG5SaV0HoYMpnM/Y6+Oqr7AmPYy/2uEoGvS+GbSKLeRxSS1uAdu59yz0ouzcuXievSgg///WA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.7", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz", + "integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0", + "has-symbols": "^1.1.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.entries": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.9.tgz", + "integrity": "sha512-8u/hfXFRBD1O0hPUjioLhoWFHRmt6tKA4/vZPyckBr18l1KE9uHrFaFaUi8MDRTpi4uak2goyPTSNJLXX2k2Hw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.fromentries": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", + "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.groupby": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", + "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.values": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.1.tgz", + "integrity": "sha512-gXah6aZrcUxjWg2zR2MwouP2eHlCBzdV4pygudehaKXSGW4v2AsRQUK+lwwXhii6KFZcunEnmSUoYp5CXibxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "call-bound": "^1.0.3", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/openapi-typescript": { + "version": "7.13.0", + "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-7.13.0.tgz", + "integrity": "sha512-EFP392gcqXS7ntPvbhBzbF8TyBA+baIYEm791Hy5YkjDYKTnk/Tn5OQeKm5BIZvJihpp8Zzr4hzx0Irde1LNGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@redocly/openapi-core": "^1.34.6", + "ansi-colors": "^4.1.3", + "change-case": "^5.4.4", + "parse-json": "^8.3.0", + "supports-color": "^10.2.2", + "yargs-parser": "^21.1.1" + }, + "bin": { + "openapi-typescript": "bin/cli.js" + }, + "peerDependencies": { + "typescript": "^5.x" + } + }, + "node_modules/openapi-typescript/node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/own-keys": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/own-keys/-/own-keys-1.0.2.tgz", + "integrity": "sha512-19YVAg7T+WTrxggPukVq7DjTv6+PJ867TmhCvBsYwmbFCsZd344rq2Ld1p0wo8f8Qrrhgp82c6FJRqdXWtSEhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.4", + "get-intrinsic": "^1.3.0", + "object-keys": "^1.1.1", + "safe-push-apply": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/oxc-parser": { + "version": "0.152.0", + "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.152.0.tgz", + "integrity": "sha512-ZztsZgaCWmPeKYMdoTT5e0oV/oxD1NeLWNR3kAtr/G707cUPYaaozRlVDHLCGnszHJRszN9mJwmPNpqgwloC0A==", + "license": "MIT", + "dependencies": { + "@oxc-project/types": "^0.152.0" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxc-parser/binding-android-arm-eabi": "0.152.0", + "@oxc-parser/binding-android-arm64": "0.152.0", + "@oxc-parser/binding-darwin-arm64": "0.152.0", + "@oxc-parser/binding-darwin-x64": "0.152.0", + "@oxc-parser/binding-freebsd-x64": "0.152.0", + "@oxc-parser/binding-linux-arm-gnueabihf": "0.152.0", + "@oxc-parser/binding-linux-arm-musleabihf": "0.152.0", + "@oxc-parser/binding-linux-arm64-gnu": "0.152.0", + "@oxc-parser/binding-linux-arm64-musl": "0.152.0", + "@oxc-parser/binding-linux-ppc64-gnu": "0.152.0", + "@oxc-parser/binding-linux-riscv64-gnu": "0.152.0", + "@oxc-parser/binding-linux-riscv64-musl": "0.152.0", + "@oxc-parser/binding-linux-s390x-gnu": "0.152.0", + "@oxc-parser/binding-linux-x64-gnu": "0.152.0", + "@oxc-parser/binding-linux-x64-musl": "0.152.0", + "@oxc-parser/binding-openharmony-arm64": "0.152.0", + "@oxc-parser/binding-win32-arm64-msvc": "0.152.0", + "@oxc-parser/binding-win32-ia32-msvc": "0.152.0", + "@oxc-parser/binding-win32-x64-msvc": "0.152.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-json": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", + "integrity": "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "index-to-position": "^1.1.0", + "type-fest": "^4.39.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parse-json/node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/path-scurry": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz", + "integrity": "sha512-3O/iVVsJAPsOnpwWIeD+d6z/7PmqApyQePUtCndjatj/9I5LylHvt5qluFaBT3I5h3r1ejfR056c+FCv+NnNXg==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/playwright": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.64.1.tgz", + "integrity": "sha512-HCrVhHr5QQuwYoswEUGTb7gGp522yflbv/ST8nF4sFWGuLjQCt17Q/EubpGGSNKYn1tsTCPZxqHhHCfVURu7UA==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.64.1" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/playwright-core": { + "version": "1.64.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.64.1.tgz", + "integrity": "sha512-BC4s8y6SEVA6Q1rSxZTto8hI1KUI3xXlHGZgvGqP4IqPdI/a6FX9H29IDNz7vKo9l21b6LfYosScPL6M3xxyDQ==", + "devOptional": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.5.23", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.23.tgz", + "integrity": "sha512-g50586zr4bZmwFiTlflMu8E0bDTb5I5gertgwAKmsdUlTQIhZtunzUlD1WSzwcVWPoAVpsrA6vlfCD7oXvRwgg==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.16", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz", + "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prop-types": { + "version": "15.8.1", + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", + "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", + "dev": true, + "license": "MIT", + "dependencies": { + "loose-envify": "^1.4.0", + "object-assign": "^4.1.1", + "react-is": "^16.13.1" + } + }, + "node_modules/prop-types/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/react": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", + "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.3" + } + }, + "node_modules/react-is": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.3.1.tgz", + "integrity": "sha512-RRieF6IyxQBkcK6pP8xOHprLTPW6QjRkbGdImtqNme+/hYVwCZkLQLdlZGOhUqXwkS9IEynaGvPJtv6XB/cz0Q==", + "license": "MIT", + "peer": true + }, + "node_modules/react-redux": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.3.0.tgz", + "integrity": "sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g==", + "license": "MIT", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, + "node_modules/react-remove-scroll": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/react-remove-scroll/-/react-remove-scroll-2.7.2.tgz", + "integrity": "sha512-Iqb9NjCCTt6Hf+vOdNIZGdTiH1QSqr27H/Ek9sv/a97gfueI/5h1s3yRi1nngzMUaOOToin5dI1dXKdXiF+u0Q==", + "license": "MIT", + "dependencies": { + "react-remove-scroll-bar": "^2.3.7", + "react-style-singleton": "^2.2.3", + "tslib": "^2.1.0", + "use-callback-ref": "^1.3.3", + "use-sidecar": "^1.1.3" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-remove-scroll-bar": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/react-remove-scroll-bar/-/react-remove-scroll-bar-2.3.8.tgz", + "integrity": "sha512-9r+yi9+mgU33AKcj6IbT9oRCO78WriSj6t/cF8DWBZJ9aOGPOTEDvdUDz1FwKim7QXWwmHqtdHnRJfhAxEG46Q==", + "license": "MIT", + "dependencies": { + "react-style-singleton": "^2.2.2", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/react-style-singleton": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/react-style-singleton/-/react-style-singleton-2.2.3.tgz", + "integrity": "sha512-b6jSvxvVnyptAiLjbkWLE/lOnR4lfTtDAl+eUC7RZy+QQWc6wRzIV2CE6xBuMmDxc2qIihtDCZD5NPOFl7fRBQ==", + "license": "MIT", + "dependencies": { + "get-nonce": "^1.0.0", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/recharts": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.10.1.tgz", + "integrity": "sha512-QXFrvt6IVcw7eeZCoyXTwkIJAX3Dv1nyVhMicXJ47GsGDDpcN8z6o644DibE9XjpBTThtsomLKnTV6lc+cVFUA==", + "license": "MIT", + "workspaces": [ + "www" + ], + "dependencies": { + "@reduxjs/toolkit": "^1.9.0 || 2.x.x", + "clsx": "^2.1.1", + "decimal.js-light": "^2.5.1", + "es-toolkit": "^1.39.3", + "eventemitter3": "^5.0.1", + "immer": "^11.1.8", + "react-redux": "8.x.x || 9.x.x", + "reselect": "5.2.0", + "tiny-invariant": "^1.3.3", + "use-sync-external-store": "^1.2.2", + "victory-vendor": "^37.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT" + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "license": "MIT", + "peerDependencies": { + "redux": "^5.0.0" + } + }, + "node_modules/reflect.getprototypeof": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.10.tgz", + "integrity": "sha512-00o4I+DVrefhv+nX0ulyi3biSHCPDe+yLv5o/p6d/UVlirijB8E16FtfwSAi4g3tcqrQ4lRAqQSoFEZJehYEcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.9", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.7", + "get-proto": "^1.0.1", + "which-builtin-type": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/regexp.prototype.flags": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz", + "integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "define-properties": "^1.2.1", + "es-errors": "^1.3.0", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "set-function-name": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/reselect": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.2.0.tgz", + "integrity": "sha512-AgZ3UOZm3YndfrJ4OYjgrT7bmCm/1iqkjvEfH/oYjzh6PD2qw4QuT3jjnXIrpdt4MTpMXclMT3lXbmRY+XRakw==", + "license": "MIT" + }, + "node_modules/resolve": { + "version": "2.0.0-next.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.7.tgz", + "integrity": "sha512-tqt+NBWwyaMgw3zDsnygx4CByWjQEJHOPMdslYhppaQSJUtL/D4JO9CcBBlhPoI8lz9oJIDXkwXfhF4aWqP8xQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.16.2", + "node-exports-info": "^1.6.0", + "object-keys": "^1.1.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.64.9", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.64.9.tgz", + "integrity": "sha512-mnPSQINChN7PpT+a5CI0/+87hm/+6zxSKBK1XonrzQ0zFnglaTjhkTP2Br4yNCTcLHUEvrAfZffH57jGf+8xBQ==", + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.64.9", + "@rollup/rollup-android-arm64": "4.64.9", + "@rollup/rollup-darwin-arm64": "4.64.9", + "@rollup/rollup-darwin-x64": "4.64.9", + "@rollup/rollup-freebsd-arm64": "4.64.9", + "@rollup/rollup-freebsd-x64": "4.64.9", + "@rollup/rollup-linux-arm-gnueabihf": "4.64.9", + "@rollup/rollup-linux-arm-musleabihf": "4.64.9", + "@rollup/rollup-linux-arm64-gnu": "4.64.9", + "@rollup/rollup-linux-arm64-musl": "4.64.9", + "@rollup/rollup-linux-loong64-gnu": "4.64.9", + "@rollup/rollup-linux-loong64-musl": "4.64.9", + "@rollup/rollup-linux-ppc64-gnu": "4.64.9", + "@rollup/rollup-linux-ppc64-musl": "4.64.9", + "@rollup/rollup-linux-riscv64-gnu": "4.64.9", + "@rollup/rollup-linux-riscv64-musl": "4.64.9", + "@rollup/rollup-linux-s390x-gnu": "4.64.9", + "@rollup/rollup-linux-x64-gnu": "4.64.9", + "@rollup/rollup-linux-x64-musl": "4.64.9", + "@rollup/rollup-openbsd-x64": "4.64.9", + "@rollup/rollup-openharmony-arm64": "4.64.9", + "@rollup/rollup-win32-arm64-msvc": "4.64.9", + "@rollup/rollup-win32-ia32-msvc": "4.64.9", + "@rollup/rollup-win32-x64-gnu": "4.64.9", + "@rollup/rollup-win32-x64-msvc": "4.64.9", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-array-concat": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.1.4.tgz", + "integrity": "sha512-wtZlHyOje6OZTGqAoaDKxFkgRtkF9CnHAVnCHKfuj200wAgL+bSJhdsCD2l0Qx/2ekEXjPWcyKkfGb5CPboslg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "get-intrinsic": "^1.3.0", + "has-symbols": "^1.1.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">=0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-push-apply": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/safe-push-apply/-/safe-push-apply-1.0.0.tgz", + "integrity": "sha512-iKE9w/Z7xCzUMIZqdBsp6pEQvwuEebH4vdpjcDWnyzaI6yl6O9FHvVpmGelvEHNsoY6wGblkxR6Zty/h00WiSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "isarray": "^2.0.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/safe-regex-test": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz", + "integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "is-regex": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "devOptional": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sentry": { + "version": "0.45.0", + "resolved": "https://registry.npmjs.org/sentry/-/sentry-0.45.0.tgz", + "integrity": "sha512-kgmEbLlC22lL7uneeUm9Sjz65rp5cvwYOMTxXbZCmBum4sbVre/lLT3zTV3kwXHJ9/BM8ZS0/GhZe9Cl1t6WyA==", + "license": "FSL-1.1-Apache-2.0", + "bin": { + "sentry": "dist/bin.cjs" + }, + "engines": { + "node": ">=20.0" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", + "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-function-name": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz", + "integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "functions-have-names": "^1.2.3", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/set-proto": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/set-proto/-/set-proto-1.0.0.tgz", + "integrity": "sha512-RJRdvCo6IAnPdsvP/7m6bsQqNnn1FCBX5ZNtFL98MmFF/4xAIJTIg1YbHW5DC2W5SKZanrC6i4HsJqlajw/dZw==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/stable-hash": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/stable-hash/-/stable-hash-0.0.5.tgz", + "integrity": "sha512-+L3ccpzibovGXFK+Ap/f8LOS0ahMrHTf3xu7mMLSpEGU0EO9ucaysSylKo9eRDFNhWve/y275iPmIZ4z39a9iA==", + "dev": true, + "license": "MIT" + }, + "node_modules/stacktrace-parser": { + "version": "0.1.11", + "resolved": "https://registry.npmjs.org/stacktrace-parser/-/stacktrace-parser-0.1.11.tgz", + "integrity": "sha512-WjlahMgHmCJpqzU8bIBy4qtsZdU9lRlcZE3Lvyej6t4tuOuv1vk57OW3MBrj6hXBFx/nNoC9MPMTcr5YA7NQbg==", + "license": "MIT", + "dependencies": { + "type-fest": "^0.7.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/stop-iteration-iterator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz", + "integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "internal-slot": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string.prototype.includes": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/string.prototype.includes/-/string.prototype.includes-2.0.1.tgz", + "integrity": "sha512-o7+c9bW6zpAdJHTtujeePODAhkuicdAryFsfVKwA+wGw89wJ4GTY484WTucM9hLtDEOpOvI+aHnzqnC5lHp4Rg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.3" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/string.prototype.matchall": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.1.0.tgz", + "integrity": "sha512-tHNHTxInrYLCga9O9YGxWA3G9/nnzQw8UGAyqGx3Ar1pSTTzIuM4woFSq4SowkXCjJIwq5sIiQvEfRI9tCH1qQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.2", + "get-intrinsic": "^1.3.0", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "internal-slot": "^1.1.0", + "regexp.prototype.flags": "^1.5.4", + "set-function-name": "^2.0.2", + "side-channel": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.repeat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string.prototype.repeat/-/string.prototype.repeat-1.0.0.tgz", + "integrity": "sha512-0u/TldDbKD8bFCQ/4f5+mNRrXwZ8hg2w7ZR8wa16e8z9XpePWl3eGEcUD0OXpEH/VJH/2G3gjUtR3ZOiBe2S/w==", + "dev": true, + "license": "MIT", + "dependencies": { + "define-properties": "^1.1.3", + "es-abstract": "^1.17.5" + } + }, + "node_modules/string.prototype.trim": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.11.tgz", + "integrity": "sha512-PwvK7BU+CMTJGYQCTZb5RWXIML92lftJLhQz1tBzgKiqGxJaMlBAa48POXaNAC2s4y8jr3EFqrkF9+44neS46w==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-data-property": "^1.1.4", + "define-properties": "^1.2.1", + "es-abstract": "^1.24.2", + "es-object-atoms": "^1.1.2", + "has-property-descriptors": "^1.0.2", + "safe-regex-test": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.10.tgz", + "integrity": "sha512-2+3aDAOmPTmuFwjDnmJG2ctEkQKVki7vOSqaxkv42Mowj1V6PnvuwFCRrR5lChUux1TBskPjfkeTOhqczDMxTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.8.tgz", + "integrity": "sha512-UXSH262CSZY1tfu3G3Secr6uGLCFVPMhIqHjlgCUtCCcgihYc/xKs9djMTMUOb2j1mVSeU8EU6NWc/iQKU6Gfg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/styled-jsx": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz", + "integrity": "sha512-qSVyDTeMotdvQYoHWLNGwRFJHC+i+ZvdBRYosOFgC+Wg1vx4frN2/RG/NA7SYqqvKNLf39P2LSRA2pu6n0XYZA==", + "license": "MIT", + "dependencies": { + "client-only": "0.0.1" + }, + "engines": { + "node": ">= 12.0.0" + }, + "peerDependencies": { + "react": ">= 16.8.0 || 17.x.x || ^18.0.0-0 || ^19.0.0-0" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tailwind-merge": { + "version": "3.7.0", + "resolved": "https://registry.npmjs.org/tailwind-merge/-/tailwind-merge-3.7.0.tgz", + "integrity": "sha512-XPPUyAc+cvspz3lHTcR/QgPfW2A0lv/xQNIjX3HGhLR+Nq2lHaLq5MtTesHn8GUr3W3DguT2KT5x3NVgRtYwmA==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/dcastil" + } + }, + "node_modules/tailwindcss": { + "version": "4.3.3", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-4.3.3.tgz", + "integrity": "sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/tapable": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.3.tgz", + "integrity": "sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-api-utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", + "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.2", + "minimist": "^1.2.6", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", + "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "license": "0BSD" + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-fest": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.7.1.tgz", + "integrity": "sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=8" + } + }, + "node_modules/typed-array-buffer": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz", + "integrity": "sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "es-errors": "^1.3.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/typed-array-byte-length": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.3.tgz", + "integrity": "sha512-BaXgOuIxz8n8pIq3e7Atg/7s+DpiYrxn4vdot3w9KbnBhcRQq6o3xemQdIfynqSeXeDrF32x+WvfzmOjPiY9lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.8", + "for-each": "^0.3.3", + "gopd": "^1.2.0", + "has-proto": "^1.2.0", + "is-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-byte-offset": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.5.tgz", + "integrity": "sha512-0FHJvLPqZ7KJzp17O13jfsAjsqazgrxBu2zEK95PmUz8lv2+GjRuxUInCr2Rk9Dms3ihN21zJ929ZO43yJ95QQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.9", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "is-typed-array": "^1.1.15", + "reflect.getprototypeof": "^1.0.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typed-array-length": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.8.tgz", + "integrity": "sha512-phPGCwqr2+Qo0fwniCE8e4pKnGu/yFb5nD5Y8bf0EEeiI5GklnACYA9GFy/DrAeRrKHXvHn+1SUsOWgJp6RO+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.9", + "for-each": "^0.3.5", + "gopd": "^1.2.0", + "is-typed-array": "^1.1.15", + "possible-typed-array-names": "^1.1.0", + "reflect.getprototypeof": "^1.0.10" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.71.2", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.71.2.tgz", + "integrity": "sha512-Rz4effbMy2g9wnvOJZG6SbVavX313Lap1vNEbk1RUochzickvzP8P4HB+bkNg5e50eVz1hQGjh9K1omI1xB4Bw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.71.2", + "@typescript-eslint/parser": "8.71.2", + "@typescript-eslint/typescript-estree": "8.71.2", + "@typescript-eslint/utils": "8.71.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.1.0.tgz", + "integrity": "sha512-nWJ91DjeOkej/TA8pXQ3myruKpKEYgqvpw9lz4OPHj/NWFNluYrjbz9j01CJ8yKQd2g4jFoOkINCTW2I5LEEyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.3", + "has-bigints": "^1.0.2", + "has-symbols": "^1.1.0", + "which-boxed-primitive": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/undici-types": { + "version": "7.24.6", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz", + "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==", + "dev": true, + "license": "MIT" + }, + "node_modules/unrs-resolver": { + "version": "1.12.2", + "resolved": "https://registry.npmjs.org/unrs-resolver/-/unrs-resolver-1.12.2.tgz", + "integrity": "sha512-dmlRxBJJayXjqTwC+JtF1HhJmgf3ftQ3YejFcZrf4+KKtJv0qDsK1pjqaaVjG7wJ5NJ6UVP1OqRMQ71Z4C3rxQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "napi-postinstall": "^0.3.4" + }, + "funding": { + "url": "https://opencollective.com/unrs-resolver" + }, + "optionalDependencies": { + "@unrs/resolver-binding-android-arm-eabi": "1.12.2", + "@unrs/resolver-binding-android-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-arm64": "1.12.2", + "@unrs/resolver-binding-darwin-x64": "1.12.2", + "@unrs/resolver-binding-freebsd-x64": "1.12.2", + "@unrs/resolver-binding-linux-arm-gnueabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm-musleabihf": "1.12.2", + "@unrs/resolver-binding-linux-arm64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-arm64-musl": "1.12.2", + "@unrs/resolver-binding-linux-loong64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-loong64-musl": "1.12.2", + "@unrs/resolver-binding-linux-ppc64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-riscv64-musl": "1.12.2", + "@unrs/resolver-binding-linux-s390x-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-gnu": "1.12.2", + "@unrs/resolver-binding-linux-x64-musl": "1.12.2", + "@unrs/resolver-binding-openharmony-arm64": "1.12.2", + "@unrs/resolver-binding-wasm32-wasi": "1.12.2", + "@unrs/resolver-binding-win32-arm64-msvc": "1.12.2", + "@unrs/resolver-binding-win32-ia32-msvc": "1.12.2", + "@unrs/resolver-binding-win32-x64-msvc": "1.12.2" + } + }, + "node_modules/update-browserslist-db": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz", + "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==", + "devOptional": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/uri-js-replace": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/uri-js-replace/-/uri-js-replace-1.0.1.tgz", + "integrity": "sha512-W+C9NWNLFOoBI2QWDp4UT9pv65r2w5Cx+3sTYFvtMdDBxkKt1syCqsUdSFAChbEe1uK5TfS04wt/nGwmaeIQ0g==", + "dev": true, + "license": "MIT" + }, + "node_modules/use-callback-ref": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/use-callback-ref/-/use-callback-ref-1.3.3.tgz", + "integrity": "sha512-jQL3lRnocaFtu3V00JToYz/4QkNWswxijDaCVNZRiRTO3HQDLsdu1ZtmIUvV4yPp+rvWm5j0y0TG/S61cuijTg==", + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-sidecar": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/use-sidecar/-/use-sidecar-1.1.3.tgz", + "integrity": "sha512-Fedw0aZvkhynoPYlA5WXrMCAMm+nSWdZt6lzJQ7Ok8S6Q+VsHmHpRWndVRJ8Be0ZbkfPc5LRYH+5XrzXcEeLRQ==", + "license": "MIT", + "dependencies": { + "detect-node-es": "^1.1.0", + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@types/react": "*", + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 || ^19.0.0-rc" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-sync-external-store": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.7.0.tgz", + "integrity": "sha512-6L+EeigHMQhdaIPNIFUKwfWJSwWFQ8gJbJ2DLOs5sDIegTwR9fRxvnM3uciHKjIZhFz+KAv2emhWMRvDmMcY8A==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/victory-vendor": { + "version": "37.3.6", + "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", + "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==", + "license": "MIT AND ISC", + "dependencies": { + "@types/d3-array": "^3.0.3", + "@types/d3-ease": "^3.0.0", + "@types/d3-interpolate": "^3.0.1", + "@types/d3-scale": "^4.0.2", + "@types/d3-shape": "^3.1.0", + "@types/d3-time": "^3.0.0", + "@types/d3-timer": "^3.0.0", + "d3-array": "^3.1.6", + "d3-ease": "^3.0.1", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-shape": "^3.1.0", + "d3-time": "^3.0.0", + "d3-timer": "^3.0.1" + } + }, + "node_modules/web-vitals": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-6.2.3.tgz", + "integrity": "sha512-Dmy+vdO1UPMqXiAtZSNayhl4f794Bxfd94W4HIj2HlYtczEQfEOon969memlcpcHrTuOKLa5baFjX7WbgmOq+A==", + "license": "Apache-2.0" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz", + "integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-bigint": "^1.1.0", + "is-boolean-object": "^1.2.1", + "is-number-object": "^1.1.1", + "is-string": "^1.1.1", + "is-symbol": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-builtin-type": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.2.1.tgz", + "integrity": "sha512-6iBczoX+kDQ7a3+YJBnh3T+KZRxM/iYNPXicqk66/Qfm1b93iu+yOImkg0zHbj5LNOcNv1TEADiZ0xa34B4q6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "function.prototype.name": "^1.1.6", + "has-tostringtag": "^1.0.2", + "is-async-function": "^2.0.0", + "is-date-object": "^1.1.0", + "is-finalizationregistry": "^1.1.0", + "is-generator-function": "^1.0.10", + "is-regex": "^1.2.1", + "is-weakref": "^1.0.2", + "isarray": "^2.0.5", + "which-boxed-primitive": "^1.1.0", + "which-collection": "^1.0.2", + "which-typed-array": "^1.1.16" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-collection": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", + "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-map": "^2.0.3", + "is-set": "^2.0.3", + "is-weakmap": "^2.0.2", + "is-weakset": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.24", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.24.tgz", + "integrity": "sha512-wk4Mf4pR5mRP7eYuuTBCIQ9d0ud2Fv2jRLQpfgnRjbOxAFHmjKFValgTpitVKzJJS8ajnYQV2Du1SZ8j6b/EUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.9", + "call-bound": "^1.0.4", + "for-each": "^0.3.5", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "devOptional": true, + "license": "ISC" + }, + "node_modules/yaml-ast-parser": { + "version": "0.0.43", + "resolved": "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz", + "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/zod": { + "version": "4.6.7", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz", + "integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-validation-error": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/zod-validation-error/-/zod-validation-error-4.0.2.tgz", + "integrity": "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.0.0" + }, + "peerDependencies": { + "zod": "^3.25.0 || ^4.0.0" + } + } + } +} diff --git a/apps/web/package.json b/apps/web/package.json new file mode 100644 index 0000000..56a8a22 --- /dev/null +++ b/apps/web/package.json @@ -0,0 +1,42 @@ +{ + "name": "@netcortex/web", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "eslint .", + "typecheck": "tsc --noEmit", + "test:e2e": "playwright test", + "test:e2e:live": "playwright test --config=playwright.live.config.ts", + "api:types": "node scripts/generate-openapi-types.mjs", + "format": "prettier --write **/*.{ts,tsx,js,mjs,json,css,md}", + "format:check": "prettier --check **/*.{ts,tsx,js,mjs,json,css,md}" + }, + "dependencies": { + "@radix-ui/react-dialog": "^1.3.1", + "@radix-ui/react-select": "^2.4.1", + "@sentry/nextjs": "^11.8.0", + "clsx": "^2.1.1", + "lucide-react": "^1.59.0", + "next": "^16.4.2", + "react": "^19.2.3", + "react-dom": "^19.2.3", + "recharts": "^3.10.1", + "tailwind-merge": "^3.7.0" + }, + "devDependencies": { + "@playwright/test": "^1.58.2", + "@tailwindcss/postcss": "^4.2.1", + "@types/node": "^25.3.0", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "eslint": "^9.39.2", + "eslint-config-next": "^16.4.2", + "openapi-typescript": "^7.13.0", + "prettier": "^3.9.10", + "tailwindcss": "^4.2.1", + "typescript": "^5.9.3" + } +} diff --git a/apps/web/playwright.config.ts b/apps/web/playwright.config.ts new file mode 100644 index 0000000..fa5a600 --- /dev/null +++ b/apps/web/playwright.config.ts @@ -0,0 +1,18 @@ +import { defineConfig, devices } from "@playwright/test"; +export default defineConfig({ + testDir: "./e2e", + testMatch: "dashboard.spec.ts", + fullyParallel: true, + reporter: "list", + use: { baseURL: "http://127.0.0.1:3000", trace: "retain-on-failure" }, + projects: [ + { name: "desktop", use: { ...devices["Desktop Chrome"] } }, + { name: "mobile", use: { ...devices["Pixel 7"] } }, + ], + webServer: { + command: "npm run dev -- --hostname 127.0.0.1", + url: "http://127.0.0.1:3000", + reuseExistingServer: !process.env.CI, + timeout: 120_000, + }, +}); diff --git a/apps/web/playwright.live.config.ts b/apps/web/playwright.live.config.ts new file mode 100644 index 0000000..cc32c8b --- /dev/null +++ b/apps/web/playwright.live.config.ts @@ -0,0 +1,22 @@ +import { defineConfig, devices } from "@playwright/test"; +export default defineConfig({ + testDir: "./e2e", + testMatch: "live-mode.spec.ts", + fullyParallel: false, + reporter: "list", + use: { + baseURL: "http://127.0.0.1:3001", + trace: "retain-on-failure", + ...devices["Desktop Chrome"], + }, + webServer: { + command: "npm run dev -- --hostname 127.0.0.1 --port 3001", + url: "http://127.0.0.1:3001", + reuseExistingServer: !process.env.CI, + timeout: 120_000, + env: { + NEXT_PUBLIC_API_MODE: "live", + NEXT_PUBLIC_API_BASE_URL: "http://127.0.0.1:3137", + }, + }, +}); diff --git a/apps/web/postcss.config.mjs b/apps/web/postcss.config.mjs new file mode 100644 index 0000000..d062fcd --- /dev/null +++ b/apps/web/postcss.config.mjs @@ -0,0 +1,2 @@ +const config = { plugins: { "@tailwindcss/postcss": {} } }; +export default config; diff --git a/apps/web/scripts/generate-openapi-types.mjs b/apps/web/scripts/generate-openapi-types.mjs new file mode 100644 index 0000000..8b298fe --- /dev/null +++ b/apps/web/scripts/generate-openapi-types.mjs @@ -0,0 +1,25 @@ +import { mkdir, writeFile } from "node:fs/promises"; +import path from "node:path"; +import openapiTS, { astToString } from "openapi-typescript"; + +const input = process.env.OPENAPI_URL; +if (!input) + throw new Error( + "Set OPENAPI_URL to Aun’s published OpenAPI JSON URL before generating API types.", + ); +const url = new URL(input); +if (!["http:", "https:"].includes(url.protocol)) + throw new Error("OPENAPI_URL must use HTTP or HTTPS."); + +const response = await fetch(url, { signal: AbortSignal.timeout(10_000) }); +if (!response.ok) + throw new Error(`OpenAPI download failed (${response.status}).`); +const schema = await response.json(); +if (!schema || typeof schema !== "object" || !("openapi" in schema)) + throw new Error("The response is not an OpenAPI document."); + +const ast = await openapiTS(schema); +const output = path.resolve("lib/generated/openapi.d.ts"); +await mkdir(path.dirname(output), { recursive: true }); +await writeFile(output, astToString(ast), "utf8"); +process.stdout.write(`Generated TypeScript from ${url} at ${output}\n`); diff --git a/apps/web/sentry.server.config.ts b/apps/web/sentry.server.config.ts new file mode 100644 index 0000000..4e4d7a7 --- /dev/null +++ b/apps/web/sentry.server.config.ts @@ -0,0 +1,3 @@ +import * as Sentry from "@sentry/nextjs"; +if (process.env.SENTRY_DSN) + Sentry.init({ dsn: process.env.SENTRY_DSN, tracesSampleRate: 0.1 }); diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json new file mode 100644 index 0000000..705f5ce --- /dev/null +++ b/apps/web/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "target": "ES2017", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "bundler", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "react-jsx", + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "@/*": ["./*"] + } + }, + "include": [ + "next-env.d.ts", + "**/*.ts", + "**/*.tsx", + ".next/types/**/*.ts", + ".next/dev/types/**/*.ts" + ], + "exclude": ["node_modules"] +} diff --git a/docs/progress/web_dashboard.md b/docs/progress/web_dashboard.md new file mode 100644 index 0000000..3d16ca7 --- /dev/null +++ b/docs/progress/web_dashboard.md @@ -0,0 +1,26 @@ +# Web dashboard handoff + +The B6 dashboard is implemented in `apps/web`. It includes responsive overview, incident list/detail, demo and read-only settings routes; a typed mock/live transport; guarded approval and rejection; replay-only scenario outcomes; optional Sentry initialization; and OpenAPI type generation that runs only when given a real schema URL. + +Validation from `apps/web`: + +- `npm run lint` — passed. +- `npm run typecheck` — passed. +- `npm run format:check` — passed. +- `npm run build` — passed with Next.js 16.4.2. +- `npm run test:e2e` — passed, 14 desktop/mobile tests. Covers the confirmation cancel path, duplicate approval clicks, failed CHR evidence blocking approval, rejection, notify-only uplink failure without a backup, simulated rollback, incident lookup failure, injection and responsive overview. +- `npm run test:e2e:live` — passed, 3 mocked-HTTP tests. Covers visible HTTP 503 without fixture fallback, named event deduplication and recovery refresh, EventSource cleanup, and decision POST acknowledgement followed by authoritative GET. +- `npm start -- --hostname 127.0.0.1 --port 3040` — verified the Render-compatible `next start` command; `/` and `/incidents` returned HTTP 200. + +Visual review screenshots (ignored by Git): + +- `C:\Users\nigga\Documents\NetCortex-web\apps\web\test-results\overview-desktop.png` +- `C:\Users\nigga\Documents\NetCortex-web\apps\web\test-results\overview-mobile.png` + +Integration still requires Aun's published OpenAPI schema and backend contract review, especially payload field mappings, metrics series semantics, SSE replay/heartbeat behavior, and voice media response. No API schema was available, so generated API types were not produced. Sentry is initialized only when a DSN is supplied; no DSN or Sentry MCP connection was available, so delivery is not verified. The root CI and Render service configuration remain parent-owned. + +Final topology correction: `apps/web/lib/fixtures.ts` subscriber counts and primary/backup capacities now match the canonical simulator source `data/sites.yaml` (North Tower 120 / 180 / 80 Mbps; Market Cafe 48 / 100 / no backup; East Relay 165 / 250 / 100 Mbps). Health, utilization, latency and loss remain illustrative replay values. The overview browser case asserts the subscriber and primary-capacity values on desktop and mobile; it passed again alongside lint, typecheck and format checks. Screenshots at the paths above were refreshed. No dashboard test server remained listening on ports 3000 or 3001 after the targeted run. + +## Dependency audit review + +`npm audit` reports five high entries but only one underlying advisory: GHSA-vfj7-8cjw-p6xm in `braces@3.0.3`, reached through the development-only lint chain `eslint-config-next@16.4.2` → `@next/eslint-plugin-next@16.4.2` → `fast-glob@3.3.1` → `micromatch@4.0.8` → `braces@3.0.3`. The advisory describes process-crashing stack exhaustion for deeply nested brace patterns and lists no patched release. `npm view braces versions` confirms 3.0.3 is the latest published release. `npm audit fix --dry-run` proposes downgrading `eslint-config-next` to 14.2.35, a breaking mismatch for Next.js 16, so no dependency override or blind downgrade was applied. `npm audit --omit=dev` reports zero vulnerabilities. Recheck when the advisory gains a patch or the compatible Next lint chain removes `braces`. References: [GitHub advisory](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm), [upstream issue](https://github.com/micromatch/braces/issues/84). From e0a6e254d5fe7e4bb34ebeedb8d83d1b1b86a508 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:19:30 +0500 Subject: [PATCH 05/21] ci: validate workspace and boot a pinned isolated RouterOS CHR --- .github/admin-setup.md | 10 + .github/copilot-instructions.md | 10 + .github/decision.md | 25 ++ .github/flow.md | 21 ++ .github/scripts/chr_bootstrap.py | 440 ++++++++++++++++++++++++++++ .github/tests/test_chr_bootstrap.py | 247 ++++++++++++++++ .github/workflows/chr-templates.yml | 120 ++++++++ .github/workflows/ci.yml | 60 ++-- infra/render/README.md | 18 ++ infra/render/decision.md | 7 + infra/render/flow.md | 10 + 11 files changed, 942 insertions(+), 26 deletions(-) create mode 100644 .github/admin-setup.md create mode 100644 .github/copilot-instructions.md create mode 100644 .github/decision.md create mode 100644 .github/flow.md create mode 100644 .github/scripts/chr_bootstrap.py create mode 100644 .github/tests/test_chr_bootstrap.py create mode 100644 .github/workflows/chr-templates.yml create mode 100644 infra/render/README.md create mode 100644 infra/render/decision.md create mode 100644 infra/render/flow.md diff --git a/.github/admin-setup.md b/.github/admin-setup.md new file mode 100644 index 0000000..9082312 --- /dev/null +++ b/.github/admin-setup.md @@ -0,0 +1,10 @@ +# GitHub repository owner setup + +This repository contains CI workflows and Copilot review instructions. A workflow cannot enable Copilot automatic reviews by itself. + +1. Confirm the repository is eligible for Copilot code review under the account's current plan and policies. +2. A repository administrator can configure repository-level automatic review under **Settings → Copilot → Code review**, if organization/enterprise policy allows it. Organization owners may instead configure a ruleset that automatically requests Copilot review for targeted repositories. +3. Decide whether new pushes and draft pull requests should be reviewed automatically. Check billing/credit implications and current plan terms before enabling them. +4. Open a test pull request and verify that Copilot appears as a reviewer and posts a review. Until an owner confirms this, describe Copilot review as a setup task, not an enabled feature. + +See GitHub's current [Copilot code review configuration guide](https://docs.github.com/en/copilot/how-tos/copilot-on-github/set-up-copilot/configure-code-review) and [review usage guide](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-code-review). diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..5026840 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,10 @@ +# NetCortex pull request review guidance + +- Check that code stays within the owner's folders and does not clone or redefine Aun's schemas, Settings, API, SSE events, Temporal workflows, or router harness. +- For every network call, verify a finite timeout, bounded response handling, and explicit failure behavior. A fallback must not imply successful model inference, provider lookup, or router validation. +- Verify telemetry units, timestamps, source labels, subscriber privacy, forecast keys, and injection behavior against approved shared contracts. Flag guessed fields as unresolved rather than treating them as correct. +- For model and provider changes, check that offline tests cover failures and do not call real services. +- For router changes, distinguish fake/offline unit coverage from CHR integration. Only `infra/chr/test_templates.py` running on the isolated router counts as real template validation. +- Inspect template parameter validation and rollback behavior. Do not treat a successful REST status alone as proof a change was applied or improved service. +- Check that secrets, router passwords, subscriber identifiers, raw RIPE downloads, generated Parquet, and logs containing credentials are not committed or exposed to browser bundles. +- Look for concrete test evidence and accurate status claims. Do not approve documentation that claims a first user, measured results, paid/free eligibility, or a live deployment without evidence. diff --git a/.github/decision.md b/.github/decision.md new file mode 100644 index 0000000..9227ef4 --- /dev/null +++ b/.github/decision.md @@ -0,0 +1,25 @@ +# CI and router integration decisions + +## CI scope + +GitHub Actions runs Python lint and offline tests on the locked workspace, plus the web app's required lint, typecheck, production build, and Playwright suite once `apps/web/package.json` exists. The web job may show a clearly labeled pending state before the app exists. Once it exists, missing lockfile, required scripts, Playwright config, or `@playwright/test` fails the job. + +The root Python environment is installed with `uv sync --all-packages --locked`. This keeps workspace packages importable in tests and ensures CI does not silently resolve different dependencies from the reviewed lock. + +## CHR selection and provenance + +The router workflow pins the official x86 CHR artifact to RouterOS 7.24.5, rather than resolving the moving `stable` channel during each run. The official `NEWESTa7.stable` endpoint returned `7.24.5 1790691687` on 2026-10-18. The downloaded official `chr-7.24.5.img.zip` was 45,293,979 bytes and its SHA-256 is `16f07222a3213352c9c4fbea4f4dec6a8ffb78fdc0fa5e398c23103ed357c6eb`. + +The helper uses QEMU directly because CI needs an isolated RouterOS instance with the real REST API and a writable disk for testing apply/read-back/rollback. It chooses KVM only when `/dev/kvm` is writable and otherwise uses TCG. The router is exposed through host forwarding bound to `127.0.0.1` for REST and SSH; the serial console stays on a Unix socket. This keeps the test router off public and shared network interfaces. + +Provisioning handles the first-login license flow by answering `n` to the optional software-license display prompt, sending Enter at its continuation prompt, and answering `y` only when RouterOS asks to agree to the license terms. Each prompt is handled once within the bounded serial provisioning deadline. The first serial read uses the remaining deadline rather than a shorter per-read cap because TCG startup may take longer than 20 seconds before the login prompt appears. It creates a random per-run admin password through the serial console and enables `www` with `rest-plain=yes`. MikroTik's [IP services reference](https://help.mikrotik.com/docs/spaces/ROS/pages/103841820/Services) documents `rest-plain` as the REST API support property for HTTP `www`. The helper fails on CLI error text rather than treating a returned prompt as proof the command worked. It emits the GitHub Actions secret mask before sending the generated password, writes the credential to later steps through `GITHUB_ENV`, and stores redacted serial transcript diagnostics on provisioning failure. The readiness gate makes two consecutive authenticated calls to `/rest/system/resource` and requires the expected single resource object with a `board-name` field. A bare HTTP 200 is insufficient evidence that RouterOS REST is ready. + +## External router test gate + +The bootstrap, router lifecycle, QEMU command, credential handling, license/password prompts, CLI error handling, and response-shape checks are B-owned and tested offline with fake console/process/network responses. `infra/chr/test_templates.py` is Aun-owned. When it is absent, a separate smoke job boots CHR and verifies authenticated REST readiness, while the real template job remains skipped with a pending summary. Unit tests and boot smoke do not count as template/router integration tests. + +The workflow retains `/tmp/netcortex-chr/qemu.log` as an artifact and cleanup validates both the recorded PID and its QEMU command line before signaling it. The disk and log remain in the runner temp directory until the job is discarded; no downloaded router image is committed. + +## Copilot review + +Repository instructions can shape Copilot's review, but automatic review still requires repository/organization admin configuration and a qualifying Copilot plan. See [admin-setup.md](admin-setup.md). The repository does not claim Copilot review is enabled until an owner verifies the setting in GitHub. diff --git a/.github/flow.md b/.github/flow.md new file mode 100644 index 0000000..3dca2a5 --- /dev/null +++ b/.github/flow.md @@ -0,0 +1,21 @@ +# CI entry and exit flow + +## Normal pull request + +**Entry:** a push to `main` or a `b/**` branch, any pull request, or manual `workflow_dispatch` starts `.github/workflows/ci.yml`. + +1. The Python job installs Python 3.12 and the complete locked uv workspace. It runs Ruff and pytest, including B's offline CHR bootstrap tests. +2. The web job checks whether `apps/web/package.json` exists. Before the app lands, it writes a pending note and exits without claiming web coverage. After the app exists, it requires the lockfile, lint/typecheck/build/e2e scripts, Playwright config, and Playwright dependency; then it runs `npm ci`, those four checks, and Chromium Playwright tests. +3. Jobs exit green only when their applicable checks pass. A missing integrated web app is reported as pending in the job summary. + +## CHR template pull request + +**Entry:** changes to RouterOS templates/fixes, Aun's harness, this bootstrap helper, its workflow, or a manual dispatch start `.github/workflows/chr-templates.yml`. + +1. Readiness checks only for Aun's `infra/chr/test_templates.py`. +2. If missing, the template job is skipped and the summary says no CHR/template tests ran. A separate smoke job installs QEMU/the locked workspace, tests B's offline lifecycle code, and boots/provisions the pinned router. +3. If present, only the real template job runs; it installs QEMU/the locked workspace and boots/provisions one router before invoking Aun's harness. The smoke job stays skipped to avoid a duplicate boot. +4. Bootstrap downloads and verifies the pinned image, starts QEMU, skips the optional license text display, presses Enter at the continuation prompt, agrees only at the terms prompt, provisions a random admin password over its serial socket, enables REST support, and verifies the authenticated REST resource twice. It masks the password before provisioning and exposes `CHR_REST_URL`, `CHR_REST_USERNAME`, and `CHR_REST_PASSWORD` only to subsequent steps through `GITHUB_ENV`. +5. The real template job runs Aun's harness against `http://127.0.0.1:9180/rest`. On every outcome, the active router job uploads QEMU and sanitized serial logs when available and asks the helper to stop only its own verified QEMU process. + +**Exit:** actual template coverage is reported only when Aun's harness ran. Bootstrap unit tests, boot smoke, job setup, and a missing-harness skip do not count as an actual router/template test pass. diff --git a/.github/scripts/chr_bootstrap.py b/.github/scripts/chr_bootstrap.py new file mode 100644 index 0000000..bd47298 --- /dev/null +++ b/.github/scripts/chr_bootstrap.py @@ -0,0 +1,440 @@ +#!/usr/bin/env python3 +"""Download, boot, provision, and validate the pinned CHR used by CI.""" + +from __future__ import annotations + +import argparse +import hashlib +import http.client +import json +import os +import platform +import re +import secrets +import shutil +import signal +import socket +import subprocess +import sys +import time +import urllib.error +import urllib.request +import zipfile +from collections.abc import Callable +from pathlib import Path + +VERSION = "7.24.5" +IMAGE_URL = f"https://download.mikrotik.com/routeros/{VERSION}/chr-{VERSION}.img.zip" +IMAGE_SHA256 = "16f07222a3213352c9c4fbea4f4dec6a8ffb78fdc0fa5e398c23103ed357c6eb" +WORK_DIR = Path("/tmp/netcortex-chr") +IMAGE_ZIP = WORK_DIR / f"chr-{VERSION}.img.zip" +IMAGE = WORK_DIR / f"chr-{VERSION}.img" +PID_FILE = WORK_DIR / "qemu.pid" +LOG_FILE = WORK_DIR / "qemu.log" +SERIAL_LOG_FILE = WORK_DIR / "serial.log" +CONSOLE_SOCKET = WORK_DIR / "serial.sock" +REST_URL = "http://127.0.0.1:9180/rest" +ANSI_ESCAPE = re.compile(r"\x1b(?:\[[0-?]*[ -/]*[@-~]|\][^\x07]*(?:\x07|\x1b\\))") +MAX_DOWNLOAD_BYTES = 128 * 1024 * 1024 +DOWNLOAD_TIMEOUT_SECONDS = 180 +BOOT_TIMEOUT_SECONDS = 360 + + +class BootstrapError(RuntimeError): + """Raised when the isolated CHR cannot be prepared safely.""" + + +def sha256_file(path: Path) -> str: + digest = hashlib.sha256() + with path.open("rb") as handle: + for chunk in iter(lambda: handle.read(1024 * 1024), b""): + digest.update(chunk) + return digest.hexdigest() + + +def verify_image(path: Path, expected: str = IMAGE_SHA256) -> None: + if not re.fullmatch(r"[0-9a-f]{64}", expected): + raise BootstrapError("CHR image SHA-256 pin is not finalized") + actual = sha256_file(path) + if not secrets.compare_digest(actual, expected): + raise BootstrapError(f"CHR image digest mismatch: got {actual}") + + +def download_image(destination: Path = IMAGE_ZIP) -> None: + destination.parent.mkdir(parents=True, exist_ok=True) + if destination.exists(): + verify_image(destination) + return + request = urllib.request.Request(IMAGE_URL, headers={"User-Agent": "NetCortex-CI/1.0"}) + temporary = destination.with_suffix(destination.suffix + ".part") + try: + deadline = time.monotonic() + DOWNLOAD_TIMEOUT_SECONDS + with urllib.request.urlopen(request, timeout=15) as response: + declared_size = response.headers.get("Content-Length") + if declared_size and int(declared_size) > MAX_DOWNLOAD_BYTES: + raise BootstrapError("CHR artifact exceeds the configured size limit") + digest = hashlib.sha256() + size = 0 + with temporary.open("wb") as output: + while True: + if time.monotonic() >= deadline: + raise BootstrapError("CHR image download exceeded its finite time budget") + chunk = response.read(1024 * 1024) + if not chunk: + break + size += len(chunk) + if size > MAX_DOWNLOAD_BYTES: + raise BootstrapError("CHR artifact exceeds the configured size limit") + digest.update(chunk) + output.write(chunk) + if not secrets.compare_digest(digest.hexdigest(), IMAGE_SHA256): + raise BootstrapError(f"CHR image digest mismatch: got {digest.hexdigest()}") + temporary.replace(destination) + except (OSError, urllib.error.URLError, http.client.HTTPException) as exc: + raise BootstrapError(f"Unable to download pinned CHR image: {exc}") from exc + finally: + temporary.unlink(missing_ok=True) + + +def extract_image(archive: Path = IMAGE_ZIP, destination: Path = IMAGE) -> Path: + verify_image(archive) + destination.parent.mkdir(parents=True, exist_ok=True) + with zipfile.ZipFile(archive) as bundle: + candidates = [item for item in bundle.infolist() if item.filename.endswith(".img")] + if len(candidates) != 1: + raise BootstrapError("Pinned CHR zip must contain exactly one .img file") + candidate = candidates[0] + if candidate.file_size > 512 * 1024 * 1024: + raise BootstrapError("CHR disk image exceeds the configured size limit") + with bundle.open(candidate) as source, destination.open("wb") as output: + shutil.copyfileobj(source, output, 1024 * 1024) + return destination + + +def acceleration(kvm_path: Path = Path("/dev/kvm")) -> list[str]: + if platform.system() == "Linux" and kvm_path.exists() and os.access(kvm_path, os.W_OK): + return ["-accel", "kvm", "-cpu", "host"] + return ["-accel", "tcg,tb-size=256"] + + +def qemu_command(image: Path, qemu: str = "qemu-system-x86_64") -> list[str]: + return [ + qemu, + "-M", + "q35", + "-m", + "256", + "-smp", + "1", + *acceleration(), + "-drive", + f"file={image},format=raw,if=virtio", + "-netdev", + "user,id=net0,hostfwd=tcp:127.0.0.1:9180-:80,hostfwd=tcp:127.0.0.1:9122-:22", + "-device", + "virtio-net-pci,netdev=net0", + "-display", + "none", + "-chardev", + f"socket,id=serial0,path={CONSOLE_SOCKET},server=on,wait=off", + "-serial", + "chardev:serial0", + "-monitor", + "none", + "-no-reboot", + ] + + +def is_owned_qemu_command(command: str, image: Path = IMAGE) -> bool: + return "qemu-system-x86_64" in command and str(image) in command + + +def _recv_until( + stream: socket.socket, + patterns: list[tuple[str, re.Pattern[str]]], + timeout: float, + transcript: list[str], +) -> str: + deadline = time.monotonic() + timeout + buffer = "" + while time.monotonic() < deadline: + stream.settimeout(min(1.0, max(0.1, deadline - time.monotonic()))) + try: + chunk = stream.recv(4096) + except TimeoutError: + continue + if not chunk: + continue + decoded = ANSI_ESCAPE.sub("", chunk.decode("utf-8", errors="replace")) + buffer += decoded + transcript.append(decoded) + for label, pattern in patterns: + if pattern.search(buffer): + return label + if len(buffer) > 16000: + buffer = buffer[-8000:] + raise BootstrapError("Timed out waiting for RouterOS serial prompt") + + +def _send_line(stream: socket.socket, line: str) -> None: + stream.sendall(line.encode("utf-8") + b"\r\n") + + +def provision_console(password: str, timeout: int = 120) -> None: + """Set the first-login admin password and enable HTTP REST for loopback CI.""" + deadline = time.monotonic() + timeout + transcript: list[str] = [] + patterns = [ + ( + "command_error", + re.compile(r"(?:bad command name|expected end of command|syntax error|failure:)", re.I), + ), + ( + "license_display", + re.compile(r"do you want to see.*software license.*\[y/n\]\s*:?", re.I), + ), + ( + "license_continue", + re.compile(r"press (?:the )?enter to continue\s*:?", re.I), + ), + ( + "license_agreement", + re.compile( + r"(?:do you agree.*(?:\[y/n\]|yes/no)|" + r"(?:license|licence).*(?:accept|agree).*(?:\[y/n\]|yes/no))", + re.I, + ), + ), + ("login", re.compile(r"login:\s*$", re.I | re.M)), + ("repeat_password", re.compile(r"repeat(?:\s+new)? password:?\s*>?\s*$", re.I | re.M)), + ("new_password", re.compile(r"new password:?\s*>?\s*$", re.I | re.M)), + ("current_password", re.compile(r"current password:?\s*>?\s*$", re.I | re.M)), + ("password", re.compile(r"(?:^|\n)password:\s*$", re.I | re.M)), + ("prompt", re.compile(r"\[[^\]]+\]\s*(?:/[^\r\n]*)?[>#]\s*$", re.M)), + ] + try: + while time.monotonic() < deadline: + try: + stream = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + stream.settimeout(1) + stream.connect(str(CONSOLE_SOCKET)) + break + except (FileNotFoundError, ConnectionRefusedError, TimeoutError, OSError): + stream.close() + time.sleep(0.25) + else: + raise BootstrapError("RouterOS serial console socket did not appear") + + with stream: + logged_in = False + sent_login = False + sent_blank_password = False + sent_old_password = False + sent_new_password = False + sent_repeat_password = False + requested_password_change = False + sent_license_display = False + sent_license_continue = False + sent_license_accept = False + while time.monotonic() < deadline: + remaining = max(1, int(deadline - time.monotonic())) + # TCG can take longer than 20 seconds to reach the first login prompt. + # Keep waiting, but never extend beyond the caller's overall deadline. + prompt = _recv_until(stream, patterns, remaining, transcript) + if prompt == "command_error": + raise BootstrapError("RouterOS rejected a serial provisioning command") + if prompt == "license_display" and not sent_license_display: + _send_line(stream, "n") + sent_license_display = True + elif prompt == "license_continue" and not sent_license_continue: + _send_line(stream, "") + sent_license_continue = True + elif prompt == "license_agreement" and not sent_license_accept: + _send_line(stream, "y") + sent_license_accept = True + elif prompt == "login" and not sent_login: + _send_line(stream, "admin") + sent_login = True + elif prompt == "password" and not sent_blank_password: + _send_line(stream, "") + sent_blank_password = True + elif prompt == "current_password" and not sent_old_password: + _send_line(stream, "") + sent_old_password = True + elif prompt == "new_password" and not sent_new_password: + _send_line(stream, password) + sent_new_password = True + elif prompt == "repeat_password" and not sent_repeat_password: + _send_line(stream, password) + sent_repeat_password = True + elif prompt == "prompt": + if sent_repeat_password: + logged_in = True + break + if sent_new_password: + raise BootstrapError( + "RouterOS returned to the prompt before password confirmation" + ) + if not requested_password_change: + _send_line(stream, "/password") + requested_password_change = True + continue + raise BootstrapError("RouterOS did not request a new admin password") + elif prompt == "login" and sent_login: + raise BootstrapError("RouterOS rejected initial console login") + if not logged_in: + raise BootstrapError("RouterOS serial login/provisioning timed out") + + for command in ("/ip service set [find name=www] disabled=no rest-plain=yes",): + _send_line(stream, command) + outcome = _recv_until(stream, patterns[:1] + [patterns[-1]], 15, transcript) + if outcome == "command_error": + raise BootstrapError("RouterOS rejected the www REST service configuration") + except BootstrapError: + _write_serial_diagnostics(transcript, password) + raise + except OSError as exc: + _write_serial_diagnostics(transcript, password) + raise BootstrapError(f"RouterOS serial console failed ({type(exc).__name__})") from exc + + +def _write_serial_diagnostics(transcript: list[str], secret: str) -> None: + SERIAL_LOG_FILE.parent.mkdir(parents=True, exist_ok=True) + sanitized = "".join(transcript).replace(secret, "[REDACTED]") + SERIAL_LOG_FILE.write_text(sanitized, encoding="utf-8") + + +def _authenticated_resource(url: str, username: str, password: str, timeout: float = 3.0) -> bool: + request = urllib.request.Request(url, headers={"Accept": "application/json"}) + token = (username + ":" + password).encode("utf-8") + import base64 + + request.add_header("Authorization", "Basic " + base64.b64encode(token).decode("ascii")) + try: + with urllib.request.urlopen(request, timeout=timeout) as response: + if response.status != 200: + return False + body = json.loads(response.read(256 * 1024)) + except (OSError, urllib.error.URLError, TimeoutError, json.JSONDecodeError): + return False + return ( + isinstance(body, dict) + and isinstance(body.get("board-name"), str) + and bool(body["board-name"]) + ) + + +def wait_for_rest( + username: str, + password: str, + timeout: int = BOOT_TIMEOUT_SECONDS, + probe: Callable[[str, str, str], bool] = _authenticated_resource, +) -> None: + deadline = time.monotonic() + timeout + consecutive = 0 + while time.monotonic() < deadline: + if probe(REST_URL + "/system/resource", username, password): + consecutive += 1 + if consecutive == 2: + return + else: + consecutive = 0 + time.sleep(2) + raise BootstrapError("CHR REST did not return two consecutive authenticated resource objects") + + +def _write_github_env(password: str) -> None: + env_path = os.environ.get("GITHUB_ENV") + if not env_path: + return + with Path(env_path).open("a", encoding="utf-8") as output: + output.write("CHR_REST_URL=" + REST_URL + "\n") + output.write("CHR_REST_USERNAME=admin\n") + output.write("CHR_REST_PASSWORD=" + password + "\n") + + +def _mask_github_secret(password: str) -> None: + if os.environ.get("GITHUB_ACTIONS") == "true": + print(f"::add-mask::{password}", flush=True) + + +def start() -> None: + if platform.system() != "Linux": + raise BootstrapError("CHR bootstrap currently requires a Linux runner") + WORK_DIR.mkdir(parents=True, exist_ok=True) + if PID_FILE.exists(): + cleanup() + download_image() + extract_image() + qemu = shutil.which("qemu-system-x86_64") + if not qemu: + raise BootstrapError("qemu-system-x86_64 is required; install qemu-system-x86") + LOG_FILE.parent.mkdir(parents=True, exist_ok=True) + log = LOG_FILE.open("ab", buffering=0) + process = subprocess.Popen( + qemu_command(IMAGE, qemu), + stdin=subprocess.DEVNULL, + stdout=log, + stderr=subprocess.STDOUT, + start_new_session=True, + ) + PID_FILE.write_text(str(process.pid), encoding="ascii") + password = secrets.token_urlsafe(32) + _mask_github_secret(password) + try: + provision_console(password) + wait_for_rest("admin", password) + _write_github_env(password) + print("CHR authenticated REST endpoint is ready at " + REST_URL) + except Exception: + cleanup() + raise + + +def cleanup() -> None: + if not PID_FILE.exists(): + return + try: + pid = int(PID_FILE.read_text(encoding="ascii").strip()) + except (ValueError, OSError): + PID_FILE.unlink(missing_ok=True) + raise BootstrapError("Refusing cleanup: invalid CHR PID file") from None + if pid <= 1: + raise BootstrapError("Refusing cleanup: unsafe CHR PID") + cmdline = Path(f"/proc/{pid}/cmdline") + if not cmdline.exists(): + PID_FILE.unlink(missing_ok=True) + return + command = cmdline.read_bytes().replace(b"\0", b" ").decode("utf-8", errors="replace") + if not is_owned_qemu_command(command): + raise BootstrapError("Refusing cleanup: PID does not match the owned CHR QEMU command") + os.kill(pid, signal.SIGTERM) + deadline = time.monotonic() + 10 + while time.monotonic() < deadline: + if not cmdline.exists(): + break + time.sleep(0.2) + else: + os.kill(pid, signal.SIGKILL) + PID_FILE.unlink(missing_ok=True) + CONSOLE_SOCKET.unlink(missing_ok=True) + + +def main() -> int: + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("action", choices=("start", "cleanup")) + args = parser.parse_args() + try: + if args.action == "start": + start() + else: + cleanup() + except BootstrapError as exc: + print(f"CHR bootstrap error: {exc}", file=sys.stderr) + print(f"Diagnostics retained at {LOG_FILE} and {SERIAL_LOG_FILE}", file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/tests/test_chr_bootstrap.py b/.github/tests/test_chr_bootstrap.py new file mode 100644 index 0000000..4ad4b4a --- /dev/null +++ b/.github/tests/test_chr_bootstrap.py @@ -0,0 +1,247 @@ +"""Offline tests for CHR lifecycle safety; these do not start a router.""" + +from __future__ import annotations + +import importlib.util +import json +import tempfile +import unittest +from pathlib import Path +from unittest.mock import patch + +MODULE_PATH = Path(__file__).parents[1] / "scripts" / "chr_bootstrap.py" +SPEC = importlib.util.spec_from_file_location("chr_bootstrap", MODULE_PATH) +assert SPEC and SPEC.loader +chr = importlib.util.module_from_spec(SPEC) +SPEC.loader.exec_module(chr) + + +class FakeConsole: + def __init__( + self, + *, + automatic_password: bool = False, + license_prompt: bool = False, + license_display: bool = False, + echo_secret: bool = False, + ) -> None: + self.buffer = ( + b"Do you want to see the software license? [Y/n]:\n" + if license_display + else b"Do you agree to the terms of this license? [Y/n]:\n" + if license_prompt + else b"login:\n" + ) + self.sent: list[str] = [] + self.closed = False + self.secret_count = 0 + self.automatic_password = automatic_password + self.license_prompt = license_prompt + self.license_display = license_display + self.display_skipped = False + self.echo_secret = echo_secret + self.reject_service_command = False + + def settimeout(self, _timeout: float) -> None: + pass + + def connect(self, _path: str) -> None: + pass + + def recv(self, _size: int) -> bytes: + result, self.buffer = self.buffer, b"" + return result + + def sendall(self, data: bytes) -> None: + value = data.decode().strip("\r\n") + self.sent.append(value) + prompts = { + "admin": b"password:\n", + "/password": b"current password:\n", + "/ip service set [find name=www] disabled=no rest-plain=yes": ( + b"bad command name\n[admin@MikroTik] >\n" + if self.reject_service_command + else b"[admin@MikroTik] >\n" + ), + } + if value.lower() == "n" and self.license_display: + self.display_skipped = True + self.buffer = b"Press Enter to continue\n" + elif value == "" and self.display_skipped: + self.display_skipped = False + self.buffer = b"Do you agree to the terms of this license? [Y/n]:\n" + self.license_prompt = True + elif value.lower() == "y" and self.license_prompt: + self.buffer = b"login:\n" + elif value == "" and self.sent.count("") == 1 and self.automatic_password: + self.buffer = b"new password:\n" + elif value == "" and self.sent.count("") == 1: + self.buffer = b"[admin@MikroTik] >\n" + elif value == "" and self.sent.count("") == 2: + self.buffer = b"new password:\n" + elif value == "test-secret": + self.secret_count += 1 + prompt = ( + b"repeat new password:\n" if self.secret_count == 1 else b"[admin@MikroTik] >\n" + ) + self.buffer = (b"test-secret\r\n" if self.echo_secret else b"") + prompt + else: + self.buffer = prompts.get(value, b"") + + def close(self) -> None: + self.closed = True + + def __enter__(self) -> FakeConsole: + return self + + def __exit__(self, *_args: object) -> None: + self.close() + + +class FakeRESTResponse: + status = 200 + + def __enter__(self) -> FakeRESTResponse: + return self + + def __exit__(self, *_args: object) -> None: + pass + + def read(self, _limit: int) -> bytes: + return json.dumps({"board-name": "CHR", "version": chr.VERSION}).encode() + + +class BootstrapTests(unittest.TestCase): + def test_serial_prompt_matching_strips_ansi_colors(self) -> None: + class ColoredPrompt: + def settimeout(self, _timeout: float) -> None: + pass + + def recv(self, _size: int) -> bytes: + return b"\x1b[32m[admin@MikroTik] >\x1b[0m\r\n" + + self.assertEqual( + chr._recv_until( + ColoredPrompt(), + [("prompt", chr.re.compile(r"\[[^\]]+\]\s*(?:/[^\r\n]*)?[>#]\s*$", chr.re.M))], + timeout=1, + transcript=[], + ), + "prompt", + ) + + def test_release_is_pinned_to_official_versioned_url(self) -> None: + self.assertEqual(chr.VERSION, "7.24.5") + self.assertEqual( + chr.IMAGE_URL, + "https://download.mikrotik.com/routeros/7.24.5/chr-7.24.5.img.zip", + ) + + def test_qemu_only_exposes_management_ports_on_loopback_and_has_serial(self) -> None: + command = chr.qemu_command(Path("/tmp/netcortex-chr/disk.img"), "qemu") + joined = " ".join(command) + self.assertIn("hostfwd=tcp:127.0.0.1:9180-:80", joined) + self.assertIn("hostfwd=tcp:127.0.0.1:9122-:22", joined) + self.assertIn("server=on,wait=off", joined) + self.assertIn("-monitor none", joined) + + def test_provision_sets_new_admin_password_and_enables_rest(self) -> None: + fake = FakeConsole() + with ( + patch.object(chr.socket, "AF_UNIX", 1, create=True), + patch.object(chr.socket, "socket", return_value=fake), + patch.object(chr.time, "sleep"), + ): + chr.provision_console("test-secret", timeout=10) + self.assertIn("admin", fake.sent) + self.assertIn("/password", fake.sent) + self.assertIn("test-secret", fake.sent) + self.assertIn("/ip service set [find name=www] disabled=no rest-plain=yes", fake.sent) + + def test_provision_handles_first_login_password_and_license_prompts(self) -> None: + fake = FakeConsole(automatic_password=True, license_prompt=True) + with ( + patch.object(chr.socket, "AF_UNIX", 1, create=True), + patch.object(chr.socket, "socket", return_value=fake), + patch.object(chr.time, "sleep"), + ): + chr.provision_console("test-secret", timeout=10) + self.assertIn("y", fake.sent) + self.assertNotIn("/password", fake.sent) + self.assertEqual(fake.sent.count("test-secret"), 2) + + def test_license_display_is_skipped_then_terms_are_accepted(self) -> None: + fake = FakeConsole(automatic_password=True, license_display=True) + with ( + patch.object(chr.socket, "AF_UNIX", 1, create=True), + patch.object(chr.socket, "socket", return_value=fake), + patch.object(chr.time, "sleep"), + ): + chr.provision_console("test-secret", timeout=10) + self.assertEqual(fake.sent[:3], ["n", "", "y"]) + self.assertEqual(fake.sent.count("test-secret"), 2) + + def test_provision_fails_when_router_rejects_rest_configuration(self) -> None: + fake = FakeConsole(echo_secret=True) + fake.reject_service_command = True + with tempfile.TemporaryDirectory() as temp: + diagnostic = Path(temp) / "serial.log" + with ( + patch.object(chr, "SERIAL_LOG_FILE", diagnostic), + patch.object(chr.socket, "AF_UNIX", 1, create=True), + patch.object(chr.socket, "socket", return_value=fake), + patch.object(chr.time, "sleep"), + self.assertRaises(chr.BootstrapError), + ): + chr.provision_console("test-secret", timeout=10) + self.assertNotIn("test-secret", diagnostic.read_text(encoding="utf-8")) + self.assertIn("[REDACTED]", diagnostic.read_text(encoding="utf-8")) + + def test_github_secret_mask_is_emitted_before_it_is_shared(self) -> None: + with ( + patch.dict(chr.os.environ, {"GITHUB_ACTIONS": "true"}), + patch("builtins.print") as output, + ): + chr._mask_github_secret("random-password") + output.assert_called_once_with("::add-mask::random-password", flush=True) + + def test_rest_shape_must_be_single_resource_object(self) -> None: + with patch.object(chr.urllib.request, "urlopen", return_value=FakeRESTResponse()): + self.assertTrue( + chr._authenticated_resource(chr.REST_URL + "/system/resource", "admin", "x") + ) + + class WrongShape(FakeRESTResponse): + def read(self, _limit: int) -> bytes: + return b'[{"board-name":"CHR"}]' + + with patch.object(chr.urllib.request, "urlopen", return_value=WrongShape()): + self.assertFalse( + chr._authenticated_resource(chr.REST_URL + "/system/resource", "admin", "x") + ) + + def test_ready_requires_two_consecutive_resource_probes(self) -> None: + probes = iter([True, False, True, True]) + with patch.object(chr.time, "sleep"): + chr.wait_for_rest("admin", "secret", timeout=5, probe=lambda *_args: next(probes)) + self.assertEqual(list(probes), []) + + def test_cleanup_refuses_unowned_pid(self) -> None: + with tempfile.TemporaryDirectory() as temp: + pid_file = Path(temp) / "qemu.pid" + pid_file.write_text("999999999", encoding="ascii") + with patch.object(chr, "PID_FILE", pid_file): + chr.cleanup() + self.assertFalse(pid_file.exists()) + + def test_process_ownership_requires_qemu_and_owned_disk(self) -> None: + image = Path("/tmp/netcortex-chr/chr-7.24.5.img") + self.assertTrue(chr.is_owned_qemu_command(f"qemu-system-x86_64 -drive {image}", image)) + self.assertFalse(chr.is_owned_qemu_command("python worker.py", image)) + self.assertFalse( + chr.is_owned_qemu_command("qemu-system-x86_64 -drive /tmp/other.img", image) + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/.github/workflows/chr-templates.yml b/.github/workflows/chr-templates.yml new file mode 100644 index 0000000..472caa9 --- /dev/null +++ b/.github/workflows/chr-templates.yml @@ -0,0 +1,120 @@ +name: CHR template integration + +on: + push: + branches: ["b/**"] + paths: + - "packages/**" + - "templates/routeros/**" + - "infra/chr/**" + - ".github/scripts/chr_bootstrap.py" + - ".github/workflows/chr-templates.yml" + pull_request: + paths: + - "packages/**" + - "templates/routeros/**" + - "infra/chr/test_templates.py" + - "infra/chr/**" + - ".github/scripts/chr_bootstrap.py" + - ".github/workflows/chr-templates.yml" + workflow_dispatch: + +permissions: + contents: read + +jobs: + readiness: + runs-on: ubuntu-latest + outputs: + ready: ${{ steps.contract.outputs.ready }} + steps: + - uses: actions/checkout@v4 + - name: Check Aun's router harness contract + id: contract + shell: bash + run: | + if [[ -f infra/chr/test_templates.py ]]; then + echo "ready=true" >> "$GITHUB_OUTPUT" + else + echo "ready=false" >> "$GITHUB_OUTPUT" + echo "## Router validation pending" >> "$GITHUB_STEP_SUMMARY" + echo "Aun harness missing." >> "$GITHUB_STEP_SUMMARY" + echo "Router templates were not tested." >> "$GITHUB_STEP_SUMMARY" + fi + + chr-smoke: + name: CHR boot and authenticated REST smoke + needs: readiness + if: needs.readiness.outputs.ready != 'true' + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - name: Set up Python 3.12 + run: uv python install 3.12 + - name: Install QEMU + run: | + sudo apt-get update + sudo apt-get install -y qemu-system-x86 qemu-utils + - name: Install locked workspace + run: uv sync --all-packages --locked + - name: Test lifecycle helper with offline fakes + run: uv run --locked pytest .github/tests/test_chr_bootstrap.py + - name: Boot CHR and verify authenticated REST readiness + run: uv run --locked python .github/scripts/chr_bootstrap.py start + - name: Record actual CHR smoke and pending template coverage + run: | + echo "## CHR bootstrap smoke passed" >> "$GITHUB_STEP_SUMMARY" + echo "CHR boot and REST check passed." >> "$GITHUB_STEP_SUMMARY" + echo "No templates were tested." >> "$GITHUB_STEP_SUMMARY" + - name: Keep router diagnostics + if: always() + uses: actions/upload-artifact@v4 + with: + name: chr-smoke-diagnostics + path: | + /tmp/netcortex-chr/qemu.log + /tmp/netcortex-chr/serial.log + if-no-files-found: ignore + - name: Stop the isolated router + if: always() + run: python .github/scripts/chr_bootstrap.py cleanup + + templates: + name: Apply, read back, and roll back on CHR + needs: readiness + if: needs.readiness.outputs.ready == 'true' + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + - name: Set up Python 3.12 + run: uv python install 3.12 + - name: Install QEMU + run: | + sudo apt-get update + sudo apt-get install -y qemu-system-x86 qemu-utils + - name: Install locked workspace + run: uv sync --all-packages --locked + - name: Offline test bootstrap lifecycle helpers + run: uv run --locked pytest .github/tests/test_chr_bootstrap.py + - name: Boot, provision, and authenticate to pinned CHR + run: uv run --locked python .github/scripts/chr_bootstrap.py start + - name: Run Aun's real router template harness + run: uv run --locked python infra/chr/test_templates.py + - name: Keep router diagnostics + if: always() + uses: actions/upload-artifact@v4 + with: + name: chr-diagnostics + path: | + /tmp/netcortex-chr/qemu.log + /tmp/netcortex-chr/serial.log + if-no-files-found: ignore + - name: Stop the isolated router + if: always() + run: python .github/scripts/chr_bootstrap.py cleanup diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9e73ef1..c2bc857 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,9 +23,11 @@ jobs: - name: Install every workspace package run: uv sync --all-packages --locked - name: Ruff - run: uv run --locked ruff check . + run: uv run --locked ruff check . .github/scripts .github/tests - name: Pytest - run: uv run --locked pytest --cov --cov-report=term-missing + run: | + uv run --locked pytest packages .github/tests \ + --cov --cov-report=term-missing web: name: Web lint, typecheck, build, and browser tests @@ -39,37 +41,43 @@ jobs: shell: bash run: | if [[ ! -f apps/web/package.json ]]; then - echo "Web app not present yet; web checks are pending." + echo "## Web validation pending" >> "$GITHUB_STEP_SUMMARY" + echo "Web checks pending." >> "$GITHUB_STEP_SUMMARY" exit 0 fi if [[ ! -f apps/web/package-lock.json ]]; then - echo "apps/web/package-lock.json is required for reproducible CI." >&2 + echo "Web lockfile required for reproducible CI." >&2 exit 1 fi + node - <<'NODE' + const fs = require('node:fs'); + const p = JSON.parse( + fs.readFileSync('apps/web/package.json', 'utf8') + ); + for (const script of ['lint', 'typecheck', 'build', 'test:e2e', 'test:e2e:live']) { + if (!p.scripts?.[script]) { + throw new Error(`Missing required npm script: ${script}`); + } + } + const configs = [ + 'playwright.config.ts', 'playwright.config.js', + 'playwright.config.mts', 'playwright.config.mjs', + 'playwright.config.cjs' + ]; + if (!configs.some(name => fs.existsSync(`apps/web/${name}`))) { + throw new Error('Playwright config is required for web CI'); + } + if (!p.devDependencies?.['@playwright/test'] && + !p.dependencies?.['@playwright/test']) { + throw new Error('@playwright/test must be declared'); + } + NODE cd apps/web npm ci + npm run format:check npm run lint npm run typecheck npm run build - if [[ -f playwright.config.ts || -f playwright.config.js || -f playwright.config.mts ]]; then - npx playwright install --with-deps chromium - npx playwright test - else - echo "Playwright configuration not present yet; browser checks are pending." - fi - - chr-templates: - name: CHR router template integration - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: astral-sh/setup-uv@v5 - - name: Run Aun's real CHR harness when available - shell: bash - run: | - if [[ ! -f infra/chr/test_templates.py ]]; then - echo "PENDING: infra/chr/test_templates.py is not present. No router tests were run." - exit 0 - fi - uv sync --all-packages --locked - uv run --locked python infra/chr/test_templates.py + npx playwright install --with-deps chromium + npm run test:e2e + npm run test:e2e:live diff --git a/infra/render/README.md b/infra/render/README.md new file mode 100644 index 0000000..6f37ea3 --- /dev/null +++ b/infra/render/README.md @@ -0,0 +1,18 @@ +# Render dashboard deployment + +Use `render.yaml` as the Blueprint file path when creating the service from the +tested branch. This is a Next.js Node web service with the root directory +`apps/web`, Node 22, a production build and the Render-assigned port. + +Select Render's free service tier. The blueprint creates no database, API or paid +resources. Verify the selected tier before creating the service in the dashboard. +Account access and the `.tech` domain are required to publish; no deployment has +been performed by this branch. + +The default environment uses fixture mode. Keep the persistent demo disclosure. +Add Aun's API URL and switch transport only after the shared API is available and +its browser/CORS/authentication contract is verified. `NEXT_PUBLIC_*` variables +are embedded at build time, so rebuild after changing them. Provider, database and +router credentials belong on the backend and must never be public variables. + +See [setup](../../docs/SETUP.md), [decisions](decision.md) and [flow](flow.md). diff --git a/infra/render/decision.md b/infra/render/decision.md new file mode 100644 index 0000000..61dc73b --- /dev/null +++ b/infra/render/decision.md @@ -0,0 +1,7 @@ +# Render deployment decisions + +The Render blueprint deploys only the Next.js web app as a Node web service. Its build runs `npm ci` and `npm run build`; the start command binds Next.js to Render's assigned `$PORT`. The health check targets `/`. + +The UI is configured for mock mode with `NEXT_PUBLIC_API_MODE=mock`. No API service is declared because Aun's backend, authentication, and deployment contract are not available in this branch. Adding an invented backend service or public API URL would imply an integration that does not exist. + +Do not put secrets in `NEXT_PUBLIC_*` variables; Next.js embeds those values into browser code. Once Aun publishes the service and auth contract, the service owner must choose the API URL, CORS/auth behavior, and private environment variables, then update the blueprint deliberately. Until the team confirms the public site is deployed and usable, describe Render as configured/planned rather than live. diff --git a/infra/render/flow.md b/infra/render/flow.md new file mode 100644 index 0000000..4177d60 --- /dev/null +++ b/infra/render/flow.md @@ -0,0 +1,10 @@ +# Render deployment flow + +**Entry:** a repository owner applies `infra/render/render.yaml` through Render Blueprint setup or updates an existing Blueprint connection. GitHub Actions does not publish the site itself. + +1. Render reads the Blueprint and builds from `apps/web`. +2. It runs `npm ci`, then `npm run build`, and starts the Next.js server on `$PORT` bound to `0.0.0.0`. +3. Render checks `/` for service health. +4. The browser loads the hosted UI in mock mode. In the current Blueprint there is no UI-to-NetCortex-API network connection; API service deployment and authentication remain blocked on Aun's backend contract. + +**Exit:** successful Render build and health response mean the UI service is healthy. They do not prove backend, live telemetry, CHR, approval, or end-to-end product behavior. Record the actual deploy URL/status only after an owner confirms it in Render. From 2b38f683948317ffdf30c80e772027917a224463 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:20:54 +0500 Subject: [PATCH 06/21] feat: add seeded telemetry scenarios and traceable RIPE calibration --- data/calibration-report.md | 72 ++ data/messages.yaml | 22 + data/ripe-baseline-summary.json | 50 ++ data/ripe-target-roles.json | 4 + data/scenarios.yaml | 8 + data/sites.yaml | 26 + docs/progress/data_simgen.md | 27 + packages/simgen/README.md | 40 + packages/simgen/decision.md | 20 + packages/simgen/flow.md | 69 ++ packages/simgen/pyproject.toml | 22 + .../simgen/src/netcortex_simgen/__init__.py | 5 + packages/simgen/src/netcortex_simgen/cli.py | 734 ++++++++++++++++++ .../src/netcortex_simgen/resources/sites.yaml | 26 + packages/simgen/src/netcortex_simgen/ripe.py | 370 +++++++++ .../simgen/src/netcortex_simgen/simulator.py | 641 +++++++++++++++ packages/simgen/tests/test_simulator.py | 607 +++++++++++++++ 17 files changed, 2743 insertions(+) create mode 100644 data/calibration-report.md create mode 100644 data/messages.yaml create mode 100644 data/ripe-baseline-summary.json create mode 100644 data/ripe-target-roles.json create mode 100644 data/scenarios.yaml create mode 100644 data/sites.yaml create mode 100644 docs/progress/data_simgen.md create mode 100644 packages/simgen/README.md create mode 100644 packages/simgen/decision.md create mode 100644 packages/simgen/flow.md create mode 100644 packages/simgen/pyproject.toml create mode 100644 packages/simgen/src/netcortex_simgen/__init__.py create mode 100644 packages/simgen/src/netcortex_simgen/cli.py create mode 100644 packages/simgen/src/netcortex_simgen/resources/sites.yaml create mode 100644 packages/simgen/src/netcortex_simgen/ripe.py create mode 100644 packages/simgen/src/netcortex_simgen/simulator.py create mode 100644 packages/simgen/tests/test_simulator.py diff --git a/data/calibration-report.md b/data/calibration-report.md new file mode 100644 index 0000000..3c4bb32 --- /dev/null +++ b/data/calibration-report.md @@ -0,0 +1,72 @@ +# RIPE calibration report + +This report summarizes downloaded public ping observations. The targets are DNS-server reachability probes; RTT is not DNS lookup latency. + +## Coverage + +- Observations: 11,819 +- UTC coverage: 2026-10-11T00:00:26+00:00 through 2026-10-17T23:59:48+00:00 +- Distinct UTC dates: 7 +- Measurement IDs: 1001, 1004 +- Probe IDs: 7613, 7764, 7812 +- Probe ASNs: 138910, 152605, 17557 + +| Public ping target | Rows | Median RTT (ms) | Median loss (%) | Pakistan hours observed | +|---|---:|---:|---:|---:| +| 192.5.5.241 | 4,295 | 16.86 | 0.00 | 24/24 | +| 193.0.14.129 | 7,524 | 7.89 | 0.00 | 24/24 | + +| Measurement ID | Rows | UTC dates covered | Targets | +|---:|---:|---:|---| +| 1001 | 7,524 | 7 | 193.0.14.129 | +| 1004 | 4,295 | 4 | 192.5.5.241 | + +## Calibration use and gaps + +- Exact configured simulator target matches: 0/5 (none). +- Public DNS role-proxy transfer: enabled. +- Explicit source targets: 192.5.5.241, 193.0.14.129. +- Proxy destination targets: 1.1.1.1, 8.8.8.8. +- Exact target calibration takes precedence. Role proxy can fill only unmatched configured public DNS targets (`1.1.1.1`, `8.8.8.8`); it never changes gateway, upstream-hop, regional-game, or DNS resolution timing. +- Role medians (only when explicitly mapped): RTT 16.325819 ms, jitter 0.05650035257903673 ms, loss 0.0%, n=11,127. +- Transfer uncertainty: These are public root-DNS-server ping paths. Their RTT, jitter, and loss are reachability proxies, not DNS lookup timing or proof of route equivalence to 1.1.1.1 or 8.8.8.8. +- The requested window covers seven UTC days. Daily failures remain in `data/ripe-baseline-summary.json`; they are not imputed. +- Failed daily requests recorded in the fetch summary: 3. +- Proxy source samples are restricted to exact observed target strings in the supplied map; provider role labels alone never authorize transfer. + +Pakistan-hour target and role medians are stored in ignored `data/calibration.json`. Role transfer is off by default and requires both an exact-target role map and `--allow-role-proxy`. + + +Failed daily requests: +- 2026-10-13, measurement 1004: TimeoutError +- 2026-10-15, measurement 1004: TimeoutError +- 2026-10-16, measurement 1004: TimeoutError + +## Explicit role-proxy statistics by Pakistan hour + +| Hour PK | Median RTT (ms) | Median jitter (ms) | Median loss (%) | RTT samples | +|---:|---:|---:|---:|---:| +| 0 | 16.318362 | 0.05606639365569698 | 0.0 | 469 | +| 1 | 16.305560333333332 | 0.047581405011715525 | 0.0 | 459 | +| 2 | 16.31138066666667 | 0.048643767482473954 | 0.0 | 463 | +| 3 | 16.299233833333332 | 0.05005642229728814 | 0.0 | 454 | +| 4 | 16.305297833333334 | 0.050188871381498454 | 0.0 | 466 | +| 5 | 16.272119666666665 | 0.049732176512460764 | 0.0 | 467 | +| 6 | 16.279111999999998 | 0.048783355979951454 | 0.0 | 467 | +| 7 | 16.251087666666663 | 0.056497728904253364 | 0.0 | 466 | +| 8 | 16.26824433333333 | 0.05048028711839256 | 0.0 | 461 | +| 9 | 16.289545333333336 | 0.06299181200417098 | 0.0 | 466 | +| 10 | 16.33685266666667 | 0.06467928693175273 | 0.0 | 459 | +| 11 | 16.401758 | 0.06545249046955104 | 0.0 | 467 | +| 12 | 16.461637 | 0.06354847995368651 | 0.0 | 470 | +| 13 | 16.358806 | 0.06573944022923481 | 0.0 | 464 | +| 14 | 16.402351333333332 | 0.05947983257280477 | 0.0 | 469 | +| 15 | 16.454457666666666 | 0.056780130587692434 | 0.0 | 457 | +| 16 | 16.347939666666665 | 0.05133088025956911 | 0.0 | 457 | +| 17 | 16.332949333333335 | 0.05449381874630879 | 0.0 | 467 | +| 18 | 16.360720166666667 | 0.06418695557570152 | 0.0 | 462 | +| 19 | 16.337348666666667 | 0.06288754541242648 | 0.0 | 461 | +| 20 | 16.338292666666668 | 0.06434506354115789 | 0.0 | 458 | +| 21 | 16.3493635 | 0.06587463696598783 | 0.0 | 466 | +| 22 | 16.319249666666668 | 0.061243529851459956 | 0.0 | 467 | +| 23 | 16.325295999999998 | 0.0631476448491937 | 0.0 | 465 | \ No newline at end of file diff --git a/data/messages.yaml b/data/messages.yaml new file mode 100644 index 0000000..4d6630c --- /dev/null +++ b/data/messages.yaml @@ -0,0 +1,22 @@ +messages: + uplink_congestion: + en: "Your internet may feel slow while the main link is busy. We are checking the connection." + ur: "مین لنک پر زیادہ رش ہے، اس لیے انٹرنیٹ سست ہو سکتا ہے۔ ہم کنکشن چیک کر رہے ہیں۔" + heavy_user: + en: "Network traffic is uneven. We are checking the affected connection." + ur: "نیٹ ورک ٹریفک غیر متوازن ہے۔ ہم متاثرہ کنکشن چیک کر رہے ہیں۔" + upstream_degradation: + en: "The upstream provider may be having trouble. Your local network is responding." + ur: "اوپر والے انٹرنیٹ فراہم کنندہ کے نیٹ ورک میں مسئلہ ہو سکتا ہے۔ مقامی نیٹ ورک جواب دے رہا ہے۔" + game_route_issue: + en: "The route to one game service is unstable. Other connections may work normally." + ur: "ایک گیم سروس کا راستہ غیر مستحکم ہے۔ باقی کنکشن معمول کے مطابق چل سکتے ہیں۔" + wireless_interference: + en: "A wireless link is unstable. A technician may need to inspect it." + ur: "ایک وائرلیس لنک غیر مستحکم ہے۔ ٹیکنیشن کو اسے دیکھنے کی ضرورت ہو سکتی ہے۔" + uplink_down: + en: "The main internet link is unavailable. Backup routing may be in use." + ur: "مین انٹرنیٹ لنک دستیاب نہیں۔ بیک اپ راستہ استعمال ہو سکتا ہے۔" + dns_slow: + en: "Name lookups are delayed. Other parts of the connection may be working." + ur: "ویب نام تلاش کرنے میں تاخیر ہے۔ کنکشن کے دوسرے حصے کام کر رہے ہو سکتے ہیں۔" diff --git a/data/ripe-baseline-summary.json b/data/ripe-baseline-summary.json new file mode 100644 index 0000000..4e98418 --- /dev/null +++ b/data/ripe-baseline-summary.json @@ -0,0 +1,50 @@ +{ + "source": "RIPE Atlas public API", + "downloaded_at": "2026-10-18T12:56:57.886439+00:00", + "requested_days": 7, + "rows": 11819, + "probe_count": 3, + "asn_count": 3, + "measurement_ids": [ + 1001, + 1004 + ], + "probes": [ + { + "id": 7613, + "asn": 152605 + }, + { + "id": 7764, + "asn": 17557 + }, + { + "id": 7812, + "asn": 138910 + } + ], + "targets": [ + "192.5.5.241", + "193.0.14.129" + ], + "first_observation": "2026-10-11T00:00:26+00:00", + "last_observation": "2026-10-17T23:59:48+00:00", + "failures": [ + { + "measurement": 1004, + "start": 1791849600, + "error": "TimeoutError" + }, + { + "measurement": 1004, + "start": 1792022400, + "error": "TimeoutError" + }, + { + "measurement": 1004, + "start": 1792108800, + "error": "TimeoutError" + } + ], + "limits": "Root DNS-server ping reachability only; not DNS resolution time. No gateway, game-server or subscriber baseline. Raw records ignored by Git." +} \ No newline at end of file diff --git a/data/ripe-target-roles.json b/data/ripe-target-roles.json new file mode 100644 index 0000000..bd2cd7f --- /dev/null +++ b/data/ripe-target-roles.json @@ -0,0 +1,4 @@ +{ + "192.5.5.241": "public_dns_reachability_proxy", + "193.0.14.129": "public_dns_reachability_proxy" +} diff --git a/data/scenarios.yaml b/data/scenarios.yaml new file mode 100644 index 0000000..2d9bfc4 --- /dev/null +++ b/data/scenarios.yaml @@ -0,0 +1,8 @@ +scenarios: + uplink_congestion: {evidence: "primary uplink utilization high; external targets degrade while gateway stays healthy", template: priority_queue} + heavy_user: {evidence: "experimental subscriber telemetry only; no core subscriber schema is defined", template: queue_limit} + upstream_degradation: {evidence: "external targets degrade while gateway and utilization remain normal", template: none} + game_route_issue: {evidence: "regional game target alone degrades", template: none} + wireless_interference: {evidence: "experimental backhaul loss and jitter; no core role mapping is defined", template: none} + uplink_down: {evidence: "primary uplink fails; failover is actionable only where backup exists", template: failover_route} + dns_slow: {evidence: "experimental DNS resolution timing only; core probe schema has no resolver timing field", template: dns_servers} diff --git a/data/sites.yaml b/data/sites.yaml new file mode 100644 index 0000000..753747e --- /dev/null +++ b/data/sites.yaml @@ -0,0 +1,26 @@ +timezone: Asia/Karachi +sites: + - id: north-tower + name: North Tower + subscribers: 120 + uplinks: + - {interface: ether1, role: primary, capacity_mbps: 180} + backup_uplink: {interface: ether2, role: backup, capacity_mbps: 80} + backhauls: [{interface: wlan1, role: backhaul, capacity_mbps: 120}] + targets: [gateway, upstream-hop, 1.1.1.1, 8.8.8.8, regional-game] + - id: market-cafe + name: Market Cafe + subscribers: 48 + uplinks: + - {interface: ether1, role: primary, capacity_mbps: 100} + backup_uplink: null + backhauls: [{interface: wlan1, role: backhaul, capacity_mbps: 80}] + targets: [gateway, upstream-hop, 1.1.1.1, 8.8.8.8, regional-game] + - id: east-relay + name: East Relay + subscribers: 165 + uplinks: + - {interface: ether1, role: primary, capacity_mbps: 250} + backup_uplink: {interface: ether2, role: backup, capacity_mbps: 100} + backhauls: [{interface: wlan1, role: backhaul, capacity_mbps: 150}, {interface: wlan2, role: backhaul, capacity_mbps: 100}] + targets: [gateway, upstream-hop, 1.1.1.1, 8.8.8.8, regional-game] diff --git a/docs/progress/data_simgen.md b/docs/progress/data_simgen.md new file mode 100644 index 0000000..1a5b656 --- /dev/null +++ b/docs/progress/data_simgen.md @@ -0,0 +1,27 @@ +# B2 data and simulator handoff + +## Scope + +Implemented `packages/simgen/`, three-site topology/scenario/message fixtures under `data/`, and the train/validation/test case generator in the package CLI. No shared core schemas, Settings, Cause model, or database schema were created. Generated and fetched Parquet/JSON files remain ignored. + +## Interfaces for detector work + +- `netcortex_simgen.simulator.generate(days=1, seed=42, start=None, scenario_type=None, duration_min=15, site_id=None, normal_only=False, hours=None)` returns `(probe_df, iface_df, labels)`. +- `inject_frames(site_id, scenario_type, duration_min=15, seed=42, start=None)` returns fixture DataFrames and one plain dictionary label. It is an internal simulator helper, not the shared core interface. +- `generate_supplemental(labels, *, start, end, seed=42, site_ids=None)` returns continuous experimental DNS, subscriber, and backhaul samples separately from core-shaped frames. +- `eval/cases/{train,validation,test}/{case_id}.json` sidecars point to sibling `-probe.parquet`, `-iface.parquet`, and `-supplemental.parquet`. Sidecars carry case/split/seed/site, event bounds, `as_of`, history window, expected label, and observation paths. For `n=80`, each split has 80 balanced cases (10 normal and 10 per cause). The test split is held out; train and validation are separate windows and seed ranges. +- CLI `inject` saves fixture rows at the deterministic simulator time base (default `2026-10-12T00:00:00Z`, single-cause event at +2h); `replay` merges persisted fixture files with generated rows in time order. This is offline fixture playback, not router/runtime injection. `inject_frames(..., start=...)` accepts a different synthetic start. + +## Implementation and validation + +Three configured sites model primary/backup capacity, targets, subscribers, and wireless backhaul. Seeded NumPy generates 10-second ping and 30-second interface observations. Pakistan-local time shapes daily demand; output timestamps are UTC. Congestion, heavy-user, uplink-down, and wireless-interference scenarios affect interface telemetry as well as pings. Gateway pings remain healthy during upstream congestion/down events. Total ping loss is exactly 100%, with RTT/jitter absent when no packets arrive. Calibration reads mapped target/hour and role/hour values where available; illustrative defaults are marked in provenance. + +RIPE parsing accepts the API's `result` packet array and preserves measurement/probe/ASN/target/time provenance. Probe and public-measurement discovery is dynamic. UTC-day requests filter to selected probe IDs; cache keys include those IDs. Requests have 15-second maximum per-request timeout, five-second connect timeout, 300-second default overall deadline, 8 MiB response cap, 10,000 result-row daily cap, bounded pagination, and a 0.25-second request gap even after failures. Partial coverage stays in the fetch report without imputation. + +The integration checkout now contains 11,819 actual public RIPE records covering 2026-10-11 through 2026-10-17: probes 7613, 7764, and 7812 across three ASNs; dynamically discovered measurements 1001 and 1004. Measurement 1001 covered all seven days. Measurement 1004 covered four days, with three daily requests timing out. `data/ripe-baseline-summary.json` and the ignored raw Parquet are parent-owned and were preserved. [The calibration report](../../data/calibration-report.md) is generated from that Parquet and reports target and role medians, hours, provenance, uncertainty, and gaps. Both observed targets are root-DNS reachability checks, not DNS lookup timing. The committed exact-target role map labels those observed paths as `public_dns_reachability_proxy`; transfer remains off unless `simgen calibrate --target-role-map data/ripe-target-roles.json --allow-role-proxy` is explicitly run. When enabled, the proxy is restricted to unmatched configured public DNS targets (`1.1.1.1`, `8.8.8.8`); exact target calibration takes precedence, and generated metadata records the source, destination, and unproven route equivalence. Gateway, upstream-hop, game-server, and DNS resolution timing never use the proxy. + +Validation in the integration checkout: 20 simgen offline tests pass and root-config Ruff passes. A wheel build and outside-checkout generation were validated in the original isolated worktree. Calibration was run against the actual 11,819-row Parquet with the committed explicit source-role map and `--allow-role-proxy`; it wrote ignored `data/calibration.json` and `data/calibration-report.md`. A subsequent normal-only generate run wrote `data/generated/generation_metadata.json`; it reports proxy use only for `1.1.1.1` and `8.8.8.8`, leaving gateway, upstream-hop, and game target defaults illustrative. `simgen calibrate --mock` exits clearly and creates no calibration from invented values. + +## Boundaries + +DNS/subscriber/backhaul records are separate experimental supplemental data, continuously generated for healthy and labeled periods so their mere presence does not leak class. They are not loaded into draft core tables; DNS timing, subscriber privacy/evidence, and interface role contracts remain pending Aun. Public `inject(...)->ScenarioLabel` lazily imports actual `netcortex_core` exports and raises an explicit unavailable-contract error when absent. Even with core importable, lifecycle creation is gated pending approval. DB load/replay persistence refuses to write until keys and transaction semantics are confirmed; mock load reads and validates source rows. No database write or working live injection is claimed. diff --git a/packages/simgen/README.md b/packages/simgen/README.md new file mode 100644 index 0000000..bb4e5dc --- /dev/null +++ b/packages/simgen/README.md @@ -0,0 +1,40 @@ +# netcortex-simgen + +Deterministic network telemetry fixtures and bounded RIPE Atlas collection. The fixture CLI works without NetCortex core. Generated Parquet and raw downloads stay under ignored `data/generated/` and `data/raw/` paths. + +Install this package through the workspace when integrated. From the package directory, an isolated offline run is: + +```powershell +python -m uv run --no-project --with pytest --with-editable . pytest +``` + +Typical commands: + +```powershell +simgen generate --days 7 --seed 42 --mock +simgen generate --days 7 --seed 42 --normal-only --mock +simgen inject --site north-tower --type uplink_congestion --duration 15 --seed 42 --mock +simgen replay --speed 60 --mock +simgen eval-cases --n 80 --seed 1000 --mock +simgen ripe --days 14 +simgen calibrate +simgen load --source sim --last 2d --mock +``` + +Default generation schedules all seven causes once per configured site; `--normal-only` generates baseline traffic. Ping samples use 10-second cadence, interfaces use 30-second cadence, and daily demand follows Pakistan local time. Timestamps remain UTC. Seeded NumPy produces the samples. One site/day contains 8,640 ping observations per target and 2,880 interface observations per configured interface. + +`generate()` returns core-shaped probe/interface DataFrames and plain fixture labels. `inject_frames()` returns fixture rows and a plain dict label. Public `inject(site_id, scenario_type, duration_min, seed)` lazy-imports the actual `netcortex_core` Cause and ScenarioLabel symbols, then fails clearly until the approved lifecycle adapter is implemented. It never returns a locally invented shared object. + +Scenario signals affect both ping and interface data. Complete uplink loss is exactly 100% with missing RTT/jitter; gateway ping remains available and a configured backup receives traffic. DNS timing and synthetic subscriber evidence are written to separate supplemental experimental Parquet with explicit status. Unsupported columns are never added to core table frames. + +RIPE collection discovers active Pakistan probes and public ping measurements dynamically, then fetches bounded UTC-day result windows for selected probes. Requests have a total deadline and response/row/pagination limits; cache keys include selected probe IDs, and partial daily gaps stay visible in the fetch report. Fetched rows retain probe/ASN/measurement/target/time provenance; no real records are fabricated. Offline tests do not call the network. + +The integration checkout contains 11,819 public RIPE ping records from 2026-10-11 through 2026-10-17: three Pakistan probes in three ASNs, across measurements 1001 and 1004. Measurement 1001 has all seven days; measurement 1004 has four successful days and three recorded request timeouts. These targets measure root-DNS-server reachability, not DNS resolution latency. Exact target calibration always wins. An opt-in role proxy is available only with both an exact-target mapping and `--allow-role-proxy`; it applies per-hour RTT, jitter, and loss medians only to unmatched configured public-DNS targets `1.1.1.1` and `8.8.8.8`. Its source, destination, and route-equivalence uncertainty are included in `generation_metadata.json`. Reproduce the explicitly approved mapping with `simgen calibrate --target-role-map data/ripe-target-roles.json --allow-role-proxy`. See [calibration-report.md](../../data/calibration-report.md). `simgen calibrate --mock` exits without writing because no mock observation dataset is bundled. + +Run that calibration command from the workspace root so the relative mapping path resolves. The mapping file records exact observed-source roles; omitting `--allow-role-proxy` stores role statistics but does not transfer them into generated target baselines. + +`eval-cases --n 80` writes 80 cases for each of train, validation, and held-out test, balanced at ten cases per class per split. Seeds and calendar windows are separate. JSON sidecars contain event bounds, seed, split, `as_of`, history window, and expected labels. Metric feature rows end at `as_of`; labels are not feature columns. Supplemental experimental evidence has a separate file. + +Database load and live injection remain unavailable until Aun confirms core table conflict keys, transaction behavior, and injection lifecycle. Mock load reads and validates the selected fixture but performs no database writes. CLI `inject` persists a fixture at the deterministic simulator clock (default base `2026-10-12T00:00:00Z`, single-cause event at +2 hours); Python `inject_frames(..., start=...)` accepts another fixture start. `replay` merges active persisted injection fixtures with generated rows and consumes them in timestamp order; only speed 1 uses wall-clock pauses. These commands do not act on a router or claim a live injection. Core database persistence stays gated. + +See [decision.md](decision.md) for material choices and [flow.md](flow.md) for entry points, files, external APIs, failure paths, and contract gates. Passing offline tests does not establish a live RIPE, core, database, router, or workflow integration. diff --git a/packages/simgen/decision.md b/packages/simgen/decision.md new file mode 100644 index 0000000..6366f43 --- /dev/null +++ b/packages/simgen/decision.md @@ -0,0 +1,20 @@ +# Simulator decisions + +| Decision | Alternatives and tradeoff | Reason | Practical implication | +|---|---|---|---| +| Package as Python 3.12 `netcortex-simgen` with `netcortex_simgen` imports and `src/` layout. | Keep scripts inside `data/`; simpler but not importable by other packages. | The brief requires a CLI and Python API. | Install from `packages/simgen/`; root workspace and lockfile remain lead-owned. | +| Build samples from seeded NumPy arrays and return pandas frames. | Handwrite row values or use LLM-generated series. | Seeded arrays are repeatable, economical, and retain daily structure. | Same seed and start yield identical observations; values remain generated data, not real measurements. | +| Use 10-second probes, 30-second interfaces, and a Pakistan local-time weekday/weekend demand curve. | One cadence, UTC-shaped daily demand, or flat utilization. | Matches collection timing and evening traffic peaks. | UTC timestamps are stored; local time drives demand. One site/day has 8,640 ping times/target and 2,880 samples/interface. | +| Keep only the seven brief cause strings and their expected template IDs. | Add convenient aliases or invent more shared values. | Those identifiers belong to Aun's contract. | `CAUSES` and `TEMPLATES` are local constants; fixture labels are plain dicts, not Pydantic types. | +| Separate internal `inject_frames()` from the public `inject(...)->ScenarioLabel`. | Return a local dict that looks like the future shared result. | Core is absent and its lifecycle isn't agreed. | Offline scenario fixtures work; public injection imports core lazily and fails explicitly until the real API is bound. | +| Gate database writes until Aun provides conflict keys and retry behavior. | Guess an `ON CONFLICT` key from the draft schema. | Guessed keys can duplicate or discard telemetry. | Mock load validates files; real load/replay stops before writes. | +| Discover RIPE probes/measurements at runtime with finite timeouts, capped pagination, cache, and request spacing. | Hardcode IDs or crawl without page limits. | Provider contents change; raw downloads must be bounded and traceable. | Fetched observations retain measurement/probe IDs; offline tests use no network. | +| Prefer exact target/hour calibration; allow an explicit, opt-in public-DNS reachability role proxy only for `1.1.1.1` and `8.8.8.8`. | Transfer by default, or apply a role baseline to gateway, upstream-hop, game-server, or DNS lookup measurements. | The brief asks for per-target-role baseline statistics and root DNS ping data is available, but its route is not proven equivalent to either configured resolver target. | `--target-role-map` plus `--allow-role-proxy` are both required. Exact target data wins. Transfer scope and uncertainty are stored in calibration and generation metadata; other targets keep illustrative defaults. | +| Compute role/hour RTT, jitter, and loss statistics only for exact targets in the supplied role map. | Let provider role labels silently authorize cross-target use. | Role aggregation should describe only operator-designated source observations. | The map is `data/ripe-target-roles.json`; its two root-DNS addresses are explicitly marked as reachability proxies. The proxy transfers only to unmatched public-DNS targets and never means DNS lookup latency. | +| Make mock calibration fail unless an explicit real observation fixture is bundled. | Run against made-up/mock samples when `--mock` is selected. | A calibration artifact should be traceable to measured data. | `simgen calibrate --mock` exits without writing; real calibration writes ignored `data/calibration.json` plus a committed measured coverage report. | +| Make interface effects agree with ping scenario windows. | Alter only ping RTT/loss while leaving utilization/counters normal. | A detector needs the physical metric evidence for the stated cause. | Congestion raises utilization/drops; total uplink loss zeros primary counters and shifts configured backup; interference raises backhaul counters. | +| Keep gateway healthy for outside-provider/congestion incidents, and model total loss as exactly 100% with unavailable RTT/jitter. | Apply the same queue delay to gateway, or emit noisy near-total loss with a valid RTT. | Those outputs contradict the incident descriptions and packet semantics. | Gateway is a local control; total loss is not mistaken for a slow successful response. | +| Keep synthetic subscriber/DNS observations in supplemental experimental Parquet. | Add unsupported columns to core tables or infer them from ping RTT. | Draft core schemas do not define subscriber traffic or resolver timing. | Supplemental rows disclose synthetic provenance and pending contracts; they are excluded from database loads. | +| Put labels in per-case JSON sidecars, never in feature rows. | Add cause/template to the metric DataFrame for convenience. | That directly leaks the answer to a detector. | Eval scoring joins expected labels only after inference; each case is clipped at its `as_of`. | +| Generate balanced train, validation and held-out test packs with distinct seeds and calendar windows. | Split adjacent windows from one run or reuse training cases as test. | Event leakage gives optimistic scores. | `--n 80` means 80 test cases plus 80 each in train and validation, ten per class in every split. It produces no scores itself. | +| Ignore large Parquet and raw RIPE cache files in version control. | Commit generated case packs/raw API payloads. | These artifacts are reproducible or grow quickly. | Small YAML fixtures are committed; use `simgen generate` and `simgen eval-cases` to materialize data locally. | diff --git a/packages/simgen/flow.md b/packages/simgen/flow.md new file mode 100644 index 0000000..b6bd3ea --- /dev/null +++ b/packages/simgen/flow.md @@ -0,0 +1,69 @@ +# Simulator flow and integration boundaries + +## Entry points + +```mermaid +flowchart TD + CLI[simgen CLI] --> GEN[generate] + CLI --> INJ[inject fixture] + CLI --> RIPE[ripe fetch] + CLI --> CAL[calibrate] + CLI --> LOAD[load and replay] + CLI --> EVAL[eval-cases] + GEN --> TABLES[probe and interface DataFrames] + GEN --> SUPP[supplemental experimental DataFrame] + INJ --> TABLES + TABLES --> PARQUET[ignored generated Parquet] + SUPP --> EXPPARQUET[supplemental experimental Parquet] + RIPE --> API[RIPE Atlas v2 API] + API --> CACHE[ignored cached JSON and RIPE Parquet] + CACHE --> CAL + CAL --> CALFILE[data/calibration.json] + CALFILE --> GEN + LOAD -->|core keys confirmed + DATABASE_URL| DB[(Aun core tables)] + LOAD -->|current gate| STOP[RuntimeError before writes] + INJ --> ACTIVE[active_scenarios.json] + ACTIVE --> LOAD + EVAL --> CASES[eval/cases split sidecars + observations] + PUBLIC[inject(site_id, Cause, duration_min, seed)] --> CORE{real netcortex_core present?} + CORE -->|no| ERROR[explicit unavailable RuntimeError] + CORE -->|yes| UNBOUND[adapter remains disabled pending lifecycle contract] +``` + +## Python API + +`src/netcortex_simgen/simulator.py` exports: + +- `generate(days=1, seed=42, start=None, scenario_type=None, duration_min=15, site_id=None, normal_only=False, hours=None) -> (probe_df, iface_df, labels)`. Without a selected scenario and without `normal_only`, it schedules each of seven causes once per selected site. Probe frame columns match the draft `probe_metrics`; interface frame columns match `iface_metrics`. An optional `hours` argument bounds a case window to at most 24 hours per requested day. Both frames carry `attrs["calibration"]` with per-target mode and any explicit proxy provenance. +- `inject_frames(site_id, scenario_type, duration_min=15, seed=42, start=None) -> (probe_df, iface_df, label_dict)`. This internal fixture helper emits table-shaped frames and a plain label dict. It does not persist on its own. +- `generate_supplemental(labels, *, start, end, seed=42, site_ids=None) -> DataFrame`. Emits continuous separately marked synthetic DNS, subscriber, and backhaul observations for every selected site across the requested interval. Scenario transforms apply only inside the event interval, so baseline presence does not reveal a label. +- `inject(site_id, scenario_type: Cause, duration_min, seed=None) -> ScenarioLabel`. This is the future public contract signature with type-only imports. At runtime it lazy-imports `netcortex_core` and raises explicitly if the actual exports are missing. Even when the module exists, the adapter raises until Aun confirms construction and lifecycle. +- `sites() -> dict` reads committed `data/sites.yaml` when running from a checkout and falls back to the bundled `netcortex_simgen.resources/sites.yaml` for an installed wheel. + +`src/netcortex_simgen/ripe.py` exports `parse_result(item, site_id="ripe-pk")` and `fetch(days=14, out=None, cache_dir=None, client=None, page_limit=20, max_measurements=5, max_probes=5, deadline_seconds=300)`. A parsed row has `source=ripe`, measurement ID, probe ID, ASN, and target. A packet-loss row with no received packets has `loss_pct=100`, `rtt_ms=None`, and `jitter_ms=None`. + +## CLI commands and file/table effects + +| Command | Input and steps | Output | Error or gate | +|---|---|---|---| +| `simgen generate --days 7 --seed 42 [--normal-only] [--mock]` | Generate all sites using seeded demand and scenario schedule, unless normal-only is selected. | `data/generated/probe_metrics.parquet`, `iface_metrics.parquet`, `supplemental_experimental.parquet`, `scenario_labels.json`, and `generation_metadata.json` describing target baseline mode, proxy scope, provenance, and uncertainty. | Days must be 1..30; invalid cause/site or non-aware Python start raises `ValueError`. | +| `simgen inject --site north-tower --type uplink_congestion --duration 15 --seed 42 --mock` | Generate one fixture at the simulator's default clock (`2026-10-12T00:00:00Z` base; a single cause starts two hours later), clip rows to its label window, and replace the same site/cause/seed fixture. | `data/generated/injections/-probe.parquet`, `-iface.parquet`, `-supplemental.parquet`, and `active_scenarios.json` with calibration metadata. | Persists a replay fixture only. It does not inject into a router/runtime, call API/core, or write a database. Python `inject_frames(..., start=...)` accepts a different fixture clock. | +| `simgen ripe --days 14` | Discover active Pakistan probes, discover public ping measurements, then bounded results. | Cached JSON under `data/raw/ripe/cache/`; `data/raw/ripe/results.parquet`. | HTTP timeout/status errors and malformed responses fail; pagination stops/errors at 20 pages. `--mock` exits because no real observation fixture is bundled. | +| `simgen calibrate [--target-role-map roles.json --allow-role-proxy]` | Read available `data/raw/ripe/results.parquet` and `data/raw/live/collector.parquet`; compute Pakistan local hour medians, target/hour medians, and counts. Role/hour medians include only exact observed targets named in the map. | Ignored `data/calibration.json` and committed `data/calibration-report.md` with measured coverage, per-target/per-role medians, default coverage, opt-in transfer scope, uncertainty, and gaps. | Role proxy requires both options and at least one matching observed target mapped to `public_dns_reachability_proxy`. It fills only unmatched `1.1.1.1`/`8.8.8.8`; exact target calibration wins. If no input exists, exits without writing; `--mock` exits because no synthetic calibration fixture is bundled. | +| `simgen load --source sim --last 2d [--mock]` | Read generated SIM or RIPE source rows and filter to the last duration. | Mock reports actual selected rows without writing. Intended target tables are `probe_metrics` and `iface_metrics`. | `--last` must be positive `d` or `h`. Real mode requires `NETCORTEX_DB_KEYS_CONFIRMED=1` and `DATABASE_URL`, but remains blocked before writes pending Aun's conflict-key contract. | +| `simgen replay --speed 60 [--mock]` | Read base generated rows and active persisted fixture rows, sort by timestamp. Speed 1 waits wall time; speed greater than 1 consumes on a virtual accelerated clock. | Mock prints consumed row and active-fixture counts. Real persistence targets the same core metrics tables. | This is deterministic fixture replay, not live scenario injection. Missing base Parquet fails; core persistence remains gated. | +| `simgen eval-cases --n 80 --seed 1000 [--mock]` | Generate a balanced set independently for each split. N is positive multiple of eight. | 80 cases per split in `eval/cases/{train,validation,test}`; each has JSON sidecar including calibration mode/proxy provenance, probe/iface Parquets, and separate supplemental Parquet. | Invalid size raises `ValueError`. `test` is the 80-case held-out set; train/validation are distinct 80-case sets. | + +Every eval JSON sidecar carries `case_id`, `split`, `seed`, `site_id`, `case_start`, `event_start`, `event_end`, `as_of`, `history_window`, `expected`, `calibration`, and observation paths. Exactly ten of each normal plus seven cause classes appear per split when n=80. Case causes and sites are shuffled; train/validation/test use different random seed ranges and nonoverlapping calendar blocks. The history window ends at `window_start=as_of-30m`, the detection interval ends at `as_of`, and event cases set `as_of=event_end-10s`. Probe/interface observations stop at `as_of`. Cause/template/params are absent from feature columns and only read after inference for scoring. The detector worker should use each sidecar's history window as the maximum available context and must not use any observation after `as_of`. + +## Network, storage, and failures + +The sole network client is httpx to RIPE Atlas v2 endpoints `/probes/`, `/measurements/`, and `/measurements/{id}/results/`. Probe and measurement discovery is dynamic; results are fetched in UTC-day requests filtered to selected probe IDs. Requests use at most 15-second timeouts (5-second connect) under a 300-second overall deadline by default. Result retrieval is paginated up to 20 pages, each response is capped at 8 MiB, and daily result rows are capped at 10,000. Requests are spaced by 0.25 seconds, including after failed responses. Cache keys include the selected probe set; partial-day gaps are preserved in the fetch report and never filled with generated observations. `--mock` makes no RIPE network call. + +The integration checkout contains 11,819 real public RIPE ping records from 2026-10-11 through 2026-10-17: three Pakistan probes across three ASNs, measurements 1001 and 1004. Measurement 1001 covers all seven days; measurement 1004 has four successful days and three recorded timeouts. These are root-DNS-server reachability observations, not DNS resolution latency. Exact target calibration takes priority. The bundled role map is opt-in: it permits medians from those two observed targets to proxy only the configured public DNS reachability targets, while generated metadata names the transfer and warns that route equivalence is unproven. Gateway, upstream-hop, regional-game, and DNS resolution timing never use this transfer. + +Pandas/NumPy make simulated rows, PyArrow stores Parquet, PyYAML reads sites/scenarios. The wheel bundles a copy of the topology file as a runtime fallback and was verified to generate a one-hour fixture outside the checkout (1,800 probes, 360 interface rows). Psycopg is declared for later database loading. The loader currently opens no transaction unless the explicit key-confirmation environment gate is set, then still exits in a transaction before any insert because the unique/upsert key has not been approved. There is no API, Temporal, CHR, or model integration. + +## Missing core gates + +`packages/core` is absent in this worktree. Aun must confirm Cause/ScenarioLabel exports; injection start/end, overlap, source, label linkage and cleanup lifecycle; unique table keys and transactional retry semantics; subscriber privacy and evidence policy; DNS resolution timing support; and explicit interface-role support. Supplemental fields are stored separately and never passed to draft core tables. The fixture CLI proves only local deterministic behavior, not RIPE availability, database persistence, live injection, or the downstream incident workflow. diff --git a/packages/simgen/pyproject.toml b/packages/simgen/pyproject.toml new file mode 100644 index 0000000..0f486d8 --- /dev/null +++ b/packages/simgen/pyproject.toml @@ -0,0 +1,22 @@ +[build-system] +requires = ["hatchling>=1.26"] +build-backend = "hatchling.build" + +[project] +name = "netcortex-simgen" +version = "0.1.0" +description = "Deterministic network telemetry simulation and fixture tools for NetCortex" +requires-python = ">=3.12,<3.13" +dependencies = ["numpy>=2.1", "pandas>=2.2", "pyarrow>=18", "PyYAML>=6", "httpx>=0.27", "psycopg[binary]>=3.2"] + +[project.scripts] +simgen = "netcortex_simgen.cli:main" + +[tool.hatch.build.targets.wheel] +packages = ["src/netcortex_simgen"] + +[tool.hatch.build.targets.wheel.force-include] +"src/netcortex_simgen/resources/sites.yaml" = "netcortex_simgen/resources/sites.yaml" + +[tool.pytest.ini_options] +testpaths = ["tests"] diff --git a/packages/simgen/src/netcortex_simgen/__init__.py b/packages/simgen/src/netcortex_simgen/__init__.py new file mode 100644 index 0000000..6d1c05a --- /dev/null +++ b/packages/simgen/src/netcortex_simgen/__init__.py @@ -0,0 +1,5 @@ +"""NetCortex simulator and dataset utilities.""" + +from .simulator import generate, inject, inject_frames, sites + +__all__ = ["generate", "inject", "inject_frames", "sites"] diff --git a/packages/simgen/src/netcortex_simgen/cli.py b/packages/simgen/src/netcortex_simgen/cli.py new file mode 100644 index 0000000..15776d2 --- /dev/null +++ b/packages/simgen/src/netcortex_simgen/cli.py @@ -0,0 +1,734 @@ +from __future__ import annotations + +import argparse +import json +import os +import time +from datetime import UTC, datetime, timedelta +from pathlib import Path +from typing import Any + +import numpy as np +import pandas as pd + +from .ripe import fetch as fetch_ripe +from .simulator import CAUSES, ROOT, generate, generate_supplemental, inject_frames, sites + +PING_TARGET_ROLES = { + "gateway", + "upstream_hop", + "public_dns_reachability_proxy", + "game_server", +} + + +def _read_target_role_map(path: Path | None) -> dict[str, str]: + if path is None: + return {} + mapping = json.loads(path.read_text(encoding="utf-8")) + if not isinstance(mapping, dict) or any( + not isinstance(target, str) or not isinstance(role, str) for target, role in mapping.items() + ): + raise ValueError("target role map must contain exact target-string keys and role names") + unknown_roles = set(mapping.values()) - PING_TARGET_ROLES + if unknown_roles: + raise ValueError( + "RIPE ping roles must describe ping observations; unsupported roles: " + + ", ".join(sorted(unknown_roles)) + ) + return mapping + + +def _build_calibration( + observations: pd.DataFrame, + target_role_map: dict[str, str] | None = None, + *, + allow_role_proxy: bool = False, +) -> dict[str, Any]: + """Summarize observed samples by Pakistan hour and exact target.""" + if "time" not in observations or "rtt_ms" not in observations: + raise ValueError("calibration input must contain time and rtt_ms columns") + df = observations.copy() + df["time"] = pd.to_datetime(df.time, utc=True) + df["rtt_ms"] = pd.to_numeric(df.rtt_ms, errors="coerce") + for column in ("jitter_ms", "loss_pct"): + if column not in df: + df[column] = pd.NA + df[column] = pd.to_numeric(df[column], errors="coerce") + df["hour_pk"] = df.time.dt.tz_convert("Asia/Karachi").dt.hour + if "target" not in df: + df["target"] = "unknown" + df["target"] = df.target.astype(str) + roles = target_role_map or {} + if "target_role" not in df: + df["target_role"] = "unmapped_ripe_public_ping" + df["target_role"] = [ + roles.get(target, role) for target, role in zip(df.target, df.target_role, strict=True) + ] + + hourly = ( + df.groupby("hour_pk") + .agg( + rtt_ms=("rtt_ms", "median"), + jitter_ms=("jitter_ms", "median"), + loss_pct=("loss_pct", "median"), + sample_count=("rtt_ms", "count"), + ) + .reset_index() + ) + target_hourly_stats: dict[str, dict[str, dict[str, float | int]]] = {} + target_hourly: dict[str, dict[str, float]] = {} + for (target, hour), group in df.groupby(["target", "hour_pk"], dropna=True): + stats: dict[str, float | int] = {"sample_count": int(group.rtt_ms.count())} + for column in ("rtt_ms", "jitter_ms", "loss_pct"): + value = group[column].median() + if pd.notna(value): + stats[column] = float(value) + target_hourly_stats.setdefault(str(target), {})[str(int(hour))] = stats + if "rtt_ms" in stats: + target_hourly.setdefault(str(target), {})[str(int(hour))] = stats["rtt_ms"] + + target_medians = df.groupby("target").rtt_ms.median().dropna().astype(float).to_dict() + target_stats: dict[str, dict[str, float | int]] = {} + for target, group in df.groupby("target"): + stats: dict[str, float | int] = {"sample_count": int(group.rtt_ms.count())} + for column in ("rtt_ms", "jitter_ms", "loss_pct"): + value = group[column].median() + if pd.notna(value): + stats[column] = float(value) + target_stats[str(target)] = stats + target_roles: dict[str, str] = {} + for target, group in df.groupby("target"): + if target in roles: + target_roles[str(target)] = roles[target] + else: + observed = set(group.target_role.dropna().astype(str)) + if len(observed) == 1: + target_roles[str(target)] = next(iter(observed)) + role_medians: dict[str, dict[str, float | int]] = {} + role_hourly_stats: dict[str, dict[str, dict[str, float | int]]] = {} + mapped = df[df.target.isin(roles)].copy() + if not mapped.empty: + mapped["target_role"] = mapped.target.map(roles) + for role, group in mapped.groupby("target_role"): + role_stats: dict[str, float | int] = {"sample_count": int(group.rtt_ms.count())} + for column in ("rtt_ms", "jitter_ms", "loss_pct"): + value = group[column].median() + if pd.notna(value): + role_stats[column] = float(value) + role_medians[str(role)] = role_stats + for hour, hour_group in group.groupby("hour_pk"): + stats = {"sample_count": int(hour_group.rtt_ms.count())} + for column in ("rtt_ms", "jitter_ms", "loss_pct"): + value = hour_group[column].median() + if pd.notna(value): + stats[column] = float(value) + role_hourly_stats.setdefault(str(role), {})[str(int(hour))] = stats + observed_targets = set(df.target.astype(str)) + proxy_sources = sorted( + target + for target, role in roles.items() + if target in observed_targets and role == "public_dns_reachability_proxy" + ) + proxy_enabled = allow_role_proxy and bool(proxy_sources) + role_proxy = { + "enabled": proxy_enabled, + "role": "public_dns_reachability_proxy", + "source_targets": proxy_sources, + "configured_targets": ["1.1.1.1", "8.8.8.8"], + "opt_in_required": ["exact target-role map", "--allow-role-proxy"], + "uncertainty": ( + "These are public root-DNS-server ping paths. Their RTT, jitter, and loss are " + "reachability proxies, not DNS lookup timing or proof of route equivalence to " + "1.1.1.1 or 8.8.8.8." + ), + "status": ( + "enabled by explicit mapping and CLI flag" + if proxy_enabled + else "disabled; requires an explicit mapping and --allow-role-proxy" + ), + } + return { + "provenance": sorted(set(observations.source.astype(str))) + if "source" in observations + else ["unknown"], + "experimental_status": ( + "Hourly and target statistics are medians of observed samples only. " + "Target/hour RTTs apply only when configured target names match. " + "Role proxies require an explicit map and opt-in flag and are restricted to " + "configured public DNS reachability targets. Ping reachability is not DNS " + "resolution timing." + ), + "target_medians_ms": target_medians, + "target_stats": target_stats, + "target_hourly_ms": target_hourly, + "target_hourly_stats": target_hourly_stats, + "role_medians": role_medians, + "role_hourly_stats": role_hourly_stats, + "role_proxy": role_proxy, + "target_roles": target_roles, + "hourly": hourly.to_dict("records"), + } + + +def _write_calibration_report( + observations: pd.DataFrame, calibration: dict[str, Any], gaps: list[dict[str, Any]] +) -> str: + """Render measured coverage and explicit simulator-baseline mapping status.""" + from .simulator import TARGETS + + display = observations.copy() + for column in ("target", "rtt_ms", "loss_pct"): + if column not in display: + display[column] = pd.NA + display["target"] = display.target.fillna("unknown").astype(str) + times = pd.to_datetime(display.time, utc=True, errors="coerce").dropna() + targets = display.target.astype(str) + measurement_ids = ( + sorted(observations.measurement_id.dropna().astype(str).unique()) + if "measurement_id" in observations + else [] + ) + probes = ( + sorted(observations.probe_id.dropna().astype(str).unique()) + if "probe_id" in observations + else [] + ) + asns = ( + sorted(observations.probe_asn.dropna().astype(str).unique()) + if "probe_asn" in observations + else [] + ) + exact_targets = set(targets.unique()) & set(TARGETS) + proxy = calibration.get("role_proxy", {}) + proxy_role_stats = calibration.get("role_medians", {}).get("public_dns_reachability_proxy", {}) + span = f"{times.min().isoformat()} through {times.max().isoformat()}" if len(times) else "none" + rows = [ + "# RIPE calibration report", + "", + "This report summarizes downloaded public ping observations. The targets are " + "DNS-server " + "reachability probes; RTT is not DNS lookup latency.", + "", + "## Coverage", + "", + f"- Observations: {len(observations):,}", + f"- UTC coverage: {span}", + f"- Distinct UTC dates: {times.dt.floor('D').nunique() if len(times) else 0}", + f"- Measurement IDs: {', '.join(measurement_ids) if measurement_ids else 'none'}", + f"- Probe IDs: {', '.join(probes) if probes else 'none'}", + f"- Probe ASNs: {', '.join(asns) if asns else 'none'}", + "", + "| Public ping target | Rows | Median RTT (ms) | Median loss (%) | " + "Pakistan hours observed |", + "|---|---:|---:|---:|---:|", + ] + for target, group in display.groupby("target", dropna=False): + rtt = pd.to_numeric(group.rtt_ms, errors="coerce") + loss = pd.to_numeric(group.loss_pct, errors="coerce") + local_hours = pd.to_datetime(group.time, utc=True).dt.tz_convert("Asia/Karachi").dt.hour + rows.append( + f"| {target} | {len(group):,} | {rtt.median():.2f} | " + f"{loss.median():.2f} | {local_hours.nunique()}/24 |" + ) + rows.extend( + [ + "", + "| Measurement ID | Rows | UTC dates covered | Targets |", + "|---:|---:|---:|---|", + ] + ) + if "measurement_id" in observations: + for measurement_id, group in display.groupby("measurement_id", dropna=False): + dates = pd.to_datetime(group.time, utc=True).dt.floor("D").nunique() + target_names = ", ".join(sorted(group.target.astype(str).unique())) + rows.append(f"| {measurement_id} | {len(group):,} | {dates} | {target_names} |") + rows.extend( + [ + "", + "## Calibration use and gaps", + "", + f"- Exact configured simulator target matches: {len(exact_targets)}/{len(TARGETS)} " + f"({', '.join(sorted(exact_targets)) if exact_targets else 'none'}).", + "- Public DNS role-proxy transfer: " + f"{'enabled' if proxy.get('enabled') else 'disabled'}.", + f"- Explicit source targets: {', '.join(proxy.get('source_targets', [])) or 'none'}.", + "- Proxy destination targets: " + f"{', '.join(proxy.get('configured_targets', [])) or 'none'}.", + "- Exact target calibration takes precedence. Role proxy can fill only " + "unmatched configured public DNS targets (`1.1.1.1`, `8.8.8.8`); it never " + "changes gateway, upstream-hop, regional-game, or DNS resolution timing.", + "- Role medians (only when explicitly mapped): " + f"RTT {proxy_role_stats.get('rtt_ms', 'n/a')} ms, " + f"jitter {proxy_role_stats.get('jitter_ms', 'n/a')} ms, " + f"loss {proxy_role_stats.get('loss_pct', 'n/a')}%, " + f"n={proxy_role_stats.get('sample_count', 0):,}.", + f"- Transfer uncertainty: {proxy.get('uncertainty', 'No role transfer enabled.')}", + "- The requested window covers seven UTC days. Daily failures remain in " + "`data/ripe-baseline-summary.json`; they are not imputed.", + f"- Failed daily requests recorded in the fetch summary: {len(gaps)}.", + "- Proxy source samples are restricted to exact observed target strings in the " + "supplied map; provider role labels alone never authorize transfer.", + "", + "Pakistan-hour target and role medians are stored in ignored `data/calibration.json`. " + "Role transfer is off by default and requires both an exact-target role map and " + "`--allow-role-proxy`.", + "", + ] + ) + if gaps: + rows.extend(["", "Failed daily requests:"]) + for gap in gaps: + stamp = pd.to_datetime(gap.get("start"), unit="s", utc=True).date() + rows.append( + f"- {stamp}, measurement {gap.get('measurement')}: " + f"{gap.get('error', 'request failed')}" + ) + role_hours = calibration.get("role_hourly_stats", {}).get("public_dns_reachability_proxy", {}) + if role_hours: + rows.extend( + [ + "", + "## Explicit role-proxy statistics by Pakistan hour", + "", + "| Hour PK | Median RTT (ms) | Median jitter (ms) | " + "Median loss (%) | RTT samples |", + "|---:|---:|---:|---:|---:|", + ] + ) + for hour, stats in sorted(role_hours.items(), key=lambda item: int(item[0])): + rows.append( + f"| {hour} | {stats.get('rtt_ms', 'n/a')} | " + f"{stats.get('jitter_ms', 'n/a')} | {stats.get('loss_pct', 'n/a')} | " + f"{stats.get('sample_count', 0):,} |" + ) + return "\n".join(rows) + + +def _write( + p: pd.DataFrame, + i: pd.DataFrame, + labels: list[dict[str, Any]], + directory: Path, + supplemental: pd.DataFrame | None = None, +) -> None: + directory.mkdir(parents=True, exist_ok=True) + p.to_parquet(directory / "probe_metrics.parquet", index=False) + i.to_parquet(directory / "iface_metrics.parquet", index=False) + pd.DataFrame(labels).to_json( + directory / "scenario_labels.json", + orient="records", + date_format="iso", + indent=2, + ) + (directory / "generation_metadata.json").write_text( + json.dumps( + { + "source": "sim", + "calibration": p.attrs.get("calibration", {}), + }, + indent=2, + ), + encoding="utf-8", + newline="\n", + ) + if supplemental is not None: + supplemental.to_parquet(directory / "supplemental_experimental.parquet", index=False) + + +def _load_database(p: pd.DataFrame, i: pd.DataFrame, source: str) -> None: + if not os.getenv("NETCORTEX_DB_KEYS_CONFIRMED") == "1": + raise RuntimeError( + "Database load disabled until Aun confirms repeat-safe database keys; " + "set NETCORTEX_DB_KEYS_CONFIRMED=1 only after the contract is published" + ) + dsn = os.getenv("DATABASE_URL") + if not dsn: + raise RuntimeError("DATABASE_URL is required") + import psycopg + + with psycopg.connect(dsn) as conn, conn.transaction(): + # The approved conflict keys are intentionally a gate. Never guess table keys. + raise RuntimeError( + "Core table key/upsert contract is not yet confirmed; no rows were written" + ) + + +def _read_source( + source: str, last: str, *, include_injections: bool = False +) -> tuple[pd.DataFrame, pd.DataFrame]: + base = ROOT / "data/generated" + if source == "sim": + p = pd.read_parquet(base / "probe_metrics.parquet") + i = pd.read_parquet(base / "iface_metrics.parquet") + elif source == "ripe": + path = ROOT / "data/raw/ripe/results.parquet" + if not path.exists(): + raise FileNotFoundError("RIPE results are missing; run `simgen ripe` first") + p = pd.read_parquet(path) + i = pd.DataFrame( + columns=[ + "time", + "site_id", + "iface", + "rx_bps", + "tx_bps", + "util_pct", + "drops", + "errors", + "source", + ] + ) + else: + raise ValueError(f"unsupported source: {source}") + if include_injections and source == "sim": + folder = base / "injections" + registry = folder / "active_scenarios.json" + if registry.exists(): + for item in json.loads(registry.read_text(encoding="utf-8")): + key = item["id"] + pp, ii = ( + folder / f"{key}-probe.parquet", + folder / f"{key}-iface.parquet", + ) + if pp.exists(): + p = pd.concat([p, pd.read_parquet(pp)], ignore_index=True) + if ii.exists(): + i = pd.concat([i, pd.read_parquet(ii)], ignore_index=True) + amount = last.strip().lower() + if amount.endswith("d"): + delta = pd.Timedelta(days=float(amount[:-1])) + elif amount.endswith("h"): + delta = pd.Timedelta(hours=float(amount[:-1])) + else: + raise ValueError("--last must be a duration such as 2d or 12h") + if delta <= pd.Timedelta(0): + raise ValueError("--last must be positive") + if len(p) and "time" in p: + edge = pd.to_datetime(p.time, utc=True).max() - delta + p = p[pd.to_datetime(p.time, utc=True) >= edge] + if len(i) and "time" in i: + i = i[pd.to_datetime(i.time, utc=True) >= edge] + return p, i + + +def build_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + prog="simgen", description="NetCortex deterministic telemetry fixtures" + ) + subs = parser.add_subparsers(dest="command", required=True) + ripe = subs.add_parser("ripe") + ripe.add_argument("--days", type=int, default=14) + ripe.add_argument("--max-probes", type=int, default=5) + ripe.add_argument("--max-measurements", type=int, default=5) + ripe.add_argument("--mock", action="store_true") + cal = subs.add_parser("calibrate") + cal.add_argument("--mock", action="store_true") + cal.add_argument( + "--target-role-map", + type=Path, + help="JSON mapping exact observed ping targets to operator-approved ping roles", + ) + cal.add_argument( + "--allow-role-proxy", + action="store_true", + help=( + "opt in to using explicitly mapped public DNS reachability-role statistics " + "for configured public DNS targets" + ), + ) + gen = subs.add_parser("generate") + gen.add_argument("--days", type=int, default=7) + gen.add_argument("--seed", type=int, default=42) + gen.add_argument("--normal-only", action="store_true") + gen.add_argument("--mock", action="store_true") + load = subs.add_parser("load") + load.add_argument("--source", default="sim", choices=["sim", "ripe"]) + load.add_argument("--last", default="2d") + load.add_argument("--mock", action="store_true") + replay = subs.add_parser("replay") + replay.add_argument("--speed", type=float, default=1) + replay.add_argument("--mock", action="store_true") + replay.add_argument("--limit", type=int) + inj = subs.add_parser("inject") + inj.add_argument("--site", required=True) + inj.add_argument("--type", required=True, choices=CAUSES) + inj.add_argument("--duration", type=int, default=15) + inj.add_argument("--seed", type=int, default=42) + inj.add_argument("--mock", action="store_true") + ev = subs.add_parser("eval-cases") + ev.add_argument( + "--n", + type=int, + default=80, + help="held-out test cases per split; multiple of eight, including normal", + ) + ev.add_argument("--seed", type=int, default=1000) + ev.add_argument("--mock", action="store_true") + return parser + + +def main(argv: list[str] | None = None) -> int: + args = build_parser().parse_args(argv) + mock = getattr(args, "mock", False) + if args.command == "ripe": + if mock: + raise SystemExit( + "RIPE fixture fetch has no bundled real-observation fixture; " + "use an explicit recorded fixture" + ) + frame = fetch_ripe( + args.days, + ROOT / "data/raw/ripe/results.parquet", + max_probes=args.max_probes, + max_measurements=args.max_measurements, + ) + if len(frame): + lo = pd.to_datetime(frame.time, utc=True).min().isoformat() + hi = pd.to_datetime(frame.time, utc=True).max().isoformat() + probes = frame.probe_id.nunique() if "probe_id" in frame else 0 + asns = frame.probe_asn.nunique() if "probe_asn" in frame else 0 + print( + f"Fetched {len(frame)} RIPE rows from {probes} probes/{asns} ASNs; " + f"coverage {lo} to {hi}; source provenance retained" + ) + else: + print("RIPE discovery completed but returned no matching result rows") + elif args.command == "calibrate": + if mock: + raise SystemExit( + "`calibrate --mock` is unavailable: no mock observations are bundled; " + "calibration will never substitute invented data" + ) + paths = [ + ROOT / "data/raw/ripe/results.parquet", + ROOT / "data/raw/live/collector.parquet", + ] + frames = [pd.read_parquet(path) for path in paths if path.exists()] + if not frames: + raise SystemExit( + "No RIPE/live rows available. Calibration not written; " + "defaults remain simulator assumptions." + ) + df = pd.concat(frames, ignore_index=True) + role_map = _read_target_role_map(args.target_role_map) + if args.allow_role_proxy and not role_map: + raise SystemExit( + "--allow-role-proxy requires --target-role-map with explicit role entries" + ) + if args.allow_role_proxy and "public_dns_reachability_proxy" not in role_map.values(): + raise SystemExit( + "--allow-role-proxy requires at least one exact target mapped to " + "public_dns_reachability_proxy" + ) + calibration = _build_calibration( + df, + role_map, + allow_role_proxy=args.allow_role_proxy, + ) + calibration["observation_count"] = len(df) + calibration["input_files"] = [ + str(path.relative_to(ROOT)) for path in paths if path.exists() + ] + times = pd.to_datetime(df.time, utc=True, errors="coerce").dropna() + calibration["time_range_utc"] = ( + {"start": times.min().isoformat(), "end": times.max().isoformat()} + if len(times) + else None + ) + out = ROOT / "data/calibration.json" + out.parent.mkdir(parents=True, exist_ok=True) + out.write_text(json.dumps(calibration, indent=2), encoding="utf-8", newline="\n") + summary_path = ROOT / "data/ripe-baseline-summary.json" + summary = ( + json.loads(summary_path.read_text(encoding="utf-8")) if summary_path.exists() else {} + ) + gaps = summary.get("failures", []) if isinstance(summary, dict) else [] + report = _write_calibration_report(df, calibration, gaps) + (ROOT / "data/calibration-report.md").write_text(report, encoding="utf-8", newline="\n") + configured_targets = {target for site in sites()["sites"] for target in site["targets"]} + matched_targets = ( + set(df.target.astype(str)) & configured_targets if "target" in df else set() + ) + print( + f"Calibrated from {len(df):,} observed rows; exact configured target matches: " + f"{len(matched_targets)}. " + "See data/calibration-report.md for coverage and gaps." + ) + elif args.command == "generate": + p, i, labels = generate(args.days, args.seed, normal_only=args.normal_only) + extra = generate_supplemental( + labels, + start=pd.to_datetime(p.time, utc=True).min().to_pydatetime(), + end=pd.to_datetime(p.time, utc=True).max().to_pydatetime(), + seed=args.seed, + site_ids=[s["id"] for s in sites()["sites"]], + ) + _write(p, i, labels, ROOT / "data/generated", extra) + print(f"Wrote {len(p)} probe and {len(i)} interface rows") + elif args.command == "inject": + p, i, label = inject_frames(args.site, args.type, args.duration, args.seed) + p = p[(p.time >= label["start"]) & (p.time < label["end"])].copy() + i = i[(i.time >= label["start"]) & (i.time < label["end"])].copy() + folder = ROOT / "data/generated/injections" + folder.mkdir(parents=True, exist_ok=True) + key = f"{args.site}-{args.type}-{args.seed}" + p.to_parquet(folder / f"{key}-probe.parquet", index=False) + i.to_parquet(folder / f"{key}-iface.parquet", index=False) + generate_supplemental( + [label], + start=p.time.min().to_pydatetime(), + end=p.time.max().to_pydatetime(), + seed=args.seed, + site_ids=[args.site], + ).to_parquet(folder / f"{key}-supplemental.parquet", index=False) + labels_path = folder / "active_scenarios.json" + labels = json.loads(labels_path.read_text(encoding="utf-8")) if labels_path.exists() else [] + labels = [x for x in labels if x.get("id") != key] + labels.append( + { + "id": key, + "calibration": p.attrs.get("calibration", {}), + **label, + "start": label["start"].isoformat(), + "end": label["end"].isoformat(), + } + ) + labels_path.write_text(json.dumps(labels, indent=2), encoding="utf-8") + print( + f"Fixture persisted as {key}; core injection/persistence unavailable " + "until its lifecycle contract is published" + ) + elif args.command == "load": + p, i = _read_source(args.source, args.last) + if mock: + print( + f"Mock load validated {len(p)} {args.source} probe rows and " + f"{len(i)} interface rows; no database writes" + ) + else: + _load_database(p, i, args.source) + elif args.command == "replay": + if args.speed <= 0: + raise SystemExit("--speed must be > 0") + p, i = _read_source("sim", "365d", include_injections=True) + p = p.sort_values("time") + i = i.sort_values("time") + # Speed 1 uses wall-clock time; larger values advance a virtual clock. + if args.limit: + p = p.head(args.limit) + i = i[i.time <= p.time.max()] + prev = None + for _, row in p.iterrows(): + stamp = pd.Timestamp(row.time).to_pydatetime() + if prev is not None and not mock and args.speed == 1: + time.sleep(min(30, max(0, (stamp - prev).total_seconds()))) + prev = stamp + if not mock: + _load_database(p, i, "sim") + active = ROOT / "data/generated/injections/active_scenarios.json" + active_count = len(json.loads(active.read_text(encoding="utf-8"))) if active.exists() else 0 + print( + f"Replay consumed {len(p)} probes and {len(i)} interfaces in time order; " + f"active injections={active_count}, virtual speed={args.speed}" + ) + elif args.command == "eval-cases": + make_eval_cases(args.n, args.seed, ROOT / "eval/cases") + return 0 + + +def make_eval_cases(n: int, seed: int, out: Path) -> None: + if n < 8 or n % 8: + raise ValueError( + "--n must be a positive multiple of eight so all seven causes and normal are balanced" + ) + out.mkdir(parents=True, exist_ok=True) + base_causes = ["normal", *CAUSES] + for split_index, split in enumerate(("train", "validation", "test")): + split_seed = seed + split_index * 1_000_000 + rng = np.random.default_rng(split_seed) + case_types = base_causes * (n // len(base_causes)) + rng.shuffle(case_types) + sites = ["north-tower", "market-cafe", "east-relay"] + split_start = datetime(2026, 1, 1, tzinfo=UTC) + timedelta(days=split_index * (n * 2 + 60)) + for idx, cause in enumerate(case_types): + case_seed = split_seed + int(rng.integers(1, 900_000)) + site = sites[int(rng.integers(0, len(sites)))] + start = split_start + timedelta(days=idx * 2) + p, i, labels = generate( + days=1, + hours=3, + seed=case_seed, + start=start, + scenario_type=None if cause == "normal" else cause, + normal_only=cause == "normal", + site_id=site, + ) + label = ( + labels[0] + if labels + else { + "site_id": site, + "start": None, + "end": None, + "cause": "normal", + "template_id": "none", + "params": {}, + } + ) + as_of = ( + (label["end"] - timedelta(seconds=10)) + if label["end"] + else (start + timedelta(hours=3) - timedelta(seconds=10)) + ) + window_start = as_of - timedelta(minutes=30) + p = p[p.time <= as_of].copy() + i = i[i.time <= as_of].copy() + folder = out / split + folder.mkdir(exist_ok=True) + caseid = f"{split}-case-{idx:03d}" + p.to_parquet(folder / f"{caseid}-probe.parquet", index=False) + i.to_parquet(folder / f"{caseid}-iface.parquet", index=False) + supplemental = generate_supplemental( + labels, + start=start, + end=as_of, + seed=case_seed, + site_ids=[site], + ) + supplemental.to_parquet(folder / f"{caseid}-supplemental.parquet", index=False) + record = { + "case_id": caseid, + "split": split, + "seed": case_seed, + "site_id": site, + "case_start": start.isoformat(), + "event_start": label["start"].isoformat() if label["start"] else None, + "event_end": label["end"].isoformat() if label["end"] else None, + "as_of": as_of.isoformat(), + "history_window": { + "start": start.isoformat(), + "end_exclusive": window_start.isoformat(), + }, + "detection_window": { + "start": window_start.isoformat(), + "end_inclusive": as_of.isoformat(), + }, + "expected": { + "cause": label["cause"], + "template_id": label["template_id"], + "params": label["params"], + }, + "calibration": p.attrs.get("calibration", {}), + "observations": { + "probe": f"{caseid}-probe.parquet", + "iface": f"{caseid}-iface.parquet", + "supplemental": f"{caseid}-supplemental.parquet", + }, + } + (folder / f"{caseid}.json").write_text(json.dumps(record, indent=2), encoding="utf-8") + print(f"Wrote {n} cases per split (train, validation, held-out test) to {out}") + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packages/simgen/src/netcortex_simgen/resources/sites.yaml b/packages/simgen/src/netcortex_simgen/resources/sites.yaml new file mode 100644 index 0000000..753747e --- /dev/null +++ b/packages/simgen/src/netcortex_simgen/resources/sites.yaml @@ -0,0 +1,26 @@ +timezone: Asia/Karachi +sites: + - id: north-tower + name: North Tower + subscribers: 120 + uplinks: + - {interface: ether1, role: primary, capacity_mbps: 180} + backup_uplink: {interface: ether2, role: backup, capacity_mbps: 80} + backhauls: [{interface: wlan1, role: backhaul, capacity_mbps: 120}] + targets: [gateway, upstream-hop, 1.1.1.1, 8.8.8.8, regional-game] + - id: market-cafe + name: Market Cafe + subscribers: 48 + uplinks: + - {interface: ether1, role: primary, capacity_mbps: 100} + backup_uplink: null + backhauls: [{interface: wlan1, role: backhaul, capacity_mbps: 80}] + targets: [gateway, upstream-hop, 1.1.1.1, 8.8.8.8, regional-game] + - id: east-relay + name: East Relay + subscribers: 165 + uplinks: + - {interface: ether1, role: primary, capacity_mbps: 250} + backup_uplink: {interface: ether2, role: backup, capacity_mbps: 100} + backhauls: [{interface: wlan1, role: backhaul, capacity_mbps: 150}, {interface: wlan2, role: backhaul, capacity_mbps: 100}] + targets: [gateway, upstream-hop, 1.1.1.1, 8.8.8.8, regional-game] diff --git a/packages/simgen/src/netcortex_simgen/ripe.py b/packages/simgen/src/netcortex_simgen/ripe.py new file mode 100644 index 0000000..0c88808 --- /dev/null +++ b/packages/simgen/src/netcortex_simgen/ripe.py @@ -0,0 +1,370 @@ +from __future__ import annotations + +import hashlib +import json +import time +import warnings +from pathlib import Path +from typing import Any + +import httpx +import pandas as pd + +API = "https://atlas.ripe.net/api/v2" +MAX_RAW_RESULT_ROWS_PER_MEASUREMENT = 50_000 +MAX_RAW_RESULT_ROWS_PER_DAY = 10_000 +MAX_SELECTED_ROWS_PER_MEASUREMENT = 50_000 +MAX_RESPONSE_BYTES = 8 * 1024 * 1024 +REQUEST_PAUSE_SECONDS = 0.25 + + +def parse_result(item: dict[str, Any], *, site_id: str = "ripe-pk") -> dict[str, Any] | None: + """Parse one RIPE ping result without treating missing RTTs as successful.""" + timestamp = item.get("timestamp") + if not isinstance(timestamp, (int, float)): + return None + raw = item.get("avg") + sent = item.get("sent") + rtts = item.get("result", item.get("rtts")) + if isinstance(rtts, list): + vals = [ + float(v["rtt"]) + for v in rtts + if isinstance(v, dict) and isinstance(v.get("rtt"), (int, float)) and v["rtt"] >= 0 + ] + received = len(vals) + sent = sent if isinstance(sent, (int, float)) and sent > 0 else len(rtts) + avg = sum(vals) / received if received else None + jitter = float(pd.Series(vals).std(ddof=0)) if received else None + else: + received = item.get("rcvd") + avg = float(raw) if isinstance(raw, (int, float)) and raw >= 0 else None + jitter = None + if not isinstance(received, (int, float)) and isinstance(sent, (int, float)): + received = 1 if avg is not None else 0 + if not isinstance(received, (int, float)) or not isinstance(sent, (int, float)) or sent <= 0: + return None + return { + "time": pd.to_datetime(timestamp, unit="s", utc=True), + "site_id": site_id, + "target": str(item.get("dst_addr", "unknown")), + "rtt_ms": avg, + "jitter_ms": jitter, + "loss_pct": max(0.0, min(100.0, (sent - received) / sent * 100)), + "source": "ripe", + "measurement_id": item.get("msm_id"), + "probe_id": item.get("prb_id"), + "probe_asn": item.get("probe_asn"), + "measurement_target": item.get("measurement_target"), + "target_role": item.get("target_role", "unmapped_ripe_public_ping"), + } + + +def _diverse_probes(probes: list[dict[str, Any]], limit: int) -> list[dict[str, Any]]: + """Choose a bounded set of active probes spanning ASNs where possible.""" + selected: list[dict[str, Any]] = [] + seen_asns = set() + for probe in probes: + asn = probe.get("asn_v4") or probe.get("asn_v6") + if asn not in seen_asns: + selected.append(probe) + seen_asns.add(asn) + if len(selected) >= limit: + return selected + selected_ids = {probe.get("id") for probe in selected} + for probe in probes: + if probe.get("id") not in selected_ids: + selected.append(probe) + if len(selected) >= limit: + break + return selected + + +def _pages( + client: httpx.Client, + url: str, + params: dict[str, Any], + page_limit: int = 20, + *, + deadline: float | None = None, + row_limit: int = MAX_RAW_RESULT_ROWS_PER_MEASUREMENT, +): + row_count = 0 + for _ in range(page_limit): + timeout = 15.0 + if deadline is not None: + remaining = deadline - time.monotonic() + if remaining <= 0: + raise TimeoutError("RIPE fetch deadline elapsed") + timeout = min(timeout, remaining) + request_timeout = httpx.Timeout(timeout, connect=min(5.0, timeout)) + try: + response = client.get(url, params=params, timeout=request_timeout) + finally: + # Preserve the request gap even when a provider request times out. + time.sleep(REQUEST_PAUSE_SECONDS) + response.raise_for_status() + if len(response.content) > MAX_RESPONSE_BYTES: + raise RuntimeError(f"RIPE response exceeded the {MAX_RESPONSE_BYTES}-byte bound") + body = response.json() + # Atlas measurement-results endpoints can return a bare array while + # discovery endpoints use the paginated {results, next} envelope. + if isinstance(body, list): + if len(body) > row_limit: + raise RuntimeError( + f"RIPE result array exceeds the configured {row_limit}-row bound" + ) + yield from body + return + if not isinstance(body, dict) or not isinstance(body.get("results"), list): + raise TypeError("Unexpected RIPE Atlas paginated response") + row_count += len(body["results"]) + if row_count > row_limit: + raise RuntimeError( + f"RIPE paginated result exceeded the configured {row_limit}-row bound" + ) + yield from body["results"] + nxt = body.get("next") + if not nxt: + return + url, params = nxt, {} + raise RuntimeError(f"RIPE Atlas pagination exceeded bounded page limit {page_limit}") + + +def fetch( + days: int = 14, + out: Path | None = None, + cache_dir: Path | None = None, + *, + client: httpx.Client | None = None, + page_limit: int = 20, + max_measurements: int = 5, + max_probes: int = 5, + deadline_seconds: float = 300.0, +) -> pd.DataFrame: + """Fetch daily RIPE snapshots for selected Pakistani probes and public ping measurements.""" + if ( + not 1 <= days <= 30 + or not 1 <= max_measurements <= 20 + or not 1 <= max_probes <= 20 + or not 1 <= deadline_seconds <= 1800 + ): + raise ValueError("days must be 1..30; probe and measurement limits must be 1..20") + cache_dir = cache_dir or Path("data/raw/ripe/cache") + cache_dir.mkdir(parents=True, exist_ok=True) + own = client is None + client = client or httpx.Client( + timeout=httpx.Timeout(15.0, connect=5.0), + headers={"User-Agent": "NetCortex-simgen/0.1"}, + ) + deadline = time.monotonic() + deadline_seconds + try: + probes = list( + _pages( + client, + f"{API}/probes/", + {"country_code": "PK", "status": 1, "page_size": 3}, + page_limit, + deadline=deadline, + ) + ) + chosen = _diverse_probes(probes, max_probes) + ids = [int(p["id"]) for p in chosen if p.get("id") is not None] + asns = { + int(p["id"]): p.get("asn_v4") or p.get("asn_v6") + for p in chosen + if p.get("id") is not None + } + if not ids: + frame = pd.DataFrame( + columns=[ + "time", + "site_id", + "target", + "rtt_ms", + "jitter_ms", + "loss_pct", + "source", + ] + ) + report = { + "status": "no_active_probes", + "days_requested": days, + "probe_ids": [], + "measurement_ids": [], + "daily_measurement_requests": 0, + "completed_daily_measurement_requests": 0, + "failed_daily_measurement_requests": [], + } + frame.attrs["ripe_fetch_report"] = report + if out: + out.parent.mkdir(parents=True, exist_ok=True) + frame.to_parquet(out, index=False) + out.with_name(out.stem + ".fetch-report.json").write_text( + json.dumps(report, indent=2), encoding="utf-8" + ) + return frame + measurements = list( + _pages( + client, + f"{API}/measurements/", + {"type": "ping", "is_public": "true", "status": 2, "page_size": 2}, + page_limit, + deadline=deadline, + ) + ) + measurement_ids = list( + dict.fromkeys(int(m["id"]) for m in measurements if m.get("id") is not None) + )[:max_measurements] + targets = { + int(m["id"]): m.get("target_ip") or m.get("target") + for m in measurements + if m.get("id") is not None + } + # Use completed UTC days so each successful result snapshot is cacheable. + now = int(time.time() // 86400 * 86400) + begin = now - days * 86400 + selected_probes = sorted(ids) + probe_hash = hashlib.sha256( + ",".join(map(str, selected_probes)).encode("ascii") + ).hexdigest()[:12] + report: dict[str, Any] = { + "status": "complete" if measurement_ids else "no_measurements", + "days_requested": days, + "window_start": begin, + "window_end_exclusive": now, + "probe_ids": selected_probes, + "measurement_ids": measurement_ids, + "daily_measurement_requests": 0, + "completed_daily_measurement_requests": 0, + "failed_daily_measurement_requests": [], + "days": {}, + } + rows = [] + selected_counts = {mid: 0 for mid in measurement_ids} + for mid in measurement_ids: + for day_index in range(days): + start = begin + day_index * 86400 + stop = start + 86400 + day_key = time.strftime("%Y-%m-%d", time.gmtime(start)) + day = report["days"].setdefault( + day_key, + {"status": "complete", "measurements": {}, "errors": [], "selected_rows": 0}, + ) + report["daily_measurement_requests"] += 1 + cache = cache_dir / f"measurement-{mid}-{start}-{stop}-probes-{probe_hash}.json" + try: + if cache.exists(): + items = json.loads(cache.read_text(encoding="utf-8")) + if not isinstance(items, list): + raise ValueError("cached RIPE result is not a list") + else: + if time.monotonic() >= deadline: + raise TimeoutError( + "RIPE fetch deadline elapsed before daily result request" + ) + items = list( + _pages( + client, + f"{API}/measurements/{mid}/results/", + { + "start": start, + "stop": stop, + "probe_ids": ",".join(map(str, selected_probes)), + "page_size": 1000, + }, + page_limit, + deadline=deadline, + row_limit=MAX_RAW_RESULT_ROWS_PER_DAY, + ) + ) + temporary = cache.with_suffix(cache.suffix + ".part") + temporary.write_text(json.dumps(items), encoding="utf-8") + temporary.replace(cache) + report["completed_daily_measurement_requests"] += 1 + selected = [] + for item in items: + try: + probe_id = int(item.get("prb_id")) + except (TypeError, ValueError): + continue + if probe_id in asns: + selected.append((item, probe_id)) + remaining = MAX_SELECTED_ROWS_PER_MEASUREMENT - selected_counts[mid] + if len(selected) > remaining: + warnings.warn( + f"RIPE measurement {mid} exceeded its " + f"{MAX_SELECTED_ROWS_PER_MEASUREMENT}-row " + "selection bound; retaining the earliest bounded sample", + stacklevel=2, + ) + selected = selected[: max(remaining, 0)] + selected_counts[mid] += len(selected) + day["measurements"][str(mid)] = { + "status": "complete", + "raw_rows": len(items), + "selected_probe_rows": len(selected), + } + day["selected_rows"] += len(selected) + for item, probe_id in selected: + parsed = parse_result( + { + **item, + "msm_id": mid, + "probe_asn": asns.get(probe_id), + "measurement_target": targets.get(mid), + "target_role": "unmapped_ripe_public_ping", + } + ) + if parsed: + rows.append(parsed) + except ( + httpx.HTTPError, + OSError, + RuntimeError, + TypeError, + ValueError, + TimeoutError, + ) as exc: + message = f"{type(exc).__name__}: {exc}" + day["status"] = "partial" if day["measurements"] else "failed" + day["errors"].append({"measurement_id": mid, "error": message}) + day["measurements"][str(mid)] = {"status": "failed", "error": message} + report["failed_daily_measurement_requests"].append( + {"date": day_key, "measurement_id": mid, "error": message} + ) + if report["failed_daily_measurement_requests"]: + report["status"] = ( + "partial" if report["completed_daily_measurement_requests"] else "failed" + ) + for day in report["days"].values(): + outcomes = [item["status"] for item in day["measurements"].values()] + failures = outcomes.count("failed") + successes = outcomes.count("complete") + if failures and successes: + day["status"] = "partial" + elif failures: + day["status"] = "failed" + elif successes: + day["status"] = "complete" + else: + day["status"] = "no_measurements" + frame = pd.DataFrame(rows) + frame.attrs["ripe_fetch_report"] = report + if out: + out.parent.mkdir(parents=True, exist_ok=True) + frame.to_parquet(out, index=False) + report_path = out.with_name(out.stem + ".fetch-report.json") + report_path.write_text(json.dumps(report, indent=2), encoding="utf-8") + if ( + report["daily_measurement_requests"] + and not report["completed_daily_measurement_requests"] + ): + raise RuntimeError( + "All RIPE daily result requests failed; inspect " + f"{out.with_name(out.stem + '.fetch-report.json') if out else 'the fetch report'}" + ) + return frame + finally: + if own: + client.close() diff --git a/packages/simgen/src/netcortex_simgen/simulator.py b/packages/simgen/src/netcortex_simgen/simulator.py new file mode 100644 index 0000000..55186cd --- /dev/null +++ b/packages/simgen/src/netcortex_simgen/simulator.py @@ -0,0 +1,641 @@ +from __future__ import annotations + +import json +from datetime import UTC, datetime, timedelta +from importlib.resources import files +from pathlib import Path +from typing import TYPE_CHECKING, Any + +import numpy as np +import pandas as pd +import yaml + +if TYPE_CHECKING: + from netcortex_core import Cause, ScenarioLabel + + +def _find_workspace_root() -> Path: + for parent in Path(__file__).resolve().parents: + if (parent / "data/sites.yaml").is_file(): + return parent + return Path.cwd() + + +ROOT = _find_workspace_root() +CAUSES = ( + "uplink_congestion", + "heavy_user", + "upstream_degradation", + "game_route_issue", + "wireless_interference", + "uplink_down", + "dns_slow", +) +TEMPLATES = { + "uplink_congestion": "priority_queue", + "heavy_user": "queue_limit", + "upstream_degradation": "none", + "game_route_issue": "none", + "wireless_interference": "none", + "uplink_down": "failover_route", + "dns_slow": "dns_servers", +} +TARGETS = ("gateway", "upstream-hop", "1.1.1.1", "8.8.8.8", "regional-game") +PUBLIC_DNS_TARGETS = frozenset({"1.1.1.1", "8.8.8.8"}) +DEFAULT_BASELINES = { + "gateway": 1.8, + "upstream-hop": 8.0, + "1.1.1.1": 28.0, + "8.8.8.8": 35.0, + "regional-game": 42.0, +} +DEFAULT_JITTER_MS = 1.0 + + +def sites() -> dict[str, Any]: + path = ROOT / "data/sites.yaml" + if path.is_file(): + with path.open(encoding="utf-8") as f: + return yaml.safe_load(f) + with files("netcortex_simgen").joinpath("resources/sites.yaml").open(encoding="utf-8") as f: + return yaml.safe_load(f) + + +def _utc(value: datetime) -> datetime: + if value.tzinfo is None: + raise ValueError("start must be timezone-aware") + return value.astimezone(UTC) + + +def _baseline_profiles() -> tuple[ + dict[str, dict[str, float]], + dict[str, dict[int, dict[str, float]]], + dict[str, Any], +]: + """Resolve exact target calibration and explicitly enabled DNS role proxies.""" + path = ROOT / "data/calibration.json" + payload: dict[str, Any] = {} + if path.exists(): + try: + payload = json.loads(path.read_text(encoding="utf-8")) + except (OSError, ValueError, TypeError): + payload = {} + + target_medians = payload.get("target_medians_ms", {}) + exact_hourly = payload.get("target_hourly_stats", {}) + exact_hourly_rtt = payload.get("target_hourly_ms", {}) + role_proxy = payload.get("role_proxy", {}) + role_medians = payload.get("role_medians", {}) + role_hourly = payload.get("role_hourly_stats", {}) + profiles = { + target: { + "rtt_ms": DEFAULT_BASELINES[target], + "jitter_ms": DEFAULT_JITTER_MS, + "loss_pct": 0.0, + } + for target in TARGETS + } + hourly: dict[str, dict[int, dict[str, float]]] = {} + exact_targets: set[str] = set() + + for target in TARGETS: + median = target_medians.get(target) + if isinstance(median, (float, int)): + profiles[target]["rtt_ms"] = float(median) + exact_targets.add(target) + target_stats = payload.get("target_stats", {}).get(target, {}) + if isinstance(target_stats, dict): + for metric in ("rtt_ms", "jitter_ms", "loss_pct"): + if isinstance(target_stats.get(metric), (float, int)): + profiles[target][metric] = float(target_stats[metric]) + exact_targets.add(target) + hourly[target] = {} + for hour, stats in exact_hourly.get(target, {}).items(): + if not isinstance(stats, dict): + continue + values = { + metric: float(stats[metric]) + for metric in ("rtt_ms", "jitter_ms", "loss_pct") + if isinstance(stats.get(metric), (float, int)) + } + if values: + hourly[target][int(hour)] = values + exact_targets.add(target) + for hour, value in exact_hourly_rtt.get(target, {}).items(): + if isinstance(value, (float, int)): + hourly[target].setdefault(int(hour), {})["rtt_ms"] = float(value) + exact_targets.add(target) + + configured_source_targets = role_proxy.get("source_targets", []) + target_roles = payload.get("target_roles", {}) + verified_source_targets = [ + target + for target in configured_source_targets + if isinstance(target, str) and target_roles.get(target) == "public_dns_reachability_proxy" + ] + explicit_proxy = ( + role_proxy.get("enabled") is True + and role_proxy.get("role") == "public_dns_reachability_proxy" + and bool(verified_source_targets) + ) + applied_targets: list[str] = [] + source_targets = verified_source_targets if explicit_proxy else [] + proxy_role = "public_dns_reachability_proxy" + role_median = role_medians.get(proxy_role, {}) if explicit_proxy else {} + role_hours = role_hourly.get(proxy_role, {}) if explicit_proxy else {} + if explicit_proxy and isinstance(role_median, dict): + for target in sorted(PUBLIC_DNS_TARGETS): + if target in exact_targets: + continue + if isinstance(role_median.get("rtt_ms"), (float, int)): + profiles[target]["rtt_ms"] = float(role_median["rtt_ms"]) + for metric in ("jitter_ms", "loss_pct"): + if isinstance(role_median.get(metric), (float, int)): + profiles[target][metric] = float(role_median[metric]) + if isinstance(role_hours, dict): + hourly[target] = {} + for hour, stats in role_hours.items(): + if isinstance(stats, dict): + hourly[target][int(hour)] = { + metric: float(stats[metric]) + for metric in ("rtt_ms", "jitter_ms", "loss_pct") + if isinstance(stats.get(metric), (float, int)) + } + applied_targets.append(target) + + modes = { + target: ( + "exact_target" + if target in exact_targets + else "explicit_role_proxy" + if target in applied_targets + else "illustrative_default" + ) + for target in TARGETS + } + proxy_uncertainty = role_proxy.get( + "uncertainty", + "A public root-DNS-server route is not proven equivalent to configured DNS destinations.", + ) + metadata = { + "calibration_source": payload.get("provenance", ["built-in illustrative defaults"]), + "target_modes": modes, + "role_proxy": { + "enabled": bool(applied_targets), + "role": proxy_role if applied_targets else None, + "source_targets": source_targets if applied_targets else [], + "applied_to": applied_targets, + "uncertainty": proxy_uncertainty if applied_targets else None, + }, + } + return profiles, hourly, metadata + + +def _baselines() -> tuple[dict[str, float], dict[str, dict[int, float]], str]: + """Compatibility helper exposing RTT baselines and provenance summary.""" + profiles, hourly_profiles, metadata = _baseline_profiles() + rtt = {target: profile["rtt_ms"] for target, profile in profiles.items()} + hourly = { + target: {hour: stats["rtt_ms"] for hour, stats in values.items() if "rtt_ms" in stats} + for target, values in hourly_profiles.items() + } + proxy = metadata["role_proxy"] + source = ", ".join(metadata["calibration_source"]) + if proxy["enabled"]: + source += ( + "; explicit role proxy from " + + ", ".join(proxy["source_targets"]) + + " to " + + ", ".join(proxy["applied_to"]) + ) + return rtt, hourly, source + + +def _labels( + selected: list[dict[str, Any]], + start: datetime, + days: int, + seed: int, + scenario_type: str | None, + normal_only: bool, + duration_min: int, +) -> list[dict[str, Any]]: + if normal_only: + return [] + if scenario_type: + causes = [scenario_type] + else: + # A normal seven-day fixture includes all seven scenarios once/site. + causes = list(CAUSES) + out = [] + for site_index, site in enumerate(selected): + for cause_index, cause in enumerate(causes): + # Events are far enough apart to preserve distinct recovery windows. + at = start + timedelta(hours=2 + cause_index * 2, minutes=site_index * 25) + out.append( + _label( + site, + cause, + at, + at + timedelta(minutes=duration_min), + seed + site_index * 10_000 + cause_index, + ) + ) + return out + + +def generate( + days: int = 1, + seed: int = 42, + start: datetime | None = None, + scenario_type: str | None = None, + duration_min: int = 15, + site_id: str | None = None, + normal_only: bool = False, + hours: int | None = None, +) -> tuple[pd.DataFrame, pd.DataFrame, list[dict[str, Any]]]: + """Generate repeatable UTC table-shaped observations and plain fixture labels. + + `hours` can limit a case window (1..24*days); the default emits full days. + Unless `normal_only` or one `scenario_type` is provided, every cause is + scheduled once per selected site within the first day. + """ + if ( + days < 1 + or days > 30 + or duration_min < 1 + or (hours is not None and not 1 <= hours <= days * 24) + ): + raise ValueError( + "days must be 1..30, duration_min positive, and hours within requested days" + ) + if scenario_type is not None and scenario_type not in CAUSES: + raise ValueError(f"unsupported scenario: {scenario_type}") + layout = sites()["sites"] + selected = [s for s in layout if site_id is None or s["id"] == site_id] + if not selected: + raise ValueError(f"unknown site: {site_id}") + start = _utc(start or datetime(2026, 10, 12, tzinfo=UTC)) + num_hours = hours or days * 24 + num_pings = num_hours * 60 * 6 + num_interfaces = num_hours * 60 * 2 + labels = _labels(selected, start, days, seed, scenario_type, normal_only, duration_min) + baseline_profiles, hourly_profiles, calibration_metadata = _baseline_profiles() + rng = np.random.default_rng(seed) + pings: list[pd.DataFrame] = [] + ifaces: list[dict[str, Any]] = [] + for site in selected: + times = pd.date_range(start=start, periods=num_pings, freq="10s", tz="UTC") + local = times.tz_convert("Asia/Karachi") + hour = (local.hour + local.minute / 60).to_numpy() + weekend = np.asarray(local.dayofweek >= 5) + daily = ( + 0.12 + + 0.70 * np.exp(-0.5 * ((hour - 21.5) / 4.4) ** 2) + + 0.24 * np.exp(-0.5 * ((hour - 1) / 2.0) ** 2) + ) + daily *= np.where(weekend, 1.12, 1.0) + capacity = float(site["uplinks"][0]["capacity_mbps"]) + subs = int(site["subscribers"]) + heavy = rng.uniform(1.2, 2.2) + demand = (subs * (0.10 + daily * 0.28) * heavy / 1.9) * ( + 1 + rng.normal(0, 0.055, num_pings) + ) + util = np.clip(demand / capacity * 100, 8, 94) + cause_at_ping = np.full(num_pings, "", dtype=object) + for label in labels: + if label["site_id"] == site["id"]: + cause_at_ping[(times >= label["start"]) & (times < label["end"])] = label["cause"] + + # Aggregate uplink effects and counters use the same event window as probes. + itimes = pd.date_range(start=start, periods=num_interfaces, freq="30s", tz="UTC") + for ix, stamp in enumerate(itimes): + pi = min(ix * 3, num_pings - 1) + cause = next( + ( + x["cause"] + for x in labels + if x["site_id"] == site["id"] and x["start"] <= stamp.to_pydatetime() < x["end"] + ), + "", + ) + base_util = float(util[pi]) + up = ( + min(99.5, max(base_util, 98.2)) + if cause == "uplink_congestion" + else min(94, max(base_util, 87.0)) + if cause == "heavy_user" + else base_util + ) + down = cause == "uplink_down" + primary = site["uplinks"][0] + wire_loss = cause == "wireless_interference" + rx = 0 if down else int(capacity * 1_000_000 * up / 100 * rng.uniform(0.47, 0.61)) + tx = 0 if down else int(capacity * 1_000_000 * up / 100 - rx) + drops = ( + 0 + if down + else int(max(0, up - 85) * rng.uniform(0.2, 1.0)) + + (int(rng.integers(12, 35)) if cause == "uplink_congestion" else 0) + ) + ifaces.append( + { + "time": stamp.to_pydatetime(), + "site_id": site["id"], + "iface": primary["interface"], + "rx_bps": rx, + "tx_bps": tx, + "util_pct": 0.0 if down else up, + "drops": drops, + "errors": 1 if down else 0, + "source": "sim", + } + ) + backup = site.get("backup_uplink") + if backup: + bu = min(65, up * 0.62) if down else 0.0 + brx = int(backup["capacity_mbps"] * 1_000_000 * bu / 100 * 0.55) + ifaces.append( + { + "time": stamp.to_pydatetime(), + "site_id": site["id"], + "iface": backup["interface"], + "rx_bps": brx, + "tx_bps": max(0, int(backup["capacity_mbps"] * 1_000_000 * bu / 100 - brx)), + "util_pct": bu, + "drops": 0, + "errors": 0, + "source": "sim", + } + ) + for bh_index, backhaul in enumerate(site.get("backhauls", [])): + bh_util = float(np.clip(18 + base_util * 0.48 + rng.normal(0, 3), 3, 95)) + affected = wire_loss and bh_index == 0 + bh_rx = int(backhaul["capacity_mbps"] * 1_000_000 * bh_util / 100 * 0.52) + ifaces.append( + { + "time": stamp.to_pydatetime(), + "site_id": site["id"], + "iface": backhaul["interface"], + "rx_bps": bh_rx, + "tx_bps": int( + backhaul["capacity_mbps"] * 1_000_000 * bh_util / 100 - bh_rx + ), + "util_pct": bh_util, + "drops": int(rng.integers(15, 50)) if affected else int(rng.integers(0, 2)), + "errors": int(rng.integers(2, 12)) if affected else 0, + "source": "sim", + } + ) + + for target in TARGETS: + target_profile = baseline_profiles[target] + per_hour = hourly_profiles.get(target, {}) + base = np.asarray( + [ + per_hour.get(int(h), {}).get("rtt_ms", target_profile["rtt_ms"]) + for h in local.hour + ], + dtype=float, + ) + base_jitter = np.asarray( + [ + per_hour.get(int(h), {}).get("jitter_ms", target_profile["jitter_ms"]) + for h in local.hour + ], + dtype=float, + ) + base_loss = np.asarray( + [ + per_hour.get(int(h), {}).get("loss_pct", target_profile["loss_pct"]) + for h in local.hour + ], + dtype=float, + ) + outside = target != "gateway" + event_cong = (cause_at_ping == "uplink_congestion") & outside + event_heavy = (cause_at_ping == "heavy_user") & outside + event_upstream = (cause_at_ping == "upstream_degradation") & outside + event_game = (cause_at_ping == "game_route_issue") & (target == "regional-game") + event_wireless = (cause_at_ping == "wireless_interference") & outside + event_down = (cause_at_ping == "uplink_down") & outside + queue = ( + np.minimum(180.0, 0.11 * util / np.maximum(0.06, 1 - util / 100)) + if outside + else np.full(num_pings, 0.0) + ) + queue = ( + queue + + event_cong * 75 + + event_heavy * 38 + + event_upstream * 95 + + event_game * 180 + + event_wireless * 8 + ) + jitter = ( + base_jitter + util * 0.025 + event_wireless * 26 + rng.normal(0, 0.35, num_pings) + ) + loss = ( + np.maximum(base_loss, (util - 95) * 0.15) + + event_cong * 7 + + event_heavy * 1.5 + + event_upstream * 4 + + event_game * 9 + + event_wireless * 5 + ) + loss = np.clip(loss + rng.normal(0, 0.1, num_pings), 0, 99.9) + loss[event_down] = 100.0 + rtt = np.maximum( + 0.2, + base + queue + rng.normal(0, 1.4 + np.maximum(0.1, jitter) * 0.3, num_pings), + ) + rtt[event_down] = np.nan + jitter[event_down] = np.nan + # DNS resolution delay is a supplemental observation, not ICMP RTT. + pings.append( + pd.DataFrame( + { + "time": times, + "site_id": site["id"], + "target": target, + "rtt_ms": rtt, + "jitter_ms": np.maximum(0.1, jitter), + "loss_pct": loss, + "source": "sim", + } + ) + ) + probe_frame = pd.concat(pings, ignore_index=True) + iface_frame = pd.DataFrame(ifaces) + probe_frame.attrs["calibration"] = calibration_metadata + iface_frame.attrs["calibration"] = calibration_metadata + return probe_frame, iface_frame, labels + + +def generate_supplemental( + labels: list[dict[str, Any]], + *, + start: datetime, + end: datetime, + seed: int = 42, + site_ids: list[str] | None = None, +) -> pd.DataFrame: + """Generate continuous synthetic DNS/subscriber/backhaul observations. + + Each selected site has healthy baseline rows throughout the case window. + Labels only alter seeded distributions in their event interval, so the + presence of supplemental rows never gives away the class. + """ + start, end = _utc(start), _utc(end) + if end <= start: + raise ValueError("supplemental end must follow start") + layout = sites()["sites"] + selected = [s for s in layout if site_ids is None or s["id"] in site_ids] + times = pd.date_range(start=start, end=end, freq="30s", inclusive="both", tz="UTC") + rows = [] + for site_index, site in enumerate(selected): + rng = np.random.default_rng(seed + site_index * 997) + local = times.tz_convert("Asia/Karachi") + hour = (local.hour + local.minute / 60).to_numpy() + demand_curve = 0.12 + 0.70 * np.exp(-0.5 * ((hour - 21.5) / 4.4) ** 2) + active_events = [x for x in labels if x["site_id"] == site["id"]] + for stamp, daily in zip(times, demand_curve, strict=True): + instant = stamp.to_pydatetime() + event = next( + (x["cause"] for x in active_events if x["start"] <= instant < x["end"]), + "", + ) + for resolver, baseline in (("1.1.1.1", 24.0), ("8.8.8.8", 31.0)): + dns_ms = max(5.0, baseline + rng.normal(0, 2.0)) + if event == "dns_slow": + dns_ms = max(300.0, rng.normal(650.0, 35.0)) + rows.append( + { + "time": instant, + "site_id": site["id"], + "kind": "dns_resolution", + "entity": resolver, + "latency_ms": float(dns_ms), + "loss_pct": 0.0, + "status": "synthetic experimental; core DNS timing contract pending", + "source": "sim_supplemental", + } + ) + rx_mbps = max(0.05, rng.gamma(2.0, 0.9) * (0.6 + daily)) + if event == "heavy_user": + rx_mbps = max(50.0, rng.normal(75.0, 6.0)) + rows.append( + { + "time": instant, + "site_id": site["id"], + "kind": "subscriber_traffic", + "entity": "192.0.2.10", + "rx_bps": int(rx_mbps * 1_000_000), + "tx_bps": int(rx_mbps * 0.10 * 1_000_000), + "status": "synthetic experimental; subscriber identity/role contract pending", + "source": "sim_supplemental", + } + ) + for bh_index, backhaul in enumerate(site.get("backhauls", [])): + loss_pct = max(0.0, rng.normal(0.12, 0.07)) + if event == "wireless_interference" and bh_index == 0: + loss_pct = min(35.0, max(8.0, rng.normal(15.0, 2.0))) + rows.append( + { + "time": instant, + "site_id": site["id"], + "kind": "backhaul_quality", + "entity": backhaul["interface"], + "loss_pct": float(loss_pct), + "status": "synthetic experimental; interface role contract pending", + "source": "sim_supplemental", + } + ) + return pd.DataFrame(rows) + + +def _label( + site: dict[str, Any], cause: str, start: datetime, end: datetime, seed: int +) -> dict[str, Any]: + params: dict[str, Any] = {} + if cause == "uplink_congestion": + params = {"interface": site["uplinks"][0]["interface"], "priority": "high"} + if cause == "uplink_down": + params = ( + { + "primary": site["uplinks"][0]["interface"], + "backup": site["backup_uplink"]["interface"], + } + if site.get("backup_uplink") + else { + "primary": site["uplinks"][0]["interface"], + "backup": None, + "actionable": False, + } + ) + if cause == "heavy_user": + params = { + "limit_mbps": 10, + "evidence_status": "synthetic subscriber row is supplemental; " + "core subscriber contract pending", + } + if cause == "dns_slow": + params = { + "template": "dns_servers", + "evidence_status": "experimental resolution rows are supplemental", + } + if cause == "wireless_interference": + params = { + "interface": site["backhauls"][0]["interface"], + "evidence_status": "simulated interface counters; role contract pending", + } + return { + "site_id": site["id"], + "start": start, + "end": end, + "cause": cause, + "template_id": TEMPLATES[cause], + "params": params, + "seed": seed, + "split": "generated", + } + + +def inject_frames( + site_id: str, + scenario_type: str, + duration_min: int = 15, + seed: int = 42, + start: datetime | None = None, +) -> tuple[pd.DataFrame, pd.DataFrame, dict[str, Any]]: + """Create scenario fixture rows. This is not the core API inject contract.""" + p, i, labels = generate( + days=1, + seed=seed, + start=start, + scenario_type=scenario_type, + duration_min=duration_min, + site_id=site_id, + ) + return p, i, labels[0] + + +def inject( + site_id: str, scenario_type: Cause, duration_min: int, seed: int | None = None +) -> ScenarioLabel: + """Core-facing contract entry point; unavailable until the real core arrives.""" + try: + import importlib + + core = importlib.import_module("netcortex_core") + for symbol in ("Cause", "ScenarioLabel"): + getattr(core, symbol) + except (ImportError, AttributeError) as exc: + raise RuntimeError( + "Core injection unavailable: netcortex_core and its approved " + "ScenarioLabel contract are not present" + ) from exc + raise RuntimeError( + "Core injection adapter is unbound: confirm core injection lifecycle, " + "Cause values, and ScenarioLabel construction before enabling" + ) diff --git a/packages/simgen/tests/test_simulator.py b/packages/simgen/tests/test_simulator.py new file mode 100644 index 0000000..d0249b4 --- /dev/null +++ b/packages/simgen/tests/test_simulator.py @@ -0,0 +1,607 @@ +import json +import shutil +from datetime import UTC, datetime +from pathlib import Path + +import httpx +import netcortex_simgen.simulator as simulator +import pandas as pd +import pytest +from netcortex_simgen import inject +from netcortex_simgen.cli import _build_calibration, _read_target_role_map, make_eval_cases +from netcortex_simgen.ripe import parse_result +from netcortex_simgen.simulator import ( + CAUSES, + generate, + generate_supplemental, + inject_frames, +) + + +def test_seed_reproducible_and_schema_cadence(): + start = datetime(2026, 10, 1, tzinfo=UTC) + p1, i1, _ = generate(days=1, seed=7, start=start, normal_only=True) + p2, i2, _ = generate(days=1, seed=7, start=start, normal_only=True) + pd.testing.assert_frame_equal(p1, p2) + pd.testing.assert_frame_equal(i1, i2) + assert p1.groupby(["site_id", "target"]).size().eq(8640).all() + assert i1.groupby(["site_id", "iface"]).size().eq(2880).all() + assert p1.time.dt.tz is not None and set(p1.source) == {"sim"} + assert p1.loss_pct.between(0, 100).all() and p1.rtt_ms.gt(0).all() + + +def test_packaged_site_resource_works_without_repository_root(monkeypatch, tmp_path): + import yaml + + monkeypatch.setattr(simulator, "ROOT", tmp_path) + layout = simulator.sites() + canonical_path = Path(simulator.__file__).resolve().parents[4] / "data" / "sites.yaml" + canonical = yaml.safe_load(canonical_path.read_text()) + assert layout == canonical + p, _, _ = generate(days=1, hours=1, seed=2, site_id="north-tower", normal_only=True) + assert len(p) == 360 * 5 + + +def test_scenarios_distinguishable_and_labelled(): + p0, _, _ = generate(days=1, seed=8, site_id="north-tower", normal_only=True) + for cause in CAUSES: + p, iface, labels = inject_frames( + "north-tower", cause, 15, 8, datetime(2026, 10, 1, tzinfo=UTC) + ) + label = labels + affected = p[(p.time >= label["start"]) & (p.time < label["end"])] + assert len(affected) > 0 and affected.loss_pct.between(0, 100).all() + if cause == "uplink_down": + assert affected[affected.target != "gateway"].loss_pct.mean() >= 95 + assert affected[affected.target != "gateway"].loss_pct.eq(100).all() + assert affected[affected.target != "gateway"].rtt_ms.isna().all() + assert "ether2" in set(iface.iface) + elif cause == "game_route_issue": + assert ( + affected[affected.target == "regional-game"].rtt_ms.mean() + > affected[affected.target == "1.1.1.1"].rtt_ms.mean() + ) + elif cause == "upstream_degradation": + assert ( + affected[affected.target == "1.1.1.1"].rtt_ms.mean() + > p0[p0.target == "1.1.1.1"].rtt_ms.mean() + ) + elif cause == "wireless_interference": + assert iface[iface.iface == "wlan1"].errors.sum() > 0 + elif cause == "uplink_congestion": + affected_ifaces = iface[(iface.time >= label["start"]) & (iface.time < label["end"])] + assert affected_ifaces[affected_ifaces.iface == "ether1"].util_pct.mean() > 95 + elif cause == "dns_slow": + extra = generate_supplemental( + [label], + start=label["start"] - pd.Timedelta(hours=1), + end=label["end"], + seed=8, + site_ids=["north-tower"], + ) + dns = extra[extra.kind == "dns_resolution"] + assert dns.latency_ms.max() > 300 and dns.latency_ms.min() < 40 + elif cause == "heavy_user": + extra = generate_supplemental( + [label], + start=label["start"] - pd.Timedelta(hours=1), + end=label["end"], + seed=8, + site_ids=["north-tower"], + ) + traffic = extra[extra.kind == "subscriber_traffic"] + assert traffic.rx_bps.max() > 50_000_000 and traffic.rx_bps.min() < 10_000_000 + + +def test_public_inject_fails_without_shared_core(): + with pytest.raises(RuntimeError, match="Core injection unavailable"): + inject("north-tower", "uplink_congestion", 15, 4) + + +def test_pk_hour_calibration_is_used_and_utc_stays_on_output(monkeypatch, tmp_path): + source_root = simulator.ROOT + (tmp_path / "data").mkdir() + shutil.copy(source_root / "data/sites.yaml", tmp_path / "data/sites.yaml") + (tmp_path / "data/calibration.json").write_text( + json.dumps( + { + "provenance": ["recorded fixture"], + "target_medians_ms": {"1.1.1.1": 200.0}, + "target_hourly_ms": {"1.1.1.1": {"12": 300.0}}, + } + ) + ) + monkeypatch.setattr(simulator, "ROOT", tmp_path) + # 07:00 UTC is 12:00 in Pakistan. + p, _, _ = generate( + days=1, + hours=1, + seed=91, + start=datetime(2026, 10, 1, 7, tzinfo=UTC), + site_id="north-tower", + normal_only=True, + ) + probe = p[p.target == "1.1.1.1"] + assert probe.rtt_ms.median() == pytest.approx(300.0, abs=3.0) + assert probe.time.dt.hour.eq(7).all() + + +def test_external_ripe_targets_do_not_calibrate_unrelated_simulator_targets(monkeypatch, tmp_path): + (tmp_path / "data").mkdir() + shutil.copy(simulator.ROOT / "data/sites.yaml", tmp_path / "data/sites.yaml") + (tmp_path / "data/calibration.json").write_text( + json.dumps( + { + "provenance": ["RIPE public DNS-server reachability"], + "target_medians_ms": {"192.5.5.241": 999.0}, + "target_hourly_ms": {"192.5.5.241": {"12": 888.0}}, + } + ), + encoding="utf-8", + ) + monkeypatch.setattr(simulator, "ROOT", tmp_path) + p, _, _ = generate( + days=1, + hours=1, + seed=92, + start=datetime(2026, 10, 1, 7, tzinfo=UTC), + site_id="north-tower", + normal_only=True, + ) + assert p[p.target == "1.1.1.1"].rtt_ms.median() == pytest.approx(28.0, abs=3.0) + assert p[p.target == "8.8.8.8"].rtt_ms.median() == pytest.approx(35.0, abs=3.0) + + +def test_calibration_uses_target_hour_medians_and_keeps_observed_stats(): + + observed = pd.DataFrame( + { + "time": pd.to_datetime( + [ + "2026-10-01T08:00:00Z", + "2026-10-01T08:10:00Z", + "2026-10-01T09:00:00Z", + ] + ), + "target": ["1.1.1.1", "1.1.1.1", "8.8.8.8"], + "target_role": ["unmapped_ripe_public_ping"] * 3, + "rtt_ms": [10.0, 200.0, 40.0], + "jitter_ms": [2.0, 4.0, 8.0], + "loss_pct": [0.0, 20.0, 10.0], + "source": ["ripe"] * 3, + } + ) + calibration = _build_calibration( + observed, + {"1.1.1.1": "public_dns_reachability_proxy"}, + ) + stats = calibration["target_hourly_stats"]["1.1.1.1"]["13"] + assert calibration["target_hourly_ms"]["1.1.1.1"]["13"] == 105.0 + assert stats == {"sample_count": 2, "rtt_ms": 105.0, "jitter_ms": 3.0, "loss_pct": 10.0} + assert calibration["target_roles"]["1.1.1.1"] == "public_dns_reachability_proxy" + assert calibration["target_roles"]["8.8.8.8"] == "unmapped_ripe_public_ping" + assert "DNS resolution timing" in calibration["experimental_status"] + assert not calibration["role_proxy"]["enabled"] + assert calibration["role_medians"]["public_dns_reachability_proxy"]["sample_count"] == 2 + assert calibration["role_hourly_stats"]["public_dns_reachability_proxy"]["13"] == { + "sample_count": 2, + "rtt_ms": 105.0, + "jitter_ms": 3.0, + "loss_pct": 10.0, + } + + +def test_role_proxy_requires_both_explicit_mapping_and_opt_in(monkeypatch, tmp_path): + observed = pd.DataFrame( + { + "time": pd.to_datetime(["2026-10-01T08:00:00Z", "2026-10-01T08:10:00Z"]), + "target": ["192.5.5.241", "193.0.14.129"], + "rtt_ms": [16.0, 18.0], + "jitter_ms": [0.4, 0.6], + "loss_pct": [0.0, 2.0], + "source": ["ripe", "ripe"], + } + ) + mapping = { + "192.5.5.241": "public_dns_reachability_proxy", + "193.0.14.129": "public_dns_reachability_proxy", + } + without_flag = _build_calibration(observed, mapping) + opted_in = _build_calibration(observed, mapping, allow_role_proxy=True) + assert without_flag["role_proxy"]["enabled"] is False + assert opted_in["role_proxy"]["enabled"] is True + assert opted_in["role_proxy"]["source_targets"] == sorted(mapping) + assert opted_in["role_medians"]["public_dns_reachability_proxy"] == { + "sample_count": 2, + "rtt_ms": 17.0, + "jitter_ms": 0.5, + "loss_pct": 1.0, + } + (tmp_path / "data").mkdir() + shutil.copy(simulator.ROOT / "data/sites.yaml", tmp_path / "data/sites.yaml") + calibration_path = tmp_path / "data/calibration.json" + calibration_path.write_text(json.dumps(without_flag), encoding="utf-8") + monkeypatch.setattr(simulator, "ROOT", tmp_path) + kwargs = { + "days": 1, + "hours": 1, + "seed": 94, + "start": datetime(2026, 10, 1, 7, tzinfo=UTC), + "site_id": "north-tower", + "normal_only": True, + } + defaulted, _, _ = generate(**kwargs) + assert defaulted.attrs["calibration"]["target_modes"]["1.1.1.1"] == "illustrative_default" + calibration_path.write_text(json.dumps(opted_in), encoding="utf-8") + proxied, _, _ = generate(**kwargs) + assert proxied.attrs["calibration"]["target_modes"]["1.1.1.1"] == "explicit_role_proxy" + + +def test_role_proxy_applies_only_dns_reachability_targets_and_exact_target_wins( + monkeypatch, tmp_path +): + (tmp_path / "data").mkdir() + shutil.copy(simulator.ROOT / "data/sites.yaml", tmp_path / "data/sites.yaml") + (tmp_path / "data/calibration.json").write_text( + json.dumps( + { + "provenance": ["RIPE public DNS-server reachability"], + "target_roles": { + "192.5.5.241": "public_dns_reachability_proxy", + "193.0.14.129": "public_dns_reachability_proxy", + }, + "target_medians_ms": {"8.8.8.8": 40.0}, + "target_stats": {"8.8.8.8": {"rtt_ms": 40.0, "jitter_ms": 9.0, "loss_pct": 1.0}}, + "target_hourly_stats": { + "8.8.8.8": {"12": {"rtt_ms": 50.0, "jitter_ms": 8.0, "loss_pct": 2.0}} + }, + "role_medians": { + "public_dns_reachability_proxy": { + "sample_count": 100, + "rtt_ms": 76.0, + "jitter_ms": 5.0, + "loss_pct": 3.0, + } + }, + "role_hourly_stats": { + "public_dns_reachability_proxy": { + "12": { + "sample_count": 10, + "rtt_ms": 100.0, + "jitter_ms": 7.0, + "loss_pct": 4.0, + } + } + }, + "role_proxy": { + "enabled": True, + "role": "public_dns_reachability_proxy", + "source_targets": ["192.5.5.241", "193.0.14.129"], + "configured_targets": ["1.1.1.1", "8.8.8.8"], + "uncertainty": "Root DNS reachability does not prove route equivalence.", + }, + } + ), + encoding="utf-8", + ) + monkeypatch.setattr(simulator, "ROOT", tmp_path) + p, _, _ = generate( + days=1, + hours=1, + seed=93, + start=datetime(2026, 10, 1, 7, tzinfo=UTC), + site_id="north-tower", + normal_only=True, + ) + dns1 = p[p.target == "1.1.1.1"] + dns8 = p[p.target == "8.8.8.8"] + assert dns1.rtt_ms.median() > dns8.rtt_ms.median() + 30 + assert dns1.jitter_ms.median() > 7.0 + assert dns1.loss_pct.median() == pytest.approx(4.0, abs=0.2) + assert p[p.target == "gateway"].rtt_ms.median() < 5 + assert p[p.target == "regional-game"].rtt_ms.median() < 100 + metadata = p.attrs["calibration"] + assert metadata["target_modes"]["1.1.1.1"] == "explicit_role_proxy" + assert metadata["target_modes"]["8.8.8.8"] == "exact_target" + assert metadata["target_modes"]["gateway"] == "illustrative_default" + assert metadata["role_proxy"]["applied_to"] == ["1.1.1.1"] + assert "does not prove route equivalence" in metadata["role_proxy"]["uncertainty"] + from netcortex_simgen.cli import _write + + output = tmp_path / "generated" + _write(p, pd.DataFrame(), [], output) + generation_metadata = json.loads((output / "generation_metadata.json").read_text()) + assert generation_metadata["calibration"]["role_proxy"]["applied_to"] == ["1.1.1.1"] + + +def test_target_role_map_rejects_dns_resolution_role(tmp_path): + mapping = tmp_path / "roles.json" + mapping.write_text('{"1.1.1.1":"dns_resolution"}', encoding="utf-8") + with pytest.raises(ValueError, match="ping observations"): + _read_target_role_map(mapping) + + +def test_ripe_loss_and_bad_rtts(): + total = parse_result({"timestamp": 10, "sent": 5, "rcvd": 0, "rtts": []}) + assert total and total["loss_pct"] == 100 and total["rtt_ms"] is None + mixed = parse_result( + { + "timestamp": 10, + "sent": 4, + "result": [{"rtt": 10}, {"x": "*"}, {}, {"rtt": 14}], + } + ) + assert mixed and mixed["loss_pct"] == 50 and mixed["rtt_ms"] == 12 + assert parse_result({"timestamp": "broken", "sent": 1}) is None + + +def test_ripe_fetch_discovers_and_caches_results_offline(monkeypatch, tmp_path): + from netcortex_simgen import ripe + + calls = [] + + def handler(request): + calls.append((request.url.path, dict(request.url.params))) + if request.url.path.endswith("/probes/"): + payload = {"results": [{"id": 17}], "next": None} + elif request.url.path.endswith("/measurements/"): + payload = {"results": [{"id": 91}], "next": None} + elif request.url.path.endswith("/results/"): + payload = { + "results": [ + { + "timestamp": 1_800_000_000, + "sent": 4, + "rtts": [{"rtt": 10}, {"rtt": 14}], + "dst_addr": "1.1.1.1", + "prb_id": 17, + } + ], + "next": None, + } + else: + raise AssertionError(f"unexpected RIPE path: {request.url.path}") + return httpx.Response(200, json=payload) + + monkeypatch.setattr(ripe.time, "time", lambda: 1_800_000_000) + monkeypatch.setattr(ripe.time, "sleep", lambda _seconds: None) + client = httpx.Client(transport=httpx.MockTransport(handler)) + first = ripe.fetch(1, cache_dir=tmp_path, client=client, max_measurements=1) + second = ripe.fetch(1, cache_dir=tmp_path, client=client, max_measurements=1) + assert len(first) == len(second) == 1 + assert first.iloc[0].source == "ripe" and first.iloc[0].probe_id == 17 + results = [params for path, params in calls if path.endswith("/results/")] + discovery = [params for path, params in calls if path.endswith("/measurements/")] + assert len(results) == 1 + assert results[0]["start"] == str(1_800_000_000 // 86400 * 86400 - 86400) + assert results[0]["stop"] == str(1_800_000_000 // 86400 * 86400) + assert results[0]["probe_ids"] == "17" + assert "probe_ids" not in discovery[0] + client.close() + + +def test_ripe_fetch_requests_each_utc_day_and_records_day_gaps(monkeypatch, tmp_path): + from netcortex_simgen import ripe + + requests = [] + + def handler(request): + if request.url.path.endswith("/probes/"): + return httpx.Response( + 200, json={"results": [{"id": 17, "asn_v4": 64500}], "next": None} + ) + if request.url.path.endswith("/measurements/"): + return httpx.Response( + 200, json={"results": [{"id": 91, "target_ip": "1.1.1.1"}], "next": None} + ) + if request.url.path.endswith("/results/"): + params = dict(request.url.params) + requests.append(params) + if len(requests) == 1: + raise httpx.ReadTimeout("recorded first-day timeout") + return httpx.Response( + 200, + json=[ + { + "timestamp": int(params["start"]) + 120, + "sent": 1, + "rcvd": 1, + "avg": 12.0, + "dst_addr": "1.1.1.1", + "prb_id": 17, + } + ], + ) + raise AssertionError(request.url) + + now = 1_800_000_000 // 86400 * 86400 + monkeypatch.setattr(ripe.time, "time", lambda: now + 100) + monkeypatch.setattr(ripe.time, "sleep", lambda _seconds: None) + client = httpx.Client(transport=httpx.MockTransport(handler)) + frame = ripe.fetch(2, cache_dir=tmp_path, client=client, max_measurements=1, max_probes=1) + report = frame.attrs["ripe_fetch_report"] + assert [int(params["start"]) for params in requests] == [now - 2 * 86400, now - 86400] + assert all(int(item["stop"]) - int(item["start"]) == 86400 for item in requests) + assert report["status"] == "partial" + assert ( + report["days"][pd.Timestamp(now - 2 * 86400, unit="s", tz="UTC").strftime("%Y-%m-%d")][ + "status" + ] + == "failed" + ) + assert ( + report["days"][pd.Timestamp(now - 86400, unit="s", tz="UTC").strftime("%Y-%m-%d")]["status"] + == "complete" + ) + assert len(report["failed_daily_measurement_requests"]) == 1 + client.close() + + +def test_ripe_result_cache_key_includes_selected_probe_ids(monkeypatch, tmp_path): + from netcortex_simgen import ripe + + result_calls = [] + + def handler(request): + path = request.url.path + if path.endswith("/probes/"): + return httpx.Response( + 200, + json={ + "results": [ + {"id": 17, "asn_v4": 64500}, + {"id": 18, "asn_v4": 64501}, + ], + "next": None, + }, + ) + if path.endswith("/measurements/"): + return httpx.Response(200, json={"results": [{"id": 91}], "next": None}) + if path.endswith("/results/"): + params = dict(request.url.params) + result_calls.append(params["probe_ids"]) + return httpx.Response(200, json=[]) + raise AssertionError(request.url) + + monkeypatch.setattr(ripe.time, "time", lambda: 1_800_000_000) + monkeypatch.setattr(ripe.time, "sleep", lambda _seconds: None) + client = httpx.Client(transport=httpx.MockTransport(handler)) + ripe.fetch(1, cache_dir=tmp_path, client=client, max_measurements=1, max_probes=1) + ripe.fetch(1, cache_dir=tmp_path, client=client, max_measurements=1, max_probes=2) + assert result_calls == ["17", "17,18"] + assert len(list(tmp_path.glob("measurement-91-*.json"))) == 2 + client.close() + + +def test_ripe_missing_provider_is_empty_and_reports_no_data(monkeypatch, tmp_path): + from netcortex_simgen import ripe + + def handler(request): + assert request.url.path.endswith("/probes/") + return httpx.Response(200, json={"results": [], "next": None}) + + monkeypatch.setattr(ripe.time, "sleep", lambda _seconds: None) + client = httpx.Client(transport=httpx.MockTransport(handler)) + frame = ripe.fetch(1, cache_dir=tmp_path, client=client) + assert frame.empty + assert frame.attrs["ripe_fetch_report"]["status"] == "no_active_probes" + assert not list(tmp_path.glob("measurement-*.json")) + client.close() + + +def test_ripe_empty_measurement_discovery_reports_no_measurements(monkeypatch, tmp_path): + from netcortex_simgen import ripe + + def handler(request): + if request.url.path.endswith("/probes/"): + return httpx.Response(200, json={"results": [{"id": 17}], "next": None}) + assert request.url.path.endswith("/measurements/") + return httpx.Response(200, json={"results": [], "next": None}) + + monkeypatch.setattr(ripe.time, "sleep", lambda _seconds: None) + client = httpx.Client(transport=httpx.MockTransport(handler)) + frame = ripe.fetch(1, cache_dir=tmp_path, client=client) + assert frame.empty + assert frame.attrs["ripe_fetch_report"]["status"] == "no_measurements" + assert not list(tmp_path.glob("measurement-*.json")) + client.close() + + +def test_ripe_malformed_discovery_is_rejected(monkeypatch, tmp_path): + from netcortex_simgen import ripe + + def handler(_request): + return httpx.Response(200, json={"unexpected": []}) + + monkeypatch.setattr(ripe.time, "sleep", lambda _seconds: None) + client = httpx.Client(transport=httpx.MockTransport(handler)) + with pytest.raises(TypeError, match="paginated response"): + ripe.fetch(1, cache_dir=tmp_path, client=client) + client.close() + + +def test_calibrate_mock_never_makes_or_uses_fake_observations(monkeypatch, tmp_path): + from netcortex_simgen import cli + + monkeypatch.setattr(cli, "ROOT", tmp_path) + with pytest.raises(SystemExit, match="no mock observations are bundled"): + cli.main(["calibrate", "--mock"]) + assert not (tmp_path / "data/calibration.json").exists() + + +def test_load_source_selects_correct_rows_and_last_window(monkeypatch, tmp_path): + from netcortex_simgen import cli + + generated = tmp_path / "data/generated" + ripe_data = tmp_path / "data/raw/ripe" + generated.mkdir(parents=True) + ripe_data.mkdir(parents=True) + times = pd.to_datetime(["2026-01-01T00:00:00Z", "2026-01-02T00:00:00Z"]) + sim = pd.DataFrame( + { + "time": times, + "site_id": "north-tower", + "target": "1.1.1.1", + "rtt_ms": [10, 11], + "source": "sim", + } + ) + ripe = sim.assign(rtt_ms=[50, 51], source="ripe") + iface = pd.DataFrame( + {"time": times, "site_id": "north-tower", "iface": "ether1", "rx_bps": [1, 2]} + ) + sim.to_parquet(generated / "probe_metrics.parquet") + iface.to_parquet(generated / "iface_metrics.parquet") + ripe.to_parquet(ripe_data / "results.parquet") + monkeypatch.setattr(cli, "ROOT", tmp_path) + p_sim, i_sim = cli._read_source("sim", "12h") + p_ripe, i_ripe = cli._read_source("ripe", "12h") + assert p_sim.source.tolist() == ["sim"] and p_sim.rtt_ms.tolist() == [11] + assert p_ripe.source.tolist() == ["ripe"] and p_ripe.rtt_ms.tolist() == [51] + assert i_sim.rx_bps.tolist() == [2] and i_ripe.empty + + +def test_eval_split_and_label_separation(tmp_path): + make_eval_cases(8, 1000, tmp_path) + cases = list(tmp_path.glob("*/*.json")) + assert len(cases) == 24 + from collections import Counter + + found = Counter() + seeds = {"train": set(), "validation": set(), "test": set()} + windows = {"train": set(), "validation": set(), "test": set()} + ranges = {"train": [], "validation": [], "test": []} + for path in cases: + import json + + record = json.loads(path.read_text()) + found[record["expected"]["cause"]] += 1 + seeds[record["split"]].add(record["seed"]) + windows[record["split"]].add(record["case_start"]) + ranges[record["split"]].append( + (pd.Timestamp(record["case_start"]), pd.Timestamp(record["as_of"])) + ) + features = pd.read_parquet(path.parent / record["observations"]["probe"]) + assert "cause" not in features and "expected" not in features + assert pd.to_datetime(features.time, utc=True).max() <= pd.Timestamp(record["as_of"]) + assert record["history_window"]["end_exclusive"] == record["detection_window"]["start"] + assert pd.Timestamp(record["as_of"]) - pd.Timestamp( + record["detection_window"]["start"] + ) == pd.Timedelta(minutes=30) + extra = pd.read_parquet(path.parent / record["observations"]["supplemental"]) + assert set(extra.kind) == {"dns_resolution", "subscriber_traffic", "backhaul_quality"} + assert found["normal"] == 3 and all(found[c] == 3 for c in CAUSES) + assert seeds["train"].isdisjoint(seeds["validation"]) and seeds["test"].isdisjoint( + seeds["train"] + ) + assert windows["train"].isdisjoint(windows["validation"]) and windows["test"].isdisjoint( + windows["train"] + ) + ordered = [ + ( + min(begin for begin, _ in ranges[split]), + max(end for _, end in ranges[split]), + ) + for split in ("train", "validation", "test") + ] + assert ordered[0][1] < ordered[1][0] < ordered[1][1] < ordered[2][0] From bb6e8d72873136a2e4997c4e73ef13ea7b6e4beb Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:22:06 +0500 Subject: [PATCH 07/21] feat: add bounded detector adapters and separated evaluation runner --- docs/progress/detector_eval.md | 18 + eval/decision.md | 8 + eval/flow.md | 7 + eval/run.py | 408 +++++++++++++ packages/detector/README.md | 24 + packages/detector/decision.md | 10 + packages/detector/flow.md | 15 + packages/detector/pyproject.toml | 31 + .../src/netcortex_detector/__init__.py | 6 + .../detector/src/netcortex_detector/cli.py | 92 +++ .../detector/src/netcortex_detector/engine.py | 470 +++++++++++++++ .../src/netcortex_detector/providers.py | 400 +++++++++++++ .../src/netcortex_detector/thresholds.py | 64 +++ packages/detector/tests/test_engine.py | 539 ++++++++++++++++++ 14 files changed, 2092 insertions(+) create mode 100644 docs/progress/detector_eval.md create mode 100644 eval/decision.md create mode 100644 eval/flow.md create mode 100644 eval/run.py create mode 100644 packages/detector/README.md create mode 100644 packages/detector/decision.md create mode 100644 packages/detector/flow.md create mode 100644 packages/detector/pyproject.toml create mode 100644 packages/detector/src/netcortex_detector/__init__.py create mode 100644 packages/detector/src/netcortex_detector/cli.py create mode 100644 packages/detector/src/netcortex_detector/engine.py create mode 100644 packages/detector/src/netcortex_detector/providers.py create mode 100644 packages/detector/src/netcortex_detector/thresholds.py create mode 100644 packages/detector/tests/test_engine.py diff --git a/docs/progress/detector_eval.md b/docs/progress/detector_eval.md new file mode 100644 index 0000000..b3bab1c --- /dev/null +++ b/docs/progress/detector_eval.md @@ -0,0 +1,18 @@ +# Detector and evaluator handoff + +Implemented Workstream B3 and the offline portion of B9 on `b/detector-eval`. Detector ownership: `packages/detector/`; evaluation ownership: `eval/`; this note is the assigned progress record. + +The engine builds past-only one-minute features from probe and interface observations, validates timestamps/site/source boundaries and rejects mixed measurement sources, returns explicit unavailable results for missing, stale, and sparse input, and accepts injected backends. Optional cloud/local TabPFN 3.5 adapters request quantiles, use shifted forecast targets, raw-only metrics, horizon-wise quantile conversion, and a deterministic 2,048-row expanded training cap, train unsupervised detection on normal TRAIN data, and normalize against normal VALIDATION scores; failures remain explicit. Core `detect()` raises `DetectorUnavailable` until Aun publishes the real core result/window mapping. Fixture backend provenance is carried into output. + +The evaluator validates split IDs, seeds, and event intervals, blocks path traversal, and uses TRAIN labels only as targets, VALIDATION labels for threshold calibration, and TEST only for measurement. Validation calibration and reported false alerts/site-day now share the unioned normal detection-window exposure per site; positive windows do not enlarge the threshold budget. The existing smoke report predates this correction and should be regenerated with the full validation/test suite. The 8-case fixture smoke report is in `eval/results/detector.md`; it explicitly is not a TabPFN result. `eval/results/agent.md` records that agent/template/params/CHR metrics are unavailable because their actual APIs/contracts were not available in this worktree. + +Commands completed: + +```powershell +python -m uv run --no-project --with-editable packages/detector --with pytest pytest packages/detector/tests +python -m uv run --no-project --with-editable packages/detector --with ruff ruff check packages/detector eval/run.py +python -m uv run --no-project --with-editable packages/detector --with-editable C:\Users\nigga\Documents\NetCortex-data\packages\simgen --with pyarrow python -c "from netcortex_simgen.cli import make_eval_cases; from pathlib import Path; make_eval_cases(8, 1000, Path('eval/cases'))" +python -m uv run --no-project --with-editable packages/detector --with pyarrow python eval/run.py --mode mock --limit 8 +``` + +Validation passed: 34 offline tests and Ruff. The 8-case fixture smoke completed; the cloud smoke recorded all cases unavailable without credentials. A wheel build and installed CLI help check passed outside the checkout. No live key, TabPFN inference, core binding, forecast persistence, agent investigation, parameter validation, CHR check, or GPU compatibility is claimed. Full 80-test evaluation per split still requires running the simulator's `make_eval_cases(80, ...)` generation, followed by the cloud/local mode only when credentials or local model setup exist. diff --git a/eval/decision.md b/eval/decision.md new file mode 100644 index 0000000..6686d9e --- /dev/null +++ b/eval/decision.md @@ -0,0 +1,8 @@ +# Evaluation decisions + +- Consume simulator-generated `train`, `validation`, and `test` directories as-is. Each case JSON names separate probe/interface/supplemental Parquet observations and expected sidecar labels. Expected cause becomes the training `y` only for TRAIN and scoring truth only for held-out cases; expected params/template are never features. +- Reject overlapping case IDs, seeds, or event intervals across splits; reject observation paths that escape their split directory. The simulator generator is responsible for its 80-per-split, balanced causes design; evaluator records actual counts instead of assuming the requested count. +- Fit the classifier only from TRAIN feature snapshots. Fit unsupervised models from normal TRAIN rows; use normal VALIDATION scores for empirical score calibration and select the threshold by F1 subject to a false-alert budget computed from unioned normal detection-window exposure per site. Positive validation windows do not increase exposure. The held-out TEST split is not used to fit, select, or tune. +- `--mode mock` is an explicit fixture backend used to check data wiring and report generation. Its outputs are never described as TabPFN accuracy. `cloud` and `local` use actual provider adapter code and preserve unavailable/error statuses. +- False alerts/site-day uses the union of scored normal detection-window exposure per site. Cause accuracy and event precision/recall include explicit denominators. Missing agent investigation, template validation, and CHR infrastructure are `unavailable`, never 0% or assumed passes. Per-case latency is recorded for completed detector runs; event delay is unavailable because each case is a single as-of snapshot. Injected investigator, parameter-validator, and CHR-check callbacks are measured only from actual returned records. +- Supplemental DNS/subscriber/backhaul Parquet remains experimental and is not read by this evaluator. Core DNS RTT is not treated as DNS-resolution evidence, and aggregate counters do not identify a subscriber. diff --git a/eval/flow.md b/eval/flow.md new file mode 100644 index 0000000..feef0ac --- /dev/null +++ b/eval/flow.md @@ -0,0 +1,7 @@ +# Evaluation flow and CLI + +`python eval/run.py` defaults to `--mode mock`, cases under `eval/cases/`, and report `eval/results/detector.md`. Options: `--mode mock|cloud|local`, `--cases PATH`, `--out PATH`, `--limit N` (for a short fixture smoke run). Cloud/local require optional model dependencies and cloud uses `TABPFN_TOKEN` or `TABPFN_API_KEY`. Provider failure is recorded per test case; missing required case files or split leakage aborts the run. + +For each case, the runner loads only the referenced probe and interface Parquet files, builds a feature snapshot through its aware UTC `as_of`, and uses TRAIN labels solely as cause targets. It runs validation first to derive the threshold using the union of scored normal detection windows per site, then calls the detector on test cases. Positive windows and training history do not increase the false-alert budget; the same exposure definition is used for reported false alerts/site-day. Results report detector provenance, available/unavailable counts, cause accuracy, event precision/recall with denominators, and elapsed time. + +The initial B9 runner cannot call Aun's `investigate()` because the core/agent interface is absent from this worktree. Optional injected investigator, parameter-validator, and CHR-check callbacks produce metrics only from actual returned records; without them the runner writes `template_accuracy`, `valid_params_rate`, and `chr_dry_run_pass_rate` as unavailable with reasons. Detection delay is unavailable from single snapshots. It does not infer parameters from labels, count a fake CHR pass, or turn a missing backend into a successful run. `eval/results/agent.md` is reserved for a real investigation integration and is not fabricated here. diff --git a/eval/run.py b/eval/run.py new file mode 100644 index 0000000..de739ad --- /dev/null +++ b/eval/run.py @@ -0,0 +1,408 @@ +from __future__ import annotations + +import argparse +import json +import statistics +import time +from pathlib import Path +from typing import Any + +import numpy as np +import pandas as pd +from netcortex_detector.engine import ( + DetectorConfig, + DetectorUnavailable, + build_features, + run_engine, +) +from netcortex_detector.providers import FixtureBackend, TabPFNBackend +from netcortex_detector.thresholds import calibrate_threshold, normal_site_days + +ROOT = Path(__file__).resolve().parents[1] + + +def _load_case(path: Path) -> tuple[dict[str, Any], pd.DataFrame, pd.DataFrame]: + case = json.loads(path.read_text(encoding="utf-8")) + folder = path.parent + root = folder.resolve() + observation_paths = {} + for key in ("probe", "iface"): + candidate = (folder / case["observations"][key]).resolve() + if not candidate.is_relative_to(root): + raise ValueError(f"case observation path escapes split directory: {key}") + observation_paths[key] = candidate + probes = pd.read_parquet(observation_paths["probe"]) + interfaces = pd.read_parquet(observation_paths["iface"]) + return case, probes, interfaces + + +def _feature_rows(paths: list[Path]) -> tuple[list[pd.Series], list[str]]: + rows, labels = [], [] + for path in paths: + case, probes, interfaces = _load_case(path) + features = build_features(probes, interfaces, site_id=case["site_id"], as_of=case["as_of"]) + if not features.empty: + rows.append(features.iloc[-1]) + labels.append(case["expected"]["cause"]) + frame = pd.DataFrame(rows).fillna(0) + return [frame.iloc[i] for i in range(len(frame))], labels + + +def _verify_splits( + train: list[dict[str, Any]], + validation: list[dict[str, Any]], + test: list[dict[str, Any]], +) -> None: + for split, cases in (("train", train), ("validation", validation), ("test", test)): + if any(case["split"] != split for case in cases): + raise ValueError(f"case metadata contains wrong split under {split}/") + ids = [{case["case_id"] for case in split} for split in (train, validation, test)] + seeds = [{case["seed"] for case in split} for split in (train, validation, test)] + windows = [ + [(pd.Timestamp(case["case_start"]), pd.Timestamp(case["as_of"])) for case in split] + for split in (train, validation, test) + ] + for label, values in ( + ("case IDs", ids), + ("seeds", seeds), + ("time windows", windows), + ): + if label != "time windows" and ( + values[0] & values[1] or values[0] & values[2] or values[1] & values[2] + ): + raise ValueError(f"{label} overlap across train, validation and test") + for left in range(len(windows)): + for right in range(left + 1, len(windows)): + overlap = any( + a_start <= b_end and b_start <= a_end + for a_start, a_end in windows[left] + for b_start, b_end in windows[right] + ) + if overlap: + raise ValueError("case time windows overlap across train, validation and test") + + +def evaluate( + cases_dir: Path, + *, + mode: str, + out: Path, + limit: int | None = None, + investigator: Any | None = None, + params_validator: Any | None = None, + chr_checker: Any | None = None, +) -> dict[str, Any]: + split_paths = { + name: sorted((cases_dir / name).glob("*.json")) for name in ("train", "validation", "test") + } + if any(not paths for paths in split_paths.values()): + raise FileNotFoundError("expected train/, validation/, and test/ JSON case files") + split_data = { + name: [_load_case(path)[0] for path in paths] for name, paths in split_paths.items() + } + _verify_splits(split_data["train"], split_data["validation"], split_data["test"]) + backend = FixtureBackend() if mode == "mock" else TabPFNBackend(mode) + train_vectors, train_labels = _feature_rows(split_paths["train"]) + train_frame = pd.DataFrame(train_vectors).fillna(0) + setup_error = None + if isinstance(backend, TabPFNBackend): + try: + normal_train = train_frame.loc[np.asarray(train_labels) == "normal"] + backend.fit_anomaly(normal_train) + normal_reference = [] + for path in split_paths["validation"]: + case, probes, interfaces = _load_case(path) + if case["expected"]["cause"] != "normal": + continue + features = build_features( + probes, interfaces, site_id=case["site_id"], as_of=case["as_of"] + ) + if not features.empty: + normal_reference.append(backend.raw_anomaly(features.iloc[-1])) + backend.set_anomaly_reference(normal_reference) + except DetectorUnavailable as exc: + setup_error = str(exc) + validation_scores: list[float] = [] + validation_labels: list[bool] = [] + validation_sites: list[str] = [] + validation_normal_windows: list[tuple[str, str, str]] = [] + validation_unavailable = 0 + # Validation calibrates score threshold only; no test data participates. + for path in split_paths["validation"]: + case, probes, interfaces = _load_case(path) + if setup_error is not None: + validation_unavailable += 1 + continue + try: + result = run_engine( + probes, + interfaces, + site_id=case["site_id"], + as_of=case["as_of"], + history_start=case["history_window"]["start"], + backend=backend, + config=DetectorConfig(), + training_features=train_frame, + training_labels=train_labels, + anomaly_threshold=1.0, + ) + except DetectorUnavailable: + validation_unavailable += 1 + continue + if result["status"] == "ok": + validation_scores.append(result["anomaly_score"]) + is_normal = case["expected"]["cause"] == "normal" + validation_labels.append(not is_normal) + validation_sites.append(case["site_id"]) + if is_normal: + validation_normal_windows.append( + ( + case["site_id"], + case["detection_window"]["start"], + case["detection_window"]["end_inclusive"], + ) + ) + threshold = calibrate_threshold( + validation_scores, + validation_labels, + validation_sites, + exposure_intervals=validation_normal_windows, + ) + selected = split_paths["test"][:limit] if limit else split_paths["test"] + results = [] + for path in selected: + case, probes, interfaces = _load_case(path) + started = time.perf_counter() + try: + if setup_error is not None: + raise DetectorUnavailable(setup_error) + result = run_engine( + probes, + interfaces, + site_id=case["site_id"], + as_of=case["as_of"], + history_start=case["history_window"]["start"], + backend=backend, + training_features=train_frame, + training_labels=train_labels, + anomaly_threshold=threshold, + ) + status = result["status"] + except DetectorUnavailable as exc: + result, status = ( + {"error": str(exc), "provenance": backend.provenance}, + "unavailable", + ) + agent_result = None + hook_error = None + if investigator is not None and status == "ok": + try: + agent_result = investigator(result) + except Exception as exc: # noqa: BLE001 - injected integration hook boundary + hook_error = f"investigator unavailable ({type(exc).__name__})" + params_valid = None + chr_pass = None + if isinstance(agent_result, dict): + if params_validator is not None: + try: + params_valid = bool(params_validator(agent_result)) + except Exception as exc: # noqa: BLE001 - injected integration hook boundary + hook_error = f"parameter validation unavailable ({type(exc).__name__})" + if chr_checker is not None: + try: + chr_pass = bool(chr_checker(agent_result)) + except Exception as exc: # noqa: BLE001 - injected integration hook boundary + hook_error = f"CHR check unavailable ({type(exc).__name__})" + results.append( + { + "case_id": case["case_id"], + "site_id": case["site_id"], + "detection_start": case["detection_window"]["start"], + "detection_end": case["detection_window"]["end_inclusive"], + "expected_cause": case["expected"]["cause"], + "predicted_cause": result.get("cause"), + "expected_template": case["expected"].get("template_id"), + "agent_cause": agent_result.get("cause") + if isinstance(agent_result, dict) + else None, + "predicted_template": agent_result.get("template_id") + if isinstance(agent_result, dict) + else None, + "params_valid": params_valid, + "chr_pass": chr_pass, + "hook_error": hook_error, + "is_anomaly": result.get("is_anomaly"), + "status": status, + "seconds": time.perf_counter() - started, + "provenance": result.get("provenance"), + } + ) + scored = [r for r in results if r["status"] == "ok"] + positives = [r for r in scored if r["expected_cause"] != "normal"] + tp = sum(bool(r["is_anomaly"]) for r in positives) + fp = sum(bool(r["is_anomaly"]) for r in scored if r["expected_cause"] == "normal") + fn = len(positives) - tp + cause_correct = sum(r["predicted_cause"] == r["expected_cause"] for r in scored) + site_days = normal_site_days( + (row["site_id"], row["detection_start"], row["detection_end"]) + for row in scored + if row["expected_cause"] == "normal" + ) + report = { + "mode": mode, + "provenance": backend.provenance, + "requested_test_cases": len(selected), + "available_test_cases": len(scored), + "unavailable_cases": len(results) - len(scored), + "cause_accuracy": cause_correct / len(scored) if scored else None, + "cause_accuracy_denominator": len(scored), + "event_precision": tp / (tp + fp) if tp + fp else None, + "event_precision_denominator": tp + fp, + "event_recall": tp / (tp + fn) if tp + fn else None, + "event_recall_denominator": len(positives), + "false_alerts_per_site_day": fp / site_days if site_days else None, + "false_alerts_site_day_denominator": site_days, + "detection_delay_minutes": None, + "detection_delay_note": ( + "unavailable: runner scores one as_of snapshot per case; " + "minute-by-minute replay is required" + ), + "median_seconds": statistics.median([r["seconds"] for r in scored]) if scored else None, + "template_accuracy": _rate( + [ + r["predicted_template"] == r["expected_template"] + for r in results + if r["predicted_template"] is not None + ] + ), + "valid_params_rate": _rate( + [r["params_valid"] for r in results if r["params_valid"] is not None] + ), + "chr_dry_run_pass_rate": _rate( + [r["chr_pass"] for r in results if r["chr_pass"] is not None] + ), + "template_note": "measured from injected investigator hook" + if any(r["predicted_template"] is not None for r in results) + else "unavailable: Aun investigate/template contracts are not published", + "params_note": "measured from injected validator hook" + if any(r["params_valid"] is not None for r in results) + else ( + "unavailable: approved template schemas and observed parameter sources " + "are not published" + ), + "chr_note": "measured from injected checker hook" + if any(r["chr_pass"] is not None for r in results) + else "unavailable: Aun CHR checker and machine-readable result contract are not present", + "validation_score_count": len(validation_scores), + "validation_unavailable_cases": validation_unavailable, + "validation_normal_site_day_exposure": normal_site_days(validation_normal_windows), + "frozen_threshold": threshold, + "agent_cause_denominator": sum(r["agent_cause"] is not None for r in results), + "agent_cause_accuracy": _rate( + [ + r["agent_cause"] == r["expected_cause"] + for r in results + if r["agent_cause"] is not None + ] + ), + "template_denominator": sum(r["predicted_template"] is not None for r in results), + "template_accuracy_actual": _rate( + [ + r["predicted_template"] == r["expected_template"] + for r in results + if r["predicted_template"] is not None + ] + ), + "params_denominator": sum(r["params_valid"] is not None for r in results), + "params_rate_actual": _rate( + [r["params_valid"] for r in results if r["params_valid"] is not None] + ), + "chr_denominator": sum(r["chr_pass"] is not None for r in results), + "chr_pass_rate_actual": _rate( + [r["chr_pass"] for r in results if r["chr_pass"] is not None] + ), + "results": results, + } + out.parent.mkdir(parents=True, exist_ok=True) + out.write_text(_markdown(report), encoding="utf-8") + return report + + +def _rate(values: list[bool]) -> float | None: + return sum(values) / len(values) if values else None + + +def _markdown(report: dict[str, Any]) -> str: + fields = ("cause_accuracy", "event_precision", "event_recall", "median_seconds") + false_alerts = report["false_alerts_per_site_day"] + site_day_denominator = report["false_alerts_site_day_denominator"] + agent_cause_accuracy = report["agent_cause_accuracy"] + agent_cause_denominator = report["agent_cause_denominator"] + fixture_disclaimer = ( + "Fixture results describe only the deterministic fixture backend. " + "They are not TabPFN accuracy claims." + ) + lines = [ + "# Detector evaluation", + "", + f"Mode: `{report['mode']}`", + f"Provenance: {report['provenance']}", + f"Test cases available: {report['available_test_cases']} / " + f"{report['requested_test_cases']}", + f"Unavailable cases: {report['unavailable_cases']}", + "", + "| Measure | Result |", + "|---|---:|", + ] + for field in fields: + lines.append(f"| {field} | {report[field]} |") + lines += [ + "", + f"Precision denominator: {report['event_precision_denominator']}", + f"Recall denominator: {report['event_recall_denominator']}", + f"False alerts/site-day: {false_alerts} (site-day denominator {site_day_denominator})", + f"Detection delay: {report['detection_delay_minutes']} ({report['detection_delay_note']})", + f"Validation score count: {report['validation_score_count']}", + f"Validation unavailable cases: {report['validation_unavailable_cases']}", + f"Validation normal exposure (site-days): {report['validation_normal_site_day_exposure']}", + f"Frozen validation threshold: {report['frozen_threshold']}", + "", + f"Agent cause accuracy: {agent_cause_accuracy} (denominator {agent_cause_denominator})", + f"Template accuracy: {report['template_accuracy']} " + f"(denominator {report['template_denominator']}; {report['template_note']})", + f"Valid parameter rate: {report['valid_params_rate']} " + f"(denominator {report['params_denominator']}; {report['params_note']})", + f"CHR dry-run pass rate: {report['chr_dry_run_pass_rate']} " + f"(denominator {report['chr_denominator']}; {report['chr_note']})", + "", + *([fixture_disclaimer] if report["mode"] == "mock" else []), + "", + "## Cases", + "", + "| Case | Expected cause | Predicted cause | Anomaly | Status | Seconds |", + "|---|---|---|---:|---|---:|", + ] + lines += [ + f"| {r['case_id']} | {r['expected_cause']} | {r['predicted_cause']} | " + f"{r['is_anomaly']} | {r['status']} | {r['seconds']:.3f} |" + for r in report["results"] + ] + return "\n".join(lines) + "\n" + + +def main() -> int: + parser = argparse.ArgumentParser( + description="Evaluate NetCortex detector against held-out cases" + ) + parser.add_argument("--cases", type=Path, default=ROOT / "eval" / "cases") + parser.add_argument("--out", type=Path, default=ROOT / "eval" / "results" / "detector.md") + parser.add_argument("--mode", choices=("mock", "cloud", "local"), default="mock") + parser.add_argument("--limit", type=int, help="limit test cases for a fixture smoke run") + args = parser.parse_args() + report = evaluate(args.cases, mode=args.mode, out=args.out, limit=args.limit) + print(f"Evaluated {report['available_test_cases']} available cases; report: {args.out}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packages/detector/README.md b/packages/detector/README.md new file mode 100644 index 0000000..3e20861 --- /dev/null +++ b/packages/detector/README.md @@ -0,0 +1,24 @@ +# netcortex-detector + +Past-only feature construction and injected TabPFN 3.5 adapters for network metrics. The package has no dependency on Aun's unpublished core types. `run_engine()` accepts probe and interface DataFrames, aware UTC `as_of`, site, an injected backend, and optional train/validation inputs. `detect(site_id, window, history)` is the future core adapter and raises `DetectorUnavailable` until the real `netcortex_core.DetectionResult` and `MetricsWindow` contract can be bound. + +Base installation keeps the heavy inference stack optional: + +```powershell +python -m uv run --no-project --with-editable packages/detector --with pytest pytest packages/detector/tests +python -m uv run --no-project --with-editable packages/detector --with ruff ruff check packages/detector eval/run.py +``` + +For live inference install the optional `cloud` extra (tabpfn-client >=0.6.1, tabpfn >=9.2.0, tabpfn-extensions >=0.6.3, torch >=2.14.1) and provide `TABPFN_TOKEN` (or `TABPFN_API_KEY`), or install the `local` extra with compatible PyTorch/CUDA. Cloud calls use a 30-second client timeout. Cloud sends supplied telemetry to Prior Labs; check its current terms and commercial licensing before product use. Local checkpoint download may require Hugging Face access and acceptance of model terms. GTX 1660 6 GB compatibility has not been verified. No live credentials or successful external inference are claimed here. + +The evaluator supports `--mode mock`, `--mode cloud`, and `--mode local`. `mock` uses a deterministic persistence/heuristic backend only for exercising the pipeline; it does not represent TabPFN accuracy. Cloud/local modes fail visibly when dependencies, credentials, or model calls fail. Example after the simulator has generated its three splits: + +```powershell +python -m uv run --no-project --with-editable packages/detector --with pyarrow --with pandas python eval/run.py --mode mock --limit 8 +python -m uv run --no-project --with-editable "packages/detector[cloud]" --with pyarrow python eval/run.py --mode cloud +python -m uv run --no-project --with-editable "packages/detector[local]" --with pyarrow python eval/run.py --mode local +``` + +Expected labels are read only from case sidecars for training targets and scoring. They are not joined to feature rows. Validation labels select a cutoff by F1 subject to the false-alert budget; it is frozen before TEST scoring. The unsupervised model is fit on normal TRAIN observations and normalized against normal VALIDATION scores. Sustained evidence requires three consecutive observed values to exceed forecasts made before each value. DNS, subscriber, and supplemental backhaul observations are not accepted as core telemetry. Template parameter validity, Aun agent investigation, CHR results, and detection delay (single as-of snapshots provide no event trajectory) stay unavailable until real interfaces/data exist. + +See [decision.md](decision.md) and [flow.md](flow.md) for design choices and boundaries. diff --git a/packages/detector/decision.md b/packages/detector/decision.md new file mode 100644 index 0000000..0670b40 --- /dev/null +++ b/packages/detector/decision.md @@ -0,0 +1,10 @@ +# Detector decisions + +- Keep `run_engine()` independent from `netcortex_core`. Its inputs are the approved-shaped probe/interface frames, `site_id`, an aware UTC cutoff, an injected backend, and optional explicit training vectors. The core-facing `detect()` lazy-imports actual core symbols and fails clearly while their contract is unavailable; this avoids a copied Settings class or a guessed shared result schema. +- Build one-minute snapshots from source rows at or before `as_of`, grouped by target role and interface role supplied as configuration. Without a role mapping, exact target/interface identifiers stay separate under `target:`/`interface:` feature names; the detector does not infer that a host is DNS or an interface is an uplink. Only RTT, jitter, loss, utilization, drops, and errors enter this feature path. Supplemental DNS resolution, subscriber traffic, and backhaul quality rows remain experimental. +- Lags and rolling statistics shift by one minute; missing observations are never backfilled from the future. Rows for another site, invalid timestamps, and supplemental source rows are rejected. Probe and interface frames must each have a single, matching source when source metadata is supplied, preventing mixed live/simulator/RIPE measurements. Sparse history returns an explicit `insufficient_history` result with no cause. +- Cloud and local TabPFN adapters are lazy, optional integrations. They select TabPFN 3.5 and send explicit 0.1/0.5/0.9 regression quantiles. Cloud credentials come from an injected argument or `TABPFN_TOKEN`/`TABPFN_API_KEY`, are never logged, and client calls use a 30-second timeout. The local adapter uses `ModelVersion.V3_5`. The unsupervised extension is fit on normal TRAIN observations; its low log-likelihood is normalized by the empirical CDF of normal VALIDATION scores. Provider errors raise `DetectorUnavailable` and are never replaced by fixtures. +- Cause classifier fitting requires explicit aligned feature vectors and labels supplied by the caller. The evaluator builds those vectors from TRAIN case files only; validation labels select the threshold maximizing F1 under a false-alert budget computed from unioned normal detection-window exposure per site, consistent with the reported false-alert/site-day denominator. Positive cases and their event duration do not enlarge the budget. TEST is used only for scoring. Labels and expected template parameters are not feature columns. Fitted contexts use a fingerprint for cache keys; the expanded five-horizon training table is deterministically capped at 2,048 rows while retaining every horizon. +- Sustained forecast evidence is walk-forward: each of the last three contiguous minute observations is compared against a forecast made strictly earlier and targeting that exact minute. Forecast timestamps, horizon, finite quantiles, order, and physical bounds are validated. One excursion does not count as sustained. Missing, stale, or sparse input returns unavailable, not healthy. +- FixtureBackend exists only to exercise the offline pipeline. Its deterministic persistence bands and simple rules are identified in every result as fixture provenance and cannot support a TabPFN performance claim. +- Forecast output is returned in memory with model provenance. Database writes are not enabled: forecast writer ownership, conflict keys, and retry semantics are still open in Aun's contract request. Cause/template parameter construction and CHR checks are outside this package until their real contracts are available. diff --git a/packages/detector/flow.md b/packages/detector/flow.md new file mode 100644 index 0000000..36c867e --- /dev/null +++ b/packages/detector/flow.md @@ -0,0 +1,15 @@ +# Detector flow and API + +`build_features(probes, interfaces, *, site_id, as_of, target_roles=None, source_roles=None)` checks required columns, aware UTC cutoff, site isolation, timestamp validity, and source boundaries. If source fields are present, each frame must use one source and both frames must agree. It returns a one-minute-indexed pandas frame with past-only values, lags, rolling summaries, and UTC calendar fields. With no role mapping, target and interface IDs remain distinct with explicit `target:` and `interface:` prefixes. It raises `ValueError` for malformed or mixed-site inputs. + +`run_engine(probes, interfaces, *, site_id, as_of, backend, history_start=None, config=None, training_features=None, training_labels=None, anomaly_threshold=None)` is the independently testable inference API. It returns a plain dictionary with anomaly/cause/forecast/evidence fields, status, provenance, and a supplemental-use flag. Missing, stale, or sparse observations return `availability="unavailable"` and a null anomaly outcome. Invalid backend causes and provider failures are errors (`DetectorUnavailable`), not healthy results. The backend is injected; this function does not silently choose a mock. + +`detect(site_id, window, history)` is the planned core entry point. It lazy-imports `netcortex_core.DetectionResult` and checks the incoming window exposes `probe_metrics`, `iface_metrics`, and `as_of`. Until Aun publishes and merges those exact contracts and field mappings, it raises `DetectorUnavailable`; `history` is reserved for the approved historical context and currently is not interpreted. + +`TabPFNBackend("cloud" | "local")` supplies real provider calls. Cloud uses `tabpfn_client`, `TABPFN_TOKEN`/`TABPFN_API_KEY` or an injected key, `set_access_token`, v3.5 factories, and a 30-second client timeout. Local uses TabPFN classifier/regressor and `ModelVersion.V3_5`. Regressors request `output_type="quantiles"` for quantiles `[0.1, 0.5, 0.9]`; the bands are sorted before reporting. The unsupervised extension is fit on normal TRAIN data; low log-likelihood is normalized against normal VALIDATION scores. Regressors use lag/calendar predictors and shifted targets; only raw RTT, loss, and utilization are forecast targets. Horizon-expanded fit rows are capped at 2,048 with deterministic per-horizon sampling. Quantile-first SDK responses are converted horizon-wise, and nonfinite, unordered, out-of-range, or invalid-time forecasts fail explicitly. Missing packages, key, model download, GPU/runtime support, and inference failures are explicit. No network request is made by the unit tests. + +`FixtureBackend` is an explicit offline fixture only. Its provenance is embedded in outputs. It supplies deterministic persistence bands and simple visible rules to verify evaluator wiring, not product inference. + +`python eval/run.py --mode mock|cloud|local [--cases eval/cases] [--out eval/results/detector.md] [--limit N]` consumes each split directory's JSON sidecars and Parquet probe/interface observations. It verifies split IDs, seeds, and event intervals do not overlap and observation paths cannot escape split directories. TRAIN sidecar causes are labels for classifier fitting only; VALIDATION calibrates the anomaly cutoff; TEST produces metrics. It records actual denominators and unavailable results. Aun's `investigate()`, template schema/parameter validation, and CHR check are reported unavailable until implemented and machine-readable. + +The runner writes Markdown. `eval/results/agent.md` follows the same principle: agent, parameter, and router-check metrics remain unavailable unless those real APIs return recorded results; the runner does not make substitute claims. diff --git a/packages/detector/pyproject.toml b/packages/detector/pyproject.toml new file mode 100644 index 0000000..5f53a5e --- /dev/null +++ b/packages/detector/pyproject.toml @@ -0,0 +1,31 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "netcortex-detector" +version = "0.1.0" +description = "Past-only TabPFN network metric detector" +requires-python = ">=3.12" +dependencies = ["numpy>=2.0", "pandas>=2.2", "pyarrow>=18"] + +[project.optional-dependencies] +cloud = ["tabpfn-client>=0.6.1", "tabpfn>=9.2.0", "tabpfn-extensions>=0.6.3", "torch>=2.14.1"] +local = ["tabpfn>=9.2.0", "tabpfn-extensions>=0.6.3", "torch>=2.14.1"] +dev = ["pytest>=8", "ruff>=0.9"] + +[project.scripts] +netcortex-detector = "netcortex_detector.cli:main" + +[tool.hatch.build.targets.wheel] +packages = ["src/netcortex_detector"] + +[tool.pytest.ini_options] +testpaths = ["tests"] + +[tool.ruff] +line-length = 100 +target-version = "py312" + +[tool.ruff.lint] +select = ["E", "F", "I", "UP", "B"] diff --git a/packages/detector/src/netcortex_detector/__init__.py b/packages/detector/src/netcortex_detector/__init__.py new file mode 100644 index 0000000..a8d29c9 --- /dev/null +++ b/packages/detector/src/netcortex_detector/__init__.py @@ -0,0 +1,6 @@ +"""Network telemetry features and TabPFN detector adapters.""" + +from netcortex_detector.engine import DetectorConfig, DetectorUnavailable, build_features + +__all__ = ["DetectorConfig", "DetectorUnavailable", "build_features"] +__version__ = "0.1.0" diff --git a/packages/detector/src/netcortex_detector/cli.py b/packages/detector/src/netcortex_detector/cli.py new file mode 100644 index 0000000..0812745 --- /dev/null +++ b/packages/detector/src/netcortex_detector/cli.py @@ -0,0 +1,92 @@ +from __future__ import annotations + +import argparse +import json +import sys +from pathlib import Path + +import numpy as np +import pandas as pd + +from netcortex_detector.engine import DetectorConfig, DetectorUnavailable, run_engine +from netcortex_detector.providers import FixtureBackend, TabPFNBackend + + +def _model_inputs(backend: TabPFNBackend, train_path: Path, validation_path: Path): + train = pd.read_parquet(train_path) + validation = pd.read_parquet(validation_path) + if "cause" not in train or "cause" not in validation: + raise ValueError("train and validation feature Parquet files must have a cause column") + train_labels = train.pop("cause").astype(str).tolist() + validation_labels = validation.pop("cause").astype(str).tolist() + if list(train.columns) != list(validation.columns): + raise ValueError("train and validation feature columns must match in the same order") + train = train.fillna(0) + validation = validation.fillna(0) + backend.fit_anomaly(train.loc[np.asarray(train_labels) == "normal"]) + normal_scores = [ + backend.raw_anomaly(validation.iloc[index]) + for index, label in enumerate(validation_labels) + if label == "normal" + ] + backend.set_anomaly_reference(normal_scores) + val_scores = [backend.anomaly(validation.iloc[index]) for index in range(len(validation))] + return train, train_labels, val_scores, [label != "normal" for label in validation_labels] + + +def main() -> int: + parser = argparse.ArgumentParser(description="Run one NetCortex detector evaluation window") + mode = parser.add_mutually_exclusive_group(required=True) + mode.add_argument("--mock", action="store_true", help="use explicit fixture-only backend") + mode.add_argument("--mode", choices=("cloud", "local"), help="use an actual TabPFN provider") + parser.add_argument("--site-id", required=True) + parser.add_argument("--probes", required=True, type=Path) + parser.add_argument("--interfaces", required=True, type=Path) + parser.add_argument("--as-of", required=True, help="timezone-aware ISO-8601 timestamp") + parser.add_argument("--history-start", help="timezone-aware ISO-8601 timestamp") + parser.add_argument("--train", type=Path, help="TRAIN feature Parquet with a cause column") + parser.add_argument( + "--validation", type=Path, help="VALIDATION feature Parquet with a cause column" + ) + args = parser.parse_args() + if bool(args.train) != bool(args.validation): + parser.error("--train and --validation must be supplied together") + try: + probes, interfaces = pd.read_parquet(args.probes), pd.read_parquet(args.interfaces) + backend = FixtureBackend() if args.mock else TabPFNBackend(args.mode) + train_features = train_labels = None + threshold = None + if isinstance(backend, TabPFNBackend): + if not args.train: + raise ValueError( + "real inference requires TRAIN and VALIDATION feature Parquet inputs" + ) + train_features, train_labels, val_scores, val_labels = _model_inputs( + backend, args.train, args.validation + ) + from netcortex_detector.thresholds import calibrate_threshold + + threshold = calibrate_threshold( + val_scores, val_labels, [args.site_id] * len(val_scores) + ) + result = run_engine( + probes, + interfaces, + site_id=args.site_id, + as_of=args.as_of, + history_start=args.history_start, + backend=backend, + config=DetectorConfig(), + training_features=train_features, + training_labels=train_labels, + anomaly_threshold=threshold, + ) + print(json.dumps(result, indent=2, default=str)) + return 0 if result["status"] == "ok" else 2 + except (DetectorUnavailable, ValueError, OSError) as exc: + print(f"detector unavailable: {exc}", file=sys.stderr) + return 2 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packages/detector/src/netcortex_detector/engine.py b/packages/detector/src/netcortex_detector/engine.py new file mode 100644 index 0000000..3203fa0 --- /dev/null +++ b/packages/detector/src/netcortex_detector/engine.py @@ -0,0 +1,470 @@ +from __future__ import annotations + +import hashlib +import importlib +from dataclasses import dataclass +from datetime import datetime +from typing import Any, Protocol + +import numpy as np +import pandas as pd + +CAUSES = ( + "uplink_congestion", + "heavy_user", + "upstream_degradation", + "game_route_issue", + "wireless_interference", + "uplink_down", + "dns_slow", + "normal", +) +PROBE_COLUMNS = {"time", "site_id", "target", "rtt_ms", "jitter_ms", "loss_pct"} +IFACE_COLUMNS = {"time", "site_id", "iface", "util_pct", "drops", "errors"} + + +class DetectorUnavailable(RuntimeError): + """The requested core or model integration is absent or failed.""" + + +@dataclass(frozen=True) +class DetectorConfig: + mode: str = "cloud" + context_rows: int = 2048 + threshold: float = 0.7 + min_history_minutes: int = 5 + source_roles: dict[str, str] | None = None + target_roles: dict[str, str] | None = None + + +class Backend(Protocol): + provenance: str + + def forecasts(self, history: pd.DataFrame, horizon: int) -> list[dict[str, Any]]: ... + def cause(self, vector: pd.Series) -> tuple[str, float]: ... + def anomaly(self, vector: pd.Series) -> float: ... + + +def _utc_series(values: pd.Series, name: str) -> pd.Series: + if any(pd.Timestamp(value).tzinfo is None for value in values if pd.notna(value)): + raise ValueError(f"{name}.time must contain timezone-aware UTC timestamps") + parsed = pd.to_datetime(values, utc=True, errors="coerce") + if parsed.isna().any(): + raise ValueError(f"{name}.time contains invalid timestamps") + return parsed + + +def _validate_frame( + frame: pd.DataFrame, required: set[str], name: str, site_id: str +) -> pd.DataFrame: + missing = required - set(frame.columns) + if missing: + raise ValueError(f"{name} missing required columns: {', '.join(sorted(missing))}") + result = frame.copy() + if result.empty: + return result + result["time"] = _utc_series(result["time"], name) + if not result["site_id"].eq(site_id).all(): + raise ValueError(f"{name} contains rows for a different site") + if "source" in result and result["source"].astype(str).str.startswith("sim_supplemental").any(): + raise ValueError(f"{name} contains experimental supplemental rows") + return result.sort_values("time", kind="stable") + + +def build_features( + probes: pd.DataFrame, + interfaces: pd.DataFrame, + *, + site_id: str, + as_of: datetime | pd.Timestamp | str, + target_roles: dict[str, str] | None = None, + source_roles: dict[str, str] | None = None, +) -> pd.DataFrame: + """Build UTC minute snapshots from observations at or before as_of only.""" + p = _validate_frame(probes, PROBE_COLUMNS, "probe", site_id) + i = _validate_frame(interfaces, IFACE_COLUMNS, "interface", site_id) + _validate_source_consistency(p, i) + _validate_bounds( + p, {"rtt_ms": (0, None), "jitter_ms": (0, None), "loss_pct": (0, 100)}, "probe" + ) + _validate_bounds( + i, {"util_pct": (0, 100), "drops": (0, None), "errors": (0, None)}, "interface" + ) + cutoff = pd.Timestamp(as_of) + if cutoff.tzinfo is None: + raise ValueError("as_of must be timezone-aware") + cutoff = cutoff.tz_convert("UTC") + p = p[p.time <= cutoff] + i = i[i.time <= cutoff] + role_map = target_roles or {} + if not p.empty: + p = p.copy() + p["target_role"] = p.target.map(role_map).fillna("target:" + p.target.astype(str)) + p["minute"] = p.time.dt.floor("min") + pg = ( + p.groupby(["minute", "target_role"], observed=True) + .agg( + rtt_ms=("rtt_ms", "median"), + jitter_ms=("jitter_ms", "median"), + loss_pct=("loss_pct", "mean"), + samples=("time", "size"), + ) + .reset_index() + ) + wide = pg.pivot( + index="minute", columns="target_role", values=["rtt_ms", "jitter_ms", "loss_pct"] + ) + wide.columns = [f"{metric}_{role}" for metric, role in wide.columns] + probe_features = wide + else: + probe_features = pd.DataFrame() + if not i.empty: + i = i.copy() + i["iface_role"] = i.iface.map(source_roles or {}).fillna("interface:" + i.iface.astype(str)) + i["minute"] = i.time.dt.floor("min") + ig = i.groupby(["minute", "iface_role"], observed=True).agg( + util_pct=("util_pct", "mean"), + drops=("drops", "sum"), + errors=("errors", "sum"), + ) + iface_features = ig.unstack("iface_role") + iface_features.columns = [ + f"iface_{metric}_{role}" for metric, role in iface_features.columns + ] + else: + iface_features = pd.DataFrame() + combined = probe_features.join(iface_features, how="outer").sort_index() + if combined.empty: + return combined + combined = combined.loc[combined.index <= cutoff.floor("min")].copy() + # No backfill: missing measurements stay missing and cannot import future values. + combined = combined.ffill(limit=2) + for col in list(combined.columns): + combined[f"{col}_lag1"] = combined[col].shift(1) + combined[f"{col}_mean5"] = combined[col].rolling(5, min_periods=3).mean().shift(1) + combined[f"{col}_std5"] = combined[col].rolling(5, min_periods=3).std().shift(1) + minutes = combined.index + combined["minute_of_day"] = minutes.hour * 60 + minutes.minute + combined["day_of_week"] = minutes.dayofweek + combined.index.name = "time" + return combined.replace([np.inf, -np.inf], np.nan) + + +def _validate_bounds( + frame: pd.DataFrame, limits: dict[str, tuple[float, float | None]], name: str +) -> None: + for column, (lower, upper) in limits.items(): + values = pd.to_numeric(frame[column], errors="coerce") + if frame[column].notna().ne(values.notna()).any(): + raise ValueError(f"{name}.{column} contains nonnumeric observations") + if (values.dropna() < lower).any() or ( + upper is not None and (values.dropna() > upper).any() + ): + raise ValueError(f"{name}.{column} is outside its valid range") + + +def _vector(frame: pd.DataFrame, as_of: pd.Timestamp) -> pd.Series: + prior = frame.loc[frame.index <= as_of.floor("min")] + if prior.empty: + return pd.Series(dtype=float) + row = prior.iloc[-1] + return pd.to_numeric(row, errors="coerce").replace([np.inf, -np.inf], np.nan).fillna(0.0) + + +def consecutive_forecast_exceedances( + observed: pd.Series, forecasts: pd.DataFrame, *, p: str = "p90", required: int = 3 +) -> int: + """Count the trailing consecutive actuals above forecasts made before each actual.""" + required_columns = {"made_at", "target_time", p} + if required_columns - set(forecasts.columns): + missing = ", ".join(sorted(required_columns - set(forecasts.columns))) + raise ValueError(f"forecasts missing columns: {missing}") + made = pd.to_datetime(forecasts["made_at"], utc=True, errors="coerce") + target = pd.to_datetime(forecasts["target_time"], utc=True, errors="coerce") + rows = forecasts.copy() + rows["made_at"], rows["target_time"] = made, target + rows = rows[rows["made_at"] < rows["target_time"]] + actual = observed.copy() + actual.index = pd.to_datetime(actual.index, utc=True, errors="coerce") + if actual.index.isna().any() or rows[["made_at", "target_time"]].isna().any().any(): + raise ValueError("observed and forecast timestamps must be valid") + by_target = ( + rows.sort_values("made_at") + .drop_duplicates("target_time", keep="last") + .set_index("target_time") + ) + hits = [] + for at, value in actual.sort_index().items(): + forecast = by_target.loc[at] if at in by_target.index else None + hits.append(bool(forecast is not None and forecast["made_at"] < at and value > forecast[p])) + count = 0 + for hit in reversed(hits): + if not hit: + break + count += 1 + return count if count >= required else 0 + + +def run_engine( + probes: pd.DataFrame, + interfaces: pd.DataFrame, + *, + site_id: str, + as_of: datetime | pd.Timestamp | str, + history_start: datetime | pd.Timestamp | str | None = None, + backend: Backend, + config: DetectorConfig | None = None, + training_features: pd.DataFrame | None = None, + training_labels: list[str] | None = None, + anomaly_threshold: float | None = None, +) -> dict[str, Any]: + """Independent engine entry point for an injected real provider or explicit fixture backend.""" + cfg = config or DetectorConfig() + end = pd.Timestamp(as_of) + if end.tzinfo is None: + raise ValueError("as_of must be timezone-aware") + end = end.tz_convert("UTC") + features = build_features( + probes, + interfaces, + site_id=site_id, + as_of=end, + target_roles=cfg.target_roles, + source_roles=cfg.source_roles, + ) + if probes.empty: + return _empty_result(site_id, end, backend.provenance, "missing_probe_data") + if interfaces.empty: + return _empty_result(site_id, end, backend.provenance, "missing_interface_data") + for frame, kind in ((probes, "probe"), (interfaces, "interface")): + past = frame.loc[pd.to_datetime(frame["time"], utc=True) <= end] + if past.empty: + return _empty_result(site_id, end, backend.provenance, f"missing_{kind}_data") + latest = pd.to_datetime(past["time"], utc=True).max() + if end - latest > pd.Timedelta(minutes=2): + return _empty_result(site_id, end, backend.provenance, "stale_data") + if history_start is not None: + start = pd.Timestamp(history_start) + if start.tzinfo is None: + raise ValueError("history_start must be timezone-aware") + features = features.loc[features.index >= start.tz_convert("UTC")] + if len(features.dropna(how="all")) < cfg.min_history_minutes: + return _empty_result(site_id, end, backend.provenance, "insufficient_history") + if end.floor("min") - features.index.max() > pd.Timedelta(minutes=2): + return _empty_result(site_id, end, backend.provenance, "stale_data") + if not _has_finite_evidence(features): + return _empty_result(site_id, end, backend.provenance, "invalid_measurements") + vector = _vector(features, end) + try: + forecasts = backend.forecasts(features.tail(cfg.context_rows), 5) + _validate_forecast_rows(forecasts) + sustained = _walk_forward_exceedances(features.tail(cfg.context_rows), backend, cfg) + if ( + training_features is not None + and training_labels is not None + and hasattr(backend, "predict_cause") + ): + cause, confidence = backend.predict_cause(vector, training_features, training_labels) + else: + cause, confidence = backend.cause(vector) + confidence = float(confidence) + raw_anomaly = float(backend.anomaly(vector)) + if not np.isfinite(confidence) or not np.isfinite(raw_anomaly): + raise DetectorUnavailable("backend returned a nonfinite score or confidence") + anomaly = float(np.clip(raw_anomaly, 0.0, 1.0)) + except Exception as exc: + raise DetectorUnavailable( + f"{backend.provenance} inference failed ({type(exc).__name__})" + ) from exc + if cause not in CAUSES: + raise DetectorUnavailable(f"backend returned unsupported cause {cause!r}") + threshold = float( + np.clip(anomaly_threshold if anomaly_threshold is not None else cfg.threshold, 0.0, 1.0) + ) + anomalous = bool(sustained or anomaly >= threshold) + evidence = [ + f"{key} observed {value:.2f} at {end.isoformat()}" + for key, value in vector.items() + if key.startswith(("iface_util_pct", "loss_pct", "rtt_ms")) + and np.isfinite(value) + and abs(float(value)) > 0 + ][:8] + return { + "site_id": site_id, + "as_of": end.isoformat(), + "is_anomaly": anomalous, + "anomaly_score": anomaly, + "threshold": threshold, + "cause": cause, + "cause_confidence": float(np.clip(confidence, 0.0, 1.0)), + "forecasts": forecasts, + "evidence": evidence, + "status": "ok", + "availability": "available", + "provenance": backend.provenance, + "supplemental_used": False, + "sustained_forecast_exceedance": sustained, + } + + +def _walk_forward_exceedances( + features: pd.DataFrame, backend: Backend, config: DetectorConfig +) -> bool: + """Forecast the final three actual points from strictly earlier observations.""" + targets = [ + column + for column in features.columns + if column.startswith(("rtt_ms_", "loss_pct_", "iface_util_pct_")) + and not column.endswith(("_lag1", "_mean5", "_std5")) + ] + times = features.index[-3:] + if len(times) != 3: + return False + if any( + (times[position] - times[position - 1]) != pd.Timedelta(minutes=1) for position in (1, 2) + ): + return False + hits: dict[str, list[bool]] = {metric: [] for metric in targets} + for target_time in times: + prior = features.loc[features.index < target_time].tail(config.context_rows) + if len(prior) < config.min_history_minutes: + return False + made = backend.forecasts(prior, 1) + by_metric = {str(row["metric"]): row for row in made} + for metric in targets: + forecast = by_metric.get(metric) + actual = features.loc[target_time, metric] + admissible = ( + forecast is not None + and pd.Timestamp(forecast["made_at"]) < target_time + and pd.Timestamp(forecast["target_time"]) == target_time + and int(forecast.get("horizon_minutes", -1)) == 1 + ) + hits[metric].append( + bool(admissible and np.isfinite(actual) and float(actual) > float(forecast["p90"])) + ) + return any(len(values) == 3 and all(values) for values in hits.values()) + + +def _validate_source_consistency(probes: pd.DataFrame, interfaces: pd.DataFrame) -> None: + sources = [] + source_metadata_present = [] + for name, frame in (("probe", probes), ("interface", interfaces)): + source_metadata_present.append("source" in frame and not frame.empty) + if "source" not in frame or frame.empty: + continue + values = set(frame["source"].dropna().astype(str).unique()) + if len(values) > 1: + raise ValueError(f"{name} frame mixes measurement sources") + if values: + sources.append(values.pop()) + if ( + all(not frame.empty for frame in (probes, interfaces)) + and any(source_metadata_present) + and not all(source_metadata_present) + ): + raise ValueError("probe and interface frames must both identify their measurement source") + if len(set(sources)) > 1: + raise ValueError("probe and interface frames use different measurement sources") + + +def _has_finite_evidence(features: pd.DataFrame) -> bool: + if features.empty: + return False + row = features.iloc[-1] + probe_valid = False + loss_columns = [ + c + for c in row.index + if c.startswith("loss_pct_") and not c.endswith(("_lag1", "_mean5", "_std5")) + ] + for name in row.index: + value = row[name] + if not np.isfinite(value): + continue + if name.startswith("rtt_ms_") and not name.endswith(("_lag1", "_mean5", "_std5")): + probe_valid = True + if not probe_valid: + probe_valid = any( + np.isfinite(row[name]) and float(row[name]) == 100.0 for name in loss_columns + ) + interface_valid = any( + name.startswith(("iface_util_pct_", "iface_drops_", "iface_errors_")) + and not name.endswith(("_lag1", "_mean5", "_std5")) + and np.isfinite(value) + for name, value in row.items() + ) + return probe_valid and interface_valid + + +def _validate_forecast_rows(rows: list[dict[str, Any]]) -> None: + for row in rows: + try: + metric = str(row["metric"]) + horizon = int(row["horizon_minutes"]) + low, median, high = (float(row[key]) for key in ("p10", "p50", "p90")) + made_at = pd.Timestamp(row["made_at"]) + target_time = pd.Timestamp(row["target_time"]) + except (KeyError, TypeError, ValueError) as exc: + raise DetectorUnavailable("backend returned malformed forecasts") from exc + if not metric.startswith(("rtt_ms_", "loss_pct_", "iface_util_pct_")): + raise DetectorUnavailable("backend returned an unsupported forecast metric") + if horizon < 1 or horizon > 5: + raise DetectorUnavailable("backend returned an unsupported forecast horizon") + if ( + made_at.tzinfo is None + or target_time.tzinfo is None + or target_time.tz_convert("UTC") + != made_at.tz_convert("UTC").floor("min") + pd.Timedelta(minutes=horizon) + ): + raise DetectorUnavailable("backend returned invalid forecast timestamps") + upper = 100.0 if metric.startswith(("loss_pct_", "iface_util_pct_")) else None + if ( + not np.isfinite([low, median, high]).all() + or not low <= median <= high + or low < 0 + or (upper is not None and high > upper) + ): + raise DetectorUnavailable("backend returned invalid forecast quantiles") + + +def _empty_result(site_id: str, at: pd.Timestamp, provenance: str, status: str) -> dict[str, Any]: + return { + "site_id": site_id, + "as_of": at.isoformat(), + "is_anomaly": None, + "anomaly_score": None, + "threshold": None, + "cause": None, + "cause_confidence": 0.0, + "forecasts": [], + "evidence": [], + "status": status, + "provenance": provenance, + "supplemental_used": False, + "availability": "unavailable", + } + + +def detect(site_id: str, window: Any, history: Any) -> Any: + """Core-facing API; it binds only to Aun's real core contract when available.""" + try: + core = importlib.import_module("netcortex_core") + result_type = core.DetectionResult + required = ("probe_metrics", "iface_metrics", "as_of") + if any(not hasattr(window, name) for name in required): + raise AttributeError("MetricsWindow lacks probe_metrics, iface_metrics, or as_of") + except (ImportError, AttributeError) as exc: + raise DetectorUnavailable( + "public detect() is unavailable until netcortex_core publishes DetectionResult " + "and the approved MetricsWindow contract; use run_engine() with injected inputs" + ) from exc + raise DetectorUnavailable( + f"core adapter requires approved field mapping for {result_type.__name__}" + ) + + +def fingerprint(frame: pd.DataFrame) -> str: + """Stable small-input cache key, excluding caller-owned object identity.""" + payload = pd.util.hash_pandas_object(frame, index=True).values.tobytes() + return hashlib.sha256(payload).hexdigest() diff --git a/packages/detector/src/netcortex_detector/providers.py b/packages/detector/src/netcortex_detector/providers.py new file mode 100644 index 0000000..ee8cc1b --- /dev/null +++ b/packages/detector/src/netcortex_detector/providers.py @@ -0,0 +1,400 @@ +from __future__ import annotations + +import os +import warnings +from typing import Any + +import numpy as np +import pandas as pd + +from netcortex_detector.engine import CAUSES, DetectorUnavailable, fingerprint + +RAW_METRIC_PREFIXES = ("rtt_ms_", "loss_pct_", "iface_util_pct_") +LAG_PREFIXES = ("rtt_ms_", "jitter_ms_", "loss_pct_", "iface_") +DERIVED_SUFFIXES = ("_lag1", "_mean5", "_std5") +MAX_TRAINING_ROWS = 2048 + + +def _array(frame: pd.DataFrame) -> np.ndarray: + return ( + frame.select_dtypes(include=["number"]) + .replace([np.inf, -np.inf], np.nan) + .fillna(0) + .to_numpy(dtype=float) + ) + + +def _bounded_horizon_rows( + x_parts: list[pd.DataFrame], y_parts: list[pd.Series], max_rows: int +) -> tuple[pd.DataFrame, np.ndarray]: + """Cap expanded training rows deterministically while retaining each horizon.""" + groups = [ + (x.reset_index(drop=True), y.reset_index(drop=True)) + for x, y in zip(x_parts, y_parts, strict=True) + ] + nonempty = [(x, y) for x, y in groups if len(x)] + if len(nonempty) > max_rows: + raise DetectorUnavailable("forecast row budget is too small to retain every horizon") + base, remainder = divmod(max_rows, len(nonempty)) if nonempty else (0, 0) + selected_x, selected_y = [], [] + for position, (x, y) in enumerate(nonempty): + quota = min(len(x), base + (position < remainder)) + indices = np.linspace(0, len(x) - 1, quota, dtype=int) if quota else np.array([], dtype=int) + selected_x.append(x.iloc[indices]) + selected_y.append(y.iloc[indices]) + if not selected_x: + return pd.DataFrame(), np.array([], dtype=float) + return pd.concat(selected_x, ignore_index=True), pd.concat(selected_y).to_numpy(dtype=float) + + +def _quantile_matrix(response: Any, horizons: int) -> np.ndarray: + """Normalize documented quantile-first [q10, q50, q90] arrays to horizons x 3.""" + if isinstance(response, (list, tuple)) and len(response) == 3: + columns = [np.asarray(values, dtype=float).reshape(-1) for values in response] + if any(len(column) != horizons for column in columns): + raise DetectorUnavailable( + "TabPFN returned a quantile array with the wrong horizon count" + ) + return np.column_stack(columns) + values = np.asarray(response, dtype=float) + if values.shape == (horizons, 3): + return values + if values.shape == (3, horizons): + return values.T + raise DetectorUnavailable("TabPFN returned quantiles with an unsupported shape") + + +def _validate_forecast_values( + metric: str, low: float, median: float, high: float, horizon: int +) -> None: + if horizon < 1 or horizon > 5: + raise DetectorUnavailable("TabPFN returned an unsupported forecast horizon") + if not np.isfinite([low, median, high]).all() or not low <= median <= high: + raise DetectorUnavailable("TabPFN returned nonfinite or unordered quantiles") + upper = 100.0 if metric.startswith(("loss_pct_", "iface_util_pct_")) else None + if low < 0 or (upper is not None and high > upper): + raise DetectorUnavailable("TabPFN forecast is outside physical metric bounds") + + +class FixtureBackend: + """Deterministic offline backend. Results must be labelled fixture provenance.""" + + provenance = "fixture: deterministic persistence/heuristic backend; no TabPFN inference" + + def forecasts(self, history: pd.DataFrame, horizon: int) -> list[dict[str, Any]]: + numeric = history.select_dtypes(include=["number"]).tail(30) + origin = pd.Timestamp(history.index.max()) + out = [] + for metric in ( + column + for column in numeric.columns + if column.startswith(RAW_METRIC_PREFIXES) and not column.endswith(DERIVED_SUFFIXES) + ): + values = numeric[metric].dropna().to_numpy(dtype=float) + if not len(values): + continue + center = float(np.median(values[-5:])) + spread = max(float(np.median(np.abs(values - np.median(values))) * 1.4826), 0.01) + lower = 0.0 + upper = 100.0 if metric.startswith(("loss_pct_", "iface_util_pct_")) else np.inf + for step in range(1, horizon + 1): + out.append( + { + "metric": metric, + "made_at": origin.isoformat(), + "target_time": ( + origin.floor("min") + pd.Timedelta(minutes=step) + ).isoformat(), + "horizon_minutes": step, + "p10": max(lower, center - 1.2816 * spread), + "p50": float(np.clip(center, lower, upper)), + "p90": min(upper, center + 1.2816 * spread), + "model": "fixture_persistence", + } + ) + return out + + def cause(self, vector: pd.Series) -> tuple[str, float]: + util = _first(vector, "iface_util_pct_") + loss = max( + (_first(vector, k) for k in vector.index if k.startswith("loss_pct_")), default=0.0 + ) + if util > 96 and loss > 2: + return "uplink_congestion", 0.70 + if util < 10 and loss >= 99: + return "uplink_down", 0.65 + if loss > 20: + return "wireless_interference", 0.55 + return "normal", 0.55 + + def anomaly(self, vector: pd.Series) -> float: + util = _first(vector, "iface_util_pct_") + loss = max( + (_first(vector, k) for k in vector.index if k.startswith("loss_pct_")), default=0.0 + ) + return float(np.clip(max((util - 90) / 10, loss / 100), 0.0, 1.0)) + + +def _first(vector: pd.Series, prefix: str) -> float: + values = [ + float(value) + for key, value in vector.items() + if key.startswith(prefix) and np.isfinite(value) + ] + return values[0] if values else 0.0 + + +class TabPFNBackend: + """Cloud or local TabPFN 3.5 adapters with bounded inputs and cached fits.""" + + def __init__(self, mode: str, *, access_token: str | None = None, timeout_s: float = 30.0): + if mode not in {"cloud", "local"}: + raise ValueError("mode must be cloud or local") + self.mode = mode + self.access_token = access_token or os.getenv("TABPFN_TOKEN") or os.getenv("TABPFN_API_KEY") + self.timeout_s = timeout_s + self.provenance = f"tabpfn-{mode}:v3.5" + self._models: dict[tuple[str, str], Any] = {} + self._model_classes: tuple[Any, Any] | None = None + self._unsupervised: Any | None = None + self._anomaly_columns: list[str] = [] + self._anomaly_reference: np.ndarray | None = None + + def _imports(self) -> tuple[Any, Any]: + if self._model_classes is not None: + return self._model_classes + try: + if self.mode == "cloud": + if not self.access_token: + raise DetectorUnavailable( + "TABPFN_TOKEN (or TABPFN_API_KEY) is required for cloud inference" + ) + from tabpfn_client import TabPFNClassifier, TabPFNRegressor, set_access_token + from tabpfn_client.models import ClientOptions + + set_access_token(self.access_token) + options = {"client_options": ClientOptions(timeout=self.timeout_s)} + clf = TabPFNClassifier.create_default_for_version("v3.5", **options) + reg = TabPFNRegressor.create_default_for_version("v3.5", **options) + else: + from tabpfn import TabPFNClassifier, TabPFNRegressor + from tabpfn.constants import ModelVersion + + clf = TabPFNClassifier.create_default_for_version(ModelVersion.V3_5) + reg = TabPFNRegressor.create_default_for_version(ModelVersion.V3_5) + self._model_classes = (clf.__class__, reg.__class__) + return self._model_classes + except DetectorUnavailable: + raise + except Exception as exc: + raise DetectorUnavailable( + f"TabPFN {self.mode} dependencies/model unavailable ({type(exc).__name__})" + ) from exc + + def _new_model(self, kind: str) -> Any: + classes = self._imports() + model_class = classes[0 if kind == "classifier" else 1] + if self.mode == "local": + from tabpfn.constants import ModelVersion + + return model_class.create_default_for_version(ModelVersion.V3_5) + from tabpfn_client.models import ClientOptions + + return model_class.create_default_for_version( + "v3.5", client_options=ClientOptions(timeout=self.timeout_s) + ) + + def _cache_model(self, key: tuple[str, str], model: Any) -> None: + if key not in self._models and len(self._models) >= 128: + self._models.pop(next(iter(self._models))) + self._models[key] = model + + def _classifier(self, x: np.ndarray, y: np.ndarray) -> Any: + key = ("classifier", fingerprint(pd.DataFrame(np.column_stack((x, y))))) + if key not in self._models: + model = self._new_model("classifier") + try: + model.fit(x, y) + except Exception as exc: + raise DetectorUnavailable( + f"TabPFN classifier fit failed ({type(exc).__name__})" + ) from exc + self._cache_model(key, model) + return self._models[key] + + def fit_cause_model(self, features: pd.DataFrame, labels: list[str]) -> str: + if len(features) != len(labels) or not labels: + raise ValueError("training feature and label rows must be nonempty and aligned") + if any(label not in CAUSES for label in labels): + raise ValueError("training labels contain unsupported causes") + x, y = _array(features), np.asarray(labels) + self._classifier(x, y) + return fingerprint(pd.DataFrame(np.column_stack((x, y)))) + + def predict_cause( + self, vector: pd.Series, training_features: pd.DataFrame, training_labels: list[str] + ) -> tuple[str, float]: + x_train, y_train = _array(training_features), np.asarray(training_labels) + model = self._classifier(x_train, y_train) + aligned = vector.reindex(training_features.columns, fill_value=0.0) + try: + probs = model.predict_proba(_array(pd.DataFrame([aligned]))) + except Exception as exc: + raise DetectorUnavailable( + f"TabPFN classifier predict failed ({type(exc).__name__})" + ) from exc + ix = int(np.argmax(probs[0])) + return str(model.classes_[ix]), float(probs[0][ix]) + + def cause(self, vector: pd.Series) -> tuple[str, float]: + raise DetectorUnavailable("cause classifier requires explicit TRAIN-only feature vectors") + + @staticmethod + def _predictor_columns(frame: pd.DataFrame) -> list[str]: + return [ + name + for name in frame.columns + if name.endswith(("_lag1", "_mean5", "_std5")) + or name in {"minute_of_day", "day_of_week"} + ] + + def forecasts(self, history: pd.DataFrame, horizon: int) -> list[dict[str, Any]]: + numeric = history.select_dtypes(include=["number"]).tail(2048) + raw_metrics = [ + name + for name in numeric.columns + if name.startswith(RAW_METRIC_PREFIXES) and not name.endswith(DERIVED_SUFFIXES) + ] + predictors = self._predictor_columns(numeric) + if len(numeric) < 8 or not predictors: + return [] + rows: list[dict[str, Any]] = [] + origin = pd.Timestamp(numeric.index.max()) + # Reuse a frozen training context for the current 15-minute bucket. + training = numeric.loc[numeric.index < origin.floor("15min")] + if len(training) < 8: + training = numeric.iloc[:-3] + for metric in raw_metrics: + x_parts, y_parts = [], [] + for step in range(1, 6): + x = training[predictors].iloc[:-step].copy() + x["forecast_horizon"] = step + y = training[metric].shift(-step).iloc[:-step] + valid = y.notna() + x_parts.append(x.loc[valid]) + y_parts.append(y.loc[valid]) + train_x, train_y = _bounded_horizon_rows(x_parts, y_parts, MAX_TRAINING_ROWS) + if len(train_x) < 8 or np.ptp(train_y) <= 1e-12: + continue + key = ( + f"regressor:{metric}", + fingerprint(pd.concat([train_x, pd.Series(train_y)], axis=1)), + ) + model = self._models.get(key) + if model is None: + model = self._new_model("regressor") + try: + with warnings.catch_warnings(): + warnings.simplefilter("ignore") + model.fit(_array(train_x), train_y) + except Exception as exc: + raise DetectorUnavailable( + f"TabPFN regressor fit failed ({type(exc).__name__})" + ) from exc + self._cache_model(key, model) + forecast_x = pd.concat( + [ + numeric[predictors].iloc[[-1]].assign(forecast_horizon=step) + for step in range(1, horizon + 1) + ], + ignore_index=True, + ) + try: + response = model.predict( + _array(forecast_x), output_type="quantiles", quantiles=[0.1, 0.5, 0.9] + ) + pred = _quantile_matrix(response, horizon) + except Exception as exc: + raise DetectorUnavailable( + f"TabPFN quantile prediction failed ({type(exc).__name__})" + ) from exc + for offset, quantiles in enumerate(pred, start=1): + lo, mid, hi = (float(value) for value in quantiles) + _validate_forecast_values(metric, lo, mid, hi, offset) + rows.append( + { + "metric": metric, + "made_at": origin.isoformat(), + "target_time": ( + origin.floor("min") + pd.Timedelta(minutes=offset) + ).isoformat(), + "horizon_minutes": offset, + "p10": lo, + "p50": mid, + "p90": hi, + "model": self.provenance, + } + ) + return rows + + def fit_anomaly(self, normal_training_features: pd.DataFrame) -> None: + columns = [ + name for name in normal_training_features if name.startswith(RAW_METRIC_PREFIXES) + ] + data = normal_training_features[columns].replace([np.inf, -np.inf], np.nan).dropna() + if len(data) < 5 or not columns: + raise DetectorUnavailable( + "TabPFN anomaly scoring needs at least five normal TRAIN snapshots" + ) + try: + self._imports() + clf, reg = self._new_model("classifier"), self._new_model("regressor") + module = __import__( + "tabpfn_extensions.unsupervised", fromlist=["TabPFNUnsupervisedModel"] + ) + self._unsupervised = module.TabPFNUnsupervisedModel(tabpfn_clf=clf, tabpfn_reg=reg) + self._unsupervised.fit(_array(data)) + self._anomaly_columns = columns + except Exception as exc: + raise DetectorUnavailable(f"TabPFN anomaly fit failed ({type(exc).__name__})") from exc + + def raw_anomaly(self, vector: pd.Series) -> float: + if self._unsupervised is None: + raise DetectorUnavailable( + "TabPFN anomaly model has not been fit on normal TRAIN snapshots" + ) + try: + data = np.asarray( + [vector.reindex(self._anomaly_columns, fill_value=0.0)], dtype=np.float32 + ) + result = self._unsupervised.outliers(data, n_permutations=1) + return float( + np.asarray(result.detach().cpu() if hasattr(result, "detach") else result).reshape( + -1 + )[0] + ) + except Exception as exc: + raise DetectorUnavailable( + f"TabPFN anomaly scoring failed ({type(exc).__name__})" + ) from exc + + def set_anomaly_reference(self, normal_validation_scores: list[float]) -> None: + values = np.asarray([x for x in normal_validation_scores if np.isfinite(x)], dtype=float) + if len(values) < 3: + raise DetectorUnavailable( + "anomaly calibration needs at least three normal VALIDATION scores" + ) + self._anomaly_reference = np.sort(values) + + def anomaly(self, vector: pd.Series) -> float: + if self._anomaly_reference is None: + raise DetectorUnavailable( + "anomaly score has not been calibrated on normal VALIDATION cases" + ) + raw = self.raw_anomaly(vector) + # Lower log density means more unusual; empirical normal tail probability is stable. + return float( + 1.0 + - np.searchsorted(self._anomaly_reference, raw, side="right") + / len(self._anomaly_reference) + ) diff --git a/packages/detector/src/netcortex_detector/thresholds.py b/packages/detector/src/netcortex_detector/thresholds.py new file mode 100644 index 0000000..8f29dcc --- /dev/null +++ b/packages/detector/src/netcortex_detector/thresholds.py @@ -0,0 +1,64 @@ +from __future__ import annotations + +from collections import defaultdict +from collections.abc import Iterable +from typing import Any + +import numpy as np +import pandas as pd + + +def normal_site_days(intervals: Iterable[tuple[str, Any, Any]]) -> float: + """Return unioned normal observation exposure in site-days, merging per site.""" + by_site: dict[str, list[tuple[Any, Any]]] = defaultdict(list) + for site_id, start, end in intervals: + left, right = pd.Timestamp(start), pd.Timestamp(end) + if left.tzinfo is None or right.tzinfo is None: + raise ValueError("normal exposure intervals must be timezone-aware") + left, right = left.tz_convert("UTC"), right.tz_convert("UTC") + if right < left: + raise ValueError("normal exposure interval ends before it starts") + by_site[site_id].append((left, right)) + total_seconds = 0.0 + for site_intervals in by_site.values(): + merged = [] + for start, end in sorted(site_intervals): + if merged and start <= merged[-1][1]: + merged[-1][1] = max(merged[-1][1], end) + else: + merged.append([start, end]) + total_seconds += sum((end - start).total_seconds() for start, end in merged) + return float(total_seconds / 86400) + + +def calibrate_threshold( + scores: list[float], + labels: list[bool], + site_ids: list[str], + *, + case_hours: float = 3.0, + false_alerts_per_site_day: float = 1.0, + exposure_intervals: Iterable[tuple[str, Any, Any]] | None = None, +) -> float: + """Choose validation F1 threshold under an explicit site-day false-alert budget.""" + if not scores or not (len(scores) == len(labels) == len(site_ids)): + return 0.7 + candidates = sorted(set([0.0, 1.0, *(float(np.clip(x, 0.0, 1.0)) for x in scores)])) + site_days = ( + normal_site_days(exposure_intervals) + if exposure_intervals is not None + else sum(site_ids.count(site) * case_hours / 24 for site in set(site_ids)) + ) + false_positive_limit = int(site_days * false_alerts_per_site_day) + best_f1, best_threshold = -1.0, 0.7 + for threshold in candidates: + predictions = [score > threshold for score in scores] + tp = sum(pred and actual for pred, actual in zip(predictions, labels, strict=True)) + fp = sum(pred and not actual for pred, actual in zip(predictions, labels, strict=True)) + fn = sum(not pred and actual for pred, actual in zip(predictions, labels, strict=True)) + if fp > false_positive_limit: + continue + f1 = 2 * tp / (2 * tp + fp + fn) if 2 * tp + fp + fn else 0.0 + if f1 > best_f1: + best_f1, best_threshold = f1, threshold + return float(best_threshold) diff --git a/packages/detector/tests/test_engine.py b/packages/detector/tests/test_engine.py new file mode 100644 index 0000000..bcdfcad --- /dev/null +++ b/packages/detector/tests/test_engine.py @@ -0,0 +1,539 @@ +from __future__ import annotations + +import sys +from datetime import UTC, datetime +from pathlib import Path +from runpy import run_path +from types import ModuleType, SimpleNamespace + +import numpy as np +import pandas as pd +import pytest + +from netcortex_detector.engine import ( + DetectorConfig, + DetectorUnavailable, + build_features, + detect, + fingerprint, + run_engine, +) +from netcortex_detector.providers import FixtureBackend, TabPFNBackend + + +def frames(site: str = "s1", *, minutes: int = 12, start: datetime | None = None): + start = start or datetime(2026, 1, 1, tzinfo=UTC) + times = pd.date_range(start, periods=minutes * 6, freq="10s") + p = pd.DataFrame( + { + "time": times, + "site_id": site, + "target": "internet", + "rtt_ms": 30.0, + "jitter_ms": 1.0, + "loss_pct": 0.0, + "source": "sim", + } + ) + it = pd.date_range(start, periods=minutes * 2, freq="30s") + i = pd.DataFrame( + { + "time": it, + "site_id": site, + "iface": "wan", + "util_pct": 40.0, + "drops": 0, + "errors": 0, + "source": "sim", + } + ) + return p, i + + +def test_future_observations_cannot_change_features_at_cutoff(): + p, i = frames() + cutoff = p.time.iloc[-1] + baseline = build_features(p, i, site_id="s1", as_of=cutoff) + changed_p = p.copy() + changed_p.loc[changed_p.time > cutoff, "rtt_ms"] = 9000 + changed_i = i.copy() + changed_i.loc[changed_i.time > cutoff, "util_pct"] = 99 + changed = build_features(changed_p, changed_i, site_id="s1", as_of=cutoff) + pd.testing.assert_frame_equal(baseline, changed) + + +def test_site_isolation_rejects_mixed_site_rows(): + p, i = frames() + p.loc[0, "site_id"] = "other" + with pytest.raises(ValueError, match="different site"): + build_features(p, i, site_id="s1", as_of=p.time.max()) + + +def test_mixed_measurement_sources_are_rejected_within_and_across_frames(): + p, i = frames() + p.loc[0, "source"] = "live" + with pytest.raises(ValueError, match="mixes measurement sources"): + build_features(p, i, site_id="s1", as_of=p.time.max()) + p, i = frames() + i["source"] = "live" + with pytest.raises(ValueError, match="different measurement source"): + build_features(p, i, site_id="s1", as_of=p.time.max()) + + +def test_supplemental_rows_are_not_core_probe_inputs(): + p, i = frames() + p["source"] = "sim_supplemental" + with pytest.raises(ValueError, match="supplemental"): + build_features(p, i, site_id="s1", as_of=p.time.max()) + + +def test_quantile_bands_are_ordered_and_scores_bounded(): + p, i = frames() + result = run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=FixtureBackend()) + assert result["status"] == "ok" + assert 0 <= result["anomaly_score"] <= 1 + assert all(row["p10"] <= row["p50"] <= row["p90"] for row in result["forecasts"]) + + +def test_sparse_history_is_explicitly_not_healthy(): + p, i = frames(minutes=3) + result = run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=FixtureBackend()) + assert result["status"] == "insufficient_history" + assert result["is_anomaly"] is None + assert result["cause"] is None + + +def test_invalid_metric_ranges_are_rejected(): + p, i = frames() + i.loc[0, "util_pct"] = 101 + with pytest.raises(ValueError, match="valid range"): + build_features(p, i, site_id="s1", as_of=p.time.max()) + + +def test_stale_and_missing_data_are_unavailable_not_healthy(): + p, i = frames() + cutoff = p.time.max() + pd.Timedelta(minutes=5) + stale = run_engine(p, i, site_id="s1", as_of=cutoff, backend=FixtureBackend()) + assert stale["status"] == "stale_data" + assert stale["is_anomaly"] is None + missing = run_engine(p.iloc[:0], i, site_id="s1", as_of=p.time.max(), backend=FixtureBackend()) + assert missing["status"] == "missing_probe_data" + assert missing["is_anomaly"] is None + + +def test_future_probe_rows_do_not_make_stale_past_probe_data_look_fresh(): + p, i = frames() + cutoff = p.time.max() + pd.Timedelta(minutes=3) + future = p.iloc[[-1]].copy() + future["time"] = cutoff + pd.Timedelta(minutes=1) + p = pd.concat([p, future], ignore_index=True) + i.loc[len(i)] = [cutoff, "s1", "wan", 40.0, 0, 0, "sim"] + result = run_engine(p, i, site_id="s1", as_of=cutoff, backend=FixtureBackend()) + assert result["status"] == "stale_data" + assert result["is_anomaly"] is None + + +def test_total_loss_allows_missing_rtt_but_all_missing_probe_metrics_are_unavailable(): + p, i = frames() + p["rtt_ms"] = np.nan + p["loss_pct"] = 100.0 + total_loss = run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=FixtureBackend()) + assert total_loss["status"] == "ok" + p["loss_pct"] = np.nan + missing = run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=FixtureBackend()) + assert missing["status"] == "invalid_measurements" + assert missing["is_anomaly"] is None + + +def test_provider_failure_is_explicit(): + class Broken(FixtureBackend): + def forecasts(self, history, horizon): + raise TimeoutError("offline") + + p, i = frames() + with pytest.raises(DetectorUnavailable, match="inference failed"): + run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=Broken()) + + +@pytest.mark.parametrize( + "forecast_row", + [ + {"metric": "rtt_ms_internet", "horizon_minutes": 1, "p10": np.nan, "p50": 2, "p90": 3}, + {"metric": "rtt_ms_internet", "horizon_minutes": 1, "p10": 3, "p50": 2, "p90": 4}, + {"metric": "loss_pct_internet", "horizon_minutes": 1, "p10": 0, "p50": 50, "p90": 101}, + {"metric": "rtt_ms_internet", "horizon_minutes": 6, "p10": 1, "p50": 2, "p90": 3}, + {"metric": "unknown_metric", "horizon_minutes": 1, "p10": 1, "p50": 2, "p90": 3}, + ], +) +def test_invalid_forecast_outputs_fail_explicitly(forecast_row): + class InvalidForecast(FixtureBackend): + def forecasts(self, history, horizon): + return [forecast_row] + + p, i = frames() + with pytest.raises(DetectorUnavailable, match="inference failed"): + run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=InvalidForecast()) + + +def test_no_tabpfn_key_or_dependency_never_silently_uses_fixture(): + backend = TabPFNBackend("cloud", access_token=None) + p, i = frames() + with pytest.raises(DetectorUnavailable): + run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=backend) + + +def test_context_fingerprint_changes_when_training_context_changes(): + p, _ = frames() + first = fingerprint(p) + changed = p.copy() + changed.loc[0, "rtt_ms"] = 31 + assert fingerprint(changed) != first + + +def test_context_truncated_to_configured_limit(): + p, i = frames(minutes=15) + + class Capture(FixtureBackend): + seen = 0 + + def forecasts(self, history, horizon): + self.seen = len(history) + return super().forecasts(history, horizon) + + backend = Capture() + run_engine( + p, + i, + site_id="s1", + as_of=p.time.max(), + backend=backend, + config=DetectorConfig(context_rows=7), + ) + assert backend.seen <= 7 + + +def test_public_core_adapter_fails_clearly_when_core_missing(): + with pytest.raises(DetectorUnavailable, match="netcortex_core"): + detect("s1", object(), object()) + + +def test_forecast_compare_only_uses_prior_forecast_samples(): + from netcortex_detector.engine import consecutive_forecast_exceedances + + observed = pd.Series( + [4.0, 5.0, 6.0], index=pd.date_range("2026-01-01", periods=3, freq="min", tz="UTC") + ) + made_at = observed.index - pd.Timedelta(minutes=1) + forecasts = pd.DataFrame( + {"made_at": made_at, "target_time": observed.index, "p90": [3.0, 4.0, 5.0]} + ) + assert consecutive_forecast_exceedances(observed, forecasts) == 3 + future_forecast = pd.DataFrame( + { + "made_at": [observed.index[-1] + pd.Timedelta(minutes=1)], + "target_time": [observed.index[-1]], + "p90": [0.0], + } + ) + assert consecutive_forecast_exceedances(observed, future_forecast) == 0 + + +def test_walk_forward_sustained_rule_rejects_gapped_minutes(): + from netcortex_detector.engine import ( + DetectorConfig, + _walk_forward_exceedances, + build_features, + ) + + class FixedForecast(FixtureBackend): + def forecasts(self, history, horizon): + origin = pd.Timestamp(history.index.max()) + return [ + { + "metric": metric, + "made_at": origin.isoformat(), + "target_time": (origin + pd.Timedelta(minutes=1)).isoformat(), + "horizon_minutes": 1, + "p90": 1.0, + } + for metric in history.columns + if metric.startswith(("rtt_ms_", "loss_pct_", "iface_util_pct_")) + ] + + p, i = frames(minutes=10) + features = build_features(p, i, site_id="s1", as_of=p.time.max()) + features = features.drop(features.index[-2]) + features.iloc[-3:, features.columns.get_loc("rtt_ms_target:internet")] = 99.0 + assert not _walk_forward_exceedances(features, FixedForecast(), DetectorConfig()) + + +@pytest.mark.parametrize("bad_value", [np.nan, np.inf, -np.inf]) +def test_nonfinite_anomaly_scores_are_unavailable(bad_value): + class BadScore(FixtureBackend): + def anomaly(self, vector): + return bad_value + + p, i = frames() + with pytest.raises(DetectorUnavailable, match="inference failed"): + run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=BadScore()) + + +@pytest.mark.parametrize("bad_confidence", [np.nan, np.inf, -np.inf]) +def test_nonfinite_cause_confidence_is_unavailable(bad_confidence): + class BadConfidence(FixtureBackend): + def cause(self, vector): + return "normal", bad_confidence + + p, i = frames() + with pytest.raises(DetectorUnavailable, match="inference failed"): + run_engine(p, i, site_id="s1", as_of=p.time.max(), backend=BadConfidence()) + + +def test_one_spike_does_not_count_as_a_sustained_event(): + from netcortex_detector.engine import consecutive_forecast_exceedances + + at = pd.date_range("2026-01-01", periods=5, freq="min", tz="UTC") + observed = pd.Series([1.0, 1.0, 1.0, 1.0, 5.0], index=at) + forecasts = pd.DataFrame( + { + "made_at": at - pd.Timedelta(minutes=1), + "target_time": at, + "p90": [2.0] * 5, + } + ) + assert consecutive_forecast_exceedances(observed, forecasts) == 0 + + +def test_walk_forward_rule_needs_three_actual_exceedances(): + from netcortex_detector.engine import DetectorConfig, run_engine + from netcortex_detector.providers import FixtureBackend + + class FixedForecast(FixtureBackend): + def forecasts(self, history, horizon): + origin = pd.Timestamp(history.index.max()) + return [ + { + "metric": metric, + "made_at": origin.isoformat(), + "target_time": (origin.floor("min") + pd.Timedelta(minutes=step)).isoformat(), + "horizon_minutes": step, + "p10": 10.0, + "p50": 20.0, + "p90": 40.0, + } + for metric in history.columns + if metric.startswith(("rtt_ms_", "loss_pct_", "iface_util_pct_")) + for step in range(1, horizon + 1) + ] + + def anomaly(self, vector): + return 0.0 + + p, i = frames(minutes=12) + last_three = p.time.max().floor("min") - pd.Timedelta(minutes=2) + single = p.copy() + single.loc[single.time >= p.time.max().floor("min"), "rtt_ms"] = 1000.0 + one = run_engine( + single, + i, + site_id="s1", + as_of=p.time.max(), + backend=FixedForecast(), + config=DetectorConfig(threshold=0.9), + anomaly_threshold=0.9, + ) + assert one["sustained_forecast_exceedance"] is False + persistent = p.copy() + persistent.loc[persistent.time.dt.floor("min") >= last_three, "rtt_ms"] = 1000.0 + three = run_engine( + persistent, + i, + site_id="s1", + as_of=p.time.max(), + backend=FixedForecast(), + config=DetectorConfig(threshold=0.9), + anomaly_threshold=0.9, + ) + assert three["sustained_forecast_exceedance"] is True + + +def test_tabpfn_adapter_fits_lagged_forecasts_and_joint_quantiles(monkeypatch): + from netcortex_detector.providers import TabPFNBackend + + calls = {"reg_fit": 0, "predict": 0, "clf_fit": 0, "unsup_fit": 0} + regression_fit_rows = [] + + class FakeRegressor: + def fit(self, x, y): + calls["reg_fit"] += 1 + assert x.shape[1] > 1 + regression_fit_rows.append(x.copy()) + self.columns = x.shape[1] + + def predict(self, x, *, output_type, quantiles): + calls["predict"] += 1 + assert output_type == "quantiles" + assert quantiles == [0.1, 0.5, 0.9] + horizons = x[:, -1].astype(int) + return [10 + horizons, 20 + horizons, 30 + horizons] + + class FakeClassifier: + classes_ = np.array(["normal", "uplink_congestion"]) + + def fit(self, x, y): + calls["clf_fit"] += 1 + + def predict_proba(self, x): + return np.tile(np.array([[0.2, 0.8]]), (len(x), 1)) + + class FakeUnsupervised: + def __init__(self, *, tabpfn_clf, tabpfn_reg): + assert tabpfn_clf is not None and tabpfn_reg is not None + + def fit(self, x): + calls["unsup_fit"] += 1 + self.width = x.shape[1] + + def outliers(self, x, *, n_permutations): + assert n_permutations == 1 + return np.linspace(-1.0, -2.0, len(x)) + + class Backend(TabPFNBackend): + def _imports(self): + return FakeClassifier, FakeRegressor + + def _new_model(self, kind): + return FakeClassifier() if kind == "classifier" else FakeRegressor() + + extension = ModuleType("tabpfn_extensions.unsupervised") + extension.TabPFNUnsupervisedModel = FakeUnsupervised + package = ModuleType("tabpfn_extensions") + package.__path__ = [] + monkeypatch.setitem(__import__("sys").modules, "tabpfn_extensions", package) + monkeypatch.setitem(__import__("sys").modules, "tabpfn_extensions.unsupervised", extension) + + backend = Backend("local") + p, i = frames(minutes=20) + p["rtt_ms"] = 30.0 + np.arange(len(p)) * 0.1 + i["util_pct"] = 40.0 + np.arange(len(i)) * 0.2 + features = build_features(p, i, site_id="s1", as_of=p.time.max()) + forecast = backend.forecasts(features, 5) + assert forecast + assert all(row["p10"] <= row["p50"] <= row["p90"] for row in forecast) + by_horizon = { + row["horizon_minutes"]: row for row in forecast if row["metric"].startswith("rtt_ms_") + } + assert [by_horizon[h]["p10"] for h in range(1, 6)] == [11, 12, 13, 14, 15] + assert [by_horizon[h]["p50"] for h in range(1, 6)] == [21, 22, 23, 24, 25] + assert [by_horizon[h]["p90"] for h in range(1, 6)] == [31, 32, 33, 34, 35] + assert all(not row["metric"].endswith(("_lag1", "_mean5", "_std5")) for row in forecast) + assert calls["predict"] == len(forecast) // 5 + backend.forecasts(features, 5) + assert calls["reg_fit"] == len(forecast) // 5 + + training = pd.DataFrame([features.iloc[-1], features.iloc[-2]]) + assert backend.fit_cause_model(training, ["normal", "uplink_congestion"]) + assert ( + backend.predict_cause(features.iloc[-1], training, ["normal", "uplink_congestion"])[0] + == "uplink_congestion" + ) + normal = pd.DataFrame([features.iloc[index] for index in range(10)]) + backend.fit_anomaly(normal) + assert calls["unsup_fit"] == 1 + reference = [backend.raw_anomaly(normal.iloc[index]) for index in range(3)] + backend.set_anomaly_reference(reference) + assert 0.0 <= backend.anomaly(features.iloc[-1]) <= 1.0 + + large_p, large_i = frames(minutes=600) + large = build_features(large_p, large_i, site_id="s1", as_of=large_p.time.max()) + backend.forecasts(large, 5) + latest_fit = regression_fit_rows[-1] + assert len(latest_fit) <= 2048 + assert set(latest_fit[:, -1].astype(int)) == {1, 2, 3, 4, 5} + + +def test_cloud_adapter_pins_timeout_and_version_without_logging_token(monkeypatch): + from netcortex_detector.providers import TabPFNBackend + + records = {} + + class Model: + @classmethod + def create_default_for_version(cls, version, **kwargs): + records[cls.__name__] = (version, kwargs) + return cls() + + class Classifier(Model): + pass + + class Regressor(Model): + pass + + client = ModuleType("tabpfn_client") + client.TabPFNClassifier = Classifier + client.TabPFNRegressor = Regressor + client.set_access_token = lambda token: records.update(token_set=token) + models = ModuleType("tabpfn_client.models") + models.ClientOptions = lambda *, timeout: SimpleNamespace(timeout=timeout) + monkeypatch.setitem(sys.modules, "tabpfn_client", client) + monkeypatch.setitem(sys.modules, "tabpfn_client.models", models) + + backend = TabPFNBackend("cloud", access_token="secret-token", timeout_s=7.0) + backend._imports() + assert records["token_set"] == "secret-token" + assert records["Classifier"] == ("v3.5", {"client_options": SimpleNamespace(timeout=7.0)}) + assert records["Regressor"] == ("v3.5", {"client_options": SimpleNamespace(timeout=7.0)}) + + +def test_eval_threshold_uses_validation_labels_and_false_alert_budget(): + from netcortex_detector.thresholds import calibrate_threshold, normal_site_days + + threshold = calibrate_threshold([0.05, 0.4, 0.8], [False, True, True], ["s1", "s1", "s1"]) + assert threshold == 0.05 + + normal_exposure = [("s1", "2026-01-01T00:00:00Z", "2026-01-01T00:30:00Z")] + site_days = normal_site_days(normal_exposure) + base_threshold = calibrate_threshold([0.8], [False], ["s1"], exposure_intervals=normal_exposure) + expanded_threshold = calibrate_threshold( + [0.8, 0.7, 0.9], + [False, True, True], + ["s1"] * 3, + exposure_intervals=normal_exposure, + ) + assert site_days == 0.5 / 24 + assert expanded_threshold == base_threshold == 0.8 + assert not any(score > expanded_threshold for score in [0.8]) + assert ( + normal_site_days([*normal_exposure, ("s1", "2026-01-01T00:15:00Z", "2026-01-01T00:45:00Z")]) + == 0.75 / 24 + ) + + +def test_eval_rejects_overlapping_splits_and_path_escape(tmp_path): + runner_path = Path(__file__).resolve().parents[3] / "eval" / "run.py" + runner = run_path(str(runner_path)) + + def make_case(split, case_id, seed, start, end): + return { + "split": split, + "case_id": case_id, + "seed": seed, + "case_start": start, + "as_of": end, + } + + train = [make_case("train", "a", 1, "2026-01-01T00:00:00Z", "2026-01-01T03:00:00Z")] + validation = [make_case("validation", "b", 2, "2026-01-01T02:00:00Z", "2026-01-01T05:00:00Z")] + test = [make_case("test", "c", 3, "2026-01-03T00:00:00Z", "2026-01-03T03:00:00Z")] + with pytest.raises(ValueError, match="time windows overlap"): + runner["_verify_splits"](train, validation, test) + + split = tmp_path / "test" + split.mkdir() + sidecar = split / "case.json" + sidecar.write_text( + '{"observations":{"probe":"../escape.parquet","iface":"iface.parquet"}}', + encoding="utf-8", + ) + with pytest.raises(ValueError, match="escapes"): + runner["_load_case"](sidecar) From 8bce8dc705c682ecc746c3852d464c1aa8ec78ad Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:22:53 +0500 Subject: [PATCH 08/21] docs: publish implementation guide and measured validation boundaries --- decision.md | 10 ++- docs/CONTRACT_REQUESTS.md | 8 +++ docs/SETUP.md | 29 ++++++-- docs/START_HERE.md | 57 +++++++++++++++ docs/VALIDATION_RESULTS.md | 67 ++++++++++++++++++ docs/post/partner-draft.md | 109 ++++++++++++++++++++++++++++ docs/progress/bootstrap.md | 20 +++++- docs/progress/head.md | 59 ++++++++++++++++ eval/results/agent.md | 13 ++++ eval/results/cloud-unavailable.md | 113 +++++++++++++++++++++++++++++ eval/results/detector.md | 114 ++++++++++++++++++++++++++++++ flow.md | 11 +-- 12 files changed, 596 insertions(+), 14 deletions(-) create mode 100644 docs/START_HERE.md create mode 100644 docs/VALIDATION_RESULTS.md create mode 100644 docs/post/partner-draft.md create mode 100644 docs/progress/head.md create mode 100644 eval/results/agent.md create mode 100644 eval/results/cloud-unavailable.md create mode 100644 eval/results/detector.md diff --git a/decision.md b/decision.md index 6a95ffe..959af74 100644 --- a/decision.md +++ b/decision.md @@ -18,14 +18,22 @@ how the pieces connect and [the implementation plan](docs/WORKSTREAM_B_PLAN.md). | Use Render Node hosting for the Next.js dashboard | SSR routes and dynamic incident URLs require the actual Next server | Static `dist` hosting is unsuitable for this application | | Keep the API deployment gated on Aun's backend | Creating a second backend would break ownership and integration | Infrastructure docs may be ready before a public complete demo | | Use free tiers and credits only | User's chosen spending limit | Any purchase or paid upgrade needs separate authorization | +| Add the MIT license specified in Aun's brief | The challenge plan explicitly requires MIT-licensed project code | Third-party model/data licenses still apply separately | | Enable Entire before the first implementation commit | Capture coding provenance required by the brief | Hook installation is verified separately from transcript/checkpoint capture | | Git author is `techieworld2` with the email the user supplied | User explicitly provided their commit identity | Repository-local identity; unrelated repositories are unchanged | +| Bind GitHub Git operations to `techieworld2` in Credential Manager | This machine has multiple stored accounts | Verified repo push/workflow permission without printing or committing tokens | | Persist decisions, flow documentation and progress handoffs | User wants to understand the code and context must survive compaction | Every package/app has both documents; lead keeps these root documents current | +| Normalize tracked text to LF | The team develops on Windows and macOS and tests on Linux | Git whitespace checks and generated diffs behave consistently | | Do not promise exact 60% compaction in this running session | Exposed agent controls do not set or trigger that threshold | Host compaction remains automatic; handoffs preserve state independently | +| Require explicit opt-in for RIPE role transfer | Measured root-server routes differ from configured DNS destinations | Transfer can affect public DNS ping baselines only; provenance and uncertainty travel with generated data | +| Validate quantile layout, forecast time and freshness independently | SDK array shape and future rows can silently corrupt an otherwise plausible forecast | Regression tests cover each horizon, physical bounds, mixed sources and gaps | +| Treat live decision POST responses as acknowledgements | A workflow can still be applying or rolling back after the HTTP request succeeds | Fetch authoritative incident state and follow SSE updates | +| Separate CHR boot smoke from template validation | A real router can boot even while Aun's template harness is absent | CI reports those outcomes separately; no fabricated template pass | +| Keep the unpatched braces advisory documented | npm proposes an incompatible Next lint downgrade and no patched braces release exists | Production audit is clean; five development audit entries share one advisory | ## Current external gates -As initially inspected, upstream main contains only README.md. Aun must publish +At the final integration refresh, upstream main still contains only README.md. Aun must publish core/backend contracts. Database, tailnet, API keys, Sentry projects, Render and domain access are not yet supplied. Their live checks remain pending until verified; none are replaced with invented pass results. diff --git a/docs/CONTRACT_REQUESTS.md b/docs/CONTRACT_REQUESTS.md index 611c7ac..ecb50a4 100644 --- a/docs/CONTRACT_REQUESTS.md +++ b/docs/CONTRACT_REQUESTS.md @@ -21,6 +21,14 @@ These are proposals and integration questions only. They do not change shared co - Confirm SSE endpoint, event envelope, event IDs/replay behavior, heartbeat cadence, reconnect expectations, and event names/payloads (`incident.opened`, `fix.tested`, and others). - Specify whether subscriber identifiers/IPs are exposed, redacted, or role-gated in API events and the UI; identify retention and access policy. - Clarify how a subscriber can be identified for heavy-user analysis without exposing unnecessary personal data. +- Extend MetricsWindow/storage with observed per-subscriber traffic and IP identity; + aggregate interface counters cannot identify an offending user. Supplemental + simulator fixtures are experimental until this contract is approved. +- Add explicit DNS resolution duration/outcome observations; ICMP RTT to a DNS + server is not a DNS lookup measurement. +- Publish target roles and interface/backhaul mapping, uplink capacities and + configured backup gateways so causes and fix parameters derive from observations. +- Define Settings read/update API endpoints before enabling editable UI Settings. ## Timing and role mapping diff --git a/docs/SETUP.md b/docs/SETUP.md index 9c8dfae..df05afd 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -5,14 +5,14 @@ Install Python 3.12, uv, Node.js/npm for the web app, and Git. From the repository root: ```powershell -uv sync --all-packages +uv sync --all-packages --locked uv run ruff check . uv run pytest ``` -`uv sync --all-packages` installs each workspace member in editable mode so tests import the installed packages. The workspace package directories are being created in parallel; run sync after they exist. The root does not own `uv.lock`; the workstream lead generates and commits it once all package manifests are present. +`uv sync --all-packages --locked` installs all four workspace packages in editable mode from the committed lockfile. The lead maintains the root manifest and lockfile. Optional TabPFN/cloud/local extras are excluded from this base installation. -For the web app, once `apps/web/package-lock.json` exists: +For the web app: ```powershell cd apps/web @@ -20,7 +20,8 @@ npm ci npm run lint npm run typecheck npm run build -npx playwright test +npm run test:e2e +npm run test:e2e:live ``` Playwright browser setup may also require `npx playwright install --with-deps` on Linux CI. @@ -41,4 +42,22 @@ The hosted demo may use Render, Tiger Data, Sentry, and vendor trial/free credit ## Integration gates -The core package name and shared schemas, Settings, API and SSE contract, role mapping, and CHR harness are awaiting Aun's confirmation. See [CONTRACT_REQUESTS.md](CONTRACT_REQUESTS.md). The Render blueprint currently describes only the static web app; an API service must not be added until Aun's backend exists and its deployment contract is known. +The core package name and shared schemas, Settings, API and SSE contract, role mapping, and CHR harness are awaiting Aun's confirmation. See [CONTRACT_REQUESTS.md](CONTRACT_REQUESTS.md). The Render blueprint describes the Next.js Node web service; an API service must not be added until Aun's backend exists and its deployment contract is known. + +## Agent add-ons configured on this workstation + +- RouterOS QEMU and Sentry instrumentation skills were installed from their + official source repositories. They were read and applied to the corresponding implementation. +- TabPFN MCP is configured at `https://api.priorlabs.ai/mcp/server`, using the + local `TABPFN_API_KEY` environment variable. No key is supplied yet, so the + connection has not been verified. The runtime Python client maps this same + setting through its supported token API. +- Tiger CLI is installed. Its MCP uses `tiger mcp start` and requires Tiger + authentication plus Aun's database access. Do not call it connected until a + real authenticated query succeeds. +- Entire is enabled locally with telemetry and automatic session uploads + disabled. Publishing selected coding-session provenance remains a separate, + deliberate action after reviewing what the captured session includes. + +Do not paste secrets into code, commit messages, documentation or chat. Use local +environment configuration and each provider's authentication flow. diff --git a/docs/START_HERE.md b/docs/START_HERE.md new file mode 100644 index 0000000..dc57627 --- /dev/null +++ b/docs/START_HERE.md @@ -0,0 +1,57 @@ +# Running and understanding Workstream B + +Start with the dashboard to explore the incident workflow. It runs independently +of Aun's pending backend and always identifies its simulated data. + +```powershell +cd apps/web +npm ci +npm run dev +``` + +Open http://localhost:3000. The Overview links to incident evidence, proposed +commands, rollback, a confirmation step, and the simulated result. The Demo page +creates fixture scenarios. Fixture approvals never contact a router. + +For the Python workspace, install Python 3.12 and uv, then from the repo root: + +```powershell +uv sync --all-packages --locked +uv run ruff check . +uv run pytest packages .github/tests +uv run simgen --help +uv run netcortex-detector --help +``` + +If uv is installed as a Python module on Windows, replace `uv` with `python -m uv`. +Base installation excludes the optional model dependencies and needs no API keys. + +## Code map + +| Component | Start reading | Decisions and API flow | +| --- | --- | --- | +| Lead integration | [implementation plan](WORKSTREAM_B_PLAN.md) | [decision](../decision.md), [flow](../flow.md) | +| Simulator and RIPE data | [simgen](../packages/simgen/README.md) | [decision](../packages/simgen/decision.md), [flow](../packages/simgen/flow.md) | +| Detection and forecasts | [detector](../packages/detector/README.md) | [decision](../packages/detector/decision.md), [flow](../packages/detector/flow.md) | +| RouterOS retrieval | [runbook](../packages/runbook/README.md) | [decision](../packages/runbook/decision.md), [flow](../packages/runbook/flow.md) | +| Voice and outage news | [notify](../packages/notify/README.md) | [decision](../packages/notify/decision.md), [flow](../packages/notify/flow.md) | +| Dashboard | [web](../apps/web/README.md) | [decision](../apps/web/decision.md), [flow](../apps/web/flow.md) | +| CI and CHR | [admin setup](../.github/admin-setup.md) | [decision](../.github/decision.md), [flow](../.github/flow.md) | +| Hosting | [Render](../infra/render/README.md) | [decision](../infra/render/decision.md), [flow](../infra/render/flow.md) | + +## Switching to the shared runtime + +[Contract requests](CONTRACT_REQUESTS.md) describe the exact missing shared +schemas, configuration and endpoints. [Setup](SETUP.md) explains credentials, +model/database setup and deployment. Public Python wrappers deliberately refuse +to construct invented shared objects while `netcortex_core` is absent. Internal +engines accept ordinary data/configuration for independent testing. + +For live UI mode, use the documented environment variables and generate API types +from Aun's actual OpenAPI. Live errors remain visible. A successful mocked API +browser test establishes transport behavior, not a working backend or router. + +[Validation results](VALIDATION_RESULTS.md) separates measured checks from +pending model, backend, provider and deployment checks. Raw RIPE rows, generated +datasets and credentials are ignored by Git; regenerate them locally using the +documented commands. diff --git a/docs/VALIDATION_RESULTS.md b/docs/VALIDATION_RESULTS.md new file mode 100644 index 0000000..267931b --- /dev/null +++ b/docs/VALIDATION_RESULTS.md @@ -0,0 +1,67 @@ +# Workstream B validation + +Measured on 2026-10-18. This report distinguishes independent implementation +checks from the shared runtime and external services that are still pending. + +| Check | Actual result | +| --- | --- | +| Locked base Python workspace | Four packages installed successfully with Python 3.12; optional heavy model extras excluded | +| Python lint and tests | Ruff passed; 84 tests passed in 11.75 seconds; combined branch coverage 68% (live services excluded) | +| Distribution build | All four source distributions and wheels built successfully | +| CLI startup | Installed `simgen --help` and `netcortex-detector --help` passed | +| Frontend | Prettier, ESLint, TypeScript and production Next.js build passed | +| Dashboard browser flows | 14 Chromium tests passed across desktop and phone widths | +| Live transport browser behavior | Three tests passed against mocked HTTP/SSE, including visible failure, deduplication/reconnect, and acknowledgement followed by authoritative refetch | +| Dependency audit | Production dependencies: zero findings. Five high development entries share unpatched braces advisory GHSA-vfj7-8cjw-p6xm; see web decisions | +| RIPE download | 11,819 real public ping records, three PK probes / three ASNs, October 11–17; three daily request gaps recorded | +| Calibration | Actual per-target/hour and explicitly opted-in public DNS role-proxy statistics; no DNS lookup timing claim | +| CHR offline lifecycle | 12 fake-console/network/process tests passed; these do not count as a real boot | +| GitHub Actions | Results and links added after push | + +The detector regressions cover past-only features, finite physical bounds, SDK +quantile layout, all five horizons, capped fit contexts, stale/future and mixed +source rows, total-loss RTT absence, gaps in historical forecast comparison, +nonfinite model outputs, separate split windows and safe observation paths. +Provider tests cover malformed responses, timeouts, unavailable audio/news and +embedding identity/dimension checks. UI tests cover confirmation, failed router +checks, duplicate submissions, missing incidents, site backup topology and rollback. + +## Evaluation + +The reproducible run creates 80 training, 80 validation and 80 held-out cases, +with ten per class in each split: + +```powershell +uv run simgen eval-cases --n 80 --seed 1000 --mock +uv run python eval/run.py --mode mock +``` + +[The detector report](../eval/results/detector.md) scored 80/80 held-out fixture +cases: cause accuracy 37.5%, event precision 100% (62 predicted positives), recall +88.6% (62/70 events), median about 97 ms/case. Zero false alerts were observed +over only 0.20833 normal site-days; this small snapshot sample does not establish +a continuous-operation false-alert rate. This does not measure TabPFN performance. The separate +[cloud-unavailable report](../eval/results/cloud-unavailable.md) scores 0/80 cases +when the provider cannot run. Expected labels stay in +sidecars, out of detector inputs. Thresholds use validation only. Agent/template, +parameter and real-router metrics remain unavailable until Aun's integration runs. +Single-snapshot evaluation cannot establish detection delay; replay is required. + +Raw/generated files and calibration JSON remain ignored. Committed provenance and +coverage live in [the RIPE summary](../data/ripe-baseline-summary.json) and +[calibration report](../data/calibration-report.md). + +## Pending shared and external checks + +Upstream `main` still contained only README.md at the integration refresh. There +is no verified `netcortex_core`, backend, workflow, collector or template harness +to integrate against. [Contract requests](CONTRACT_REQUESTS.md) specify what is +needed. Public Python wrappers fail explicitly at those boundaries. + +No live database/pgvector query, EmbeddingGemma search, TabPFN inference, +ElevenLabs audio, SerpApi outage check, Sentry event, deployed Render/domain or +live approval/apply/verification/rollback has been established. Their account +access, credentials, exact model identity and/or Aun's code are pending. No +provider-free result is presented as evidence for those integrations. + +See [the start guide](START_HERE.md) to run the independent implementation. diff --git a/docs/post/partner-draft.md b/docs/post/partner-draft.md new file mode 100644 index 0000000..c17f3e3 --- /dev/null +++ b/docs/post/partner-draft.md @@ -0,0 +1,109 @@ +# NetCortex: a second set of eyes for a small network operator + +Draft for the team submission. This is not published. Aun supplies the +architecture, agent and router-safety sections. Replace every pending integration +with verified evidence before describing it as working. + +## Who might pay for this? + +A neighbourhood ISP or gaming cafe can have a busy evening and no dedicated +network operations team. A slow game server, a full uplink and one demanding +subscriber can all reach the owner as the same complaint: "the internet is slow." +The useful product is a shorter path from that complaint to evidence and an +appropriate action. + +Our intended customers are small wireless ISPs, cafe owners and freelance network +engineers who already operate MikroTik equipment. We have not yet established +willingness to pay. The first-user section must report an actual conversation or +walkthrough rather than treating this target audience as customer validation. + +## What the partner work builds + +Workstream B supplies reproducible telemetry scenarios, a detector adapter, +source-linked RouterOS documentation retrieval, voice/outage-check adapters and +the operator dashboard. The shared API, agent, durable workflows and virtual-router +test harness belong to Aun's workstream. + +The intended walkthrough starts with a site and a selected incident. The owner +sees the observations, the explanation, the proposed commands, the rollback +commands and the router-test result before deciding. The dashboard treats a +decision as a request to the workflow; it does not equate clicking Approve with a +successful router change. + +The current integration status and validation evidence must accompany any demo. +Fixture tests alone do not establish that the live API, model or virtual router +works. Hosted fixture mode is labelled **Demo: replayed data**. + +## The data story + +We wrote a generator rather than hand-writing plausible-looking metric rows. +Its inputs describe three sites, their uplink capacities, backhaul interfaces, +targets and subscriber counts. Seeded demand and queueing effects produce +repeatable normal periods and incidents. + +The real-baseline ingestion path discovers public Pakistani RIPE Atlas probes and +ping measurements. It derives latency, jitter and packet loss from the packet +results, retains measurement/probe provenance and caches bounded downloads. +The measured run downloaded 11,819 observations from three Pakistani probes +across three ASNs, spanning October 11?17, 2026. One measurement returned all +seven days; another returned four days and recorded three timeout gaps. The +[provenance summary](../../data/ripe-baseline-summary.json) and +[calibration report](../../data/calibration-report.md) preserve that coverage. +Root-server ping statistics can be explicitly opted into as a public-DNS +reachability proxy, with the route-transfer uncertainty recorded. Other target +roles retain clearly identified defaults. + +We also found a useful boundary in the original design: aggregate interface +counters cannot identify an individual heavy user, and a ping to a DNS resolver +does not measure a DNS lookup. Experimental subscriber and DNS fixtures stay +separate until the shared telemetry contract can carry those observations. + +## Why open models matter to the product + +The on-site design uses local Gemma inference and local EmbeddingGemma retrieval +so network context can remain on the operator's own machine. Local execution is +also valuable when the connection being diagnosed is unavailable. These are +deployment goals that must be demonstrated with a real offline run before we +claim the whole product works without internet access. + +The code can expose the model boundaries and measured failures for inspection. +That makes it possible to evaluate a different model or narrow its task without +rewriting the dashboard and workflows. + +Cloud add-ons have different boundaries. TabPFN cloud receives the submitted +feature data; ElevenLabs receives alert text; SerpApi receives the outage query. +They must be optional and described accurately. Our code's MIT license does not +replace the licenses of model weights, datasets or third-party services. Check +the applicable [TabPFN model terms](https://github.com/PriorLabs/TabPFN) before +commercial use. + +## What we measure + +Training, threshold selection and the final evaluation use separate cases. +The report distinguishes event detection from cause classification and records +false alerts, detection delay, parameter validity, router-test outcomes and +latency only where those checks actually ran. + +Results are linked from the repository's validation and evaluation reports. +Provider-free unit tests establish our parsing, failure handling and UI behavior; +they do not count as model-accuracy or live-integration results. + +## First-user notes to collect + +- Operator's role and existing MikroTik workflow, with permission to describe it. +- What they expected to see before approving a change. +- Which evidence they trusted or found confusing. +- Whether the tool would save time, and whether they would pay for it. +- What they requested next. + +No user, quote, payment or endorsement has been collected for this draft. + +## Submission checklist + +- Link the working demo only after an unaffiliated visitor can complete it. +- Include measured results and their fixture/cloud/local labels. +- Include actual model/checkpoint identities and data provenance. +- Link selected verified coding-session provenance if available. +- Add Aun's architecture, agent, approval and rollback evidence. +- Use the [official submission template](https://dev.to/challenges/hacktoberfest-week2-2026-10-12) + and required tags; publish before the verified deadline. diff --git a/docs/progress/bootstrap.md b/docs/progress/bootstrap.md index 8ab3f11..d0b1ee6 100644 --- a/docs/progress/bootstrap.md +++ b/docs/progress/bootstrap.md @@ -2,8 +2,22 @@ Date: 2026-10-18 -Root tooling and partner-owned documentation scaffolding are in place. The Python workspace declares the four planned Workstream B distributions and requires Python 3.12. Package directories are being developed by parallel workers, so lock generation is intentionally deferred to the workstream lead. +The root tooling and partner-owned bootstrap docs were laid down first. The workstream lead now owns the shared Python manifest and `uv.lock`; workers must not regenerate that lock independently. -Integration gates still open: Aun's actual core distribution name and shared schemas, Settings/API/SSE contracts, subscriber telemetry and role policy, forecast key/writer semantics, injection lifecycle, and the CHR test harness. CI calls the real harness when it appears and marks its absence as pending rather than claiming router coverage. +## CI and CHR -The Render blueprint includes only the static web app. The API remains a pending deployment integration. No user, evaluation, or live deployment claims have been fabricated in the post notes. +- Python CI installs all locked workspace packages, runs Ruff, and runs the package tests plus `.github/tests/test_chr_bootstrap.py`. +- Web CI has a pending summary until `apps/web` exists. Once it exists, missing lockfile/scripts/Playwright configuration/dependency fails instead of silently skipping the required checks. +- `.github/scripts/chr_bootstrap.py` pins official x86 CHR 7.24.5 and SHA-256 `16f07222a3213352c9c4fbea4f4dec6a8ffb78fdc0fa5e398c23103ed357c6eb` (official zip size 45,293,979 bytes). It uses QEMU with loopback-only management ports, handles the optional license-display prompt separately from actual terms acceptance, provisions a random admin password over serial, and requires two authenticated REST resource responses before reporting ready. +- Twelve offline lifecycle tests use fake console/process/network responses. They cover first-login display/acceptance prompts, bounded provisioning, GitHub secret masking, and password-redacted serial diagnostics. They do not boot a real router and are not counted as router/template coverage. +- The CHR template workflow owns QEMU setup and bootstrap; it uploads both QEMU and sanitized serial logs when available. When Aun's `infra/chr/test_templates.py` is absent, a separate CI smoke job boots CHR and checks authenticated REST readiness; the actual template job is skipped and the workflow summary says no template tests ran. +- The actual GitHub-hosted CHR smoke has not run from this branch yet. No real router boot or template pass is claimed here. +- The [official RouterOS REST API documentation](https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI) states REST uses the RouterOS HTTP/HTTPS service and Basic Auth. + +## Render + +`infra/render/render.yaml` is a Next.js Node web service in mock mode. It deploys no API. Aun's backend URL, auth, and deployment contract remain pending; Render health for `/` alone does not prove end-to-end product behavior. + +## Still open + +Core package naming and shared schemas, Settings/API/SSE contracts, subscriber telemetry/privacy and role policy, forecast key/writer semantics, simulator injection lifecycle, web app merge, API deployment integration, and the real CHR harness remain open. The demo and post notes contain no fabricated users, evaluation figures, or live deployment claims. diff --git a/docs/progress/head.md b/docs/progress/head.md new file mode 100644 index 0000000..edea020 --- /dev/null +++ b/docs/progress/head.md @@ -0,0 +1,59 @@ +# Head handoff: Workstream B + +Updated 2026-10-18. Integration repo is `NetCortex`, branch `b/workstream-b`. +User authorized full B1-B9/B11 excluding Tinker, Luna medium coding workers, +lead review/integration, tested branch push and decision/flow documents. +Only free tiers/credits; no purchase. Do not ask again for Git identity/auth. + +## Integrated code + +- Four uv workspace packages: simgen, detector, runbook, notify. +- Next.js dashboard with fixture and live HTTP/SSE transports. +- Python/frontend CI, separate pinned CHR bootstrap smoke/template jobs. +- Render Node blueprint; no deployed service or domain claimed. +- Root/package/app/eval/CI/hosting decision.md and flow.md, start guide, + validation plan/results, contract requests and honest submission draft. +- Main README remains Aun-owned and unchanged. MIT license follows brief. + +## Actual local checks + +- Locked base workspace sync passed; optional heavy model extras excluded. +- Root Ruff passed; combined Python/bootstrap suite: 84 passed in 11.75s, + branch coverage 68%. Current NumPy/pandas emit deprecation warnings. +- Four wheels/source distributions built; installed simgen/detector CLI help passed. +- Frontend format/lint/typecheck/production build passed. +- 14 desktop/mobile fixture E2E + 3 mocked-live HTTP/SSE E2E passed. +- Production npm audit clean; five high development entries share one unpatched + braces advisory. Web decision.md records why an incompatible downgrade was rejected. +- Real RIPE: 11,819 rows, three PK probes/ASNs, October 11-17; three daily + measurement request gaps. Raw rows ignored; provenance/report committed. +- Calibration explicitly opted into a narrow public-DNS ping-role proxy from + measured root-server paths, with provenance and route uncertainty. No DNS lookup claim. +- Generated 80 cases EACH train/validation/test (ten/class), separate seeds/windows. +- Fixture held-out report: 80/80 available; cause accuracy .375; event precision 1; + recall 62/70; median ~.097s; zero false alerts over .20833 normal site-days. + Single snapshots do not measure detection delay or continuous operation. +- Cloud-unavailable report: 0/80 model cases scored; never counts absence as normal. +- CHR offline: 12 tests, no local Linux boot. Real smoke must be observed on Actions. + +## GitHub and external gates + +Git author techieworld2 / user-provided email is local to repo. GCM contains +multiple identities; repo explicitly selects techieworld2. Verified push/workflow +access, no admin. Never print/store credential values. A helper outside the repo +can pass the existing GCM token to gh through the process environment only. +Entire enabled locally before first commit; telemetry/session auto-upload disabled. +No verified captured/uploaded coding transcript claimed. + +Upstream refresh still showed main at 4f84168 with README only. Aun must provide +core, Settings, API/SSE, migrations, workflows, collector, agent/fixes and template +harness. Public shared-type wrappers deliberately fail until those contracts exist. +DB/model/provider/Render/domain access is missing. Tiger/TabPFN MCP configured, +not authenticated/verified. RouterOS and Sentry skills installed/read/applied. + +## Delivery follow-through + +Push tested branch, create draft PR with actual checks/gates; observe CI and real +CHR smoke, repair failures. Add run/PR links to validation docs and final handoff. +Copilot automatic review requires Aun admin/eligible plan; do not claim enabled. +No merge or deployment is authorized/possible without shared code/account access. diff --git a/eval/results/agent.md b/eval/results/agent.md new file mode 100644 index 0000000..a97f080 --- /dev/null +++ b/eval/results/agent.md @@ -0,0 +1,13 @@ +# Agent evaluation + +Status: unavailable. The Aun `investigate()` API and its core input/output contracts are not present in this worktree, and the RouterOS CHR checker does not yet expose a machine-readable result contract here. + +| Measure | Result | Denominator | +|---|---:|---:| +| Cause accuracy | unavailable | unavailable | +| Template accuracy | unavailable | unavailable | +| Valid parameter rate | unavailable | unavailable | +| CHR dry-run pass rate | unavailable | unavailable | +| Time per case | unavailable | unavailable | + +No agent calls or CHR checks were made. The detector evaluator records detector cause accuracy separately in `detector.md`; fixture output is not a substitute for an agent run or a TabPFN result. This report can be populated after the approved `investigate()` contract and actual router checker are available. diff --git a/eval/results/cloud-unavailable.md b/eval/results/cloud-unavailable.md new file mode 100644 index 0000000..6a65203 --- /dev/null +++ b/eval/results/cloud-unavailable.md @@ -0,0 +1,113 @@ +# Detector evaluation + +Mode: `cloud` +Provenance: tabpfn-cloud:v3.5 +Test cases available: 0 / 80 +Unavailable cases: 80 + +| Measure | Result | +|---|---:| +| cause_accuracy | None | +| event_precision | None | +| event_recall | None | +| median_seconds | None | + +Precision denominator: 0 +Recall denominator: 0 +False alerts/site-day: None (site-day denominator 0.0) +Detection delay: None (unavailable: runner scores one as_of snapshot per case; minute-by-minute replay is required) +Validation score count: 0 +Validation unavailable cases: 80 +Validation normal exposure (site-days): 0.0 +Frozen validation threshold: 0.7 + +Agent cause accuracy: None (denominator 0) +Template accuracy: None (denominator 0; unavailable: Aun investigate/template contracts are not published) +Valid parameter rate: None (denominator 0; unavailable: approved template schemas and observed parameter sources are not published) +CHR dry-run pass rate: None (denominator 0; unavailable: Aun CHR checker and machine-readable result contract are not present) + + +## Cases + +| Case | Expected cause | Predicted cause | Anomaly | Status | Seconds | +|---|---|---|---:|---|---:| +| test-case-000 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-001 | normal | None | None | unavailable | 0.000 | +| test-case-002 | uplink_down | None | None | unavailable | 0.000 | +| test-case-003 | heavy_user | None | None | unavailable | 0.000 | +| test-case-004 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-005 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-006 | dns_slow | None | None | unavailable | 0.000 | +| test-case-007 | dns_slow | None | None | unavailable | 0.000 | +| test-case-008 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-009 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-010 | uplink_down | None | None | unavailable | 0.000 | +| test-case-011 | dns_slow | None | None | unavailable | 0.000 | +| test-case-012 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-013 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-014 | dns_slow | None | None | unavailable | 0.000 | +| test-case-015 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-016 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-017 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-018 | dns_slow | None | None | unavailable | 0.000 | +| test-case-019 | normal | None | None | unavailable | 0.000 | +| test-case-020 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-021 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-022 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-023 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-024 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-025 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-026 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-027 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-028 | dns_slow | None | None | unavailable | 0.000 | +| test-case-029 | uplink_down | None | None | unavailable | 0.000 | +| test-case-030 | normal | None | None | unavailable | 0.000 | +| test-case-031 | normal | None | None | unavailable | 0.000 | +| test-case-032 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-033 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-034 | normal | None | None | unavailable | 0.000 | +| test-case-035 | heavy_user | None | None | unavailable | 0.000 | +| test-case-036 | dns_slow | None | None | unavailable | 0.000 | +| test-case-037 | uplink_down | None | None | unavailable | 0.000 | +| test-case-038 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-039 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-040 | uplink_down | None | None | unavailable | 0.000 | +| test-case-041 | heavy_user | None | None | unavailable | 0.000 | +| test-case-042 | normal | None | None | unavailable | 0.000 | +| test-case-043 | heavy_user | None | None | unavailable | 0.000 | +| test-case-044 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-045 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-046 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-047 | normal | None | None | unavailable | 0.000 | +| test-case-048 | normal | None | None | unavailable | 0.000 | +| test-case-049 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-050 | uplink_down | None | None | unavailable | 0.000 | +| test-case-051 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-052 | normal | None | None | unavailable | 0.000 | +| test-case-053 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-054 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-055 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-056 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-057 | heavy_user | None | None | unavailable | 0.000 | +| test-case-058 | heavy_user | None | None | unavailable | 0.000 | +| test-case-059 | heavy_user | None | None | unavailable | 0.000 | +| test-case-060 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-061 | dns_slow | None | None | unavailable | 0.000 | +| test-case-062 | heavy_user | None | None | unavailable | 0.000 | +| test-case-063 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-064 | dns_slow | None | None | unavailable | 0.000 | +| test-case-065 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-066 | upstream_degradation | None | None | unavailable | 0.000 | +| test-case-067 | wireless_interference | None | None | unavailable | 0.000 | +| test-case-068 | heavy_user | None | None | unavailable | 0.000 | +| test-case-069 | uplink_down | None | None | unavailable | 0.000 | +| test-case-070 | heavy_user | None | None | unavailable | 0.000 | +| test-case-071 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-072 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-073 | normal | None | None | unavailable | 0.000 | +| test-case-074 | uplink_down | None | None | unavailable | 0.000 | +| test-case-075 | uplink_congestion | None | None | unavailable | 0.000 | +| test-case-076 | uplink_down | None | None | unavailable | 0.000 | +| test-case-077 | game_route_issue | None | None | unavailable | 0.000 | +| test-case-078 | dns_slow | None | None | unavailable | 0.000 | +| test-case-079 | uplink_down | None | None | unavailable | 0.000 | diff --git a/eval/results/detector.md b/eval/results/detector.md new file mode 100644 index 0000000..8589453 --- /dev/null +++ b/eval/results/detector.md @@ -0,0 +1,114 @@ +# Detector evaluation + +Mode: `mock` +Provenance: fixture: deterministic persistence/heuristic backend; no TabPFN inference +Test cases available: 80 / 80 +Unavailable cases: 0 + +| Measure | Result | +|---|---:| +| cause_accuracy | 0.375 | +| event_precision | 1.0 | +| event_recall | 0.8857142857142857 | +| median_seconds | 0.09696915000677109 | + +Precision denominator: 62 +Recall denominator: 70 +False alerts/site-day: 0.0 (site-day denominator 0.20833333333333334) +Detection delay: None (unavailable: runner scores one as_of snapshot per case; minute-by-minute replay is required) +Validation score count: 80 +Validation unavailable cases: 0 +Validation normal exposure (site-days): 0.20833333333333334 +Frozen validation threshold: 0.0011706044401654952 + +Agent cause accuracy: None (denominator 0) +Template accuracy: None (denominator 0; unavailable: Aun investigate/template contracts are not published) +Valid parameter rate: None (denominator 0; unavailable: approved template schemas and observed parameter sources are not published) +CHR dry-run pass rate: None (denominator 0; unavailable: Aun CHR checker and machine-readable result contract are not present) + +Fixture results describe only the deterministic fixture backend. They are not TabPFN accuracy claims. + +## Cases + +| Case | Expected cause | Predicted cause | Anomaly | Status | Seconds | +|---|---|---|---:|---|---:| +| test-case-000 | game_route_issue | normal | True | ok | 0.093 | +| test-case-001 | normal | normal | False | ok | 0.114 | +| test-case-002 | uplink_down | uplink_down | True | ok | 0.093 | +| test-case-003 | heavy_user | normal | True | ok | 0.093 | +| test-case-004 | upstream_degradation | normal | True | ok | 0.099 | +| test-case-005 | game_route_issue | normal | True | ok | 0.099 | +| test-case-006 | dns_slow | normal | False | ok | 0.096 | +| test-case-007 | dns_slow | normal | False | ok | 0.100 | +| test-case-008 | upstream_degradation | normal | True | ok | 0.098 | +| test-case-009 | upstream_degradation | normal | True | ok | 0.088 | +| test-case-010 | uplink_down | uplink_down | True | ok | 0.093 | +| test-case-011 | dns_slow | normal | False | ok | 0.104 | +| test-case-012 | upstream_degradation | normal | True | ok | 0.105 | +| test-case-013 | upstream_degradation | normal | True | ok | 0.100 | +| test-case-014 | dns_slow | normal | False | ok | 0.099 | +| test-case-015 | wireless_interference | normal | True | ok | 0.093 | +| test-case-016 | wireless_interference | normal | True | ok | 0.088 | +| test-case-017 | game_route_issue | normal | True | ok | 0.089 | +| test-case-018 | dns_slow | normal | True | ok | 0.094 | +| test-case-019 | normal | normal | False | ok | 0.099 | +| test-case-020 | game_route_issue | normal | True | ok | 0.104 | +| test-case-021 | game_route_issue | normal | True | ok | 0.093 | +| test-case-022 | wireless_interference | normal | True | ok | 0.099 | +| test-case-023 | uplink_congestion | uplink_congestion | True | ok | 0.105 | +| test-case-024 | game_route_issue | normal | True | ok | 0.099 | +| test-case-025 | uplink_congestion | uplink_congestion | True | ok | 0.091 | +| test-case-026 | game_route_issue | normal | True | ok | 0.092 | +| test-case-027 | uplink_congestion | uplink_congestion | True | ok | 0.086 | +| test-case-028 | dns_slow | normal | True | ok | 0.100 | +| test-case-029 | uplink_down | uplink_down | True | ok | 0.098 | +| test-case-030 | normal | normal | False | ok | 0.105 | +| test-case-031 | normal | normal | False | ok | 0.106 | +| test-case-032 | upstream_degradation | normal | True | ok | 0.099 | +| test-case-033 | uplink_congestion | uplink_congestion | True | ok | 0.087 | +| test-case-034 | normal | normal | False | ok | 0.101 | +| test-case-035 | heavy_user | normal | True | ok | 0.100 | +| test-case-036 | dns_slow | normal | False | ok | 0.105 | +| test-case-037 | uplink_down | uplink_down | True | ok | 0.099 | +| test-case-038 | uplink_congestion | uplink_congestion | True | ok | 0.089 | +| test-case-039 | upstream_degradation | normal | True | ok | 0.086 | +| test-case-040 | uplink_down | uplink_down | True | ok | 0.097 | +| test-case-041 | heavy_user | normal | True | ok | 0.100 | +| test-case-042 | normal | normal | False | ok | 0.099 | +| test-case-043 | heavy_user | normal | True | ok | 0.099 | +| test-case-044 | game_route_issue | normal | True | ok | 0.087 | +| test-case-045 | uplink_congestion | uplink_congestion | True | ok | 0.086 | +| test-case-046 | wireless_interference | normal | True | ok | 0.100 | +| test-case-047 | normal | normal | False | ok | 0.104 | +| test-case-048 | normal | normal | False | ok | 0.110 | +| test-case-049 | wireless_interference | normal | True | ok | 0.108 | +| test-case-050 | uplink_down | uplink_down | True | ok | 0.100 | +| test-case-051 | game_route_issue | normal | True | ok | 0.098 | +| test-case-052 | normal | normal | False | ok | 0.106 | +| test-case-053 | upstream_degradation | normal | True | ok | 0.096 | +| test-case-054 | wireless_interference | normal | True | ok | 0.088 | +| test-case-055 | wireless_interference | normal | True | ok | 0.089 | +| test-case-056 | wireless_interference | normal | True | ok | 0.099 | +| test-case-057 | heavy_user | normal | True | ok | 0.095 | +| test-case-058 | heavy_user | normal | True | ok | 0.088 | +| test-case-059 | heavy_user | normal | True | ok | 0.113 | +| test-case-060 | wireless_interference | normal | True | ok | 0.088 | +| test-case-061 | dns_slow | normal | False | ok | 0.087 | +| test-case-062 | heavy_user | normal | True | ok | 0.087 | +| test-case-063 | uplink_congestion | uplink_congestion | True | ok | 0.090 | +| test-case-064 | dns_slow | normal | False | ok | 0.087 | +| test-case-065 | upstream_degradation | normal | True | ok | 0.091 | +| test-case-066 | upstream_degradation | normal | True | ok | 0.087 | +| test-case-067 | wireless_interference | normal | True | ok | 0.087 | +| test-case-068 | heavy_user | normal | True | ok | 0.088 | +| test-case-069 | uplink_down | uplink_down | True | ok | 0.118 | +| test-case-070 | heavy_user | normal | True | ok | 0.097 | +| test-case-071 | uplink_congestion | uplink_congestion | True | ok | 0.099 | +| test-case-072 | uplink_congestion | uplink_congestion | True | ok | 0.095 | +| test-case-073 | normal | normal | False | ok | 0.094 | +| test-case-074 | uplink_down | uplink_down | True | ok | 0.098 | +| test-case-075 | uplink_congestion | uplink_congestion | True | ok | 0.088 | +| test-case-076 | uplink_down | uplink_down | True | ok | 0.088 | +| test-case-077 | game_route_issue | normal | True | ok | 0.094 | +| test-case-078 | dns_slow | normal | False | ok | 0.091 | +| test-case-079 | uplink_down | uplink_down | True | ok | 0.100 | diff --git a/flow.md b/flow.md index 340049a..638cf6e 100644 --- a/flow.md +++ b/flow.md @@ -39,7 +39,7 @@ flowchart TD | Entry | Inputs | Connection / processing | Exit | | --- | --- | --- | --- | | `simgen ripe` | requested days, cache location | Discover PK probes/measurements; bounded RIPE downloads | Local raw dataset with source provenance; error on unavailable API | -| `simgen calibrate` | real baseline rows | Group baseline statistics by target role and local hour | Calibration file with coverage/default status | +| `simgen calibrate` | real baseline rows, optional exact target-role map and explicit proxy opt-in | Group statistics by target and Pakistan hour; restrict proxy transfer to public DNS ping roles | Calibration/report with coverage, defaults, source targets and transfer uncertainty | | `simgen generate` | days, seed, scenario configuration | Seeded demand/noise and incident transforms | Probe/interface Parquet plus separate expected labels | | `simgen replay` / `inject` | site, cause, duration, seed | Active simulator runtime; DB writes need Aun's keys/runtime agreement | Current metrics and scenario label; explicit missing-runtime/contract failure | | `detect(site_id, window, history)` | observed shared MetricsWindow | Lag features -> TabPFN forecasts/anomaly/cause | Shared DetectionResult and approved forecast writes, or unavailable error | @@ -47,7 +47,7 @@ flowchart TD | `speak(text, lang)` | short text, en/ur | ElevenLabs with finite deadlines | MP3 bytes; empty bytes when audio unavailable | | `check_news(provider, target)` | upstream provider/target | Recent SerpApi search | Shared NewsCheck with links; explicit unavailable summary on failure | | Dashboard navigation | site/incident selection | Fixture transport or Aun's HTTP API | Rendered status/evidence, loading state or visible error | -| Dashboard decision | confirmed approve/reject | POST to Aun; workflow owns subsequent state | Acknowledged decision, followed by SSE/refetch; no assumed live success | +| Dashboard decision | confirmed approve/reject | POST to Aun; GET authoritative incident after acknowledgement; workflow owns subsequent state | Acknowledged decision, followed by SSE/refetch; no assumed live success | | Evaluation runner | held-out case directory and mode | Detector, then Aun's agent/checker when available | Markdown/structured results with actual measurements and pending gates | ## HTTP boundary owned by Aun @@ -73,6 +73,7 @@ passing CHR check and an appropriate incident state. Render runs the dashboard's Node/Next.js server. Aun supplies the API service; the browser does not hold database or provider secrets. Sentry receives optional frontend monitoring when configured. CI checks offline Python/frontend behavior; -the separate CHR workflow can establish router validity only when Aun's actual -boot/test harness runs successfully. External authentication is setup, not an -automatic claim of a working connection. +the separate CHR workflow boots a pinned router and checks authenticated REST. +Its template job runs only when Aun's actual test harness exists; boot success +alone does not establish template validity. External authentication is setup, +not an automatic claim of a working connection. From 4fecafffbecc6dc674ad27efec694ea64bdc14a4 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:30:08 +0500 Subject: [PATCH 09/21] fix: pin free hosting tier and preserve reproducible calibration inputs --- data/baselines/ripe-pk-2026-10-11--17.json | 728 +++++++++++++++++++++ decision.md | 1 + docs/VALIDATION_RESULTS.md | 7 +- infra/render/decision.md | 4 + infra/render/render.yaml | 1 + 5 files changed, 740 insertions(+), 1 deletion(-) create mode 100644 data/baselines/ripe-pk-2026-10-11--17.json diff --git a/data/baselines/ripe-pk-2026-10-11--17.json b/data/baselines/ripe-pk-2026-10-11--17.json new file mode 100644 index 0000000..e6f9c49 --- /dev/null +++ b/data/baselines/ripe-pk-2026-10-11--17.json @@ -0,0 +1,728 @@ +{ + "provenance": [ + "ripe" + ], + "experimental_status": "Hourly and target statistics are medians of observed samples only. Target/hour RTTs apply only when configured target names match. Role proxies require an explicit map and opt-in flag and are restricted to configured public DNS reachability targets. Ping reachability is not DNS resolution timing.", + "target_medians_ms": { + "192.5.5.241": 16.85852, + "193.0.14.129": 7.894053666666667 + }, + "target_stats": { + "192.5.5.241": { + "sample_count": 4028, + "rtt_ms": 16.85852, + "jitter_ms": 0.08237573216397984, + "loss_pct": 0.0 + }, + "193.0.14.129": { + "sample_count": 7099, + "rtt_ms": 7.894053666666667, + "jitter_ms": 0.04502710909613845, + "loss_pct": 0.0 + } + }, + "target_hourly_ms": { + "192.5.5.241": { + "0": 16.551208, + "1": 16.460082166666666, + "2": 16.480653666666665, + "3": 16.43144266666667, + "4": 16.493018666666668, + "5": 16.470335, + "6": 16.482232999999997, + "7": 17.67344866666667, + "8": 17.660875333333333, + "9": 17.677235833333334, + "10": 17.683419833333332, + "11": 17.691219666666665, + "12": 17.748065999999998, + "13": 16.711672166666666, + "14": 18.12307666666667, + "15": 17.903861333333335, + "16": 16.787747833333334, + "17": 16.811923333333333, + "18": 16.883398, + "19": 16.7215055, + "20": 16.749110333333334, + "21": 16.776593833333333, + "22": 16.601736166666665, + "23": 16.608373666666665 + }, + "193.0.14.129": { + "0": 7.766230999999999, + "1": 7.779592999999999, + "2": 7.78787, + "3": 7.889932, + "4": 7.520911833333334, + "5": 7.43387, + "6": 7.5493239999999995, + "7": 7.610784333333332, + "8": 7.555726333333332, + "9": 7.811861166666667, + "10": 7.942510666666666, + "11": 8.058916166666666, + "12": 8.269731333333334, + "13": 8.324717333333332, + "14": 8.001093333333333, + "15": 8.1707405, + "16": 8.079793666666667, + "17": 8.284253666666666, + "18": 8.331689666666668, + "19": 8.114797666666666, + "20": 7.927429, + "21": 7.9019363333333335, + "22": 7.943615, + "23": 7.857167666666666 + } + }, + "target_hourly_stats": { + "192.5.5.241": { + "0": { + "sample_count": 171, + "rtt_ms": 16.551208, + "jitter_ms": 0.08723196902894369, + "loss_pct": 0.0 + }, + "1": { + "sample_count": 164, + "rtt_ms": 16.460082166666666, + "jitter_ms": 0.06263128287844744, + "loss_pct": 0.0 + }, + "2": { + "sample_count": 169, + "rtt_ms": 16.480653666666665, + "jitter_ms": 0.06513735497819637, + "loss_pct": 0.0 + }, + "3": { + "sample_count": 164, + "rtt_ms": 16.43144266666667, + "jitter_ms": 0.06734879409334318, + "loss_pct": 0.0 + }, + "4": { + "sample_count": 170, + "rtt_ms": 16.493018666666668, + "jitter_ms": 0.06160606919488268, + "loss_pct": 0.0 + }, + "5": { + "sample_count": 170, + "rtt_ms": 16.470335, + "jitter_ms": 0.062486896789335916, + "loss_pct": 0.0 + }, + "6": { + "sample_count": 167, + "rtt_ms": 16.482232999999997, + "jitter_ms": 0.0609383460738985, + "loss_pct": 0.0 + }, + "7": { + "sample_count": 169, + "rtt_ms": 17.67344866666667, + "jitter_ms": 0.07209053793359879, + "loss_pct": 0.0 + }, + "8": { + "sample_count": 167, + "rtt_ms": 17.660875333333333, + "jitter_ms": 0.07230787847500103, + "loss_pct": 0.0 + }, + "9": { + "sample_count": 168, + "rtt_ms": 17.677235833333334, + "jitter_ms": 0.08598795710954867, + "loss_pct": 0.0 + }, + "10": { + "sample_count": 164, + "rtt_ms": 17.683419833333332, + "jitter_ms": 0.0764706252819589, + "loss_pct": 0.0 + }, + "11": { + "sample_count": 169, + "rtt_ms": 17.691219666666665, + "jitter_ms": 0.08759109905438797, + "loss_pct": 0.0 + }, + "12": { + "sample_count": 171, + "rtt_ms": 17.748065999999998, + "jitter_ms": 0.08607756587455918, + "loss_pct": 0.0 + }, + "13": { + "sample_count": 170, + "rtt_ms": 16.711672166666666, + "jitter_ms": 0.10387277837942613, + "loss_pct": 0.0 + }, + "14": { + "sample_count": 168, + "rtt_ms": 18.12307666666667, + "jitter_ms": 0.11632398105445785, + "loss_pct": 0.0 + }, + "15": { + "sample_count": 167, + "rtt_ms": 17.903861333333335, + "jitter_ms": 0.10073576050572414, + "loss_pct": 0.0 + }, + "16": { + "sample_count": 166, + "rtt_ms": 16.787747833333334, + "jitter_ms": 0.08513931209142364, + "loss_pct": 0.0 + }, + "17": { + "sample_count": 170, + "rtt_ms": 16.811923333333333, + "jitter_ms": 0.09845366630407364, + "loss_pct": 0.0 + }, + "18": { + "sample_count": 167, + "rtt_ms": 16.883398, + "jitter_ms": 0.10846517943356529, + "loss_pct": 0.0 + }, + "19": { + "sample_count": 166, + "rtt_ms": 16.7215055, + "jitter_ms": 0.08740146543418953, + "loss_pct": 0.0 + }, + "20": { + "sample_count": 165, + "rtt_ms": 16.749110333333334, + "jitter_ms": 0.12022342645535682, + "loss_pct": 0.0 + }, + "21": { + "sample_count": 168, + "rtt_ms": 16.776593833333333, + "jitter_ms": 0.11234178991210653, + "loss_pct": 0.0 + }, + "22": { + "sample_count": 170, + "rtt_ms": 16.601736166666665, + "jitter_ms": 0.09395578484504383, + "loss_pct": 0.0 + }, + "23": { + "sample_count": 168, + "rtt_ms": 16.608373666666665, + "jitter_ms": 0.07806283871480835, + "loss_pct": 0.0 + } + }, + "193.0.14.129": { + "0": { + "sample_count": 298, + "rtt_ms": 7.766230999999999, + "jitter_ms": 0.04321145040112888, + "loss_pct": 0.0 + }, + "1": { + "sample_count": 295, + "rtt_ms": 7.779592999999999, + "jitter_ms": 0.04182783331971933, + "loss_pct": 0.0 + }, + "2": { + "sample_count": 294, + "rtt_ms": 7.78787, + "jitter_ms": 0.040253578554628994, + "loss_pct": 0.0 + }, + "3": { + "sample_count": 290, + "rtt_ms": 7.889932, + "jitter_ms": 0.04551134974164825, + "loss_pct": 0.0 + }, + "4": { + "sample_count": 296, + "rtt_ms": 7.520911833333334, + "jitter_ms": 0.046292455069333834, + "loss_pct": 0.0 + }, + "5": { + "sample_count": 297, + "rtt_ms": 7.43387, + "jitter_ms": 0.04145629599416179, + "loss_pct": 0.0 + }, + "6": { + "sample_count": 300, + "rtt_ms": 7.5493239999999995, + "jitter_ms": 0.044059064300009707, + "loss_pct": 0.0 + }, + "7": { + "sample_count": 297, + "rtt_ms": 7.610784333333332, + "jitter_ms": 0.04862236033166552, + "loss_pct": 0.0 + }, + "8": { + "sample_count": 294, + "rtt_ms": 7.555726333333332, + "jitter_ms": 0.043966652029034325, + "loss_pct": 0.0 + }, + "9": { + "sample_count": 298, + "rtt_ms": 7.811861166666667, + "jitter_ms": 0.05171096604106671, + "loss_pct": 0.0 + }, + "10": { + "sample_count": 295, + "rtt_ms": 7.942510666666666, + "jitter_ms": 0.05597684071113695, + "loss_pct": 0.0 + }, + "11": { + "sample_count": 298, + "rtt_ms": 8.058916166666666, + "jitter_ms": 0.05042900038671104, + "loss_pct": 0.0 + }, + "12": { + "sample_count": 299, + "rtt_ms": 8.269731333333334, + "jitter_ms": 0.044524962040036205, + "loss_pct": 0.0 + }, + "13": { + "sample_count": 294, + "rtt_ms": 8.324717333333332, + "jitter_ms": 0.050453374424636946, + "loss_pct": 0.0 + }, + "14": { + "sample_count": 301, + "rtt_ms": 8.001093333333333, + "jitter_ms": 0.04459212634037255, + "loss_pct": 0.0 + }, + "15": { + "sample_count": 290, + "rtt_ms": 8.1707405, + "jitter_ms": 0.04274184622170979, + "loss_pct": 0.0 + }, + "16": { + "sample_count": 291, + "rtt_ms": 8.079793666666667, + "jitter_ms": 0.04155619593059766, + "loss_pct": 0.0 + }, + "17": { + "sample_count": 297, + "rtt_ms": 8.284253666666666, + "jitter_ms": 0.043701857964573716, + "loss_pct": 0.0 + }, + "18": { + "sample_count": 295, + "rtt_ms": 8.331689666666668, + "jitter_ms": 0.04833549472178839, + "loss_pct": 0.0 + }, + "19": { + "sample_count": 295, + "rtt_ms": 8.114797666666666, + "jitter_ms": 0.04531499111282881, + "loss_pct": 0.0 + }, + "20": { + "sample_count": 293, + "rtt_ms": 7.927429, + "jitter_ms": 0.04604739787074472, + "loss_pct": 0.0 + }, + "21": { + "sample_count": 298, + "rtt_ms": 7.9019363333333335, + "jitter_ms": 0.043603682430102125, + "loss_pct": 0.0 + }, + "22": { + "sample_count": 297, + "rtt_ms": 7.943615, + "jitter_ms": 0.04487730574453963, + "loss_pct": 0.0 + }, + "23": { + "sample_count": 297, + "rtt_ms": 7.857167666666666, + "jitter_ms": 0.04756501525514548, + "loss_pct": 0.0 + } + } + }, + "role_medians": { + "public_dns_reachability_proxy": { + "sample_count": 11127, + "rtt_ms": 16.325819, + "jitter_ms": 0.05650035257903673, + "loss_pct": 0.0 + } + }, + "role_hourly_stats": { + "public_dns_reachability_proxy": { + "0": { + "sample_count": 469, + "rtt_ms": 16.318362, + "jitter_ms": 0.05606639365569698, + "loss_pct": 0.0 + }, + "1": { + "sample_count": 459, + "rtt_ms": 16.305560333333332, + "jitter_ms": 0.047581405011715525, + "loss_pct": 0.0 + }, + "2": { + "sample_count": 463, + "rtt_ms": 16.31138066666667, + "jitter_ms": 0.048643767482473954, + "loss_pct": 0.0 + }, + "3": { + "sample_count": 454, + "rtt_ms": 16.299233833333332, + "jitter_ms": 0.05005642229728814, + "loss_pct": 0.0 + }, + "4": { + "sample_count": 466, + "rtt_ms": 16.305297833333334, + "jitter_ms": 0.050188871381498454, + "loss_pct": 0.0 + }, + "5": { + "sample_count": 467, + "rtt_ms": 16.272119666666665, + "jitter_ms": 0.049732176512460764, + "loss_pct": 0.0 + }, + "6": { + "sample_count": 467, + "rtt_ms": 16.279111999999998, + "jitter_ms": 0.048783355979951454, + "loss_pct": 0.0 + }, + "7": { + "sample_count": 466, + "rtt_ms": 16.251087666666663, + "jitter_ms": 0.056497728904253364, + "loss_pct": 0.0 + }, + "8": { + "sample_count": 461, + "rtt_ms": 16.26824433333333, + "jitter_ms": 0.05048028711839256, + "loss_pct": 0.0 + }, + "9": { + "sample_count": 466, + "rtt_ms": 16.289545333333336, + "jitter_ms": 0.06299181200417098, + "loss_pct": 0.0 + }, + "10": { + "sample_count": 459, + "rtt_ms": 16.33685266666667, + "jitter_ms": 0.06467928693175273, + "loss_pct": 0.0 + }, + "11": { + "sample_count": 467, + "rtt_ms": 16.401758, + "jitter_ms": 0.06545249046955104, + "loss_pct": 0.0 + }, + "12": { + "sample_count": 470, + "rtt_ms": 16.461637, + "jitter_ms": 0.06354847995368651, + "loss_pct": 0.0 + }, + "13": { + "sample_count": 464, + "rtt_ms": 16.358806, + "jitter_ms": 0.06573944022923481, + "loss_pct": 0.0 + }, + "14": { + "sample_count": 469, + "rtt_ms": 16.402351333333332, + "jitter_ms": 0.05947983257280477, + "loss_pct": 0.0 + }, + "15": { + "sample_count": 457, + "rtt_ms": 16.454457666666666, + "jitter_ms": 0.056780130587692434, + "loss_pct": 0.0 + }, + "16": { + "sample_count": 457, + "rtt_ms": 16.347939666666665, + "jitter_ms": 0.05133088025956911, + "loss_pct": 0.0 + }, + "17": { + "sample_count": 467, + "rtt_ms": 16.332949333333335, + "jitter_ms": 0.05449381874630879, + "loss_pct": 0.0 + }, + "18": { + "sample_count": 462, + "rtt_ms": 16.360720166666667, + "jitter_ms": 0.06418695557570152, + "loss_pct": 0.0 + }, + "19": { + "sample_count": 461, + "rtt_ms": 16.337348666666667, + "jitter_ms": 0.06288754541242648, + "loss_pct": 0.0 + }, + "20": { + "sample_count": 458, + "rtt_ms": 16.338292666666668, + "jitter_ms": 0.06434506354115789, + "loss_pct": 0.0 + }, + "21": { + "sample_count": 466, + "rtt_ms": 16.3493635, + "jitter_ms": 0.06587463696598783, + "loss_pct": 0.0 + }, + "22": { + "sample_count": 467, + "rtt_ms": 16.319249666666668, + "jitter_ms": 0.061243529851459956, + "loss_pct": 0.0 + }, + "23": { + "sample_count": 465, + "rtt_ms": 16.325295999999998, + "jitter_ms": 0.0631476448491937, + "loss_pct": 0.0 + } + } + }, + "role_proxy": { + "enabled": true, + "role": "public_dns_reachability_proxy", + "source_targets": [ + "192.5.5.241", + "193.0.14.129" + ], + "configured_targets": [ + "1.1.1.1", + "8.8.8.8" + ], + "opt_in_required": [ + "exact target-role map", + "--allow-role-proxy" + ], + "uncertainty": "These are public root-DNS-server ping paths. Their RTT, jitter, and loss are reachability proxies, not DNS lookup timing or proof of route equivalence to 1.1.1.1 or 8.8.8.8.", + "status": "enabled by explicit mapping and CLI flag" + }, + "target_roles": { + "192.5.5.241": "public_dns_reachability_proxy", + "193.0.14.129": "public_dns_reachability_proxy" + }, + "hourly": [ + { + "hour_pk": 0, + "rtt_ms": 16.318362, + "jitter_ms": 0.05606639365569698, + "loss_pct": 0.0, + "sample_count": 469 + }, + { + "hour_pk": 1, + "rtt_ms": 16.305560333333332, + "jitter_ms": 0.047581405011715525, + "loss_pct": 0.0, + "sample_count": 459 + }, + { + "hour_pk": 2, + "rtt_ms": 16.31138066666667, + "jitter_ms": 0.048643767482473954, + "loss_pct": 0.0, + "sample_count": 463 + }, + { + "hour_pk": 3, + "rtt_ms": 16.299233833333332, + "jitter_ms": 0.05005642229728814, + "loss_pct": 0.0, + "sample_count": 454 + }, + { + "hour_pk": 4, + "rtt_ms": 16.305297833333334, + "jitter_ms": 0.050188871381498454, + "loss_pct": 0.0, + "sample_count": 466 + }, + { + "hour_pk": 5, + "rtt_ms": 16.272119666666665, + "jitter_ms": 0.049732176512460764, + "loss_pct": 0.0, + "sample_count": 467 + }, + { + "hour_pk": 6, + "rtt_ms": 16.279111999999998, + "jitter_ms": 0.048783355979951454, + "loss_pct": 0.0, + "sample_count": 467 + }, + { + "hour_pk": 7, + "rtt_ms": 16.251087666666663, + "jitter_ms": 0.056497728904253364, + "loss_pct": 0.0, + "sample_count": 466 + }, + { + "hour_pk": 8, + "rtt_ms": 16.26824433333333, + "jitter_ms": 0.05048028711839256, + "loss_pct": 0.0, + "sample_count": 461 + }, + { + "hour_pk": 9, + "rtt_ms": 16.289545333333336, + "jitter_ms": 0.06299181200417098, + "loss_pct": 0.0, + "sample_count": 466 + }, + { + "hour_pk": 10, + "rtt_ms": 16.33685266666667, + "jitter_ms": 0.06467928693175273, + "loss_pct": 0.0, + "sample_count": 459 + }, + { + "hour_pk": 11, + "rtt_ms": 16.401758, + "jitter_ms": 0.06545249046955104, + "loss_pct": 0.0, + "sample_count": 467 + }, + { + "hour_pk": 12, + "rtt_ms": 16.461637, + "jitter_ms": 0.06354847995368651, + "loss_pct": 0.0, + "sample_count": 470 + }, + { + "hour_pk": 13, + "rtt_ms": 16.358806, + "jitter_ms": 0.06573944022923481, + "loss_pct": 0.0, + "sample_count": 464 + }, + { + "hour_pk": 14, + "rtt_ms": 16.402351333333332, + "jitter_ms": 0.05947983257280477, + "loss_pct": 0.0, + "sample_count": 469 + }, + { + "hour_pk": 15, + "rtt_ms": 16.454457666666666, + "jitter_ms": 0.056780130587692434, + "loss_pct": 0.0, + "sample_count": 457 + }, + { + "hour_pk": 16, + "rtt_ms": 16.347939666666665, + "jitter_ms": 0.05133088025956911, + "loss_pct": 0.0, + "sample_count": 457 + }, + { + "hour_pk": 17, + "rtt_ms": 16.332949333333335, + "jitter_ms": 0.05449381874630879, + "loss_pct": 0.0, + "sample_count": 467 + }, + { + "hour_pk": 18, + "rtt_ms": 16.360720166666667, + "jitter_ms": 0.06418695557570152, + "loss_pct": 0.0, + "sample_count": 462 + }, + { + "hour_pk": 19, + "rtt_ms": 16.337348666666667, + "jitter_ms": 0.06288754541242648, + "loss_pct": 0.0, + "sample_count": 461 + }, + { + "hour_pk": 20, + "rtt_ms": 16.338292666666668, + "jitter_ms": 0.06434506354115789, + "loss_pct": 0.0, + "sample_count": 458 + }, + { + "hour_pk": 21, + "rtt_ms": 16.3493635, + "jitter_ms": 0.06587463696598783, + "loss_pct": 0.0, + "sample_count": 466 + }, + { + "hour_pk": 22, + "rtt_ms": 16.319249666666668, + "jitter_ms": 0.061243529851459956, + "loss_pct": 0.0, + "sample_count": 467 + }, + { + "hour_pk": 23, + "rtt_ms": 16.325295999999998, + "jitter_ms": 0.0631476448491937, + "loss_pct": 0.0, + "sample_count": 465 + } + ], + "observation_count": 11819, + "input_files": [ + "data\\raw\\ripe\\results.parquet" + ], + "time_range_utc": { + "start": "2026-10-11T00:00:26+00:00", + "end": "2026-10-17T23:59:48+00:00" + } +} diff --git a/decision.md b/decision.md index 959af74..27da661 100644 --- a/decision.md +++ b/decision.md @@ -25,6 +25,7 @@ how the pieces connect and [the implementation plan](docs/WORKSTREAM_B_PLAN.md). | Persist decisions, flow documentation and progress handoffs | User wants to understand the code and context must survive compaction | Every package/app has both documents; lead keeps these root documents current | | Normalize tracked text to LF | The team develops on Windows and macOS and tests on Linux | Git whitespace checks and generated diffs behave consistently | | Do not promise exact 60% compaction in this running session | Exposed agent controls do not set or trigger that threshold | Host compaction remains automatic; handoffs preserve state independently | +| Preserve a frozen aggregate calibration profile | Seeded evaluation also depends on the baseline statistics | Reproduce the recorded run without committing raw RIPE rows or relying on a moving download window | | Require explicit opt-in for RIPE role transfer | Measured root-server routes differ from configured DNS destinations | Transfer can affect public DNS ping baselines only; provenance and uncertainty travel with generated data | | Validate quantile layout, forecast time and freshness independently | SDK array shape and future rows can silently corrupt an otherwise plausible forecast | Regression tests cover each horizon, physical bounds, mixed sources and gaps | | Treat live decision POST responses as acknowledgements | A workflow can still be applying or rolling back after the HTTP request succeeds | Fetch authoritative incident state and follow SSE updates | diff --git a/docs/VALIDATION_RESULTS.md b/docs/VALIDATION_RESULTS.md index 267931b..04b3440 100644 --- a/docs/VALIDATION_RESULTS.md +++ b/docs/VALIDATION_RESULTS.md @@ -32,6 +32,7 @@ The reproducible run creates 80 training, 80 validation and 80 held-out cases, with ten per class in each split: ```powershell +Copy-Item data/baselines/ripe-pk-2026-10-11--17.json data/calibration.json uv run simgen eval-cases --n 80 --seed 1000 --mock uv run python eval/run.py --mode mock ``` @@ -47,7 +48,11 @@ sidecars, out of detector inputs. Thresholds use validation only. Agent/template parameter and real-router metrics remain unavailable until Aun's integration runs. Single-snapshot evaluation cannot establish detection delay; replay is required. -Raw/generated files and calibration JSON remain ignored. Committed provenance and +The frozen aggregate [calibration profile](../data/baselines/ripe-pk-2026-10-11--17.json) +preserves the exact statistical input used for this run. Copying it as above +explicitly opts into the narrow role proxy; use `cp` in a POSIX shell. No raw +measurements are included in the profile. Raw/generated files and the active +`data/calibration.json` remain ignored. Committed provenance and coverage live in [the RIPE summary](../data/ripe-baseline-summary.json) and [calibration report](../data/calibration-report.md). diff --git a/infra/render/decision.md b/infra/render/decision.md index 61dc73b..d3468fa 100644 --- a/infra/render/decision.md +++ b/infra/render/decision.md @@ -2,6 +2,10 @@ The Render blueprint deploys only the Next.js web app as a Node web service. Its build runs `npm ci` and `npm run build`; the start command binds Next.js to Render's assigned `$PORT`. The health check targets `/`. +The service explicitly sets `plan: free` to honor the user's spending limit and +avoid inheriting a paid service default. Account eligibility and current Render +limits still need verification at deployment time. + The UI is configured for mock mode with `NEXT_PUBLIC_API_MODE=mock`. No API service is declared because Aun's backend, authentication, and deployment contract are not available in this branch. Adding an invented backend service or public API URL would imply an integration that does not exist. Do not put secrets in `NEXT_PUBLIC_*` variables; Next.js embeds those values into browser code. Once Aun publishes the service and auth contract, the service owner must choose the API URL, CORS/auth behavior, and private environment variables, then update the blueprint deliberately. Until the team confirms the public site is deployed and usable, describe Render as configured/planned rather than live. diff --git a/infra/render/render.yaml b/infra/render/render.yaml index 67bcb57..9c14e5e 100644 --- a/infra/render/render.yaml +++ b/infra/render/render.yaml @@ -4,6 +4,7 @@ services: - type: web name: netcortex-demo runtime: node + plan: free rootDir: apps/web buildCommand: npm ci && npm run build startCommand: npm run start -- --hostname 0.0.0.0 --port $PORT From f8b500f2a123c4d01ec155ff884cd3f005be68ef Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:31:17 +0500 Subject: [PATCH 10/21] fix: handle real CHR console input and control browser test clocks --- .github/decision.md | 2 +- .github/flow.md | 2 +- .github/scripts/chr_bootstrap.py | 55 +++++++++++++---- .github/tests/test_chr_bootstrap.py | 95 ++++++++++++++++++++++++++--- .github/workflows/ci.yml | 8 +++ apps/web/decision.md | 1 + apps/web/e2e/dashboard.spec.ts | 18 +++++- decision.md | 8 +++ docs/progress/bootstrap.md | 4 +- docs/progress/head.md | 7 ++- docs/progress/web_dashboard.md | 4 ++ 11 files changed, 175 insertions(+), 29 deletions(-) diff --git a/.github/decision.md b/.github/decision.md index 9227ef4..605d4cb 100644 --- a/.github/decision.md +++ b/.github/decision.md @@ -12,7 +12,7 @@ The router workflow pins the official x86 CHR artifact to RouterOS 7.24.5, rathe The helper uses QEMU directly because CI needs an isolated RouterOS instance with the real REST API and a writable disk for testing apply/read-back/rollback. It chooses KVM only when `/dev/kvm` is writable and otherwise uses TCG. The router is exposed through host forwarding bound to `127.0.0.1` for REST and SSH; the serial console stays on a Unix socket. This keeps the test router off public and shared network interfaces. -Provisioning handles the first-login license flow by answering `n` to the optional software-license display prompt, sending Enter at its continuation prompt, and answering `y` only when RouterOS asks to agree to the license terms. Each prompt is handled once within the bounded serial provisioning deadline. The first serial read uses the remaining deadline rather than a shorter per-read cap because TCG startup may take longer than 20 seconds before the login prompt appears. It creates a random per-run admin password through the serial console and enables `www` with `rest-plain=yes`. MikroTik's [IP services reference](https://help.mikrotik.com/docs/spaces/ROS/pages/103841820/Services) documents `rest-plain` as the REST API support property for HTTP `www`. The helper fails on CLI error text rather than treating a returned prompt as proof the command worked. It emits the GitHub Actions secret mask before sending the generated password, writes the credential to later steps through `GITHUB_ENV`, and stores redacted serial transcript diagnostics on provisioning failure. The readiness gate makes two consecutive authenticated calls to `/rest/system/resource` and requires the expected single resource object with a `board-name` field. A bare HTTP 200 is insufficient evidence that RouterOS REST is ready. +Provisioning handles the first-login license flow by answering `n` to the optional software-license display prompt, sending Enter at its continuation prompt, and answering `y` only when RouterOS asks to agree to the license terms. Each prompt is handled once within the bounded serial provisioning deadline. The first serial read uses the remaining deadline rather than a shorter per-read cap because TCG startup may take longer than 20 seconds before the login prompt appears. It creates a random per-run admin password through the serial console and enables `www` with `rest-plain=yes`. MikroTik's [IP services reference](https://help.mikrotik.com/docs/spaces/ROS/pages/103841820/Services) documents `rest-plain` as the REST API support property for HTTP `www`. The helper fails on CLI error text rather than treating a returned prompt as proof the command worked. It emits the GitHub Actions secret mask before sending the generated password, writes the credential to later steps through `GITHUB_ENV`, and stores redacted serial transcript diagnostics after successful provisioning and on failures so later REST readiness errors retain console context. Serial input lines end with a single carriage return: the failed real boot transcript showed the password prompt repeated twice followed by New passwords do not match after CRLF submissions. The helper now detects password rejection immediately and preserves prompt text already buffered after a match. The readiness gate makes two consecutive authenticated calls to `/rest/system/resource` and requires the expected single resource object with a `board-name` field. A bare HTTP 200 is insufficient evidence that RouterOS REST is ready. ## External router test gate diff --git a/.github/flow.md b/.github/flow.md index 3dca2a5..28610f8 100644 --- a/.github/flow.md +++ b/.github/flow.md @@ -15,7 +15,7 @@ 1. Readiness checks only for Aun's `infra/chr/test_templates.py`. 2. If missing, the template job is skipped and the summary says no CHR/template tests ran. A separate smoke job installs QEMU/the locked workspace, tests B's offline lifecycle code, and boots/provisions the pinned router. 3. If present, only the real template job runs; it installs QEMU/the locked workspace and boots/provisions one router before invoking Aun's harness. The smoke job stays skipped to avoid a duplicate boot. -4. Bootstrap downloads and verifies the pinned image, starts QEMU, skips the optional license text display, presses Enter at the continuation prompt, agrees only at the terms prompt, provisions a random admin password over its serial socket, enables REST support, and verifies the authenticated REST resource twice. It masks the password before provisioning and exposes `CHR_REST_URL`, `CHR_REST_USERNAME`, and `CHR_REST_PASSWORD` only to subsequent steps through `GITHUB_ENV`. +4. Bootstrap downloads and verifies the pinned image, starts QEMU, skips the optional license text display, presses Enter at the continuation prompt, agrees only at the terms prompt, provisions a random admin password over its serial socket, enables REST support, and verifies the authenticated REST resource twice. It sends serial input with a single CR terminator, detects password mismatch errors immediately, preserves additional prompts from a read chunk, and writes the redacted serial transcript after provisioning so REST failures can be debugged. It masks the password before provisioning and exposes `CHR_REST_URL`, `CHR_REST_USERNAME`, and `CHR_REST_PASSWORD` only to subsequent steps through `GITHUB_ENV`. 5. The real template job runs Aun's harness against `http://127.0.0.1:9180/rest`. On every outcome, the active router job uploads QEMU and sanitized serial logs when available and asks the helper to stop only its own verified QEMU process. **Exit:** actual template coverage is reported only when Aun's harness ran. Bootstrap unit tests, boot smoke, job setup, and a missing-harness skip do not count as an actual router/template test pass. diff --git a/.github/scripts/chr_bootstrap.py b/.github/scripts/chr_bootstrap.py index bd47298..d8ce504 100644 --- a/.github/scripts/chr_bootstrap.py +++ b/.github/scripts/chr_bootstrap.py @@ -154,10 +154,20 @@ def _recv_until( patterns: list[tuple[str, re.Pattern[str]]], timeout: float, transcript: list[str], + pending: list[str] | None = None, ) -> str: deadline = time.monotonic() + timeout - buffer = "" + pending = pending if pending is not None else [] + buffer = "".join(pending) + pending.clear() while time.monotonic() < deadline: + for label, pattern in patterns: + match = pattern.search(buffer) + if match: + remainder = buffer[match.end() :] + if remainder: + pending.append(remainder) + return label stream.settimeout(min(1.0, max(0.1, deadline - time.monotonic()))) try: chunk = stream.recv(4096) @@ -169,7 +179,11 @@ def _recv_until( buffer += decoded transcript.append(decoded) for label, pattern in patterns: - if pattern.search(buffer): + match = pattern.search(buffer) + if match: + remainder = buffer[match.end() :] + if remainder: + pending.append(remainder) return label if len(buffer) > 16000: buffer = buffer[-8000:] @@ -177,25 +191,34 @@ def _recv_until( def _send_line(stream: socket.socket, line: str) -> None: - stream.sendall(line.encode("utf-8") + b"\r\n") + stream.sendall(line.encode("utf-8") + b"\r") def provision_console(password: str, timeout: int = 120) -> None: """Set the first-login admin password and enable HTTP REST for loopback CI.""" deadline = time.monotonic() + timeout transcript: list[str] = [] + pending: list[str] = [] patterns = [ ( "command_error", re.compile(r"(?:bad command name|expected end of command|syntax error|failure:)", re.I), ), + ( + "password_error", + re.compile( + r"(?:new passwords? do not match|passwords? do not match|" + r"incorrect password|wrong password)", + re.I, + ), + ), ( "license_display", re.compile(r"do you want to see.*software license.*\[y/n\]\s*:?", re.I), ), ( "license_continue", - re.compile(r"press (?:the )?enter to continue\s*:?", re.I), + re.compile(r"press (?:the )?enter to continue[ \t]*:?", re.I), ), ( "license_agreement", @@ -205,12 +228,15 @@ def provision_console(password: str, timeout: int = 120) -> None: re.I, ), ), - ("login", re.compile(r"login:\s*$", re.I | re.M)), - ("repeat_password", re.compile(r"repeat(?:\s+new)? password:?\s*>?\s*$", re.I | re.M)), - ("new_password", re.compile(r"new password:?\s*>?\s*$", re.I | re.M)), - ("current_password", re.compile(r"current password:?\s*>?\s*$", re.I | re.M)), - ("password", re.compile(r"(?:^|\n)password:\s*$", re.I | re.M)), - ("prompt", re.compile(r"\[[^\]]+\]\s*(?:/[^\r\n]*)?[>#]\s*$", re.M)), + ("login", re.compile(r"login:[ \t]*\r?$", re.I | re.M)), + ( + "repeat_password", + re.compile(r"repeat(?:\s+new)? password:?[ \t]*>?[ \t]*\r?$", re.I | re.M), + ), + ("new_password", re.compile(r"new password:?[ \t]*>?[ \t]*\r?$", re.I | re.M)), + ("current_password", re.compile(r"current password:?[ \t]*>?[ \t]*\r?$", re.I | re.M)), + ("password", re.compile(r"(?:^|\n)password:[ \t]*\r?$", re.I | re.M)), + ("prompt", re.compile(r"\[[^\]]+\][ \t]*(?:/[^\r\n]*)?[>#][ \t]*\r?$", re.M)), ] try: while time.monotonic() < deadline: @@ -240,9 +266,11 @@ def provision_console(password: str, timeout: int = 120) -> None: remaining = max(1, int(deadline - time.monotonic())) # TCG can take longer than 20 seconds to reach the first login prompt. # Keep waiting, but never extend beyond the caller's overall deadline. - prompt = _recv_until(stream, patterns, remaining, transcript) + prompt = _recv_until(stream, patterns, remaining, transcript, pending) if prompt == "command_error": raise BootstrapError("RouterOS rejected a serial provisioning command") + if prompt == "password_error": + raise BootstrapError("RouterOS rejected admin password confirmation") if prompt == "license_display" and not sent_license_display: _send_line(stream, "n") sent_license_display = True @@ -287,9 +315,12 @@ def provision_console(password: str, timeout: int = 120) -> None: for command in ("/ip service set [find name=www] disabled=no rest-plain=yes",): _send_line(stream, command) - outcome = _recv_until(stream, patterns[:1] + [patterns[-1]], 15, transcript) + outcome = _recv_until( + stream, patterns[:2] + [patterns[-1]], 15, transcript, pending + ) if outcome == "command_error": raise BootstrapError("RouterOS rejected the www REST service configuration") + _write_serial_diagnostics(transcript, password) except BootstrapError: _write_serial_diagnostics(transcript, password) raise diff --git a/.github/tests/test_chr_bootstrap.py b/.github/tests/test_chr_bootstrap.py index 4ad4b4a..f23d12c 100644 --- a/.github/tests/test_chr_bootstrap.py +++ b/.github/tests/test_chr_bootstrap.py @@ -24,6 +24,7 @@ def __init__( license_prompt: bool = False, license_display: bool = False, echo_secret: bool = False, + password_mismatch: bool = False, ) -> None: self.buffer = ( b"Do you want to see the software license? [Y/n]:\n" @@ -40,7 +41,9 @@ def __init__( self.license_display = license_display self.display_skipped = False self.echo_secret = echo_secret + self.password_mismatch = password_mismatch self.reject_service_command = False + self.raw_sent: list[bytes] = [] def settimeout(self, _timeout: float) -> None: pass @@ -53,6 +56,7 @@ def recv(self, _size: int) -> bytes: return result def sendall(self, data: bytes) -> None: + self.raw_sent.append(data) value = data.decode().strip("\r\n") self.sent.append(value) prompts = { @@ -81,9 +85,12 @@ def sendall(self, data: bytes) -> None: self.buffer = b"new password:\n" elif value == "test-secret": self.secret_count += 1 - prompt = ( - b"repeat new password:\n" if self.secret_count == 1 else b"[admin@MikroTik] >\n" - ) + if self.password_mismatch and self.secret_count == 2: + prompt = b"Try again, error: New passwords do not match!\nnew password>\n" + else: + prompt = ( + b"repeat new password:\n" if self.secret_count == 1 else b"[admin@MikroTik] >\n" + ) self.buffer = (b"test-secret\r\n" if self.echo_secret else b"") + prompt else: self.buffer = prompts.get(value, b"") @@ -130,6 +137,51 @@ def recv(self, _size: int) -> bytes: "prompt", ) + def test_serial_lines_use_single_carriage_return_delimiter(self) -> None: + class RecordingStream: + sent = b"" + + def sendall(self, data: bytes) -> None: + self.sent = data + + stream = RecordingStream() + chr._send_line(stream, "admin") + self.assertEqual(stream.sent, b"admin\r") + + def test_serial_reader_preserves_prompt_bytes_after_match(self) -> None: + class BufferedPrompts: + chunks = [b"login:\r\nnew password>\r\n"] + + def settimeout(self, _timeout: float) -> None: + pass + + def recv(self, _size: int) -> bytes: + return self.chunks.pop(0) if self.chunks else b"" + + stream = BufferedPrompts() + pending: list[str] = [] + transcript: list[str] = [] + self.assertEqual( + chr._recv_until( + stream, + [("login", chr.re.compile(r"login:[ \t]*\r?$", chr.re.I | chr.re.M))], + timeout=1, + transcript=transcript, + pending=pending, + ), + "login", + ) + self.assertEqual( + chr._recv_until( + stream, + [("new_password", chr.re.compile(r"new password>[ \t]*\r?$", chr.re.I | chr.re.M))], + timeout=1, + transcript=transcript, + pending=pending, + ), + "new_password", + ) + def test_release_is_pinned_to_official_versioned_url(self) -> None: self.assertEqual(chr.VERSION, "7.24.5") self.assertEqual( @@ -146,13 +198,19 @@ def test_qemu_only_exposes_management_ports_on_loopback_and_has_serial(self) -> self.assertIn("-monitor none", joined) def test_provision_sets_new_admin_password_and_enables_rest(self) -> None: - fake = FakeConsole() - with ( - patch.object(chr.socket, "AF_UNIX", 1, create=True), - patch.object(chr.socket, "socket", return_value=fake), - patch.object(chr.time, "sleep"), - ): - chr.provision_console("test-secret", timeout=10) + fake = FakeConsole(echo_secret=True) + with tempfile.TemporaryDirectory() as temp: + diagnostic = Path(temp) / "serial.log" + with ( + patch.object(chr, "SERIAL_LOG_FILE", diagnostic), + patch.object(chr.socket, "AF_UNIX", 1, create=True), + patch.object(chr.socket, "socket", return_value=fake), + patch.object(chr.time, "sleep"), + ): + chr.provision_console("test-secret", timeout=10) + saved = diagnostic.read_text(encoding="utf-8") + self.assertIn("[REDACTED]", saved) + self.assertNotIn("test-secret", saved) self.assertIn("admin", fake.sent) self.assertIn("/password", fake.sent) self.assertIn("test-secret", fake.sent) @@ -197,6 +255,23 @@ def test_provision_fails_when_router_rejects_rest_configuration(self) -> None: self.assertNotIn("test-secret", diagnostic.read_text(encoding="utf-8")) self.assertIn("[REDACTED]", diagnostic.read_text(encoding="utf-8")) + def test_password_mismatch_fails_immediately_and_saves_redacted_log(self) -> None: + fake = FakeConsole(automatic_password=True, password_mismatch=True, echo_secret=True) + with tempfile.TemporaryDirectory() as temp: + diagnostic = Path(temp) / "serial.log" + with ( + patch.object(chr, "SERIAL_LOG_FILE", diagnostic), + patch.object(chr.socket, "AF_UNIX", 1, create=True), + patch.object(chr.socket, "socket", return_value=fake), + patch.object(chr.time, "sleep"), + self.assertRaisesRegex(chr.BootstrapError, "password confirmation"), + ): + chr.provision_console("test-secret", timeout=10) + self.assertEqual(fake.secret_count, 2) + saved = diagnostic.read_text(encoding="utf-8") + self.assertIn("New passwords do not match", saved) + self.assertNotIn("test-secret", saved) + def test_github_secret_mask_is_emitted_before_it_is_shared(self) -> None: with ( patch.dict(chr.os.environ, {"GITHUB_ACTIONS": "true"}), diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2bc857..3f1a660 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,3 +81,11 @@ jobs: npx playwright install --with-deps chromium npm run test:e2e npm run test:e2e:live + - name: Keep browser failure diagnostics + if: failure() + uses: actions/upload-artifact@v4 + with: + name: browser-failure-diagnostics + path: apps/web/test-results/ + if-no-files-found: ignore + retention-days: 3 diff --git a/apps/web/decision.md b/apps/web/decision.md index c56aa6b..9c63d62 100644 --- a/apps/web/decision.md +++ b/apps/web/decision.md @@ -6,6 +6,7 @@ - **Explicit fixture provenance.** Persistent `Demo: replayed data` badge appears in every route. Fixture dry-run and apply states say they are simulated; mock mode does not contact a router. The voice control displays an unavailable message because there is no real bundled audio or voice endpoint contract yet. - **Simulator topology source with a fixture boundary.** Subscriber counts, primary capacities and backup capacities in `lib/fixtures.ts` mirror the canonical `data/sites.yaml`: North Tower 120 / 180 Mbps / 80 Mbps backup, Market Cafe 48 / 100 Mbps / no backup, and East Relay 165 / 250 Mbps / 100 Mbps backup. The dashboard’s health, utilization, latency and loss remain illustrative replay samples, not live simulator readings. Keeping the split avoids contradicting topology while preserving the demo-only telemetry disclosure. - **Approval guard and confirmation.** Approval is enabled only for `awaiting_approval`, `dryRun === passed`, a non-`none` template and non-empty commands. Rejection remains possible for `open` or `awaiting_approval`. Radix confirmation dialogs, a busy flag and transport state guards prevent accidental or repeated decisions. Fixture approval visibly advances through applying, verifying and then resolved or rolled back; fixture rejection becomes rejected. +- **Deterministic approval timing in browser tests.** `e2e/dashboard.spec.ts` installs Playwright's page clock after the confirmation dialog appears, pauses it at a fixed future instant with `pauseAt`, then advances only through explicit `runFor` calls across the existing mock transport delays. This keeps tests asserting each real application transition without making the fixture faster or relying on scheduler timing. - **Local incident fixture store.** Injection creates a browser-memory incident for actionable scenarios and a no-router-change message for normal/notify-only scenarios. Market Cafe has no configured backup, so an uplink-down replay there is notify-only. Queue, DNS and failover rollback commands match their proposed changes. Simulated CHR results are labeled as fixture-only. A refresh resets this memory state. There is no persistence claim. - **SSE refresh strategy.** Named `metric`, `incident.opened`, `incident.updated`, `fix.tested`, and `fix.applied` events trigger a data refetch. `lastEventId` values are deduplicated within one EventSource connection; `onerror` and a subsequent `onopen` request refreshes as the stream recovers. Cleanup removes listeners and closes the source. Event envelope and ID replay semantics await Aun's confirmation. - **Pakistan time without hydration mismatch.** The overview renders a placeholder for the live clock and formats timestamps after mount with `Intl.DateTimeFormat` and `Asia/Karachi`. This avoids server/client locale mismatch. diff --git a/apps/web/e2e/dashboard.spec.ts b/apps/web/e2e/dashboard.spec.ts index 0635924..b4b436a 100644 --- a/apps/web/e2e/dashboard.spec.ts +++ b/apps/web/e2e/dashboard.spec.ts @@ -1,6 +1,12 @@ -import { expect, test } from "@playwright/test"; +import { expect, test, type Page } from "@playwright/test"; import path from "node:path"; +async function installPausedClock(page: Page) { + const start = new Date("2026-10-18T00:00:00.000Z"); + await page.clock.install({ time: start }); + await page.clock.pauseAt(new Date(start.getTime() + 1_000)); +} + test("overview and site layout render at desktop and phone widths", async ({ page, }, testInfo) => { @@ -43,12 +49,17 @@ test("approval needs confirmation and visibly simulates each stage", async ({ await page.getByRole("button", { name: "Go back" }).click(); await expect(page.getByRole("dialog")).toBeHidden(); await page.getByRole("button", { name: "Approve change" }).first().click(); + await expect(page.getByRole("dialog")).toBeVisible(); + await installPausedClock(page); await page .getByRole("dialog") .getByRole("button", { name: "Approve change" }) .dblclick(); + await page.clock.runFor(350); await expect(page.getByText("applying", { exact: true })).toBeVisible(); + await page.clock.runFor(500); await expect(page.getByText("verifying", { exact: true })).toBeVisible(); + await page.clock.runFor(600); await expect(page.getByText("resolved", { exact: true })).toBeVisible(); }); @@ -109,12 +120,17 @@ test("an approved backup failover can simulate rollback", async ({ page }) => { await page.getByRole("button", { name: "Replay scenario" }).click(); await page.getByRole("link", { name: "Open incident" }).click(); await page.getByRole("button", { name: "Approve change" }).first().click(); + await expect(page.getByRole("dialog")).toBeVisible(); + await installPausedClock(page); await page .getByRole("dialog") .getByRole("button", { name: "Approve change" }) .click(); + await page.clock.runFor(350); await expect(page.getByText("applying", { exact: true })).toBeVisible(); + await page.clock.runFor(500); await expect(page.getByText("verifying", { exact: true })).toBeVisible(); + await page.clock.runFor(600); await expect(page.getByText("rolled back", { exact: true })).toBeVisible(); }); diff --git a/decision.md b/decision.md index 27da661..08f8dd4 100644 --- a/decision.md +++ b/decision.md @@ -32,6 +32,14 @@ how the pieces connect and [the implementation plan](docs/WORKSTREAM_B_PLAN.md). | Separate CHR boot smoke from template validation | A real router can boot even while Aun's template harness is absent | CI reports those outcomes separately; no fabricated template pass | | Keep the unpatched braces advisory documented | npm proposes an incompatible Next lint downgrade and no patched braces release exists | Production audit is clean; five development audit entries share one advisory | +## Findings from actual GitHub CI + +The first Linux CI run passed. The parallel PR run exposed a browser assertion +against a short-lived fixture state, so tests now control the clock explicitly. +The first real CHR boot reached RouterOS login and exposed CRLF being treated as +two Enter keys during password confirmation. The serial helper now submits CR +and retains redacted diagnostics. Fake-console tests alone did not reveal this. + ## Current external gates At the final integration refresh, upstream main still contains only README.md. Aun must publish diff --git a/docs/progress/bootstrap.md b/docs/progress/bootstrap.md index d0b1ee6..695df1b 100644 --- a/docs/progress/bootstrap.md +++ b/docs/progress/bootstrap.md @@ -9,9 +9,9 @@ The root tooling and partner-owned bootstrap docs were laid down first. The work - Python CI installs all locked workspace packages, runs Ruff, and runs the package tests plus `.github/tests/test_chr_bootstrap.py`. - Web CI has a pending summary until `apps/web` exists. Once it exists, missing lockfile/scripts/Playwright configuration/dependency fails instead of silently skipping the required checks. - `.github/scripts/chr_bootstrap.py` pins official x86 CHR 7.24.5 and SHA-256 `16f07222a3213352c9c4fbea4f4dec6a8ffb78fdc0fa5e398c23103ed357c6eb` (official zip size 45,293,979 bytes). It uses QEMU with loopback-only management ports, handles the optional license-display prompt separately from actual terms acceptance, provisions a random admin password over serial, and requires two authenticated REST resource responses before reporting ready. -- Twelve offline lifecycle tests use fake console/process/network responses. They cover first-login display/acceptance prompts, bounded provisioning, GitHub secret masking, and password-redacted serial diagnostics. They do not boot a real router and are not counted as router/template coverage. +- Fifteen offline lifecycle tests use fake console/process/network responses. They cover first-login display/acceptance prompts, CR-only serial line endings, buffered prompts, immediate password-mismatch failure, GitHub secret masking, and redacted serial diagnostics on success and failure. They do not boot a real router and are not counted as router/template coverage. - The CHR template workflow owns QEMU setup and bootstrap; it uploads both QEMU and sanitized serial logs when available. When Aun's `infra/chr/test_templates.py` is absent, a separate CI smoke job boots CHR and checks authenticated REST readiness; the actual template job is skipped and the workflow summary says no template tests ran. -- The actual GitHub-hosted CHR smoke has not run from this branch yet. No real router boot or template pass is claimed here. +- A real CHR smoke reached login and license handling but failed password confirmation; the redacted transcript showed repeated new/repeat prompts and New passwords do not match after CRLF line submissions. The helper now sends a single CR terminator and rejects mismatch output promptly. The corrected real boot has not been rerun; no CHR readiness or template pass is claimed. - The [official RouterOS REST API documentation](https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI) states REST uses the RouterOS HTTP/HTTPS service and Basic Auth. ## Render diff --git a/docs/progress/head.md b/docs/progress/head.md index edea020..4b0e2e4 100644 --- a/docs/progress/head.md +++ b/docs/progress/head.md @@ -53,7 +53,10 @@ not authenticated/verified. RouterOS and Sentry skills installed/read/applied. ## Delivery follow-through -Push tested branch, create draft PR with actual checks/gates; observe CI and real -CHR smoke, repair failures. Add run/PR links to validation docs and final handoff. +Branch pushed; draft PR https://github.com/aunraza19/NetCortex/pull/1 is open. +First push CI passed; PR CI exposed a transient rollback assertion. Real CHR +boot reached login but password confirmation failed, with CRLF double-submit +visible in the preserved console. Workers are correcting deterministic browser +clocks and serial CR-only input before rerunning. Observe corrected CI/CHR. Add run/PR links to validation docs and final handoff. Copilot automatic review requires Aun admin/eligible plan; do not claim enabled. No merge or deployment is authorized/possible without shared code/account access. diff --git a/docs/progress/web_dashboard.md b/docs/progress/web_dashboard.md index 3d16ca7..4f9cd9c 100644 --- a/docs/progress/web_dashboard.md +++ b/docs/progress/web_dashboard.md @@ -24,3 +24,7 @@ Final topology correction: `apps/web/lib/fixtures.ts` subscriber counts and prim ## Dependency audit review `npm audit` reports five high entries but only one underlying advisory: GHSA-vfj7-8cjw-p6xm in `braces@3.0.3`, reached through the development-only lint chain `eslint-config-next@16.4.2` → `@next/eslint-plugin-next@16.4.2` → `fast-glob@3.3.1` → `micromatch@4.0.8` → `braces@3.0.3`. The advisory describes process-crashing stack exhaustion for deeply nested brace patterns and lists no patched release. `npm view braces versions` confirms 3.0.3 is the latest published release. `npm audit fix --dry-run` proposes downgrading `eslint-config-next` to 14.2.35, a breaking mismatch for Next.js 16, so no dependency override or blind downgrade was applied. `npm audit --omit=dev` reports zero vulnerabilities. Recheck when the advisory gains a patch or the compatible Next lint chain removes `braces`. References: [GitHub advisory](https://github.com/advisories/GHSA-vfj7-8cjw-p6xm), [upstream issue](https://github.com/micromatch/braces/issues/84). + +## Deterministic approval E2E timing + +The approve-to-resolved and approve-to-rollback browser tests install Playwright `page.clock` after opening the confirmation dialog, pause it at a fixed future time with `pauseAt`, and explicitly advance through the existing 250/400/500 ms mock transport waits with `runFor`. The clock stays paused between advances, keeping applying/verifying assertions deterministic under CI scheduling while leaving application workflow timing untouched. After this pause refinement, the focused approval/rollback cases passed on desktop and mobile (4/4). The full suites had passed immediately before this refinement: dashboard 14/14, live 3/3; lint, typecheck and format check passed. No app code changed. From 4ba49f335351bc6b94a95f22dd23ba116342bdca Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 18:35:26 +0500 Subject: [PATCH 11/21] docs: record successful CI and real CHR smoke evidence --- .github/decision.md | 6 +++++- decision.md | 5 ++++- docs/VALIDATION_RESULTS.md | 12 +++++++++--- docs/progress/bootstrap.md | 2 +- docs/progress/head.md | 22 +++++++++++++--------- 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/.github/decision.md b/.github/decision.md index 605d4cb..08c6671 100644 --- a/.github/decision.md +++ b/.github/decision.md @@ -16,10 +16,14 @@ Provisioning handles the first-login license flow by answering `n` to the option ## External router test gate -The bootstrap, router lifecycle, QEMU command, credential handling, license/password prompts, CLI error handling, and response-shape checks are B-owned and tested offline with fake console/process/network responses. `infra/chr/test_templates.py` is Aun-owned. When it is absent, a separate smoke job boots CHR and verifies authenticated REST readiness, while the real template job remains skipped with a pending summary. Unit tests and boot smoke do not count as template/router integration tests. +The bootstrap, router lifecycle, QEMU command, credential handling, license/password prompts, CLI error handling, and response-shape checks are B-owned and tested offline with fake console/process/network responses. `infra/chr/test_templates.py` is Aun-owned. When it is absent, a separate smoke job boots CHR and verifies authenticated REST readiness, while the real template job remains skipped with a pending summary. Unit tests and boot smoke do not count as template apply/read-back/rollback tests. The workflow retains `/tmp/netcortex-chr/qemu.log` as an artifact and cleanup validates both the recorded PID and its QEMU command line before signaling it. The disk and log remain in the runner temp directory until the job is discarded; no downloaded router image is committed. ## Copilot review Repository instructions can shape Copilot's review, but automatic review still requires repository/organization admin configuration and a qualifying Copilot plan. See [admin-setup.md](admin-setup.md). The repository does not claim Copilot review is enabled until an owner verifies the setting in GitHub. + +## Verified implementation run + +The corrected [CHR smoke](https://github.com/aunraza19/NetCortex/actions/runs/39131915789) passed on `d60ffac`, including authenticated REST readiness and cleanup. The template job was skipped because Aun's harness is absent. [Python/frontend CI](https://github.com/aunraza19/NetCortex/actions/runs/39131915864) also passed. diff --git a/decision.md b/decision.md index 08f8dd4..fc22c98 100644 --- a/decision.md +++ b/decision.md @@ -38,7 +38,10 @@ The first Linux CI run passed. The parallel PR run exposed a browser assertion against a short-lived fixture state, so tests now control the clock explicitly. The first real CHR boot reached RouterOS login and exposed CRLF being treated as two Enter keys during password confirmation. The serial helper now submits CR -and retains redacted diagnostics. Fake-console tests alone did not reveal this. +and retains redacted diagnostics. Fake-console tests alone did not reveal this. The corrected +[Python/frontend CI](https://github.com/aunraza19/NetCortex/actions/runs/39131915864) and +[real CHR smoke](https://github.com/aunraza19/NetCortex/actions/runs/39131915789) both passed +on implementation commit `d60ffac`. ## Current external gates diff --git a/docs/VALIDATION_RESULTS.md b/docs/VALIDATION_RESULTS.md index 04b3440..d9389bc 100644 --- a/docs/VALIDATION_RESULTS.md +++ b/docs/VALIDATION_RESULTS.md @@ -6,7 +6,7 @@ checks from the shared runtime and external services that are still pending. | Check | Actual result | | --- | --- | | Locked base Python workspace | Four packages installed successfully with Python 3.12; optional heavy model extras excluded | -| Python lint and tests | Ruff passed; 84 tests passed in 11.75 seconds; combined branch coverage 68% (live services excluded) | +| Python lint and tests | Ruff passed; 87 tests passed in 7.30 seconds; combined branch coverage 68% (live services excluded) | | Distribution build | All four source distributions and wheels built successfully | | CLI startup | Installed `simgen --help` and `netcortex-detector --help` passed | | Frontend | Prettier, ESLint, TypeScript and production Next.js build passed | @@ -15,8 +15,9 @@ checks from the shared runtime and external services that are still pending. | Dependency audit | Production dependencies: zero findings. Five high development entries share unpatched braces advisory GHSA-vfj7-8cjw-p6xm; see web decisions | | RIPE download | 11,819 real public ping records, three PK probes / three ASNs, October 11–17; three daily request gaps recorded | | Calibration | Actual per-target/hour and explicitly opted-in public DNS role-proxy statistics; no DNS lookup timing claim | -| CHR offline lifecycle | 12 fake-console/network/process tests passed; these do not count as a real boot | -| GitHub Actions | Results and links added after push | +| CHR offline lifecycle | 15 fake-console/network/process tests passed; these do not count as a real boot | +| GitHub Actions | [Python/frontend CI](https://github.com/aunraza19/NetCortex/actions/runs/39131915864) passed on implementation commit `d60ffac`; all 87 Python and 17 browser tests passed | +| Real isolated CHR | [Router smoke](https://github.com/aunraza19/NetCortex/actions/runs/39131915789) passed: pinned RouterOS boot, console provisioning, two authenticated REST resource checks and cleanup. Template job skipped pending Aun harness | The detector regressions cover past-only features, finite physical bounds, SDK quantile layout, all five horizons, capped fit contexts, stale/future and mixed @@ -26,6 +27,11 @@ Provider tests cover malformed responses, timeouts, unavailable audio/news and embedding identity/dimension checks. UI tests cover confirmation, failed router checks, duplicate submissions, missing incidents, site backup topology and rollback. +The first real runs exposed serial CRLF double submission and a transient browser +assertion. Both were corrected before the successful runs linked above. The +report update changes documentation only. [Draft PR #1](https://github.com/aunraza19/NetCortex/pull/1) +contains the implementation and the remaining shared-runtime gates. + ## Evaluation The reproducible run creates 80 training, 80 validation and 80 held-out cases, diff --git a/docs/progress/bootstrap.md b/docs/progress/bootstrap.md index 695df1b..b64d7b8 100644 --- a/docs/progress/bootstrap.md +++ b/docs/progress/bootstrap.md @@ -11,7 +11,7 @@ The root tooling and partner-owned bootstrap docs were laid down first. The work - `.github/scripts/chr_bootstrap.py` pins official x86 CHR 7.24.5 and SHA-256 `16f07222a3213352c9c4fbea4f4dec6a8ffb78fdc0fa5e398c23103ed357c6eb` (official zip size 45,293,979 bytes). It uses QEMU with loopback-only management ports, handles the optional license-display prompt separately from actual terms acceptance, provisions a random admin password over serial, and requires two authenticated REST resource responses before reporting ready. - Fifteen offline lifecycle tests use fake console/process/network responses. They cover first-login display/acceptance prompts, CR-only serial line endings, buffered prompts, immediate password-mismatch failure, GitHub secret masking, and redacted serial diagnostics on success and failure. They do not boot a real router and are not counted as router/template coverage. - The CHR template workflow owns QEMU setup and bootstrap; it uploads both QEMU and sanitized serial logs when available. When Aun's `infra/chr/test_templates.py` is absent, a separate CI smoke job boots CHR and checks authenticated REST readiness; the actual template job is skipped and the workflow summary says no template tests ran. -- A real CHR smoke reached login and license handling but failed password confirmation; the redacted transcript showed repeated new/repeat prompts and New passwords do not match after CRLF line submissions. The helper now sends a single CR terminator and rejects mismatch output promptly. The corrected real boot has not been rerun; no CHR readiness or template pass is claimed. +- A real CHR smoke reached login and license handling but failed password confirmation; the redacted transcript showed repeated new/repeat prompts and New passwords do not match after CRLF line submissions. The helper now sends a single CR terminator and rejects mismatch output promptly. The corrected real smoke subsequently passed on implementation commit d60ffac: https://github.com/aunraza19/NetCortex/actions/runs/39131915789. This establishes pinned boot, authenticated REST and cleanup; template apply/read-back/rollback remains untested. - The [official RouterOS REST API documentation](https://help.mikrotik.com/docs/spaces/ROS/pages/47579162/REST%2BAPI) states REST uses the RouterOS HTTP/HTTPS service and Basic Auth. ## Render diff --git a/docs/progress/head.md b/docs/progress/head.md index 4b0e2e4..20a9f29 100644 --- a/docs/progress/head.md +++ b/docs/progress/head.md @@ -18,7 +18,7 @@ Only free tiers/credits; no purchase. Do not ask again for Git identity/auth. ## Actual local checks - Locked base workspace sync passed; optional heavy model extras excluded. -- Root Ruff passed; combined Python/bootstrap suite: 84 passed in 11.75s, +- Root Ruff passed; combined Python/bootstrap suite: 87 passed in 7.30s, branch coverage 68%. Current NumPy/pandas emit deprecation warnings. - Four wheels/source distributions built; installed simgen/detector CLI help passed. - Frontend format/lint/typecheck/production build passed. @@ -34,7 +34,11 @@ Only free tiers/credits; no purchase. Do not ask again for Git identity/auth. recall 62/70; median ~.097s; zero false alerts over .20833 normal site-days. Single snapshots do not measure detection delay or continuous operation. - Cloud-unavailable report: 0/80 model cases scored; never counts absence as normal. -- CHR offline: 12 tests, no local Linux boot. Real smoke must be observed on Actions. +- CHR offline: 15 tests. Corrected real Linux CHR boot, authenticated REST and + cleanup passed: https://github.com/aunraza19/NetCortex/actions/runs/39131915789 +- Corrected Linux Python/frontend CI passed: https://github.com/aunraza19/NetCortex/actions/runs/39131915864 + Both push and PR runs passed on d60ffac; template apply/read-back/rollback + remains skipped because Aun harness is absent. ## GitHub and external gates @@ -51,12 +55,12 @@ harness. Public shared-type wrappers deliberately fail until those contracts exi DB/model/provider/Render/domain access is missing. Tiger/TabPFN MCP configured, not authenticated/verified. RouterOS and Sentry skills installed/read/applied. -## Delivery follow-through +## Delivery Branch pushed; draft PR https://github.com/aunraza19/NetCortex/pull/1 is open. -First push CI passed; PR CI exposed a transient rollback assertion. Real CHR -boot reached login but password confirmation failed, with CRLF double-submit -visible in the preserved console. Workers are correcting deterministic browser -clocks and serial CR-only input before rerunning. Observe corrected CI/CHR. Add run/PR links to validation docs and final handoff. -Copilot automatic review requires Aun admin/eligible plan; do not claim enabled. -No merge or deployment is authorized/possible without shared code/account access. +The first runs exposed a transient browser assertion and serial CRLF double +submission. Both fixes were verified by successful push and PR CI runs. +Documentation links those implementation-run results. Shared runtime/provider +and deployment gates remain explicit; the PR stays draft for Aun's contract review. +Copilot automatic review requires Aun admin/eligible plan; it is not enabled. +No merge, purchase or live deployment has been performed. From 9cb082df52e05a5b868b180bde5dcbe42fb99d08 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 22:30:48 +0500 Subject: [PATCH 12/21] feat: bind partner modules to merged core and remove speech generation --- .codex/config.toml | 18 + .github/workflows/ci.yml | 2 +- AGENTS.md | 7 +- apps/web/README.md | 2 +- apps/web/app/globals.css | 47 - apps/web/components/incident-detail.tsx | 37 +- apps/web/decision.md | 4 +- apps/web/flow.md | 16 +- apps/web/lib/transport.ts | 27 - decision.md | 19 +- docs/CONTRACT_REQUESTS.md | 92 +- docs/CORE_INTEGRATION_VALIDATION.md | 51 + docs/PARTNER_PLAN.md | 28 +- docs/SECURITY_VERIFICATION.md | 43 + docs/SETUP.md | 4 +- docs/START_HERE.md | 11 +- docs/VALIDATION_PLAN.md | 6 +- docs/VALIDATION_RESULTS.md | 34 +- docs/WORKSTREAM_B_PLAN.md | 14 +- docs/post/notes.md | 2 +- docs/post/partner-draft.md | 3 +- docs/progress/core_detector.md | 9 + docs/progress/core_news_ui.md | 7 + docs/progress/core_simgen.md | 7 + docs/progress/head.md | 121 +- docs/progress/retrieval_notify.md | 51 +- docs/progress/web_dashboard.md | 4 +- flow.md | 22 +- packages/detector/README.md | 2 +- packages/detector/decision.md | 5 +- packages/detector/flow.md | 4 +- packages/detector/pyproject.toml | 2 +- .../src/netcortex_detector/__init__.py | 10 +- .../detector/src/netcortex_detector/engine.py | 124 +- .../tests/test_detector_core_contract.py | 107 ++ packages/detector/tests/test_engine.py | 4 +- packages/notify/README.md | 10 +- packages/notify/decision.md | 12 +- packages/notify/flow.md | 32 +- packages/notify/pyproject.toml | 4 +- .../notify/src/netcortex_notify/__init__.py | 6 +- packages/notify/src/netcortex_notify/cli.py | 17 +- .../notify/src/netcortex_notify/service.py | 156 +- packages/notify/tests/test_notify.py | 74 +- .../notify/tests/test_notify_core_contract.py | 45 + packages/runbook/README.md | 10 +- packages/runbook/decision.md | 12 +- packages/runbook/flow.md | 31 +- packages/runbook/pyproject.toml | 2 +- packages/runbook/src/netcortex_runbook/cli.py | 12 +- .../runbook/src/netcortex_runbook/service.py | 88 +- .../tests/test_runbook_core_contract.py | 30 + packages/simgen/README.md | 8 +- packages/simgen/decision.md | 6 +- packages/simgen/flow.md | 25 +- packages/simgen/pyproject.toml | 2 +- packages/simgen/src/netcortex_simgen/cli.py | 50 +- .../simgen/src/netcortex_simgen/simulator.py | 298 +++- .../simgen/tests/test_simgen_core_contract.py | 46 + packages/simgen/tests/test_simulator.py | 207 ++- uv.lock | 1285 +++++++++++++++-- 61 files changed, 2535 insertions(+), 879 deletions(-) create mode 100644 .codex/config.toml create mode 100644 docs/CORE_INTEGRATION_VALIDATION.md create mode 100644 docs/SECURITY_VERIFICATION.md create mode 100644 docs/progress/core_detector.md create mode 100644 docs/progress/core_news_ui.md create mode 100644 docs/progress/core_simgen.md create mode 100644 packages/detector/tests/test_detector_core_contract.py create mode 100644 packages/notify/tests/test_notify_core_contract.py create mode 100644 packages/runbook/tests/test_runbook_core_contract.py create mode 100644 packages/simgen/tests/test_simgen_core_contract.py diff --git a/.codex/config.toml b/.codex/config.toml new file mode 100644 index 0000000..981f9fb --- /dev/null +++ b/.codex/config.toml @@ -0,0 +1,18 @@ +# Start a new sandboxed Codex session with this project profile to enforce reads. +# An already-running unrestricted session cannot acquire this boundary retroactively. +default_permissions = "netcortex" + +[permissions.netcortex.filesystem] +glob_scan_max_depth = 8 +":minimal" = "read" + +[permissions.netcortex.filesystem.":workspace_roots"] +"." = "write" +".env" = "deny" +"**/.env" = "deny" +"**/.env.*" = "deny" +"**/*credentials*.env" = "deny" +"secrets" = "deny" + +[permissions.netcortex.network] +enabled = true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f1a660..42ad250 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: run: uv run --locked ruff check . .github/scripts .github/tests - name: Pytest run: | - uv run --locked pytest packages .github/tests \ + uv run --locked pytest -m "not live" \ --cov --cov-report=term-missing web: diff --git a/AGENTS.md b/AGENTS.md index 543c5ae..c440d9b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,10 +4,15 @@ - Workstream B owns only the root tooling/bootstrap files, `docs/`, `infra/render/`, `.github/`, `packages/simgen/`, `packages/detector/`, `packages/runbook/`, `packages/notify/`, `apps/web/`, `data/`, and `eval/` as assigned in the build plan. - Aun owns `packages/core/`, `packages/agent/`, `packages/fixes/`, `services/api/`, `services/worker/`, `services/collector/`, shared schemas and Settings, Temporal workflows, and the router harness. Do not create, edit, or redefine those contracts. -- The future core import is `netcortex_core`, but its actual distribution/package name and interface are unresolved. Treat consuming it as blocked until Aun confirms the package name and contract. +- Core is merged: distribution `netcortex-core`, import `netcortex_core`. Import actual schemas, Settings and ModuleUnavailable directly. Main's core code is authoritative. - Workstream B distribution/import pairs are `netcortex-simgen` / `netcortex_simgen`, `netcortex-detector` / `netcortex_detector`, `netcortex-runbook` / `netcortex_runbook`, and `netcortex-notify` / `netcortex_notify`. - Never copy shared types into a Workstream B package. Import them from the approved core package after it exists. - Root files, `uv.lock`, integration wiring, and shared deployment decisions are owned by the workstream lead. Do not regenerate or edit `uv.lock` from a worker branch. +- Keep main's pyproject.toml, .gitignore, LICENSE and .gitattributes. Never re-add .entire/ to .gitignore; regenerate uv.lock with uv, never merge it manually. +- Never open .env or credential files, dump environment variables, or expose provider errors containing secrets. Tests use Settings(_env_file=None). Obtain runtime credentials through the process environment and unwrap SecretStr at the point of use. +- Database migration 001 is already applied on Tiger Cloud. Do not run any migrations. detect() never writes forecasts; the worker owns forecast writes. +- Voice is removed. Keep English/Urdu customer messages as text; remove speak, audio routes/players and voice configuration from B-owned code/docs. +- EMBED_MODEL is exactly embeddinggemma. Do not require a version suffix. ## Implementation expectations diff --git a/apps/web/README.md b/apps/web/README.md index c5b4bbd..946a368 100644 --- a/apps/web/README.md +++ b/apps/web/README.md @@ -11,7 +11,7 @@ $env:NEXT_PUBLIC_API_MODE = 'mock' npm run dev ``` -Use `NEXT_PUBLIC_API_MODE=live` and `NEXT_PUBLIC_API_BASE_URL` to connect to Aun's API. Live mode calls the draft routes in `decision.md`; request timeouts and errors appear in the UI and never switch to fixtures. Those API payload types remain provisional until Aun publishes OpenAPI and shared contracts. The fixture values and CHR outcomes are invented demo records; the UI labels them “Demo: replayed data.” Mock approval simulates workflow states in browser memory only. No router is contacted. Voice playback displays an unavailable state because fixture audio is not real audio. +Use `NEXT_PUBLIC_API_MODE=live` and `NEXT_PUBLIC_API_BASE_URL` to connect to Aun's API. Live mode calls the draft routes in `decision.md`; request timeouts and errors appear in the UI and never switch to fixtures. Those API payload types remain provisional until Aun publishes OpenAPI and shared contracts. The fixture values and CHR outcomes are invented demo records; the UI labels them “Demo: replayed data.” Mock approval simulates workflow states in browser memory only. No router is contacted. Customer messages remain English or Urdu text. `NEXT_PUBLIC_SENTRY_DSN` enables browser monitoring; server monitoring reads `SENTRY_DSN`. No DSN is committed. Sentry setup is code-ready but not connected or verified without the project DSN. diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index 0769293..3eb7216 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -1181,53 +1181,6 @@ select:focus-visible { border: 1px solid #293841; border-radius: 5px; } -.voice-panel { - padding: 12px; - display: flex; - align-items: center; - gap: 9px; - flex-wrap: wrap; -} -.voice-icon { - width: 28px; - height: 28px; - display: grid; - place-items: center; - color: #8cb8d7; - background: #1b2934; - border-radius: 6px; -} -.voice-copy { - flex: 1; -} -.voice-copy strong, -.voice-copy small { - display: block; -} -.voice-copy strong { - font-size: 10px; -} -.voice-copy small { - font-size: 9px; - color: #788993; - margin-top: 3px; -} -.play-button { - width: 27px; - height: 27px; - border: 1px solid #34434c; - border-radius: 50%; - display: grid; - place-items: center; - color: #a3b7bf; - background: #111a20; -} -.voice-error { - width: 100%; - font-size: 9px; - color: #e2a3a0; - margin: 0 0 0 37px; -} .dialog-overlay { position: fixed; inset: 0; diff --git a/apps/web/components/incident-detail.tsx b/apps/web/components/incident-detail.tsx index d5b7a64..99b2f07 100644 --- a/apps/web/components/incident-detail.tsx +++ b/apps/web/components/incident-detail.tsx @@ -7,10 +7,8 @@ import { ChevronRight, ExternalLink, Info, - Play, RotateCcw, ShieldCheck, - Volume2, } from "lucide-react"; import { transport } from "@/lib/transport"; import type { Incident } from "@/lib/types"; @@ -34,9 +32,7 @@ export function IncidentDetail({ id }: { id: string }) { const [item, setItem] = useState(null), [err, setErr] = useState(""), [dialog, setDialog] = useState<"approve" | "reject" | null>(null), - [busy, setBusy] = useState(false), - [voiceErr, setVoiceErr] = useState(""), - [voiceUrl, setVoiceUrl] = useState(""); + [busy, setBusy] = useState(false); const busyRef = useRef(false); const load = useCallback( () => @@ -303,37 +299,6 @@ export function IncidentDetail({ id }: { id: string }) { )} -
-
- -
-
- Voice alert - Short incident summary -
- - {voiceErr &&

{voiceErr}

} - {voiceUrl && ( -
&to=`, GET `/incidents?status=…`, GET `/incidents/{id}`, GET `/incidents/{id}/voice` (audio blob), POST `/demo/scenarios`, POST `/incidents/{id}/approve`, POST `/incidents/{id}/reject`, and EventSource GET `/stream`. Decision POST bodies are treated only as acknowledgements: the app immediately GETs `/incidents/{id}` and renders that authoritative record. Scenario injection POST is also treated as an acknowledgement; the app says diagnosis is queued and links to the incident list rather than treating the response as an incident. Each fetch has a seven-second abort timeout; OpenAPI download is separately bounded to ten seconds. A failed live request raises an error; there is no fixture fallback. These payload mappings are provisional until OpenAPI is available. The metrics key currently uses the documented `probe::rtt_ms` pattern and remains provisional until the published schema confirms it. Run `OPENAPI_URL= npm run api:types` to generate a separate type file once Aun publishes the schema. No generated types are currently present. +`lib/transport.ts` implements the `Transport` interface. Live mode uses GET `/sites`, GET `/metrics?site_id=…&series=probe%3A1.1.1.1%3Artt_ms&from=&to=`, GET `/incidents?status=…`, GET `/incidents/{id}`, POST `/demo/scenarios`, POST `/incidents/{id}/approve`, POST `/incidents/{id}/reject`, and EventSource GET `/stream`. Decision POST bodies are treated only as acknowledgements: the app immediately GETs `/incidents/{id}` and renders that authoritative record. Scenario injection POST is also treated as an acknowledgement; the app says diagnosis is queued and links to the incident list rather than treating the response as an incident. Each fetch has a seven-second abort timeout; OpenAPI download is separately bounded to ten seconds. A failed live request raises an error; there is no fixture fallback. These payload mappings are provisional until OpenAPI is available. The metrics key currently uses the documented `probe::rtt_ms` pattern and remains provisional until the published schema confirms it. Run `OPENAPI_URL= npm run api:types` to generate a separate type file once Aun publishes the schema. No generated types are currently present. The stream subscribes to `metric`, `incident.opened`, `incident.updated`, `fix.tested`, and `fix.applied`. Any event causes a route refresh. Repeated event IDs are ignored in the current connection. EventSource reconnects itself; both `onerror` and a later `onopen` trigger a refresh so recovery is reflected. Component cleanup removes listeners and closes the connection. Server event IDs, replay and heartbeat behavior remain an integration question. diff --git a/apps/web/lib/transport.ts b/apps/web/lib/transport.ts index 4ef91e9..bb09b47 100644 --- a/apps/web/lib/transport.ts +++ b/apps/web/lib/transport.ts @@ -15,7 +15,6 @@ export interface Transport { incidents(status?: string, siteId?: string): Promise; incident(id: string): Promise; metrics(siteId: string): Promise>; - voice(id: string): Promise; inject( siteId: string, scenario: Scenario, @@ -258,32 +257,6 @@ export const transport: Transport = { ? request(`/metrics?${query}`) : (await pause(), makeSeries()); }, - async voice(id) { - if (mode === "mock") - throw new Error( - "Voice alert unavailable in replay fixtures. No audio has been generated.", - ); - const controller = new AbortController(); - const timer = setTimeout(() => controller.abort(), 7000); - try { - const response = await fetch( - `${base}/incidents/${encodeURIComponent(id)}/voice`, - { signal: controller.signal }, - ); - if (!response.ok) - throw new Error( - response.status === 404 - ? "No voice alert is available for this incident." - : `Voice alert request failed (${response.status}).`, - ); - return URL.createObjectURL(await response.blob()); - } catch (error) { - if (error instanceof Error) throw error; - throw new Error("Voice alert could not be reached."); - } finally { - clearTimeout(timer); - } - }, async inject(siteId, scenario, duration) { if (mode === "live") { await requestAck("/demo/scenarios", { diff --git a/decision.md b/decision.md index fc22c98..900d47d 100644 --- a/decision.md +++ b/decision.md @@ -10,8 +10,8 @@ how the pieces connect and [the implementation plan](docs/WORKSTREAM_B_PLAN.md). | Start on `b/workstream-b`; isolate parallel workers in `b/data-simgen`, `b/runbook-notify`, `b/web-dashboard` worktrees | Keep main untouched and concurrent writes separate | Lead integrates owned paths and validates before pushing | | Coding workers use `gpt-6-luna`, medium reasoning | User requested this model and lead/worker division | Lead specifies, reviews, tests and handles integration | | Aun owns core, Settings, migrations, API, workflows, agent and router infrastructure | The shared build brief explicitly reserves those contracts | We write requests and use lazy imports; no replacement schemas | -| Build independent engines with plain data and explicit fixture modes | Core and external credentials are absent | Fixture success does not establish live integration | -| Gate heavy-user and DNS claims on new telemetry contracts | Aggregate interface stats cannot identify a subscriber, and ping is not DNS resolution timing | Never fabricate offending IPs or claim DNS diagnosis from ping alone | +| Build independent engines with plain data and explicit fixture modes | Core was initially absent; its merged contracts now bind public wrappers | Fixture success does not establish live integration | +| Use core DNS/subscriber contracts for the corresponding observations | Core now carries subscriber IP/traffic and DNS-kind probes; ICMP remains separate | Never fabricate offending IPs or claim DNS diagnosis from ping alone | | Separate training, validation and final evaluation | Tuning thresholds on final tests inflates measured quality | Freeze thresholds before held-out scoring and report actual denominators | | Failure is unavailable, never an implicit normal result | A failed diagnostic must not tell the operator a broken network is healthy | Provider errors stay visible; live transport never silently falls back to fixtures | | Use TabPFN Python adapters in the application; MCP only for experiments | The detector needs a stable callable and explicit configuration | Connecting an MCP does not replace the runtime integration | @@ -49,3 +49,18 @@ At the final integration refresh, upstream main still contains only README.md. A core/backend contracts. Database, tailnet, API keys, Sentry projects, Render and domain access are not yet supplied. Their live checks remain pending until verified; none are replaced with invented pass results. + +## Core integration and scope update + +Rebased after PR #5 onto main fc297c1. Main's four root files remain byte-identical; +uv lock regenerated the lockfile. The lead wrote contract/validation cases before +three Luna medium agents changed owned paths. Public adapters import real core +models, preserve SecretStr and ModuleUnavailable, and never write forecasts from +detect. DNS/subscriber observations and atomic simulator injection now use core. +The embedding model setting is embeddinggemma. Customer messages stay text. + +Current follow-up is Gate 2 only, in a small separate PR: prepare legitimate TRAIN +and VALIDATION contexts, inject sim rows, and call actual TabPFN through detect. +A missing trained backend is an explicit unavailable result, not mock inference. +See [security verification](docs/SECURITY_VERIFICATION.md) for the redacted public +history/checkpoint audit and the current sandbox enforcement limitation. diff --git a/docs/CONTRACT_REQUESTS.md b/docs/CONTRACT_REQUESTS.md index ecb50a4..9ef0a08 100644 --- a/docs/CONTRACT_REQUESTS.md +++ b/docs/CONTRACT_REQUESTS.md @@ -1,49 +1,43 @@ -# Contract questions for Aun - -These are proposals and integration questions only. They do not change shared contracts. Aun must approve the answers and publish the source-of-truth definitions before Workstream B binds to them. - -## Core package and shared types - -- Confirm the distribution name and import name for `packages/core`; `netcortex_core` is the expected import namespace, but the distribution name is unresolved. -- Publish supported Python version, package exports, schema versions, and compatibility policy. -- Confirm exact types and field names for probe/interface metrics, forecasts, incidents, detection results, incident reports, fix plans, and template parameters. -- Clarify timestamp timezone/format, units, nullability, source labels, and identifier formats. - -## Settings and API - -- Confirm Settings field names, defaults, environment variable names, validation behavior, and secret handling. -- Confirm API base path, auth mechanism, owner/user role mapping, and how demo mode is represented. -- Provide request/response examples and explicit status/error payloads for incident list/detail, approval/rejection, history, and health endpoints. -- Define explicit failure semantics for upstream timeouts, unavailable model/provider, stale data, authorization failure, and partial results. Errors must remain distinguishable from a successful empty response. - -## SSE and subscriber telemetry - -- Confirm SSE endpoint, event envelope, event IDs/replay behavior, heartbeat cadence, reconnect expectations, and event names/payloads (`incident.opened`, `fix.tested`, and others). -- Specify whether subscriber identifiers/IPs are exposed, redacted, or role-gated in API events and the UI; identify retention and access policy. -- Clarify how a subscriber can be identified for heavy-user analysis without exposing unnecessary personal data. -- Extend MetricsWindow/storage with observed per-subscriber traffic and IP identity; - aggregate interface counters cannot identify an offending user. Supplemental - simulator fixtures are experimental until this contract is approved. -- Add explicit DNS resolution duration/outcome observations; ICMP RTT to a DNS - server is not a DNS lookup measurement. -- Publish target roles and interface/backhaul mapping, uplink capacities and - configured backup gateways so causes and fix parameters derive from observations. -- Define Settings read/update API endpoints before enabling editable UI Settings. - -## Timing and role mapping - -- Confirm collection intervals, detector lookback/history window, forecast horizon, and freshness thresholds for probe and interface telemetry. -- Confirm role mapping for owner, operator, and read-only/demo viewers, including permissions for approve/reject and subscriber-level evidence. -- Confirm workflow timing and expiry behavior for approvals and for post-change observation/rollback. - -## Forecast persistence and injection lifecycle - -- Define a unique key and conflict/upsert policy for forecasts, including site, metric/target, model/version, and forecast timestamp dimensions as appropriate. -- Identify the sole forecast writer and the expected transactional behavior when a detection run retries. -- Define simulator injection start/end semantics, source labeling, scenario-label linkage, cleanup/expiry behavior, and whether injections can overlap. -- Clarify how generated/replayed rows differ from injected rows and which records are safe to retain in a hosted demo. - -## Router test integration - -- Confirm location and invocation contract for Aun's CHR harness, expected CHR image/license setup, and machine-readable result format. -- Workstream B CI will call `infra/chr/test_templates.py` only when Aun provides it. Until then, the router template CI gate is pending; no substitute test will be reported as a router test. +# Shared contract answers and remaining runtime checks + +Aun answered the original questions in [merged core PR #2](https://github.com/aunraza19/NetCortex/pull/2). +The code in packages/core is authoritative. [PR #5](https://github.com/aunraza19/NetCortex/pull/5) +removed speech generation and its database storage. This file supersedes the original unanswered checklist. + +- Python 3.12; netcortex-core / netcortex_core. Import shared schemas and Settings directly. +- Secrets are SecretStr: unwrap at their network/DB boundary; never log raw values. +- MetricsWindow includes probe, interface and subscriber DataFrames with UTC as_of. +- DNS observations: kind=dns, target=dns:, rtt_ms is lookup response time. +- SubscriberMetric carries IP and traffic; hosted demos use synthetic addresses only. +- Site combines primary, backup and backhaul uplinks; ProbeTarget carries role/kind/host. +- detect returns DetectionResult (score, cause_guess, series, cloud/local/mock mode). +- Only the worker persists forecasts, uniquely keyed by site/series/model/time. +- inject writes source=sim rows from now for duration plus one ScenarioLabel; reject + overlapping active injection for a site. Keep these writes atomic. +- get_pool, insert metric helpers, upsert_site and fetch_site are shared DB helpers. +- search_runbook score is one minus cosine distance. EMBED_MODEL=embeddinggemma. +- check_news returns NewsCheck(available=False, ...) when unavailable. +- Text customer messages remain English and Urdu. +- Migration 001 is already applied on Tiger Cloud: do not rerun it or run migrations + as part of partner setup, tests, injection or detection. + +## API and workflow agreements + +Root paths follow the plan; actual generated client types wait for OpenAPI from A9. +Errors use detail with 404/409/503; an empty successful collection stays 200 []. +The hackathon build has one owner role, no authentication. Settings stays read-only. +SSE events use numeric IDs, named events and JSON payloads, replay Last-Event-ID, +and a 15-second comment heartbeat. Metric events are transient. + +Approval waits up to two hours. The workflow verifies five minutes after applying +and rolls back on failed improvement. Public demo approvals replay saved timelines. +The template harness contract is infra/chr/test_templates.py with --json PATH; +CI keeps the readiness gate until that file exists. + +## Scope now + +Finish core binding and removal, push the existing PR and mark ready after checks. +Then work only on Gate 2: real simgen injection to actual TabPFN detect returning +DetectionResult. Agent, fixes and runtime services remain Aun-owned. Provider-free +checks cannot establish Gate 2. No new shared contract is needed to prepare a +legitimate detector training artifact from TRAIN and VALIDATION data. diff --git a/docs/CORE_INTEGRATION_VALIDATION.md b/docs/CORE_INTEGRATION_VALIDATION.md new file mode 100644 index 0000000..446a27c --- /dev/null +++ b/docs/CORE_INTEGRATION_VALIDATION.md @@ -0,0 +1,51 @@ +# Core integration: lead-written acceptance cases + +Written before implementation delegation on 2026-10-18. Source of truth is +`origin/main` at `fc297c1`, including merged core and voice removal (PRs #2/#5). +Python stays 3.12. Database migration 001 is already applied: never rerun it. + +| ID | Case | Required result | +| --- | --- | --- | +| R1 | Rebase existing B branch after voice merge | Main is ancestor; four root files byte-identical to main; uv.lock generated by uv lock | +| R2 | Base workspace installation | All packages import actual core; no replacement shared models, no runtime lazy core discovery | +| D1 | Map deterministic engine output through public detect | Actual DetectionResult; score/cause/series mapping; canonical series keys, ordered future points | +| D2 | Empty/stale/provider failure | ModuleUnavailable subclass; never a fabricated healthy result or automatic mock fallback | +| D3 | Detector runs with history/window | Past observations only; site/source boundaries; forecast writer is never called | +| D4 | Explicit fixture backend | mode=mock and fixture model identity; actual provider mode stays cloud/local | +| D5 | SecretStr TabPFN token | Unwrapped only at provider boundary; no key or credential-bearing exception in output | +| S1 | dns_slow generation | Actual ProbeMetric rows, kind=dns, target=dns:1.1.1.1; lookup response time separate from ICMP | +| S2 | heavy_user generation | Actual SubscriberMetric rows with observed synthetic IP and traffic, healthy-period samples too; source=sim | +| S3 | YAML Site conversion | Site/Uplink/ProbeTarget instances; all primary/backup/backhaul capacities retained; no invented backup for cafe | +| S4 | inject lifecycle | Atomic site/metric/subscriber/label writes from now for requested duration; ScenarioLabel return; overlap rejected with site lock | +| S5 | Injection transaction fails | Rollback; no partial label/metric writes; no migration/DDL or live-site topology overwrite | +| N1 | check_news public entry | Actual NewsCheck; available=False preserved; SecretStr unwrapped; relative dates converted to datetimes | +| K1 | Shared embedding name | EMBED_MODEL=embeddinggemma accepted; correct 768 dimensions; no unrelated model substitution | +| K2 | Runbook DB boundary | SecretStr unwrapped; real RunbookChunk objects; score=1-cosine-distance; failures subclass ModuleUnavailable | +| V1 | Voice removal | No speak exports/CLI/tests/config/player/network requests; English and Urdu customer text remains | +| SEC1 | Agent file boundary | Never open .env. Commit sandbox deny-read profile; explicitly record that current unrestricted host requires a new session to enforce it | +| SEC2 | Public history/checkpoints | Redacted secret scan of commits and Entire refs; GitGuardian PR check; rotate confirmed exposed keys through provider access | + +## Order and ownership + +Lead authors these cases and contract acceptance tests first. Luna medium workers +implement detector, simulator, and retrieval/news/UI removal in separate owned +paths. Workers maintain decision.md/flow.md and must not edit the lead tests, +root files, uv.lock, core/agent/fixes, migrations, or runtime services. + +Run offline contract tests plus existing packages, agent, collector and fixes +regressions; frontend checks and browser flows include no audio. Push the rebased +branch with an explicit force-with-lease, wait for CI/GitGuardian, then mark the +existing PR ready. A passing mock result cannot satisfy real Gate 2. + +## Gate 2 only, after integration delivery + +Use a small separate B branch/PR for any further corrections. Obtain existing +DATABASE_URL and TabPFN credentials from local process/Windows environment only; +never print them or read .env. Check schema existence without migrating. Use a +dedicated simulated site; preserve home-lab live telemetry. Inject a scenario, +load an as-of MetricsWindow plus strictly prior history, call public detect with +actual TabPFN, and validate DetectionResult, real provider identity, finite score, +forecast timestamps/quantiles and zero detector DB writes. Save a sanitized result +and timing. If a credential/provider is unavailable, record that exact gate; +never mark it passed. Keep deployment, local embedding installation, broad agent +evaluation and other work outside this Gate 2 follow-up. diff --git a/docs/PARTNER_PLAN.md b/docs/PARTNER_PLAN.md index f4c9608..b7351e1 100644 --- a/docs/PARTNER_PLAN.md +++ b/docs/PARTNER_PLAN.md @@ -1,3 +1,6 @@ +> Updated scope: core/agent and removal PRs are merged. The shared code and +> [contract answers](CONTRACT_REQUESTS.md) supersede the original draft below. + # NetCortex — Partner Build Plan Oct 18, 2026 · @Aun Raza @@ -35,7 +38,6 @@ We are entering the DEV **Hacktoberfest Open-Source AI Challenge, Week 2: "Side | Temporal | $100 | Durable monitoring and incident workflows | Aun | | Sentry | $100 | Traces every agent and model step | Aun (backend), Partner (UI) | | Tiger Data | $100 | Metrics storage (TimescaleDB) and docs search (pgvector) | Shared database, Aun sets it up | -| ElevenLabs | $100 | Voice alert for the owner, Urdu or English | Partner | | SerpApi | $100 | "Is it us or them?" outage check | Partner | | .tech domain | $100 | The demo's public address | Partner | | GitHub | $100 | CI that tests every fix on a virtual router, Copilot PR review | Partner | @@ -56,7 +58,7 @@ NetCortex watches a small network, warns before customers start complaining, exp 3. Investigates: is the uplink full, is one user hogging it, is the upstream ISP having a bad day, or is one game server's route broken? 4. Proposes one fix from a set of tested MikroTik RouterOS templates, with the exact commands and the commands to undo them. 5. Tests that fix on a virtual MikroTik router before any human sees it. -6. Alerts the owner (dashboard, plus a short voice note in Urdu or English) and waits for Approve or Reject. +6. Alerts the owner (dashboard and English/Urdu customer text) and waits for Approve or Reject. 7. After an approved fix, watches the metrics and rolls back automatically if things did not improve. **Why open models matter here** (this is a required part of the post): @@ -66,7 +68,6 @@ NetCortex watches a small network, warns before customers start complaining, exp - **Cost:** no per-token bills, so a small ISP can afford it. - **Control:** we can swap models, fine-tune for RouterOS, and constrain the agent's output. -**Honest limits to state in the post:** TabPFN-3.5's cloud API sends anonymised metrics out, and its free license is non-commercial (a paid product would need a commercial license). Cloud add-ons (ElevenLabs, SerpApi, TabPFN cloud) are optional switches. The hosted demo uses replayed and simulated data. **Vendor scope:** MikroTik RouterOS only. It is common among small ISPs and has a free virtual router image (CHR) we can test on. Cisco is out of scope. @@ -85,7 +86,6 @@ The highlighted boxes are the partner's. Every partner box is a plain function o 3. **Open.** If `is_anomaly` is true and no incident is open for that site and cause, an `incidents` row is created and `IncidentWorkflow` starts. 4. **Investigate.** Aun's agent runs `investigate()`. It reads the detection result and calls tools: metrics lookup, the partner's `search_runbook()` and `check_news()`, and the template list. It returns an `IncidentReport`. 5. **Check the fix.** The fix checker validates the template values, fills the template, applies it on the virtual MikroTik router, reads back the config, then rolls it back. The result goes in `fix_plans`. -6. **Alert.** The partner's `speak()` makes a short voice note. The API pushes `incident.opened` and `fix.tested` events to the UI. 7. **Decide.** The owner opens the incident in the UI and presses Approve or Reject. The API sends a Temporal signal. The workflow waits up to 2 hours. 8. **Apply and verify.** If approved, the fix is applied (to the virtual router in the demo). The workflow watches the key metric for 5 minutes. Improved → `resolved`. Not improved → automatic rollback → `rolled_back`. 9. **Trace and score.** Sentry traces every step. The partner's eval runner replays the same path offline to measure accuracy. @@ -103,7 +103,6 @@ Two people on two networks. Tailscale joins the machines into one private networ | --- | --- | --- | --- | | Aun | Mac mini M4 | 16 GB RAM, 256 GB disk | Ollama: Gemma 4 E4B (agent) and EmbeddingGemma (embeddings), shared over Tailscale | | Aun | Laptop | Intel i7 10th gen, 32 GB RAM, NVIDIA Quadro P520 4 GB | Docker: Temporal dev server, MikroTik CHR virtual router (QEMU), FastAPI, Temporal workers, live collector. This is the integration host. | -| Partner | PC | NVIDIA GTX 1660 6 GB, 16 GB RAM | Simulator, detector, docs indexer, voice and news modules, web UI, CI and deploy work. Local TabPFN and local EmbeddingGemma. | **Shared services:** @@ -152,7 +151,6 @@ Aun builds everything that needs his hardware, the router or the runtime glue. T | B2 Datasets + simulator | Real data ingest (RIPE Atlas, live collector export), simulator, scenarios, labels, network layout, eval set | `packages/simgen`, `data/`, `eval/` | | B3 Detector | TabPFN forecasting, anomaly score, cause classifier → `detect()` | `packages/detector` | | B4 Docs search | MikroTik docs → chunks → EmbeddingGemma → pgvector → `search_runbook()` | `packages/runbook` | -| B5 Side modules | `speak()` with ElevenLabs, `check_news()` with SerpApi | `packages/notify` | | B6 Web UI | Next.js dashboard, mobile-first, mock mode first | `apps/web` | | B7 Hosted demo | Render + .tech domain, demo mode with replay | `infra/render` | | B8 CI | GitHub Actions: lint, tests, CHR template tests; Copilot PR review | `.github/workflows` | @@ -176,7 +174,6 @@ Python for everything except the UI, which is TypeScript. One repo, one `uv` wor | Workflows | Temporal Python SDK + Pydantic AI `TemporalAgent` (Aun) | | API | FastAPI + SSE (Aun) | | Web | Next.js (App Router), TypeScript, Tailwind CSS, shadcn/ui, Recharts, `@sentry/nextjs` | -| Side services | ElevenLabs (TTS), SerpApi (Google search) | | Hosting | Render (web + API demo), .tech domain | | CI | GitHub Actions, QEMU for CHR | @@ -193,7 +190,6 @@ netcortex/ packages/fixes/ fix checker (Aun) packages/detector/ TabPFN detection (Partner) packages/runbook/ docs ingest + search (Partner) - packages/notify/ ElevenLabs + SerpApi (Partner) packages/simgen/ simulator + data tools (Partner) templates/routeros/ fix templates (YAML) (Aun) data/ small fixtures, sites.yaml, scenario catalog (Partner) @@ -274,7 +270,6 @@ def search_runbook(query: str, k: int = 5) -> list[RunbookChunk]: ... # RunbookChunk: title, section, text, source_url, score # packages/notify -def speak(text: str, lang: Literal["en", "ur"]) -> bytes: ... # MP3 bytes def check_news(provider: str | None, target: str | None) -> NewsCheck: ... # NewsCheck: outage_reported: bool, summary: str, items: list[NewsItem(title, url, published)] @@ -309,7 +304,6 @@ customer_message_ur: str | GET | `/metrics?site_id&from&to&series` | Time series for charts, including forecast bands | | GET | `/incidents?status` | Incident list, newest first | | GET | `/incidents/{id}` | Incident, detection, report, fix plan, dry-run log, timeline | -| GET | `/incidents/{id}/voice` | MP3 voice alert | | POST | `/incidents/{id}/approve` | Sends the Temporal approve signal | | POST | `/incidents/{id}/reject` | Sends the Temporal reject signal | | POST | `/demo/scenarios` | Body `{site_id, scenario_type, duration_min}` → injects a scenario | @@ -326,8 +320,6 @@ AGENT_MODEL= EMBED_MODEL= TABPFN_MODE=cloud # cloud | local TABPFN_API_KEY= # name per tabpfn-client docs -ELEVENLABS_API_KEY= -ELEVENLABS_VOICE_ID= SERPAPI_API_KEY= SENTRY_DSN_BACKEND= NEXT_PUBLIC_SENTRY_DSN= @@ -347,7 +339,6 @@ Do them in this order. Each task lists what it needs, what to build and when it - [ ] Install Tailscale and join Aun's tailnet. Check `curl http://:11434/api/tags` works. - [ ] Install Entire and run `entire enable --agent codex` in the repo **before the first commit**. - [ ] Install `uv`, Node LTS, Docker. Clone the repo. -- [ ] Get API keys: Prior Labs (accept the free non-commercial license at platform.priorlabs.ai), ElevenLabs, SerpApi. Claim the .tech domain and Render credits at hacktoberfest.com/my/promos. - [ ] Install Ollama locally and pull EmbeddingGemma (same tag as Aun). Optional: install local `tabpfn` with CUDA and run its quick-start on the GTX 1660. - [ ] Create `AGENTS.md` for Codex: point it to `docs/PARTNER_PLAN.md`, the folder ownership in section 7, and the rules in section 12. @@ -381,7 +372,7 @@ Three jobs inside one `detect()`: - Keep training context small (a few thousand rows). Cache fitted context per site. - `TABPFN_MODE=cloud` uses `tabpfn-client` (TabPFN-3.5). `TABPFN_MODE=local` uses the local package on the GTX 1660. Same interface either way. -- Write each forecast to the `forecasts` table so the UI can draw bands. +- Return forecast series to the worker; the worker alone writes the `forecasts` table. - Fill `evidence` with short plain sentences ("uplink ether1 at 97% for 6 min"). - Report precision, recall and detection delay on the eval set in `eval/results/detector.md`. @@ -398,11 +389,10 @@ Three jobs inside one `detect()`: ### B5. Side modules -- [ ] `speak(text, lang)`: ElevenLabs text-to-speech, a multilingual model that supports Urdu. Return MP3 bytes. Keep text under \~40 words. - [ ] `check_news(provider, target)`: SerpApi search for recent outage reports about the upstream provider or a game server, past 24 hours. Return a short summary and links. -- [ ] Both have a mock mode and a timeout. Failing services must never block an incident. +- [ ] The news lookup has a mock mode and a timeout. Failing services must never block an incident. -**Done when:** both work from a script, and both return safely when keys are missing. +**Done when:** the lookup works from a script and returns safely when keys are missing. ### B6. Web UI @@ -411,10 +401,9 @@ Build in mock mode first (`NEXT_PUBLIC_API_MODE=mock`, fixtures that follow the | Page | What it shows | Actions | | --- | --- | --- | | Overview | One card per site: health, uplink usage, worst latency now; a live chart of latency with the forecast band | Open a site or incident | -| Incident detail | Timeline; evidence charts; agent summary, cause and confidence; upstream news result; fix commands and rollback commands; CHR test result; voice alert player | Approve, Reject (with confirm) | +| Incident detail | Timeline; evidence charts; agent summary, cause and confidence; upstream news result; fix commands and rollback commands; CHR test result; English/Urdu customer messages | Approve, Reject (with confirm) | | Incidents | List, newest first, filter by status and site | Open | | Demo panel | Scenario picker, site picker, duration | Inject scenario | -| Settings | Targets per site; switches for TabPFN cloud/local, ElevenLabs, SerpApi | Save | - Live updates through the SSE `/stream`. - Show the fix commands in a monospace block with a copy button. Never imply they were applied before approval. @@ -586,7 +575,6 @@ The project is complete when a stranger can open the demo, inject an incident, r - [ ] Simulator generates, replays and injects all 7 scenarios with labels - [ ] `detect()` passes on the eval set, results in `eval/results/detector.md` - [ ] `search_runbook()` returns the right docs for the 4 template topics -- [ ] `speak()` and `check_news()` work and fail safely - [ ] Web UI: full approve flow works live on a phone - [ ] Hosted demo live on the .tech domain - [ ] CI green; Copilot review enabled diff --git a/docs/SECURITY_VERIFICATION.md b/docs/SECURITY_VERIFICATION.md new file mode 100644 index 0000000..788fe89 --- /dev/null +++ b/docs/SECURITY_VERIFICATION.md @@ -0,0 +1,43 @@ +# Secret handling and public history verification + +Lead verification, 2026-10-18. No credential values are recorded in this file. + +- Main's `.gitignore` is preserved, including `.env` exclusions and the deliberate + absence of a blanket `.entire/` exclusion. `git check-ignore .env` succeeds. +- The agent did not open `.env`. A separate local masked-input PowerShell window + wrote the credentials directly to that ignored file. Tool arguments and output + contain no credential values. Application runtime Settings may load dotenv; + tests construct Settings with `_env_file=None`. +- Runtime adapters unwrap SecretStr only when contacting the intended provider + or database. Detector/provider failures use sanitized errors. +- Entire reports automatic checkpoint pushing disabled locally + (`push_sessions=false`). Its Codex hooks need approval and no publication of + the current coding transcript was performed. Keep credential-bearing chats + private; replace credentials that have been published or shared through chat. +- Gitleaks 8.30.1 was installed from an official release with verified checksum. + The initial Git branch/history scan found zero findings. A second `--all` scan + explicitly fetched and included 18 public Entire checkpoint refs. +- The checkpoint scan returned 2,092 generic-rule occurrences. Private in-process + classification found every captured value was a dated API feature flag adjacent + to an OAuth beta-feature header. There were zero unclassified findings and no + confirmed provider credentials. No allowlist suppressing provider keys was added. +- Scan reports remain ignored under `.build-check/security`; only redacted + findings/counts were displayed. Current provider keys were not compared or printed. +- GitGuardian's PR result is checked again after pushing the rebased branch. + +## Codex deny-read profile + +[The project profile](../.codex/config.toml) denies `.env`, dotenv variants and +credential-file paths. This follows the official [filesystem permission rules](https://learn.chatgpt.com/docs/permissions#filesystem-permissions). + +The current host session was launched with unrestricted filesystem permissions. +Editing project configuration cannot retroactively enforce a sandbox boundary on +that process or its existing subagents. Start a new sandboxed Codex session with +the profile active to enforce the deny rules. Do not describe a policy instruction +or `.gitignore` entry as an operating-system read restriction. Applications run +outside the agent sandbox can load their own dotenv files normally. + +Database migrations are excluded from partner setup and verification: Aun already +applied 001 on Tiger Cloud. No migration or credential rotation was performed by +this integration. Confirmed public credential leaks would require provider-side +rotation rather than merely deleting a file or ignoring a scanner finding. diff --git a/docs/SETUP.md b/docs/SETUP.md index df05afd..646ba4e 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -28,7 +28,7 @@ Playwright browser setup may also require `npx playwright install --with-deps` o ## Local environment and secrets -Copy `.env.example` to `.env` when the relevant integration modules provide it. Keep `.env` local; never add credentials to source control. Use mock/offline modes for unit tests. External credentials such as database, Sentry, TabPFN, ElevenLabs, and SerpApi keys are optional and should be supplied only for the corresponding integration. No credentials are required for linting or offline unit tests. +Copy `.env.example` to `.env` when the relevant integration modules provide it. Keep `.env` local; never add credentials to source control. Use mock/offline modes for unit tests. External credentials such as database, Sentry, TabPFN, and SerpApi keys are optional and should be supplied only for the corresponding integration. No credentials are required for linting or offline unit tests. Store secrets in the local shell environment or the hosting provider's encrypted environment settings. Do not place production secrets in frontend variables: values embedded into a browser bundle are public. @@ -42,7 +42,7 @@ The hosted demo may use Render, Tiger Data, Sentry, and vendor trial/free credit ## Integration gates -The core package name and shared schemas, Settings, API and SSE contract, role mapping, and CHR harness are awaiting Aun's confirmation. See [CONTRACT_REQUESTS.md](CONTRACT_REQUESTS.md). The Render blueprint describes the Next.js Node web service; an API service must not be added until Aun's backend exists and its deployment contract is known. +Core schemas, Settings, DNS/subscriber observations and runtime agreements are merged. API/OpenAPI and the actual CHR harness still require their runtime implementation. See [CONTRACT_REQUESTS.md](CONTRACT_REQUESTS.md). The Render blueprint describes the Next.js Node web service; an API service must not be added until Aun's backend exists and its deployment contract is known. ## Agent add-ons configured on this workstation diff --git a/docs/START_HERE.md b/docs/START_HERE.md index dc57627..4d2db61 100644 --- a/docs/START_HERE.md +++ b/docs/START_HERE.md @@ -34,18 +34,17 @@ Base installation excludes the optional model dependencies and needs no API keys | Simulator and RIPE data | [simgen](../packages/simgen/README.md) | [decision](../packages/simgen/decision.md), [flow](../packages/simgen/flow.md) | | Detection and forecasts | [detector](../packages/detector/README.md) | [decision](../packages/detector/decision.md), [flow](../packages/detector/flow.md) | | RouterOS retrieval | [runbook](../packages/runbook/README.md) | [decision](../packages/runbook/decision.md), [flow](../packages/runbook/flow.md) | -| Voice and outage news | [notify](../packages/notify/README.md) | [decision](../packages/notify/decision.md), [flow](../packages/notify/flow.md) | +| Outage news | [notify](../packages/notify/README.md) | [decision](../packages/notify/decision.md), [flow](../packages/notify/flow.md) | | Dashboard | [web](../apps/web/README.md) | [decision](../apps/web/decision.md), [flow](../apps/web/flow.md) | | CI and CHR | [admin setup](../.github/admin-setup.md) | [decision](../.github/decision.md), [flow](../.github/flow.md) | | Hosting | [Render](../infra/render/README.md) | [decision](../infra/render/decision.md), [flow](../infra/render/flow.md) | ## Switching to the shared runtime -[Contract requests](CONTRACT_REQUESTS.md) describe the exact missing shared -schemas, configuration and endpoints. [Setup](SETUP.md) explains credentials, -model/database setup and deployment. Public Python wrappers deliberately refuse -to construct invented shared objects while `netcortex_core` is absent. Internal -engines accept ordinary data/configuration for independent testing. +[Contract answers](CONTRACT_REQUESTS.md) summarize Aun's merged schemas, +configuration and runtime agreements. [Setup](SETUP.md) explains credentials, +model/database setup and deployment. Public Python wrappers now bind to actual `netcortex_core` objects. Internal +engines also accept ordinary data/configuration for independent testing. For live UI mode, use the documented environment variables and generate API types from Aun's actual OpenAPI. Live errors remain visible. A successful mocked API diff --git a/docs/VALIDATION_PLAN.md b/docs/VALIDATION_PLAN.md index 1291aa9..7b9ba58 100644 --- a/docs/VALIDATION_PLAN.md +++ b/docs/VALIDATION_PLAN.md @@ -32,10 +32,10 @@ Heavy-user fix parameters must come from observed subscriber telemetry, not labe incidents, seeds and time windows. Freeze thresholds on validation, not tests. - Retrieval: correct top-three result for four fix topics; repeat-safe indexing; dimension/model mismatch; missing database/model; official source attribution. -- Notifications: MP3 in English/Urdu, missing keys, timeout/rate limit, malformed - search results and unavailable checks distinct from confirmed no outage. +- News: missing keys, timeout/rate limit, malformed search results and unavailable + checks distinct from confirmed no outage. - UI: mobile layout; loading/empty/error states; approval/rejection confirmation; - duplicate clicks; failed CHR check; request errors; unavailable voice; + duplicate clicks; failed CHR check; request errors; preserved English/Urdu customer text; reconnect/refetch and duplicate SSE events; live mode must not fall back to mocks. - Integration: inject -> detect -> investigate -> CHR check -> approve/reject -> resolved/rolled_back. Verify workflow rejection and expiry with Aun. diff --git a/docs/VALIDATION_RESULTS.md b/docs/VALIDATION_RESULTS.md index d9389bc..b0f8ead 100644 --- a/docs/VALIDATION_RESULTS.md +++ b/docs/VALIDATION_RESULTS.md @@ -23,7 +23,7 @@ The detector regressions cover past-only features, finite physical bounds, SDK quantile layout, all five horizons, capped fit contexts, stale/future and mixed source rows, total-loss RTT absence, gaps in historical forecast comparison, nonfinite model outputs, separate split windows and safe observation paths. -Provider tests cover malformed responses, timeouts, unavailable audio/news and +Provider tests cover malformed responses, timeouts, unavailable news and embedding identity/dimension checks. UI tests cover confirmation, failed router checks, duplicate submissions, missing incidents, site backup topology and rollback. @@ -62,17 +62,39 @@ measurements are included in the profile. Raw/generated files and the active coverage live in [the RIPE summary](../data/ripe-baseline-summary.json) and [calibration report](../data/calibration-report.md). +## Historical baseline and current integration + +The 87-test evidence above predates the merged core. The new integration is +checked against actual shared models; see [core acceptance cases](CORE_INTEGRATION_VALIDATION.md) +and the core integration progress notes. The existing fixture accuracy report +is historical and does not establish real TabPFN performance. + ## Pending shared and external checks -Upstream `main` still contained only README.md at the integration refresh. There -is no verified `netcortex_core`, backend, workflow, collector or template harness -to integrate against. [Contract requests](CONTRACT_REQUESTS.md) specify what is -needed. Public Python wrappers fail explicitly at those boundaries. +Core, agent, fixes and collector are now merged, including db.fetch_site and +DNS/subscriber contracts. Public wrappers bind to actual netcortex_core types. +API/OpenAPI, workflows and the template harness still need their respective +runtime implementations. Database migration 001 was already applied by Aun and +was not rerun. No live database/pgvector query, EmbeddingGemma search, TabPFN inference, -ElevenLabs audio, SerpApi outage check, Sentry event, deployed Render/domain or +SerpApi outage check, Sentry event, deployed Render/domain or live approval/apply/verification/rollback has been established. Their account access, credentials, exact model identity and/or Aun's code are pending. No provider-free result is presented as evidence for those integrations. See [the start guide](START_HERE.md) to run the independent implementation. + +## Merged-core acceptance run + +After rebase onto main fc297c1 (core, agent, collector, fixes and removal merged): +root Ruff passes; 200 offline tests pass, one live agent test deselected, including +lead-authored core boundary cases. The frontend format/lint/typecheck/build and +both browser suites passed: 14 dashboard plus three HTTP/SSE cases. Provider keys +were configured locally with masked input; they were not printed or committed. +Main's root files remain byte-identical, and uv regenerated its lockfile. + +This acceptance run verifies real core schema bindings and simulator transactions +through fake DB tests. Real TabPFN requires an explicit TRAIN/normal-VALIDATION +preparation step; the public adapter currently raises unavailable without that +state. The next small PR is limited to that Gate 2 path. No DB migration ran. diff --git a/docs/WORKSTREAM_B_PLAN.md b/docs/WORKSTREAM_B_PLAN.md index a636837..c5d2575 100644 --- a/docs/WORKSTREAM_B_PLAN.md +++ b/docs/WORKSTREAM_B_PLAN.md @@ -15,6 +15,9 @@ Every worker records its files, commands, results, decisions and blockers in a handoff. Exact 60% compaction is controlled by the host; use token thresholds where supported and persist handoffs regardless. +Core and voice removal are now merged. Follow [the lead acceptance cases](CORE_INTEGRATION_VALIDATION.md) +for the current integration, then limit follow-up work to Gate 2. + ## Prerequisites and contracts - Python 3.12, uv, Node LTS, Entire Codex hooks, GitHub authentication. @@ -22,7 +25,7 @@ where supported and persist handoffs regardless. modules and serialized fixtures are built. Secrets never enter source control. - Aun supplies core plus subscriber traffic/IP evidence, DNS resolution timing, target/interface roles, backup topology, forecast write/upsert ownership, - replay/injection lifecycle and Settings/API/SSE/voice failure contracts. + replay/injection lifecycle and Settings/API/SSE failure contracts. - Require those additions before claiming affected features work. Never infer subscriber IPs or causes from evaluation labels. - Free tiers and credits only; no purchase or paid upgrade is authorized. @@ -43,18 +46,19 @@ where supported and persist handoffs regardless. TabPFN 3.5 cloud/local regression quantiles for 1-5 minutes, unsupervised scoring, cause classification. Bound contexts, cache fits and batch requests. Normalize scores on validation data; freeze thresholds before held-out tests. - Compare observations only to forecasts created earlier. Persist forecasts once. + Compare observations only to forecasts created earlier. Return series; the worker + alone persists forecasts. Inference failures are unavailable, never healthy or silently mocked. 5. Retrieval: official RouterOS sources and headings, 300-500-word chunks, EmbeddingGemma through Ollama, pgvector, source URLs and top-k search. Verify 768 dimensions and matching model identity. Vector search first; hybrid optional. -6. Notifications: ElevenLabs English/Urdu MP3, short alerts, SerpApi recent - provider/target outage search. Finite deadlines and explicit unavailable states. +6. News: SerpApi recent provider/target outage search, finite deadlines and explicit + unavailable states. Customer messages remain English and Urdu text. 7. G2: offline module tests pass; actual service smoke results reported separately. 8. Dashboard: Next.js App Router/TypeScript/Tailwind/shadcn/Recharts; Overview, Incidents, Incident Detail, Demo Panel; Settings waits for a backend interface. Responsive dark UI with Pakistan times, forecast bands, evidence, commands, - rollback, CHR results, voice and timeline. Fixture/live transports share one + rollback, CHR results, customer messages and timeline. Fixture/live transports share one interface. Generate API types from Aun's OpenAPI. SSE reconnect/refetch and duplicate-event handling. Confirm decisions and prevent duplicate submissions; commands are applied only when the API confirms the corresponding state. diff --git a/docs/post/notes.md b/docs/post/notes.md index a167abe..545cff3 100644 --- a/docs/post/notes.md +++ b/docs/post/notes.md @@ -14,6 +14,6 @@ NetCortex is being built for small network operators who need an affordable way Open-weight local inference is intended to keep network context on-site, support diagnosis during internet outages, and avoid per-token charges for the core workflow. These are design goals; claims about measured privacy, reliability, cost, or accuracy require implementation and evidence. -The hosted demo is planned to use simulated/replayed telemetry. TabPFN cloud sends anonymized metrics to its provider and its current license terms may restrict commercial use; verify the applicable terms before making product claims. Cloud voice and outage-search integrations are optional and may require paid credentials. +The hosted demo is planned to use simulated/replayed telemetry. TabPFN cloud sends anonymized metrics to its provider and its current license terms may restrict commercial use; verify the applicable terms before making product claims. Cloud outage-search integrations are optional and may require paid credentials. Before publication, replace this draft with verified implementation details, evaluation results, limitations, a working demo link if available, and an actual first-user account only if one exists and consents to being described. diff --git a/docs/post/partner-draft.md b/docs/post/partner-draft.md index c17f3e3..221064a 100644 --- a/docs/post/partner-draft.md +++ b/docs/post/partner-draft.md @@ -20,7 +20,6 @@ walkthrough rather than treating this target audience as customer validation. ## What the partner work builds Workstream B supplies reproducible telemetry scenarios, a detector adapter, -source-linked RouterOS documentation retrieval, voice/outage-check adapters and the operator dashboard. The shared API, agent, durable workflows and virtual-router test harness belong to Aun's workstream. @@ -71,7 +70,7 @@ That makes it possible to evaluate a different model or narrow its task without rewriting the dashboard and workflows. Cloud add-ons have different boundaries. TabPFN cloud receives the submitted -feature data; ElevenLabs receives alert text; SerpApi receives the outage query. +SerpApi supplies optional recent provider/target outage searches; customer messages remain text. They must be optional and described accurately. Our code's MIT license does not replace the licenses of model weights, datasets or third-party services. Check the applicable [TabPFN model terms](https://github.com/PriorLabs/TabPFN) before diff --git a/docs/progress/core_detector.md b/docs/progress/core_detector.md new file mode 100644 index 0000000..6e371ce --- /dev/null +++ b/docs/progress/core_detector.md @@ -0,0 +1,9 @@ +# Core detector integration progress + +The detector now imports the merged core contracts directly. `DetectorUnavailable` is a `ModuleUnavailable` subtype, and `detect(site_id, window, history)` consumes core `MetricsWindow` inputs and returns `DetectionResult` with canonical forecast series, including DNS target names containing colons. Results stay in memory; detector code does not call the forecast database writer. + +The public API has no labels for cause fitting and no normal validation scores for anomaly calibration. It does not infer either from expected evaluation labels or templates. Consequently, public real TabPFN inference raises a sanitized unavailable error until an approved training/reference source is connected. An explicitly injected fixture backend is mapped to `mode="mock"` and `model="fixture_persistence"` for offline contract tests. + +Cloud credentials come from core `Settings`; `.env` loading is disabled at the detector boundary, and `SecretStr` is unwrapped only when constructing the cloud provider. Provider exceptions are reduced to their type by the engine. + +Offline verification: detector tests and lead-authored core contract tests pass (37 tests total), and `ruff check packages/detector` passes. Root `ruff check .` reports 19 findings in concurrently changed notify, runbook, and simgen files; it reports no detector findings. No real TabPFN call was made. diff --git a/docs/progress/core_news_ui.md b/docs/progress/core_news_ui.md new file mode 100644 index 0000000..acfaaff --- /dev/null +++ b/docs/progress/core_news_ui.md @@ -0,0 +1,7 @@ +# Core news, runbook, and UI integration + +Implemented the shared core boundary for news and runbook search. News returns the real `NewsCheck` and `NewsItem` schemas, keeps provider failures unavailable, and normalizes relative SerpApi dates to aware UTC datetimes. Runbook imports actual `Settings`, `RunbookChunk`, and `ModuleUnavailable`; it accepts the shared bare `embeddinggemma` name, validates 768 finite dimensions, unwraps database `SecretStr` at psycopg use, and returns cosine similarity scores. + +Removed voice exports, CLI commands, provider code and tests, web audio route/player/request, and related styles. English and Urdu customer messages remain text. Updated package and app README, decision, and flow documents. + +Validation: notify and runbook existing plus lead acceptance tests passed (20 tests). Web lint, typecheck, production build, Prettier check, and all 17 browser tests passed (14 dashboard and 3 live-mode tests). Live SerpApi, Ollama, and database checks were not run. The worker used the existing `.venv` interpreter; the lead also reran through `python -m uv` with the regenerated locked workspace. diff --git a/docs/progress/core_simgen.md b/docs/progress/core_simgen.md new file mode 100644 index 0000000..f0fc27a --- /dev/null +++ b/docs/progress/core_simgen.md @@ -0,0 +1,7 @@ +# Simgen core binding progress + +Bound simgen to the merged `netcortex-core` schemas, Settings, and DB helpers. DNS slow cases now include DNS-kind lookup probes at `dns:1.1.1.1`; heavy-user evidence is continuous `SubscriberMetric` output. Fixture topology conversion retains primary, configured backup, and backhaul links and maps configured targets to core roles. + +Public injection creates a UTC now-to-end scenario, takes a transaction-scoped site advisory lock, rejects overlapping simulator labels, preserves existing Site rows, and writes probe/interface/subscriber metrics plus the label in one transaction. Database load/replay use bounded inserts and Settings for credentials; mock mode remains offline. + +Validation passed with the workspace environment: all 25 simgen tests and Ruff checks pass. Template expectations are checked against the installed fixes templates. Runtime Settings use shared defaults; tests isolate Settings with `_env_file=None`. Injection rejects windows over 22 hours and unknown sites before opening a connection. No live database or credentials were used. The package manifest declares its core workspace dependency; the root workspace already installs all packages with `uv sync --all-packages`. diff --git a/docs/progress/head.md b/docs/progress/head.md index 20a9f29..ebdd2db 100644 --- a/docs/progress/head.md +++ b/docs/progress/head.md @@ -1,66 +1,55 @@ -# Head handoff: Workstream B - -Updated 2026-10-18. Integration repo is `NetCortex`, branch `b/workstream-b`. -User authorized full B1-B9/B11 excluding Tinker, Luna medium coding workers, -lead review/integration, tested branch push and decision/flow documents. -Only free tiers/credits; no purchase. Do not ask again for Git identity/auth. - -## Integrated code - -- Four uv workspace packages: simgen, detector, runbook, notify. -- Next.js dashboard with fixture and live HTTP/SSE transports. -- Python/frontend CI, separate pinned CHR bootstrap smoke/template jobs. -- Render Node blueprint; no deployed service or domain claimed. -- Root/package/app/eval/CI/hosting decision.md and flow.md, start guide, - validation plan/results, contract requests and honest submission draft. -- Main README remains Aun-owned and unchanged. MIT license follows brief. - -## Actual local checks - -- Locked base workspace sync passed; optional heavy model extras excluded. -- Root Ruff passed; combined Python/bootstrap suite: 87 passed in 7.30s, - branch coverage 68%. Current NumPy/pandas emit deprecation warnings. -- Four wheels/source distributions built; installed simgen/detector CLI help passed. -- Frontend format/lint/typecheck/production build passed. -- 14 desktop/mobile fixture E2E + 3 mocked-live HTTP/SSE E2E passed. -- Production npm audit clean; five high development entries share one unpatched - braces advisory. Web decision.md records why an incompatible downgrade was rejected. -- Real RIPE: 11,819 rows, three PK probes/ASNs, October 11-17; three daily - measurement request gaps. Raw rows ignored; provenance/report committed. -- Calibration explicitly opted into a narrow public-DNS ping-role proxy from - measured root-server paths, with provenance and route uncertainty. No DNS lookup claim. -- Generated 80 cases EACH train/validation/test (ten/class), separate seeds/windows. -- Fixture held-out report: 80/80 available; cause accuracy .375; event precision 1; - recall 62/70; median ~.097s; zero false alerts over .20833 normal site-days. - Single snapshots do not measure detection delay or continuous operation. -- Cloud-unavailable report: 0/80 model cases scored; never counts absence as normal. -- CHR offline: 15 tests. Corrected real Linux CHR boot, authenticated REST and - cleanup passed: https://github.com/aunraza19/NetCortex/actions/runs/39131915789 -- Corrected Linux Python/frontend CI passed: https://github.com/aunraza19/NetCortex/actions/runs/39131915864 - Both push and PR runs passed on d60ffac; template apply/read-back/rollback - remains skipped because Aun harness is absent. - -## GitHub and external gates - -Git author techieworld2 / user-provided email is local to repo. GCM contains -multiple identities; repo explicitly selects techieworld2. Verified push/workflow -access, no admin. Never print/store credential values. A helper outside the repo -can pass the existing GCM token to gh through the process environment only. -Entire enabled locally before first commit; telemetry/session auto-upload disabled. -No verified captured/uploaded coding transcript claimed. - -Upstream refresh still showed main at 4f84168 with README only. Aun must provide -core, Settings, API/SSE, migrations, workflows, collector, agent/fixes and template -harness. Public shared-type wrappers deliberately fail until those contracts exist. -DB/model/provider/Render/domain access is missing. Tiger/TabPFN MCP configured, -not authenticated/verified. RouterOS and Sentry skills installed/read/applied. - -## Delivery - -Branch pushed; draft PR https://github.com/aunraza19/NetCortex/pull/1 is open. -The first runs exposed a transient browser assertion and serial CRLF double -submission. Both fixes were verified by successful push and PR CI runs. -Documentation links those implementation-run results. Shared runtime/provider -and deployment gates remain explicit; the PR stays draft for Aun's contract review. -Copilot automatic review requires Aun admin/eligible plan; it is not enabled. -No merge, purchase or live deployment has been performed. +# Workstream lead handoff + +Current task: user required rebase after merged core/agent/removal, direct shared +contracts, SecretStr handling, real DNS/subscriber simulation, no forecast DB +writes in detect, removal of speech generation, push/ready existing PR, then +Gate 2 only in small follow-up PRs. Keep Python 3.12 and main root files exactly. + +## Integration complete locally + +- Rebased b/workstream-b onto origin/main fc297c1. Backup branch exists for the + old public head; push must use explicit force-with-lease against 44e4a7b. +- Main pyproject.toml/.gitignore/LICENSE/.gitattributes are byte-identical. + uv lock regenerated, uv sync --all-packages --locked succeeded. +- Lead wrote docs/CORE_INTEGRATION_VALIDATION.md and four contract test files + before delegating to three Luna medium workers (shared integration owned paths). +- Direct core DetectionResult/MetricsWindow/Settings/ModuleUnavailable bindings; + canonical forecast series including DNS colons; worker alone writes forecasts. +- Simgen DNS-kind probes, continuous subscriber rows, Site mapping, actual atomic + injection with advisory locking/overlap protection, existing-site preservation. +- News returns real NewsCheck; embeddinggemma bare model accepted, SecretStr + handled at DB/provider boundary. No speech code/player; customer text preserved. +- Ruff passed; 200 offline tests passed, 1 live agent test deselected. Frontend + format/lint/typecheck/build + 14 dashboard/3 live browser cases passed. +- Public history plus 18 explicitly fetched Entire refs audited with Gitleaks: + zero confirmed secrets. 2092 generic findings were all dated SDK feature flags. + Reports ignored. Automatic checkpoint pushing remains disabled locally. +- A local masked-input window wrote ignored .env; agent did not open it. User + pasted credentials in chat; never repeat them in tools, docs or responses. + Do not publish this current transcript. No rotation or migrations performed. +- .codex/config.toml provides future-session deny-read rules. Current unrestricted + host cannot acquire that sandbox retroactively; limitation documented honestly. + +## Delivery sequence + +Commit owned source/test/docs and regenerated lock; scan staged changes without +printing credentials. Force-with-lease push to existing PR #1, inspect CI and +GitGuardian, repair failures, mark ready only after checks pass. No migrations. + +## Gate 2 follow-up only + +Use a small new B branch from delivered integration and draft PR. Real TabPFN +public detect still lacks explicitly prepared TRAIN labels/normal VALIDATION +reference; this is our training responsibility, not missing Aun schemas. Proposed +startup API prepares a data-only artifact from simulator TRAIN/VALIDATION only, +loads/caches a configured backend, and lets public detect use it. No TEST sidecars +at inference; no pickled SDK models or fake real inference. + +User credentials are in .env for application runtime only; never use tool reads +or output raw Settings/errors. Use dedicated simulated site, preserve home-lab, +no migrations. Inject now; obtain past-only context/current MetricsWindow; call +actual TabPFN and validate actual DetectionResult, mode/model, finite ordered +future forecast points and no detector DB writes. Save sanitized timing/result. +Embedding installation, deployment, broad evaluation and other work are outside +this requested follow-up. Prior Labs model/client adapters may need SDK fixes +based on actual calls; keep the patch and tests focused. diff --git a/docs/progress/retrieval_notify.md b/docs/progress/retrieval_notify.md index df0aebd..4f98785 100644 --- a/docs/progress/retrieval_notify.md +++ b/docs/progress/retrieval_notify.md @@ -1,43 +1,14 @@ -# B4/B5 runbook and notifications handoff +# Retrieval and news handoff -## Owned files delivered +Superseded by [core integration](core_news_ui.md). The original independent +packages were integrated before core was available. Public functions now import +actual core models and Settings. The accepted embedding name is exactly +embeddinggemma; the former full-tag prerequisite is removed. -- `packages/runbook/`: hatchling package `netcortex-runbook` / `netcortex_runbook`, official-doc ingestion, vector search adapter, fixture CLI, unit tests, README, decision guide, and flow guide. -- `packages/notify/`: hatchling package `netcortex-notify` / `netcortex_notify`, ElevenLabs and SerpApi helpers, unavailable-only fixture CLI, unit tests, README, decision guide, and flow guide. -- This handoff. +News uses SerpApi and returns NewsCheck, preserving available=False. Retrieval +uses official source URLs, checked 768-dimensional embeddings and cosine +similarity. Runtime credentials are SecretStr and are unwrapped only at the +network/database boundary. Tests use mocked providers and Settings(_env_file=None). +English and Urdu customer messages are text. No speech generation remains. -No core schema, Settings, root manifest, lockfile, or other team-owned file was changed. No credentials, live embedding calls, database writes, TTS calls, or SerpApi calls were used. - -## Checks run - -Command: - -```powershell -python -m uv run --with-editable packages/runbook --with-editable packages/notify --with pytest pytest packages/runbook/tests packages/notify/tests -``` - -Result: **18 passed** on Python 3.12.0. These are offline unit tests using `httpx.MockTransport` and fixture data. Coverage includes four fixture topics with source metadata plus a canonical six-page allowlist/crawl-delay policy test, chunk boundaries, EmbeddingGemma identity/dimension/non-finite values, robots denial, model-specific idempotent persistence, body deadline, voice language/word validation, MP3 response, output-format query, voice rate limit and public failure handling, absent credentials, malformed news payloads, unsafe links, date filtering, outage relevance, and SerpApi rate limit/timeout. - -The smoke CLIs were run: - -```powershell -python -m uv run --with-editable packages/runbook runbook fixture "failover default route" --mock -python -m uv run --with-editable packages/notify notify speak "Uplink is degraded" --lang ur --mock -python -m uv run --with-editable packages/notify notify news ExampleISP game-server --mock -``` - -Runbook returned source-linked `fixture=true` excerpts with source titles and retrieval date. Notification fixtures returned unavailable outputs and made no provider calls. - -Ruff formatting and checks passed against `C:\Users\nigga\Documents\NetCortex\pyproject.toml` (Python 3.12, E/F/I/UP/B rules, 100-character lines). `git diff --check` passed. `uv build --wheel` built both distributions successfully. The ignored wheel outputs remain under each package's `.build-check` folder because cleanup commands were blocked by the execution policy. - -## Decisions and live gates - -- Official RouterOS sources are restricted to six canonical `help.mikrotik.com` pages: queues, route, failover, DNS, mangle, and interface stats/traffic. A one-time live source validation on 2026-10-18 got `robots.txt` HTTP 200 with `Crawl-delay: 5`; all six canonical pages returned HTTP 200 with expected titles. The indexer reads robots once, checks each URL, and honors its parsed delay between page fetches. The page fetches were not retained as a raw corpus. Responses stream with a 2 MB cap and finite HTTP timeouts. -- No Ollama tag is guessed. The shared configured value must be a full `embeddinggemma:`; responses are checked for exact identity and 768 finite dimensions. Aun still must confirm the shared tag and Settings fields before public search can use `netcortex_core`. -- Chunking targets 400 words, accepts a target from 300 through 500, balances page remainder, and preserves headings in section metadata. Source pages were validated but no raw corpus was retained. -- Existing `runbook_chunks` schema has no content uniqueness key. Indexing therefore takes a PostgreSQL transaction advisory lock and selects by source/title/section/text/model before inserting; the schema is not changed. A model change keeps a distinct embedding row. The database write path has not been exercised against PostgreSQL. -- Vector-only pgvector cosine search returns Aun's `RunbookChunk` objects and source URLs. Search quality is not measured until the shared DB/model is available. -- ElevenLabs `eleven_v3` was chosen because its current official model docs list Urdu; `eleven_multilingual_v2` does not support the API language-code parameter. MP3 format is an API query parameter. SerpApi Google search uses `tbs=qdr:d`; result dates, relevant outage wording, and HTTP(S) URLs are checked. These API/model choices are recorded in package docs. -- Public functions are contract-gated: `search_runbook` needs core `Settings` and `RunbookChunk`; `speak` needs core `Settings`; `check_news` needs core `Settings`, `NewsCheck`, and `NewsItem`. Internal functions support passed config and injected clients. There are no copied shared types or alternate Settings classes. - -Pending before integration claims: Aun publishes the core package/schema/settings fields and confirms the EmbeddingGemma tag; a real test database and Ollama host are available; run ingestion twice and verify idempotence; run all four retrieval topics and verify correct top-three hits; test real Urdu/English MP3 playback and SerpApi known/empty/error cases. No external integration or real retrieval/voice/news pass is claimed. +Live provider/database retrieval quality remains separate from offline tests. diff --git a/docs/progress/web_dashboard.md b/docs/progress/web_dashboard.md index 4f9cd9c..338fc18 100644 --- a/docs/progress/web_dashboard.md +++ b/docs/progress/web_dashboard.md @@ -17,7 +17,7 @@ Visual review screenshots (ignored by Git): - `C:\Users\nigga\Documents\NetCortex-web\apps\web\test-results\overview-desktop.png` - `C:\Users\nigga\Documents\NetCortex-web\apps\web\test-results\overview-mobile.png` -Integration still requires Aun's published OpenAPI schema and backend contract review, especially payload field mappings, metrics series semantics, SSE replay/heartbeat behavior, and voice media response. No API schema was available, so generated API types were not produced. Sentry is initialized only when a DSN is supplied; no DSN or Sentry MCP connection was available, so delivery is not verified. The root CI and Render service configuration remain parent-owned. +Integration still requires Aun's published OpenAPI schema and backend contract review, especially payload field mappings, metrics series semantics, SSE replay/heartbeat behavior. No API schema was available, so generated API types were not produced. Sentry is initialized only when a DSN is supplied; no DSN or Sentry MCP connection was available, so delivery is not verified. The root CI and Render service configuration remain parent-owned. Final topology correction: `apps/web/lib/fixtures.ts` subscriber counts and primary/backup capacities now match the canonical simulator source `data/sites.yaml` (North Tower 120 / 180 / 80 Mbps; Market Cafe 48 / 100 / no backup; East Relay 165 / 250 / 100 Mbps). Health, utilization, latency and loss remain illustrative replay values. The overview browser case asserts the subscriber and primary-capacity values on desktop and mobile; it passed again alongside lint, typecheck and format checks. Screenshots at the paths above were refreshed. No dashboard test server remained listening on ports 3000 or 3001 after the targeted run. @@ -28,3 +28,5 @@ Final topology correction: `apps/web/lib/fixtures.ts` subscriber counts and prim ## Deterministic approval E2E timing The approve-to-resolved and approve-to-rollback browser tests install Playwright `page.clock` after opening the confirmation dialog, pause it at a fixed future time with `pauseAt`, and explicitly advance through the existing 250/400/500 ms mock transport waits with `runFor`. The clock stays paused between advances, keeping applying/verifying assertions deterministic under CI scheduling while leaving application workflow timing untouched. After this pause refinement, the focused approval/rollback cases passed on desktop and mobile (4/4). The full suites had passed immediately before this refinement: dashboard 14/14, live 3/3; lint, typecheck and format check passed. No app code changed. + +Current removal/core update: see [core news/UI handoff](core_news_ui.md). Both browser suites passed, 14 dashboard plus three live-transport cases. diff --git a/flow.md b/flow.md index 638cf6e..d9da916 100644 --- a/flow.md +++ b/flow.md @@ -1,6 +1,6 @@ # NetCortex: entry points, connections and exits -This map distinguishes the partner's code from Aun's pending shared runtime. +This map distinguishes the partner's code from Aun's shared runtime. Package `flow.md` files give exact implementation-level names and examples. This document is updated as each component is integrated. @@ -22,9 +22,6 @@ flowchart TD N --> SE[SerpApi] A --> X[Aun: template checker / isolated CHR] X --> API[Aun: FastAPI + SSE] - A --> V[Partner: speak] - V --> EL[ElevenLabs MP3] - EL --> API API <--> UI[Partner: Next.js dashboard] UI --> Q{Human decision} Q -->|approve| IW[Aun: incident workflow] @@ -44,7 +41,6 @@ flowchart TD | `simgen replay` / `inject` | site, cause, duration, seed | Active simulator runtime; DB writes need Aun's keys/runtime agreement | Current metrics and scenario label; explicit missing-runtime/contract failure | | `detect(site_id, window, history)` | observed shared MetricsWindow | Lag features -> TabPFN forecasts/anomaly/cause | Shared DetectionResult and approved forecast writes, or unavailable error | | `search_runbook(query, k)` | question and result count | Ollama query embedding -> pgvector retrieval | Shared RunbookChunk objects with source URLs | -| `speak(text, lang)` | short text, en/ur | ElevenLabs with finite deadlines | MP3 bytes; empty bytes when audio unavailable | | `check_news(provider, target)` | upstream provider/target | Recent SerpApi search | Shared NewsCheck with links; explicit unavailable summary on failure | | Dashboard navigation | site/incident selection | Fixture transport or Aun's HTTP API | Rendered status/evidence, loading state or visible error | | Dashboard decision | confirmed approve/reject | POST to Aun; GET authoritative incident after acknowledgement; workflow owns subsequent state | Acknowledged decision, followed by SSE/refetch; no assumed live success | @@ -53,9 +49,8 @@ flowchart TD ## HTTP boundary owned by Aun The draft API exposes `GET /sites`, `/metrics`, `/incidents`, -`/incidents/{id}`, `/incidents/{id}/voice`, `GET /stream`, `POST /incidents/{id}/approve`, `/incidents/{id}/reject`, and -`POST /demo/scenarios`. Actual response types must come from Aun's OpenAPI. +`POST /demo/scenarios`. Actual response types will come from Aun's API OpenAPI when published. SSE event names are `metric`, `incident.opened`, `incident.updated`, `fix.tested` and `fix.applied`. Reconnect must refresh state; repeated event IDs must not repeat effects. Settings reads/writes are a pending contract. @@ -77,3 +72,16 @@ the separate CHR workflow boots a pinned router and checks authenticated REST. Its template job runs only when Aun's actual test harness exists; boot success alone does not establish template validity. External authentication is setup, not an automatic claim of a working connection. + +## Merged core boundary + +simgen.inject enters a site-locked transaction, preserves existing Site topology, +inserts sim ProbeMetric/IfaceMetric/SubscriberMetric observations and one +ScenarioLabel, then commits or rolls back together. DNS uses kind=dns and target +dns:1.1.1.1. The detector consumes actual MetricsWindow inputs and returns +DetectionResult with canonical SeriesForecast/ForecastPoint data. detect performs +no forecast writes; MonitorSiteWorkflow owns persistence. Core exposes fetch_site. + +The detector needs an explicitly prepared real TabPFN context for cloud/local +inference. Gate 2 will prepare it from TRAIN and normal VALIDATION observations, +without reading TEST labels at inference. Provider failures remain unavailable. diff --git a/packages/detector/README.md b/packages/detector/README.md index 3e20861..41337c3 100644 --- a/packages/detector/README.md +++ b/packages/detector/README.md @@ -1,6 +1,6 @@ # netcortex-detector -Past-only feature construction and injected TabPFN 3.5 adapters for network metrics. The package has no dependency on Aun's unpublished core types. `run_engine()` accepts probe and interface DataFrames, aware UTC `as_of`, site, an injected backend, and optional train/validation inputs. `detect(site_id, window, history)` is the future core adapter and raises `DetectorUnavailable` until the real `netcortex_core.DetectionResult` and `MetricsWindow` contract can be bound. +Past-only feature construction and TabPFN 3.5 adapters for network metrics. `run_engine()` accepts probe and interface DataFrames, aware UTC `as_of`, site, an injected backend, and optional explicit training inputs. `detect(site_id, window, history)` consumes actual core `MetricsWindow` objects and returns core `DetectionResult` with grouped forecast series. The public API receives no labeled TRAIN data or calibrated normal VALIDATION reference, so actual TabPFN cause/anomaly inference fails explicitly until that data contract is supplied; it never substitutes fixtures. Explicit fixture provenance is labeled `mode="mock"`. The detector returns forecasts in memory and performs no database writes. Base installation keeps the heavy inference stack optional: diff --git a/packages/detector/decision.md b/packages/detector/decision.md index 0670b40..fa18c61 100644 --- a/packages/detector/decision.md +++ b/packages/detector/decision.md @@ -1,10 +1,11 @@ # Detector decisions -- Keep `run_engine()` independent from `netcortex_core`. Its inputs are the approved-shaped probe/interface frames, `site_id`, an aware UTC cutoff, an injected backend, and optional explicit training vectors. The core-facing `detect()` lazy-imports actual core symbols and fails clearly while their contract is unavailable; this avoids a copied Settings class or a guessed shared result schema. +- `run_engine()` remains independently testable with approved-shaped frames and an injected backend. Public `detect(site_id, window, history)` imports the actual core `MetricsWindow`, `DetectionResult`, `Cause`, forecast models, `Settings`, and `ModuleUnavailable`; `DetectorUnavailable` subclasses the shared error. It combines prior history with the current window, applies the window cutoff and site checks in the engine, and returns grouped core series without writing forecasts. - Build one-minute snapshots from source rows at or before `as_of`, grouped by target role and interface role supplied as configuration. Without a role mapping, exact target/interface identifiers stay separate under `target:`/`interface:` feature names; the detector does not infer that a host is DNS or an interface is an uplink. Only RTT, jitter, loss, utilization, drops, and errors enter this feature path. Supplemental DNS resolution, subscriber traffic, and backhaul quality rows remain experimental. - Lags and rolling statistics shift by one minute; missing observations are never backfilled from the future. Rows for another site, invalid timestamps, and supplemental source rows are rejected. Probe and interface frames must each have a single, matching source when source metadata is supplied, preventing mixed live/simulator/RIPE measurements. Sparse history returns an explicit `insufficient_history` result with no cause. - Cloud and local TabPFN adapters are lazy, optional integrations. They select TabPFN 3.5 and send explicit 0.1/0.5/0.9 regression quantiles. Cloud credentials come from an injected argument or `TABPFN_TOKEN`/`TABPFN_API_KEY`, are never logged, and client calls use a 30-second timeout. The local adapter uses `ModelVersion.V3_5`. The unsupervised extension is fit on normal TRAIN observations; its low log-likelihood is normalized by the empirical CDF of normal VALIDATION scores. Provider errors raise `DetectorUnavailable` and are never replaced by fixtures. -- Cause classifier fitting requires explicit aligned feature vectors and labels supplied by the caller. The evaluator builds those vectors from TRAIN case files only; validation labels select the threshold maximizing F1 under a false-alert budget computed from unioned normal detection-window exposure per site, consistent with the reported false-alert/site-day denominator. Positive cases and their event duration do not enlarge the budget. TEST is used only for scoring. Labels and expected template parameters are not feature columns. Fitted contexts use a fingerprint for cache keys; the expanded five-horizon training table is deterministically capped at 2,048 rows while retaining every horizon. +- Cause classifier fitting requires explicit aligned feature vectors and labels supplied by the caller. The evaluator builds those vectors from TRAIN case files only; validation labels select the threshold maximizing F1 under a false-alert budget computed from unioned normal detection-window exposure per site. Public `detect()` receives no labels, and neither expected labels nor template metadata are inferred from metrics. Gate 2 preparation will use the existing simulator TRAIN and normal VALIDATION packs to build detector-owned runtime training state; TEST remains evaluation-only. Fitted contexts use fingerprints; expanded forecast training is capped at 2,048 rows. - Sustained forecast evidence is walk-forward: each of the last three contiguous minute observations is compared against a forecast made strictly earlier and targeting that exact minute. Forecast timestamps, horizon, finite quantiles, order, and physical bounds are validated. One excursion does not count as sustained. Missing, stale, or sparse input returns unavailable, not healthy. - FixtureBackend exists only to exercise the offline pipeline. Its deterministic persistence bands and simple rules are identified in every result as fixture provenance and cannot support a TabPFN performance claim. - Forecast output is returned in memory with model provenance. Database writes are not enabled: forecast writer ownership, conflict keys, and retry semantics are still open in Aun's contract request. Cause/template parameter construction and CHR checks are outside this package until their real contracts are available. +- Explicit fixture provenance maps to core `mode="mock"` and `model="fixture_persistence"`; cloud and local provider identities retain their configured mode. Core `Settings()` supplies runtime configuration; SecretStr is unwrapped only when constructing the cloud provider. Tests instantiate Settings with `_env_file=None`. diff --git a/packages/detector/flow.md b/packages/detector/flow.md index 36c867e..d4c3d80 100644 --- a/packages/detector/flow.md +++ b/packages/detector/flow.md @@ -1,10 +1,10 @@ # Detector flow and API -`build_features(probes, interfaces, *, site_id, as_of, target_roles=None, source_roles=None)` checks required columns, aware UTC cutoff, site isolation, timestamp validity, and source boundaries. If source fields are present, each frame must use one source and both frames must agree. It returns a one-minute-indexed pandas frame with past-only values, lags, rolling summaries, and UTC calendar fields. With no role mapping, target and interface IDs remain distinct with explicit `target:` and `interface:` prefixes. It raises `ValueError` for malformed or mixed-site inputs. +`build_features(probes, interfaces, *, site_id, as_of, target_roles=None, source_roles=None)` checks required columns, aware UTC cutoff, site isolation, timestamp validity, and source boundaries. If source fields are present, each frame must use one source and both frames must agree. It returns a one-minute-indexed pandas frame with past-only values, lags, rolling summaries, and UTC calendar fields. With no role mapping, target and interface IDs remain distinct under `target:` and `interface:` prefixes. `detect()` maps either default-prefixed or explicitly role-mapped raw feature names through the core `series_key()` helper, preserving colons in DNS target names. It raises `ValueError` for malformed or mixed-site inputs. `run_engine(probes, interfaces, *, site_id, as_of, backend, history_start=None, config=None, training_features=None, training_labels=None, anomaly_threshold=None)` is the independently testable inference API. It returns a plain dictionary with anomaly/cause/forecast/evidence fields, status, provenance, and a supplemental-use flag. Missing, stale, or sparse observations return `availability="unavailable"` and a null anomaly outcome. Invalid backend causes and provider failures are errors (`DetectorUnavailable`), not healthy results. The backend is injected; this function does not silently choose a mock. -`detect(site_id, window, history)` is the planned core entry point. It lazy-imports `netcortex_core.DetectionResult` and checks the incoming window exposes `probe_metrics`, `iface_metrics`, and `as_of`. Until Aun publishes and merges those exact contracts and field mappings, it raises `DetectorUnavailable`; `history` is reserved for the approved historical context and currently is not interpreted. +`detect(site_id, window, history)` accepts actual core `MetricsWindow` objects. It combines their probe/interface rows, runs the current window through `as_of`, and calls the provider selected by shared `Settings()`. It maps in-memory forecasts to core `SeriesForecast`/`ForecastPoint` objects with canonical series keys, preserving DNS target colons; an unrecognized forecast metric fails explicitly instead of disappearing. Missing/stale measurements and provider failures raise `DetectorUnavailable`, a `ModuleUnavailable` subtype. It never writes forecast rows. The detector API does not accept labels or normal reference scores; Gate 2 preparation will provide detector-owned state from TRAIN and normal VALIDATION data without using TEST labels at inference. Fixture backend output is marked `mode="mock"` and `model="fixture_persistence"`. `TabPFNBackend("cloud" | "local")` supplies real provider calls. Cloud uses `tabpfn_client`, `TABPFN_TOKEN`/`TABPFN_API_KEY` or an injected key, `set_access_token`, v3.5 factories, and a 30-second client timeout. Local uses TabPFN classifier/regressor and `ModelVersion.V3_5`. Regressors request `output_type="quantiles"` for quantiles `[0.1, 0.5, 0.9]`; the bands are sorted before reporting. The unsupervised extension is fit on normal TRAIN data; low log-likelihood is normalized against normal VALIDATION scores. Regressors use lag/calendar predictors and shifted targets; only raw RTT, loss, and utilization are forecast targets. Horizon-expanded fit rows are capped at 2,048 with deterministic per-horizon sampling. Quantile-first SDK responses are converted horizon-wise, and nonfinite, unordered, out-of-range, or invalid-time forecasts fail explicitly. Missing packages, key, model download, GPU/runtime support, and inference failures are explicit. No network request is made by the unit tests. diff --git a/packages/detector/pyproject.toml b/packages/detector/pyproject.toml index 5f53a5e..40a55ee 100644 --- a/packages/detector/pyproject.toml +++ b/packages/detector/pyproject.toml @@ -7,7 +7,7 @@ name = "netcortex-detector" version = "0.1.0" description = "Past-only TabPFN network metric detector" requires-python = ">=3.12" -dependencies = ["numpy>=2.0", "pandas>=2.2", "pyarrow>=18"] +dependencies = ["netcortex-core", "numpy>=2.0", "pandas>=2.2", "pyarrow>=18"] [project.optional-dependencies] cloud = ["tabpfn-client>=0.6.1", "tabpfn>=9.2.0", "tabpfn-extensions>=0.6.3", "torch>=2.14.1"] diff --git a/packages/detector/src/netcortex_detector/__init__.py b/packages/detector/src/netcortex_detector/__init__.py index a8d29c9..2708ee3 100644 --- a/packages/detector/src/netcortex_detector/__init__.py +++ b/packages/detector/src/netcortex_detector/__init__.py @@ -1,6 +1,12 @@ """Network telemetry features and TabPFN detector adapters.""" -from netcortex_detector.engine import DetectorConfig, DetectorUnavailable, build_features +from netcortex_detector.engine import ( + DetectorConfig, + DetectorUnavailable, + build_features, + detect, + run_engine, +) -__all__ = ["DetectorConfig", "DetectorUnavailable", "build_features"] +__all__ = ["DetectorConfig", "DetectorUnavailable", "build_features", "detect", "run_engine"] __version__ = "0.1.0" diff --git a/packages/detector/src/netcortex_detector/engine.py b/packages/detector/src/netcortex_detector/engine.py index 3203fa0..630bdcf 100644 --- a/packages/detector/src/netcortex_detector/engine.py +++ b/packages/detector/src/netcortex_detector/engine.py @@ -1,13 +1,22 @@ from __future__ import annotations import hashlib -import importlib from dataclasses import dataclass from datetime import datetime from typing import Any, Protocol import numpy as np import pandas as pd +from netcortex_core import ( + Cause, + DetectionResult, + ForecastPoint, + MetricsWindow, + ModuleUnavailable, + SeriesForecast, + Settings, + series_key, +) CAUSES = ( "uplink_congestion", @@ -23,7 +32,7 @@ IFACE_COLUMNS = {"time", "site_id", "iface", "util_pct", "drops", "errors"} -class DetectorUnavailable(RuntimeError): +class DetectorUnavailable(ModuleUnavailable): """The requested core or model integration is absent or failed.""" @@ -268,10 +277,10 @@ def run_engine( else: cause, confidence = backend.cause(vector) confidence = float(confidence) - raw_anomaly = float(backend.anomaly(vector)) - if not np.isfinite(confidence) or not np.isfinite(raw_anomaly): - raise DetectorUnavailable("backend returned a nonfinite score or confidence") - anomaly = float(np.clip(raw_anomaly, 0.0, 1.0)) + raw_anomaly = float(backend.anomaly(vector)) + if not np.isfinite(confidence) or not np.isfinite(raw_anomaly): + raise DetectorUnavailable("backend returned a nonfinite score or confidence") + anomaly = float(np.clip(raw_anomaly, 0.0, 1.0)) except Exception as exc: raise DetectorUnavailable( f"{backend.provenance} inference failed ({type(exc).__name__})" @@ -446,22 +455,95 @@ def _empty_result(site_id: str, at: pd.Timestamp, provenance: str, status: str) } -def detect(site_id: str, window: Any, history: Any) -> Any: - """Core-facing API; it binds only to Aun's real core contract when available.""" - try: - core = importlib.import_module("netcortex_core") - result_type = core.DetectionResult - required = ("probe_metrics", "iface_metrics", "as_of") - if any(not hasattr(window, name) for name in required): - raise AttributeError("MetricsWindow lacks probe_metrics, iface_metrics, or as_of") - except (ImportError, AttributeError) as exc: - raise DetectorUnavailable( - "public detect() is unavailable until netcortex_core publishes DetectionResult " - "and the approved MetricsWindow contract; use run_engine() with injected inputs" - ) from exc - raise DetectorUnavailable( - f"core adapter requires approved field mapping for {result_type.__name__}" +def detect(site_id: str, window: MetricsWindow, history: MetricsWindow) -> DetectionResult: + """Run detection on one site's observations and return the shared core contract.""" + if not isinstance(window, MetricsWindow) or not isinstance(history, MetricsWindow): + raise DetectorUnavailable("detect requires core MetricsWindow inputs") + if window.probe_metrics.empty or window.iface_metrics.empty: + raise DetectorUnavailable("probe and interface observations are required") + if not window.probe_metrics["site_id"].eq(site_id).all() or not window.iface_metrics[ + "site_id" + ].eq(site_id).all(): + raise DetectorUnavailable("metrics window contains rows for a different site") + + # Prior history is context only. It supplies observations, never labels or expected causes. + probes = _combine_observations(history.probe_metrics, window.probe_metrics) + interfaces = _combine_observations(history.iface_metrics, window.iface_metrics) + target_roles = { + target: ("dns:" + target[4:] if target.startswith("dns:") else target) + for target in probes.get("target", pd.Series(dtype=str)).dropna().astype(str).unique() + } + settings = Settings() + token = settings.tabpfn_token.get_secret_value() if settings.tabpfn_token else None + from netcortex_detector import providers + + backend = providers.TabPFNBackend( + settings.tabpfn_mode, access_token=token, timeout_s=settings.http_timeout_s ) + result = run_engine( + probes, + interfaces, + site_id=site_id, + as_of=window.as_of, + backend=backend, + config=DetectorConfig(target_roles=target_roles), + ) + if result["availability"] != "available": + raise DetectorUnavailable(f"detector data unavailable ({result['status']})") + + grouped: dict[str, list[ForecastPoint]] = {} + for row in result["forecasts"]: + metric = row["metric"] + key = _forecast_series_key(metric) + grouped.setdefault(key, []).append( + ForecastPoint( + time=pd.Timestamp(row["target_time"]).to_pydatetime(), + p10=row["p10"], + p50=row["p50"], + p90=row["p90"], + ) + ) + series = [ + SeriesForecast(series_key=key, points=sorted(points, key=lambda point: point.time)) + for key, points in sorted(grouped.items()) + ] + provenance = str(result["provenance"]) + is_fixture = provenance.startswith("fixture:") + mode = "mock" if is_fixture else settings.tabpfn_mode + model = "fixture_persistence" if is_fixture else backend.provenance + return DetectionResult( + is_anomaly=result["is_anomaly"], + score=result["anomaly_score"], + cause_guess=Cause(result["cause"]), + cause_confidence=result["cause_confidence"], + evidence=result["evidence"], + series=series, + model=model, + mode=mode, + ) + + +def _forecast_series_key(metric: str) -> str: + """Map a raw feature metric to the matching shared core series key.""" + for prefix, kind, field, role_prefix in ( + ("rtt_ms_", "probe", "rtt_ms", "target:"), + ("loss_pct_", "probe", "loss_pct", "target:"), + ("iface_util_pct_", "iface", "util_pct", "interface:"), + ): + if metric.startswith(prefix): + name = metric.removeprefix(prefix).removeprefix(role_prefix) + if not name: + break + return series_key(kind, name, field) + raise DetectorUnavailable("backend forecast metric cannot be mapped to a core series") + + +def _combine_observations(history: pd.DataFrame, current: pd.DataFrame) -> pd.DataFrame: + frames = [frame for frame in (history, current) if not frame.empty] + if not frames: + return current.copy() + combined = pd.concat(frames, ignore_index=True).drop_duplicates(keep="last") + return combined def fingerprint(frame: pd.DataFrame) -> str: diff --git a/packages/detector/tests/test_detector_core_contract.py b/packages/detector/tests/test_detector_core_contract.py new file mode 100644 index 0000000..5b1e287 --- /dev/null +++ b/packages/detector/tests/test_detector_core_contract.py @@ -0,0 +1,107 @@ +"""Lead-authored public contract mapping and failure cases.""" + +from datetime import UTC, datetime, timedelta + +import pandas as pd +import pytest +from netcortex_core import DetectionResult, MetricsWindow, ModuleUnavailable + +from netcortex_detector import engine + + +def test_detector_error_is_shared_module_unavailable(): + assert issubclass(engine.DetectorUnavailable, ModuleUnavailable) + + +def test_detect_rejects_missing_observations(): + window = MetricsWindow(as_of=datetime(2026, 10, 18, tzinfo=UTC)) + with pytest.raises(ModuleUnavailable): + engine.detect("north-tower", window, window) + + +def test_result_mapping_preserves_nested_series_and_has_no_db_writes(monkeypatch): + from netcortex_core import Settings, db + + from netcortex_detector import providers + + at = datetime(2026, 10, 18, 12, tzinfo=UTC) + times = pd.date_range(at - timedelta(minutes=20), at, freq="30s") + probes = pd.DataFrame( + { + "time": times, + "site_id": "north-tower", + "target": "dns:1.1.1.1", + "kind": "dns", + "rtt_ms": 30.0, + "jitter_ms": 2.0, + "loss_pct": 0.0, + "source": "sim", + } + ) + interfaces = pd.DataFrame( + { + "time": times, + "site_id": "north-tower", + "iface": "ether1", + "rx_bps": 100, + "tx_bps": 100, + "util_pct": 40.0, + "drops": 0, + "errors": 0, + "source": "sim", + } + ) + window = MetricsWindow(as_of=at, probe_metrics=probes, iface_metrics=interfaces) + monkeypatch.setattr(engine, "Settings", lambda: Settings(_env_file=None), raising=False) + + monkeypatch.setattr( + providers, "TabPFNBackend", lambda *args, **kwargs: providers.FixtureBackend() + ) + + def forbidden(*args, **kwargs): + pytest.fail("detect must not persist forecasts") + + monkeypatch.setattr(db, "upsert_forecasts", forbidden) + + def result(*args, **kwargs): + return { + "status": "ok", + "availability": "available", + "is_anomaly": True, + "anomaly_score": 0.91, + "cause": "dns_slow", + "cause_confidence": 0.8, + "evidence": ["Measured lookup time increased"], + "provenance": "fixture: contract test; no model inference", + "forecasts": [ + { + "metric": "rtt_ms_target:dns:1.1.1.1", + "horizon_minutes": h, + "made_at": at.isoformat(), + "target_time": (at + timedelta(minutes=h)).isoformat(), + "p10": 20.0, + "p50": 30.0, + "p90": 40.0, + } + for h in range(1, 6) + ], + } + + real_engine = engine.run_engine + monkeypatch.setattr(engine, "run_engine", result) + detection = engine.detect("north-tower", window, window) + assert isinstance(detection, DetectionResult) + assert detection.score == 0.91 and detection.cause_guess.value == "dns_slow" + assert detection.mode == "mock" + assert detection.series[0].series_key == "probe:dns:1.1.1.1:rtt_ms" + assert [p.time for p in detection.series[0].points] == [ + at + timedelta(minutes=h) for h in range(1, 6) + ] + + # Exercise the feature builder too: canonical keys must survive actual engine names. + monkeypatch.setattr(engine, "run_engine", real_engine) + actual = engine.detect("north-tower", window, window) + keys = {item.series_key for item in actual.series} + assert "probe:dns:1.1.1.1:rtt_ms" in keys + assert "iface:ether1:util_pct" in keys + assert all(len(item.points) == 5 for item in actual.series) diff --git a/packages/detector/tests/test_engine.py b/packages/detector/tests/test_engine.py index bcdfcad..f8d53eb 100644 --- a/packages/detector/tests/test_engine.py +++ b/packages/detector/tests/test_engine.py @@ -212,8 +212,8 @@ def forecasts(self, history, horizon): assert backend.seen <= 7 -def test_public_core_adapter_fails_clearly_when_core_missing(): - with pytest.raises(DetectorUnavailable, match="netcortex_core"): +def test_public_core_adapter_rejects_non_core_windows(): + with pytest.raises(DetectorUnavailable, match="MetricsWindow"): detect("s1", object(), object()) diff --git a/packages/notify/README.md b/packages/notify/README.md index 65e9f9a..d516973 100644 --- a/packages/notify/README.md +++ b/packages/notify/README.md @@ -1,9 +1,5 @@ -# netcortex-notify +# Notifications -` speak(text, lang)` generates a short MP3 through ElevenLabs `eleven_v3`, which lists Urdu support. ElevenLabs documents that `eleven_multilingual_v2` does not support `language_code`, so it is not selected. Missing voice credentials return empty bytes to represent unavailable voice; HTTP failures and rate limits remain errors. +`check_news(provider, target)` checks recent provider outage reports through SerpApi and returns the shared core `NewsCheck` schema. Unavailable searches set `available: false` and never claim that no outage exists. Relative search dates are converted to timezone-aware datetimes. The package imports actual `netcortex_core` contracts and unwraps the SerpApi `SecretStr` only at the HTTP boundary. -`check_news(provider, target)` uses SerpApi Google search with `tbs=qdr:d`, then validates result shape, relative/ISO dates, and safe HTTP(S) URLs. A failed lookup produces `available: false` explicitly and never claims there was no outage. The public functions await Aun's `netcortex_core.Settings` and `NewsCheck` contract. Internal helpers accept passed credentials and are usable offline without shadow settings. - -Fixture examples: `python -m netcortex_notify.cli speak "Uplink is degraded" --lang en --mock` and `python -m netcortex_notify.cli news ExampleISP game-server --mock`. They only report unavailable fixtures and make no network requests. `live-speak` and `live-news` invoke the public core-gated functions. - -Live smoke steps: configure test credentials through the eventual core Settings, make one short English and one Urdu alert and verify MP3 playback, then query a known provider and target. Exercise missing keys and rate limits separately. No live credentials or external calls were used on this branch. +Offline fixture: `python -m netcortex_notify.cli news ExampleISP game-server --mock`. Live command: `python -m netcortex_notify.cli live-news ExampleISP game-server`. Tests use mocked HTTP responses and do not require credentials. Network timeouts and response size are bounded. diff --git a/packages/notify/decision.md b/packages/notify/decision.md index b4d07e5..689818e 100644 --- a/packages/notify/decision.md +++ b/packages/notify/decision.md @@ -1,11 +1,5 @@ -# Notification design decisions +# Decisions -Voice uses ElevenLabs' HTTP text-to-speech endpoint with `eleven_v3`. Current official model documentation lists Urdu for v3; the API reference says `language_code` is unsupported by `eleven_multilingual_v2`, so v2 is not selected. The MP3 `output_format` is an endpoint query parameter. English and Urdu are the only accepted language values, and alerts are limited to 40 words. +News uses SerpApi Google search with a one-day filter. Missing credentials, timeouts, provider errors, malformed JSON, and malformed result structures return the shared `NewsCheck` with `available=False`; they never claim no outage. Valid searches with no qualifying recent links return `available=True`, `outage_reported=False`. SerpApi relative dates are normalized to timezone-aware UTC datetimes before creating core `NewsItem` objects. -Missing voice credentials produce empty bytes. Provider timeouts, HTTP failures, rate limits, and malformed audio are logged by exception class only and produce empty bytes in the public `speak()` wrapper so an incident alert does not wait on voice. Input validation and missing shared Settings remain explicit errors. The internal adapter retains provider errors so tests and callers can inspect them. - -SerpApi Google Search uses `tbs=qdr:d`; returned relative or ISO dates are checked against a 24-hour window. A result must have an absolute HTTP(S) URL without embedded credentials. Recent results alone do not assert an outage: text must mention a supplied provider or target and contain outage language. Search text remains untrusted evidence and the summary asks the operator to verify. No HTML or result content is fetched. - -Missing news credentials, timeout, rate limit, provider/API error, malformed JSON, or malformed result structure returns an explicit unavailable summary. A valid search with no qualifying recent links is a successful check with a distinct no-reports summary. The shared draft `NewsCheck` carries `outage_reported`, `summary`, and `items`; unavailable state is spelled out in the summary while `outage_reported` remains false. - -Internal adapters accept explicit credentials and injected `httpx.Client` instances. Public functions read only the eventual `netcortex_core.Settings` and return Aun's shared schemas. There is no package-local Settings class or environment-variable fallback. Fixture commands make no HTTP calls and cannot claim real provider results. +The public function imports the actual core `Settings`, `NewsCheck`, and `NewsItem` contracts. It unwraps `SecretStr` only when passing the SerpApi key to the HTTP request. The internal helper takes explicit credentials and an injectable `httpx.Client`, so tests stay offline. Fixture CLI commands make no HTTP calls and cannot claim a provider was checked. diff --git a/packages/notify/flow.md b/packages/notify/flow.md index cb451ab..62ee12f 100644 --- a/packages/notify/flow.md +++ b/packages/notify/flow.md @@ -1,31 +1,9 @@ -# Notification execution flow +# Flow -## Entry points +`python -m netcortex_notify.cli news ExampleISP game-server --mock` runs an offline unavailable-news fixture. `python -m netcortex_notify.cli live-news ExampleISP game-server` invokes the public live search. -- `python -m netcortex_notify.cli speak "Uplink is degraded" --lang en --mock` runs the offline unavailable-voice fixture. -- `python -m netcortex_notify.cli news ExampleISP game-server --mock` runs the offline unavailable-news fixture. -- `netcortex_notify.speak(text, lang)` is the public live voice function; it awaits `netcortex_core.Settings` fields `elevenlabs_api_key` and `elevenlabs_voice_id`. -- `netcortex_notify.check_news(provider, target)` is the public live search function; it awaits `Settings.serpapi_api_key` and core `NewsCheck` and `NewsItem` exports. -- Internal `_speak` and `_check_news` accept explicit credentials and optional injected `httpx.Client`; tests use `httpx.MockTransport` and do not access a network. +`netcortex_notify.check_news(provider, target)` reads shared `Settings.serpapi_api_key` and returns core `NewsCheck` and `NewsItem` objects. The secret is unwrapped only when passed to SerpApi. `_check_news` accepts explicit credentials and an optional injected `httpx.Client`; tests use `httpx.MockTransport` and make no network calls. -## Voice path +The helper calls SerpApi Google search with a one-day filter, a finite connection and request timeout, an 8-second response deadline, and a 1 MB body cap. It retains only safe absolute HTTP(S) URLs with recent dates, up to five items. Relative or ISO dates become aware UTC datetimes before constructing `NewsItem`. Outage wording alone does not mark an outage: the supplied provider or target must also appear in the result. A valid empty search is available with no outage claim. Missing credentials, timeouts, provider errors, malformed JSON, or malformed result structures return `available=False` with an explicit unavailable summary. -```mermaid -flowchart TD - A[text + en/ur] --> B{1-40 words?} - B -->|No| C[ValueError] - B -->|Yes| D{Key and voice ID?} - D -->|No| E[Return empty bytes: unavailable] - D -->|Yes| F[POST api.elevenlabs.io/v1/text-to-speech/{voice_id}] - F --> G[eleven_v3 + language_code + MP3 format] - G --> H[HTTP/status/content validation] - H --> I[MP3 bytes] -``` - -The call uses finite connection and per-operation timeouts plus a 12-second response-body deadline and 1 MB body cap, with no automatic retry or redirects. MP3 format is sent as the endpoint's `output_format` query parameter. The public wrapper catches provider/time-limit/audio-response failures, logs only the exception class, and returns empty bytes so alerts do not block an incident. Invalid caller inputs and missing core Settings still fail explicitly. The fixture path supplies no keys and sends no HTTP request. - -## News path - -The helper accepts optional provider and target values; both absent returns an unavailable result without a request. Otherwise it calls `https://serpapi.com/search.json` with Google engine, available query terms, `tbs=qdr:d`, and the passed API key. The key is sent as a request parameter per SerpApi's API contract and must never be logged. Result items are parsed defensively from a streamed response capped at 1 MB with an 8-second body deadline and finite connection/per-operation timeouts. Only recent (relative or ISO) dates and absolute safe HTTP(S) URLs survive. Up to five items are returned with title, URL, and published date. `outage_reported` requires supplied provider/target text and outage wording; recent dates alone do not assert an outage. Valid zero results produce a successful no-reports summary; any unavailable or malformed call returns `available=false` internally and an explicit unavailable summary. Public output is constructed from Aun's actual core `NewsItem` and `NewsCheck` types; no local schema is defined. - -Core imports are delayed until the public live entry point is called. Until the shared package and field names are published, those functions raise a clear `RuntimeError`. Fixture CLI outputs are dictionaries, visibly marked as fixture/unavailable, and never claim a provider was checked or an outage was confirmed. +Core contracts are imported directly from `netcortex_core`; there are no local copies or runtime discovery. Fixture CLI output is marked unavailable and makes no HTTP call. diff --git a/packages/notify/pyproject.toml b/packages/notify/pyproject.toml index a5c83e2..d52722c 100644 --- a/packages/notify/pyproject.toml +++ b/packages/notify/pyproject.toml @@ -5,9 +5,9 @@ build-backend = "hatchling.build" [project] name = "netcortex-notify" version = "0.1.0" -description = "Voice alerts and upstream outage checks for NetCortex" +description = "Upstream outage checks for NetCortex" requires-python = ">=3.12,<3.13" -dependencies = ["httpx>=0.27,<1"] +dependencies = ["httpx>=0.27,<1", "netcortex-core"] [project.optional-dependencies] test = ["pytest>=8,<9"] diff --git a/packages/notify/src/netcortex_notify/__init__.py b/packages/notify/src/netcortex_notify/__init__.py index 0111c78..4591bbb 100644 --- a/packages/notify/src/netcortex_notify/__init__.py +++ b/packages/notify/src/netcortex_notify/__init__.py @@ -1,5 +1,5 @@ -"""Voice and upstream-news helpers.""" +"""Upstream-news checks.""" -from .service import check_news, speak +from .service import check_news -__all__ = ["check_news", "speak"] +__all__ = ["check_news"] diff --git a/packages/notify/src/netcortex_notify/cli.py b/packages/notify/src/netcortex_notify/cli.py index 53ab070..cf0e6b1 100644 --- a/packages/notify/src/netcortex_notify/cli.py +++ b/packages/notify/src/netcortex_notify/cli.py @@ -1,35 +1,22 @@ import argparse import json -from .service import _check_news, _speak, check_news, speak +from .service import _check_news, check_news def main() -> None: parser = argparse.ArgumentParser(description="Offline-safe notification fixture CLI") sub = parser.add_subparsers(dest="command", required=True) - voice = sub.add_parser("speak") - voice.add_argument("text") - voice.add_argument("--lang", choices=["en", "ur"], default="en") - voice.add_argument("--mock", action="store_true", required=True) news = sub.add_parser("news") news.add_argument("provider", nargs="?") news.add_argument("target", nargs="?") news.add_argument("--mock", action="store_true", required=True) - live_voice = sub.add_parser("live-speak") - live_voice.add_argument("text") - live_voice.add_argument("--lang", choices=["en", "ur"], default="en") live_news = sub.add_parser("live-news") live_news.add_argument("provider", nargs="?") live_news.add_argument("target", nargs="?") args = parser.parse_args() - if args.command == "speak": - data = _speak(args.text, args.lang, api_key=None, voice_id=None) - print(json.dumps({"available": bool(data), "fixture": True, "bytes": len(data)})) - elif args.command == "news": + if args.command == "news": print(json.dumps(_check_news(args.provider, args.target, api_key=None), indent=2)) - elif args.command == "live-speak": - data = speak(args.text, args.lang) - print(json.dumps({"available": bool(data), "bytes": len(data)})) else: print(check_news(args.provider, args.target).model_dump_json(indent=2)) diff --git a/packages/notify/src/netcortex_notify/service.py b/packages/notify/src/netcortex_notify/service.py index 59f3249..8a6b4ab 100644 --- a/packages/notify/src/netcortex_notify/service.py +++ b/packages/notify/src/netcortex_notify/service.py @@ -1,22 +1,21 @@ from __future__ import annotations import json -import logging import re import time from datetime import UTC, datetime, timedelta -from typing import TYPE_CHECKING, Any +from typing import Any from urllib.parse import urlparse import httpx +from netcortex_core import NewsCheck, NewsItem, Settings -if TYPE_CHECKING: - from netcortex_core import NewsCheck # type: ignore[import-not-found] - -VOICE_MODEL = "eleven_v3" # official docs list Urdu for v3; multilingual_v2 lacks Urdu support -ELEVEN_URL = "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}" SERP_URL = "https://serpapi.com/search.json" -logger = logging.getLogger(__name__) + + +def _load_settings() -> Settings: + """Load the shared core settings for the public entry point.""" + return Settings() def _read_body(response: httpx.Response, *, max_bytes: int, total_seconds: float) -> bytes: @@ -31,75 +30,6 @@ def _read_body(response: httpx.Response, *, max_bytes: int, total_seconds: float return bytes(body) -def _load_settings() -> Any: - try: - from netcortex_core import Settings # type: ignore[import-not-found] - except ImportError as exc: - raise RuntimeError( - "live notification calls require Aun's published netcortex_core.Settings" - ) from exc - return Settings() - - -def _speak( - text: str, - lang: str, - *, - api_key: str | None, - voice_id: str | None, - client: httpx.Client | None = None, -) -> bytes: - if lang not in {"en", "ur"}: - raise ValueError("lang must be 'en' or 'ur'") - if not text.strip() or len(text.split()) > 40: - raise ValueError("voice alert must contain 1..40 words") - if not api_key or not voice_id: - return b"" - own = client is None - client = client or httpx.Client(timeout=httpx.Timeout(3, connect=2), follow_redirects=False) - try: - with client.stream( - "POST", - ELEVEN_URL.format(voice_id=voice_id), - params={"output_format": "mp3_44100_128"}, - headers={ - "xi-api-key": api_key, - "Accept": "audio/mpeg", - "Content-Type": "application/json", - }, - json={ - "text": text, - "model_id": VOICE_MODEL, - "language_code": "ur" if lang == "ur" else "en", - }, - ) as response: - if response.status_code == 429: - raise RuntimeError("ElevenLabs rate limit; voice is unavailable") - response.raise_for_status() - content_type = response.headers.get("content-type", "").lower() - if content_type and "audio/" not in content_type and "octet-stream" not in content_type: - raise RuntimeError("ElevenLabs returned a non-audio response") - audio = _read_body(response, max_bytes=1_000_000, total_seconds=12) - if not audio: - raise RuntimeError("ElevenLabs returned an empty audio response") - return audio - finally: - if own: - client.close() - - -def speak(text: str, lang: str) -> bytes: - """Return MP3 bytes; an unconfigured voice service is safely unavailable as b''.""" - settings = _load_settings() - try: - return _speak( - text, lang, api_key=settings.elevenlabs_api_key, voice_id=settings.elevenlabs_voice_id - ) - except (httpx.HTTPError, RuntimeError) as exc: - logger.warning("ElevenLabs voice unavailable (%s)", type(exc).__name__) - return b"" - - def _safe_url(value: Any) -> str | None: if not isinstance(value, str): return None @@ -114,38 +44,38 @@ def _safe_url(value: Any) -> str | None: return value -def _recent_date(value: Any, now: datetime) -> bool: +def _published_date(value: Any, now: datetime) -> datetime | None: if not isinstance(value, str) or not value.strip(): - return False - # SerpApi commonly gives relative labels; accept explicit recent durations and ISO dates. + return None text = value.strip().lower() - if text in { - "today", - "1 hour ago", - "2 hours ago", - "3 hours ago", - "4 hours ago", - "5 hours ago", - "6 hours ago", - "12 hours ago", - }: - return True try: parsed = datetime.fromisoformat(text.replace("z", "+00:00")) if parsed.tzinfo is None: parsed = parsed.replace(tzinfo=UTC) - return now - timedelta(hours=24) <= parsed.astimezone(UTC) <= now + timedelta(minutes=5) + parsed = parsed.astimezone(UTC) + return parsed if now - timedelta(hours=24) <= parsed <= now + timedelta(minutes=5) else None except ValueError: pass + if text == "today": + parsed = now.astimezone(UTC).replace(hour=0, minute=0, second=0, microsecond=0) + return parsed + if text == "yesterday": + return now.astimezone(UTC) - timedelta(hours=24) match = re.fullmatch(r"(\d+)\s*(minute|hour|day)s?\s+ago", text) if match: amount = int(match.group(1)) - return ( - (match.group(2) == "minute" and amount <= 1440) - or (match.group(2) == "hour" and amount <= 24) - or (match.group(2) == "day" and amount == 1) - ) - return False + delta = { + "minute": timedelta(minutes=amount), + "hour": timedelta(hours=amount), + "day": timedelta(days=amount), + }[match.group(2)] + if delta <= timedelta(hours=24): + return now.astimezone(UTC) - delta + return None + + +def _recent_date(value: Any, now: datetime) -> bool: + return _published_date(value, now) is not None def _check_news( @@ -213,7 +143,10 @@ def _check_news( r"\b(?:outages?|down|degraded|disruptions?|unavailable|failures?|incidents?|offline)\b" ) for item in items: - if not isinstance(item, dict) or not _recent_date(item.get("date"), timestamp): + if not isinstance(item, dict): + continue + published = _published_date(item.get("date"), timestamp) + if published is None: continue url = _safe_url(item.get("link")) title = item.get("title") @@ -222,7 +155,7 @@ def _check_news( { "title": title.strip()[:200], "url": url, - "published": str(item.get("date", ""))[:100], + "published": published.isoformat(), } ) snippet = str(item.get("snippet", "")) @@ -264,19 +197,22 @@ def _check_news( def check_news(provider: str | None, target: str | None) -> NewsCheck: - """Search recent outage reports and return core NewsCheck once the shared contract exists.""" + """Search recent outage reports and return the shared core contract.""" settings = _load_settings() - result = _check_news(provider, target, api_key=settings.serpapi_api_key) - try: - from netcortex_core import NewsCheck, NewsItem # type: ignore[import-not-found] - except ImportError as exc: - raise RuntimeError( - "check_news requires Aun's published netcortex_core.NewsCheck and NewsItem contracts" - ) from exc + api_key = settings.serpapi_api_key.get_secret_value() if settings.serpapi_api_key else None + result = _check_news(provider, target, api_key=api_key) + timestamp = datetime.now(UTC) items = [ - NewsItem(title=item["title"], url=item["url"], published=item["published"]) + NewsItem( + title=item["title"], + url=item["url"], + published=_published_date(item.get("published"), timestamp), + ) for item in result["links"] ] return NewsCheck( - outage_reported=result.get("outage_reported", False), summary=result["summary"], items=items + available=result["available"], + outage_reported=result.get("outage_reported", False), + summary=result["summary"], + items=items, ) diff --git a/packages/notify/tests/test_notify.py b/packages/notify/tests/test_notify.py index 10f6a3b..730aa1e 100644 --- a/packages/notify/tests/test_notify.py +++ b/packages/notify/tests/test_notify.py @@ -1,61 +1,9 @@ -import sys from datetime import UTC, datetime -from types import SimpleNamespace import httpx import pytest from netcortex_notify import service -from netcortex_notify.service import _check_news, _read_body, _recent_date, _safe_url, _speak - - -def test_speak_missing_keys_and_validation(): - assert _speak("alert", "en", api_key=None, voice_id=None) == b"" - with pytest.raises(ValueError): - _speak("hello", "fr", api_key=None, voice_id=None) - with pytest.raises(ValueError): - _speak("word " * 41, "en", api_key=None, voice_id=None) - - -def test_speak_validates_audio_and_propagates_rate_limit(): - def audio(request): - assert request.url.params["output_format"] == "mp3_44100_128" - return httpx.Response(200, headers={"content-type": "audio/mpeg"}, content=b"mp3") - - client = httpx.Client(transport=httpx.MockTransport(audio)) - assert _speak("short alert", "ur", api_key="test", voice_id="voice", client=client) == b"mp3" - client.close() - - -def test_speak_non_audio_timeout_and_public_failure_are_safe(monkeypatch): - client = httpx.Client( - transport=httpx.MockTransport( - lambda request: httpx.Response( - 200, headers={"content-type": "application/json"}, content=b"{}" - ) - ) - ) - with pytest.raises(RuntimeError, match="non-audio"): - _speak("short alert", "en", api_key="test", voice_id="voice", client=client) - client.close() - client = httpx.Client( - transport=httpx.MockTransport( - lambda request: (_ for _ in ()).throw(httpx.ReadTimeout("simulated")) - ) - ) - with pytest.raises(httpx.ReadTimeout): - _speak("short alert", "en", api_key="test", voice_id="voice", client=client) - client.close() - monkeypatch.setattr( - service, - "_load_settings", - lambda: SimpleNamespace(elevenlabs_api_key="test", elevenlabs_voice_id="voice"), - ) - monkeypatch.setattr( - service, - "_speak", - lambda *args, **kwargs: (_ for _ in ()).throw(httpx.ReadTimeout("simulated")), - ) - assert service.speak("short alert", "en") == b"" +from netcortex_notify.service import _check_news, _read_body, _recent_date, _safe_url def test_response_reader_enforces_total_deadline(monkeypatch): @@ -98,10 +46,6 @@ def test_news_does_not_flag_unrelated_or_non_outage_results(): result = _check_news("ExampleISP", "game", api_key="test", client=client) assert result["outage_reported"] is False client.close() - client = httpx.Client(transport=httpx.MockTransport(lambda request: httpx.Response(429))) - with pytest.raises(RuntimeError, match="rate limit"): - _speak("short alert", "en", api_key="test", voice_id="voice", client=client) - client.close() def test_news_timeout_is_unavailable(): @@ -124,19 +68,9 @@ def test_news_missing_key_and_unsafe_urls_are_not_outages(): def test_public_check_news_preserves_unavailable_state(monkeypatch): - class NewsCheck: - def __init__(self, *, outage_reported, summary, items): - self.outage_reported = outage_reported - self.summary = summary - self.items = items - - class NewsItem: - def __init__(self, **fields): - self.fields = fields - - core = SimpleNamespace(NewsCheck=NewsCheck, NewsItem=NewsItem) - monkeypatch.setitem(sys.modules, "netcortex_core", core) - monkeypatch.setattr(service, "_load_settings", lambda: SimpleNamespace(serpapi_api_key=None)) + from netcortex_core import Settings + + monkeypatch.setattr(service, "_load_settings", lambda: Settings(_env_file=None)) result = service.check_news("isp", None) assert result.outage_reported is False assert "unavailable" in result.summary.lower() diff --git a/packages/notify/tests/test_notify_core_contract.py b/packages/notify/tests/test_notify_core_contract.py new file mode 100644 index 0000000..c1d480e --- /dev/null +++ b/packages/notify/tests/test_notify_core_contract.py @@ -0,0 +1,45 @@ +"""Lead-written behavioral acceptance cases for the real core boundary.""" + +from netcortex_core import NewsCheck, Settings +from netcortex_notify import service + + +def test_public_news_unavailable_is_not_success(monkeypatch): + monkeypatch.setattr(service, "_load_settings", lambda: Settings(_env_file=None)) + result = service.check_news("ExampleISP", "Dubai") + assert isinstance(result, NewsCheck) + assert result.available is False + assert not result.outage_reported + + +def test_news_unwraps_secret_and_normalizes_relative_date(monkeypatch): + settings = Settings(_env_file=None, serpapi_api_key="synthetic-test-value") + monkeypatch.setattr(service, "_load_settings", lambda: settings) + + def search(provider, target, *, api_key, **kwargs): + assert api_key == "synthetic-test-value" + return { + "available": True, + "outage_reported": True, + "summary": "Reported outage", + "links": [ + { + "title": "ExampleISP outage", + "url": "https://example.com/news", + "published": "2 hours ago", + } + ], + } + + monkeypatch.setattr(service, "_check_news", search) + result = service.check_news("ExampleISP", "Dubai") + assert isinstance(result, NewsCheck) + assert result.available and result.items[0].published is not None + assert result.items[0].published.tzinfo is not None + + +def test_voice_public_export_removed(): + import netcortex_notify + + assert not hasattr(netcortex_notify, "speak") + assert not hasattr(service, "speak") diff --git a/packages/runbook/README.md b/packages/runbook/README.md index c85def2..64f50f7 100644 --- a/packages/runbook/README.md +++ b/packages/runbook/README.md @@ -1,9 +1,5 @@ -# netcortex-runbook +# Runbook retrieval -Official MikroTik RouterOS documentation ingestion and pgvector retrieval. The ingestion allowlist is limited to `help.mikrotik.com`, checks `robots.txt`, uses finite HTTP/database timeouts, caps downloads at 2 MB, and chunks source text with headings. The ingest transaction takes an advisory lock and checks approved content columns before inserting, because the shared schema has no natural uniqueness constraint. It does not change the shared schema. +Offline example: `python -m netcortex_runbook.cli fixture "failover default route" --mock`. Fixture excerpts are marked and do not use EmbeddingGemma. Live `runbook search QUERY` embeds through Ollama and queries pgvector; `runbook ingest` fetches approved MikroTik documentation and indexes it. Both use the actual core `Settings` and require a database URL and Ollama service. Search returns core `RunbookChunk` objects with cosine similarity scores (`1 - distance`); failures raise `ModuleUnavailable`. -The exact Ollama model must be passed/configured as a full `embeddinggemma:` value. No default tag is guessed while Aun's shared tag decision is pending. Ingestion and search reject a different returned model and any embedding dimension other than 768. Search ranks by vector distance only. - -Offline illustration (fixture excerpts link to official pages and do not use EmbeddingGemma): `python -m netcortex_runbook.cli fixture "failover default route" --mock`. This CLI labels every item as a fixture and includes source titles and retrieval date. Live `search_runbook(query, k=5)` awaits Aun's `netcortex_core.Settings` and `RunbookChunk` exports; it fails explicitly until those exist. Live CLI operations are `runbook search QUERY` and `runbook ingest`; both consume only shared core Settings. - -Live smoke steps: provision approved core/schema and an isolated database; run Ollama with the agreed exact EmbeddingGemma tag; call `ingest`; repeat it and check row count is unchanged; query each of the four topics in the validation plan and verify the right page in top three. Those live checks have not been run on this branch. +The shared model is `EMBED_MODEL=embeddinggemma`, with 768 dimensional vectors. Search embeds the query before accessing the database. No live ingestion or search has been run on this branch. diff --git a/packages/runbook/decision.md b/packages/runbook/decision.md index 0345495..5859a6d 100644 --- a/packages/runbook/decision.md +++ b/packages/runbook/decision.md @@ -1,11 +1,7 @@ -# Runbook design decisions +# Decisions -The indexer reads only official MikroTik RouterOS pages from `help.mikrotik.com`. It checks that host's `robots.txt`, rejects redirects outside the official HTTPS host, and caps each page at 2 MB while streaming. The source set is finite: queues, route, failover, DNS, mangle, and interface stats/traffic. Every HTTP request has finite connect/read/write/pool timeouts. The indexer honors the crawl delay advertised by robots.txt between page fetches. +Search uses pgvector cosine distance and returns the actual core `RunbookChunk` schema with higher-is-better `score=1-distance`. No keyword fallback is used, so an empty list means no matching rows. The package imports `Settings`, `RunbookChunk`, and `ModuleUnavailable` directly from core. -Chunking targets 400 words and accepts configured sizes only from 300 through 500. Section titles remain in metadata. The vector model is supplied explicitly from the approved shared Settings; there is no guessed default while Aun's exact model tag decision is pending. The configured value must be a full `embeddinggemma:`, and Ollama's returned model must match it exactly. Every vector must contain 768 finite numbers. +`EMBED_MODEL=embeddinggemma` is the shared default and is sent unchanged to Ollama. Ollama's equivalent response alias `embeddinggemma:latest` is accepted only for that bare requested model; a different model or tag fails explicitly. Every returned vector must have 768 finite numeric dimensions. -The current `runbook_chunks` schema has no natural unique key. Indexing therefore takes a transaction-scoped advisory lock and selects by source URL, title, section, text, and model before inserting. The model is part of the key so an approved model change cannot silently reuse the old embedding. Writes use only the shared columns; this package does not alter the schema. PostgreSQL connection and statement deadlines are both finite. - -Search uses pgvector cosine distance only. Keyword fallback is omitted so the order and score remain clear. Results are instantiated as Aun's `RunbookChunk` with source URL and higher-is-better score `1 - distance`. No local copy of that schema is defined. Live search waits for Aun's `netcortex_core.Settings` and `RunbookChunk` exports and fields. - -Fixture excerpts are manually written, source-linked paraphrases checked against official MikroTik docs. Each has source title, retrieval date, and `fixture=true`. They are lexical examples only; no model vectors are used and their tests do not establish live search quality. +Database credentials are unwrapped from `SecretStr` only at the psycopg connection boundary. Provider, database, and model failures from live search raise `ModuleUnavailable` with exception details suppressed to the class name, so credentials in driver messages are not surfaced. diff --git a/packages/runbook/flow.md b/packages/runbook/flow.md index 795ea70..0a12530 100644 --- a/packages/runbook/flow.md +++ b/packages/runbook/flow.md @@ -1,30 +1,7 @@ -# Runbook execution flow +# Flow -## Entry points +`python -m netcortex_runbook.cli fixture QUERY --mock` prints explicit offline fixture excerpts. `runbook search QUERY` uses the actual core `Settings`, embeds through Ollama, queries `runbook_chunks`, and serializes core `RunbookChunk` records. `runbook ingest` reads the same settings, fetches the approved official MikroTik pages, embeds chunks, and upserts them. Both live operations require the configured database and Ollama service. -- `python -m netcortex_runbook.cli fixture "failover default route" --mock [-k 3]` performs offline lexical fixture search. `--mock` is required by the CLI. -- `netcortex_runbook.service.fixture_search(query, k=3)` is the same fixture adapter in Python. -- `netcortex_runbook.search_runbook(query, k=5)` is the public live function. It requires Aun's published `netcortex_core.Settings` and `netcortex_core.RunbookChunk` and settings fields `database_url`, `ollama_base_url`, `embed_model`. -- `netcortex_runbook.ingest(database_url=..., ollama_base_url=..., embed_model=...)` fetches and indexes the finite source allowlist. It can take an injected `httpx.Client` for tests. The model argument is required; no default tag is assumed before Aun confirms it. +`search_runbook(query, k=5)` validates query and result count, sends `Settings.embed_model` unchanged, verifies 768 finite dimensions, then orders rows by pgvector cosine distance. Results carry `score=1-distance`; an empty list means no matches. The configured model is exactly `embeddinggemma` by default. Ollama's equivalent `embeddinggemma:latest` response alias is accepted only when the request used the bare default; unrelated tags fail. -## Live indexing path - -```mermaid -flowchart TD - A[Approved MikroTik URL] --> B[GET official robots.txt] - B --> C[GET page: HTTPS, max 2 MB, finite timeout] - C --> D[Extract title, headings, paragraphs, list items] - D --> E[300-500 word chunks with section] - E --> F[Ollama POST /api/embed] - F --> G[Check configured model identity and 768 finite values] - G --> H[Postgres transaction + advisory lock] - H --> I[Select by source/title/section/text/model; insert if absent] -``` - -Only `help.mikrotik.com` URLs are accepted. Current source areas are queues, route, DNS, and mangle. Ollama is called at `/api/embed` with `{model, input}` using the explicit configured full model tag. The tag must be in the `embeddinggemma` family, the response tag must match exactly, and the first embedding must have 768 finite numeric values. PostgreSQL writes only `runbook_chunks(id, source_url, title, section, text, embedding, embed_model)`; the vector is serialized for pgvector. Same-content rows with the same model tag are left untouched; another tag is a distinct row. The batch is one transaction with a 5-second statement timeout and connect timeout and rolls back on failure. - -## Live query path - -`search_runbook` validates non-empty query and `k` from 1 through 20, imports the actual core contracts, checks the configured tag, embeds the query, and selects the nearest rows with `ORDER BY embedding <=> query_vector LIMIT k`. It returns a list of core `RunbookChunk` objects with source URL and `score=1-distance`. There is no keyword mode. - -Input validation raises `ValueError`; blocked robots, HTTP/database/model errors, dimension mismatch, or tag mismatch fail explicitly. Missing core exports/settings raise `RuntimeError` naming the unavailable contract. No fallback fixture result is returned from the live function. The offline CLI makes no network or database request and marks every result as a fixture. +The shared `Settings`, `RunbookChunk`, and `ModuleUnavailable` contracts are direct imports from `netcortex_core`. `database_url` remains a `SecretStr` until psycopg receives it. A missing URL or live search provider/database/model failure raises `ModuleUnavailable`; the exception message includes only the failure class, not a potentially credential-bearing provider message. Invalid query or `k` raises `ValueError`. Fixture search performs no network or database calls and marks each result as a fixture. diff --git a/packages/runbook/pyproject.toml b/packages/runbook/pyproject.toml index 2fee871..c876c98 100644 --- a/packages/runbook/pyproject.toml +++ b/packages/runbook/pyproject.toml @@ -7,7 +7,7 @@ name = "netcortex-runbook" version = "0.1.0" description = "Official RouterOS documentation retrieval for NetCortex" requires-python = ">=3.12,<3.13" -dependencies = ["beautifulsoup4>=4.12,<5", "httpx>=0.27,<1", "psycopg[binary]>=3.2,<4"] +dependencies = ["beautifulsoup4>=4.12,<5", "httpx>=0.27,<1", "netcortex-core", "psycopg[binary]>=3.2,<4"] [project.optional-dependencies] test = ["pytest>=8,<9"] diff --git a/packages/runbook/src/netcortex_runbook/cli.py b/packages/runbook/src/netcortex_runbook/cli.py index a35dd2f..055bcdd 100644 --- a/packages/runbook/src/netcortex_runbook/cli.py +++ b/packages/runbook/src/netcortex_runbook/cli.py @@ -1,6 +1,8 @@ import argparse import json +from netcortex_core import ModuleUnavailable, Settings + from .service import fixture_search, ingest, search_runbook @@ -23,16 +25,12 @@ def main() -> None: elif args.command == "search": output = [item.model_dump() for item in search_runbook(args.query, args.k)] else: - try: - from netcortex_core import Settings # type: ignore[import-not-found] - except ImportError as exc: - raise RuntimeError( - "live indexing requires Aun's published netcortex_core.Settings" - ) from exc settings = Settings() + if settings.database_url is None: + raise ModuleUnavailable("runbook ingest unavailable: database URL is not configured") output = { "indexed_chunks": ingest( - database_url=settings.database_url, + database_url=settings.database_url.get_secret_value(), ollama_base_url=settings.ollama_base_url, embed_model=settings.embed_model, ) diff --git a/packages/runbook/src/netcortex_runbook/service.py b/packages/runbook/src/netcortex_runbook/service.py index 3ba919d..ccd5ab5 100644 --- a/packages/runbook/src/netcortex_runbook/service.py +++ b/packages/runbook/src/netcortex_runbook/service.py @@ -5,14 +5,12 @@ import time import urllib.robotparser from dataclasses import dataclass -from typing import TYPE_CHECKING, Any +from typing import Any from urllib.parse import urlparse import httpx from bs4 import BeautifulSoup - -if TYPE_CHECKING: - from netcortex_core import RunbookChunk # type: ignore[import-not-found] +from netcortex_core import ModuleUnavailable, RunbookChunk, Settings SOURCES = { "queues": "https://help.mikrotik.com/docs/spaces/ROS/pages/328088/Queues", @@ -137,10 +135,11 @@ def _embed(client: httpx.Client, text: str, base_url: str, model: str) -> list[f payload = response.json() if not isinstance(payload, dict): raise TypeError("Ollama returned a malformed embedding response") - if payload.get("model") != model: - raise ValueError( - f"Ollama model mismatch: requested {model!r}, received {payload.get('model')!r}" - ) + reported_model = payload.get("model") + if reported_model != model and not ( + model == "embeddinggemma" and reported_model == "embeddinggemma:latest" + ): + raise ValueError(f"Ollama model mismatch: requested {model!r}, received {reported_model!r}") embeddings = payload.get("embeddings") vector = embeddings[0] if isinstance(embeddings, list) and embeddings else None if not isinstance(vector, list) or len(vector) != 768: @@ -157,10 +156,10 @@ def _embed(client: httpx.Client, text: str, base_url: str, model: str) -> list[f def _validate_model(model: str) -> None: if ( not isinstance(model, str) - or not model.startswith("embeddinggemma:") - or not model.split(":", 1)[1] + or model != "embeddinggemma" + and not re.fullmatch(r"embeddinggemma:[^\s:]+", model) ): - raise ValueError("embed_model must be an explicitly configured full embeddinggemma tag") + raise ValueError("embed_model must be embeddinggemma or an explicit embeddinggemma tag") def _store_chunks(conn: Any, chunks: list[tuple[Chunk, list[float]]], embed_model: str) -> None: @@ -226,54 +225,55 @@ def ingest( ) as conn: _store_chunks(conn, chunks, embed_model) return len(chunks) + except ModuleUnavailable: + raise + except Exception as exc: + raise ModuleUnavailable(f"runbook ingest unavailable ({type(exc).__name__})") from exc finally: if own: client.close() -def _settings_and_contract() -> tuple[Any, Any]: - try: - from netcortex_core import RunbookChunk, Settings # type: ignore[import-not-found] - except ImportError as exc: - raise RuntimeError( - "live search requires Aun's published netcortex_core Settings and RunbookChunk contract" - ) from exc - return Settings, RunbookChunk - - def search_runbook(query: str, k: int = 5) -> list[RunbookChunk]: """Search pgvector; return core RunbookChunk items after its contract is published.""" if not query.strip() or not 1 <= k <= 20: raise ValueError("query must be non-empty and k must be 1..20") - Settings, RunbookChunk = _settings_and_contract() settings = Settings() model = settings.embed_model try: _validate_model(model) except ValueError as exc: - raise RuntimeError(str(exc)) from exc - with httpx.Client(timeout=httpx.Timeout(15, connect=5)) as client: - vector = _embed(client, query, settings.ollama_base_url, model) - import psycopg + raise ModuleUnavailable(f"runbook search unavailable: {exc}") from exc + if settings.database_url is None: + raise ModuleUnavailable("runbook search unavailable: database URL is not configured") + try: + with httpx.Client(timeout=httpx.Timeout(15, connect=5)) as client: + vector = _embed(client, query, settings.ollama_base_url, model) + import psycopg - with ( - psycopg.connect( - settings.database_url, connect_timeout=5, options="-c statement_timeout=5000" - ) as conn, - conn.cursor() as cur, - ): - cur.execute( - "SELECT source_url,title,section,text,embedding <=> %s::vector AS distance " - "FROM runbook_chunks WHERE embed_model=%s ORDER BY embedding <=> %s::vector " - "LIMIT %s", - ( - "[" + ",".join(map(str, vector)) + "]", - model, - "[" + ",".join(map(str, vector)) + "]", - k, - ), - ) - rows = cur.fetchall() + database_url = settings.database_url.get_secret_value() + with ( + psycopg.connect( + database_url, connect_timeout=5, options="-c statement_timeout=5000" + ) as conn, + conn.cursor() as cur, + ): + cur.execute( + "SELECT source_url,title,section,text,embedding <=> %s::vector AS distance " + "FROM runbook_chunks WHERE embed_model=%s " + "ORDER BY embedding <=> %s::vector LIMIT %s", + ( + "[" + ",".join(map(str, vector)) + "]", + model, + "[" + ",".join(map(str, vector)) + "]", + k, + ), + ) + rows = cur.fetchall() + except ModuleUnavailable: + raise + except Exception as exc: + raise ModuleUnavailable(f"runbook search unavailable ({type(exc).__name__})") from exc return [ RunbookChunk(source_url=r[0], title=r[1], section=r[2], text=r[3], score=1.0 - float(r[4])) for r in rows diff --git a/packages/runbook/tests/test_runbook_core_contract.py b/packages/runbook/tests/test_runbook_core_contract.py new file mode 100644 index 0000000..9a1bc54 --- /dev/null +++ b/packages/runbook/tests/test_runbook_core_contract.py @@ -0,0 +1,30 @@ +"""Lead acceptance cases; no model download, database or secrets required.""" + +import httpx +import pytest +from netcortex_core import ModuleUnavailable +from netcortex_runbook import service + + +def test_agreed_embedding_name_and_dimensions(): + def reply(request): + assert b'"model":"embeddinggemma"' in request.content + return httpx.Response(200, json={"model": "embeddinggemma", "embeddings": [[0.0] * 768]}) + + with httpx.Client(transport=httpx.MockTransport(reply)) as client: + assert ( + len(service._embed(client, "failover", "http://localhost:11434", "embeddinggemma")) + == 768 + ) + + +def test_invalid_embedding_dimensions_rejected(): + with httpx.Client( + transport=httpx.MockTransport( + lambda request: httpx.Response( + 200, json={"model": "embeddinggemma", "embeddings": [[0.0] * 2]} + ) + ) + ) as client: + with pytest.raises((ValueError, ModuleUnavailable)): + service._embed(client, "failover", "http://localhost:11434", "embeddinggemma") diff --git a/packages/simgen/README.md b/packages/simgen/README.md index bb4e5dc..19a3b17 100644 --- a/packages/simgen/README.md +++ b/packages/simgen/README.md @@ -1,6 +1,6 @@ # netcortex-simgen -Deterministic network telemetry fixtures and bounded RIPE Atlas collection. The fixture CLI works without NetCortex core. Generated Parquet and raw downloads stay under ignored `data/generated/` and `data/raw/` paths. +Deterministic network telemetry fixtures and bounded RIPE Atlas collection. The package imports the shared NetCortex core schemas directly. Offline fixture commands require no database credentials. Generated Parquet and raw downloads stay under ignored `data/generated/` and `data/raw/` paths. Install this package through the workspace when integrated. From the package directory, an isolated offline run is: @@ -23,9 +23,9 @@ simgen load --source sim --last 2d --mock Default generation schedules all seven causes once per configured site; `--normal-only` generates baseline traffic. Ping samples use 10-second cadence, interfaces use 30-second cadence, and daily demand follows Pakistan local time. Timestamps remain UTC. Seeded NumPy produces the samples. One site/day contains 8,640 ping observations per target and 2,880 interface observations per configured interface. -`generate()` returns core-shaped probe/interface DataFrames and plain fixture labels. `inject_frames()` returns fixture rows and a plain dict label. Public `inject(site_id, scenario_type, duration_min, seed)` lazy-imports the actual `netcortex_core` Cause and ScenarioLabel symbols, then fails clearly until the approved lifecycle adapter is implemented. It never returns a locally invented shared object. +`generate()` returns core-shaped probe/interface DataFrames and plain fixture labels, including DNS lookup observations. `generate_subscribers()` returns continuous core SubscriberMetric-shaped rows. `inject_frames()` remains a local fixture helper; public `inject(site_id, scenario_type, duration_min, seed)` returns a core ScenarioLabel and transactionally inserts sim metrics after a per-site advisory lock and overlap check. Existing site rows are preserved. -Scenario signals affect both ping and interface data. Complete uplink loss is exactly 100% with missing RTT/jitter; gateway ping remains available and a configured backup receives traffic. DNS timing and synthetic subscriber evidence are written to separate supplemental experimental Parquet with explicit status. Unsupported columns are never added to core table frames. +Scenario signals affect both ping and interface data. Complete uplink loss is exactly 100% with missing RTT/jitter; gateway ping remains available and a configured backup receives traffic. DNS timing uses core probe rows (`kind=dns`, target `dns:1.1.1.1`), separate from ICMP. Continuous subscriber evidence uses core SubscriberMetric rows. Experimental backhaul quality remains in supplemental Parquet. RIPE collection discovers active Pakistan probes and public ping measurements dynamically, then fetches bounded UTC-day result windows for selected probes. Requests have a total deadline and response/row/pagination limits; cache keys include selected probe IDs, and partial daily gaps stay visible in the fetch report. Fetched rows retain probe/ASN/measurement/target/time provenance; no real records are fabricated. Offline tests do not call the network. @@ -35,6 +35,6 @@ Run that calibration command from the workspace root so the relative mapping pat `eval-cases --n 80` writes 80 cases for each of train, validation, and held-out test, balanced at ten cases per class per split. Seeds and calendar windows are separate. JSON sidecars contain event bounds, seed, split, `as_of`, history window, and expected labels. Metric feature rows end at `as_of`; labels are not feature columns. Supplemental experimental evidence has a separate file. -Database load and live injection remain unavailable until Aun confirms core table conflict keys, transaction behavior, and injection lifecycle. Mock load reads and validates the selected fixture but performs no database writes. CLI `inject` persists a fixture at the deterministic simulator clock (default base `2026-10-12T00:00:00Z`, single-cause event at +2 hours); Python `inject_frames(..., start=...)` accepts another fixture start. `replay` merges active persisted injection fixtures with generated rows and consumes them in timestamp order; only speed 1 uses wall-clock pauses. These commands do not act on a router or claim a live injection. Core database persistence stays gated. +Database load and live injection use the merged core schemas and DB helpers. Load/replay append source-tagged metric rows in bounded batches; mock mode validates without writes. Injection inserts probes, interfaces, subscribers, and one scenario label in one transaction. Repeating a load appends another copy because metric rows have no unique key. CLI `inject --mock` persists a fixture at the deterministic simulator clock; real CLI injection calls the transactional Python `inject` lifecycle. Injection supports durations from 1 minute through 22 hours, which fits its generated probe/interface window. Python `inject_frames(..., start=...)` accepts a fixture start. `replay` merges active persisted injection fixtures with generated rows and consumes them in timestamp order; only speed 1 uses wall-clock pauses. These commands do not act on a router or claim a live injection. Mock tests cover the transaction boundary; real database operation still requires configured credentials. See [decision.md](decision.md) for material choices and [flow.md](flow.md) for entry points, files, external APIs, failure paths, and contract gates. Passing offline tests does not establish a live RIPE, core, database, router, or workflow integration. diff --git a/packages/simgen/decision.md b/packages/simgen/decision.md index 6366f43..1250afd 100644 --- a/packages/simgen/decision.md +++ b/packages/simgen/decision.md @@ -6,15 +6,15 @@ | Build samples from seeded NumPy arrays and return pandas frames. | Handwrite row values or use LLM-generated series. | Seeded arrays are repeatable, economical, and retain daily structure. | Same seed and start yield identical observations; values remain generated data, not real measurements. | | Use 10-second probes, 30-second interfaces, and a Pakistan local-time weekday/weekend demand curve. | One cadence, UTC-shaped daily demand, or flat utilization. | Matches collection timing and evening traffic peaks. | UTC timestamps are stored; local time drives demand. One site/day has 8,640 ping times/target and 2,880 samples/interface. | | Keep only the seven brief cause strings and their expected template IDs. | Add convenient aliases or invent more shared values. | Those identifiers belong to Aun's contract. | `CAUSES` and `TEMPLATES` are local constants; fixture labels are plain dicts, not Pydantic types. | -| Separate internal `inject_frames()` from the public `inject(...)->ScenarioLabel`. | Return a local dict that looks like the future shared result. | Core is absent and its lifecycle isn't agreed. | Offline scenario fixtures work; public injection imports core lazily and fails explicitly until the real API is bound. | -| Gate database writes until Aun provides conflict keys and retry behavior. | Guess an `ON CONFLICT` key from the draft schema. | Guessed keys can duplicate or discard telemetry. | Mock load validates files; real load/replay stops before writes. | +| Separate internal `inject_frames()` from the public `inject(...)->ScenarioLabel`. | Return a local dict that looks like the future shared result. | The merged core publishes the schemas and transactional insert helpers. | Offline scenario fixtures work; public injection returns the core ScenarioLabel and atomically writes observations with overlap protection. | +| Use core metric insert helpers for database load and replay. | Guess an `ON CONFLICT` key from the draft schema. | Metric tables have no unique replay key; append semantics preserve observations. | Mock load validates files; real load/replay writes source-tagged observations in bounded batches. | | Discover RIPE probes/measurements at runtime with finite timeouts, capped pagination, cache, and request spacing. | Hardcode IDs or crawl without page limits. | Provider contents change; raw downloads must be bounded and traceable. | Fetched observations retain measurement/probe IDs; offline tests use no network. | | Prefer exact target/hour calibration; allow an explicit, opt-in public-DNS reachability role proxy only for `1.1.1.1` and `8.8.8.8`. | Transfer by default, or apply a role baseline to gateway, upstream-hop, game-server, or DNS lookup measurements. | The brief asks for per-target-role baseline statistics and root DNS ping data is available, but its route is not proven equivalent to either configured resolver target. | `--target-role-map` plus `--allow-role-proxy` are both required. Exact target data wins. Transfer scope and uncertainty are stored in calibration and generation metadata; other targets keep illustrative defaults. | | Compute role/hour RTT, jitter, and loss statistics only for exact targets in the supplied role map. | Let provider role labels silently authorize cross-target use. | Role aggregation should describe only operator-designated source observations. | The map is `data/ripe-target-roles.json`; its two root-DNS addresses are explicitly marked as reachability proxies. The proxy transfers only to unmatched public-DNS targets and never means DNS lookup latency. | | Make mock calibration fail unless an explicit real observation fixture is bundled. | Run against made-up/mock samples when `--mock` is selected. | A calibration artifact should be traceable to measured data. | `simgen calibrate --mock` exits without writing; real calibration writes ignored `data/calibration.json` plus a committed measured coverage report. | | Make interface effects agree with ping scenario windows. | Alter only ping RTT/loss while leaving utilization/counters normal. | A detector needs the physical metric evidence for the stated cause. | Congestion raises utilization/drops; total uplink loss zeros primary counters and shifts configured backup; interference raises backhaul counters. | | Keep gateway healthy for outside-provider/congestion incidents, and model total loss as exactly 100% with unavailable RTT/jitter. | Apply the same queue delay to gateway, or emit noisy near-total loss with a valid RTT. | Those outputs contradict the incident descriptions and packet semantics. | Gateway is a local control; total loss is not mistaken for a slow successful response. | -| Keep synthetic subscriber/DNS observations in supplemental experimental Parquet. | Add unsupported columns to core tables or infer them from ping RTT. | Draft core schemas do not define subscriber traffic or resolver timing. | Supplemental rows disclose synthetic provenance and pending contracts; they are excluded from database loads. | +| Store DNS lookup and subscriber evidence in the actual core metric schemas. | Add unsupported columns to core tables or infer them from ping RTT. | Merged core defines DNS ProbeMetric and SubscriberMetric. | Supplemental rows disclose synthetic provenance and pending contracts; they are excluded from database loads. | | Put labels in per-case JSON sidecars, never in feature rows. | Add cause/template to the metric DataFrame for convenience. | That directly leaks the answer to a detector. | Eval scoring joins expected labels only after inference; each case is clipped at its `as_of`. | | Generate balanced train, validation and held-out test packs with distinct seeds and calendar windows. | Split adjacent windows from one run or reuse training cases as test. | Event leakage gives optimistic scores. | `--n 80` means 80 test cases plus 80 each in train and validation, ten per class in every split. It produces no scores itself. | | Ignore large Parquet and raw RIPE cache files in version control. | Commit generated case packs/raw API payloads. | These artifacts are reproducible or grow quickly. | Small YAML fixtures are committed; use `simgen generate` and `simgen eval-cases` to materialize data locally. | diff --git a/packages/simgen/flow.md b/packages/simgen/flow.md index b6bd3ea..d293248 100644 --- a/packages/simgen/flow.md +++ b/packages/simgen/flow.md @@ -10,7 +10,7 @@ flowchart TD CLI --> CAL[calibrate] CLI --> LOAD[load and replay] CLI --> EVAL[eval-cases] - GEN --> TABLES[probe and interface DataFrames] + GEN --> TABLES[core probe and interface DataFrames] GEN --> SUPP[supplemental experimental DataFrame] INJ --> TABLES TABLES --> PARQUET[ignored generated Parquet] @@ -20,24 +20,23 @@ flowchart TD CACHE --> CAL CAL --> CALFILE[data/calibration.json] CALFILE --> GEN - LOAD -->|core keys confirmed + DATABASE_URL| DB[(Aun core tables)] - LOAD -->|current gate| STOP[RuntimeError before writes] + LOAD -->|DATABASE_URL| DB[(core metric tables)] + LOAD -->|mock| STOP[validate only] INJ --> ACTIVE[active_scenarios.json] ACTIVE --> LOAD EVAL --> CASES[eval/cases split sidecars + observations] - PUBLIC[inject(site_id, Cause, duration_min, seed)] --> CORE{real netcortex_core present?} - CORE -->|no| ERROR[explicit unavailable RuntimeError] - CORE -->|yes| UNBOUND[adapter remains disabled pending lifecycle contract] + PUBLIC[inject(site_id, Cause, duration_min, seed)] --> TX[site advisory lock + overlap check] + TX --> WRITE[atomic core metrics + ScenarioLabel] ``` ## Python API `src/netcortex_simgen/simulator.py` exports: -- `generate(days=1, seed=42, start=None, scenario_type=None, duration_min=15, site_id=None, normal_only=False, hours=None) -> (probe_df, iface_df, labels)`. Without a selected scenario and without `normal_only`, it schedules each of seven causes once per selected site. Probe frame columns match the draft `probe_metrics`; interface frame columns match `iface_metrics`. An optional `hours` argument bounds a case window to at most 24 hours per requested day. Both frames carry `attrs["calibration"]` with per-target mode and any explicit proxy provenance. +- `generate(days=1, seed=42, start=None, scenario_type=None, duration_min=15, site_id=None, normal_only=False, hours=None) -> (probe_df, iface_df, labels)`. Without a selected scenario and without `normal_only`, it schedules each of seven causes once per selected site. Probe frame columns match core `probe_metrics`, including separate DNS lookup kind; interface frame columns match `iface_metrics`. An optional `hours` argument bounds a case window to at most 24 hours per requested day. Both frames carry `attrs["calibration"]` with per-target mode and any explicit proxy provenance. - `inject_frames(site_id, scenario_type, duration_min=15, seed=42, start=None) -> (probe_df, iface_df, label_dict)`. This internal fixture helper emits table-shaped frames and a plain label dict. It does not persist on its own. -- `generate_supplemental(labels, *, start, end, seed=42, site_ids=None) -> DataFrame`. Emits continuous separately marked synthetic DNS, subscriber, and backhaul observations for every selected site across the requested interval. Scenario transforms apply only inside the event interval, so baseline presence does not reveal a label. -- `inject(site_id, scenario_type: Cause, duration_min, seed=None) -> ScenarioLabel`. This is the future public contract signature with type-only imports. At runtime it lazy-imports `netcortex_core` and raises explicitly if the actual exports are missing. Even when the module exists, the adapter raises until Aun confirms construction and lifecycle. +- `generate_subscribers(labels, *, start, end, seed=42, site_ids=None) -> DataFrame`. Emits continuous core-shaped SubscriberMetric rows with healthy baseline and active heavy-user traffic. `generate_supplemental(...)` continues to emit experimental backhaul quality rows and legacy supplemental exports. +- `inject(site_id, scenario_type: Cause, duration_min, seed=None) -> ScenarioLabel`. It imports the actual core contract, fixes the event window at injected UTC now through now plus duration, locks the site, rejects overlapping simulator labels, preserves existing site topology, and inserts probe/interface/subscriber metrics plus the scenario label in one transaction. Duration is limited to 1..1320 minutes so metric generation covers the full label. Unknown fixture sites fail as ValueError. Optional `now` and `database` keyword arguments make clock and transaction behavior testable offline. - `sites() -> dict` reads committed `data/sites.yaml` when running from a checkout and falls back to the bundled `netcortex_simgen.resources/sites.yaml` for an installed wheel. `src/netcortex_simgen/ripe.py` exports `parse_result(item, site_id="ripe-pk")` and `fetch(days=14, out=None, cache_dir=None, client=None, page_limit=20, max_measurements=5, max_probes=5, deadline_seconds=300)`. A parsed row has `source=ripe`, measurement ID, probe ID, ASN, and target. A packet-loss row with no received packets has `loss_pct=100`, `rtt_ms=None`, and `jitter_ms=None`. @@ -47,11 +46,11 @@ flowchart TD | Command | Input and steps | Output | Error or gate | |---|---|---|---| | `simgen generate --days 7 --seed 42 [--normal-only] [--mock]` | Generate all sites using seeded demand and scenario schedule, unless normal-only is selected. | `data/generated/probe_metrics.parquet`, `iface_metrics.parquet`, `supplemental_experimental.parquet`, `scenario_labels.json`, and `generation_metadata.json` describing target baseline mode, proxy scope, provenance, and uncertainty. | Days must be 1..30; invalid cause/site or non-aware Python start raises `ValueError`. | -| `simgen inject --site north-tower --type uplink_congestion --duration 15 --seed 42 --mock` | Generate one fixture at the simulator's default clock (`2026-10-12T00:00:00Z` base; a single cause starts two hours later), clip rows to its label window, and replace the same site/cause/seed fixture. | `data/generated/injections/-probe.parquet`, `-iface.parquet`, `-supplemental.parquet`, and `active_scenarios.json` with calibration metadata. | Persists a replay fixture only. It does not inject into a router/runtime, call API/core, or write a database. Python `inject_frames(..., start=...)` accepts a different fixture clock. | +| `simgen inject --site north-tower --type uplink_congestion --duration 15 [--mock]` | Mock mode writes a local fixture at the deterministic clock. Real mode calls core `inject()` for the current UTC interval. | Mock writes probe/interface/supplemental Parquets and `active_scenarios.json`; real mode returns a ScenarioLabel after atomic core DB inserts. | Real mode requires DATABASE_URL. Overlap raises ValueError and transaction failure rolls back. Failover labels use `failover_route` only when both gateways are explicitly present in fixture topology; otherwise expected template is `none`. It does not change router configuration. | | `simgen ripe --days 14` | Discover active Pakistan probes, discover public ping measurements, then bounded results. | Cached JSON under `data/raw/ripe/cache/`; `data/raw/ripe/results.parquet`. | HTTP timeout/status errors and malformed responses fail; pagination stops/errors at 20 pages. `--mock` exits because no real observation fixture is bundled. | | `simgen calibrate [--target-role-map roles.json --allow-role-proxy]` | Read available `data/raw/ripe/results.parquet` and `data/raw/live/collector.parquet`; compute Pakistan local hour medians, target/hour medians, and counts. Role/hour medians include only exact observed targets named in the map. | Ignored `data/calibration.json` and committed `data/calibration-report.md` with measured coverage, per-target/per-role medians, default coverage, opt-in transfer scope, uncertainty, and gaps. | Role proxy requires both options and at least one matching observed target mapped to `public_dns_reachability_proxy`. It fills only unmatched `1.1.1.1`/`8.8.8.8`; exact target calibration wins. If no input exists, exits without writing; `--mock` exits because no synthetic calibration fixture is bundled. | -| `simgen load --source sim --last 2d [--mock]` | Read generated SIM or RIPE source rows and filter to the last duration. | Mock reports actual selected rows without writing. Intended target tables are `probe_metrics` and `iface_metrics`. | `--last` must be positive `d` or `h`. Real mode requires `NETCORTEX_DB_KEYS_CONFIRMED=1` and `DATABASE_URL`, but remains blocked before writes pending Aun's conflict-key contract. | -| `simgen replay --speed 60 [--mock]` | Read base generated rows and active persisted fixture rows, sort by timestamp. Speed 1 waits wall time; speed greater than 1 consumes on a virtual accelerated clock. | Mock prints consumed row and active-fixture counts. Real persistence targets the same core metrics tables. | This is deterministic fixture replay, not live scenario injection. Missing base Parquet fails; core persistence remains gated. | +| `simgen load --source sim --last 2d [--mock]` | Read generated SIM or RIPE source rows and filter to the last duration. | Mock reports actual selected rows without writing. Intended target tables are `probe_metrics` and `iface_metrics`. | `--last` must be positive `d` or `h`. Real mode requires `DATABASE_URL` from process settings and appends source-tagged rows in bounded batches; missing configuration raises `ModuleUnavailable`. | +| `simgen replay --speed 60 [--mock]` | Read base generated rows and active persisted fixture rows, sort by timestamp. Speed 1 waits wall time; speed greater than 1 consumes on a virtual accelerated clock. | Mock prints consumed row and active-fixture counts. Real persistence targets the same core metrics tables. | This is deterministic fixture replay, not router configuration. Missing base Parquet fails; real mode appends rows transactionally through core DB helpers. | | `simgen eval-cases --n 80 --seed 1000 [--mock]` | Generate a balanced set independently for each split. N is positive multiple of eight. | 80 cases per split in `eval/cases/{train,validation,test}`; each has JSON sidecar including calibration mode/proxy provenance, probe/iface Parquets, and separate supplemental Parquet. | Invalid size raises `ValueError`. `test` is the 80-case held-out set; train/validation are distinct 80-case sets. | Every eval JSON sidecar carries `case_id`, `split`, `seed`, `site_id`, `case_start`, `event_start`, `event_end`, `as_of`, `history_window`, `expected`, `calibration`, and observation paths. Exactly ten of each normal plus seven cause classes appear per split when n=80. Case causes and sites are shuffled; train/validation/test use different random seed ranges and nonoverlapping calendar blocks. The history window ends at `window_start=as_of-30m`, the detection interval ends at `as_of`, and event cases set `as_of=event_end-10s`. Probe/interface observations stop at `as_of`. Cause/template/params are absent from feature columns and only read after inference for scoring. The detector worker should use each sidecar's history window as the maximum available context and must not use any observation after `as_of`. @@ -66,4 +65,4 @@ Pandas/NumPy make simulated rows, PyArrow stores Parquet, PyYAML reads sites/sce ## Missing core gates -`packages/core` is absent in this worktree. Aun must confirm Cause/ScenarioLabel exports; injection start/end, overlap, source, label linkage and cleanup lifecycle; unique table keys and transactional retry semantics; subscriber privacy and evidence policy; DNS resolution timing support; and explicit interface-role support. Supplemental fields are stored separately and never passed to draft core tables. The fixture CLI proves only local deterministic behavior, not RIPE availability, database persistence, live injection, or the downstream incident workflow. +`packages/core` is absent in this worktree. Aun must confirm Cause/ScenarioLabel exports; injection start/end, overlap, source, label linkage and cleanup lifecycle; unique table keys and transactional retry semantics; subscriber privacy and evidence policy; DNS resolution timing support; and explicit interface-role support. Supplemental fields are stored separately and never passed to draft core tables. Offline fake-transaction tests cover overlap and rollback behavior; they do not establish external database credentials, RIPE availability, router changes, or the downstream incident workflow. diff --git a/packages/simgen/pyproject.toml b/packages/simgen/pyproject.toml index 0f486d8..6998e68 100644 --- a/packages/simgen/pyproject.toml +++ b/packages/simgen/pyproject.toml @@ -7,7 +7,7 @@ name = "netcortex-simgen" version = "0.1.0" description = "Deterministic network telemetry simulation and fixture tools for NetCortex" requires-python = ">=3.12,<3.13" -dependencies = ["numpy>=2.1", "pandas>=2.2", "pyarrow>=18", "PyYAML>=6", "httpx>=0.27", "psycopg[binary]>=3.2"] +dependencies = ["netcortex-core", "numpy>=2.1", "pandas>=2.2", "pyarrow>=18", "PyYAML>=6", "httpx>=0.27", "psycopg[binary]>=3.2"] [project.scripts] simgen = "netcortex_simgen.cli:main" diff --git a/packages/simgen/src/netcortex_simgen/cli.py b/packages/simgen/src/netcortex_simgen/cli.py index 15776d2..6914b5d 100644 --- a/packages/simgen/src/netcortex_simgen/cli.py +++ b/packages/simgen/src/netcortex_simgen/cli.py @@ -2,7 +2,6 @@ import argparse import json -import os import time from datetime import UTC, datetime, timedelta from pathlib import Path @@ -337,21 +336,28 @@ def _write( def _load_database(p: pd.DataFrame, i: pd.DataFrame, source: str) -> None: - if not os.getenv("NETCORTEX_DB_KEYS_CONFIRMED") == "1": - raise RuntimeError( - "Database load disabled until Aun confirms repeat-safe database keys; " - "set NETCORTEX_DB_KEYS_CONFIRMED=1 only after the contract is published" - ) - dsn = os.getenv("DATABASE_URL") - if not dsn: - raise RuntimeError("DATABASE_URL is required") - import psycopg + from netcortex_core import IfaceMetric, ProbeMetric, Source + from netcortex_core import db as core_db + from netcortex_core.settings import Settings - with psycopg.connect(dsn) as conn, conn.transaction(): - # The approved conflict keys are intentionally a gate. Never guess table keys. - raise RuntimeError( - "Core table key/upsert contract is not yet confirmed; no rows were written" - ) + source_value = Source(source) + setting = Settings() + if setting.database_url is None: + raise RuntimeError("DATABASE_URL is required") + probes = [] + for item in p.to_dict("records"): + item["source"] = source_value + probes.append(ProbeMetric.model_validate(item)) + interfaces = [] + for item in i.to_dict("records"): + item["source"] = source_value + interfaces.append(IfaceMetric.model_validate(item)) + with core_db.get_pool(setting).connection() as conn, conn.transaction(): + # Bounded batches keep replay transactions from growing without limit. + for offset in range(0, len(probes), 1000): + core_db.insert_probe_metrics(conn, probes[offset : offset + 1000]) + for offset in range(0, len(interfaces), 1000): + core_db.insert_iface_metrics(conn, interfaces[offset : offset + 1000]) def _read_source( @@ -408,7 +414,8 @@ def _read_source( edge = pd.to_datetime(p.time, utc=True).max() - delta p = p[pd.to_datetime(p.time, utc=True) >= edge] if len(i) and "time" in i: - i = i[pd.to_datetime(i.time, utc=True) >= edge] + i_edge = pd.to_datetime(i.time, utc=True).max() - delta + i = i[pd.to_datetime(i.time, utc=True) >= i_edge] return p, i @@ -567,6 +574,12 @@ def main(argv: list[str] | None = None) -> int: _write(p, i, labels, ROOT / "data/generated", extra) print(f"Wrote {len(p)} probe and {len(i)} interface rows") elif args.command == "inject": + if not mock: + from .simulator import inject + + label = inject(args.site, args.type, args.duration, args.seed) + print(f"Injected {label.scenario_type.value} at {label.site_id} ({label.id})") + return 0 p, i, label = inject_frames(args.site, args.type, args.duration, args.seed) p = p[(p.time >= label["start"]) & (p.time < label["end"])].copy() i = i[(i.time >= label["start"]) & (i.time < label["end"])].copy() @@ -595,10 +608,7 @@ def main(argv: list[str] | None = None) -> int: } ) labels_path.write_text(json.dumps(labels, indent=2), encoding="utf-8") - print( - f"Fixture persisted as {key}; core injection/persistence unavailable " - "until its lifecycle contract is published" - ) + print(f"Fixture persisted as {key}; this mock path did not write to the database") elif args.command == "load": p, i = _read_source(args.source, args.last) if mock: diff --git a/packages/simgen/src/netcortex_simgen/simulator.py b/packages/simgen/src/netcortex_simgen/simulator.py index 55186cd..95a7624 100644 --- a/packages/simgen/src/netcortex_simgen/simulator.py +++ b/packages/simgen/src/netcortex_simgen/simulator.py @@ -4,14 +4,30 @@ from datetime import UTC, datetime, timedelta from importlib.resources import files from pathlib import Path -from typing import TYPE_CHECKING, Any +from typing import Any import numpy as np import pandas as pd import yaml - -if TYPE_CHECKING: - from netcortex_core import Cause, ScenarioLabel +from netcortex_core import ( + Cause, + IfaceMetric, + ModuleUnavailable, + ProbeKind, + ProbeMetric, + ProbeTarget, + ScenarioLabel, + Site, + Source, + SubscriberMetric, + TargetRole, + TemplateId, + Uplink, + UplinkRole, +) +from netcortex_core import db as core_db +from netcortex_core.settings import Settings +from psycopg.types.json import Jsonb def _find_workspace_root() -> Path: @@ -458,6 +474,7 @@ def generate( "time": times, "site_id": site["id"], "target": target, + "kind": "icmp", "rtt_ms": rtt, "jitter_ms": np.maximum(0.1, jitter), "loss_pct": loss, @@ -465,6 +482,23 @@ def generate( } ) ) + dns_ms = np.maximum(5, 24 + rng.normal(0, 2, num_pings)) + dns_mask = cause_at_ping == "dns_slow" + dns_ms[dns_mask] = np.maximum(300, rng.normal(650, 35, int(dns_mask.sum()))) + pings.append( + pd.DataFrame( + { + "time": times, + "site_id": site["id"], + "target": "dns:1.1.1.1", + "kind": "dns", + "rtt_ms": dns_ms, + "jitter_ms": np.maximum(0.1, rng.normal(2, 0.4, num_pings)), + "loss_pct": np.zeros(num_pings), + "source": "sim", + } + ) + ) probe_frame = pd.concat(pings, ignore_index=True) iface_frame = pd.DataFrame(ifaces) probe_frame.attrs["calibration"] = calibration_metadata @@ -491,7 +525,7 @@ def generate_supplemental( raise ValueError("supplemental end must follow start") layout = sites()["sites"] selected = [s for s in layout if site_ids is None or s["id"] in site_ids] - times = pd.date_range(start=start, end=end, freq="30s", inclusive="both", tz="UTC") + times = pd.date_range(start=start, end=end, freq="30s", inclusive="left", tz="UTC") rows = [] for site_index, site in enumerate(selected): rng = np.random.default_rng(seed + site_index * 997) @@ -554,48 +588,147 @@ def generate_supplemental( return pd.DataFrame(rows) +def generate_subscribers( + labels: list[dict[str, Any]], + *, + start: datetime, + end: datetime, + seed: int = 42, + site_ids: list[str] | None = None, +) -> pd.DataFrame: + """Generate continuous, core-shaped subscriber observations.""" + start, end = _utc(start), _utc(end) + if end <= start: + raise ValueError("subscriber end must follow start") + selected = [s for s in sites()["sites"] if site_ids is None or s["id"] in site_ids] + times = pd.date_range(start=start, end=end, freq="30s", inclusive="left", tz="UTC") + rows = [] + for ix, site in enumerate(selected): + rng = np.random.default_rng(seed + ix * 997) + active = [label for label in labels if label["site_id"] == site["id"]] + for stamp in times: + instant = stamp.to_pydatetime() + heavy = any( + x["cause"] == "heavy_user" and x["start"] <= instant < x["end"] for x in active + ) + rx = max(100_000, int((75 if heavy else rng.gamma(2, 900_000) / 1_000_000) * 1_000_000)) + rows.append( + { + "time": instant, + "site_id": site["id"], + "ip": "192.0.2.10", + "rx_bps": rx, + "tx_bps": max(50_000, int(rx * 0.1)), + "source": "sim", + } + ) + return pd.DataFrame(rows, columns=list(SubscriberMetric.model_fields)) + + +def site_from_fixture(site_id: str) -> Site: + """Convert fixture topology to the shared core Site contract.""" + raw = next((s for s in sites()["sites"] if s["id"] == site_id), None) + if raw is None: + raise ValueError(f"unknown site: {site_id}") + uplinks = [ + Uplink( + iface=x["interface"], + role=UplinkRole(x["role"]), + capacity_mbps=x["capacity_mbps"], + gateway=x.get("gateway"), + ) + for x in raw["uplinks"] + ] + if raw.get("backup_uplink"): + x = raw["backup_uplink"] + uplinks.append( + Uplink( + iface=x["interface"], + role=UplinkRole.BACKUP, + capacity_mbps=x["capacity_mbps"], + gateway=x.get("gateway"), + ) + ) + uplinks.extend( + Uplink( + iface=x["interface"], + role=UplinkRole.BACKHAUL, + capacity_mbps=x["capacity_mbps"], + gateway=x.get("gateway"), + ) + for x in raw.get("backhauls", []) + ) + role = { + "gateway": TargetRole.GATEWAY, + "upstream-hop": TargetRole.UPSTREAM_HOP, + "regional-game": TargetRole.GAME_SERVER, + "1.1.1.1": TargetRole.PUBLIC_DNS, + "8.8.8.8": TargetRole.PUBLIC_DNS, + } + targets = [ProbeTarget(key=target, host=target, role=role[target]) for target in raw["targets"]] + targets.append( + ProbeTarget( + key="dns:1.1.1.1", host="1.1.1.1", kind=ProbeKind.DNS, role=TargetRole.PUBLIC_DNS + ) + ) + return Site( + id=raw["id"], + name=raw["name"], + uplinks=uplinks, + targets=targets, + subscribers=raw["subscribers"], + ) + + def _label( site: dict[str, Any], cause: str, start: datetime, end: datetime, seed: int ) -> dict[str, Any]: params: dict[str, Any] = {} + affected: dict[str, Any] = {} + template_id = TEMPLATES[cause] if cause == "uplink_congestion": - params = {"interface": site["uplinks"][0]["interface"], "priority": "high"} + uplink = site["uplinks"][0] + params = { + "uplink": uplink["interface"], + "uplink_mbps": max(1, int(uplink["capacity_mbps"] * 0.9)), + "game_ports": "3074,3478-3480,27015-27050", + } + affected = {"iface": uplink["interface"]} if cause == "uplink_down": - params = ( - { - "primary": site["uplinks"][0]["interface"], - "backup": site["backup_uplink"]["interface"], - } - if site.get("backup_uplink") - else { - "primary": site["uplinks"][0]["interface"], - "backup": None, - "actionable": False, + primary = site["uplinks"][0] + backup = site.get("backup_uplink") + affected = { + "iface": primary["interface"], + "backup_iface": backup["interface"] if backup else None, + } + if primary.get("gateway") and backup and backup.get("gateway"): + params = { + "primary_gateway": primary["gateway"], + "backup_gateway": backup["gateway"], + "backup_distance": 2, } - ) + else: + template_id = "none" if cause == "heavy_user": params = { - "limit_mbps": 10, - "evidence_status": "synthetic subscriber row is supplemental; " - "core subscriber contract pending", + "target": "192.0.2.10", + "upload_mbps": 1, + "download_mbps": 10, } + affected = {"ip": "192.0.2.10"} if cause == "dns_slow": - params = { - "template": "dns_servers", - "evidence_status": "experimental resolution rows are supplemental", - } - if cause == "wireless_interference": - params = { - "interface": site["backhauls"][0]["interface"], - "evidence_status": "simulated interface counters; role contract pending", - } + params = {"servers": ["1.1.1.1", "8.8.8.8"]} + affected = {"target": "dns:1.1.1.1"} + if cause == "wireless_interference" and site.get("backhauls"): + affected = {"iface": site["backhauls"][0]["interface"]} return { "site_id": site["id"], "start": start, "end": end, "cause": cause, - "template_id": TEMPLATES[cause], + "template_id": template_id, "params": params, + "affected": affected, "seed": seed, "split": "generated", } @@ -621,21 +754,94 @@ def inject_frames( def inject( - site_id: str, scenario_type: Cause, duration_min: int, seed: int | None = None + site_id: str, + scenario_type: Cause, + duration_min: int, + seed: int | None = None, + *, + now: datetime | None = None, + database: Any = None, ) -> ScenarioLabel: - """Core-facing contract entry point; unavailable until the real core arrives.""" - try: - import importlib - - core = importlib.import_module("netcortex_core") - for symbol in ("Cause", "ScenarioLabel"): - getattr(core, symbol) - except (ImportError, AttributeError) as exc: - raise RuntimeError( - "Core injection unavailable: netcortex_core and its approved " - "ScenarioLabel contract are not present" - ) from exc - raise RuntimeError( - "Core injection adapter is unbound: confirm core injection lifecycle, " - "Cause values, and ScenarioLabel construction before enabling" + """Atomically inject core-validated sim observations for a bounded window.""" + if not 1 <= duration_min <= 22 * 60: + raise ValueError("duration_min must be between 1 and 1320 (22 hours)") + cause = Cause(scenario_type) + now = _utc(now or datetime.now(UTC)) + end = now + timedelta(minutes=duration_min) + actual_seed = int(seed if seed is not None else np.random.SeedSequence().generate_state(1)[0]) + fixture_site = next((site for site in sites()["sites"] if site["id"] == site_id), None) + if fixture_site is None: + raise ValueError(f"unknown site: {site_id}") + setting = None + if database is None: + setting = Settings() + if setting.database_url is None: + raise ModuleUnavailable("DATABASE_URL is required for simulator injection") + scenario_raw = _label(fixture_site, cause.value, now, end, actual_seed) + label = ScenarioLabel( + site_id=site_id, + scenario_type=cause, + start_at=now, + end_at=end, + affected=scenario_raw["affected"], + expected_cause=cause, + expected_template=TemplateId(scenario_raw["template_id"]), + expected_params=scenario_raw["params"], + seed=actual_seed, + source=Source.SIM, + ) + fixture_start = now - timedelta(hours=2) + p, i, labels = generate( + days=1, + start=fixture_start, + scenario_type=cause.value, + duration_min=duration_min, + site_id=site_id, + seed=actual_seed, + ) + p = p[(p.time >= now) & (p.time < end)] + i = i[(i.time >= now) & (i.time < end)] + subscriber = generate_subscribers( + labels, start=now, end=end, seed=actual_seed, site_ids=[site_id] ) + probes = [ProbeMetric.model_validate(row) for row in p.to_dict("records")] + ifaces = [IfaceMetric.model_validate(row) for row in i.to_dict("records")] + subscribers = [SubscriberMetric.model_validate(row) for row in subscriber.to_dict("records")] + # Label is written through the same transaction as observations. The advisory + # lock serializes concurrent injectors for this site before overlap checking. + pool = database if database is not None else core_db.get_pool(setting) + with pool.connection() as conn, conn.transaction(): + with conn.cursor() as cur: + cur.execute("SELECT pg_advisory_xact_lock(hashtextextended(%s, 0))", (site_id,)) + cur.execute( + "SELECT 1 FROM scenario_labels WHERE site_id=%s AND source='sim' " + "AND start_at < %s AND COALESCE(end_at, 'infinity') > %s LIMIT 1", + (site_id, end, now), + ) + if cur.fetchone(): + raise ValueError("an injected scenario overlaps this site and time window") + if core_db.fetch_site(conn, site_id) is None: + core_db.upsert_site(conn, site_from_fixture(site_id)) + core_db.insert_probe_metrics(conn, probes) + core_db.insert_iface_metrics(conn, ifaces) + core_db.insert_subscriber_metrics(conn, subscribers) + with conn.cursor() as cur: + cur.execute( + "INSERT INTO scenario_labels (id, site_id, scenario_type, start_at, end_at, " + "affected, expected_cause, expected_template, expected_params, seed, source) " + "VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)", + ( + label.id, + label.site_id, + label.scenario_type.value, + label.start_at, + label.end_at, + Jsonb(label.affected), + label.expected_cause.value, + label.expected_template.value, + Jsonb(label.expected_params), + label.seed, + label.source.value, + ), + ) + return label diff --git a/packages/simgen/tests/test_simgen_core_contract.py b/packages/simgen/tests/test_simgen_core_contract.py new file mode 100644 index 0000000..0df7e37 --- /dev/null +++ b/packages/simgen/tests/test_simgen_core_contract.py @@ -0,0 +1,46 @@ +"""Lead tests for contract-shaped observations, independent of database setup.""" + +from datetime import UTC, datetime + +from netcortex_core import ProbeMetric, SubscriberMetric +from netcortex_simgen.simulator import generate, generate_supplemental + + +def test_dns_scenario_uses_measured_lookup_probe_kind(): + probes, _, labels = generate( + days=1, + hours=3, + seed=11, + site_id="north-tower", + scenario_type="dns_slow", + start=datetime(2026, 10, 12, tzinfo=UTC), + ) + assert "kind" in probes + dns = probes[(probes.kind == "dns") & (probes.target == "dns:1.1.1.1")] + assert not dns.empty + label = labels[0] + active = dns[(dns.time >= label["start"]) & (dns.time < label["end"])] + healthy = dns[dns.time < label["start"]] + assert not healthy.empty and active.rtt_ms.median() > healthy.rtt_ms.median() + assert ProbeMetric.model_validate(active.iloc[0].to_dict()).kind.value == "dns" + + +def test_heavy_user_has_core_shaped_subscriber_observations(): + start = datetime(2026, 10, 12, tzinfo=UTC) + _, _, labels = generate( + days=1, hours=3, seed=12, site_id="north-tower", scenario_type="heavy_user", start=start + ) + rows = generate_supplemental( + labels, start=start, end=labels[0]["end"], seed=12, site_ids=["north-tower"] + ) + # Production subscriber frame is a separate helper; supplemental remains experimental. + import netcortex_simgen.simulator as simulator + + subscriber = simulator.generate_subscribers( + labels, start=start, end=labels[0]["end"], seed=12, site_ids=["north-tower"] + ) + assert not subscriber.empty and not rows.empty + validated = [SubscriberMetric.model_validate(r) for r in subscriber.to_dict("records")] + assert all(r.source.value == "sim" for r in validated) + assert subscriber.time.min() < labels[0]["start"] + assert subscriber.loc[subscriber.time >= labels[0]["start"], "tx_bps"].max() > 0 diff --git a/packages/simgen/tests/test_simulator.py b/packages/simgen/tests/test_simulator.py index d0249b4..ac9afee 100644 --- a/packages/simgen/tests/test_simulator.py +++ b/packages/simgen/tests/test_simulator.py @@ -30,6 +30,196 @@ def test_seed_reproducible_and_schema_cadence(): assert p1.loss_pct.between(0, 100).all() and p1.rtt_ms.gt(0).all() +def test_core_site_mapping_and_subscribers_have_healthy_and_active_rows(): + site = simulator.site_from_fixture("market-cafe") + assert [uplink.role.value for uplink in site.uplinks] == ["primary", "backhaul"] + assert all(target.role.value for target in site.targets) + assert not any(uplink.role.value == "backup" for uplink in site.uplinks) + start = datetime(2026, 10, 12, tzinfo=UTC) + label = { + "site_id": "north-tower", + "cause": "heavy_user", + "start": start + pd.Timedelta(minutes=1), + "end": start + pd.Timedelta(minutes=2), + } + rows = simulator.generate_subscribers( + [label], start=start, end=start + pd.Timedelta(minutes=3), site_ids=["north-tower"] + ) + assert rows.time.min() < label["start"] + assert rows.loc[rows.time >= label["start"], "rx_bps"].max() > 10_000_000 + + +def test_scenario_labels_match_template_parameter_contracts(): + from netcortex_fixes import validate + + site = simulator.sites()["sites"][0] + start = datetime(2026, 10, 12, tzinfo=UTC) + for cause in CAUSES: + label = simulator._label(site, cause, start, start + pd.Timedelta(minutes=15), 9) + if label["template_id"] == "none": + assert label["params"] == {} + else: + validate(label["template_id"], label["params"]) + + gateway_site = { + **site, + "uplinks": [{**site["uplinks"][0], "gateway": "192.0.2.1"}], + "backup_uplink": {**site["backup_uplink"], "gateway": "192.0.2.2"}, + } + failover = simulator._label( + gateway_site, "uplink_down", start, start + pd.Timedelta(minutes=15), 10 + ) + assert failover["template_id"] == "failover_route" + validate(failover["template_id"], failover["params"]) + + +class _Transaction: + def __init__(self, conn): + self.conn = conn + + def __enter__(self): + return self + + def __exit__(self, exc_type, *_): + self.conn.rolled_back = exc_type is not None + return False + + +class _Cursor: + def __init__(self, conn): + self.conn = conn + + def __enter__(self): + return self + + def __exit__(self, *_): + return False + + def execute(self, sql, params=None): + self.conn.sql.append(sql) + self.conn.last_overlap = "SELECT 1 FROM scenario_labels" in sql + + def fetchone(self): + return (1,) if self.conn.overlap and self.conn.last_overlap else None + + +class _Conn: + def __init__(self, overlap=False): + self.overlap = overlap + self.rolled_back = False + self.sql = [] + + def cursor(self): + return _Cursor(self) + + def transaction(self): + return _Transaction(self) + + +class _Pool: + def __init__(self, conn): + self.conn = conn + + def connection(self): + class Connection: + def __enter__(_self): + return self.conn + + def __exit__(_self, *_): + return False + + return Connection() + + +def test_public_inject_preserves_site_and_rolls_back_on_failure(monkeypatch): + now = datetime(2026, 10, 12, tzinfo=UTC) + conn = _Conn() + upserted_sites = [] + monkeypatch.setattr( + simulator.core_db, "fetch_site", lambda *_: simulator.site_from_fixture("north-tower") + ) + monkeypatch.setattr( + simulator.core_db, "upsert_site", lambda _conn, site: upserted_sites.append(site) + ) + monkeypatch.setattr(simulator.core_db, "insert_probe_metrics", lambda *_: 1) + monkeypatch.setattr(simulator.core_db, "insert_iface_metrics", lambda *_: 1) + monkeypatch.setattr(simulator.core_db, "insert_subscriber_metrics", lambda *_: 1) + monkeypatch.setattr( + simulator, + "generate", + lambda **kwargs: ( + pd.DataFrame( + [ + { + "time": now, + "site_id": "north-tower", + "target": "1.1.1.1", + "kind": "icmp", + "rtt_ms": 20.0, + "jitter_ms": 1.0, + "loss_pct": 0.0, + "source": "sim", + } + ] + ), + pd.DataFrame( + columns=[ + "time", + "site_id", + "iface", + "rx_bps", + "tx_bps", + "util_pct", + "drops", + "errors", + "source", + ] + ), + [ + simulator._label( + simulator.sites()["sites"][0], + kwargs["scenario_type"], + now, + now + pd.Timedelta(minutes=kwargs["duration_min"]), + kwargs["seed"], + ) + ], + ), + ) + label = simulator.inject( + "north-tower", "uplink_congestion", 2, 8, now=now, database=_Pool(conn) + ) + assert label.start_at == now and label.end_at == now + pd.Timedelta(minutes=2) + assert not conn.rolled_back + assert not upserted_sites + assert any("pg_advisory_xact_lock" in sql for sql in conn.sql) + assert any("INSERT INTO scenario_labels" in sql for sql in conn.sql) + assert not any("CREATE " in sql for sql in conn.sql) + with pytest.raises(ValueError, match="1320"): + simulator.inject("north-tower", "uplink_congestion", 1321, 8, now=now, database=_Pool(conn)) + with pytest.raises(ValueError, match="unknown site"): + simulator.inject("missing-site", "uplink_congestion", 2, 8, now=now, database=_Pool(conn)) + + overlap_conn = _Conn(overlap=True) + with pytest.raises(ValueError, match="overlaps"): + simulator.inject( + "north-tower", "uplink_congestion", 2, 8, now=now, database=_Pool(overlap_conn) + ) + assert overlap_conn.rolled_back + + monkeypatch.setattr( + simulator.core_db, + "insert_probe_metrics", + lambda *_: (_ for _ in ()).throw(RuntimeError("db failure")), + ) + failed_conn = _Conn() + with pytest.raises(RuntimeError, match="db failure"): + simulator.inject( + "north-tower", "uplink_congestion", 2, 8, now=now, database=_Pool(failed_conn) + ) + assert failed_conn.rolled_back + + def test_packaged_site_resource_works_without_repository_root(monkeypatch, tmp_path): import yaml @@ -39,7 +229,7 @@ def test_packaged_site_resource_works_without_repository_root(monkeypatch, tmp_p canonical = yaml.safe_load(canonical_path.read_text()) assert layout == canonical p, _, _ = generate(days=1, hours=1, seed=2, site_id="north-tower", normal_only=True) - assert len(p) == 360 * 5 + assert len(p) == 360 * 6 def test_scenarios_distinguishable_and_labelled(): @@ -52,9 +242,10 @@ def test_scenarios_distinguishable_and_labelled(): affected = p[(p.time >= label["start"]) & (p.time < label["end"])] assert len(affected) > 0 and affected.loss_pct.between(0, 100).all() if cause == "uplink_down": - assert affected[affected.target != "gateway"].loss_pct.mean() >= 95 - assert affected[affected.target != "gateway"].loss_pct.eq(100).all() - assert affected[affected.target != "gateway"].rtt_ms.isna().all() + outside = affected[(affected.kind == "icmp") & (affected.target != "gateway")] + assert outside.loss_pct.mean() >= 95 + assert outside.loss_pct.eq(100).all() + assert outside.rtt_ms.isna().all() assert "ether2" in set(iface.iface) elif cause == "game_route_issue": assert ( @@ -93,8 +284,12 @@ def test_scenarios_distinguishable_and_labelled(): assert traffic.rx_bps.max() > 50_000_000 and traffic.rx_bps.min() < 10_000_000 -def test_public_inject_fails_without_shared_core(): - with pytest.raises(RuntimeError, match="Core injection unavailable"): +def test_public_inject_reports_missing_database(monkeypatch): + from netcortex_core import ModuleUnavailable + + settings = simulator.Settings + monkeypatch.setattr(simulator, "Settings", lambda: settings(_env_file=None)) + with pytest.raises(ModuleUnavailable, match="DATABASE_URL"): inject("north-tower", "uplink_congestion", 15, 4) diff --git a/uv.lock b/uv.lock index 8bc1ce5..3279466 100644 --- a/uv.lock +++ b/uv.lock @@ -12,7 +12,11 @@ members = [ "netcortex-agent", "netcortex-collector", "netcortex-core", + "netcortex-detector", "netcortex-fixes", + "netcortex-notify", + "netcortex-runbook", + "netcortex-simgen", "netcortex-workspace", ] @@ -25,6 +29,12 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/99/91/8acff4f5e50511b911bbccb72b8628a49c68ce14148cd9f6431094859a90/annotated_types-0.8.0-py3-none-any.whl", hash = "sha256:f072f4d804ea359e4eaf198b1af7a8b0943881a87f31bb764f8bf219bb9419e0", size = 13427, upload-time = "2026-07-23T20:16:12.938Z" }, ] +[[package]] +name = "antlr4-python3-runtime" +version = "4.9.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/3e/38/7859ff46355f76f8d19459005ca000b6e7012f2f1ca597746cbcd1fbfe5e/antlr4-python3-runtime-4.9.3.tar.gz", hash = "sha256:f224469b4168294902bb1efa80a8bf7855f24c99aef99cbefc1bcd3cce77881b", size = 117034, upload-time = "2021-11-06T17:52:23.524Z" } + [[package]] name = "anyio" version = "4.15.1" @@ -38,6 +48,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/12/b8/4bd346e22b28902df4d651910f5242c28d84e4a5c2435ca5c3f797ed7e2e/anyio-4.15.1-py3-none-any.whl", hash = "sha256:6152fdbbf9a77fdec97731721bebf7c4c44f7c29b424b0065826173efc7ed101", size = 132079, upload-time = "2026-09-05T10:42:37.923Z" }, ] +[[package]] +name = "backoff" +version = "2.2.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/47/d7/5bbeb12c44d7c4f2fb5b56abce497eb5ed9f34d85701de869acedd602619/backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba", size = 17001, upload-time = "2022-10-05T19:19:32.061Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/df/73/b6e24bd22e6720ca8ee9a85a0c4a2971af8497d8f3193fa05390cbd46e09/backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8", size = 15148, upload-time = "2022-10-05T19:19:30.546Z" }, +] + +[[package]] +name = "beautifulsoup4" +version = "4.15.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "soupsieve" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/43/65/318323f98dbee45d42dff61d8f047181bc6f2268a9068cfad035a46be5af/beautifulsoup4-4.15.0.tar.gz", hash = "sha256:288e3ca7d54b06f2ac191970bc275c1939cb46d450b255bf6718b04aa37ab4f7", size = 632571, upload-time = "2026-06-07T16:44:20.453Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/c6/92fcd42f1ba33e1184263f25bfabf3d27c383410470f169e4b8163bf9c17/beautifulsoup4-4.15.0-py3-none-any.whl", hash = "sha256:d6f88de62e1d4e38ecb1077eb9724cd0eff29d2a08ca16a401e9b9e93f117cf9", size = 109924, upload-time = "2026-06-07T16:44:21.566Z" }, +] + [[package]] name = "certifi" version = "2026.7.22" @@ -88,6 +120,24 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/fc/ad/d07d7862a62ffa6d79d68074d14823243dd235a77c45262acbf6adeb28bf/charset_normalizer-3.5.2-py3-none-any.whl", hash = "sha256:b6b751274acb69d77b3323d6b7dbaa3c7fdfc1eb829b7eb61d262f32e1af9685", size = 68872, upload-time = "2026-09-30T04:39:21.828Z" }, ] +[[package]] +name = "click" +version = "8.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/c7/0e/7fa0ef50764b67090eca4114772a2abf8b6148198475e54c660b97caeee6/click-8.5.0.tar.gz", hash = "sha256:ba0d2089de75ea0310e2dde03160e6ca10009947fb95a182f9b54021bb272e34", size = 382235, upload-time = "2026-08-26T13:33:14.56Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/58/50/6c0d534c5f134586a8e1ba4e330569e32f057e33372ae556463212fb4cd3/click-8.5.0-py3-none-any.whl", hash = "sha256:255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360", size = 125251, upload-time = "2026-08-26T13:33:12.928Z" }, +] + +[[package]] +name = "cloudpickle" +version = "3.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/27/fb/576f067976d320f5f0114a8d9fa1215425441bb35627b1993e5afd8111e5/cloudpickle-3.1.2.tar.gz", hash = "sha256:7fda9eb655c9c230dab534f1983763de5835249750e85fbcef43aaa30a9a2414", size = 22330, upload-time = "2025-11-03T09:25:26.604Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/39/799be3f2f0f38cc727ee3b4f1445fe6d5e4133064ec2e4115069418a5bb6/cloudpickle-3.1.2-py3-none-any.whl", hash = "sha256:9acb47f6afd73f60dc1df93bb801b472f05ff42fa6c84167d25cb206be1fbf4a", size = 22228, upload-time = "2025-11-03T09:25:25.534Z" }, +] + [[package]] name = "colorama" version = "0.4.6" @@ -97,6 +147,28 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, ] +[[package]] +name = "contourpy" +version = "1.4.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "numpy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/83/5a/a55177dd22553a277388e8a1b3220e92de91bacb28356cdc73caa240121d/contourpy-1.4.0.tar.gz", hash = "sha256:20156f5a1ac4f8ce02656e39a61e82164a3d359796dc8026f75b062783d500e1", size = 13323726, upload-time = "2026-09-11T19:05:05.808Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/97/ba/01bde9753bdbba04a6da9d2bff3881f021bc708f654655e95fae26d3b3a3/contourpy-1.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:186ba929df36d61b6127da2e89cd1357e4cb79aca647381ab1a6feb0b152877b", size = 297302, upload-time = "2026-09-11T19:02:45.103Z" }, + { url = "https://files.pythonhosted.org/packages/dd/f5/c5bf67522d49a2222f3154fe46879451d26f0e35ece41770758a64ea78cb/contourpy-1.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:c76f3a5318164db7d9401132fc1b5364b784c613c93fa506e3b5e6d1bf353ec8", size = 284921, upload-time = "2026-09-11T19:02:48.049Z" }, + { url = "https://files.pythonhosted.org/packages/0f/cc/cb989599eec12fda312e127eb8e04a8b21a7a6c94bf7ff1bc68273334a42/contourpy-1.4.0-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:43c3ccbb32c6294b183dcc8e8c46dacf5ecef809497e3d48a5be298eef185ad0", size = 356332, upload-time = "2026-09-11T19:02:51.408Z" }, + { url = "https://files.pythonhosted.org/packages/47/fb/6f620d7602507817b0b4c21dd790ed68688f1f4ae9c29aacf21f08db5cf1/contourpy-1.4.0-cp312-cp312-manylinux_2_26_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:86d05cec773c9507a3950122e0e40ce77c23c75ceeb2fc189514e71893cbb34b", size = 405878, upload-time = "2026-09-11T19:02:54.093Z" }, + { url = "https://files.pythonhosted.org/packages/32/4e/693c6d6bdece679f0953775eef3a1b66d56be55478d936e7deb1f3004422/contourpy-1.4.0-cp312-cp312-manylinux_2_26_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2deb580178ca19437a84bd77e4bc2cd91a8ccad212413a83c273900868b5978c", size = 408296, upload-time = "2026-09-11T19:02:56.528Z" }, + { url = "https://files.pythonhosted.org/packages/78/f9/b6831508960d559581c448532ba4df312217072975486dbf2b24fcc5b76f/contourpy-1.4.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:875f42444c9cf48d56f724f2637e60d0f73b3b12c9041e1484580a233edf9591", size = 383243, upload-time = "2026-09-11T19:02:58.638Z" }, + { url = "https://files.pythonhosted.org/packages/f2/21/52903825a0ae7bb625e8bd30a09816d4c3c5d6174a469c10a616166cf780/contourpy-1.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:f863c6100bf926cf47d13f3cd75f9bb8ebd98aaab230eeb4468b91f98f39a6b3", size = 1357306, upload-time = "2026-09-11T19:03:01.036Z" }, + { url = "https://files.pythonhosted.org/packages/d8/79/d68b1ce8539e4071518fed9523f558398f34dcd078b8927b109c72dad2ef/contourpy-1.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3863ef2e2b13fe93f8c0ebb08ee400cb07153b8b0e91c5acb26e4537f283634f", size = 1427243, upload-time = "2026-09-11T19:03:03.866Z" }, + { url = "https://files.pythonhosted.org/packages/ac/f0/b75a10e9d0616b97a30de277b6dfe83f1879880854c7330337309530eb48/contourpy-1.4.0-cp312-cp312-win32.whl", hash = "sha256:5450f091ac1be0be3ad3a2a3b3f23b5e443e78c670ced4fd347d626f92a28fd2", size = 347345, upload-time = "2026-09-11T19:03:06.192Z" }, + { url = "https://files.pythonhosted.org/packages/50/a9/dab08786bb4d77ef9a046b3c1be923be4e73c5d07d91f5a54e8ea9b09e41/contourpy-1.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:6e697d94e69f499ff6bebb899cae97a58d5d14f0e1fe9568b43a0248d2f9af8c", size = 234083, upload-time = "2026-09-11T19:03:08.122Z" }, + { url = "https://files.pythonhosted.org/packages/47/b9/3ba509755a970dbde5948e7142ac21f266be72f38017cc4087a05fdceee1/contourpy-1.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:0c7a4c2716a4e98342221954416a836cca77c996c14ddbf22b5f01d5d93ca09c", size = 559521, upload-time = "2026-09-11T19:03:10.047Z" }, +] + [[package]] name = "coverage" version = "7.16.2" @@ -121,6 +193,93 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/3f/0c/7a64e1ac90541a8edf50daef0914848011fb057a5bf55284a4811e21939a/coverage-7.16.2-py3-none-any.whl", hash = "sha256:11d28e9123a9156cb405d8d27b44256c9a58fb5decc2073a8f17862057e3aa0f", size = 215754, upload-time = "2026-09-27T12:28:59.075Z" }, ] +[[package]] +name = "cuda-bindings" +version = "13.4.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cuda-pathfinder" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/d7/38/87909f62598d02d9e5c536326aed1755f6bfa190285507b962bb601e0005/cuda_bindings-13.4.4-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b346bfe1dda49537537c06cc4727b2210d949d8aee883cb591bca46581629d00", size = 6488222, upload-time = "2026-10-14T12:35:20.703Z" }, + { url = "https://files.pythonhosted.org/packages/c2/f8/332443cf969734551891cdbd93657eaeaf747ac2b7dd73feb3422701b02b/cuda_bindings-13.4.4-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:433efa31e33c2868621b5f6036bd3bf5de9c45c5546cb1361a5f6ff3415b8bb5", size = 7172184, upload-time = "2026-10-14T12:35:22.817Z" }, +] + +[[package]] +name = "cuda-pathfinder" +version = "1.8.3" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b9/fb/f8e1890428f9f590b4beebd63b068aac1ce32a3331510c847b9f9a78f261/cuda_pathfinder-1.8.3-py3-none-any.whl", hash = "sha256:e29e59829c297a7a5233bd9cc71094fc5bddbd076951482670178f9eade39b1f", size = 62561, upload-time = "2026-10-02T03:20:23.712Z" }, +] + +[[package]] +name = "cuda-toolkit" +version = "13.0.3.0" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/c7/a79086a62c98befcdb8349656c6f114e2db3b8b2422f6e25c97a7f2a9a3c/cuda_toolkit-13.0.3.0-py2.py3-none-any.whl", hash = "sha256:d693caaa261214ddd7dbb60d68e71cbed884e68c2be7509778f3051da0b91c3f", size = 2512, upload-time = "2026-04-14T00:50:08.173Z" }, +] + +[package.optional-dependencies] +cublas = [ + { name = "nvidia-cublas", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-cuda-nvrtc", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +cudart = [ + { name = "nvidia-cuda-runtime", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +cufft = [ + { name = "nvidia-cufft", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-nvjitlink", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +cufile = [ + { name = "nvidia-cufile", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +cupti = [ + { name = "nvidia-cuda-cupti", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +curand = [ + { name = "nvidia-curand", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +cusolver = [ + { name = "nvidia-cublas", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-cusolver", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-cusparse", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-nvjitlink", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +cusparse = [ + { name = "nvidia-cusparse", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, + { name = "nvidia-nvjitlink", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +nvjitlink = [ + { name = "nvidia-nvjitlink", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +nvrtc = [ + { name = "nvidia-cuda-nvrtc", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] +nvtx = [ + { name = "nvidia-nvtx", marker = "platform_machine == 'aarch64' or platform_machine == 'x86_64'" }, +] + +[[package]] +name = "cycler" +version = "0.12.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a9/95/a3dbbb5028f35eafb79008e7522a75244477d2838f38cbb722248dabc2a8/cycler-0.12.1.tar.gz", hash = "sha256:88bb128f02ba341da8ef447245a9e138fae777f6a23943da4540077d3601eb1c", size = 7615, upload-time = "2023-10-07T05:32:18.335Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e7/05/c19819d5e3d95294a6f5947fb9b9629efb316b96de511b418c53d245aae6/cycler-0.12.1-py3-none-any.whl", hash = "sha256:85cef7cff222d8644161529808465972e51340599459b8ac3ccbac5a854e0d30", size = 8321, upload-time = "2023-10-07T05:32:16.783Z" }, +] + +[[package]] +name = "distro" +version = "1.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/fc/f8/98eea607f65de6527f8a2e8885fc8015d3e6f5775df186e443e0964a11c3/distro-1.9.0.tar.gz", hash = "sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed", size = 60722, upload-time = "2023-12-24T09:54:32.31Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/12/b3/231ffd4ab1fc9d679809f356cebee130ac7daa00d6d6f3206dd4fd137e9e/distro-1.9.0-py3-none-any.whl", hash = "sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2", size = 20277, upload-time = "2023-12-24T09:54:30.421Z" }, +] + [[package]] name = "dnspython" version = "2.9.0" @@ -130,6 +289,50 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/10/02/cdcc9b7c051786a103c3b09e1003a82fa0c66bcb91ffbdabcfbf7b4163b9/dnspython-2.9.0-py3-none-any.whl", hash = "sha256:9a4aedb833c3c1b49214d04d44d3032ab7a9135f7c1d29a549b4ff78fd82fda9", size = 354822, upload-time = "2026-10-09T00:07:22.622Z" }, ] +[[package]] +name = "einops" +version = "0.8.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/2c/77/850bef8d72ffb9219f0b1aac23fbc1bf7d038ee6ea666f331fa273031aa2/einops-0.8.2.tar.gz", hash = "sha256:609da665570e5e265e27283aab09e7f279ade90c4f01bcfca111f3d3e13f2827", size = 56261, upload-time = "2026-01-26T04:13:17.638Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/09/f8d8f8f31e4483c10a906437b4ce31bdf3d6d417b73fe33f1a8b59e34228/einops-0.8.2-py3-none-any.whl", hash = "sha256:54058201ac7087911181bfec4af6091bb59380360f069276601256a76af08193", size = 65638, upload-time = "2026-01-26T04:13:18.546Z" }, +] + +[[package]] +name = "filelock" +version = "4.2.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d4/08/d8f81287742010e38daf3632380c8d80ede7b4df2716f8ca3d0a2b087d44/filelock-4.2.2.tar.gz", hash = "sha256:b29ff2ae9140bb17b3bc77c648dc4f010d9ac0955eccabff4f2b01dde859f787", size = 651339, upload-time = "2026-10-18T07:26:44.624Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4e/53/35698fff350cb99c49ee01ae5cb1eb4408567792a286314ea984b53b5002/filelock-4.2.2-py3-none-any.whl", hash = "sha256:1851d2f14ca2901e98069d68333b33ad7409f56904e17b48cc0c32a0db8ed73a", size = 162415, upload-time = "2026-10-18T07:26:43.115Z" }, +] + +[[package]] +name = "fonttools" +version = "4.67.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/94/36/102e180f8f5dbaee88b26595b01ca8aa80bf4e62128d9aa94265b3996c96/fonttools-4.67.0.tar.gz", hash = "sha256:3cb57e6600ca77c0b1729cf8adc23bc0652633a37f18cfa934d9c7bc3de25519", size = 3750028, upload-time = "2026-10-14T13:20:28.294Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/5b/50/f674402869f11a89868c4755ae86cd2fcfd67ca6193c6f5d1b479b1267b9/fonttools-4.67.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:fcb9743140419410161acfe7ec205fb0a8a703acfccb85b586becb5a97c047c9", size = 3108316, upload-time = "2026-10-14T13:18:39.162Z" }, + { url = "https://files.pythonhosted.org/packages/e3/c8/5963603c5f9bbc28bde3a29dd7cdbe0bfcbee414b0f7eccec04ae477e1b6/fonttools-4.67.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ad813967410ba6d24a52850df59b164ee17883f17b96a91b4b0ac6e9d7b5a118", size = 2598450, upload-time = "2026-10-14T13:18:42.136Z" }, + { url = "https://files.pythonhosted.org/packages/25/6d/f8e5924917a6b5c0296fb507f748c139a34972f66e91d89159d5c98e27b2/fonttools-4.67.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:768a33bbe6ec5ba8f19979f938752f06d4e614cb554fd47abd7830f2007660e3", size = 5427391, upload-time = "2026-10-14T13:18:44.248Z" }, + { url = "https://files.pythonhosted.org/packages/c1/e0/ec9e4cc868c514deb02233aa1047a6aeb9350d3ee012862f58eec10ef834/fonttools-4.67.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:eb3c98cac93aac4b9f6e3ce2008325340b234cc9b0338ca6b513f31962a1e278", size = 5408233, upload-time = "2026-10-14T13:18:46.616Z" }, + { url = "https://files.pythonhosted.org/packages/cd/4a/fe409cb3ab32f322de92e08e6362cd06bf6dd5f0cee5980d823849e9bd11/fonttools-4.67.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e0ca4c8438dd6320f5850c9bbee3b3980455ee3bac602a9a0299caf9e799a0e8", size = 5364778, upload-time = "2026-10-14T13:18:48.926Z" }, + { url = "https://files.pythonhosted.org/packages/de/5b/2a8dede092113be56329dd210deb6b34c55df2f3d7270934ffece8c7d0bb/fonttools-4.67.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2a09d33a9264a6b29efca9dc633b53969aaedb250a9c8521d60f51280cef65ca", size = 5528522, upload-time = "2026-10-14T13:18:51.297Z" }, + { url = "https://files.pythonhosted.org/packages/6c/de/d3baf686e4ac5726a24819a670747c51571c774dcfa41cc0528e5e8c1a2d/fonttools-4.67.0-cp312-cp312-win32.whl", hash = "sha256:e8a8545cbd58bd29494ffe81e3cb35f8a29332a8e495c42bec334145ce8cd65b", size = 2446090, upload-time = "2026-10-14T13:18:53.379Z" }, + { url = "https://files.pythonhosted.org/packages/c1/3a/625a6dd0173e88dbea1826405b4bcbfa06c6ca095310ed720caba36b2e43/fonttools-4.67.0-cp312-cp312-win_amd64.whl", hash = "sha256:2bfab2f5d1d255dec82f4bd082a1c10e77df808e42210890f50a9c30bf91570e", size = 2497985, upload-time = "2026-10-14T13:18:55.245Z" }, + { url = "https://files.pythonhosted.org/packages/3d/61/4161946319472aaa9b897bd18ad5108a5b10f5ebaa503d921a001ac4fff9/fonttools-4.67.0-py3-none-any.whl", hash = "sha256:4304f03ed7f4ba000a8dcc941ad854bfa52e2f3b6112b8f099b6f431cf98e701", size = 1213142, upload-time = "2026-10-14T13:20:26.258Z" }, +] + +[[package]] +name = "fsspec" +version = "2026.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/77/cd/9be253869fc42e764de7f3dedd6969af7d44ff9c3375214a3442a6f3fc08/fsspec-2026.9.0.tar.gz", hash = "sha256:0f08147951c8cb31d844c3547d631053b127863b60be04cf06e121333ee0e2fe", size = 333545, upload-time = "2026-09-18T17:50:42.825Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6c/c0/a98505f18594f1bce828bb159cec0fcf9860562f1a2c85913409fc8f3d9e/fsspec-2026.9.0-py3-none-any.whl", hash = "sha256:8dd6e646e99ea382bd85f97a45e6b526a442d79423a7dc673f1e2756d05fcb5f", size = 221738, upload-time = "2026-09-18T17:50:41.341Z" }, +] + [[package]] name = "genai-prices" version = "0.0.73" @@ -143,6 +346,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a8/85/527a729ecd58b7169430e47febdab2e3f91193d0e3f5a56d721c04525709/genai_prices-0.0.73-py3-none-any.whl", hash = "sha256:64dfbbf55df91db6b74ff2b24ac752b8154952e0aed4e62868d6cd42710bf742", size = 92507, upload-time = "2026-07-29T12:48:57.194Z" }, ] +[[package]] +name = "google-crc32c" +version = "1.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/03/41/4b9c02f99e4c5fb477122cd5437403b552873f014616ac1d19ac8221a58d/google_crc32c-1.8.0.tar.gz", hash = "sha256:a428e25fb7691024de47fecfbff7ff957214da51eddded0da0ae0e0f03a2cf79", size = 14192, upload-time = "2025-12-16T00:35:25.142Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e9/5f/7307325b1198b59324c0fa9807cafb551afb65e831699f2ce211ad5c8240/google_crc32c-1.8.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:4b8286b659c1335172e39563ab0a768b8015e88e08329fa5321f774275fc3113", size = 31300, upload-time = "2025-12-16T00:21:56.723Z" }, + { url = "https://files.pythonhosted.org/packages/21/8e/58c0d5d86e2220e6a37befe7e6a94dd2f6006044b1a33edf1ff6d9f7e319/google_crc32c-1.8.0-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:2a3dc3318507de089c5384cc74d54318401410f82aa65b2d9cdde9d297aca7cb", size = 30867, upload-time = "2025-12-16T00:38:31.302Z" }, + { url = "https://files.pythonhosted.org/packages/ce/a9/a780cc66f86335a6019f557a8aaca8fbb970728f0efd2430d15ff1beae0e/google_crc32c-1.8.0-cp312-cp312-manylinux1_x86_64.manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:14f87e04d613dfa218d6135e81b78272c3b904e2a7053b841481b38a7d901411", size = 33364, upload-time = "2025-12-16T00:40:22.96Z" }, + { url = "https://files.pythonhosted.org/packages/21/3f/3457ea803db0198c9aaca2dd373750972ce28a26f00544b6b85088811939/google_crc32c-1.8.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cb5c869c2923d56cb0c8e6bcdd73c009c36ae39b652dbe46a05eb4ef0ad01454", size = 33740, upload-time = "2025-12-16T00:40:23.96Z" }, + { url = "https://files.pythonhosted.org/packages/df/c0/87c2073e0c72515bb8733d4eef7b21548e8d189f094b5dad20b0ecaf64f6/google_crc32c-1.8.0-cp312-cp312-win_amd64.whl", hash = "sha256:3cc0c8912038065eafa603b238abf252e204accab2a704c63b9e14837a854962", size = 34437, upload-time = "2025-12-16T00:35:21.395Z" }, +] + [[package]] name = "griffelib" version = "2.3.2" @@ -161,6 +377,22 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/04/4b/29cac41a4d98d144bf5f6d33995617b185d14b22401f75ca86f384e87ff1/h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86", size = 37515, upload-time = "2025-04-24T03:35:24.344Z" }, ] +[[package]] +name = "hf-xet" +version = "1.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9e/27/06d899ea7bd721d272f84aac98bdb238de98af4cc767a69056d967d68c71/hf_xet-1.7.0.tar.gz", hash = "sha256:d406ec79053c0871817f700c2ac8c36ba0d87f9c34b7458b0f0063bb218b0466", size = 985689, upload-time = "2026-10-06T20:18:43.89Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9c/0b/b03be21ffaada749ba0d3197d8aefbf1aa698bac149580421c15239b299e/hf_xet-1.7.0-cp38-abi3-macosx_10_12_x86_64.whl", hash = "sha256:e3e88a7a75d7d95cbee1f37dc31341d6201124cf21c6c4b1dfab8ccba9b09e0f", size = 3796096, upload-time = "2026-10-06T20:18:28.43Z" }, + { url = "https://files.pythonhosted.org/packages/c3/47/a26ebdce7056a61e931f228439bc0ab08cbec239d1690f965e5e637cba79/hf_xet-1.7.0-cp38-abi3-macosx_11_0_arm64.whl", hash = "sha256:59fba37039233c7fcbe196817d6cdcf1b40dfb17b410f229d85b0cf0a1848da4", size = 3560352, upload-time = "2026-10-06T20:18:30.365Z" }, + { url = "https://files.pythonhosted.org/packages/a3/4c/2bf3b66c215d409655f28de1622393dde04c9461280d48c7924bb3b2decd/hf_xet-1.7.0-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2814a6e999d13464c4d679b788cc5d784eb5a4edfc638a31f10e9a11ab531ef8", size = 4212180, upload-time = "2026-10-06T20:18:32.292Z" }, + { url = "https://files.pythonhosted.org/packages/49/0c/a2f703a5a78267556e89e03316fa0805c86b72b50829bc67665746e8ebf0/hf_xet-1.7.0-cp38-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:fcfd6c22418e57dd5b3aea649e813b2e2cfb2aebf317b210d90f1fe4b3018b52", size = 3990011, upload-time = "2026-10-06T20:18:34.21Z" }, + { url = "https://files.pythonhosted.org/packages/a4/77/e52e4201b1cbf571530a61cc57f70182045a39a230089ee5f1df182a4de2/hf_xet-1.7.0-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:80f79dae613ce9e0ea1fd1ae15616ca9ac74aed4c770aabc199c4f03ebecc863", size = 4190628, upload-time = "2026-10-06T20:18:36.062Z" }, + { url = "https://files.pythonhosted.org/packages/6c/dc/03a21b89f118664a0926ff25b0f8e44a519bf22724a6a8fc7a9abbc188b6/hf_xet-1.7.0-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:0a9e802f33bf50c851abe45fc5380e61f959e2d369647d6742b79ad9d6c27cab", size = 4418814, upload-time = "2026-10-06T20:18:37.888Z" }, + { url = "https://files.pythonhosted.org/packages/4d/59/b35106dfa71b6eef605dc88bd038fe99c7f86fb132a15b60d0bf2f235b2c/hf_xet-1.7.0-cp38-abi3-win_amd64.whl", hash = "sha256:2b7bb5727889b0f2436dbaaad8fc4c3e66b8240d992716989e0c086b4278b1bc", size = 3822644, upload-time = "2026-10-06T20:18:40.052Z" }, + { url = "https://files.pythonhosted.org/packages/48/cd/072313585f74fe9d441e2eb5e0a4703c30586cd709810ea369675f61b74e/hf_xet-1.7.0-cp38-abi3-win_arm64.whl", hash = "sha256:acc3851cf2576a8fb2ae926da863f4efabe21303cf292e9a44332802ab0dcc6a", size = 3662436, upload-time = "2026-10-06T20:18:42.205Z" }, +] + [[package]] name = "httpcore" version = "1.0.9" @@ -228,6 +460,26 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/9b/43/832f631d32e4f1211caa2ba368317739fe71f0b8530e4c9d15dc454bac2a/httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32", size = 6382, upload-time = "2026-08-07T00:13:06.567Z" }, ] +[[package]] +name = "huggingface-hub" +version = "2.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "filelock" }, + { name = "fsspec" }, + { name = "hf-xet", marker = "platform_machine == 'AMD64' or platform_machine == 'ARM64' or platform_machine == 'aarch64' or platform_machine == 'amd64' or platform_machine == 'arm64' or platform_machine == 'x86_64'" }, + { name = "httpx2" }, + { name = "packaging" }, + { name = "pyyaml" }, + { name = "tqdm" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/12/47/6858d63643e66fb4f6585c3cfd4029c0b2bc1ae21688cee9b3335f20a10d/huggingface_hub-2.2.0.tar.gz", hash = "sha256:5d1b47537394e4215cb858aa12fd493d0f7ef7f58990f5dcd24bc173107b2871", size = 1041026, upload-time = "2026-10-08T15:30:59.971Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/eb/b0/0f7b430fd100b3a3b037fdbb314878200241082e607b3383c63d91a13a72/huggingface_hub-2.2.0-py3-none-any.whl", hash = "sha256:1667f145dc56dc210d60966069397df9ecfca9607a5d43db88b308c89dae56b3", size = 839884, upload-time = "2026-10-08T15:30:57.914Z" }, +] + [[package]] name = "icmplib" version = "3.0.4" @@ -293,6 +545,62 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e1/8b/d76219ebdbcf3d4209d9d21a0810db4c8d0a6f88e3ee87d30bdea4e90d30/jiter-0.17.0-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2c0bf24c72fd0491405dce5d40194f2070e9021ce648c1a1d46234b93d848ff", size = 307147, upload-time = "2026-09-12T15:14:12.897Z" }, ] +[[package]] +name = "joblib" +version = "1.6.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cloudpickle" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/d5/1d/537ab090f302b838943a1b56497dd53059b9a9b46a074936470173a2e207/joblib-1.6.0.tar.gz", hash = "sha256:2ccc96785b12046c08fd6d55839c12857831b54a3c1673ffadd2f04bfc4eda03", size = 327903, upload-time = "2026-08-31T09:39:04.122Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/18/53/84099323c2ec4be98d935f63c033ac4151ee83836ca1050ede3b3aadf155/joblib-1.6.0-py3-none-any.whl", hash = "sha256:3dbbf9f6e4b592a2357b854608e980fe6390d131d7a82f011a377ef2ebef7aba", size = 306115, upload-time = "2026-08-31T09:39:02.298Z" }, +] + +[[package]] +name = "kiwisolver" +version = "1.5.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ba/07/bd78e6a8fae171ea041ef5bba3ed21a003522fa088834b069b1909981f30/kiwisolver-1.5.1.tar.gz", hash = "sha256:f1303ef2eec81262a4b708c3e858afe58d7c75ad91c1c05266eda7673369859a", size = 104395, upload-time = "2026-08-28T10:28:27.153Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6b/9b/65b302742389c6f96f2956bef5decf26011309feb2fc5d79613af18adea4/kiwisolver-1.5.1-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:63fb7294b768f444eb4b068965f2662f28c2fd4161e23bd60fcf3ff27b74c046", size = 123876, upload-time = "2026-08-28T10:25:27.44Z" }, + { url = "https://files.pythonhosted.org/packages/71/74/c21f339956f6f691b2ed7e31d5f3ae767304df6c460192739fc830853051/kiwisolver-1.5.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:0ebdef3eae5336568147c39a55be6a2036ffde53faa9ca2d978989ae7c2da12c", size = 66487, upload-time = "2026-08-28T10:25:28.728Z" }, + { url = "https://files.pythonhosted.org/packages/84/e5/bdb34e21523e01dceda064d63713f3bdec91388af24fba1eca7ea5e85864/kiwisolver-1.5.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:1798e83840c3f627246104c4d8a9639c60fa068adf9ce92b61791781fa8a68c1", size = 64660, upload-time = "2026-08-28T10:25:30.071Z" }, + { url = "https://files.pythonhosted.org/packages/fc/f4/dadfec469313c7f428efa7e84b4aba9732f813c13ea7131a24b7b008ef57/kiwisolver-1.5.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:34633ecf50d16187ab8e5528b7a2530f2feb4e23f300db4672538b51cfc5cd38", size = 1477929, upload-time = "2026-08-28T10:25:31.495Z" }, + { url = "https://files.pythonhosted.org/packages/6f/35/09c58daac34e6f6ea5c6dee0094b422118e5a7c265586008a95fd135ac5f/kiwisolver-1.5.1-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d27c2123977cb9269c30a49ba45f03a4323017ef693e19db4ec9dbe1299a3002", size = 1278499, upload-time = "2026-08-28T10:25:33.375Z" }, + { url = "https://files.pythonhosted.org/packages/19/32/739765e24fbad29d13f83e546ea4abc215a78cea9d677ca09025b027724d/kiwisolver-1.5.1-cp312-cp312-manylinux_2_24_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:6a797a1cefc8b9c93170db580337e1fe3d011ad18b1299943231279406342048", size = 1296677, upload-time = "2026-08-28T10:25:35.059Z" }, + { url = "https://files.pythonhosted.org/packages/df/32/03304d1010e2cc45e5b3b52cef7e43fed3a2a5cd6c87a89b4a88e1d85b5d/kiwisolver-1.5.1-cp312-cp312-manylinux_2_24_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2551cf9917af48ee7c4b29cc82320489508cf96fd26a51f6fc124de661cd44c7", size = 1346037, upload-time = "2026-08-28T10:25:36.705Z" }, + { url = "https://files.pythonhosted.org/packages/3e/57/4c49377bfd274450dd72ecaa13eaac32ea804a03363e4d1db0c5aa999ceb/kiwisolver-1.5.1-cp312-cp312-manylinux_2_39_riscv64.whl", hash = "sha256:38f6e0deb4d0a4615efe0c4efc5990b06ae450ab50a0b321c0b078b6d238c083", size = 988248, upload-time = "2026-08-28T10:25:38.299Z" }, + { url = "https://files.pythonhosted.org/packages/cb/c3/38df144a08b6c5d75ca4504e5cc3141bb3bfef64c04f4ef48204f42711b6/kiwisolver-1.5.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:bfd1de989b3330420e29de39352f5c049905c9e3ee67233a50d550e3d652c148", size = 2228722, upload-time = "2026-08-28T10:25:40.038Z" }, + { url = "https://files.pythonhosted.org/packages/e7/11/3221838a89cd64d9b386353e000cd8a296069a20fbe3584507fdfd5bebae/kiwisolver-1.5.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:1209042a623ddfda5497e4066c7b77651dde8e1d3a9dd97599dc7e97f3b9b78c", size = 2325216, upload-time = "2026-08-28T10:25:41.699Z" }, + { url = "https://files.pythonhosted.org/packages/83/d4/075c219230697bb5db910d37262b9bacf880f92b4811a02ab81ed073a253/kiwisolver-1.5.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:26e8268480be5061d509e29669d59103c067a26377a56491630ece11762e3858", size = 1977689, upload-time = "2026-08-28T10:25:43.559Z" }, + { url = "https://files.pythonhosted.org/packages/bb/08/1d219c3c2dd960983d0d4da623d916e9de6385df2b0bab3d1af0e9b8fccc/kiwisolver-1.5.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:d79308fa689fac89cbcfbd4dbfc80b5f95c54c5a7fd4d194be221f9d33d026e6", size = 2491443, upload-time = "2026-08-28T10:25:45.242Z" }, + { url = "https://files.pythonhosted.org/packages/ba/d3/024208ec1079d273f1047468d1bdffbf38bb75b7b268090fd3a0301b9d9a/kiwisolver-1.5.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b03af77d77e50edba2030fd5f7c352ff209314b09030a3cba7c14edf9a09a444", size = 2295200, upload-time = "2026-08-28T10:25:46.984Z" }, + { url = "https://files.pythonhosted.org/packages/6e/7c/7b210498f9f92e1cd7855f260fa69ef056881087b199ee20c208f0e4189a/kiwisolver-1.5.1-cp312-cp312-win_amd64.whl", hash = "sha256:06a6917674de9e0fe3f66f5430787f59a9f2ddb64af9b714eaec547e29ef5c19", size = 70748, upload-time = "2026-08-28T10:25:48.444Z" }, + { url = "https://files.pythonhosted.org/packages/94/61/ef0daa157c8bb23672f7423e0d14c39db1dc6ef8ed47e6bc54c9c1bef3bf/kiwisolver-1.5.1-cp312-cp312-win_arm64.whl", hash = "sha256:ad8b9671348d7c8716715652ae11f85ed0eb99e265a2df2ca490577d69860b2c", size = 68324, upload-time = "2026-08-28T10:25:49.81Z" }, + { url = "https://files.pythonhosted.org/packages/a9/c4/1407df7512a5b36cc79840e01710dc575733c461b13ab866cae77eaf87f3/kiwisolver-1.5.1-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:482676e5bd48d70ac99d9fc78863469845421e01184fa83f1f9366dc49f7e974", size = 134002, upload-time = "2026-08-28T10:28:08.881Z" }, + { url = "https://files.pythonhosted.org/packages/16/45/c37a21ad5c0ab581a93c55ad544721aaa1f0ae94edb29c6a678a23d013e6/kiwisolver-1.5.1-graalpy312-graalpy250_312_native-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:072bdb15a3c19a5b5dbc8f8fb1f4e1884bf4f3507eeb4cc6334401274d37a5c0", size = 194292, upload-time = "2026-08-28T10:28:11.06Z" }, + { url = "https://files.pythonhosted.org/packages/a6/c1/69f00d627949580e43d57af0aa465df46868d7c29801c137a55374101294/kiwisolver-1.5.1-graalpy312-graalpy250_312_native-win_amd64.whl", hash = "sha256:a5a00665d1a0e26763a7338d7e911d4598fbc1d50dd0d6b7919b7dc6c5d6569f", size = 73362, upload-time = "2026-08-28T10:28:12.449Z" }, +] + +[[package]] +name = "lightgbm" +version = "4.7.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "narwhals" }, + { name = "numpy" }, + { name = "scipy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/63/8e/4db5e29290d7e619c307fdb8dab0a0514090af2ce3ec483050e024ec6126/lightgbm-4.7.0.tar.gz", hash = "sha256:f8e20f682c9aabd000bcf4a7ed8aa6f473c1adfecccae34ec24e823d156f4af0", size = 1792896, upload-time = "2026-07-18T21:00:56.139Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cd/05/7213965863cba1ed0150ad045bceed6276a1afaaaedbaeff4699ec4f0ccb/lightgbm-4.7.0-py3-none-macosx_10_15_x86_64.whl", hash = "sha256:dfc1cfe8e760387be1e7ba7a214688be21fdff96e4ed9749188f83e1877c2477", size = 1877851, upload-time = "2026-07-18T21:00:35.225Z" }, + { url = "https://files.pythonhosted.org/packages/b2/86/f4fe714f2e0bf3941705a20d7f6849dc476276d71236e82ea6b0d6539b86/lightgbm-4.7.0-py3-none-macosx_12_0_arm64.whl", hash = "sha256:129535462686f274df179133643118c5c5c5667167fe6c3a28d955f0b3c8e868", size = 1498914, upload-time = "2026-07-18T21:00:36.549Z" }, + { url = "https://files.pythonhosted.org/packages/c6/a3/b29580948b92e8c2f84dea70118ac702ff067dc52ec4ffb5d73c953536a5/lightgbm-4.7.0-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d4529acec5c6fefe4768302a529707d0ead90f6a6f42df694b856212e09695b8", size = 3349492, upload-time = "2026-07-18T21:00:37.943Z" }, + { url = "https://files.pythonhosted.org/packages/15/eb/837ea3b40cc36e22eeebb9785c01e42b2c255d033eea1d2d9ee8e2540e55/lightgbm-4.7.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d23e922acd891e77212e4d0fbcee9ba973c96dee479491341d05ba595357ebb7", size = 3476028, upload-time = "2026-07-18T21:00:39.331Z" }, + { url = "https://files.pythonhosted.org/packages/d5/0b/c5c17d862b12ce292f24cd85d40f2f8f8981668fbdbd43fdc2625eccbc79/lightgbm-4.7.0-py3-none-win_amd64.whl", hash = "sha256:f42d1e5b32b6f170e606d7c689c6165671da98d7bf37f1addec2623efc8740c9", size = 1360833, upload-time = "2026-07-18T21:00:40.865Z" }, +] + [[package]] name = "logfire-api" version = "5.2.0" @@ -302,6 +610,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b9/5a/cd2d6e41b04c932c33dd027e119e3b6923c740e7b68da6f78cfb901040b4/logfire_api-5.2.0-py3-none-any.whl", hash = "sha256:f4bd56df590ba7e7a32adb0302c82af38dc4edb9eecd03b1bfa03ffa581eecf8", size = 151057, upload-time = "2026-10-13T17:36:29.201Z" }, ] +[[package]] +name = "markdown-it-py" +version = "4.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mdurl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/06/ff/7841249c247aa650a76b9ee4bbaeae59370dc8bfd2f6c01f3630c35eb134/markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49", size = 82454, upload-time = "2026-05-07T12:08:28.36Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/81/4da04ced5a082363ecfa159c010d200ecbd959ae410c10c0264a38cac0f5/markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a", size = 91687, upload-time = "2026-05-07T12:08:27.182Z" }, +] + [[package]] name = "markupsafe" version = "3.0.4" @@ -325,6 +645,82 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c5/8e/4c24208776a65878d656996945aacfbfe010d3720d1a98fc0eb8491fc03b/markupsafe-3.0.4-cp312-cp312-win_arm64.whl", hash = "sha256:a4bbd2d87dd233b9fc5812160c3d0ffbe42edc22a26ce0469f58479ede633fe9", size = 14174, upload-time = "2026-10-02T23:05:07.617Z" }, ] +[[package]] +name = "matplotlib" +version = "3.11.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "contourpy" }, + { name = "cycler" }, + { name = "fonttools" }, + { name = "kiwisolver" }, + { name = "numpy" }, + { name = "packaging" }, + { name = "pillow" }, + { name = "pyparsing" }, + { name = "python-dateutil" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e7/c8/9aa712a0afb882649424dd8de8ad9aa6235e796e84c6052e8f6dc1598d0d/matplotlib-3.11.2.tar.gz", hash = "sha256:cec596316640f2b394b8f0daa0ea61a8eae82d017b620b9f202befb972a59ea4", size = 32660610, upload-time = "2026-09-11T19:05:31.214Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/ce/1bfcc4873b121597791ad74032943b123218c0613af0b97e8dd05e916fb1/matplotlib-3.11.2-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ef752769cd962f39ea0b6ffc82d1ea43a0012c5a6157c7a075212fa509cfcff2", size = 9476466, upload-time = "2026-09-11T19:03:19.45Z" }, + { url = "https://files.pythonhosted.org/packages/a6/c4/7f5f3601ee69baf072c0c7d3ce60c03e0618621c5a56c34a62a460e29d11/matplotlib-3.11.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ef31985c4dedb5f1424e1aec6849a47dd37689cb7fa3c20b1b82187f26806261", size = 9305583, upload-time = "2026-09-11T19:03:22.39Z" }, + { url = "https://files.pythonhosted.org/packages/b8/90/2b3fd67ee273163faeda6d514be70b5596eaa0fd77b60ffc294ad0b34f5f/matplotlib-3.11.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:df4f7784aca81a94f254c0a2767d592ee25f407e488f5fa7203e51093fb6ca27", size = 9860353, upload-time = "2026-09-11T19:03:25.049Z" }, + { url = "https://files.pythonhosted.org/packages/f4/84/32549e7a462dc311aed2ab62e5d2538028840b5c53a8be0195c789937c3d/matplotlib-3.11.2-cp312-cp312-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1b9a7ad579856284135e401ecc918c5f8a017ee30539298862a109f51b971710", size = 10670348, upload-time = "2026-09-11T19:03:28.108Z" }, + { url = "https://files.pythonhosted.org/packages/84/39/02e21b74f7439bd643d717ea846006d46e309e6d29b632b57751265311d6/matplotlib-3.11.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3aa4b8516fd26659e4363abbf317c703d9116496c5db2e9d0609a2866dd39dd2", size = 10810580, upload-time = "2026-09-11T19:03:31.402Z" }, + { url = "https://files.pythonhosted.org/packages/04/93/0d239bde12b308262265c2d98909b2f0ecad2b5deeae96241642e822e9c7/matplotlib-3.11.2-cp312-cp312-win_amd64.whl", hash = "sha256:c5c1c68ee401fc98271263410f0e5ce88285abacf7627132914e8adf3d70ff43", size = 9349409, upload-time = "2026-09-11T19:03:34.195Z" }, + { url = "https://files.pythonhosted.org/packages/49/a8/06baf901c02246c8a222b655cc4540ef9c15e1549a04e07927f9cde716c3/matplotlib-3.11.2-cp312-cp312-win_arm64.whl", hash = "sha256:643ff850d8e0f5b8319337f87ed3cb59506afb3df3cc48de777d85871233be7b", size = 9028084, upload-time = "2026-09-11T19:03:37.032Z" }, +] + +[[package]] +name = "mdurl" +version = "0.1.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d6/54/cfe61301667036ec958cb99bd3efefba235e65cdeb9c84d24a8293ba1d90/mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba", size = 8729, upload-time = "2022-08-14T12:40:10.846Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8", size = 9979, upload-time = "2022-08-14T12:40:09.779Z" }, +] + +[[package]] +name = "mlx" +version = "0.32.4" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mlx-metal" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/69/b0/e726ce51e1b445e4ed08c2d0e036a01c7532f4d1a856328da546a6f883bd/mlx-0.32.4-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:ff1d7be54758ea3a875b8fe54eff13bed17ad9566505e301f5d7851bf869680f", size = 667597, upload-time = "2026-10-14T21:16:00.688Z" }, + { url = "https://files.pythonhosted.org/packages/6d/92/7a999dcf6460525a31e555905cdca2f835ec0d786c528e969e04cd00d158/mlx-0.32.4-cp312-cp312-macosx_15_0_arm64.whl", hash = "sha256:f0604cb3015091f285c79c7b7dbfcabcfa9948248728c7bab6e0263513c3d3fe", size = 667599, upload-time = "2026-10-14T21:16:02.467Z" }, + { url = "https://files.pythonhosted.org/packages/af/44/90bbdc3cdd120e1181f7c4f617ff996530159f2ea3ba3c08b83b08314d21/mlx-0.32.4-cp312-cp312-macosx_26_0_arm64.whl", hash = "sha256:7928869076db6267ab3ebdb253b2c80be1e738b3032c783170bd1d59d460c578", size = 667622, upload-time = "2026-10-14T21:16:04.219Z" }, +] + +[[package]] +name = "mlx-metal" +version = "0.32.4" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/77/24/7e5b7ed5d28abacab4577c7a8dd1fca6e9058504f5f95ae4333c09420e2e/mlx_metal-0.32.4-py3-none-macosx_14_0_arm64.whl", hash = "sha256:8019b2db622599267d66cc168b2f0dbf5af929790a6c3b3913e00eabc42a7947", size = 44958619, upload-time = "2026-10-14T21:14:45.727Z" }, + { url = "https://files.pythonhosted.org/packages/54/8c/9754dd6c4db485037f59cc8be6495738e14cdeb8bf19d5bddb5e96da890f/mlx_metal-0.32.4-py3-none-macosx_15_0_arm64.whl", hash = "sha256:9f0a3cc26d89724434d9684932fc6f3e4e83669d2a895d858ed2c8a55eb84e8b", size = 44942974, upload-time = "2026-10-14T21:14:50.012Z" }, + { url = "https://files.pythonhosted.org/packages/2a/d6/4340ed6e184f71693d7f531c9ae55d677451351245760d71f8dd714dcbe5/mlx_metal-0.32.4-py3-none-macosx_26_0_arm64.whl", hash = "sha256:514df92d41a286895d2564b4b18f4da45096bd7a4a0c47e1042f345ad5a7f936", size = 78106861, upload-time = "2026-10-14T21:14:56.184Z" }, +] + +[[package]] +name = "mpmath" +version = "1.3.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e0/47/dd32fa426cc72114383ac549964eecb20ecfd886d1e5ccf5340b55b02f57/mpmath-1.3.0.tar.gz", hash = "sha256:7a28eb2a9774d00c7bc92411c19a89209d5da7c4c9a9e227be8330a23a25b91f", size = 508106, upload-time = "2023-03-07T16:47:11.061Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/43/e3/7d92a15f894aa0c9c4b49b8ee9ac9850d6e63b03c9c32c0367a13ae62209/mpmath-1.3.0-py3-none-any.whl", hash = "sha256:a0b2b9fe80bbcd81a6647ff13108738cfb482d481d826cc0e02f5b35e5c88d2c", size = 536198, upload-time = "2023-03-07T16:47:09.197Z" }, +] + +[[package]] +name = "narwhals" +version = "2.27.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/bf/21/f64d6b2dbea7bf3f8c38cdc786dcc6ef012ca3d173ad208c782c9a7bedf6/narwhals-2.27.1.tar.gz", hash = "sha256:aed93076a3ea42d9c32c88e4eb5ea422a21937011cbe1f480f9572a523c82094", size = 735013, upload-time = "2026-10-10T06:52:18.113Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/89/5d4c86da1130d9059681e5b6cd7645df5c10279a6a079c5c37dcb2cc6f3f/narwhals-2.27.1-py3-none-any.whl", hash = "sha256:d057df13f5852b8e157596e82eb5e955fad267425df5e420e0ee9863da483b31", size = 483211, upload-time = "2026-10-10T06:52:16.32Z" }, +] + [[package]] name = "netcortex-agent" version = "0.1.0" @@ -382,6 +778,52 @@ requires-dist = [ { name = "pydantic-settings", specifier = ">=2.9,<3" }, ] +[[package]] +name = "netcortex-detector" +version = "0.1.0" +source = { editable = "packages/detector" } +dependencies = [ + { name = "netcortex-core" }, + { name = "numpy" }, + { name = "pandas" }, + { name = "pyarrow" }, +] + +[package.optional-dependencies] +cloud = [ + { name = "tabpfn" }, + { name = "tabpfn-client" }, + { name = "tabpfn-extensions" }, + { name = "torch" }, +] +dev = [ + { name = "pytest" }, + { name = "ruff" }, +] +local = [ + { name = "tabpfn" }, + { name = "tabpfn-extensions" }, + { name = "torch" }, +] + +[package.metadata] +requires-dist = [ + { name = "netcortex-core", editable = "packages/core" }, + { name = "numpy", specifier = ">=2.0" }, + { name = "pandas", specifier = ">=2.2" }, + { name = "pyarrow", specifier = ">=18" }, + { name = "pytest", marker = "extra == 'dev'", specifier = ">=8" }, + { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.9" }, + { name = "tabpfn", marker = "extra == 'cloud'", specifier = ">=9.2.0" }, + { name = "tabpfn", marker = "extra == 'local'", specifier = ">=9.2.0" }, + { name = "tabpfn-client", marker = "extra == 'cloud'", specifier = ">=0.6.1" }, + { name = "tabpfn-extensions", marker = "extra == 'cloud'", specifier = ">=0.6.3" }, + { name = "tabpfn-extensions", marker = "extra == 'local'", specifier = ">=0.6.3" }, + { name = "torch", marker = "extra == 'cloud'", specifier = ">=2.14.1" }, + { name = "torch", marker = "extra == 'local'", specifier = ">=2.14.1" }, +] +provides-extras = ["cloud", "local", "dev"] + [[package]] name = "netcortex-fixes" version = "0.1.0" @@ -393,64 +835,320 @@ dependencies = [ { name = "pyyaml" }, ] -[package.metadata] -requires-dist = [ - { name = "httpx", specifier = ">=0.27,<1" }, - { name = "jinja2", specifier = ">=3.1,<4" }, - { name = "netcortex-core", editable = "packages/core" }, - { name = "pyyaml", specifier = ">=6,<7" }, +[package.metadata] +requires-dist = [ + { name = "httpx", specifier = ">=0.27,<1" }, + { name = "jinja2", specifier = ">=3.1,<4" }, + { name = "netcortex-core", editable = "packages/core" }, + { name = "pyyaml", specifier = ">=6,<7" }, +] + +[[package]] +name = "netcortex-notify" +version = "0.1.0" +source = { editable = "packages/notify" } +dependencies = [ + { name = "httpx" }, + { name = "netcortex-core" }, +] + +[package.optional-dependencies] +test = [ + { name = "pytest" }, +] + +[package.metadata] +requires-dist = [ + { name = "httpx", specifier = ">=0.27,<1" }, + { name = "netcortex-core", editable = "packages/core" }, + { name = "pytest", marker = "extra == 'test'", specifier = ">=8,<9" }, +] +provides-extras = ["test"] + +[[package]] +name = "netcortex-runbook" +version = "0.1.0" +source = { editable = "packages/runbook" } +dependencies = [ + { name = "beautifulsoup4" }, + { name = "httpx" }, + { name = "netcortex-core" }, + { name = "psycopg", extra = ["binary"] }, +] + +[package.optional-dependencies] +test = [ + { name = "pytest" }, +] + +[package.metadata] +requires-dist = [ + { name = "beautifulsoup4", specifier = ">=4.12,<5" }, + { name = "httpx", specifier = ">=0.27,<1" }, + { name = "netcortex-core", editable = "packages/core" }, + { name = "psycopg", extras = ["binary"], specifier = ">=3.2,<4" }, + { name = "pytest", marker = "extra == 'test'", specifier = ">=8,<9" }, +] +provides-extras = ["test"] + +[[package]] +name = "netcortex-simgen" +version = "0.1.0" +source = { editable = "packages/simgen" } +dependencies = [ + { name = "httpx" }, + { name = "netcortex-core" }, + { name = "numpy" }, + { name = "pandas" }, + { name = "psycopg", extra = ["binary"] }, + { name = "pyarrow" }, + { name = "pyyaml" }, +] + +[package.metadata] +requires-dist = [ + { name = "httpx", specifier = ">=0.27" }, + { name = "netcortex-core", editable = "packages/core" }, + { name = "numpy", specifier = ">=2.1" }, + { name = "pandas", specifier = ">=2.2" }, + { name = "psycopg", extras = ["binary"], specifier = ">=3.2" }, + { name = "pyarrow", specifier = ">=18" }, + { name = "pyyaml", specifier = ">=6" }, +] + +[[package]] +name = "netcortex-workspace" +version = "0.1.0" +source = { virtual = "." } +dependencies = [ + { name = "netcortex-agent" }, + { name = "netcortex-collector" }, + { name = "netcortex-core" }, + { name = "netcortex-fixes" }, +] + +[package.dev-dependencies] +dev = [ + { name = "pytest" }, + { name = "pytest-cov" }, + { name = "ruff" }, +] + +[package.metadata] +requires-dist = [ + { name = "netcortex-agent", editable = "packages/agent" }, + { name = "netcortex-collector", editable = "services/collector" }, + { name = "netcortex-core", editable = "packages/core" }, + { name = "netcortex-fixes", editable = "packages/fixes" }, +] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.3,<9" }, + { name = "pytest-cov", specifier = ">=6,<7" }, + { name = "ruff", specifier = ">=0.11,<1" }, +] + +[[package]] +name = "networkx" +version = "3.7" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/dc/76/3af777226b63a5e64a6b36b1ec5855c14e2b94a37096d4760e595fc43511/networkx-3.7.tar.gz", hash = "sha256:fd77a511bd90f39f3d016351345b52cf5319b813bdca01de3f755d3cca62e96a", size = 1866482, upload-time = "2026-09-21T16:45:16.974Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7e/cd/fe58041e9011f307c490e3e17dd48cc516448f7c698a3f2d9d9d65d7e6a8/networkx-3.7-py3-none-any.whl", hash = "sha256:e3fd2c13a7814cee3746340d8d7f8598a67f16a58bf47fb7f8793fab6efca1b0", size = 2142205, upload-time = "2026-09-21T16:45:14.609Z" }, +] + +[[package]] +name = "numpy" +version = "2.5.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/95/b0/c7453d0b6e2073c3264468b106ee1563750cecc910965e67357e3698c83e/numpy-2.5.4.tar.gz", hash = "sha256:9a94cf751c9ad8ebaa835bcd3d40dacf8534ad086b88c38029b65123c7999d2a", size = 20866315, upload-time = "2026-10-10T20:05:31.422Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d0/97/ba2074e92b7befea137e77ea8471e768bbd87c339b7e8c9f5a931949f977/numpy-2.5.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c6342f54c67093cae5c0227eb0eb772fdb79f2a2c37a6eb278b9909ee06aa356", size = 17001609, upload-time = "2026-10-10T20:02:40.843Z" }, + { url = "https://files.pythonhosted.org/packages/ff/a9/bac826765e971d8e16e2064e9ac7525fd69b40ac17c905033a7f5442023f/numpy-2.5.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b11e8fda06a7d69f15ebf542660b74466c2e51094800c1fb794f47ad4faeef17", size = 12015718, upload-time = "2026-10-10T20:02:43.45Z" }, + { url = "https://files.pythonhosted.org/packages/31/2f/5ea3570fcb8ccd0882bea99436a513b2c85dad8f774a2057849130a8fb99/numpy-2.5.4-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:9cb18a327b49c5c337f972b03682f6a49855525faaf3c0d3e9c96cd0fd8880a8", size = 5451717, upload-time = "2026-10-10T20:02:46.169Z" }, + { url = "https://files.pythonhosted.org/packages/34/f2/b4fc1bafca03868220b5eaf729d2f21ebd7d7b151c0f9e144fe212bbca35/numpy-2.5.4-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:aec3fc4b32ff82421274f5d205c559c51c840c8df66a78efd7f3612dd005a26a", size = 6789926, upload-time = "2026-10-10T20:02:48.139Z" }, + { url = "https://files.pythonhosted.org/packages/dc/96/8319e2457ae4333c62c815c7006b869a4f60985c1e01024c2f8c6c040fe5/numpy-2.5.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fe4d21ab149f15e4e6043dfb0de87e6e5f34ac176cde83060e9802981fca2ac2", size = 15695312, upload-time = "2026-10-10T20:02:50.115Z" }, + { url = "https://files.pythonhosted.org/packages/43/a3/c799c62e19c337e6d3770b08e475887fb30ce8477d3c09efca6b2f0228a6/numpy-2.5.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fbde6962867ee75b48b0ee29b2b9372ec5d617799dbaf38e82dc0596f2f7738a", size = 16727283, upload-time = "2026-10-10T20:02:53.186Z" }, + { url = "https://files.pythonhosted.org/packages/39/6b/3604e53fb00314d0dc1b94ec9125a1484f649c0a17480b1f0f0c7a9d6250/numpy-2.5.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:381a7a3d2e65e64c0ec302795ab9dc12bb1e73f150904699c153716177eebdaf", size = 17047890, upload-time = "2026-10-10T20:02:56.038Z" }, + { url = "https://files.pythonhosted.org/packages/4a/7a/e8b58a5289a0d464c52885de47c35a935cdd70c03a4c3ab94a5126416dd0/numpy-2.5.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b89d0aaae2fe498c648f4c4795c084db535af5bd98ef942b2a3681fb74ce8645", size = 18485839, upload-time = "2026-10-10T20:02:59.018Z" }, + { url = "https://files.pythonhosted.org/packages/6f/c9/47094f597015009f310b8c900def59065ef1ff5a6fe7b51fc65ec58ec2c6/numpy-2.5.4-cp312-cp312-win32.whl", hash = "sha256:9968ab7e49b93ac6e1c3b2239732183152c9150f16308d30b66a372cffe3483c", size = 6138936, upload-time = "2026-10-10T20:03:01.626Z" }, + { url = "https://files.pythonhosted.org/packages/12/33/fefe62073dc8acfd0f2b9ed7c003af2f50aa61555e113e6db02b8f79f145/numpy-2.5.4-cp312-cp312-win_amd64.whl", hash = "sha256:a7b1b6353e36a7e50de2973a38d705c88ee93adcf120673cee7f45a4a3fa223a", size = 12573091, upload-time = "2026-10-10T20:03:04.349Z" }, + { url = "https://files.pythonhosted.org/packages/1a/07/161270b0c2eec56e4c905f6d6d22e1b836887b2cb189d3f5820aa588e9dd/numpy-2.5.4-cp312-cp312-win_arm64.whl", hash = "sha256:aa1cce2ff3f8d953de38b76bf44602caeb69f101430208f64a10067f7cb4b1d3", size = 10521630, upload-time = "2026-10-10T20:03:06.767Z" }, +] + +[[package]] +name = "nvidia-cublas" +version = "13.1.1.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nvidia-cuda-nvrtc" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/a1/0bd24ee8c8d03adac032fd2909426a00c88f8c57961b1277ded97f91119f/nvidia_cublas-13.1.1.3-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:b7a210458267ac818974c53038fbec2e969d5c99f305ab15c72522fa9f001dd5", size = 542848918, upload-time = "2026-04-08T18:46:22.985Z" }, + { url = "https://files.pythonhosted.org/packages/3b/cd/154ca20c38269e05eff77c1464e6c1da89f50a6390b565e9d82e06bc11e1/nvidia_cublas-13.1.1.3-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:37936a16db8fe4ac1f065c2139360608a543a09275cb1a1af612e08cfa065436", size = 423138758, upload-time = "2026-04-08T18:46:58.655Z" }, +] + +[[package]] +name = "nvidia-cuda-cupti" +version = "13.0.85" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/2a/2a/80353b103fc20ce05ef51e928daed4b6015db4aaa9162ed0997090fe2250/nvidia_cuda_cupti-13.0.85-py3-none-manylinux_2_25_aarch64.whl", hash = "sha256:796bd679890ee55fb14a94629b698b6db54bcfd833d391d5e94017dd9d7d3151", size = 10310827, upload-time = "2025-09-04T08:26:42.012Z" }, + { url = "https://files.pythonhosted.org/packages/33/6d/737d164b4837a9bbd202f5ae3078975f0525a55730fe871d8ed4e3b952b0/nvidia_cuda_cupti-13.0.85-py3-none-manylinux_2_25_x86_64.whl", hash = "sha256:4eb01c08e859bf924d222250d2e8f8b8ff6d3db4721288cf35d14252a4d933c8", size = 10715597, upload-time = "2025-09-04T08:26:51.312Z" }, +] + +[[package]] +name = "nvidia-cuda-nvrtc" +version = "13.0.88" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c3/68/483a78f5e8f31b08fb1bb671559968c0ca3a065ac7acabfc7cee55214fd6/nvidia_cuda_nvrtc-13.0.88-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl", hash = "sha256:ad9b6d2ead2435f11cbb6868809d2adeeee302e9bb94bcf0539c7a40d80e8575", size = 90215200, upload-time = "2025-09-04T08:28:44.204Z" }, + { url = "https://files.pythonhosted.org/packages/b7/dc/6bb80850e0b7edd6588d560758f17e0550893a1feaf436807d64d2da040f/nvidia_cuda_nvrtc-13.0.88-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d27f20a0ca67a4bb34268a5e951033496c5b74870b868bacd046b1b8e0c3267b", size = 43015449, upload-time = "2025-09-04T08:28:20.239Z" }, +] + +[[package]] +name = "nvidia-cuda-runtime" +version = "13.0.96" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/87/4f/17d7b9b8e285199c58ce28e31b5c5bbaa4d8271af06a89b6405258245de2/nvidia_cuda_runtime-13.0.96-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:ef9bcbe90493a2b9d810e43d249adb3d02e98dd30200d86607d8d02687c43f55", size = 2261060, upload-time = "2025-10-09T08:55:15.78Z" }, + { url = "https://files.pythonhosted.org/packages/2e/24/d1558f3b68b1d26e706813b1d10aa1d785e4698c425af8db8edc3dced472/nvidia_cuda_runtime-13.0.96-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:7f82250d7782aa23b6cfe765ecc7db554bd3c2870c43f3d1821f1d18aebf0548", size = 2243632, upload-time = "2025-10-09T08:55:36.117Z" }, +] + +[[package]] +name = "nvidia-cudnn-cu13" +version = "9.24.0.43" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nvidia-cublas" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/ca/30/7c257e3d5cb4fecb147b93895c66e29c93f8e76d74b45bb418ff0587c4ec/nvidia_cudnn_cu13-9.24.0.43-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:a6812a554a1ff0413e9c52b84c26c050380649ab9615f9c16bded368ce9f421f", size = 650976863, upload-time = "2026-07-02T16:23:39.248Z" }, + { url = "https://files.pythonhosted.org/packages/5c/ba/791cffd048fe5b044e620df55267e3e95c0e6e07d50b41e377c03dfc910f/nvidia_cudnn_cu13-9.24.0.43-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:71f181cd810e90f9b6023b01186fe82d13d65f0ec098581ee201d39fad769e4b", size = 553099438, upload-time = "2026-07-02T16:27:42.58Z" }, +] + +[[package]] +name = "nvidia-cufft" +version = "12.0.0.61" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nvidia-nvjitlink" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/8b/ae/f417a75c0259e85c1d2f83ca4e960289a5f814ed0cea74d18c353d3e989d/nvidia_cufft-12.0.0.61-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:2708c852ef8cd89d1d2068bdbece0aa188813a0c934db3779b9b1faa8442e5f5", size = 214053554, upload-time = "2025-09-04T08:31:38.196Z" }, + { url = "https://files.pythonhosted.org/packages/a8/2f/7b57e29836ea8714f81e9898409196f47d772d5ddedddf1592eadb8ab743/nvidia_cufft-12.0.0.61-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:6c44f692dce8fd5ffd3e3df134b6cdb9c2f72d99cf40b62c32dde45eea9ddad3", size = 214085489, upload-time = "2025-09-04T08:31:56.044Z" }, +] + +[[package]] +name = "nvidia-cufile" +version = "1.15.1.6" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3f/70/4f193de89a48b71714e74602ee14d04e4019ad36a5a9f20c425776e72cd6/nvidia_cufile-1.15.1.6-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:08a3ecefae5a01c7f5117351c64f17c7c62efa5fffdbe24fc7d298da19cd0b44", size = 1223672, upload-time = "2025-09-04T08:32:22.779Z" }, + { url = "https://files.pythonhosted.org/packages/ab/73/cc4a14c9813a8a0d509417cf5f4bdaba76e924d58beb9864f5a7baceefbf/nvidia_cufile-1.15.1.6-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:bdc0deedc61f548bddf7733bdc216456c2fdb101d020e1ab4b88d232d5e2f6d1", size = 1136992, upload-time = "2025-09-04T08:32:14.119Z" }, +] + +[[package]] +name = "nvidia-curand" +version = "10.4.0.35" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1e/72/7c2ae24fb6b63a32e6ae5d241cc65263ea18d08802aaae087d9f013335a2/nvidia_curand-10.4.0.35-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:133df5a7509c3e292aaa2b477afd0194f06ce4ea24d714d616ff36439cee349a", size = 61962106, upload-time = "2025-08-04T10:21:41.128Z" }, + { url = "https://files.pythonhosted.org/packages/a5/9f/be0a41ca4a4917abf5cb9ae0daff1a6060cc5de950aec0396de9f3b52bc5/nvidia_curand-10.4.0.35-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:1aee33a5da6e1db083fe2b90082def8915f30f3248d5896bcec36a579d941bfc", size = 59544258, upload-time = "2025-08-04T10:22:03.992Z" }, +] + +[[package]] +name = "nvidia-cusolver" +version = "12.0.4.66" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nvidia-cublas" }, + { name = "nvidia-cusparse" }, + { name = "nvidia-nvjitlink" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/c8/c3/b30c9e935fc01e3da443ec0116ed1b2a009bb867f5324d3f2d7e533e776b/nvidia_cusolver-12.0.4.66-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:02c2457eaa9e39de20f880f4bd8820e6a1cfb9f9a34f820eb12a155aa5bc92d2", size = 223467760, upload-time = "2025-09-04T08:33:04.222Z" }, + { url = "https://files.pythonhosted.org/packages/5f/67/cba3777620cdacb99102da4042883709c41c709f4b6323c10781a9c3aa34/nvidia_cusolver-12.0.4.66-py3-none-manylinux_2_27_x86_64.whl", hash = "sha256:0a759da5dea5c0ea10fd307de75cdeb59e7ea4fcb8add0924859b944babf1112", size = 200941980, upload-time = "2025-09-04T08:33:22.767Z" }, +] + +[[package]] +name = "nvidia-cusparse" +version = "12.6.3.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "nvidia-nvjitlink" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/f8/94/5c26f33738ae35276672f12615a64bd008ed5be6d1ebcb23579285d960a9/nvidia_cusparse-12.6.3.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:80bcc4662f23f1054ee334a15c72b8940402975e0eab63178fc7e670aa59472c", size = 162155568, upload-time = "2025-09-04T08:33:42.864Z" }, + { url = "https://files.pythonhosted.org/packages/fa/18/623c77619c31d62efd55302939756966f3ecc8d724a14dab2b75f1508850/nvidia_cusparse-12.6.3.3-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:2b3c89c88d01ee0e477cb7f82ef60a11a4bcd57b6b87c33f789350b59759360b", size = 145942937, upload-time = "2025-09-04T08:33:58.029Z" }, +] + +[[package]] +name = "nvidia-cusparselt-cu13" +version = "0.8.1" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/46/e1/cdc1797eadf82d3a9a575a19b33fdc871a97edbec42c00b5b5e914f4aff4/nvidia_cusparselt_cu13-0.8.1-py3-none-manylinux2014_aarch64.whl", hash = "sha256:4dca476c50bf4780d46cd0bfbd82e2bc10a08e4fef7950917ce8d7578d22a23f", size = 221051344, upload-time = "2025-09-05T18:49:51.289Z" }, + { url = "https://files.pythonhosted.org/packages/34/7d/2661f2fb3ac4302f3a246f5fc030213ac60c1fe0bce84f9783dbd831dbb7/nvidia_cusparselt_cu13-0.8.1-py3-none-manylinux2014_x86_64.whl", hash = "sha256:786ce87568c303fadb5afcc7102d454cd3040d75f6f8626f5db460d1871f4dd0", size = 170148586, upload-time = "2025-09-05T18:50:50.248Z" }, +] + +[[package]] +name = "nvidia-ml-py" +version = "13.615.71" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/fd/30/b25216758be3d3e2834825d8193609e2d71c770a8bd7984438c058c90268/nvidia_ml_py-13.615.71.tar.gz", hash = "sha256:bebe4e48f51b1dc75028c0815cb7bfa14a31a5bb80be70c9d980c6036953fc3d", size = 57485, upload-time = "2026-09-25T15:15:28.226Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/53/a1/1681dfa1c904d4e3e72e51b55a0ff012d50b766843ef832d584abe2113c6/nvidia_ml_py-13.615.71-py3-none-any.whl", hash = "sha256:959bf4adf6fe1308e4bd739e722236b0d1ec8392e2cefad33ff70c311380b9b6", size = 58132, upload-time = "2026-09-25T15:15:26.54Z" }, ] [[package]] -name = "netcortex-workspace" -version = "0.1.0" -source = { virtual = "." } -dependencies = [ - { name = "netcortex-agent" }, - { name = "netcortex-collector" }, - { name = "netcortex-core" }, - { name = "netcortex-fixes" }, +name = "nvidia-nccl-cu13" +version = "2.30.7" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/21/a73174c6157101bdf1ffc22b517f76ff0082613989dd9bc8f43e8034caac/nvidia_nccl_cu13-2.30.7-py3-none-manylinux_2_18_aarch64.whl", hash = "sha256:ca786ffa5a647c75d4d1f5cc72a6c4f537947e2ba8823d7c8aaf768e7a7b9f77", size = 215983881, upload-time = "2026-06-09T03:23:15.633Z" }, + { url = "https://files.pythonhosted.org/packages/3f/34/c500f90c7ae641b8e0f98965b36b8a7ac79cc8b296e8d251fe3eb592ee54/nvidia_nccl_cu13-2.30.7-py3-none-manylinux_2_18_x86_64.whl", hash = "sha256:cefa7fdb9710efd0f39c5f1be1d61ff6fc9a996c451265bd7fbdcf9455ed4b50", size = 215965170, upload-time = "2026-06-09T03:23:39.73Z" }, ] -[package.dev-dependencies] -dev = [ - { name = "pytest" }, - { name = "pytest-cov" }, - { name = "ruff" }, +[[package]] +name = "nvidia-nvjitlink" +version = "13.4.92" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1d/6b/eef7a9e32872b8f41e145bf10cddc9af26e153c338852811fe9a9baddf9e/nvidia_nvjitlink-13.4.92-py3-none-manylinux2010_x86_64.manylinux_2_12_x86_64.whl", hash = "sha256:e0391f24ed94ec879b84e3da4d4ec320c879aff681f2c7a638462f7199284323", size = 42452378, upload-time = "2026-09-16T20:45:29.042Z" }, + { url = "https://files.pythonhosted.org/packages/1f/a8/1cbd4014898af8b419e69b0d7dbc63da2121ee92d92b47d59f4fe9075349/nvidia_nvjitlink-13.4.92-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:25f74fad0d654271c921ac4dca614bd6258bc21791242fc7b2289dad7ae9c099", size = 40420120, upload-time = "2026-09-16T20:45:19.163Z" }, ] -[package.metadata] -requires-dist = [ - { name = "netcortex-agent", editable = "packages/agent" }, - { name = "netcortex-collector", editable = "services/collector" }, - { name = "netcortex-core", editable = "packages/core" }, - { name = "netcortex-fixes", editable = "packages/fixes" }, +[[package]] +name = "nvidia-nvshmem-cu13" +version = "3.4.5" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/dc/0f/05cc9c720236dcd2db9c1ab97fff629e96821be2e63103569da0c9b72f19/nvidia_nvshmem_cu13-3.4.5-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:6dc2a197f38e5d0376ad52cd1a2a3617d3cdc150fd5966f4aee9bcebb1d68fe9", size = 60215947, upload-time = "2025-09-06T00:32:20.022Z" }, + { url = "https://files.pythonhosted.org/packages/3c/35/a9bf80a609e74e3b000fef598933235c908fcefcef9026042b8e6dfde2a9/nvidia_nvshmem_cu13-3.4.5-py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:290f0a2ee94c9f3687a02502f3b9299a9f9fe826e6d0287ee18482e78d495b80", size = 60412546, upload-time = "2025-09-06T00:32:41.564Z" }, ] -[package.metadata.requires-dev] -dev = [ - { name = "pytest", specifier = ">=8.3,<9" }, - { name = "pytest-cov", specifier = ">=6,<7" }, - { name = "ruff", specifier = ">=0.11,<1" }, +[[package]] +name = "nvidia-nvtx" +version = "13.0.85" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c2/f3/d86c845465a2723ad7e1e5c36dcd75ddb82898b3f53be47ebd429fb2fa5d/nvidia_nvtx-13.0.85-py3-none-manylinux1_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:4936d1d6780fbe68db454f5e72a42ff64d1fd6397df9f363ae786930fd5c1cd4", size = 148047, upload-time = "2025-09-04T08:29:01.761Z" }, + { url = "https://files.pythonhosted.org/packages/a8/64/3708a90d1ebe202ffdeb7185f878a3c84d15c2b2c31858da2ce0583e2def/nvidia_nvtx-13.0.85-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:cb7780edb6b14107373c835bf8b72e7a178bac7367e23da7acb108f973f157a6", size = 148878, upload-time = "2025-09-04T08:28:53.627Z" }, ] [[package]] -name = "numpy" -version = "2.5.4" +name = "omegaconf" +version = "2.3.0" source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/95/b0/c7453d0b6e2073c3264468b106ee1563750cecc910965e67357e3698c83e/numpy-2.5.4.tar.gz", hash = "sha256:9a94cf751c9ad8ebaa835bcd3d40dacf8534ad086b88c38029b65123c7999d2a", size = 20866315, upload-time = "2026-10-10T20:05:31.422Z" } +dependencies = [ + { name = "antlr4-python3-runtime" }, + { name = "pyyaml" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/09/48/6388f1bb9da707110532cb70ec4d2822858ddfb44f1cdf1233c20a80ea4b/omegaconf-2.3.0.tar.gz", hash = "sha256:d5d4b6d29955cc50ad50c46dc269bcd92c6e00f5f90d23ab5fee7bfca4ba4cc7", size = 3298120, upload-time = "2022-12-08T20:59:22.753Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d0/97/ba2074e92b7befea137e77ea8471e768bbd87c339b7e8c9f5a931949f977/numpy-2.5.4-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c6342f54c67093cae5c0227eb0eb772fdb79f2a2c37a6eb278b9909ee06aa356", size = 17001609, upload-time = "2026-10-10T20:02:40.843Z" }, - { url = "https://files.pythonhosted.org/packages/ff/a9/bac826765e971d8e16e2064e9ac7525fd69b40ac17c905033a7f5442023f/numpy-2.5.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b11e8fda06a7d69f15ebf542660b74466c2e51094800c1fb794f47ad4faeef17", size = 12015718, upload-time = "2026-10-10T20:02:43.45Z" }, - { url = "https://files.pythonhosted.org/packages/31/2f/5ea3570fcb8ccd0882bea99436a513b2c85dad8f774a2057849130a8fb99/numpy-2.5.4-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:9cb18a327b49c5c337f972b03682f6a49855525faaf3c0d3e9c96cd0fd8880a8", size = 5451717, upload-time = "2026-10-10T20:02:46.169Z" }, - { url = "https://files.pythonhosted.org/packages/34/f2/b4fc1bafca03868220b5eaf729d2f21ebd7d7b151c0f9e144fe212bbca35/numpy-2.5.4-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:aec3fc4b32ff82421274f5d205c559c51c840c8df66a78efd7f3612dd005a26a", size = 6789926, upload-time = "2026-10-10T20:02:48.139Z" }, - { url = "https://files.pythonhosted.org/packages/dc/96/8319e2457ae4333c62c815c7006b869a4f60985c1e01024c2f8c6c040fe5/numpy-2.5.4-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:fe4d21ab149f15e4e6043dfb0de87e6e5f34ac176cde83060e9802981fca2ac2", size = 15695312, upload-time = "2026-10-10T20:02:50.115Z" }, - { url = "https://files.pythonhosted.org/packages/43/a3/c799c62e19c337e6d3770b08e475887fb30ce8477d3c09efca6b2f0228a6/numpy-2.5.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fbde6962867ee75b48b0ee29b2b9372ec5d617799dbaf38e82dc0596f2f7738a", size = 16727283, upload-time = "2026-10-10T20:02:53.186Z" }, - { url = "https://files.pythonhosted.org/packages/39/6b/3604e53fb00314d0dc1b94ec9125a1484f649c0a17480b1f0f0c7a9d6250/numpy-2.5.4-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:381a7a3d2e65e64c0ec302795ab9dc12bb1e73f150904699c153716177eebdaf", size = 17047890, upload-time = "2026-10-10T20:02:56.038Z" }, - { url = "https://files.pythonhosted.org/packages/4a/7a/e8b58a5289a0d464c52885de47c35a935cdd70c03a4c3ab94a5126416dd0/numpy-2.5.4-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:b89d0aaae2fe498c648f4c4795c084db535af5bd98ef942b2a3681fb74ce8645", size = 18485839, upload-time = "2026-10-10T20:02:59.018Z" }, - { url = "https://files.pythonhosted.org/packages/6f/c9/47094f597015009f310b8c900def59065ef1ff5a6fe7b51fc65ec58ec2c6/numpy-2.5.4-cp312-cp312-win32.whl", hash = "sha256:9968ab7e49b93ac6e1c3b2239732183152c9150f16308d30b66a372cffe3483c", size = 6138936, upload-time = "2026-10-10T20:03:01.626Z" }, - { url = "https://files.pythonhosted.org/packages/12/33/fefe62073dc8acfd0f2b9ed7c003af2f50aa61555e113e6db02b8f79f145/numpy-2.5.4-cp312-cp312-win_amd64.whl", hash = "sha256:a7b1b6353e36a7e50de2973a38d705c88ee93adcf120673cee7f45a4a3fa223a", size = 12573091, upload-time = "2026-10-10T20:03:04.349Z" }, - { url = "https://files.pythonhosted.org/packages/1a/07/161270b0c2eec56e4c905f6d6d22e1b836887b2cb189d3f5820aa588e9dd/numpy-2.5.4-cp312-cp312-win_arm64.whl", hash = "sha256:aa1cce2ff3f8d953de38b76bf44602caeb69f101430208f64a10067f7cb4b1d3", size = 10521630, upload-time = "2026-10-10T20:03:06.767Z" }, + { url = "https://files.pythonhosted.org/packages/e3/94/1843518e420fa3ed6919835845df698c7e27e183cb997394e4a670973a65/omegaconf-2.3.0-py3-none-any.whl", hash = "sha256:7b4df175cdb08ba400f45cae3bdcae7ba8365db4d165fc65fd04b050ab63b46b", size = 79500, upload-time = "2022-12-08T20:59:19.686Z" }, ] [[package]] @@ -493,24 +1191,66 @@ wheels = [ [[package]] name = "pandas" -version = "3.0.6" +version = "2.3.3" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "numpy" }, { name = "python-dateutil" }, - { name = "tzdata", marker = "sys_platform == 'emscripten' or sys_platform == 'win32'" }, + { name = "pytz" }, + { name = "tzdata" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/33/01/d40b85317f86cf08d853a4f495195c73815fdf205eef3993821720274518/pandas-2.3.3.tar.gz", hash = "sha256:e05e1af93b977f7eafa636d043f9f94c7ee3ac81af99c13508215942e64c993b", size = 4495223, upload-time = "2025-09-29T23:34:51.853Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/9c/fb/231d89e8637c808b997d172b18e9d4a4bc7bf31296196c260526055d1ea0/pandas-2.3.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6d21f6d74eb1725c2efaa71a2bfc661a0689579b58e9c0ca58a739ff0b002b53", size = 11597846, upload-time = "2025-09-29T23:19:48.856Z" }, + { url = "https://files.pythonhosted.org/packages/5c/bd/bf8064d9cfa214294356c2d6702b716d3cf3bb24be59287a6a21e24cae6b/pandas-2.3.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3fd2f887589c7aa868e02632612ba39acb0b8948faf5cc58f0850e165bd46f35", size = 10729618, upload-time = "2025-09-29T23:39:08.659Z" }, + { url = "https://files.pythonhosted.org/packages/57/56/cf2dbe1a3f5271370669475ead12ce77c61726ffd19a35546e31aa8edf4e/pandas-2.3.3-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ecaf1e12bdc03c86ad4a7ea848d66c685cb6851d807a26aa245ca3d2017a1908", size = 11737212, upload-time = "2025-09-29T23:19:59.765Z" }, + { url = "https://files.pythonhosted.org/packages/e5/63/cd7d615331b328e287d8233ba9fdf191a9c2d11b6af0c7a59cfcec23de68/pandas-2.3.3-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b3d11d2fda7eb164ef27ffc14b4fcab16a80e1ce67e9f57e19ec0afaf715ba89", size = 12362693, upload-time = "2025-09-29T23:20:14.098Z" }, + { url = "https://files.pythonhosted.org/packages/a6/de/8b1895b107277d52f2b42d3a6806e69cfef0d5cf1d0ba343470b9d8e0a04/pandas-2.3.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a68e15f780eddf2b07d242e17a04aa187a7ee12b40b930bfdd78070556550e98", size = 12771002, upload-time = "2025-09-29T23:20:26.76Z" }, + { url = "https://files.pythonhosted.org/packages/87/21/84072af3187a677c5893b170ba2c8fbe450a6ff911234916da889b698220/pandas-2.3.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:371a4ab48e950033bcf52b6527eccb564f52dc826c02afd9a1bc0ab731bba084", size = 13450971, upload-time = "2025-09-29T23:20:41.344Z" }, + { url = "https://files.pythonhosted.org/packages/86/41/585a168330ff063014880a80d744219dbf1dd7a1c706e75ab3425a987384/pandas-2.3.3-cp312-cp312-win_amd64.whl", hash = "sha256:a16dcec078a01eeef8ee61bf64074b4e524a2a3f4b3be9326420cabe59c4778b", size = 10992722, upload-time = "2025-09-29T23:20:54.139Z" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/e2/17/d7b106e05bfa642e8694451e7d3d759c6a241c5386a5d962e4f66c047e06/pandas-3.0.6.tar.gz", hash = "sha256:66b07ef7315a31bfe1089cd3d71a7de781c9dca986762d0b4fe7c0ef17465d10", size = 4667686, upload-time = "2026-09-17T23:23:18.345Z" } + +[[package]] +name = "password-strength" +version = "0.0.3.post2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "six" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/db/f1/6165ebcca27fca3f1d63f8c3a45805c2ed8568be4d09219a2aa45e792c14/password_strength-0.0.3.post2.tar.gz", hash = "sha256:bf4df10a58fcd3abfa182367307b4fd7b1cec518121dd83bf80c1c42ba796762", size = 12857, upload-time = "2019-01-04T13:41:29.711Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1c/d6/08fd888c980589e4e27c2a4177e972481e8881600138e63afb785fe52630/password_strength-0.0.3.post2-py2.py3-none-any.whl", hash = "sha256:6739357c2863d707b7c7f247ff7c6882a70904a18d12c9aaf98f8b95da176fb9", size = 12167, upload-time = "2019-01-04T13:41:27.497Z" }, +] + +[[package]] +name = "pillow" +version = "13.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/ce/a4/9cc30690a394a8305e8be4c9036aa16d0dfddadd09079860b582f562496d/pillow-13.0.0.tar.gz", hash = "sha256:cdcd1ba258178f7356d74170c9a81ba4eab6a5d55748bc402a5a2a6fe6be3510", size = 47058631, upload-time = "2026-10-16T22:18:09.718Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/7a/b8/58d79332229482eb0d27c82973850808c19d37e5bdc14443d3417bd373f5/pillow-13.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:67c8d44ad89fa7eb88de5d6ef6199b1e03dd24974f85a67639fc8badb801fe79", size = 5568643, upload-time = "2026-10-16T22:15:44.474Z" }, + { url = "https://files.pythonhosted.org/packages/39/4b/f2ed53d83aa44ac19599ac0a54897f867fafb95f406980d1e24083f8cbe3/pillow-13.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc481f742ccda20e9ed760b8f978dff50f2a4e9bc253ac167fb0a05b0783ef52", size = 4852329, upload-time = "2026-10-16T22:15:46.284Z" }, + { url = "https://files.pythonhosted.org/packages/3b/bb/9e30e8ed18c20800ee327a12107d5249ad8dc444867b3adfcc21654e3c71/pillow-13.0.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8bf295fe459343bc6093c8e5e0df60bfa189e0fcb775a22e2c2488fdeccc6c0d", size = 6519309, upload-time = "2026-10-16T22:15:48.14Z" }, + { url = "https://files.pythonhosted.org/packages/e6/99/fdf65cc539e266ab93546c261bdf98411fe165c6e4e13f9dbf597097192b/pillow-13.0.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:42d63be3af4f9b951b199b0a9d23365d37ab14687e6d77b74940432c8515c4ca", size = 7144542, upload-time = "2026-10-16T22:15:50.093Z" }, + { url = "https://files.pythonhosted.org/packages/26/9b/f38b7c4d8f599537e2d1a6d546cec9beef7536ff8f5c49a3f9c78179d8ac/pillow-13.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:4bd024d567eca931b668978d672dba914d4b8e2628e2c3073a2ad178de8a2620", size = 6618042, upload-time = "2026-10-16T22:15:52.054Z" }, + { url = "https://files.pythonhosted.org/packages/a8/7c/45ee28531f89ee4582967d8a17f7a26d71ca64cd902b93c269590cd60a00/pillow-13.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:23edf4ec4b6f4f240e8df6e4985e9ee2ced86474632433e55fb1e2548744bf40", size = 7228137, upload-time = "2026-10-16T22:15:54.009Z" }, + { url = "https://files.pythonhosted.org/packages/01/bc/9c2a969cb1b70201d04fa17fd5aedf02a732870b8da86bceaaa30b0ca385/pillow-13.0.0-cp312-cp312-win32.whl", hash = "sha256:02464da86f561f410e13b061ec37c3068a9cb557a095494157742d07b3c24a27", size = 6515423, upload-time = "2026-10-16T22:15:56.25Z" }, + { url = "https://files.pythonhosted.org/packages/ff/cd/73a79ecdc822076002eb24b5e1e4a530b0bb5310fcb6d239abbec877110b/pillow-13.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:ff3fe9eb621fbb9db4c4be33ab946f6bac5f98ab50ca8d3260503653656c961b", size = 7272166, upload-time = "2026-10-16T22:15:58.597Z" }, + { url = "https://files.pythonhosted.org/packages/4a/a3/be5a1236efd085b3984e4305da8f179ae9dab80c991d2ad78f2bd5c4c843/pillow-13.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:c3bc8ee0271387e0b1e3ad0ff893645990a656e79bf9c42f4f734a3642b11d51", size = 2698943, upload-time = "2026-10-16T22:16:00.637Z" }, + { url = "https://files.pythonhosted.org/packages/60/da/f6d644e631c5b370c5d0b899f3ccadd2780aab070b29a110527cf4e1fd2c/pillow-13.0.0-pp312-pypy312_pp80-macosx_10_15_x86_64.whl", hash = "sha256:8619685cad8efc4c38c66d3b36aad854523297c43d748b3b6f0cc03c90ba3463", size = 5523188, upload-time = "2026-10-16T22:17:59.334Z" }, + { url = "https://files.pythonhosted.org/packages/e4/b0/2594f202d743a35d4fe80682bfd96f277e5ca7aecb27cf64ef5bfc1d000b/pillow-13.0.0-pp312-pypy312_pp80-macosx_11_0_arm64.whl", hash = "sha256:7e91e97a929232cdb828889ee6ad0e48d7f40f4ec38818f4e4a8968b2b1af22e", size = 4806808, upload-time = "2026-10-16T22:18:01.188Z" }, + { url = "https://files.pythonhosted.org/packages/8e/ed/d504165ef79af6fafe25c76726cf30f544cc236002f7ed054f1d51adc4ff/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:93ff9c9c3663ce23aaa5d0b6b6abac55359e2a0c06c7e30f3771829af816be63", size = 5464358, upload-time = "2026-10-16T22:18:02.779Z" }, + { url = "https://files.pythonhosted.org/packages/7b/fe/a10aba5503ca13e9e009b8bd0a1a4ce5584bdce246245fd6f3a83701369c/pillow-13.0.0-pp312-pypy312_pp80-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e65dd6e75de67b2362a4fa3e16aa627595f65054dc4ec73d64680c84d592fa61", size = 6043514, upload-time = "2026-10-16T22:18:04.538Z" }, + { url = "https://files.pythonhosted.org/packages/c0/37/66b12dc476041fe523bca29c9d58fbf1ea92a4eaf73acfb9e993948f1191/pillow-13.0.0-pp312-pypy312_pp80-win_amd64.whl", hash = "sha256:567f20f1c75897d7663830da6ea8af719e03d712b1d9ee7f813319f9ece42e5a", size = 7366030, upload-time = "2026-10-16T22:18:06.638Z" }, +] + +[[package]] +name = "platformdirs" +version = "4.13.4" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b7/89/dfd269de936e76319cf27787d9eaaca513491f635d49b0fbe7cdb6d3bf6f/platformdirs-4.13.4.tar.gz", hash = "sha256:dd96496961684a7f42041923f842ec7494e09f5e87aded99117e1109cd40570e", size = 62364, upload-time = "2026-10-17T19:31:53.69Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/77/4c/597d588c055d4373cff19cbbc32d4dd046c7be8fadee957585b5ba9e5b24/pandas-3.0.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7dac2d65e9087e8e7b5a45fe15c4920911a221df061ab629943ce016489145c7", size = 10397411, upload-time = "2026-09-17T23:20:49.465Z" }, - { url = "https://files.pythonhosted.org/packages/18/8f/48907c7c707b61a8e5018c32e1a3f70623209bfb59020a2f6196159d3aa7/pandas-3.0.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:9dab635a549e58a053c7b0fa054dc0bd7be22f0ed9a720f4a85d5fb993276172", size = 10051279, upload-time = "2026-09-17T23:20:52.409Z" }, - { url = "https://files.pythonhosted.org/packages/67/fa/613d867c3d9554a61bafdec6f79565c8a3e73235feb52cc4a72ad2e0fa6a/pandas-3.0.6-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e3dccb584123b399c07562ac4d62543e90ede49ddf8ce3c13ffc64cbe828c281", size = 10303429, upload-time = "2026-09-17T23:20:55.597Z" }, - { url = "https://files.pythonhosted.org/packages/cb/67/0c0f18e38d7f2d2af8c24b3315bc4046e73bbdd4a5540405506671ad0c0d/pandas-3.0.6-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0704044b676496b8350e023b09f174a26772456c974a2b11c36bebb558c9490d", size = 10788193, upload-time = "2026-09-17T23:20:58.617Z" }, - { url = "https://files.pythonhosted.org/packages/39/53/1b57f3162501fe36687e4870e1b918a6458ca7386b173af75663ace95857/pandas-3.0.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:e7c1905ef02c3d6d43d9dbd5b6ccb4da4870a0b0c821bbc103fbdb6f3ad2707b", size = 11323501, upload-time = "2026-09-17T23:21:01.911Z" }, - { url = "https://files.pythonhosted.org/packages/f2/d2/b1182e8d39100369d7f13f4a125a3fb6b096fef112c46d0566c25781ff68/pandas-3.0.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:569e114072b24fc4970c12e2b4bab252671668a40b324318903380cab0254c0c", size = 11838173, upload-time = "2026-09-17T23:21:04.85Z" }, - { url = "https://files.pythonhosted.org/packages/c7/33/5b717af24d2f27995e51e0875a269dddd373045216e34cf62e3aa764eaa1/pandas-3.0.6-cp312-cp312-pyemscripten_2024_0_wasm32.whl", hash = "sha256:2a8fc94be2ee5f1d86f97aacd8cc566f81680b6498e76f3007421bb5d98151bf", size = 7118499, upload-time = "2026-09-17T23:21:07.661Z" }, - { url = "https://files.pythonhosted.org/packages/bd/2a/14b3b17cd75cef4a1ee1af4234eb41cc1afe4103b98c2d80e8916abfd42b/pandas-3.0.6-cp312-cp312-win_amd64.whl", hash = "sha256:3ef908d28590b3f42d7070e7ad8f9b34b442b260b7f3c1afb57e0040c58cdb1b", size = 9661439, upload-time = "2026-09-17T23:21:10.959Z" }, - { url = "https://files.pythonhosted.org/packages/3b/11/3d580a604a1e35d69f6676847bd12db7d14344bc677b717f4413e79c5d0d/pandas-3.0.6-cp312-cp312-win_arm64.whl", hash = "sha256:f4e7c52eb108d752e7592268108fd3e98efd76d83a3125cdd06c621c2e44359b", size = 8959806, upload-time = "2026-09-17T23:21:13.851Z" }, + { url = "https://files.pythonhosted.org/packages/58/51/5614d0537dd830ca64d95a2f254bd66bdf3ac61d41cffcccaec62121fcfd/platformdirs-4.13.4-py3-none-any.whl", hash = "sha256:502ce08e9d36cf90579ee44e1e764838842fa658e4975ef47344fd053011d2c8", size = 32782, upload-time = "2026-10-17T19:31:52.293Z" }, ] [[package]] @@ -522,6 +1262,21 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/40/9e/2b38731e0fc536806f16490e1a12d7f0dc2a1235aa8cc07bcc75416a7daa/pluggy-1.7.0-py3-none-any.whl", hash = "sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec", size = 27082, upload-time = "2026-10-15T09:50:56.808Z" }, ] +[[package]] +name = "posthog" +version = "7.71.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "backoff" }, + { name = "distro" }, + { name = "requests" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c6/9b/12e2e82fbbf5d70f554cfd1930631a6d1cce8975721ad50b5d7b47e580ff/posthog-7.71.0.tar.gz", hash = "sha256:00950999edf7f613a90015126bacc431d3ab3964a70d91c2f792e6a0dc81f358", size = 763019, upload-time = "2026-10-16T19:24:33.765Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f5/8e/9b185e665800a922e95fb965fb9c17d2a54cee575cf5e425308250663393/posthog-7.71.0-py3-none-any.whl", hash = "sha256:52cb1320b7e178b36ef7594cf15b4a8c492c24d4d1c46700f5bee0089ba5c6ac", size = 892234, upload-time = "2026-10-16T19:24:31.706Z" }, +] + [[package]] name = "psycopg" version = "3.3.6" @@ -570,9 +1325,24 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/5d/b4/452c6607a0f479465cd8a9b0d9956919fcb150050c1f83f9f11e6b8ee8dc/psycopg_pool-3.3.3-py3-none-any.whl", hash = "sha256:9b9cd6a4fcec47a410f7e82d408540e7f77b478509e91b44c1a5457a13e5ff37", size = 40304, upload-time = "2026-09-22T15:53:23.712Z" }, ] +[[package]] +name = "pyarrow" +version = "25.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/3d/e3/27f57f80141379d60defe6703eb50a707325706f07fedfd1312c7a751995/pyarrow-25.0.1.tar.gz", hash = "sha256:9150a83248bfed9813ea3c3af74c3856c1984d444aa28e58bf7733b9750ddf6a", size = 1201653, upload-time = "2026-08-10T12:40:53.904Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a6/e2/9ab15b88cbfac28e16419ce5439ec29234c5172cb8259301b4ba639bdec0/pyarrow-25.0.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:df961f2e7ae9cf496459259d798652c70625f6c080650d6952f8c04053c58ee9", size = 35861559, upload-time = "2026-08-10T12:38:02.567Z" }, + { url = "https://files.pythonhosted.org/packages/58/79/a0036dbe1eabe1f73127427342f1d99982584c4a2cde2651d6c93499c6f6/pyarrow-25.0.1-cp312-cp312-macosx_12_0_x86_64.whl", hash = "sha256:cc4aa407fde9fc660be3939e49ea31f50f3e9fec17c0ec63159f7711edd3efc9", size = 37628383, upload-time = "2026-08-10T12:38:09.083Z" }, + { url = "https://files.pythonhosted.org/packages/13/49/d93a57d375f4bf0cf82913dd6bb54acafde83dd993be2282c81ac5616cad/pyarrow-25.0.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:4340f0ba6c1d2e13f21658de1d7c662ca2545018568d0030a1e9afca159d87e3", size = 46820190, upload-time = "2026-08-10T12:38:15.458Z" }, + { url = "https://files.pythonhosted.org/packages/60/c9/711ca85d79f1ec98f29a5eae2b051e25b4ecec5de3e3c0e2d5c5dcb15664/pyarrow-25.0.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:5389cdf79447ed1515c9e31620e6e1e2302249564d603f2ad727d4f6d313e4c3", size = 50102437, upload-time = "2026-08-10T12:38:22.487Z" }, + { url = "https://files.pythonhosted.org/packages/80/53/8fb8359ff17cfb6263a1cf3ebf7caec9fe197de118719e84fcb1d0618026/pyarrow-25.0.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d51592cb7561e87877c506113e7adbf1342ab579e6c21f0ef44b8ba41cb74c80", size = 49942424, upload-time = "2026-08-10T12:38:28.755Z" }, + { url = "https://files.pythonhosted.org/packages/e8/83/4e5ae02a9341571b18a6fca380ac7a58ce6ddae7ab3c060208c0a1e79f02/pyarrow-25.0.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:6109c94d8b9f3b17a041daca16cacb2f651ad8f1ef70a4232c2c0f37a23da2a8", size = 53144206, upload-time = "2026-08-10T12:38:34.862Z" }, + { url = "https://files.pythonhosted.org/packages/65/ee/197cbf47e49f83e6ebeb946a5259a48a638dea27ac774db42fe78022179d/pyarrow-25.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:8858d7bfc22e3f51529aeaa4077225029724623e4595dc9eff8c793935c34140", size = 27953934, upload-time = "2026-08-10T12:38:39.808Z" }, +] + [[package]] name = "pydantic" -version = "2.14.1" +version = "2.13.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "annotated-types" }, @@ -580,9 +1350,9 @@ dependencies = [ { name = "typing-extensions" }, { name = "typing-inspection" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/7c/0b/8e10b2e693af8ec54346a14caf36221334775975a747c9ceaa3f8371d96d/pydantic-2.14.1.tar.gz", hash = "sha256:94f478203dd03404682a1ada216965651dd74b1d2d5ffd62e00e0837caab5c26", size = 900362, upload-time = "2026-10-11T18:37:55.396Z" } +sdist = { url = "https://files.pythonhosted.org/packages/18/a5/b60d21ac674192f8ab0ba4e9fd860690f9b4a6e51ca5df118733b487d8d6/pydantic-2.13.4.tar.gz", hash = "sha256:c40756b57adaa8b1efeeced5c196f3f3b7c435f90e84ea7f443901bec8099ef6", size = 844775, upload-time = "2026-05-06T13:43:05.343Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/35/ea/a56b9fe5066f3537b7882f77e9c5dfb26d8c2eefdaed9b5fc73d57b4dc22/pydantic-2.14.1-py3-none-any.whl", hash = "sha256:9195d967ec791692a04438115466764fb8b9a27b31f14a760437694f40d6b454", size = 488106, upload-time = "2026-10-11T18:37:53.437Z" }, + { url = "https://files.pythonhosted.org/packages/fd/7b/122376b1fd3c62c1ed9dc80c931ace4844b3c55407b6fb2d199377c9736f/pydantic-2.13.4-py3-none-any.whl", hash = "sha256:45a282cde31d808236fd7ea9d919b128653c8b38b393d1c4ab335c62924d9aba", size = 472262, upload-time = "2026-05-06T13:43:02.641Z" }, ] [[package]] @@ -611,32 +1381,32 @@ openai = [ [[package]] name = "pydantic-core" -version = "2.50.1" +version = "2.46.4" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "typing-extensions" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/a6/24/af4ec4be49fbc810f35b0bdcacc3d433b56bbfa469fd3bfd4ae116cd9bf1/pydantic_core-2.50.1.tar.gz", hash = "sha256:e50d7b94baac6c7d09927fa5ca5800a0c7ee5015c7fcff65beb3a1931b5a6e09", size = 513515, upload-time = "2026-10-11T18:35:44.82Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/ee/94/101b49a6c63f99586755690696eae14532772587d9e39e93f7b8d28a49da/pydantic_core-2.50.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:704075d10b74f2f3c6e15407c696d88701df35fc8953f434a431add0d0074db0", size = 2222428, upload-time = "2026-10-11T18:32:20.228Z" }, - { url = "https://files.pythonhosted.org/packages/db/a3/f8b1b39349c33037c73d7a1b794c9c29d8f07d5bd2b74399c1375a529cc6/pydantic_core-2.50.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:e8e1d6ce820aa23317e8209a86bd65a540973c12dc7552b48a4f6c8e9926815e", size = 2025779, upload-time = "2026-10-11T18:32:21.723Z" }, - { url = "https://files.pythonhosted.org/packages/d2/2d/862a7d115305cc621358e51ba13f296e0ffdf4fbd984be9f63bc7862730b/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c18db21573bd2c6489f9a544b7499f0df2853958c568e5e783536ee1f690af41", size = 2048429, upload-time = "2026-10-11T18:32:23.3Z" }, - { url = "https://files.pythonhosted.org/packages/c0/7d/fed95d18bf2b5abe2d5ab2bbec4184bfc22b6805994a33ccdae8edffd25a/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cb57f304525a5e3c13333b772bf9a473f36326e9c821b2e8e1b2fd36f80ae2c3", size = 2173274, upload-time = "2026-10-11T18:32:24.697Z" }, - { url = "https://files.pythonhosted.org/packages/93/1e/c6f22ceac65dc3d291ff79bea0eb74cbd1de8b128f01fee48af03bcea1e1/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a27c09d86600f1bf2fe3f37e1ae697faf3143931c09322cd799da94deee923b5", size = 2360403, upload-time = "2026-10-11T18:32:26.281Z" }, - { url = "https://files.pythonhosted.org/packages/2c/97/190b5b6bfe4c72f265feb657913eb30749193927a5ad7b83cfa7866a25a2/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:46b3301d3b5c886f77de7546e47274a5842c622ea2020b8c6524c6b66913b4a6", size = 2439799, upload-time = "2026-10-11T18:32:27.844Z" }, - { url = "https://files.pythonhosted.org/packages/90/24/48cd98388e4ac2c08d0800af36d15413db15e20387f1038123a2c86cb2f6/pydantic_core-2.50.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93ba4e9d8210d941c200431a56b2c0400b131865947903937ed3ec5404307d2e", size = 2160157, upload-time = "2026-10-11T18:32:29.553Z" }, - { url = "https://files.pythonhosted.org/packages/00/86/d909133d0b9979ed14c20f110f21124a0e346caf071bd66ac5af3009062b/pydantic_core-2.50.1-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:e5faeaee74a57d32b3ab3aebad2e348f06d3ba946fc5d28c1728455f00a3d13a", size = 2229523, upload-time = "2026-10-11T18:32:31.027Z" }, - { url = "https://files.pythonhosted.org/packages/90/31/4b43f08131b2098e73a852fd932063385f3103b33839fd9d1abdb89e673d/pydantic_core-2.50.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a3cda0e538208e5d722bbf3698b24f19c0a7d05bc8d5f8a7f9b121ea7fa243d9", size = 2242700, upload-time = "2026-10-11T18:32:32.622Z" }, - { url = "https://files.pythonhosted.org/packages/88/77/de39658569dc7a4c293d110a89629f61145e7538f00d1e4280c28debefd3/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:57f51b31ff826e2859120cf4737c5a758a48d96f3e97da40ccee1796d58078ff", size = 2278452, upload-time = "2026-10-11T18:32:34.165Z" }, - { url = "https://files.pythonhosted.org/packages/46/bd/1eeb9e4e791e81210ef9096f58080b32ba15b5b13c108d50aaa3f8ce9f73/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8daa7ee75245d43ad7d747e5c9ecc1b1d06552f72b14887e9276f787d57375f4", size = 2450098, upload-time = "2026-10-11T18:32:35.547Z" }, - { url = "https://files.pythonhosted.org/packages/1c/e6/b2accfdff17e5a88d6358536702146de00f9339adaa4d5bbe1ee93cb4832/pydantic_core-2.50.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:acbf31f37c53a5ac0c34706c80b4f5107ba20b05fdd3816124bf236ef0c57dd2", size = 2476839, upload-time = "2026-10-11T18:32:37.119Z" }, - { url = "https://files.pythonhosted.org/packages/3b/7e/c8a83eb5d2cd42c2e13507150fb777b1edea5a018adc9cbf2858a1d08285/pydantic_core-2.50.1-cp312-cp312-win32.whl", hash = "sha256:45b11cac094aa25725581d9304eee93c9028516b9ea80dd9e175e13a5a2c840e", size = 2101425, upload-time = "2026-10-11T18:32:38.593Z" }, - { url = "https://files.pythonhosted.org/packages/c5/17/8bbd530b8659e9d963f5b16f6cb8e159f4cd174b4d6304e48969ab12dba8/pydantic_core-2.50.1-cp312-cp312-win_amd64.whl", hash = "sha256:132529c83901437ff642f585216831bf5fd7a91df66829907e155192ead62498", size = 2172522, upload-time = "2026-10-11T18:32:40.112Z" }, - { url = "https://files.pythonhosted.org/packages/af/9f/a79d690b127e4e3cff143d031538ab9aa715f6b2fbeecbd07cd6f2bf9fb7/pydantic_core-2.50.1-cp312-cp312-win_arm64.whl", hash = "sha256:4e834f6a8e4ff772dcc34f58ef5504147a3ea5b0f4eeb13b0f8eb2ca75ac57f1", size = 2161366, upload-time = "2026-10-11T18:32:41.606Z" }, - { url = "https://files.pythonhosted.org/packages/a5/09/1bcf160f3cd6333e2a76982fae5963e5032de0bcaaba38464223dc266bfe/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:76e2e83fa6ec8cdc972d438dafc2522b3a47bee4ec0ae668b29cfb1977ab5242", size = 2217070, upload-time = "2026-10-11T18:35:15.688Z" }, - { url = "https://files.pythonhosted.org/packages/3d/81/f02de95eec7794dfc7a5bc69a834f0e834b31b3009014ce6de903855f775/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:a51eee75939cf811ac09b278745a6cee7dc873ccfbc8b9af3cc88fe4b7ce25b5", size = 2039027, upload-time = "2026-10-11T18:35:18.07Z" }, - { url = "https://files.pythonhosted.org/packages/4d/16/227746ed3771d9bf2304568b55134849ece34e13b38b1d76de763015c77f/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae28183297fb0d2b8dc46a1f01d51f5e45825fc5afe76a835a6cb7fb34821295", size = 2109009, upload-time = "2026-10-11T18:35:20.218Z" }, - { url = "https://files.pythonhosted.org/packages/e5/b9/7664d1592a0e5a74903f357cd5b28ceb7336f3473256c5a4e8c8432f1881/pydantic_core-2.50.1-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:88e492e8b9d0312e7dc13667c30222abf284dc3b79b5302b3607b41a5784ce61", size = 2269883, upload-time = "2026-10-11T18:35:22.48Z" }, +sdist = { url = "https://files.pythonhosted.org/packages/9d/56/921726b776ace8d8f5db44c4ef961006580d91dc52b803c489fafd1aa249/pydantic_core-2.46.4.tar.gz", hash = "sha256:62f875393d7f270851f20523dd2e29f082bcc82292d66db2b64ea71f64b6e1c1", size = 471464, upload-time = "2026-05-06T13:37:06.98Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ce/8c/af022f0af448d7747c5154288d46b5f2bc5f17366eaa0e23e9aa04d59f3b/pydantic_core-2.46.4-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:3245406455a5d98187ec35530fd772b1d799b26667980872c8d4614991e2c4a2", size = 2106158, upload-time = "2026-05-06T13:38:57.215Z" }, + { url = "https://files.pythonhosted.org/packages/19/95/6195171e385007300f0f5574592e467c568becce2d937a0b6804f218bc49/pydantic_core-2.46.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:962ccbab7b642487b1d8b7df90ef677e03134cf1fd8880bf698649b22a69371f", size = 1951724, upload-time = "2026-05-06T13:37:02.697Z" }, + { url = "https://files.pythonhosted.org/packages/8e/bc/f47d1ff9cbb1620e1b5b697eef06010035735f07820180e74178226b27b3/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8233f2947cf85404441fd7e0085f53b10c93e0ee78611099b5c7237e36aacbf7", size = 1975742, upload-time = "2026-05-06T13:37:09.448Z" }, + { url = "https://files.pythonhosted.org/packages/5b/11/9b9a5b0306345664a2da6410877af6e8082481b5884b3ddd78d47c6013ce/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a233125ac121aa3ffba9a2b59edfc4a985a76092dc8279586ab4b71390875e7", size = 2052418, upload-time = "2026-05-06T13:37:38.234Z" }, + { url = "https://files.pythonhosted.org/packages/f1/b7/a65fec226f5d78fc39f4a13c4cc0c768c22b113438f60c14adc9d2865038/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5b712b53160b79a5850310b912a5ef8e57e56947c8ad690c227f5c9d7e561712", size = 2232274, upload-time = "2026-05-06T13:38:27.753Z" }, + { url = "https://files.pythonhosted.org/packages/68/f0/92039db98b907ef49269a8271f67db9cb78ae2fc68062ef7e4e77adb5f61/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9401557acd873c3a7f3eb9383edef8ac4968f9510e340f4808d427e75667e7b4", size = 2309940, upload-time = "2026-05-06T13:38:05.353Z" }, + { url = "https://files.pythonhosted.org/packages/5f/97/2aab507d3d00ca626e8e57c1eac6a79e4e5fbcc63eb99733ff55d1717f65/pydantic_core-2.46.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:926c9541b14b12b1681dca8a0b75feb510b06c6341b70a8e500c2fdcff837cce", size = 2094516, upload-time = "2026-05-06T13:39:10.577Z" }, + { url = "https://files.pythonhosted.org/packages/22/37/a8aca44d40d737dde2bc05b3c6c07dff0de07ce6f82e9f3167aeaf4d5dea/pydantic_core-2.46.4-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:56cb4851bcaf3d117eddcef4fe66afd750a50274b0da8e22be256d10e5611987", size = 2136854, upload-time = "2026-05-06T13:40:22.59Z" }, + { url = "https://files.pythonhosted.org/packages/24/99/fcef1b79238c06a8cbec70819ac722ba76e02bc8ada9b0fd66eba40da01b/pydantic_core-2.46.4-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c68fcd102d71ea85c5b2dfac3f4f8476eff42a9e078fd5faefff6d145063536b", size = 2180306, upload-time = "2026-05-06T13:40:10.666Z" }, + { url = "https://files.pythonhosted.org/packages/ae/6c/fc44000918855b42779d007ae63b0532794739027b2f417321cddbc44f6a/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b2f69dec1725e79a012d920df1707de5caf7ed5e08f3be4435e25803efc47458", size = 2190044, upload-time = "2026-05-06T13:40:43.231Z" }, + { url = "https://files.pythonhosted.org/packages/6b/65/d9cadc9f1920d7a127ad2edba16c1db7916e59719285cd6c94600b0080ba/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:8d0820e8192167f80d88d64038e609c31452eeca865b4e1d9950a27a4609b00b", size = 2329133, upload-time = "2026-05-06T13:39:57.365Z" }, + { url = "https://files.pythonhosted.org/packages/d0/cf/c873d91679f3a30bcf5e7ac280ce5573483e72295307685120d0d5ad3416/pydantic_core-2.46.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:fbdb89b3e1c94a30cc5edfce477c6e6a5dc4d8f84665b455c27582f211a1c72c", size = 2374464, upload-time = "2026-05-06T13:38:06.976Z" }, + { url = "https://files.pythonhosted.org/packages/47/bd/6f2fc8188f31bf10590f1e98e7b306336161fac930a8c514cd7bd828c7dc/pydantic_core-2.46.4-cp312-cp312-win32.whl", hash = "sha256:9aa768456404a8bf48a4406685ac2bec8e72b62c69313734fa3b73cf33b3a894", size = 1974823, upload-time = "2026-05-06T13:40:47.985Z" }, + { url = "https://files.pythonhosted.org/packages/40/8c/985c1d41ea1107c2534abd9870e4ed5c8e7669b5c308297835c001e7a1c4/pydantic_core-2.46.4-cp312-cp312-win_amd64.whl", hash = "sha256:e9c26f834c65f5752f3f06cb08cb86a913ceb7274d0db6e267808a708b46bc89", size = 2072919, upload-time = "2026-05-06T13:39:21.153Z" }, + { url = "https://files.pythonhosted.org/packages/c4/ba/f463d006e0c47373ca7ec5e1a261c59dc01ef4d62b2657af925fb0deee3a/pydantic_core-2.46.4-cp312-cp312-win_arm64.whl", hash = "sha256:4fc73cb559bdb54b1134a706a2802a4cddd27a0633f5abb7e53056268751ac6a", size = 2027604, upload-time = "2026-05-06T13:39:03.753Z" }, + { url = "https://files.pythonhosted.org/packages/9d/1d/8987ad40f65ae1432753072f214fb5c74fe47ffbd0698bb9cbbb585664f8/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:1d8ba486450b14f3b1d63bc521d410ec7565e52f887b9fb671791886436a42f7", size = 2095527, upload-time = "2026-05-06T13:39:52.283Z" }, + { url = "https://files.pythonhosted.org/packages/64/d3/84c282a7eee1d3ac4c0377546ef5a1ea436ce26840d9ac3b7ed54a377507/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:3009f12e4e90b7f88b4f9adb1b0c4a3d58fe7820f3238c190047209d148026df", size = 1936024, upload-time = "2026-05-06T13:40:15.671Z" }, + { url = "https://files.pythonhosted.org/packages/d7/ca/eac61596cdeb4d7e174d3dc0bd8a6238f14f75f97a24e7b7db4c7e7340a0/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ad785e92e6dc634c21555edc8bd6b64957ab844541bcb96a1366c202951ae526", size = 1990696, upload-time = "2026-05-06T13:38:34.717Z" }, + { url = "https://files.pythonhosted.org/packages/fa/c3/7c8b240552251faf6b3a957db200fcfbbcec36763c050428b601e0c9b83b/pydantic_core-2.46.4-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:00c603d540afdd6b80eb39f078f33ebd46211f02f33e34a32d9f053bba711de0", size = 2147590, upload-time = "2026-05-06T13:39:29.883Z" }, ] [[package]] @@ -656,17 +1426,28 @@ wheels = [ [[package]] name = "pydantic-settings" -version = "2.16.0" +version = "2.15.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, { name = "python-dotenv" }, - { name = "typing-extensions" }, { name = "typing-inspection" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/2e/3b/a5d2294799b53b448319978cfb5bd139d5a9d45e862af91661614f14c922/pydantic_settings-2.16.0.tar.gz", hash = "sha256:5b6c578049ede4db0e2ef3b4eaa4ad4069cfa9211f83fb38df899dfade50a614", size = 301031, upload-time = "2026-10-14T12:44:09.998Z" } +sdist = { url = "https://files.pythonhosted.org/packages/68/ca/31c57507b13119d7d3cfa1576dad2911a4861e3be07b579395f4e9d393f9/pydantic_settings-2.15.0.tar.gz", hash = "sha256:694b793e84f766ba76a90ebdefc01d0a9a045dab0382bee70393da93712ad117", size = 261253, upload-time = "2026-08-07T09:24:57.419Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/30/a4/2bffa9f8e804325a09867f0e9d30795c80ea9f8d62560bd1b6ad6220eb2f/pydantic_settings-2.15.0-py3-none-any.whl", hash = "sha256:0ba092c291c94baceb5eff768aa0d56400a457585bc0175925a5a5510303da42", size = 69413, upload-time = "2026-08-07T09:24:55.839Z" }, +] + +[[package]] +name = "pydot" +version = "4.0.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pyparsing" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/50/35/b17cb89ff865484c6a20ef46bf9d95a5f07328292578de0b295f4a6beec2/pydot-4.0.1.tar.gz", hash = "sha256:c2148f681c4a33e08bf0e26a9e5f8e4099a82e0e2a068098f32ce86577364ad5", size = 162594, upload-time = "2025-06-17T20:09:56.454Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/53/f4/b987bf8c51e5b19a95fa66d1ee596074141e085d9c2ddf97920803c7029b/pydantic_settings-2.16.0-py3-none-any.whl", hash = "sha256:7e73acf7f61936a15e5a3b6eedaea29f133357faf7272f2607ba479b049dd7f2", size = 80364, upload-time = "2026-10-14T12:44:08.233Z" }, + { url = "https://files.pythonhosted.org/packages/7e/32/a7125fb28c4261a627f999d5fb4afff25b523800faed2c30979949d6facd/pydot-4.0.1-py3-none-any.whl", hash = "sha256:869c0efadd2708c0be1f916eb669f3d664ca684bc57ffb7ecc08e70d5e93fee6", size = 37087, upload-time = "2025-06-17T20:09:55.25Z" }, ] [[package]] @@ -678,6 +1459,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" }, ] +[[package]] +name = "pyparsing" +version = "3.3.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e4/11/b213bebff182584360cb8d17c72c1677fec5c5c228de439e63bcf8ab1c8f/pyparsing-3.3.3.tar.gz", hash = "sha256:928ae7e20211f3b6f3915a72f06a0cfd29ab9d24279dd6346b6b1a7146397d36", size = 1050487, upload-time = "2026-09-20T20:59:05.609Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/38/bb/d215ee7c73b61497b28a5503f9f53523f294fcc936762b7caf90e0c1c2b5/pyparsing-3.3.3-py3-none-any.whl", hash = "sha256:ece8c00a69cf01b45d0b1dedabb469c90d8caf996d4fda40f147627a122849a4", size = 126420, upload-time = "2026-09-20T20:59:04.025Z" }, +] + [[package]] name = "pytest" version = "8.4.2" @@ -729,6 +1519,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/60/d1/38f3a3405989a89ac18390803e70c6ad7c7760da4f9b83cbeca0c44a0c72/python_dotenv-1.2.4-py3-none-any.whl", hash = "sha256:42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc", size = 23266, upload-time = "2026-10-01T05:36:08.633Z" }, ] +[[package]] +name = "pytz" +version = "2026.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/14/21/d83d6ef28c4c912c4bb4d1dcf591f7b8c6bde87b9c66f9f454677314e16d/pytz-2026.5.tar.gz", hash = "sha256:fa23724b9c486543b9ff54a327ee7569ac83ade54bb9afd0fc18676620401c86", size = 318572, upload-time = "2026-10-04T02:37:58.719Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4f/ef/c66110d46fb800dda0bf33164182dfadabe26a90e4476844d502a23dca8e/pytz-2026.5-py2.py3-none-any.whl", hash = "sha256:e658af3757f9e26a9d25dd2aff38335acd92bc9104f890a894b2c1ba28311b03", size = 506342, upload-time = "2026-10-04T02:37:56.814Z" }, +] + [[package]] name = "pyyaml" version = "6.0.3" @@ -786,6 +1585,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/a0/f4/c67b0b3f1b9245e8d266f0f112c500d50e5b4e83cb6f3b71b6528104182a/requests-2.34.2-py3-none-any.whl", hash = "sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0", size = 73075, upload-time = "2026-05-14T19:25:26.443Z" }, ] +[[package]] +name = "rich" +version = "15.0.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "markdown-it-py" }, + { name = "pygments" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c0/8f/0722ca900cc807c13a6a0c696dacf35430f72e0ec571c4275d2371fca3e9/rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36", size = 230680, upload-time = "2026-04-12T08:24:00.75Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" }, +] + [[package]] name = "ruff" version = "0.17.1" @@ -811,6 +1623,81 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/df/c9/0f2a4dea06a5e12c1191ee3d96b1e1233797d0d5e18f97a2b909a95a9836/ruff-0.17.1-py3-none-win_arm64.whl", hash = "sha256:42400b9a6ff8515ff27796f07f92e0195be011c86e81e381606f58ea5502fef4", size = 9853542, upload-time = "2026-10-15T15:23:16.05Z" }, ] +[[package]] +name = "safetensors" +version = "0.8.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/45/06/f955dbbb1859e3bd23c8ac6141af5106e7ad5fedec4a3a6e3d60f94b7001/safetensors-0.8.0.tar.gz", hash = "sha256:fabaf3e0f18a6618d9b36560682562157f77c2b71fcffc7b432be2baed9d753d", size = 325846, upload-time = "2026-06-09T07:52:25.563Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/39/a0/f718cda65b05407d228f97602cf60dca269c979867aa5beb25410de26cd3/safetensors-0.8.0-cp310-abi3-macosx_10_12_x86_64.whl", hash = "sha256:c554f85858e05226d3c2828e32395e677434685d6d94594a41643361c5e837f0", size = 473568, upload-time = "2026-06-09T07:52:18.829Z" }, + { url = "https://files.pythonhosted.org/packages/f5/b1/fa7c600e7dceae12e9606c7578cbc9ff1e1ed55844883ee5c92205e86226/safetensors-0.8.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:c80201d22cbf405b80647a60ada77bba06c8fba2da2743ba1e89cdcc39a81f25", size = 484562, upload-time = "2026-06-09T07:52:17.518Z" }, + { url = "https://files.pythonhosted.org/packages/09/7d/65a7de0af421317bb36a067241e4235fff194eed60b961ed6d3f59a3fc60/safetensors-0.8.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7a46e5ff292c356d6991e60942ba7f79817682d3a2cef0702136448cb9c4d235", size = 502844, upload-time = "2026-06-09T07:52:07.624Z" }, + { url = "https://files.pythonhosted.org/packages/91/4f/3175c9d75634e0e0dda0082794193521035edd7c70a6f212bf33ca06ddf4/safetensors-0.8.0-cp310-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4124502b78f03534117c848f87a39b8f31e577b15eff423bf8bfb95f2a8c30d0", size = 511823, upload-time = "2026-06-09T07:52:09.565Z" }, + { url = "https://files.pythonhosted.org/packages/20/87/846c289e7aa2299eff406335717cf43ce8777194ece8aad75772e0411615/safetensors-0.8.0-cp310-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7bc0a787ba8a35be368ee3574edfa2b1ad389eebd0a72e482ae275490e3f6c98", size = 633461, upload-time = "2026-06-09T07:52:11.128Z" }, + { url = "https://files.pythonhosted.org/packages/76/22/8d64d9df2c45d5ded401df889d0ad90882804ca172d79ec4f0df8f727fe0/safetensors-0.8.0-cp310-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:040070828e36dc8e122178bbbd5830ff9e97920affb84cbe0f46442497bed358", size = 545148, upload-time = "2026-06-09T07:52:13.603Z" }, + { url = "https://files.pythonhosted.org/packages/28/50/f203ff3a3ddfe19308efc83c5a3a29ed02bf786732ec35e68bf9162f3365/safetensors-0.8.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd6f3f93c9a0a7cc2788ee63fb763353d4bd2e89b0751bc78fcf7dda00bea774", size = 516040, upload-time = "2026-06-09T07:52:16.29Z" }, + { url = "https://files.pythonhosted.org/packages/46/fb/cdaed17ceb2948784fd9c36b6fd3e951b608547cea81a48e8ee6f8cfdfcb/safetensors-0.8.0-cp310-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:fcdd41ec4628fee5799f807c73c353629130fbd942aa23d83c623dd6c9d52d78", size = 513832, upload-time = "2026-06-09T07:52:12.37Z" }, + { url = "https://files.pythonhosted.org/packages/0d/49/1e15de264dcc3b77943d2d0c56a95809956883b1c2d6d585c792523f180b/safetensors-0.8.0-cp310-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8e9f537aa183a38ace122d27303dcd986b26bd2a7591f9181d7f0c396f4677ca", size = 559930, upload-time = "2026-06-09T07:52:14.743Z" }, + { url = "https://files.pythonhosted.org/packages/2a/43/bf38443278eab4b1be1fce2931e2b012ad9cb7df52ada751d0aab8f7659a/safetensors-0.8.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:87eec7ffed2b809f05a398a8becb7d013f19f7837cd15d9748580d6cf30dbaf4", size = 678670, upload-time = "2026-06-09T07:52:20.032Z" }, + { url = "https://files.pythonhosted.org/packages/72/e3/68cd3fa5b48488e84add63e04cb12f3bc28ae4638c06d4508c6e88823d0e/safetensors-0.8.0-cp310-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:4a95ae2b05d7726d751da4ebf626a2ca782b706e101bd894c95bc2450b1cffcc", size = 786679, upload-time = "2026-06-09T07:52:21.322Z" }, + { url = "https://files.pythonhosted.org/packages/29/4b/1c19c509d56e01f4fbb3d0a2e597450f6cc04d1d56cf52defb0a62dfd715/safetensors-0.8.0-cp310-abi3-musllinux_1_2_i686.whl", hash = "sha256:3ae091f16662658bdc019a4ff6cb4c085bb7d725eb5978b183ffd265863b6d2d", size = 765683, upload-time = "2026-06-09T07:52:22.594Z" }, + { url = "https://files.pythonhosted.org/packages/27/43/41c1621732edd934d868a00d1b891584c892a7b62a9aab82ea5a0a5623ee/safetensors-0.8.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:8e080062fcde23be189565e1c3305d16751a218ecf9412c8601e64204eb6f846", size = 722361, upload-time = "2026-06-09T07:52:23.924Z" }, + { url = "https://files.pythonhosted.org/packages/8e/3f/73ccf82579412b4a71c4ca673f10b5f1f888d7cf5af7fe24f27d30307be4/safetensors-0.8.0-cp310-abi3-win32.whl", hash = "sha256:2ddf52eac562eda224f99acfa7889d02968c1fd59a5b011ae7d8137c37e9c02d", size = 342401, upload-time = "2026-06-09T07:52:28.895Z" }, + { url = "https://files.pythonhosted.org/packages/1b/6d/3fba214c1e5e0f69991677ec3bc17023f0421776975e1de0c682dca475e2/safetensors-0.8.0-cp310-abi3-win_amd64.whl", hash = "sha256:096ec1a98435df7beb08853bb5aa9081a84f23d0adc67ed1a0a10550f608373f", size = 355540, upload-time = "2026-06-09T07:52:27.832Z" }, + { url = "https://files.pythonhosted.org/packages/8d/fc/7eedc3510d97878876e32774eebbeb61c43f148a96e915c84229a3e967aa/safetensors-0.8.0-cp310-abi3-win_arm64.whl", hash = "sha256:f7838e5135a406ad3e02efdcb8cf2e5397d368b0154537c4fec682dbc544d452", size = 340500, upload-time = "2026-06-09T07:52:26.745Z" }, +] + +[[package]] +name = "scikit-learn" +version = "1.9.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "joblib" }, + { name = "narwhals" }, + { name = "numpy" }, + { name = "scipy" }, + { name = "threadpoolctl" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/fa/6f/37092bdb25f712817231799fc5674d8e704066a8a70c1d2d40517e18b4ab/scikit_learn-1.9.0.tar.gz", hash = "sha256:8833266989d3a5110178a9fae30783675460724d0e1efb13b14901d2c660c557", size = 7750767, upload-time = "2026-06-02T11:54:32.706Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ac/20/75f915ff375d6249e6550ac740fdbbd66159a068fd3af1400ff62036b07a/scikit_learn-1.9.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:2bd41b0d201bc81575531b96b713d3eb5e5f50fb0b82101ff0f92294fdc236ac", size = 8741122, upload-time = "2026-06-02T11:53:24.08Z" }, + { url = "https://files.pythonhosted.org/packages/cc/d5/2b5148f2279196775e1db2aeb85d14b70ac80e7e32b3b28e7ebeafb0901d/scikit_learn-1.9.0-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:5be45aa4a42a68a533913a6ed736cf309de2226411c79ef8d609a5456f1939b1", size = 8261512, upload-time = "2026-06-02T11:53:27.183Z" }, + { url = "https://files.pythonhosted.org/packages/a0/ee/5adbc77656b71f9456a2f5a7a9fdb4bcf9207a6b962889f1c2f9323afa4e/scikit_learn-1.9.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:5e50ed4da51974e86e940690e9a3d82e729b62b5a49f7c9bac534d515d39d86f", size = 8837603, upload-time = "2026-06-02T11:53:30.328Z" }, + { url = "https://files.pythonhosted.org/packages/6c/c2/63fdda36c56437eeb44aaf9493c8bcd62ce230ab1598924fc626ffbfa943/scikit_learn-1.9.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:056c92bb67ad4c28463c2f2653d9701449201e7e7a9e94e321be0f71c4fef2b8", size = 9132097, upload-time = "2026-06-02T11:53:33.456Z" }, + { url = "https://files.pythonhosted.org/packages/83/a4/c8e67227c680e2259c8864ae72ff48b06e16a6f51253a22167aa02a8aa4e/scikit_learn-1.9.0-cp312-cp312-win_amd64.whl", hash = "sha256:4306775fad04cc4b472a1b15af1ae9cede1540fbfcc17fbce3767cd8dc7ae283", size = 8211173, upload-time = "2026-06-02T11:53:36.602Z" }, + { url = "https://files.pythonhosted.org/packages/cf/fd/3c0863792e98e67e9184aa4029288a175935eb65443afcd30d4f143450cf/scikit_learn-1.9.0-cp312-cp312-win_arm64.whl", hash = "sha256:26e22435f63bcdcf396b574273f29f13dd531f5ea035801f5be10ba1540a4e60", size = 7867451, upload-time = "2026-06-02T11:53:39.075Z" }, +] + +[[package]] +name = "scipy" +version = "1.18.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "numpy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/7e/74/66de6258867beb2ef08f35f9f2ac017a52cacd5081714d239ff1a442d458/scipy-1.18.1.tar.gz", hash = "sha256:52c4b7422442aba924d03ad4019852b08a92e64ea187b933135687bfe2747307", size = 30781235, upload-time = "2026-08-21T23:28:50.599Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/18/f7/240c110c08693826b4513a52f5717d62ec7c7af72f2920821247c03b17b3/scipy-1.18.1-cp312-cp312-macosx_10_15_x86_64.whl", hash = "sha256:457fd7a2a8edeb044ab6ffbc0aa03ff6cd18491356e5e0c834d76ce621b916d1", size = 31111061, upload-time = "2026-08-21T23:23:44.522Z" }, + { url = "https://files.pythonhosted.org/packages/05/4a/78c6285577c375e7cf27277ea8ee6961224327f1e1a0c44af5f17f23635c/scipy-1.18.1-cp312-cp312-macosx_12_0_arm64.whl", hash = "sha256:e708533e8b2ae2497d65346538a7dcc92814410b25b81432eac66de0f2af8265", size = 28733332, upload-time = "2026-08-21T23:23:50.015Z" }, + { url = "https://files.pythonhosted.org/packages/a5/f6/a5b82f8abbe14d134691b8b903696f701d25a081353a29dc655c364d9e62/scipy-1.18.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:7bbf207c4453ce1ad2e00b17313852b33310b83090c2311bdaf97f93c0380d12", size = 20475078, upload-time = "2026-08-21T23:23:54.138Z" }, + { url = "https://files.pythonhosted.org/packages/23/22/0858a0bbd6b3e825ceb8cd9baf9eaf3b2f2b1d77727eb6be40500bcdc92f/scipy-1.18.1-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:78c0665edead396b1abb4897c41a5c1d9bf090c8a637a4c20a61678e0a264e66", size = 23108904, upload-time = "2026-08-21T23:23:57.824Z" }, + { url = "https://files.pythonhosted.org/packages/75/9a/2e71719f31eaefe0e3a1706c4a1ded94e664bfd95ffca2b219a671faee01/scipy-1.18.1-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3c085faa2cfa879c5141df483f836f4d691045a078224a670fa570fa01612d89", size = 34025113, upload-time = "2026-08-21T23:24:02.209Z" }, + { url = "https://files.pythonhosted.org/packages/df/64/ff35eb9e54894cf471ff4716abd3c81eb0a0626869217ce3e6ba4ccf17d7/scipy-1.18.1-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f55fa87b6c612ecd6b058f167c53231b1d14e412efe361d3d6e38b3631c73218", size = 35344199, upload-time = "2026-08-21T23:24:07.844Z" }, + { url = "https://files.pythonhosted.org/packages/d3/af/c5538be1792f7034c12c7db6ee67cace58253c7b87b122d68253eaf5de89/scipy-1.18.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:c35d74ce0e193ff740c2f2be2ac913ddc232fe6c1ff40b26cfecb9c670c63314", size = 35639587, upload-time = "2026-08-21T23:24:13.05Z" }, + { url = "https://files.pythonhosted.org/packages/91/4c/075e4f66471bac101141ac739e9e135549be1bae584571bd03a530c056e1/scipy-1.18.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:d2924a03db38dc2e848bca2fe9f077dafb891480b91a00a0963a8cf86dfc31c1", size = 37480330, upload-time = "2026-08-21T23:24:19.608Z" }, + { url = "https://files.pythonhosted.org/packages/39/e7/979fd14e75008623df31ba70d6bb144700f68feadcea042021c06a05bf82/scipy-1.18.1-cp312-cp312-win_amd64.whl", hash = "sha256:5e4d44984abc0020154ea81b247adeddcc3ac5527b975ff798bd1ba0adc513c2", size = 36658278, upload-time = "2026-08-21T23:24:25.463Z" }, + { url = "https://files.pythonhosted.org/packages/c7/0b/e1525354ff9d7d5feb6d1b31af6d14072e5c91e9607b421fa1ec889660b3/scipy-1.18.1-cp312-cp312-win_arm64.whl", hash = "sha256:d65d448389b8436493abcf629cc94ad0cf32aecaf06e1acca1de53cc795f2f12", size = 24400588, upload-time = "2026-08-21T23:24:30.579Z" }, +] + +[[package]] +name = "setuptools" +version = "84.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6d/44/f5da03a8ef95d369145c5bb53050e7877c9f3d312e128605fd9504829143/setuptools-84.0.0.tar.gz", hash = "sha256:f4695c21257f0d9b537ec2692c941d02ee143b7cc1276941349a546573b2ef73", size = 1168449, upload-time = "2026-08-08T18:27:58.365Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/95/9c/c510029fc6ef33a6275cd2c5d3cecd6613dfd6aa401d57c54f1c18852ccf/setuptools-84.0.0-py3-none-any.whl", hash = "sha256:51a52592b3b99e102b609654876bd65f19f999935166d1352678931132b0c670", size = 818216, upload-time = "2026-08-08T18:27:56.719Z" }, +] + [[package]] name = "six" version = "1.17.0" @@ -820,6 +1707,27 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/b7/ce/149a00dd41f10bc29e5921b496af8b574d8413afcd5e30dfa0ed46c2cc5e/six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274", size = 11050, upload-time = "2024-12-04T17:35:26.475Z" }, ] +[[package]] +name = "skrub" +version = "0.10.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cloudpickle" }, + { name = "jinja2" }, + { name = "joblib" }, + { name = "matplotlib" }, + { name = "numpy" }, + { name = "pandas" }, + { name = "pydot" }, + { name = "requests" }, + { name = "scikit-learn" }, + { name = "scipy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/a3/a6/f4d0b7240ebf546d3a77f212958b930282cccb0a53d66b9b0e1639ce8230/skrub-0.10.1.tar.gz", hash = "sha256:39f58492f6889c5563a654478cd523771aaa8dab5a42ad2ce9f430efb3881f53", size = 4205317, upload-time = "2026-09-01T09:33:37.146Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/0e/2d/492a8b0d0d8b344918312a6416c537e54081ca5d0aaf19d085a188905e41/skrub-0.10.1-py3-none-any.whl", hash = "sha256:553c6f9b19a2cb97bba776a28255e7e024e77d4f50d7c6c70b4805f4e668a3cc", size = 595919, upload-time = "2026-09-01T09:33:35.208Z" }, +] + [[package]] name = "sniffio" version = "1.3.1" @@ -829,6 +1737,138 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235, upload-time = "2024-02-25T23:20:01.196Z" }, ] +[[package]] +name = "soupsieve" +version = "3.0.3" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/5e/77/2dcfa996b01702ab8fd0763d84098f6a640d6162a328f1c04c2697579a1a/soupsieve-3.0.3.tar.gz", hash = "sha256:7dcf6022eed0399eb9934a75e020148f7a2024c37b7dfcd3cf2c5505d69c364e", size = 115923, upload-time = "2026-10-12T13:21:17.696Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/49/ca/f639c80449997b88aba7bc9705d25dd76cc0844f45f187862fd8f8bb18fa/soupsieve-3.0.3-py3-none-any.whl", hash = "sha256:fa30e3ba4809cb81ce1f3209f2fbe3e779fc445f0439bc147a0d7c4601743f21", size = 41705, upload-time = "2026-10-12T13:21:16.474Z" }, +] + +[[package]] +name = "sseclient-py" +version = "1.9.0" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/4d/2e/59920f7d66b7f9932a3d83dd0ec53fab001be1e058bf582606fe414a5198/sseclient_py-1.9.0-py3-none-any.whl", hash = "sha256:340062b1587fc2880892811e2ab5b176d98ef3eee98b3672ff3a3ba1e8ed0f6f", size = 8351, upload-time = "2026-01-02T23:39:30.995Z" }, +] + +[[package]] +name = "sympy" +version = "1.14.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "mpmath" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/83/d3/803453b36afefb7c2bb238361cd4ae6125a569b4db67cd9e79846ba2d68c/sympy-1.14.0.tar.gz", hash = "sha256:d3d3fe8df1e5a0b42f0e7bdf50541697dbe7d23746e894990c030e2b05e72517", size = 7793921, upload-time = "2025-04-27T18:05:01.611Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a2/09/77d55d46fd61b4a135c444fc97158ef34a095e5681d0a6c10b75bf356191/sympy-1.14.0-py3-none-any.whl", hash = "sha256:e091cc3e99d2141a0ba2847328f5479b05d94a6635cb96148ccb3f34671bd8f5", size = 6299353, upload-time = "2025-04-27T18:04:59.103Z" }, +] + +[[package]] +name = "tabpfn" +version = "9.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "einops" }, + { name = "filelock" }, + { name = "huggingface-hub" }, + { name = "joblib" }, + { name = "lightgbm" }, + { name = "matplotlib" }, + { name = "mlx", marker = "platform_machine == 'arm64' and sys_platform == 'darwin'" }, + { name = "numpy" }, + { name = "pandas" }, + { name = "pydantic" }, + { name = "pydantic-settings" }, + { name = "safetensors" }, + { name = "scikit-learn" }, + { name = "scipy" }, + { name = "skrub" }, + { name = "torch" }, + { name = "tqdm" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b0/03/1b48e093811877c651f731ac64e36a71b3ac44ec5c5c67a395422a6cbfed/tabpfn-9.2.0.tar.gz", hash = "sha256:e7fb2c6293ffef664c69838eb4cb215c79c85a0c0bd449fdf22489045d32b9eb", size = 937644, upload-time = "2026-10-12T15:12:56.56Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ac/a7/5c403c9fec9f726c91eaeaebaa8905530813ab58cb134a043c4b17afbd6a/tabpfn-9.2.0-py3-none-any.whl", hash = "sha256:bf8edb860cf490ab021d0ba6e91a9798f1b549bdb220066599661c8fc6d6089f", size = 850035, upload-time = "2026-10-12T15:12:54.671Z" }, +] + +[[package]] +name = "tabpfn-client" +version = "0.6.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "backoff" }, + { name = "google-crc32c" }, + { name = "httpx" }, + { name = "omegaconf" }, + { name = "pandas" }, + { name = "password-strength" }, + { name = "pyarrow" }, + { name = "pydantic" }, + { name = "pydantic-settings" }, + { name = "rich" }, + { name = "scikit-learn" }, + { name = "sseclient-py" }, + { name = "tabpfn-common-utils" }, + { name = "tqdm" }, + { name = "typing-extensions" }, + { name = "xxhash" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b9/c0/df9cc8322cd72da6cec64e8208e6d4a5ad382d0a34df02cd044a035fecf6/tabpfn_client-0.6.1.tar.gz", hash = "sha256:682b96888809372651eff86f2b34ec96a4f38be1ff1cbea8ef9c2921e2df566d", size = 297863, upload-time = "2026-09-28T12:40:39.995Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/03/8b/574d92d54d133bd3b1146f9cb899702901914a2a96bd58a4d242b7b61ea7/tabpfn_client-0.6.1-py3-none-any.whl", hash = "sha256:40c49a5f06ab7b9f4e9c697433d8fc0fefba8bcf18971d372d9a2737ccda8133", size = 84751, upload-time = "2026-09-28T12:40:38.509Z" }, +] + +[[package]] +name = "tabpfn-common-utils" +version = "0.2.19" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "filelock" }, + { name = "numpy" }, + { name = "nvidia-ml-py" }, + { name = "pandas" }, + { name = "platformdirs" }, + { name = "posthog" }, + { name = "requests" }, + { name = "ruff" }, + { name = "scikit-learn" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/84/62/ec181b52e12f64eac179f31d0891ccb2b3f48552de32d8992e0f5144c808/tabpfn_common_utils-0.2.19.tar.gz", hash = "sha256:d5bb515f9c7bdda555d833542ab4c41a2cc7007e3ae57b9c302ad4f4f8186558", size = 1932394, upload-time = "2026-03-27T13:31:27.285Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/34/dd/4b6095777970f3f9e50144b5cfd993ad2e70a9c08fed3425d8c9e8f88784/tabpfn_common_utils-0.2.19-py3-none-any.whl", hash = "sha256:1f53f3f96ddccc99b27f80075437e7a3dd29666b6c2575ad03dc3f9ae6df9c38", size = 37295, upload-time = "2026-03-27T13:31:25.917Z" }, +] + +[[package]] +name = "tabpfn-extensions" +version = "0.6.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pandas" }, + { name = "scikit-learn" }, + { name = "scipy" }, + { name = "tabpfn" }, + { name = "tabpfn-common-utils" }, + { name = "torch" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/76/e6/bf599982b235116a061ef7681433d897a1c4070c7b3c8f0a60130a936c77/tabpfn_extensions-0.6.3.tar.gz", hash = "sha256:ff8756d2ae9146920165c0138b21dbb8e86a2d3e0cc106ce1d76324adb68211d", size = 154444, upload-time = "2026-09-21T14:23:43.905Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/35/b2/5c15d56b777a96bab66d81a2db959da8c24b3b6d755c8604184527a21b4e/tabpfn_extensions-0.6.3-py3-none-any.whl", hash = "sha256:9305e495cd1c7b572db63b301ccd149e4b0e7769c70a1058f76a1430caacbf63", size = 123160, upload-time = "2026-09-21T14:23:42.118Z" }, +] + +[[package]] +name = "threadpoolctl" +version = "3.7.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/00/dc/6c58154c1c65f758ea979e7139cb76993a9cfc662d14e9be3c4a667cfb77/threadpoolctl-3.7.0.tar.gz", hash = "sha256:61348cfb77d53b9242e0017029244b559b810c142ced65b4e21eeca1843959a7", size = 31961, upload-time = "2026-09-15T15:46:20.263Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/43/3f/f88a53f60a472b46f4023f56d204dd7de33d34c5d2acbfa0d70a674e639e/threadpoolctl-3.7.0-py3-none-any.whl", hash = "sha256:cd8b60b5641b45c67bbf73c64c843235fc2d8a480c87389f52f5dbee893b86be", size = 26362, upload-time = "2026-09-15T15:46:19.168Z" }, +] + [[package]] name = "tiktoken" version = "0.14.0" @@ -848,6 +1888,54 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/bd/bd/a2e884fb1402cba5be08836590320012b2d8ada0e2eef9911a64df4bcd2d/tiktoken-0.14.0-cp312-cp312-win_amd64.whl", hash = "sha256:087538c080e5ff421abd3a0785ed63c5111d06af98e6cd0d374dbe5969147ca3", size = 941208, upload-time = "2026-08-17T19:48:56.938Z" }, ] +[[package]] +name = "torch" +version = "2.14.1" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "cuda-bindings", marker = "sys_platform == 'linux'" }, + { name = "cuda-toolkit", extra = ["cublas", "cudart", "cufft", "cufile", "cupti", "curand", "cusolver", "cusparse", "nvjitlink", "nvrtc", "nvtx"], marker = "sys_platform == 'linux'" }, + { name = "filelock" }, + { name = "fsspec" }, + { name = "jinja2" }, + { name = "networkx" }, + { name = "nvidia-cudnn-cu13", marker = "sys_platform == 'linux'" }, + { name = "nvidia-cusparselt-cu13", marker = "sys_platform == 'linux'" }, + { name = "nvidia-nccl-cu13", marker = "sys_platform == 'linux'" }, + { name = "nvidia-nvshmem-cu13", marker = "sys_platform == 'linux'" }, + { name = "setuptools" }, + { name = "sympy" }, + { name = "triton", marker = "sys_platform == 'linux'" }, + { name = "typing-extensions" }, +] +wheels = [ + { url = "https://files.pythonhosted.org/packages/4b/3c/379349820e9a6e713826de3d0b88f07728541bdcabe2a3afd128871cdc4b/torch-2.14.1-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:420dbf314c180ee4b86e9bc00aee5746a7d6e5bacdd7df925af671ed393f0b2e", size = 127307099, upload-time = "2026-09-30T17:44:10.421Z" }, + { url = "https://files.pythonhosted.org/packages/a4/3e/474930ab971e306957ec763b7df695d659179e15ccab9e7073d47ae14ce8/torch-2.14.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:0b13acde294b401509830d85a8906cbf2fc97425a12a66cce1d9fa13c5106a2a", size = 453998918, upload-time = "2026-09-30T17:52:45.134Z" }, + { url = "https://files.pythonhosted.org/packages/ba/fd/c470857d0dfc5d4c94430658b3eed60fd5292b0bf596a8aae7b9fd66d674/torch-2.14.1-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:23011fe29a99b591eabb3a31a25080c62e2c2f0690a3c798744e5489dae50451", size = 554618695, upload-time = "2026-09-30T17:53:06.8Z" }, + { url = "https://files.pythonhosted.org/packages/ad/1a/b9648b0d228e513f69f8453ec3f90a8d436d78ff6d85a2773e539f0c07cf/torch-2.14.1-cp312-cp312-win_amd64.whl", hash = "sha256:38bee9f2a2ccfc6898172a5075e4ba52522fbe143eeb099674fc67ab390e858d", size = 124113906, upload-time = "2026-09-30T17:52:21.377Z" }, +] + +[[package]] +name = "tqdm" +version = "4.70.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/21/3b/6c24bec5be5e743ffd99576daa5cc077722fc7d5bbc00bd133fa0c698dc6/tqdm-4.70.0.tar.gz", hash = "sha256:55b0b0dbd97462d06ebee91e4dac24ed4d4702be82b24f07e6c1d27e08cea220", size = 795438, upload-time = "2026-07-27T11:33:15.271Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f9/1c/01bfd571a64e7f270e6bab5e33777debe0edc56759233ce84f27dec92d14/tqdm-4.70.0-py3-none-any.whl", hash = "sha256:7f585706bfddbdebf89daac705b2dfcc16890130727d3197ca62c732b4310953", size = 80184, upload-time = "2026-07-27T11:33:13.167Z" }, +] + +[[package]] +name = "triton" +version = "3.8.0" +source = { registry = "https://pypi.org/simple" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/87/07/0f8cd8e8db0472334253efdaaab3d0819fea27aa99bf0e7f1aeea4ceb5ae/triton-3.8.0-cp312-cp312-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a9c404c69ed4a39e8ec632eaf6b9fe058a060bf98979c177f6ef666f06bb8d50", size = 226474486, upload-time = "2026-08-28T16:08:18.29Z" }, + { url = "https://files.pythonhosted.org/packages/c1/09/b7012e5bfae67640f268aa584caa80fe1674f6b0da949046b679972c33e3/triton-3.8.0-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e91ffa46d095b252248297292dd22bcbacd53a125a0c2eefbbbf74925a320bc3", size = 247972921, upload-time = "2026-08-28T15:55:53.157Z" }, +] + [[package]] name = "truststore" version = "0.10.5" @@ -895,3 +1983,30 @@ sdist = { url = "https://files.pythonhosted.org/packages/e3/05/b17359e1cefb4f909 wheels = [ { url = "https://files.pythonhosted.org/packages/92/9d/c4e665119135114480843e7ab388fa94d8480650450e6f8e26b70d323a4c/urllib3-2.8.0-py3-none-any.whl", hash = "sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3", size = 135717, upload-time = "2026-09-15T19:29:34.577Z" }, ] + +[[package]] +name = "xxhash" +version = "3.8.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/8e/63/71aa56b151a1b28770037a61bd4e461c2619cfc8866a4fcaf1548605e325/xxhash-3.8.1.tar.gz", hash = "sha256:b0de4bf3aa66363552d52c6a89003c479911f12098cd48a53d44a0f7a25f7c46", size = 86223, upload-time = "2026-07-06T10:49:58.937Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/42/91/f65c34a7aa7b4e7cf4854f8e6ef3f7ee32ceac41d4f008da0780db0612f6/xxhash-3.8.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:e6e49370822c1f4d8d90e678b06dbcb08b51a026a7c4b55479e7d467f2e813bc", size = 34680, upload-time = "2026-07-06T10:44:40.932Z" }, + { url = "https://files.pythonhosted.org/packages/57/04/b10a245a4c09a9cfa88f8e9ae755029413ad1ac17047f9a61906e5ae0799/xxhash-3.8.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:220d68130f83f7cc86d6edfdeab176adc73d7200bf3a8ec10c629e8cf605c215", size = 32397, upload-time = "2026-07-06T10:44:42.196Z" }, + { url = "https://files.pythonhosted.org/packages/3a/75/45ab795b5945b6388583bd75202106af505537935566c15a1577797a0e08/xxhash-3.8.1-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4d365ee1892c1fa803536f8c6ce21d24b29c9718ec75eb856095c07830f8c478", size = 220549, upload-time = "2026-07-06T10:44:43.603Z" }, + { url = "https://files.pythonhosted.org/packages/13/44/5ba2bd0a14ddf4193fc7d8ec29625f659f22c06d60b28f04bf46305d8330/xxhash-3.8.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:852bfe059720632e2f16a6a4745e41d20937b2bf2a42a401e2412046bb6971cc", size = 241186, upload-time = "2026-07-06T10:44:45.534Z" }, + { url = "https://files.pythonhosted.org/packages/23/32/c4147def4d1e4538b906f82731e0ba23424377fc50a7cddd03cd284c8f63/xxhash-3.8.1-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:2f8c25a7061d952de589bd0ea0eaadee32378ff83dd6a677b267f9cd86f401f8", size = 264852, upload-time = "2026-07-06T10:44:47.199Z" }, + { url = "https://files.pythonhosted.org/packages/6c/bd/71ed14f4f0318bb7fd7b2ec51999413487fa8da8d41208e84d50d1ef0f98/xxhash-3.8.1-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:868a8dcaff1a84ba78038e1cef14fc88ccf84d9b4d12ea604696e0693296aa56", size = 242663, upload-time = "2026-07-06T10:44:48.846Z" }, + { url = "https://files.pythonhosted.org/packages/91/09/70af22c565a8473b3f2ae73f88e7721af281bc4a575236dbd1970c9f76f6/xxhash-3.8.1-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:6536d8677d2fff7e64cd0b98b976df9de7aee0e69590044c2af5f51b76b7a170", size = 473510, upload-time = "2026-07-06T10:44:50.695Z" }, + { url = "https://files.pythonhosted.org/packages/18/96/34db781c8f0cf99c544ca1f2bc2e5bf55426e1eb4ca6de8ea5da56a9f352/xxhash-3.8.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:82c0cedd280eab2e8291270e6c04894dbc096f8159a39dcf1807429f026ca3cc", size = 220469, upload-time = "2026-07-06T10:44:52.422Z" }, + { url = "https://files.pythonhosted.org/packages/93/5f/9a184f615fa5a4dce30c01534f62946ce5a11ce40f73785cbd356ccabaa9/xxhash-3.8.1-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:daa86e4b68221d38e669bb236ba112d0335353829fb627c82e5909e4bbe8694c", size = 310290, upload-time = "2026-07-06T10:44:54.142Z" }, + { url = "https://files.pythonhosted.org/packages/a9/dc/9b9a9789011ee153723a5eb9e7dd7fcbae2ba9b3fe7a729249ca7c252056/xxhash-3.8.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:2bc7113e6f2b6b3922dd61796ca9f36af09da3773898e7003038dc992fc83b8d", size = 238173, upload-time = "2026-07-06T10:44:55.693Z" }, + { url = "https://files.pythonhosted.org/packages/ec/4d/71c6005ada9dcb608a4e1902e8475ecadb5f3fbfa04e1e244d276a2d0c43/xxhash-3.8.1-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:5eed32dad81d6ba8e62dc7b9ffa0500199385d7810a8dd9d4eafaceb8c6e20bb", size = 269026, upload-time = "2026-07-06T10:44:57.424Z" }, + { url = "https://files.pythonhosted.org/packages/2f/87/d6c036ba25dfbd9c8633be5aa86fc9474bbb9e2c68212a841d090abe7344/xxhash-3.8.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:83697b0ea1f10e7f5d8b26a4906fa851393c61546c63839643a2b7fe2d868061", size = 224970, upload-time = "2026-07-06T10:44:59.085Z" }, + { url = "https://files.pythonhosted.org/packages/48/62/4c1f035a41c5752aa05e195b6c904c07b94fe9061a16de61e72a6e6b135f/xxhash-3.8.1-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:36fc69160465ae75c6ec4ac9f781bb2aa16ae7ff869e73c26fee85fbb11b9887", size = 240820, upload-time = "2026-07-06T10:45:00.746Z" }, + { url = "https://files.pythonhosted.org/packages/da/14/d39d565069b87e86d21a2af2a31d04db79249d25aa8d5b62959056a89857/xxhash-3.8.1-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:445e0f5a31f2f3546ae0895d4811e159518cdc9d824c11419898d40cfadb677e", size = 300619, upload-time = "2026-07-06T10:45:02.716Z" }, + { url = "https://files.pythonhosted.org/packages/13/22/75467acc887edc8cf71c97ab1708feb3df7a88bda589b9f399765c6387d2/xxhash-3.8.1-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:dfe0580fbfd5e4af87d0cc52d2044f155d55ebd8c8a93568758a2ea7d8e15975", size = 443267, upload-time = "2026-07-06T10:45:04.653Z" }, + { url = "https://files.pythonhosted.org/packages/a4/b6/1da3baa5fa6ef705e3425fddd382be7dfc4dfba2686df90a20f16e9c7b1b/xxhash-3.8.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:095e1323fa108be1292c54c86da3ef3c7a7dc015b105a52133973bc07a6ad11a", size = 217338, upload-time = "2026-07-06T10:45:06.304Z" }, + { url = "https://files.pythonhosted.org/packages/78/dd/b5295a9f97484e7a1c2b283a742ca45e3104991c55a1ef670dde161829ba/xxhash-3.8.1-cp312-cp312-win32.whl", hash = "sha256:bf28f55e427e0483acb1f666bd0d869b6d5e5a716680c216ad7befe3d4cfba2e", size = 31970, upload-time = "2026-07-06T10:45:07.823Z" }, + { url = "https://files.pythonhosted.org/packages/ec/31/3fa0b807d7e21515cd975e7fe5c039d52ac3e9401a96d6ad68dae6305215/xxhash-3.8.1-cp312-cp312-win_amd64.whl", hash = "sha256:2256e80e4960ee282f63428adb349cb7f8bd8efe4db770d88eb815f4b9860724", size = 32741, upload-time = "2026-07-06T10:45:09.42Z" }, + { url = "https://files.pythonhosted.org/packages/b8/05/86feada74e239600e6875aa507afb40482a89b92700aa74a92da83bdcb77/xxhash-3.8.1-cp312-cp312-win_arm64.whl", hash = "sha256:9df56e6df96a60590935e22373041cccc91fd55858763dcffb55bf63b3a2b396", size = 29234, upload-time = "2026-07-06T10:45:10.809Z" }, +] From 875c7f086c0148eb13a6b4abb79d4fb035f43256 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 23:00:19 +0500 Subject: [PATCH 13/21] feat: prepare real TabPFN detection and verify simulator Gate 2 --- decision.md | 38 +- docs/CORE_INTEGRATION_VALIDATION.md | 6 +- docs/GATE2_VALIDATION.md | 36 + docs/SECURITY_VERIFICATION.md | 6 + docs/progress/core_detector.md | 10 +- docs/progress/gate2_runner.md | 9 + eval/decision.md | 7 + eval/flow.md | 6 + eval/gate2.py | 696 ++++++++++++++++++ eval/results/gate2.md | 39 + flow.md | 11 +- packages/detector/README.md | 26 +- packages/detector/decision.md | 9 +- packages/detector/flow.md | 10 +- .../src/netcortex_detector/__init__.py | 16 +- .../detector/src/netcortex_detector/engine.py | 34 +- .../src/netcortex_detector/preparation.py | 361 +++++++++ .../src/netcortex_detector/providers.py | 52 +- packages/detector/tests/test_engine.py | 47 ++ .../detector/tests/test_gate2_preparation.py | 206 ++++++ packages/detector/tests/test_gate2_runner.py | 66 ++ packages/detector/tests/test_gate2_state.py | 239 ++++++ 22 files changed, 1891 insertions(+), 39 deletions(-) create mode 100644 docs/GATE2_VALIDATION.md create mode 100644 docs/progress/gate2_runner.md create mode 100644 eval/gate2.py create mode 100644 eval/results/gate2.md create mode 100644 packages/detector/src/netcortex_detector/preparation.py create mode 100644 packages/detector/tests/test_gate2_preparation.py create mode 100644 packages/detector/tests/test_gate2_runner.py create mode 100644 packages/detector/tests/test_gate2_state.py diff --git a/decision.md b/decision.md index 900d47d..a759ba0 100644 --- a/decision.md +++ b/decision.md @@ -9,7 +9,7 @@ how the pieces connect and [the implementation plan](docs/WORKSTREAM_B_PLAN.md). | Build B1-B9 and B11; exclude Tinker | Agreed scope; establish the working product before optional fine-tuning | No fine-tuned planner is claimed | | Start on `b/workstream-b`; isolate parallel workers in `b/data-simgen`, `b/runbook-notify`, `b/web-dashboard` worktrees | Keep main untouched and concurrent writes separate | Lead integrates owned paths and validates before pushing | | Coding workers use `gpt-6-luna`, medium reasoning | User requested this model and lead/worker division | Lead specifies, reviews, tests and handles integration | -| Aun owns core, Settings, migrations, API, workflows, agent and router infrastructure | The shared build brief explicitly reserves those contracts | We write requests and use lazy imports; no replacement schemas | +| Aun owns core, Settings, migrations, API, workflows, agent and router infrastructure | The shared build brief explicitly reserves those contracts | Import merged core directly; no replacement schemas | | Build independent engines with plain data and explicit fixture modes | Core was initially absent; its merged contracts now bind public wrappers | Fixture success does not establish live integration | | Use core DNS/subscriber contracts for the corresponding observations | Core now carries subscriber IP/traffic and DNS-kind probes; ICMP remains separate | Never fabricate offending IPs or claim DNS diagnosis from ping alone | | Separate training, validation and final evaluation | Tuning thresholds on final tests inflates measured quality | Freeze thresholds before held-out scoring and report actual denominators | @@ -45,10 +45,10 @@ on implementation commit `d60ffac`. ## Current external gates -At the final integration refresh, upstream main still contains only README.md. Aun must publish -core/backend contracts. Database, tailnet, API keys, Sentry projects, Render and -domain access are not yet supplied. Their live checks remain pending until -verified; none are replaced with invented pass results. +Core, agent, fixes and collector are now merged. Database and TabPFN credentials +are configured locally for the bounded Gate 2 check. Embedding setup, retrieval +ingestion and hosting remain separate verification gates; fixture results do not +establish those integrations. ## Core integration and scope update @@ -59,8 +59,34 @@ models, preserve SecretStr and ModuleUnavailable, and never write forecasts from detect. DNS/subscriber observations and atomic simulator injection now use core. The embedding model setting is embeddinggemma. Customer messages stay text. -Current follow-up is Gate 2 only, in a small separate PR: prepare legitimate TRAIN +Current follow-up is Gate 2 only, on the same branch and PR #1: prepare legitimate TRAIN and VALIDATION contexts, inject sim rows, and call actual TabPFN through detect. A missing trained backend is an explicit unavailable result, not mock inference. See [security verification](docs/SECURITY_VERIFICATION.md) for the redacted public history/checkpoint audit and the current sandbox enforcement limitation. + +The lead wrote preparation and runner acceptance tests before implementation. +Startup uses a versioned JSON artifact rather than serialized provider objects, +so credentials and SDK state never enter the artifact. TRAIN supplies supervised +cause context and normal density context; three normal VALIDATION snapshots +provide a limited plumbing reference. TEST files are excluded. This does not +establish detector accuracy or a production threshold. Repeated detect calls +reuse the configured backend, and the worker remains responsible for persistence. + +The first credentialed setup exposed a real SDK assertion for constant training +metrics. Density fitting now excludes constant columns using normal TRAIN only; +it fails if no varying metric remains. Reference and live scores use the same +seeded feature order and CPU noise, with caller RNG state restored. Review also +found that rotated credentials or changed timeouts could reuse stale setup; +the cache now includes an internal configuration digest and rebuilds on changes. + +The credentialed Gate 2 run returned a valid cloud DetectionResult with four +five-point series and no forecast-table row change. Setup took 271.7 seconds and +detect took 114.8 seconds. It predicted uplink_down for uplink_congestion. These +results establish integration only; model quality and latency need separate work. +The [sanitized report](eval/results/gate2.md) records the measured result. + +Main advanced during verification with Aun's CHR PR #6. The same branch was +rebased again onto d70f76f and uv lock rerun. Main's four required root files +remain identical. The combined suite passes 220 offline tests with three live +tests deselected, including with unmocked Torch imports blocked. diff --git a/docs/CORE_INTEGRATION_VALIDATION.md b/docs/CORE_INTEGRATION_VALIDATION.md index 446a27c..d57e5fe 100644 --- a/docs/CORE_INTEGRATION_VALIDATION.md +++ b/docs/CORE_INTEGRATION_VALIDATION.md @@ -39,9 +39,9 @@ existing PR ready. A passing mock result cannot satisfy real Gate 2. ## Gate 2 only, after integration delivery -Use a small separate B branch/PR for any further corrections. Obtain existing -DATABASE_URL and TabPFN credentials from local process/Windows environment only; -never print them or read .env. Check schema existence without migrating. Use a +Keep updates on b/workstream-b and PR #1, per the user's latest instruction. +Runtime Settings may load the local ignored .env internally; the agent must never +open it or print credentials. Check schema existence without migrating. Use a dedicated simulated site; preserve home-lab live telemetry. Inject a scenario, load an as-of MetricsWindow plus strictly prior history, call public detect with actual TabPFN, and validate DetectionResult, real provider identity, finite score, diff --git a/docs/GATE2_VALIDATION.md b/docs/GATE2_VALIDATION.md new file mode 100644 index 0000000..ca2f836 --- /dev/null +++ b/docs/GATE2_VALIDATION.md @@ -0,0 +1,36 @@ +# Gate 2: lead acceptance cases before implementation + +PR #1 passed CI/GitGuardian and is ready at ce6a1b4. These updates stay on +b/workstream-b and PR #1, as requested, and focus on simulator injection and real +TabPFN detection. + +1. Prepare a data-only artifact from TRAIN and VALIDATION cases. Never open TEST + files at model startup/inference. Validate paths, split IDs, distinct seeds and + time ranges. Cause labels are supervised TRAIN targets, not metric columns. +2. Fit the cause classifier from TRAIN. Fit the anomaly estimator only on normal + TRAIN snapshots. Calibrate it with at least three normal VALIDATION scores. + Exclude lag/rolling columns from density features; preserve predictor schema. +3. Explicit startup configuration loads this artifact and caches a prepared real + provider. Repeated public detect calls reuse it; missing/corrupt setup is + ModuleUnavailable. Do not pickle SDK objects or save credentials. +4. The public three-argument detect returns actual core DetectionResult, with + cloud/local mode, canonical series keys, finite ordered quantiles at +1..5 + minutes, causal timestamps and no database writes. +5. Real smoke uses shared Settings internally, never prints credentials and never + runs migrations. Preserve home-lab. Prepare a bounded normal history for a + dedicated simulated site, inject a current scenario through public inject, + fetch source=sim past-only observations, and call public detect. +6. Bound preparation/inference calls and record exact series subset and timing. + A small normal reference/default threshold can establish plumbing only, not + production accuracy, target recall/false-alert rates or warm p95 latency. +7. Save only sanitized result fields/timing/provider identity to a report. Capture + vendor logs privately in memory and emit sanitized error classes/messages if + a call fails. Never substitute a fixture when a provider fails. +8. Reuse setup only while artifact, provider mode, token and timeout match. + Rotating a dummy token or changing timeout must rebuild the backend; identical + configuration must reuse it. Store no raw token in artifact or cache metadata. + +Lead tests for preparation leakage, setup reuse, actual engine/core mapping and +invalid artifacts are written before implementation delegation. The real smoke +is a separate credentialed check, not a CI unit test. Credentials stay in ignored +.env for application runtime; the agent never opens that file itself. diff --git a/docs/SECURITY_VERIFICATION.md b/docs/SECURITY_VERIFICATION.md index 788fe89..d088996 100644 --- a/docs/SECURITY_VERIFICATION.md +++ b/docs/SECURITY_VERIFICATION.md @@ -24,6 +24,12 @@ Lead verification, 2026-10-18. No credential values are recorded in this file. - Scan reports remain ignored under `.build-check/security`; only redacted findings/counts were displayed. Current provider keys were not compared or printed. - GitGuardian's PR result is checked again after pushing the rebased branch. +- A later upstream refresh increased the public checkpoint refs from 18 to 22 + and updated three existing refs. The repeated full-history/checkpoint scan + returned 3,039 generic-rule occurrences, all privately classified as dated + API feature flags; zero unclassified findings. No captured values were printed. + The Gate 2 staged-content scan found zero findings, and GitGuardian passed + before the final refresh onto Aun's newly merged CHR work. ## Codex deny-read profile diff --git a/docs/progress/core_detector.md b/docs/progress/core_detector.md index 6e371ce..05b389a 100644 --- a/docs/progress/core_detector.md +++ b/docs/progress/core_detector.md @@ -1,9 +1,11 @@ # Core detector integration progress -The detector now imports the merged core contracts directly. `DetectorUnavailable` is a `ModuleUnavailable` subtype, and `detect(site_id, window, history)` consumes core `MetricsWindow` inputs and returns `DetectionResult` with canonical forecast series, including DNS target names containing colons. Results stay in memory; detector code does not call the forecast database writer. +The detector imports the merged core contracts directly. `DetectorUnavailable` subclasses `ModuleUnavailable`; public `detect(site_id, window, history)` returns an actual `DetectionResult` and canonical `SeriesForecast` rows, including DNS keys with colons. Forecasts stay in memory; the detector does not write to the shared forecast table. -The public API has no labels for cause fitting and no normal validation scores for anomaly calibration. It does not infer either from expected evaluation labels or templates. Consequently, public real TabPFN inference raises a sanitized unavailable error until an approved training/reference source is connected. An explicitly injected fixture backend is mapped to `mode="mock"` and `model="fixture_persistence"` for offline contract tests. +Gate 2 startup now uses `prepare_detector(cases_dir, out)` to read only TRAIN and VALIDATION packs and create a versioned feature-only JSON artifact. It validates safe paths, split names, IDs, seeds, time bounds, labels, and numeric feature matrices. TRAIN labels are classifier targets; anomaly fitting uses varying raw normal TRAIN metrics (constant metrics are excluded since they cannot define a continuous density); only the first three normal VALIDATION snapshots are scored for the reference distribution. No TEST metadata or observations are loaded, and the artifact has no SDK object or credential. -Cloud credentials come from core `Settings`; `.env` loading is disabled at the detector boundary, and `SecretStr` is unwrapped only when constructing the cloud provider. Provider exceptions are reduced to their type by the engine. +`configure_detector(artifact, settings=None, backend_factory=None)` validates and fits a real cloud/local provider, then caches it for public detection. `detect()` reuses the backend across calls and rejects an unprepared real backend before making provider inference calls. Explicit fixture injection remains available to offline contract tests and stays labeled `mode="mock"`. The Gate 2 anomaly reference uses a fixed seeded feature ordering and CPU density noise; it restores the extension RNG reference and PyTorch CPU RNG state after each score. The fixed 0.7 cutoff and three-sample reference support integration plumbing only; they are not accuracy or production-threshold claims. -Offline verification: detector tests and lead-authored core contract tests pass (37 tests total), and `ruff check packages/detector` passes. Root `ruff check .` reports 19 findings in concurrently changed notify, runbook, and simgen files; it reports no detector findings. No real TabPFN call was made. +Offline verification: all 45 detector tests pass, including Gate 2 artifact/setup, core contract, unprepared-provider and credential/timeout cache cases. After rebasing onto main d70f76f (Aun's CHR PR #6), the full repository suite passes 220 tests with three live tests deselected, including when unmocked Torch imports are blocked. Ruff, uv lock and diff checks pass. + +The separate lead-run credentialed smoke returned a valid real TabPFN Cloud v3.5 DetectionResult, four forecast series with five points each, and unchanged forecast-table row counts (0 before/after). Setup took 271.7 seconds and detection 114.8 seconds. Predicted uplink_down differs from injected uplink_congestion: this is an integration pass, not an accuracy or latency pass. See eval/results/gate2.md. diff --git a/docs/progress/gate2_runner.md b/docs/progress/gate2_runner.md new file mode 100644 index 0000000..3e785ca --- /dev/null +++ b/docs/progress/gate2_runner.md @@ -0,0 +1,9 @@ +# Gate 2 runner progress + +Added `eval/gate2.py` as a separate credentialed smoke CLI. It prepares a detector artifact only when absent, configures the actual provider once, seeds bounded normal `source=sim` history without replacing existing Site topology or duplicate metric keys, and calls public simulator injection for a current 15-minute scenario. It refuses an overlapping label rather than editing it. The ignored `data/generated/gate2/state.json` records its own label ID; a later run resumes only that exact active DB label, never another scenario. Re-seeding is locked per site, skips metric keys already present, and skips any recorded SIM scenario interval so it cannot add healthy data over an active or historical injected event. + +`fetch_window(conn, site_id, start, end)` returns the actual core `MetricsWindow` from three site/source/time bounded queries. The runner separates strictly prior 60-minute history from a 30-minute current window, filters initial inference to the two documented probe targets and `ether1`, verifies actual cloud/local `DetectionResult` forecasts, and compares forecast-table row counts around detection. Reports include actual first/last metric times because a one-hour seed may contribute only 30 minutes to the strictly prior context window. + +Provider stdout/stderr stays in memory; report error chains redact known secret values, URI userinfo, bearer strings, and common token prefixes. It writes sanitized JSON plus Markdown. Offline fetch and state/resume tests pass. No provider or database calls were made during implementation. Lead owns the separate credentialed execution after the code is reviewed. + +Lead execution on 2026-10-18 passed the real-provider contract smoke. The report records four five-point cloud series, unchanged forecast rows, setup/detection timings, and the cause mismatch rather than claiming production quality. Existing live home-lab telemetry and topology were outside the runner's site scope; no migration was run. diff --git a/eval/decision.md b/eval/decision.md index 6686d9e..3adccc8 100644 --- a/eval/decision.md +++ b/eval/decision.md @@ -6,3 +6,10 @@ - `--mode mock` is an explicit fixture backend used to check data wiring and report generation. Its outputs are never described as TabPFN accuracy. `cloud` and `local` use actual provider adapter code and preserve unavailable/error statuses. - False alerts/site-day uses the union of scored normal detection-window exposure per site. Cause accuracy and event precision/recall include explicit denominators. Missing agent investigation, template validation, and CHR infrastructure are `unavailable`, never 0% or assumed passes. Per-case latency is recorded for completed detector runs; event delay is unavailable because each case is a single as-of snapshot. Injected investigator, parameter-validator, and CHR-check callbacks are measured only from actual returned records. - Supplemental DNS/subscriber/backhaul Parquet remains experimental and is not read by this evaluator. Core DNS RTT is not treated as DNS-resolution evidence, and aggregate counters do not identify a subscriber. + +## Gate 2 real-provider smoke + +- Keep the credentialed smoke in `eval/gate2.py`, separate from the mock evaluation CLI. It prepares only the detector's TRAIN/VALIDATION artifact and asks the public simulator and detector entry points to perform the real flow. +- Seed only bounded, missing, source=`sim` normal telemetry for `north-tower`. Existing Site topology is read and preserved; existing metric keys in the seed interval are skipped. The current injection interval is never replaced when the site overlap guard rejects it. +- Query core probe, interface and subscriber columns with site, source and inclusive time predicates. Keep history strictly before current-window start and subset smoke inference to two named probe targets plus primary `ether1`; report actual metric time bounds and exact subset, and make plumbing-only claims. +- Capture provider output in memory, redact known runtime secrets and credential patterns from failure chains, and write a sanitized JSON/Markdown result. Compare forecast row counts around public detect and fail if they change. No migrations, deletes or router calls belong in this runner. diff --git a/eval/flow.md b/eval/flow.md index feef0ac..279815a 100644 --- a/eval/flow.md +++ b/eval/flow.md @@ -5,3 +5,9 @@ For each case, the runner loads only the referenced probe and interface Parquet files, builds a feature snapshot through its aware UTC `as_of`, and uses TRAIN labels solely as cause targets. It runs validation first to derive the threshold using the union of scored normal detection windows per site, then calls the detector on test cases. Positive windows and training history do not increase the false-alert budget; the same exposure definition is used for reported false alerts/site-day. Results report detector provenance, available/unavailable counts, cause accuracy, event precision/recall with denominators, and elapsed time. The initial B9 runner cannot call Aun's `investigate()` because the core/agent interface is absent from this worktree. Optional injected investigator, parameter-validator, and CHR-check callbacks produce metrics only from actual returned records; without them the runner writes `template_accuracy`, `valid_params_rate`, and `chr_dry_run_pass_rate` as unavailable with reasons. Detection delay is unavailable from single snapshots. It does not infer parameters from labels, count a fake CHR pass, or turn a missing backend into a successful run. `eval/results/agent.md` is reserved for a real investigation integration and is not fabricated here. + +## Gate 2 credentialed smoke + +Run `.venv/Scripts/python.exe eval/gate2.py --cases eval/cases --artifact data/generated/gate2/training.json --out eval/results/gate2.json` only for the separately authorized credentialed Gate 2 check. It prepares the data-only TRAIN/VALIDATION artifact if absent, configures a real cloud/local backend once, preserves an existing `north-tower` Site, and seeds only missing bounded normal SIM rows before calling public `inject()` for 15 minutes. An existing overlapping scenario is an error and is never replaced. + +After one 12-second cadence wait, the runner fetches source=`sim` metrics from the last 30 minutes and strictly prior 60-minute context. The one-hour seed may supply only 30 minutes inside that past context; the report records actual first/last metric times for each stream. Initial inference is limited to probes `1.1.1.1` and `dns:1.1.1.1` and interface `ether1`. The helper `fetch_window(conn, site_id, start, end)` runs three bounded core-column queries and returns an actual `MetricsWindow`. Public `detect()` must return real cloud/local DetectionResult with five ordered future points per canonical series. Forecast row counts are compared before/after detect. Vendor stdout/stderr is held in memory; the output contains sanitized results and error chains only. JSON and a companion Markdown report are written to the requested path. This smoke measures plumbing only, not production accuracy or latency. diff --git a/eval/gate2.py b/eval/gate2.py new file mode 100644 index 0000000..8480e34 --- /dev/null +++ b/eval/gate2.py @@ -0,0 +1,696 @@ +"""Credentialed, bounded Gate 2 smoke runner. + +This command is intentionally not part of CI. It writes only sanitized summaries and uses +existing core tables; it never migrates, deletes, or changes router configuration. +""" + +from __future__ import annotations + +import argparse +import contextlib +import io +import json +import math +import re +import time +import traceback +from datetime import UTC, datetime, timedelta +from pathlib import Path +from typing import Any + +import pandas as pd +from netcortex_core import ( + IFACE_COLUMNS, + PROBE_COLUMNS, + SUBSCRIBER_COLUMNS, + DetectionResult, + MetricsWindow, + ModuleUnavailable, + SubscriberMetric, + parse_series_key, +) +from netcortex_core import db as core_db +from netcortex_core.settings import Settings + +ROOT = Path(__file__).resolve().parents[1] +SITE_ID = "north-tower" +SEED = 20261018 +CADENCE_SECONDS = 12 +CURRENT_MINUTES = 30 +HISTORY_MINUTES = 60 +PROBE_TARGETS = ("1.1.1.1", "dns:1.1.1.1") +PRIMARY_IFACE = "ether1" + +_URI_USERINFO = re.compile(r"(?i)(\b[a-z][a-z0-9+.-]*://)[^/@\s]+@") +_BEARER = re.compile(r"(?i)\bBearer\s+[A-Za-z0-9._~+/=-]+") +_TOKEN = re.compile( + r"(?i)\b(?:sk|pk|hf|tabpfn)[_-][A-Za-z0-9_-]{8,}|" + r"\b(?:api[_-]?key|access[_-]?token|token|secret|password)\s*[:=]\s*" + r"(?:['\"]?)[^\s,;:'\"]+" +) + + +def fetch_window(conn: Any, site_id: str, start: datetime, end: datetime) -> MetricsWindow: + """Fetch one site's source=sim metrics inside inclusive UTC bounds.""" + start, end = _utc(start), _utc(end) + if start > end: + raise ValueError("start must be at or before end") + queries = ( + ( + "SELECT time, site_id, target, kind, rtt_ms, jitter_ms, loss_pct, source " + "FROM probe_metrics WHERE site_id = %s AND source = 'sim' " + "AND time >= %s AND time <= %s ORDER BY time", + PROBE_COLUMNS, + ), + ( + "SELECT time, site_id, iface, rx_bps, tx_bps, util_pct, drops, errors, source " + "FROM iface_metrics WHERE site_id = %s AND source = 'sim' " + "AND time >= %s AND time <= %s ORDER BY time", + IFACE_COLUMNS, + ), + ( + "SELECT time, site_id, ip, rx_bps, tx_bps, source FROM subscriber_metrics " + "WHERE site_id = %s AND source = 'sim' AND time >= %s AND time <= %s ORDER BY time", + SUBSCRIBER_COLUMNS, + ), + ) + frames = [] + for sql, columns in queries: + with conn.cursor() as cursor: + cursor.execute(sql, (site_id, start, end)) + frames.append(pd.DataFrame(cursor.fetchall(), columns=list(columns))) + return MetricsWindow( + as_of=end, + probe_metrics=frames[0], + iface_metrics=frames[1], + subscriber_metrics=frames[2], + ) + + +def _utc(value: datetime) -> datetime: + if value.tzinfo is None: + raise ValueError("Gate 2 timestamps must be timezone-aware") + return value.astimezone(UTC) + + +def _stage(name: str) -> None: + print(f"Gate 2: {name}", flush=True) + + +def _row_time(value: Any) -> datetime: + return pd.Timestamp(value).to_pydatetime() + + +def _seed_normal_history(conn: Any, *, site_id: str, now: datetime, seed: int) -> dict[str, int]: + """Add missing normal samples for one bounded prior hour, without replacing Site rows.""" + from netcortex_core import IfaceMetric, ProbeMetric + from netcortex_simgen.simulator import generate, generate_subscribers, site_from_fixture + + start = now - timedelta(minutes=HISTORY_MINUTES) + end = now - timedelta(seconds=10) + with conn.cursor() as cursor: + cursor.execute("SELECT pg_advisory_xact_lock(hashtextextended(%s, 0))", (site_id,)) + if core_db.fetch_site(conn, site_id) is None: + core_db.upsert_site(conn, site_from_fixture(site_id)) + + probes, interfaces, labels = generate( + days=1, + hours=1, + start=start, + seed=seed, + site_id=site_id, + normal_only=True, + ) + probes = probes[(probes.time >= start) & (probes.time <= end)] + interfaces = interfaces[(interfaces.time >= start) & (interfaces.time <= end)] + subscribers = generate_subscribers(labels, start=start, end=now, seed=seed, site_ids=[site_id]) + + with conn.cursor() as cursor: + cursor.execute( + "SELECT start_at, end_at FROM scenario_labels WHERE site_id = %s " + "AND source = 'sim' AND start_at < %s " + "AND COALESCE(end_at, 'infinity') > %s", + (site_id, end, start), + ) + scenario_intervals = [ + (_row_time(label_start), _row_time(label_end) if label_end else None) + for label_start, label_end in cursor.fetchall() + ] + cursor.execute( + "SELECT time, target FROM probe_metrics WHERE site_id = %s AND source = 'sim' " + "AND time >= %s AND time <= %s", + (site_id, start, end), + ) + existing_probes = {(_row_time(at), str(target)) for at, target in cursor.fetchall()} + cursor.execute( + "SELECT time, iface FROM iface_metrics WHERE site_id = %s AND source = 'sim' " + "AND time >= %s AND time <= %s", + (site_id, start, end), + ) + existing_interfaces = {(_row_time(at), str(iface)) for at, iface in cursor.fetchall()} + cursor.execute( + "SELECT time, ip FROM subscriber_metrics WHERE site_id = %s AND source = 'sim' " + "AND time >= %s AND time <= %s", + (site_id, start, end), + ) + existing_subscribers = {(_row_time(at), str(ip)) for at, ip in cursor.fetchall()} + + def outside_scenario(value: Any) -> bool: + at = _row_time(value) + return not any( + at >= left and (right is None or at < right) for left, right in scenario_intervals + ) + + new_probes = [ + ProbeMetric.model_validate(row) + for row in probes.to_dict("records") + if outside_scenario(row["time"]) + and (_row_time(row["time"]), str(row["target"])) not in existing_probes + ] + new_interfaces = [ + IfaceMetric.model_validate(row) + for row in interfaces.to_dict("records") + if outside_scenario(row["time"]) + and (_row_time(row["time"]), str(row["iface"])) not in existing_interfaces + ] + new_subscribers = [ + SubscriberMetric.model_validate(row) + for row in subscribers.to_dict("records") + if outside_scenario(row["time"]) + and (_row_time(row["time"]), str(row["ip"])) not in existing_subscribers + ] + core_db.insert_probe_metrics(conn, new_probes) + core_db.insert_iface_metrics(conn, new_interfaces) + core_db.insert_subscriber_metrics(conn, new_subscribers) + return { + "requested_start": start.isoformat(), + "requested_end": end.isoformat(), + "probe_rows_added": len(new_probes), + "iface_rows_added": len(new_interfaces), + "subscriber_rows_added": len(new_subscribers), + } + + +def _load_state(path: Path) -> dict[str, Any]: + if not path.exists(): + return {"version": 1, "scenarios": {}} + try: + state = json.loads(path.read_text(encoding="utf-8")) + except (OSError, ValueError) as exc: + raise ModuleUnavailable("Gate 2 resume state is unreadable") from exc + if ( + not isinstance(state, dict) + or state.get("version") != 1 + or not isinstance(state.get("scenarios"), dict) + ): + raise ModuleUnavailable("Gate 2 resume state has an unsupported format") + return state + + +def _resume_active_label( + conn: Any, state: dict[str, Any], *, site_id: str, seed: int, now: datetime +) -> Any | None: + """Resume only this runner's exact active SIM label confirmed by the database.""" + from netcortex_core import ScenarioLabel + + item = state["scenarios"].get(site_id) + if not isinstance(item, dict) or item.get("seed") != seed: + return None + try: + label_id = str(item["id"]) + expected_start = _utc(datetime.fromisoformat(item["start_at"])) + expected_end = _utc(datetime.fromisoformat(item["end_at"])) + except (KeyError, TypeError, ValueError) as exc: + raise ModuleUnavailable("Gate 2 resume state entry is invalid") from exc + now = _utc(now) + if not expected_start <= now < expected_end: + return None + columns = ( + "id", + "site_id", + "scenario_type", + "start_at", + "end_at", + "affected", + "expected_cause", + "expected_template", + "expected_params", + "seed", + "source", + ) + with conn.cursor() as cursor: + cursor.execute( + "SELECT id, site_id, scenario_type, start_at, end_at, affected, expected_cause, " + "expected_template, expected_params, seed, source FROM scenario_labels " + "WHERE id = %s AND site_id = %s AND source = 'sim'", + (label_id, site_id), + ) + row = cursor.fetchone() + if row is None: + return None + data = dict(zip(columns, row, strict=True)) + if ( + str(data["id"]) != label_id + or _utc(data["start_at"]) != expected_start + or _utc(data["end_at"]) != expected_end + or data["seed"] != seed + or str(data["scenario_type"]) != "uplink_congestion" + ): + raise ModuleUnavailable("Gate 2 resume state does not match its stored scenario label") + return ScenarioLabel.model_validate(data) + + +def _save_state(path: Path, state: dict[str, Any], label: Any) -> None: + state.setdefault("scenarios", {})[label.site_id] = { + "id": str(label.id), + "site_id": label.site_id, + "scenario_type": label.scenario_type.value, + "start_at": label.start_at.isoformat(), + "end_at": label.end_at.isoformat(), + "seed": label.seed, + "source": label.source.value, + } + path.parent.mkdir(parents=True, exist_ok=True) + temporary = path.with_suffix(path.suffix + ".tmp") + temporary.write_text(json.dumps(state, indent=2) + "\n", encoding="utf-8") + temporary.replace(path) + + +def _subset(window: MetricsWindow) -> MetricsWindow: + probes = window.probe_metrics[window.probe_metrics.target.isin(PROBE_TARGETS)].copy() + interfaces = window.iface_metrics[window.iface_metrics.iface.eq(PRIMARY_IFACE)].copy() + return MetricsWindow( + as_of=window.as_of, + probe_metrics=probes, + iface_metrics=interfaces, + subscriber_metrics=window.subscriber_metrics.copy(), + ) + + +def _window_metrics(window: MetricsWindow) -> dict[str, Any]: + def bounds(frame: pd.DataFrame) -> dict[str, str | None]: + if frame.empty: + return {"first": None, "last": None} + times = pd.to_datetime(frame.time, utc=True) + return {"first": times.min().isoformat(), "last": times.max().isoformat()} + + return { + "probe": len(window.probe_metrics), + "probe_time_range": bounds(window.probe_metrics), + "iface": len(window.iface_metrics), + "iface_time_range": bounds(window.iface_metrics), + "subscriber": len(window.subscriber_metrics), + "subscriber_time_range": bounds(window.subscriber_metrics), + } + + +def _forecast_count(conn: Any, site_id: str) -> int: + with conn.cursor() as cursor: + cursor.execute("SELECT count(*) FROM forecasts WHERE site_id = %s", (site_id,)) + row = cursor.fetchone() + if not row: + raise RuntimeError("forecast count query returned no row") + return int(row[0]) + + +def _secret_values(settings: Settings) -> list[str]: + values = [] + for secret in (settings.database_url, settings.tabpfn_token): + if secret is not None: + value = secret.get_secret_value() + if value: + values.append(value) + return values + + +def _sanitize(text: Any, secrets: list[str]) -> str: + value = str(text) + for secret in sorted(secrets, key=len, reverse=True): + value = value.replace(secret, "[REDACTED]") + value = _URI_USERINFO.sub(r"\1[REDACTED]@", value) + value = _BEARER.sub("Bearer [REDACTED]", value) + value = _TOKEN.sub("[REDACTED]", value) + value = re.sub(r"[\r\n\t]+", " ", value) + return value[:400] + + +def _safe_error(exc: BaseException, secrets: list[str]) -> list[str]: + chain = [] + seen: set[int] = set() + current: BaseException | None = exc + while current is not None and id(current) not in seen and len(chain) < 8: + seen.add(id(current)) + message = _sanitize(str(current), secrets) + chain.append(f"{type(current).__name__}: {message}" if message else type(current).__name__) + current = current.__cause__ or current.__context__ + return chain + + +def _safe_frames(exc: BaseException) -> list[dict[str, Any]]: + """Report code locations only, without source lines, locals or exception values.""" + frames = [] + seen: set[int] = set() + current: BaseException | None = exc + while current is not None and id(current) not in seen and len(seen) < 8: + seen.add(id(current)) + for frame in traceback.extract_tb(current.__traceback__): + frames.append( + {"file": Path(frame.filename).name, "line": frame.lineno, "function": frame.name} + ) + current = current.__cause__ or current.__context__ + return frames + + +def _validate_result( + result: DetectionResult, + *, + settings: Settings, + as_of: datetime, + expected_model: str, +) -> None: + if not isinstance(result, DetectionResult): + raise ValueError("detect did not return a core DetectionResult") + if result.mode != settings.tabpfn_mode or result.mode not in {"cloud", "local"}: + raise ValueError("detect did not report the configured real provider mode") + if ( + not result.model + or result.model != expected_model + or result.model.startswith("fixture:") + or "fixture" in result.model + ): + raise ValueError("detect reported fixture model provenance") + if not math.isfinite(result.score): + raise ValueError("DetectionResult score is not finite") + origin = pd.Timestamp(as_of).floor("min") + if not result.series: + raise ValueError("DetectionResult contains no forecast series") + for series in result.series: + try: + kind, name, metric = parse_series_key(series.series_key) + except (ValueError, TypeError) as exc: + raise ValueError("DetectionResult contains a noncanonical series key") from exc + if kind not in {"probe", "iface", "subscriber"} or not name or not metric: + raise ValueError("DetectionResult contains a noncanonical series key") + if len(series.points) != 5: + raise ValueError("DetectionResult forecast does not contain five horizons") + for horizon, point in enumerate(series.points, start=1): + at = pd.Timestamp(point.time) + if at.tzinfo is None or at.tz_convert("UTC") != origin + pd.Timedelta(minutes=horizon): + raise ValueError( + "DetectionResult forecast timestamps are not ordered +1..+5 minutes" + ) + if not math.isfinite(point.p10 + point.p50 + point.p90): + raise ValueError("DetectionResult forecast contains nonfinite quantiles") + if not point.p10 <= point.p50 <= point.p90: + raise ValueError("DetectionResult forecast quantiles are unordered") + + +def run_gate2( + *, + cases: Path, + artifact: Path, + out: Path, + site_id: str = SITE_ID, + seed: int = SEED, + wait_seconds: int = CADENCE_SECONDS, +) -> dict[str, Any]: + """Run one bounded real provider smoke and write a sanitized JSON/Markdown report.""" + from netcortex_detector.engine import detect + from netcortex_detector.preparation import configure_detector, prepare_detector + from netcortex_simgen.simulator import inject + + settings = Settings(http_timeout_s=30.0) + secrets = _secret_values(settings) + artifact = Path(artifact) + cases = Path(cases) + out = Path(out) + state_path = artifact.parent / "state.json" + report: dict[str, Any] = { + "gate": "Gate 2 bounded real-provider plumbing smoke", + "status": "failed", + "site_id": site_id, + "provider_mode": settings.tabpfn_mode, + "started_at": datetime.now(UTC).isoformat(), + "scope": { + "site_id": site_id, + "probe_targets": list(PROBE_TARGETS), + "interface": PRIMARY_IFACE, + "current_minutes": CURRENT_MINUTES, + "history_minutes": HISTORY_MINUTES, + "wait_seconds": wait_seconds, + "claims": "plumbing only; no production accuracy or latency claim", + }, + "timings_seconds": {}, + } + stdout_capture, stderr_capture = io.StringIO(), io.StringIO() + start_total = time.perf_counter() + try: + _stage("preparing context") + state = _load_state(state_path) + if not artifact.exists(): + t = time.perf_counter() + prepare_detector(cases, artifact) + report["timings_seconds"]["prepare_artifact"] = time.perf_counter() - t + t = time.perf_counter() + _stage("configuring real provider") + with contextlib.redirect_stdout(stdout_capture), contextlib.redirect_stderr(stderr_capture): + backend = configure_detector(artifact, settings=settings) + report["timings_seconds"]["provider_setup"] = time.perf_counter() - t + report["model_identity"] = _sanitize(getattr(backend, "provenance", "unknown"), secrets) + if settings.tabpfn_mode not in {"cloud", "local"}: + raise ModuleUnavailable("Gate 2 requires cloud or local provider mode") + if str(getattr(backend, "provenance", "")).startswith("fixture:"): + raise ModuleUnavailable("Gate 2 requires a real cloud or local provider") + + with contextlib.redirect_stdout(stdout_capture), contextlib.redirect_stderr(stderr_capture): + pool = core_db.get_pool(settings) + injected_at = datetime.now(UTC) + _stage("seeding sim history") + with pool.connection() as conn, conn.transaction(): + label = _resume_active_label(conn, state, site_id=site_id, seed=seed, now=injected_at) + history_anchor = label.start_at if label is not None else injected_at + report["history_seed"] = _seed_normal_history( + conn, site_id=site_id, now=history_anchor, seed=seed + ) + _stage("injecting or resuming scenario") + if label is None: + t = time.perf_counter() + label = inject(site_id, "uplink_congestion", 15, seed, now=injected_at) + report["timings_seconds"]["injection"] = time.perf_counter() - t + _save_state(state_path, state, label) + report["injection_action"] = "created" + else: + report["injection_action"] = "resumed existing active label" + report["label_id"] = str(label.id) + report["injected_cause"] = label.expected_cause.value + time.sleep(max(0, min(wait_seconds, 30))) + as_of = datetime.now(UTC) + current_start = as_of - timedelta(minutes=CURRENT_MINUTES) + history_end = current_start - timedelta(microseconds=1) + history_start = history_end - timedelta(minutes=HISTORY_MINUTES) + with pool.connection() as conn: + forecast_before = _forecast_count(conn, site_id) + history_all = fetch_window(conn, site_id, history_start, history_end) + current_all = fetch_window(conn, site_id, current_start, as_of) + history, current = _subset(history_all), _subset(current_all) + report["as_of"] = as_of.isoformat() + report["metrics"] = { + "history": _window_metrics(history), + "current": _window_metrics(current), + } + if not history.probe_metrics.size or not history.iface_metrics.size: + raise ModuleUnavailable( + "bounded source=sim history lacks selected probe or interface rows" + ) + if not current.probe_metrics.size or not current.iface_metrics.size: + raise ModuleUnavailable( + "bounded source=sim current window lacks selected probe or interface rows" + ) + t = time.perf_counter() + _stage("detecting") + detect_error = None + try: + with ( + contextlib.redirect_stdout(stdout_capture), + contextlib.redirect_stderr(stderr_capture), + ): + result = detect(site_id, current, history) + except BaseException as exc: + detect_error = exc + report["timings_seconds"]["detect"] = time.perf_counter() - t + with pool.connection() as conn: + forecast_after = _forecast_count(conn, site_id) + report["forecast_rows_before"] = forecast_before + report["forecast_rows_after"] = forecast_after + report["forecast_rows_changed"] = forecast_after != forecast_before + if forecast_after != forecast_before: + raise RuntimeError("public detect changed forecast row count") + if detect_error is not None: + raise detect_error + _validate_result( + result, + settings=settings, + as_of=as_of, + expected_model=str(getattr(backend, "provenance", "")), + ) + report["result"] = { + "is_anomaly": result.is_anomaly, + "score": float(result.score), + "cause": result.cause_guess.value, + "cause_confidence": float(result.cause_confidence), + "cause_matches_injection": result.cause_guess == label.expected_cause, + "model": _sanitize(result.model, secrets), + "mode": result.mode, + "series": [ + { + "series_key": series.series_key, + "points": len(series.points), + "first_time": series.points[0].time.isoformat(), + "last_time": series.points[-1].time.isoformat(), + } + for series in result.series + ], + } + report["status"] = "passed" + except BaseException as exc: + report["error_chain"] = _safe_error(exc, secrets) + report["error_locations"] = _safe_frames(exc) + report["status"] = "failed" + finally: + report["timings_seconds"]["total"] = time.perf_counter() - start_total + report["vendor_log_summary"] = { + "stdout_lines_captured": len(stdout_capture.getvalue().splitlines()), + "stderr_lines_captured": len(stderr_capture.getvalue().splitlines()), + "contents": "captured in memory and discarded after redaction boundary", + } + report["finished_at"] = datetime.now(UTC).isoformat() + _write_report(report, out, secrets) + return report + + +def _write_report(report: dict[str, Any], out: Path, secrets: list[str]) -> None: + out.parent.mkdir(parents=True, exist_ok=True) + safe_report = _sanitize_tree(report, secrets) + out.write_text(json.dumps(safe_report, indent=2, allow_nan=False) + "\n", encoding="utf-8") + result = safe_report.get("result", {}) + markdown = [ + "# Gate 2 bounded provider smoke", + "", + f"- Status: {safe_report['status']}", + f"- Site: {safe_report.get('site_id', 'unknown')}", + f"- Provider mode: {safe_report.get('provider_mode', 'unknown')}", + f"- Model: {safe_report.get('model_identity', 'not configured')}", + f"- As of: {safe_report.get('as_of', 'not reached')}", + f"- Label ID: {safe_report.get('label_id', 'not created')}", + f"- Injected cause: {safe_report.get('injected_cause', 'not created')}", + f"- Predicted cause: {result.get('cause', 'unavailable')} " + f"(confidence {result.get('cause_confidence', 'unavailable')})", + f"- Cause matches injection: {result.get('cause_matches_injection', 'unavailable')}", + f"- Anomaly: {result.get('is_anomaly', 'unavailable')}; " + f"score: {result.get('score', 'unavailable')}", + f"- Forecast rows before/after: {safe_report.get('forecast_rows_before', 'unknown')} / " + f"{safe_report.get('forecast_rows_after', 'unknown')}", + "", + "This bounded smoke establishes plumbing only; it is not an accuracy, target recall, " + "false-alert, or warm-latency evaluation.", + "", + "| Stage | Seconds |", + "| --- | ---: |", + ] + for stage, seconds in safe_report.get("timings_seconds", {}).items(): + markdown.append(f"| {stage} | {seconds:.3f} |") + markdown.extend( + [ + "", + "| Window | Probe rows | Interface rows | Subscriber rows |", + "| --- | ---: | ---: | ---: |", + ] + ) + for window, metrics in safe_report.get("metrics", {}).items(): + markdown.append( + f"| {window} | {metrics['probe']} | {metrics['iface']} | {metrics['subscriber']} |" + ) + markdown.extend( + ["", "| Series | Points | First target | Last target |", "| --- | ---: | --- | --- |"] + ) + for series in result.get("series", []): + markdown.append( + f"| {series['series_key']} | {series['points']} | " + f"{series['first_time']} | {series['last_time']} |" + ) + scope = safe_report.get("scope", {}) + if scope: + markdown.extend( + [ + "", + f"Selected probes: {', '.join(scope['probe_targets'])}; " + f"interface: {scope['interface']}.", + "Only past source=sim observations enter detection. TRAIN supplies contexts;", + "three normal VALIDATION references and a fixed 0.7 threshold " + "are a limited smoke setup.", + "The runner uses no TEST cases, performs no migration, " + "and does not operate on home-lab.", + ] + ) + if safe_report.get("error_chain"): + markdown.extend( + [ + "", + "Sanitized failure chain:", + "", + *[f"- {line}" for line in safe_report["error_chain"]], + ] + ) + out.with_suffix(".md").write_text("\n".join(markdown) + "\n", encoding="utf-8") + + +def _sanitize_tree(value: Any, secrets: list[str]) -> Any: + if isinstance(value, dict): + return {str(key): _sanitize_tree(item, secrets) for key, item in value.items()} + if isinstance(value, list): + return [_sanitize_tree(item, secrets) for item in value] + if isinstance(value, str): + return _sanitize(value, secrets) + return value + + +def build_parser() -> argparse.ArgumentParser: + parser = argparse.ArgumentParser( + description="Run a bounded real-provider NetCortex Gate 2 smoke" + ) + parser.add_argument("--cases", type=Path, default=ROOT / "eval/cases") + parser.add_argument( + "--artifact", type=Path, default=ROOT / "data/generated/gate2/training.json" + ) + parser.add_argument("--out", type=Path, default=ROOT / "eval/results/gate2.json") + parser.add_argument("--site", default=SITE_ID) + parser.add_argument("--seed", type=int, default=SEED) + parser.add_argument("--wait-seconds", type=int, default=CADENCE_SECONDS) + return parser + + +def main(argv: list[str] | None = None) -> int: + args = build_parser().parse_args(argv) + try: + report = run_gate2( + cases=args.cases, + artifact=args.artifact, + out=args.out, + site_id=args.site, + seed=args.seed, + wait_seconds=args.wait_seconds, + ) + except BaseException as exc: + # Last-resort parser/path failures contain no provider or connection details. + report = { + "gate": "Gate 2 bounded real-provider plumbing smoke", + "status": "failed", + "error_chain": [f"{type(exc).__name__}: Gate 2 runner could not start"], + } + _write_report(report, args.out, []) + print(f"Gate 2 {report['status']}; sanitized report saved.") + return 0 if report["status"] == "passed" else 1 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/eval/results/gate2.md b/eval/results/gate2.md new file mode 100644 index 0000000..30a23ac --- /dev/null +++ b/eval/results/gate2.md @@ -0,0 +1,39 @@ +# Gate 2 bounded provider smoke + +- Status: passed +- Site: north-tower +- Provider mode: cloud +- Model: tabpfn-cloud:v3.5 +- As of: 2026-10-18T17:56:11.235227+00:00 +- Label ID: 938c8282-ae06-4d57-a8a0-c5941bdfa0d2 +- Injected cause: uplink_congestion +- Predicted cause: uplink_down (confidence 0.4366297423839569) +- Cause matches injection: False +- Anomaly: True; score: 1.0 +- Forecast rows before/after: 0 / 0 + +This bounded smoke establishes plumbing only; it is not an accuracy, target recall, false-alert, or warm-latency evaluation. + +| Stage | Seconds | +| --- | ---: | +| provider_setup | 271.689 | +| injection | 2.642 | +| detect | 114.776 | +| total | 409.199 | + +| Window | Probe rows | Interface rows | Subscriber rows | +| --- | ---: | ---: | ---: | +| history | 364 | 61 | 61 | +| current | 360 | 60 | 60 | + +| Series | Points | First target | Last target | +| --- | ---: | --- | --- | +| iface:ether1:util_pct | 5 | 2026-10-18T17:57:00+00:00 | 2026-10-18T18:01:00+00:00 | +| probe:1.1.1.1:loss_pct | 5 | 2026-10-18T17:57:00+00:00 | 2026-10-18T18:01:00+00:00 | +| probe:1.1.1.1:rtt_ms | 5 | 2026-10-18T17:57:00+00:00 | 2026-10-18T18:01:00+00:00 | +| probe:dns:1.1.1.1:rtt_ms | 5 | 2026-10-18T17:57:00+00:00 | 2026-10-18T18:01:00+00:00 | + +Selected probes: 1.1.1.1, dns:1.1.1.1; interface: ether1. +Only past source=sim observations enter detection. TRAIN supplies contexts; +three normal VALIDATION references and a fixed 0.7 threshold are a limited smoke setup. +The runner uses no TEST cases, performs no migration, and does not operate on home-lab. diff --git a/flow.md b/flow.md index d9da916..bec52ce 100644 --- a/flow.md +++ b/flow.md @@ -39,7 +39,7 @@ flowchart TD | `simgen calibrate` | real baseline rows, optional exact target-role map and explicit proxy opt-in | Group statistics by target and Pakistan hour; restrict proxy transfer to public DNS ping roles | Calibration/report with coverage, defaults, source targets and transfer uncertainty | | `simgen generate` | days, seed, scenario configuration | Seeded demand/noise and incident transforms | Probe/interface Parquet plus separate expected labels | | `simgen replay` / `inject` | site, cause, duration, seed | Active simulator runtime; DB writes need Aun's keys/runtime agreement | Current metrics and scenario label; explicit missing-runtime/contract failure | -| `detect(site_id, window, history)` | observed shared MetricsWindow | Lag features -> TabPFN forecasts/anomaly/cause | Shared DetectionResult and approved forecast writes, or unavailable error | +| `detect(site_id, window, history)` | observed shared MetricsWindow | Lag features -> prepared TabPFN forecasts/anomaly/cause | Shared DetectionResult, or unavailable error; worker owns forecast writes | | `search_runbook(query, k)` | question and result count | Ollama query embedding -> pgvector retrieval | Shared RunbookChunk objects with source URLs | | `check_news(provider, target)` | upstream provider/target | Recent SerpApi search | Shared NewsCheck with links; explicit unavailable summary on failure | | Dashboard navigation | site/incident selection | Fixture transport or Aun's HTTP API | Rendered status/evidence, loading state or visible error | @@ -85,3 +85,12 @@ no forecast writes; MonitorSiteWorkflow owns persistence. Core exposes fetch_sit The detector needs an explicitly prepared real TabPFN context for cloud/local inference. Gate 2 will prepare it from TRAIN and normal VALIDATION observations, without reading TEST labels at inference. Provider failures remain unavailable. + +Gate 2 entry is `python eval/gate2.py`. It calls `prepare_detector(cases, artifact)` +for TRAIN/VALIDATION JSON and Parquet, then `configure_detector(artifact)` to fit +and cache the real provider. The runner seeds bounded simulated history for +north-tower, calls public simgen inject, and fetches only past source=sim rows +through core's database pool. Public detect returns a core DetectionResult; +the runner validates provenance, quantiles and horizons and compares forecast +row counts. Exit is a sanitized JSON/Markdown report with measured timing and +an explicit pass or failure. No migrations or live-router operations occur. diff --git a/packages/detector/README.md b/packages/detector/README.md index 41337c3..d9f9162 100644 --- a/packages/detector/README.md +++ b/packages/detector/README.md @@ -1,6 +1,26 @@ # netcortex-detector -Past-only feature construction and TabPFN 3.5 adapters for network metrics. `run_engine()` accepts probe and interface DataFrames, aware UTC `as_of`, site, an injected backend, and optional explicit training inputs. `detect(site_id, window, history)` consumes actual core `MetricsWindow` objects and returns core `DetectionResult` with grouped forecast series. The public API receives no labeled TRAIN data or calibrated normal VALIDATION reference, so actual TabPFN cause/anomaly inference fails explicitly until that data contract is supplied; it never substitutes fixtures. Explicit fixture provenance is labeled `mode="mock"`. The detector returns forecasts in memory and performs no database writes. +Past-only feature construction and TabPFN 3.5 adapters for network metrics. `run_engine()` accepts probe and interface DataFrames, aware UTC `as_of`, site, an injected backend, and optional explicit training inputs. `detect(site_id, window, history)` consumes actual core `MetricsWindow` objects and returns core `DetectionResult` with grouped forecast series. Explicit fixture provenance is labeled `mode="mock"`; detector forecasts remain in memory and are never written to the database. + +For Gate 2 runtime setup, `prepare_detector(cases_dir, artifact_path)` writes a versioned data-only JSON artifact from TRAIN cases and normal VALIDATION snapshots. It only opens `train/` and `validation/`; it validates split names, paths, unique IDs/seeds, disjoint time ranges, labels, and feature matrices. The artifact contains TRAIN labels as classifier targets, normal TRAIN features, and at most three normal VALIDATION feature rows. It contains no TEST content, SDK model object, or credential. `configure_detector(artifact_path)` fits the classifier and normal-only anomaly model (excluding constant raw metrics from the density fit), calibrates its reference, and caches the configured cloud/local backend for subsequent public `detect()` calls. It raises `ModuleUnavailable` if setup or provider initialization fails and never falls back to fixtures. The cache identity includes a one-way fingerprint of the configured token and timeout; call `configure_detector()` again after either setting changes to rebuild the backend. `clear_prepared_detector()` clears the process cache. + +The prepared anomaly cutoff is fixed at `0.7` for Gate 2 plumbing; this small normal reference and cutoff do not establish model accuracy or production operating thresholds. Preparation can be run without model credentials. Provider setup/inference needs the selected cloud/local dependencies and credentials described below. + +```python +from pathlib import Path +from netcortex_detector import configure_detector, prepare_detector + +artifact = prepare_detector(Path("eval/cases"), Path("artifacts/detector-training.json")) +configure_detector(artifact) +# Application startup can now call netcortex_detector.detect(site_id, window, history). +``` + +The lead's [credentialed Gate 2 report](../../eval/results/gate2.md) records a real +TabPFN Cloud v3.5 result after public simulator injection. Four series with five +future points each validated; forecast-table rows stayed unchanged. Setup took +271.7 seconds and detection 114.8 seconds. The predicted cause was `uplink_down` +for an `uplink_congestion` injection, so this establishes the API path only; +cause accuracy and performance remain unfinished. Base installation keeps the heavy inference stack optional: @@ -9,7 +29,7 @@ python -m uv run --no-project --with-editable packages/detector --with pytest py python -m uv run --no-project --with-editable packages/detector --with ruff ruff check packages/detector eval/run.py ``` -For live inference install the optional `cloud` extra (tabpfn-client >=0.6.1, tabpfn >=9.2.0, tabpfn-extensions >=0.6.3, torch >=2.14.1) and provide `TABPFN_TOKEN` (or `TABPFN_API_KEY`), or install the `local` extra with compatible PyTorch/CUDA. Cloud calls use a 30-second client timeout. Cloud sends supplied telemetry to Prior Labs; check its current terms and commercial licensing before product use. Local checkpoint download may require Hugging Face access and acceptance of model terms. GTX 1660 6 GB compatibility has not been verified. No live credentials or successful external inference are claimed here. +For live inference install the optional `cloud` extra (tabpfn-client >=0.6.1, tabpfn >=9.2.0, tabpfn-extensions >=0.6.3, torch >=2.14.1) and provide `TABPFN_TOKEN` (or `TABPFN_API_KEY`), or install the `local` extra with compatible PyTorch/CUDA. Cloud calls use a 30-second client timeout. Cloud sends supplied telemetry to Prior Labs; check its current terms and commercial licensing before product use. Local checkpoint download may require Hugging Face access and acceptance of model terms. GTX 1660 6 GB compatibility has not been verified. The bounded credentialed run is recorded above; local GPU inference remains unverified. The evaluator supports `--mode mock`, `--mode cloud`, and `--mode local`. `mock` uses a deterministic persistence/heuristic backend only for exercising the pipeline; it does not represent TabPFN accuracy. Cloud/local modes fail visibly when dependencies, credentials, or model calls fail. Example after the simulator has generated its three splits: @@ -19,6 +39,6 @@ python -m uv run --no-project --with-editable "packages/detector[cloud]" --with python -m uv run --no-project --with-editable "packages/detector[local]" --with pyarrow python eval/run.py --mode local ``` -Expected labels are read only from case sidecars for training targets and scoring. They are not joined to feature rows. Validation labels select a cutoff by F1 subject to the false-alert budget; it is frozen before TEST scoring. The unsupervised model is fit on normal TRAIN observations and normalized against normal VALIDATION scores. Sustained evidence requires three consecutive observed values to exceed forecasts made before each value. DNS, subscriber, and supplemental backhaul observations are not accepted as core telemetry. Template parameter validity, Aun agent investigation, CHR results, and detection delay (single as-of snapshots provide no event trajectory) stay unavailable until real interfaces/data exist. +TRAIN cause labels are classifier targets and never become feature columns. Normal TRAIN snapshots fit the anomaly estimator after constant raw metrics are excluded from its continuous-density features; the first three normal VALIDATION snapshots provide its reference distribution. The Gate 2 setup uses a fixed 0.7 threshold and seeded feature ordering for density scores so reference and live calls use the same ordering; this is a plumbing configuration, not a performance claim. The evaluator separately uses VALIDATION labels for threshold selection before TEST scoring. Public detection consumes core probe and interface metrics; DNS-kind probes use those metrics directly, while the simulator's supplemental DNS-resolution sidecar is unused. Subscriber observations are outside its feature model. Forecast persistence belongs to the core worker; the detector returns forecasts in memory. Sustained evidence requires three consecutive observed values to exceed forecasts made before each value. See [decision.md](decision.md) and [flow.md](flow.md) for design choices and boundaries. diff --git a/packages/detector/decision.md b/packages/detector/decision.md index fa18c61..df67a1f 100644 --- a/packages/detector/decision.md +++ b/packages/detector/decision.md @@ -1,11 +1,12 @@ # Detector decisions - `run_engine()` remains independently testable with approved-shaped frames and an injected backend. Public `detect(site_id, window, history)` imports the actual core `MetricsWindow`, `DetectionResult`, `Cause`, forecast models, `Settings`, and `ModuleUnavailable`; `DetectorUnavailable` subclasses the shared error. It combines prior history with the current window, applies the window cutoff and site checks in the engine, and returns grouped core series without writing forecasts. -- Build one-minute snapshots from source rows at or before `as_of`, grouped by target role and interface role supplied as configuration. Without a role mapping, exact target/interface identifiers stay separate under `target:`/`interface:` feature names; the detector does not infer that a host is DNS or an interface is an uplink. Only RTT, jitter, loss, utilization, drops, and errors enter this feature path. Supplemental DNS resolution, subscriber traffic, and backhaul quality rows remain experimental. +- Build one-minute snapshots from source rows at or before `as_of`, grouped by target role and interface role supplied as configuration. Without a role mapping, exact target/interface identifiers stay separate under `target:`/`interface:` feature names; the detector does not infer that a host is DNS or an interface is an uplink. Only RTT, jitter, loss, utilization, drops, and errors enter this feature path. DNS-kind probes use these standard core metrics directly when present; the simulator's supplemental DNS-resolution sidecar is unused. Subscriber traffic and backhaul quality are outside this feature model. - Lags and rolling statistics shift by one minute; missing observations are never backfilled from the future. Rows for another site, invalid timestamps, and supplemental source rows are rejected. Probe and interface frames must each have a single, matching source when source metadata is supplied, preventing mixed live/simulator/RIPE measurements. Sparse history returns an explicit `insufficient_history` result with no cause. -- Cloud and local TabPFN adapters are lazy, optional integrations. They select TabPFN 3.5 and send explicit 0.1/0.5/0.9 regression quantiles. Cloud credentials come from an injected argument or `TABPFN_TOKEN`/`TABPFN_API_KEY`, are never logged, and client calls use a 30-second timeout. The local adapter uses `ModelVersion.V3_5`. The unsupervised extension is fit on normal TRAIN observations; its low log-likelihood is normalized by the empirical CDF of normal VALIDATION scores. Provider errors raise `DetectorUnavailable` and are never replaced by fixtures. -- Cause classifier fitting requires explicit aligned feature vectors and labels supplied by the caller. The evaluator builds those vectors from TRAIN case files only; validation labels select the threshold maximizing F1 under a false-alert budget computed from unioned normal detection-window exposure per site. Public `detect()` receives no labels, and neither expected labels nor template metadata are inferred from metrics. Gate 2 preparation will use the existing simulator TRAIN and normal VALIDATION packs to build detector-owned runtime training state; TEST remains evaluation-only. Fitted contexts use fingerprints; expanded forecast training is capped at 2,048 rows. +- Cloud and local TabPFN adapters are lazy, optional integrations. They select TabPFN 3.5 and send explicit 0.1/0.5/0.9 regression quantiles. Cloud credentials come from an injected argument or `TABPFN_TOKEN`/`TABPFN_API_KEY`, are never logged, and client calls use a 30-second timeout. The local adapter uses `ModelVersion.V3_5`. The unsupervised extension is fit on varying raw normal TRAIN metrics only; constant metrics are excluded because they cannot define a continuous density. Its low log-likelihood is normalized by the empirical CDF of normal VALIDATION scores. Its random feature permutation is seeded consistently for reference and live scores, with the extension's module RNG restored after each call. Provider errors raise `DetectorUnavailable` and are never replaced by fixtures. +- Cause classifier fitting uses aligned feature vectors and labels from TRAIN case sidecars only; expected template metadata is never a feature. Gate 2 preparation writes a versioned data-only artifact from TRAIN and normal VALIDATION snapshots only. TEST is not enumerated or opened during preparation/configuration. Public `detect()` receives no labels; `configure_detector()` fits and caches the classifier and anomaly model from the validated artifact. Its at-most-three normal VALIDATION scores and fixed 0.7 cutoff establish plumbing only, not an accuracy or production-threshold claim. Fitted contexts use fingerprints; expanded forecast training is capped at 2,048 rows. - Sustained forecast evidence is walk-forward: each of the last three contiguous minute observations is compared against a forecast made strictly earlier and targeting that exact minute. Forecast timestamps, horizon, finite quantiles, order, and physical bounds are validated. One excursion does not count as sustained. Missing, stale, or sparse input returns unavailable, not healthy. - FixtureBackend exists only to exercise the offline pipeline. Its deterministic persistence bands and simple rules are identified in every result as fixture provenance and cannot support a TabPFN performance claim. -- Forecast output is returned in memory with model provenance. Database writes are not enabled: forecast writer ownership, conflict keys, and retry semantics are still open in Aun's contract request. Cause/template parameter construction and CHR checks are outside this package until their real contracts are available. +- Forecast output is returned in memory with model provenance. The detector does not write forecast rows; persistence belongs to the core worker. Cause/template parameter construction and CHR checks are outside this package. - Explicit fixture provenance maps to core `mode="mock"` and `model="fixture_persistence"`; cloud and local provider identities retain their configured mode. Core `Settings()` supplies runtime configuration; SecretStr is unwrapped only when constructing the cloud provider. Tests instantiate Settings with `_env_file=None`. +- `prepare_detector(cases_dir, out)` reads only the `train/` and `validation/` packs, checks safe observation paths and split/seed/time boundaries, and writes feature data rather than SDK objects. `configure_detector(artifact, settings=None, backend_factory=None)` is explicit startup setup; missing/invalid artifacts and provider failures raise `ModuleUnavailable`, with no fixture substitution. The process cache is reusable across public detect calls and can be cleared explicitly. diff --git a/packages/detector/flow.md b/packages/detector/flow.md index d4c3d80..675d4da 100644 --- a/packages/detector/flow.md +++ b/packages/detector/flow.md @@ -4,12 +4,12 @@ `run_engine(probes, interfaces, *, site_id, as_of, backend, history_start=None, config=None, training_features=None, training_labels=None, anomaly_threshold=None)` is the independently testable inference API. It returns a plain dictionary with anomaly/cause/forecast/evidence fields, status, provenance, and a supplemental-use flag. Missing, stale, or sparse observations return `availability="unavailable"` and a null anomaly outcome. Invalid backend causes and provider failures are errors (`DetectorUnavailable`), not healthy results. The backend is injected; this function does not silently choose a mock. -`detect(site_id, window, history)` accepts actual core `MetricsWindow` objects. It combines their probe/interface rows, runs the current window through `as_of`, and calls the provider selected by shared `Settings()`. It maps in-memory forecasts to core `SeriesForecast`/`ForecastPoint` objects with canonical series keys, preserving DNS target colons; an unrecognized forecast metric fails explicitly instead of disappearing. Missing/stale measurements and provider failures raise `DetectorUnavailable`, a `ModuleUnavailable` subtype. It never writes forecast rows. The detector API does not accept labels or normal reference scores; Gate 2 preparation will provide detector-owned state from TRAIN and normal VALIDATION data without using TEST labels at inference. Fixture backend output is marked `mode="mock"` and `model="fixture_persistence"`. +`prepare_detector(cases_dir, out)` reads `train/*.json` and `validation/*.json` only, checks case split, safe probe/interface paths, unique case IDs/seeds, and non-overlapping aware time bounds, then writes a versioned JSON feature artifact. TRAIN labels are kept aligned as supervised targets; normal TRAIN snapshots and up to three normal VALIDATION snapshots are stored separately. It never lists or reads `test/`. `configure_detector(artifact, *, settings=None, backend_factory=None)` validates the artifact, fits the cause classifier from TRAIN, fits the anomaly estimator only on varying raw normal TRAIN metrics (constant columns are excluded), scores the normal VALIDATION references, and caches the real cloud/local backend plus a fixed 0.7 plumbing threshold. It returns the configured backend; provider/setup failures are sanitized `ModuleUnavailable` errors. `clear_prepared_detector()` resets the process cache. -`TabPFNBackend("cloud" | "local")` supplies real provider calls. Cloud uses `tabpfn_client`, `TABPFN_TOKEN`/`TABPFN_API_KEY` or an injected key, `set_access_token`, v3.5 factories, and a 30-second client timeout. Local uses TabPFN classifier/regressor and `ModelVersion.V3_5`. Regressors request `output_type="quantiles"` for quantiles `[0.1, 0.5, 0.9]`; the bands are sorted before reporting. The unsupervised extension is fit on normal TRAIN data; low log-likelihood is normalized against normal VALIDATION scores. Regressors use lag/calendar predictors and shifted targets; only raw RTT, loss, and utilization are forecast targets. Horizon-expanded fit rows are capped at 2,048 with deterministic per-horizon sampling. Quantile-first SDK responses are converted horizon-wise, and nonfinite, unordered, out-of-range, or invalid-time forecasts fail explicitly. Missing packages, key, model download, GPU/runtime support, and inference failures are explicit. No network request is made by the unit tests. +`detect(site_id, window, history)` accepts actual core `MetricsWindow` objects. It combines their probe/interface rows, runs the current window through `as_of`, and uses the explicitly prepared backend when configured. The prepared classifier reuses TRAIN labels, and anomaly scoring uses the cached normal reference. Without startup configuration it permits only an explicitly injected fixture backend for offline contract tests; a real provider is rejected before forecast or scoring calls. It maps in-memory forecasts to core `SeriesForecast`/`ForecastPoint` objects with canonical series keys, preserving DNS target colons; an unrecognized forecast metric fails explicitly instead of disappearing. Missing/stale measurements and provider failures raise `DetectorUnavailable`, a `ModuleUnavailable` subtype. It never writes forecast rows. Fixture backend output is marked `mode="mock"` and `model="fixture_persistence"`; startup preparation rejects fixture provenance. -`FixtureBackend` is an explicit offline fixture only. Its provenance is embedded in outputs. It supplies deterministic persistence bands and simple visible rules to verify evaluator wiring, not product inference. +`TabPFNBackend("cloud" | "local")` supplies real provider calls. Cloud uses `tabpfn_client`, `TABPFN_TOKEN`/`TABPFN_API_KEY` or an injected key, `set_access_token`, v3.5 factories, and a finite client timeout. Local uses TabPFN classifier/regressor and `ModelVersion.V3_5`. Regressors request `output_type="quantiles"` for quantiles `[0.1, 0.5, 0.9]`; the bands are sorted before reporting. The unsupervised extension is fit on normal TRAIN data; low log-likelihood is normalized against normal VALIDATION scores. Its extension-level random feature ordering is seeded identically for reference and live score calls, with the original RNG object restored afterward. Regressors use lag/calendar predictors and shifted targets; only raw RTT, loss, and utilization are forecast targets. Horizon-expanded fit rows are capped at 2,048 with deterministic per-horizon sampling. Quantile-first SDK responses are converted horizon-wise, and nonfinite, unordered, out-of-range, or invalid-time forecasts fail explicitly. Missing packages, key, model download, GPU/runtime support, and inference failures are explicit. No network request is made by the unit tests. -`python eval/run.py --mode mock|cloud|local [--cases eval/cases] [--out eval/results/detector.md] [--limit N]` consumes each split directory's JSON sidecars and Parquet probe/interface observations. It verifies split IDs, seeds, and event intervals do not overlap and observation paths cannot escape split directories. TRAIN sidecar causes are labels for classifier fitting only; VALIDATION calibrates the anomaly cutoff; TEST produces metrics. It records actual denominators and unavailable results. Aun's `investigate()`, template schema/parameter validation, and CHR check are reported unavailable until implemented and machine-readable. +`FixtureBackend` is an explicit offline fixture only. Its provenance is embedded in outputs. It supplies deterministic persistence bands and simple visible rules to verify evaluator wiring, not product inference. -The runner writes Markdown. `eval/results/agent.md` follows the same principle: agent, parameter, and router-check metrics remain unavailable unless those real APIs return recorded results; the runner does not make substitute claims. +`python eval/run.py --mode mock|cloud|local [--cases eval/cases] [--out eval/results/detector.md] [--limit N]` runs the offline evaluator over split sidecars and probe/interface Parquet observations. It validates split separation and safe observation paths; TRAIN causes are classifier targets, VALIDATION calibrates evaluation thresholds, and TEST is scored only after setup. It records actual denominators and unavailable results in Markdown. diff --git a/packages/detector/src/netcortex_detector/__init__.py b/packages/detector/src/netcortex_detector/__init__.py index 2708ee3..f847d08 100644 --- a/packages/detector/src/netcortex_detector/__init__.py +++ b/packages/detector/src/netcortex_detector/__init__.py @@ -7,6 +7,20 @@ detect, run_engine, ) +from netcortex_detector.preparation import ( + clear_prepared_detector, + configure_detector, + prepare_detector, +) -__all__ = ["DetectorConfig", "DetectorUnavailable", "build_features", "detect", "run_engine"] +__all__ = [ + "DetectorConfig", + "DetectorUnavailable", + "build_features", + "clear_prepared_detector", + "configure_detector", + "detect", + "prepare_detector", + "run_engine", +] __version__ = "0.1.0" diff --git a/packages/detector/src/netcortex_detector/engine.py b/packages/detector/src/netcortex_detector/engine.py index 630bdcf..8be5357 100644 --- a/packages/detector/src/netcortex_detector/engine.py +++ b/packages/detector/src/netcortex_detector/engine.py @@ -469,17 +469,26 @@ def detect(site_id: str, window: MetricsWindow, history: MetricsWindow) -> Detec # Prior history is context only. It supplies observations, never labels or expected causes. probes = _combine_observations(history.probe_metrics, window.probe_metrics) interfaces = _combine_observations(history.iface_metrics, window.iface_metrics) - target_roles = { - target: ("dns:" + target[4:] if target.startswith("dns:") else target) - for target in probes.get("target", pd.Series(dtype=str)).dropna().astype(str).unique() - } + target_roles = _identity_target_roles(probes) settings = Settings() - token = settings.tabpfn_token.get_secret_value() if settings.tabpfn_token else None from netcortex_detector import providers + from netcortex_detector.preparation import get_prepared_detector - backend = providers.TabPFNBackend( - settings.tabpfn_mode, access_token=token, timeout_s=settings.http_timeout_s - ) + prepared = get_prepared_detector() + if prepared is None: + token = settings.tabpfn_token.get_secret_value() if settings.tabpfn_token else None + backend = providers.TabPFNBackend( + settings.tabpfn_mode, access_token=token, timeout_s=settings.http_timeout_s + ) + if not str(getattr(backend, "provenance", "")).startswith("fixture:"): + raise DetectorUnavailable( + "public detect requires configure_detector() before real provider inference" + ) + threshold = None + else: + backend, threshold = prepared + if backend.mode != settings.tabpfn_mode: + raise DetectorUnavailable("prepared detector mode does not match current Settings") result = run_engine( probes, interfaces, @@ -487,6 +496,7 @@ def detect(site_id: str, window: MetricsWindow, history: MetricsWindow) -> Detec as_of=window.as_of, backend=backend, config=DetectorConfig(target_roles=target_roles), + anomaly_threshold=threshold, ) if result["availability"] != "available": raise DetectorUnavailable(f"detector data unavailable ({result['status']})") @@ -546,6 +556,14 @@ def _combine_observations(history: pd.DataFrame, current: pd.DataFrame) -> pd.Da return combined +def _identity_target_roles(probes: pd.DataFrame) -> dict[str, str]: + """Keep each observed target name intact when building feature columns.""" + return { + str(target): str(target) + for target in probes.get("target", pd.Series(dtype=str)).dropna().unique() + } + + def fingerprint(frame: pd.DataFrame) -> str: """Stable small-input cache key, excluding caller-owned object identity.""" payload = pd.util.hash_pandas_object(frame, index=True).values.tobytes() diff --git a/packages/detector/src/netcortex_detector/preparation.py b/packages/detector/src/netcortex_detector/preparation.py new file mode 100644 index 0000000..8ce568a --- /dev/null +++ b/packages/detector/src/netcortex_detector/preparation.py @@ -0,0 +1,361 @@ +"""Prepare and load detector-owned TRAIN/VALIDATION state for public detect().""" + +from __future__ import annotations + +import hashlib +import json +from collections.abc import Callable +from dataclasses import dataclass +from pathlib import Path +from typing import Any + +import numpy as np +import pandas as pd +from netcortex_core import ModuleUnavailable, Settings + +from netcortex_detector.engine import ( + CAUSES, + _identity_target_roles, + build_features, +) + +ARTIFACT_FORMAT = "netcortex-detector-training" +ARTIFACT_VERSION = 1 +DEFAULT_THRESHOLD = 0.7 +NORMAL_REFERENCE_LIMIT = 3 + + +@dataclass(frozen=True) +class _PreparedDetector: + backend: Any + threshold: float + artifact_path: Path + artifact_digest: str + mode: str + configuration_digest: str + backend_factory_id: int + + +_prepared: _PreparedDetector | None = None + + +def prepare_detector(cases_dir: Path, out: Path) -> Path: + """Build a data-only artifact from TRAIN and normal VALIDATION case packs.""" + cases_dir = Path(cases_dir).resolve() + train_paths = sorted((cases_dir / "train").glob("*.json")) + validation_paths = sorted((cases_dir / "validation").glob("*.json")) + if not train_paths or not validation_paths: + raise ModuleUnavailable("TRAIN and VALIDATION case files are required") + + train_cases = [_load_case(path, cases_dir, "train") for path in train_paths] + validation_cases = [_load_case(path, cases_dir, "validation") for path in validation_paths] + _validate_case_boundaries(train_cases, validation_cases) + + train_columns, train_rows, train_labels = _feature_rows(train_cases) + if not train_rows: + raise ModuleUnavailable("TRAIN cases produced no feature snapshots") + normal_train = [ + row for row, label in zip(train_rows, train_labels, strict=True) if label == "normal" + ] + if len(normal_train) < 5: + raise ModuleUnavailable("at least five normal TRAIN snapshots are required") + if len(set(train_labels)) < 2: + raise ModuleUnavailable("TRAIN cases must contain at least two cause classes") + + _, validation_rows, validation_labels = _feature_rows( + validation_cases, columns=train_columns + ) + normal_validation = [ + row + for row, label in zip(validation_rows, validation_labels, strict=True) + if label == "normal" + ][:NORMAL_REFERENCE_LIMIT] + if len(normal_validation) < 3: + raise ModuleUnavailable("at least three normal VALIDATION snapshots are required") + + payload = { + "format": ARTIFACT_FORMAT, + "version": ARTIFACT_VERSION, + "feature_columns": train_columns, + "train_features": train_rows, + "train_labels": train_labels, + "normal_train_features": normal_train, + "normal_validation_features": normal_validation, + "threshold": DEFAULT_THRESHOLD, + "threshold_note": "fixed plumbing default; not an accuracy-calibrated operating point", + "normal_reference_note": ( + f"first {len(normal_validation)} normal VALIDATION snapshots; plumbing reference only" + ), + "provenance": { + "train_case_ids": [case["case_id"] for case, _, _ in train_cases], + "validation_case_ids": [case["case_id"] for case, _, _ in validation_cases], + "train_seeds": [case["seed"] for case, _, _ in train_cases], + "validation_seeds": [case["seed"] for case, _, _ in validation_cases], + "train_windows": [_case_bounds(case) for case, _, _ in train_cases], + "validation_windows": [_case_bounds(case) for case, _, _ in validation_cases], + }, + } + out = Path(out) + out.parent.mkdir(parents=True, exist_ok=True) + out.write_text(json.dumps(payload, allow_nan=False, separators=(",", ":")), encoding="utf-8") + return out + + +def configure_detector( + artifact: Path, + *, + settings: Settings | None = None, + backend_factory: Callable[..., Any] | None = None, +) -> Any: + """Fit and cache the real provider from a validated data-only artifact.""" + global _prepared + artifact_path = Path(artifact).resolve() + try: + content = artifact_path.read_bytes() + digest = hashlib.sha256(content).hexdigest() + payload = json.loads(content) + columns, train, labels, normal_train, normal_validation, threshold = _validate_artifact( + payload + ) + except ModuleUnavailable: + _prepared = None + raise + except Exception as exc: + _prepared = None + raise ModuleUnavailable( + f"detector training artifact is invalid ({type(exc).__name__})" + ) from exc + + configured = settings or Settings() + mode = configured.tabpfn_mode + token = configured.tabpfn_token.get_secret_value() if configured.tabpfn_token else None + configuration_digest = hashlib.sha256( + json.dumps( + { + "token_sha256": hashlib.sha256(token.encode("utf-8")).hexdigest() + if token is not None + else None, + "timeout_s": configured.http_timeout_s, + }, + sort_keys=True, + separators=(",", ":"), + ).encode("utf-8") + ).hexdigest() + if _prepared and ( + _prepared.artifact_path == artifact_path + and _prepared.artifact_digest == digest + and _prepared.mode == mode + and _prepared.configuration_digest == configuration_digest + and (backend_factory is None or _prepared.backend_factory_id == id(backend_factory)) + ): + return _prepared.backend + + if backend_factory is None: + from netcortex_detector.providers import TabPFNBackend + + backend_factory = TabPFNBackend + try: + backend = backend_factory( + mode, access_token=token, timeout_s=configured.http_timeout_s + ) + if str(getattr(backend, "provenance", "")).startswith("fixture:"): + raise ModuleUnavailable("startup preparation requires a real provider backend") + train_frame = pd.DataFrame(train, columns=columns) + normal_train_frame = pd.DataFrame(normal_train, columns=columns) + train_labels = [str(label) for label in labels] + backend.fit_cause_model(train_frame, train_labels) + backend.fit_anomaly(normal_train_frame) + validation_scores = [ + float(backend.raw_anomaly(pd.Series(row, index=columns))) + for row in normal_validation + ] + backend.set_anomaly_reference(validation_scores) + except ModuleUnavailable: + _prepared = None + raise + except Exception as exc: + _prepared = None + raise ModuleUnavailable(f"detector provider setup failed ({type(exc).__name__})") from exc + + _prepared = _PreparedDetector( + backend=backend, + threshold=threshold, + artifact_path=artifact_path, + artifact_digest=digest, + mode=mode, + configuration_digest=configuration_digest, + backend_factory_id=id(backend_factory), + ) + return backend + + +def get_prepared_detector() -> tuple[Any, float] | None: + """Return the process-cached backend and fixed threshold, if startup configured it.""" + if _prepared is None: + return None + return _prepared.backend, _prepared.threshold + + +def clear_prepared_detector() -> None: + """Clear the process cache; primarily useful for isolated application lifecycles/tests.""" + global _prepared + _prepared = None + + +def _load_case(path: Path, cases_root: Path, expected_split: str): + split_root = (cases_root / expected_split).resolve() + if not split_root.is_relative_to(cases_root): + raise ModuleUnavailable("split directory escapes the case root") + if not path.resolve().is_relative_to(split_root): + raise ModuleUnavailable("case path escapes its split directory") + try: + case = json.loads(path.read_text(encoding="utf-8")) + if case.get("split") != expected_split: + raise ValueError("case split does not match its directory") + case_id = str(case["case_id"]) + site_id = str(case["site_id"]) + label = str(case["expected"]["cause"]) + seed = int(case["seed"]) + if not case_id or not site_id or label not in CAUSES: + raise ValueError("case metadata is invalid") + start, end = _case_bounds(case) + folder = path.parent.resolve() + observations = case["observations"] + frames = [] + for key in ("probe", "iface"): + observation_path = (folder / observations[key]).resolve() + if not observation_path.is_relative_to(folder): + raise ValueError("observation path escapes its split directory") + frames.append(pd.read_parquet(observation_path)) + probes, interfaces = frames + features = build_features( + probes, + interfaces, + site_id=site_id, + as_of=case["as_of"], + target_roles=_identity_target_roles(probes), + ) + if features.empty: + raise ValueError("case produced no feature snapshots") + row = features.iloc[-1] + row = pd.to_numeric(row, errors="coerce").replace([np.inf, -np.inf], np.nan).fillna(0.0) + return ( + {"case_id": case_id, "site_id": site_id, "seed": seed, "start": start, "end": end}, + row, + label, + ) + except ModuleUnavailable: + raise + except Exception as exc: + raise ModuleUnavailable(f"{expected_split} case is invalid ({type(exc).__name__})") from exc + + +def _case_bounds(case: dict[str, Any]) -> tuple[str, str]: + start = pd.Timestamp(case.get("case_start", case.get("start"))) + end = pd.Timestamp(case.get("as_of", case.get("end"))) + if start.tzinfo is None or end.tzinfo is None or start > end: + raise ValueError("case time bounds must be ordered and timezone-aware") + return start.tz_convert("UTC").isoformat(), end.tz_convert("UTC").isoformat() + + +def _validate_case_boundaries(train_cases: list[Any], validation_cases: list[Any]) -> None: + cases = [*train_cases, *validation_cases] + ids = [case[0]["case_id"] for case in cases] + seeds = [case[0]["seed"] for case in cases] + if len(ids) != len(set(ids)) or len(seeds) != len(set(seeds)): + raise ModuleUnavailable("TRAIN and VALIDATION case IDs and seeds must be distinct") + for index, (left, _, _) in enumerate(cases): + for right, _, _ in cases[index + 1 :]: + if left["start"] <= right["end"] and right["start"] <= left["end"]: + raise ModuleUnavailable("TRAIN and VALIDATION case time ranges overlap") + + +def _feature_rows(cases: list[Any], columns: list[str] | None = None): + frame = pd.DataFrame([row for _, row, _ in cases]).replace([np.inf, -np.inf], np.nan) + if columns is None: + columns = sorted(str(column) for column in frame.columns) + frame = frame.reindex(columns=columns).fillna(0.0) + rows = frame.to_numpy(dtype=float).tolist() + labels = [label for _, _, label in cases] + return columns, rows, labels + + +def _validate_artifact(payload: Any): + if not isinstance(payload, dict): + raise ModuleUnavailable("detector training artifact must be an object") + if payload.get("format") != ARTIFACT_FORMAT or payload.get("version") != ARTIFACT_VERSION: + raise ModuleUnavailable("detector training artifact format or version is unsupported") + columns = payload.get("feature_columns") + train = payload.get("train_features") + labels = payload.get("train_labels") + normal_train = payload.get("normal_train_features") + normal_validation = payload.get("normal_validation_features") + threshold = payload.get("threshold") + provenance = payload.get("provenance") + if ( + not isinstance(columns, list) + or not columns + or len(columns) != len(set(columns)) + or not isinstance(train, list) + or not isinstance(labels, list) + or len(train) != len(labels) + or not isinstance(normal_train, list) + or len(normal_train) < 5 + or not isinstance(normal_validation, list) + or len(normal_validation) < 3 + or not isinstance(threshold, (int, float)) + or not np.isfinite(threshold) + or not 0 <= threshold <= 1 + or not isinstance(provenance, dict) + ): + raise ModuleUnavailable("detector training artifact fields are invalid") + if not train or any(label not in CAUSES for label in labels) or len(set(labels)) < 2: + raise ModuleUnavailable("detector training artifact labels are invalid") + for matrix in (train, normal_train, normal_validation): + values = np.asarray(matrix, dtype=float) + if values.shape != (len(matrix), len(columns)) or not np.isfinite(values).all(): + raise ModuleUnavailable("detector training artifact feature matrix is invalid") + split_metadata = {} + for split in ("train", "validation"): + ids = provenance.get(f"{split}_case_ids") + seeds = provenance.get(f"{split}_seeds") + windows = provenance.get(f"{split}_windows") + if ( + not isinstance(ids, list) + or not isinstance(seeds, list) + or not isinstance(windows, list) + ): + raise ModuleUnavailable("detector training artifact provenance is incomplete") + if len(ids) != len(set(ids)) or len(seeds) != len(set(seeds)) or len(ids) != len(seeds): + raise ModuleUnavailable("detector training artifact provenance is inconsistent") + if any(not isinstance(value, str) or not value for value in ids): + raise ModuleUnavailable("detector training artifact case IDs are invalid") + if any(not isinstance(value, int) for value in seeds): + raise ModuleUnavailable("detector training artifact seeds are invalid") + if len(windows) != len(ids): + raise ModuleUnavailable("detector training artifact time ranges are inconsistent") + split_metadata[split] = (ids, seeds, windows) + train_ids, train_seeds, train_windows = split_metadata["train"] + validation_ids, validation_seeds, validation_windows = split_metadata["validation"] + if set(train_ids) & set(validation_ids) or set(train_seeds) & set(validation_seeds): + raise ModuleUnavailable("detector training artifact TRAIN and VALIDATION overlap") + parsed_windows = [] + for split, ranges in (("train", train_windows), ("validation", validation_windows)): + split_ranges = [] + for start_text, end_text in ranges: + start, end = pd.Timestamp(start_text), pd.Timestamp(end_text) + if start.tzinfo is None or end.tzinfo is None or start > end: + raise ModuleUnavailable("detector training artifact time ranges are invalid") + split_ranges.append((start, end)) + parsed_windows.append((split, split_ranges)) + for index, (split, left_ranges) in enumerate(parsed_windows): + for other_split, right_ranges in parsed_windows[index:]: + for left_start, left_end in left_ranges: + for right_start, right_end in right_ranges: + if split == other_split and left_start == right_start and left_end == right_end: + continue + if left_start <= right_end and right_start <= left_end: + raise ModuleUnavailable("detector training artifact time ranges overlap") + if len(train) != len(train_ids) or len(normal_train) != labels.count("normal"): + raise ModuleUnavailable("detector training artifact row counts are inconsistent") + return columns, train, labels, normal_train, normal_validation, float(threshold) diff --git a/packages/detector/src/netcortex_detector/providers.py b/packages/detector/src/netcortex_detector/providers.py index ee8cc1b..357ad37 100644 --- a/packages/detector/src/netcortex_detector/providers.py +++ b/packages/detector/src/netcortex_detector/providers.py @@ -1,7 +1,10 @@ from __future__ import annotations import os +import random +import sys import warnings +from threading import Lock from typing import Any import numpy as np @@ -13,6 +16,8 @@ LAG_PREFIXES = ("rtt_ms_", "jitter_ms_", "loss_pct_", "iface_") DERIVED_SUFFIXES = ("_lag1", "_mean5", "_std5") MAX_TRAINING_ROWS = 2048 +ANOMALY_PERMUTATION_SEED = 73021 +_ANOMALY_PERMUTATION_LOCK = Lock() def _array(frame: pd.DataFrame) -> np.ndarray: @@ -159,6 +164,9 @@ def __init__(self, mode: str, *, access_token: str | None = None, timeout_s: flo self._unsupervised: Any | None = None self._anomaly_columns: list[str] = [] self._anomaly_reference: np.ndarray | None = None + self._cause_features: pd.DataFrame | None = None + self._cause_labels: list[str] | None = None + self._unsupervised_module: Any | None = None def _imports(self) -> tuple[Any, Any]: if self._model_classes is not None: @@ -229,6 +237,8 @@ def fit_cause_model(self, features: pd.DataFrame, labels: list[str]) -> str: raise ValueError("training labels contain unsupported causes") x, y = _array(features), np.asarray(labels) self._classifier(x, y) + self._cause_features = features.copy() + self._cause_labels = list(labels) return fingerprint(pd.DataFrame(np.column_stack((x, y)))) def predict_cause( @@ -247,7 +257,9 @@ def predict_cause( return str(model.classes_[ix]), float(probs[0][ix]) def cause(self, vector: pd.Series) -> tuple[str, float]: - raise DetectorUnavailable("cause classifier requires explicit TRAIN-only feature vectors") + if self._cause_features is None or self._cause_labels is None: + raise DetectorUnavailable("cause classifier has not been prepared from TRAIN data") + return self.predict_cause(vector, self._cause_features, self._cause_labels) @staticmethod def _predictor_columns(frame: pd.DataFrame) -> list[str]: @@ -339,13 +351,24 @@ def forecasts(self, history: pd.DataFrame, horizon: int) -> list[dict[str, Any]] def fit_anomaly(self, normal_training_features: pd.DataFrame) -> None: columns = [ - name for name in normal_training_features if name.startswith(RAW_METRIC_PREFIXES) + name + for name in normal_training_features + if name.startswith(RAW_METRIC_PREFIXES) and not name.endswith(DERIVED_SUFFIXES) ] data = normal_training_features[columns].replace([np.inf, -np.inf], np.nan).dropna() - if len(data) < 5 or not columns: + if len(data) < 5: raise DetectorUnavailable( "TabPFN anomaly scoring needs at least five normal TRAIN snapshots" ) + # The density regressor requires a non-degenerate target support. Constant + # raw metrics cannot define a continuous density, so omit them using TRAIN + # observations only; derived/lag features are already excluded above. + columns = [name for name in columns if data[name].nunique(dropna=True) > 1] + if not columns: + raise DetectorUnavailable( + "TabPFN anomaly scoring needs a varying raw metric in normal TRAIN" + ) + data = data[columns] try: self._imports() clf, reg = self._new_model("classifier"), self._new_model("regressor") @@ -353,6 +376,9 @@ def fit_anomaly(self, normal_training_features: pd.DataFrame) -> None: "tabpfn_extensions.unsupervised", fromlist=["TabPFNUnsupervisedModel"] ) self._unsupervised = module.TabPFNUnsupervisedModel(tabpfn_clf=clf, tabpfn_reg=reg) + self._unsupervised_module = sys.modules.get( + module.TabPFNUnsupervisedModel.__module__ + ) self._unsupervised.fit(_array(data)) self._anomaly_columns = columns except Exception as exc: @@ -364,10 +390,28 @@ def raw_anomaly(self, vector: pd.Series) -> float: "TabPFN anomaly model has not been fit on normal TRAIN snapshots" ) try: + import torch + data = np.asarray( [vector.reindex(self._anomaly_columns, fill_value=0.0)], dtype=np.float32 ) - result = self._unsupervised.outliers(data, n_permutations=1) + # The extension uses both its module-level Python RNG for feature ordering + # and torch's CPU RNG for density noise. Forking preserves the caller's RNG. + with _ANOMALY_PERMUTATION_LOCK, torch.random.fork_rng(devices=[]): + torch.manual_seed(ANOMALY_PERMUTATION_SEED) + if self._unsupervised_module is not None and hasattr( + self._unsupervised_module, "random" + ): + previous_random = self._unsupervised_module.random + self._unsupervised_module.random = random.Random( + ANOMALY_PERMUTATION_SEED + ) + try: + result = self._unsupervised.outliers(data, n_permutations=1) + finally: + self._unsupervised_module.random = previous_random + else: + result = self._unsupervised.outliers(data, n_permutations=1) return float( np.asarray(result.detach().cpu() if hasattr(result, "detach") else result).reshape( -1 diff --git a/packages/detector/tests/test_engine.py b/packages/detector/tests/test_engine.py index f8d53eb..0b848ef 100644 --- a/packages/detector/tests/test_engine.py +++ b/packages/detector/tests/test_engine.py @@ -217,6 +217,39 @@ def test_public_core_adapter_rejects_non_core_windows(): detect("s1", object(), object()) +def test_public_detect_requires_real_startup_setup_before_provider_calls(monkeypatch): + from netcortex_core import MetricsWindow, Settings + + from netcortex_detector import engine, providers + from netcortex_detector.preparation import clear_prepared_detector + + probes, interfaces = frames(minutes=6) + probes["kind"] = "icmp" + interfaces["rx_bps"] = 100 + interfaces["tx_bps"] = 100 + window = MetricsWindow( + as_of=probes.time.max().to_pydatetime(), + probe_metrics=probes, + iface_metrics=interfaces, + ) + + class UnpreparedRealBackend: + provenance = "tabpfn-cloud:v3.5" + mode = "cloud" + + def forecasts(self, history, horizon): + pytest.fail("detect must reject an unprepared backend before provider calls") + + monkeypatch.setattr(engine, "Settings", lambda: Settings(_env_file=None)) + monkeypatch.setattr(providers, "TabPFNBackend", lambda *args, **kwargs: UnpreparedRealBackend()) + clear_prepared_detector() + try: + with pytest.raises(DetectorUnavailable, match="configure_detector"): + detect("s1", window, window) + finally: + clear_prepared_detector() + + def test_forecast_compare_only_uses_prior_forecast_samples(): from netcortex_detector.engine import consecutive_forecast_exceedances @@ -358,6 +391,8 @@ def anomaly(self, vector): def test_tabpfn_adapter_fits_lagged_forecasts_and_joint_quantiles(monkeypatch): + from contextlib import nullcontext + from netcortex_detector.providers import TabPFNBackend calls = {"reg_fit": 0, "predict": 0, "clf_fit": 0, "unsup_fit": 0} @@ -411,6 +446,14 @@ def _new_model(self, kind): package.__path__ = [] monkeypatch.setitem(__import__("sys").modules, "tabpfn_extensions", package) monkeypatch.setitem(__import__("sys").modules, "tabpfn_extensions.unsupervised", extension) + seeded_values = [] + fake_torch = SimpleNamespace( + manual_seed=seeded_values.append, + random=SimpleNamespace( + fork_rng=lambda *, devices: nullcontext(), + ) + ) + monkeypatch.setitem(sys.modules, "torch", fake_torch) backend = Backend("local") p, i = frames(minutes=20) @@ -438,11 +481,15 @@ def _new_model(self, kind): == "uplink_congestion" ) normal = pd.DataFrame([features.iloc[index] for index in range(10)]) + normal["rtt_ms_constant"] = 42.0 backend.fit_anomaly(normal) assert calls["unsup_fit"] == 1 + assert "rtt_ms_constant" not in backend._anomaly_columns + assert all(normal[column].nunique() > 1 for column in backend._anomaly_columns) reference = [backend.raw_anomaly(normal.iloc[index]) for index in range(3)] backend.set_anomaly_reference(reference) assert 0.0 <= backend.anomaly(features.iloc[-1]) <= 1.0 + assert seeded_values == [73021] * 4 large_p, large_i = frames(minutes=600) large = build_features(large_p, large_i, site_id="s1", as_of=large_p.time.max()) diff --git a/packages/detector/tests/test_gate2_preparation.py b/packages/detector/tests/test_gate2_preparation.py new file mode 100644 index 0000000..f5b6394 --- /dev/null +++ b/packages/detector/tests/test_gate2_preparation.py @@ -0,0 +1,206 @@ +"""Lead Gate 2 acceptance cases: provider-free tests are not a live pass.""" + +import json +from datetime import UTC, datetime, timedelta +from pathlib import Path + +import pandas as pd +import pytest +from netcortex_core import DetectionResult, MetricsWindow, ModuleUnavailable, Settings + +from netcortex_detector import engine, providers + + +def _write_case(root: Path, split: str, number: int, cause: str) -> None: + folder = root / split + folder.mkdir(parents=True, exist_ok=True) + offset = number + (100 if split == "validation" else 0) + start = datetime(2025, 1, 1, tzinfo=UTC) + timedelta(days=offset) + times = pd.date_range(start, periods=40, freq="min") + probes = pd.DataFrame( + { + "time": times, + "site_id": "north-tower", + "target": "1.1.1.1", + "kind": "icmp", + "rtt_ms": [10.0 + i % 5 for i in range(40)], + "jitter_ms": 1.0, + "loss_pct": 0.0, + "source": "sim", + } + ) + interfaces = pd.DataFrame( + { + "time": times, + "site_id": "north-tower", + "iface": "ether1", + "rx_bps": 100, + "tx_bps": 100, + "util_pct": [30.0 + i % 7 for i in range(40)], + "drops": 0, + "errors": 0, + "source": "sim", + } + ) + prefix = f"{split}-{number}" + probes.to_parquet(folder / f"{prefix}-probe.parquet", index=False) + interfaces.to_parquet(folder / f"{prefix}-iface.parquet", index=False) + case = { + "case_id": prefix, + "split": split, + "seed": offset, + "site_id": "north-tower", + "case_start": start.isoformat(), + "as_of": times[-1].isoformat(), + "history_window": {"start": start.isoformat(), "end_exclusive": times[9].isoformat()}, + "detection_window": {"start": times[9].isoformat(), "end_inclusive": times[-1].isoformat()}, + "expected": {"cause": cause, "template_id": "none", "params": {}}, + "observations": {"probe": f"{prefix}-probe.parquet", "iface": f"{prefix}-iface.parquet"}, + } + (folder / f"{prefix}.json").write_text(json.dumps(case), encoding="utf-8") + + +@pytest.fixture +def training_cases(tmp_path): + causes = ["normal"] * 5 + ["dns_slow", "heavy_user", "uplink_down"] + for number, cause in enumerate(causes): + _write_case(tmp_path, "train", number, cause) + for number in range(3): + _write_case(tmp_path, "validation", number, "normal") + (tmp_path / "test").mkdir() + # Any attempt to parse test metadata would fail; preparation must ignore it. + (tmp_path / "test" / "never-read.json").write_text("DO NOT READ TEST", encoding="utf-8") + return tmp_path + + +def test_preparation_ignores_test_and_rejects_invalid_artifact(training_cases, tmp_path): + from netcortex_detector.preparation import configure_detector, prepare_detector + + artifact = prepare_detector(training_cases, tmp_path / "training.json") + assert artifact.is_file() + payload = artifact.read_text() + assert "DO NOT READ TEST" not in payload + assert "tabpfn_token" not in payload.lower() + bad = tmp_path / "bad.json" + bad.write_text("{}") + with pytest.raises(ModuleUnavailable): + configure_detector(bad, settings=Settings(_env_file=None)) + + +def test_prepared_backend_is_used_by_public_detect(training_cases, tmp_path, monkeypatch): + from netcortex_detector.preparation import ( + clear_prepared_detector, + configure_detector, + prepare_detector, + ) + + class Backend(providers.FixtureBackend): + provenance = "tabpfn-cloud:v3.5" + mode = "cloud" + + def __init__(self): + self.fit_calls = 0 + self.raw_calls = 0 + + def fit_cause_model(self, features, labels): + self.fit_calls += 1 + assert len(labels) == 8 and set(labels) == { + "normal", + "dns_slow", + "heavy_user", + "uplink_down", + } + + def fit_anomaly(self, features): + assert len(features) == 5 + + def raw_anomaly(self, vector): + self.raw_calls += 1 + return -float(vector.iloc[0]) + + def set_anomaly_reference(self, scores): + assert len(scores) == 3 + + def predict_cause(self, vector, features, labels): + return "dns_slow", 0.9 + + def cause(self, vector): + return "dns_slow", 0.9 + + def anomaly(self, vector): + return 0.8 + + backend = Backend() + settings = Settings(_env_file=None, tabpfn_mode="cloud") + artifact = prepare_detector(training_cases, tmp_path / "training.json") + monkeypatch.setattr(engine, "Settings", lambda: settings) + try: + configure_detector(artifact, settings=settings, backend_factory=lambda *a, **k: backend) + folder = training_cases / "validation" + window = MetricsWindow( + as_of=datetime(2025, 4, 11, 0, 39, tzinfo=UTC), + probe_metrics=pd.read_parquet(folder / "validation-0-probe.parquet"), + iface_metrics=pd.read_parquet(folder / "validation-0-iface.parquet"), + ) + first = engine.detect("north-tower", window, window) + second = engine.detect("north-tower", window, window) + assert isinstance(first, DetectionResult) and isinstance(second, DetectionResult) + assert first.mode == "cloud" and first.model.startswith("tabpfn-") + assert first.series and all(len(s.points) == 5 for s in first.series) + assert backend.fit_calls == 1 and backend.raw_calls == 3 + finally: + clear_prepared_detector() + + +def test_rotating_runtime_configuration_rebuilds_cached_backend(training_cases, tmp_path): + from netcortex_detector.preparation import ( + clear_prepared_detector, + configure_detector, + prepare_detector, + ) + + created = [] + + class Backend: + provenance = "tabpfn-cloud:v3.5" + + def __init__(self, mode, *, access_token, timeout_s): + self.mode = mode + created.append((access_token, timeout_s)) + + def fit_cause_model(self, features, labels): + pass + + def fit_anomaly(self, features): + pass + + def raw_anomaly(self, vector): + return -1.0 + + def set_anomaly_reference(self, scores): + pass + + def settings(token, timeout): + return Settings(_env_file=None, TABPFN_TOKEN=token, http_timeout_s=timeout) + + artifact = prepare_detector(training_cases, tmp_path / "training.json") + clear_prepared_detector() + try: + first = configure_detector( + artifact, settings=settings("dummy-a", 10), backend_factory=Backend + ) + assert ( + configure_detector(artifact, settings=settings("dummy-a", 10), backend_factory=Backend) + is first + ) + rotated = configure_detector( + artifact, settings=settings("dummy-b", 10), backend_factory=Backend + ) + assert rotated is not first + changed_timeout = configure_detector( + artifact, settings=settings("dummy-b", 20), backend_factory=Backend + ) + assert changed_timeout is not rotated + assert created == [("dummy-a", 10), ("dummy-b", 10), ("dummy-b", 20)] + finally: + clear_prepared_detector() diff --git a/packages/detector/tests/test_gate2_runner.py b/packages/detector/tests/test_gate2_runner.py new file mode 100644 index 0000000..6999f16 --- /dev/null +++ b/packages/detector/tests/test_gate2_runner.py @@ -0,0 +1,66 @@ +"""Lead Gate 2 SQL-boundary test; it does not contact the shared database.""" + +from contextlib import contextmanager +from datetime import UTC, datetime, timedelta +from pathlib import Path +from runpy import run_path + +from netcortex_core import IFACE_COLUMNS, PROBE_COLUMNS, SUBSCRIBER_COLUMNS, MetricsWindow + + +def test_fetch_window_is_site_source_and_time_bounded(): + module = run_path(str(Path(__file__).resolve().parents[3] / "eval" / "gate2.py")) + at = datetime(2026, 10, 18, 12, tzinfo=UTC) + start = at - timedelta(minutes=30) + calls = [] + + class Cursor: + def execute(self, sql, params): + calls.append((sql, params)) + self.sql = sql + + def fetchall(self): + if "probe_metrics" in self.sql: + row = dict( + time=at, + site_id="north-tower", + target="1.1.1.1", + kind="icmp", + rtt_ms=20.0, + jitter_ms=1.0, + loss_pct=0.0, + source="sim", + ) + return [tuple(row[c] for c in PROBE_COLUMNS)] + if "iface_metrics" in self.sql: + row = dict( + time=at, + site_id="north-tower", + iface="ether1", + rx_bps=10, + tx_bps=10, + util_pct=20.0, + drops=0, + errors=0, + source="sim", + ) + return [tuple(row[c] for c in IFACE_COLUMNS)] + row = dict( + time=at, site_id="north-tower", ip="192.0.2.10", rx_bps=10, tx_bps=10, source="sim" + ) + return [tuple(row[c] for c in SUBSCRIBER_COLUMNS)] + + class Connection: + @contextmanager + def cursor(self): + yield Cursor() + + result = module["fetch_window"](Connection(), "north-tower", start, at) + assert isinstance(result, MetricsWindow) and result.as_of == at + assert len(calls) == 3 + for sql, params in calls: + normalized = " ".join(sql.lower().split()) + assert "site_id" in normalized and "source" in normalized + assert "time >=" in normalized and "time <=" in normalized + assert "north-tower" in params and start in params and at in params + assert "sim" in params or "source = 'sim'" in normalized or "source='sim'" in normalized diff --git a/packages/detector/tests/test_gate2_state.py b/packages/detector/tests/test_gate2_state.py new file mode 100644 index 0000000..8f63476 --- /dev/null +++ b/packages/detector/tests/test_gate2_state.py @@ -0,0 +1,239 @@ +"""Offline state/resume tests for the separate credentialed Gate 2 runner.""" + +from contextlib import contextmanager +from datetime import UTC, datetime, timedelta +from pathlib import Path +from runpy import run_path + +import netcortex_simgen.simulator as simulator +import pandas as pd +from netcortex_core import Cause, ScenarioLabel, Source, TemplateId + +RUNNER = run_path(str(Path(__file__).resolve().parents[3] / "eval" / "gate2.py")) + + +def _label() -> ScenarioLabel: + start = datetime(2026, 10, 18, 12, tzinfo=UTC) + return ScenarioLabel( + site_id="north-tower", + scenario_type=Cause.UPLINK_CONGESTION, + start_at=start, + end_at=start + timedelta(minutes=15), + affected={"iface": "ether1"}, + expected_cause=Cause.UPLINK_CONGESTION, + expected_template=TemplateId.PRIORITY_QUEUE, + expected_params={"uplink": "ether1", "uplink_mbps": 162}, + seed=20261018, + source=Source.SIM, + ) + + +def test_resume_state_round_trip_and_requires_matching_database_label(tmp_path): + label = _label() + state_path = tmp_path / "state.json" + state = RUNNER["_load_state"](state_path) + RUNNER["_save_state"](state_path, state, label) + loaded = RUNNER["_load_state"](state_path) + + values = ( + label.id, + label.site_id, + label.scenario_type.value, + label.start_at, + label.end_at, + label.affected, + label.expected_cause.value, + label.expected_template.value, + label.expected_params, + label.seed, + label.source.value, + ) + calls = [] + + class Cursor: + def __enter__(self): + return self + + def __exit__(self, *_): + return False + + def execute(self, sql, params): + calls.append((sql, params)) + + def fetchone(self): + return values + + class Connection: + @contextmanager + def cursor(self): + yield Cursor() + + resumed = RUNNER["_resume_active_label"]( + Connection(), + loaded, + site_id="north-tower", + seed=20261018, + now=label.start_at + timedelta(seconds=12), + ) + assert resumed == label + assert "source = 'sim'" in calls[0][0] + assert calls[0][1] == (str(label.id), "north-tower") + + +def test_resume_state_does_not_resume_expired_or_foreign_labels(tmp_path): + label = _label() + state_path = tmp_path / "state.json" + state = RUNNER["_load_state"](state_path) + RUNNER["_save_state"](state_path, state, label) + + class Connection: + @contextmanager + def cursor(self): + class Cursor: + def __enter__(self): + return self + + def __exit__(self, *_): + return False + + def execute(self, *_): + pass + + def fetchone(self): + return None + + yield Cursor() + + assert ( + RUNNER["_resume_active_label"]( + Connection(), state, site_id="north-tower", seed=20261018, now=label.end_at + ) + is None + ) + assert ( + RUNNER["_resume_active_label"]( + Connection(), state, site_id="north-tower", seed=8, now=label.start_at + ) + is None + ) + + +def test_history_seeding_skips_rows_inside_existing_scenario(monkeypatch): + now = datetime(2026, 10, 18, 12, tzinfo=UTC) + start = now - timedelta(minutes=60) + fault_start = start + timedelta(minutes=1) + fault_end = start + timedelta(minutes=3) + + class Cursor: + def __init__(self): + self.sql = "" + + def __enter__(self): + return self + + def __exit__(self, *_): + return False + + def execute(self, sql, _params=None): + self.sql = sql + + def fetchall(self): + if "FROM scenario_labels" in self.sql: + return [(fault_start, fault_end)] + return [] + + class Connection: + @contextmanager + def cursor(self): + yield Cursor() + + probes = pd.DataFrame( + [ + { + "time": start, + "site_id": "north-tower", + "target": "1.1.1.1", + "kind": "icmp", + "rtt_ms": 20.0, + "jitter_ms": 1.0, + "loss_pct": 0.0, + "source": "sim", + }, + { + "time": fault_start, + "site_id": "north-tower", + "target": "1.1.1.1", + "kind": "icmp", + "rtt_ms": 20.0, + "jitter_ms": 1.0, + "loss_pct": 0.0, + "source": "sim", + }, + ] + ) + interfaces = pd.DataFrame( + [ + { + "time": start, + "site_id": "north-tower", + "iface": "ether1", + "rx_bps": 1, + "tx_bps": 1, + "util_pct": 20.0, + "drops": 0, + "errors": 0, + "source": "sim", + }, + { + "time": fault_start, + "site_id": "north-tower", + "iface": "ether1", + "rx_bps": 1, + "tx_bps": 1, + "util_pct": 20.0, + "drops": 0, + "errors": 0, + "source": "sim", + }, + ] + ) + subscribers = pd.DataFrame( + [ + { + "time": start, + "site_id": "north-tower", + "ip": "192.0.2.10", + "rx_bps": 1, + "tx_bps": 1, + "source": "sim", + }, + { + "time": fault_start, + "site_id": "north-tower", + "ip": "192.0.2.10", + "rx_bps": 1, + "tx_bps": 1, + "source": "sim", + }, + ] + ) + monkeypatch.setattr(simulator, "generate", lambda **_: (probes, interfaces, [])) + monkeypatch.setattr(simulator, "generate_subscribers", lambda *_, **__: subscribers) + monkeypatch.setattr(RUNNER["core_db"], "fetch_site", lambda *_: object()) + inserted = {"probe": [], "iface": [], "subscriber": []} + monkeypatch.setattr( + RUNNER["core_db"], "insert_probe_metrics", lambda _, rows: inserted["probe"].extend(rows) + ) + monkeypatch.setattr( + RUNNER["core_db"], "insert_iface_metrics", lambda _, rows: inserted["iface"].extend(rows) + ) + monkeypatch.setattr( + RUNNER["core_db"], + "insert_subscriber_metrics", + lambda _, rows: inserted["subscriber"].extend(rows), + ) + + result = RUNNER["_seed_normal_history"](Connection(), site_id="north-tower", now=now, seed=5) + assert result["probe_rows_added"] == result["iface_rows_added"] == 1 + assert result["subscriber_rows_added"] == 1 + assert all(row.time == start for rows in inserted.values() for row in rows) From a778e7209b25c658d8451def5bdafda4bd208494 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 23:08:52 +0500 Subject: [PATCH 14/21] wip --- .github/decision.md | 18 +++++++++++ .github/flow.md | 6 ++-- .github/scripts/chr_ci_env.py | 36 ++++++++++++++++++++++ .github/tests/test_chr_harness_ci.py | 45 ++++++++++++++++++++++++++++ .github/workflows/chr-templates.yml | 18 ++++++----- decision.md | 8 +++++ docs/CHR_CI_VALIDATION.md | 25 ++++++++++++++++ docs/progress/chr_ci.md | 14 +++++++++ flow.md | 6 ++++ 9 files changed, 166 insertions(+), 10 deletions(-) create mode 100644 .github/scripts/chr_ci_env.py create mode 100644 .github/tests/test_chr_harness_ci.py create mode 100644 docs/CHR_CI_VALIDATION.md create mode 100644 docs/progress/chr_ci.md diff --git a/.github/decision.md b/.github/decision.md index 08c6671..41ffc53 100644 --- a/.github/decision.md +++ b/.github/decision.md @@ -27,3 +27,21 @@ Repository instructions can shape Copilot's review, but automatic review still r ## Verified implementation run The corrected [CHR smoke](https://github.com/aunraza19/NetCortex/actions/runs/39131915789) passed on `d60ffac`, including authenticated REST readiness and cleanup. The template job was skipped because Aun's harness is absent. [Python/frontend CI](https://github.com/aunraza19/NetCortex/actions/runs/39131915864) also passed. + +## Template job baseline + +When Aun's real harness is present, CI boots `infra/chr/chr.py start`, which +applies the canonical three-NIC baseline in `infra/chr/baseline.rsc`. The +one-NIC `.github/scripts/chr_bootstrap.py` helper remains only for the separate +missing-harness smoke job. This preserves the static primary route, backup +uplink, LAN queues, and DNS baseline required by failover, queue, and resolver +template checks. + +The template job creates a fresh URL-safe password for that job, emits its +GitHub Actions mask before writing only `CHR_REST_URL`, `CHR_USERNAME`, and +`CHR_PASSWORD` to `GITHUB_ENV`, and then runs the real harness with its JSON +report path. Its always-run stop step uses the canonical `chr.py stop` command. +The uploaded artifacts are restricted to `var/chr/qemu.log` and +`var/chr/template-results.json`; router disks and environment files are never +uploaded. `.github/scripts/chr_ci_env.py` has offline tests and no credential +or file access outside the explicit GitHub environment file. diff --git a/.github/flow.md b/.github/flow.md index 28610f8..f29c361 100644 --- a/.github/flow.md +++ b/.github/flow.md @@ -14,8 +14,8 @@ 1. Readiness checks only for Aun's `infra/chr/test_templates.py`. 2. If missing, the template job is skipped and the summary says no CHR/template tests ran. A separate smoke job installs QEMU/the locked workspace, tests B's offline lifecycle code, and boots/provisions the pinned router. -3. If present, only the real template job runs; it installs QEMU/the locked workspace and boots/provisions one router before invoking Aun's harness. The smoke job stays skipped to avoid a duplicate boot. -4. Bootstrap downloads and verifies the pinned image, starts QEMU, skips the optional license text display, presses Enter at the continuation prompt, agrees only at the terms prompt, provisions a random admin password over its serial socket, enables REST support, and verifies the authenticated REST resource twice. It sends serial input with a single CR terminator, detects password mismatch errors immediately, preserves additional prompts from a read chunk, and writes the redacted serial transcript after provisioning so REST failures can be debugged. It masks the password before provisioning and exposes `CHR_REST_URL`, `CHR_REST_USERNAME`, and `CHR_REST_PASSWORD` only to subsequent steps through `GITHUB_ENV`. -5. The real template job runs Aun's harness against `http://127.0.0.1:9180/rest`. On every outcome, the active router job uploads QEMU and sanitized serial logs when available and asks the helper to stop only its own verified QEMU process. +3. If present, only the real template job runs; it installs QEMU/the locked workspace, writes a fresh masked job password to `GITHUB_ENV`, and starts the canonical `infra/chr/chr.py` router. The smoke job stays skipped to avoid a duplicate boot. +4. `chr.py start` boots the three-NIC `infra/chr/baseline.rsc` topology. The template job runs Aun's unmodified harness against that primary/backup/LAN and DNS baseline, writing `var/chr/template-results.json`. +5. On every outcome, the template job attempts `uv run --locked python infra/chr/chr.py stop` and retains only `var/chr/qemu.log` and the harness JSON report when present. The one-NIC bootstrap helper remains only in the missing-harness smoke job. **Exit:** actual template coverage is reported only when Aun's harness ran. Bootstrap unit tests, boot smoke, job setup, and a missing-harness skip do not count as an actual router/template test pass. diff --git a/.github/scripts/chr_ci_env.py b/.github/scripts/chr_ci_env.py new file mode 100644 index 0000000..bbc2df1 --- /dev/null +++ b/.github/scripts/chr_ci_env.py @@ -0,0 +1,36 @@ +"""Provide a fresh, masked CHR credential to later steps in this CI job.""" + +from __future__ import annotations + +import os +import secrets +import sys +from pathlib import Path + + +def write_ci_environment(path: Path) -> None: + """Mask a job-only password, then write CHR settings to GitHub's env file.""" + password = secrets.token_urlsafe(32) + # GitHub must learn the mask before any later step can emit this value. + print(f"::add-mask::{password}", flush=True) + with path.open("a", encoding="utf-8") as environment: + environment.write("CHR_REST_URL=http://127.0.0.1:9180\n") + environment.write("CHR_USERNAME=admin\n") + environment.write(f"CHR_PASSWORD={password}\n") + + +def main() -> int: + env_path = os.environ.get("GITHUB_ENV") + if not env_path: + print("GITHUB_ENV is required in the CHR template job", file=sys.stderr) + return 2 + try: + write_ci_environment(Path(env_path)) + except OSError: + print("Could not configure the CHR job environment", file=sys.stderr) + return 1 + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/.github/tests/test_chr_harness_ci.py b/.github/tests/test_chr_harness_ci.py new file mode 100644 index 0000000..b5f3319 --- /dev/null +++ b/.github/tests/test_chr_harness_ci.py @@ -0,0 +1,45 @@ +"""Lead acceptance tests for CI wiring to Aun's canonical three-NIC router.""" + +from pathlib import Path +from runpy import run_path + +import yaml + +ROOT = Path(__file__).resolve().parents[2] + + +def test_template_job_uses_canonical_router_and_keeps_only_safe_diagnostics(): + workflow = yaml.safe_load((ROOT / ".github/workflows/chr-templates.yml").read_text()) + steps = workflow["jobs"]["templates"]["steps"] + runs = [step.get("run", "") for step in steps] + setup = runs.index("python .github/scripts/chr_ci_env.py") + start = runs.index("uv run --locked python infra/chr/chr.py start") + harness = next(i for i, run in enumerate(runs) if "infra/chr/test_templates.py" in run) + stop = next(step for step in steps if "infra/chr/chr.py stop" in step.get("run", "")) + assert setup < start < harness + assert stop["if"] == "always()" + assert not any("chr_bootstrap.py start" in run for run in runs) + artifacts = [ + step["with"]["path"] for step in steps if "upload-artifact" in step.get("uses", "") + ] + assert artifacts and all("var/chr/qemu.log" in path for path in artifacts) + assert all( + not any(s in path for s in ("qcow2", ".env", "*.img", "var/chr/**")) for path in artifacts + ) + + +def test_ci_credentials_are_masked_and_only_written_to_job_environment( + tmp_path, monkeypatch, capsys +): + module = run_path(str(ROOT / ".github/scripts/chr_ci_env.py")) + monkeypatch.setattr(module["secrets"], "token_urlsafe", lambda size: "dummy-ci-password") + target = tmp_path / "job-environment.txt" + target.write_text("EXISTING_SETTING=preserved\n") + module["write_ci_environment"](target) + assert capsys.readouterr().out == "::add-mask::dummy-ci-password\n" + values = dict(line.split("=", 1) for line in target.read_text().splitlines()) + assert values["EXISTING_SETTING"] == "preserved" + assert values["CHR_REST_URL"] == "http://127.0.0.1:9180" + assert values["CHR_USERNAME"] == "admin" + assert values["CHR_PASSWORD"] == "dummy-ci-password" + assert not (tmp_path / ".env").exists() diff --git a/.github/workflows/chr-templates.yml b/.github/workflows/chr-templates.yml index 472caa9..d6180af 100644 --- a/.github/workflows/chr-templates.yml +++ b/.github/workflows/chr-templates.yml @@ -7,6 +7,7 @@ on: - "packages/**" - "templates/routeros/**" - "infra/chr/**" + - ".github/scripts/chr_ci_env.py" - ".github/scripts/chr_bootstrap.py" - ".github/workflows/chr-templates.yml" pull_request: @@ -15,6 +16,7 @@ on: - "templates/routeros/**" - "infra/chr/test_templates.py" - "infra/chr/**" + - ".github/scripts/chr_ci_env.py" - ".github/scripts/chr_bootstrap.py" - ".github/workflows/chr-templates.yml" workflow_dispatch: @@ -101,20 +103,22 @@ jobs: - name: Install locked workspace run: uv sync --all-packages --locked - name: Offline test bootstrap lifecycle helpers - run: uv run --locked pytest .github/tests/test_chr_bootstrap.py - - name: Boot, provision, and authenticate to pinned CHR - run: uv run --locked python .github/scripts/chr_bootstrap.py start + run: uv run --locked pytest .github/tests/test_chr_bootstrap.py .github/tests/test_chr_harness_ci.py + - name: Configure isolated CHR credentials + run: python .github/scripts/chr_ci_env.py + - name: Boot canonical three-NIC CHR baseline + run: uv run --locked python infra/chr/chr.py start - name: Run Aun's real router template harness - run: uv run --locked python infra/chr/test_templates.py + run: uv run --locked python infra/chr/test_templates.py --json var/chr/template-results.json - name: Keep router diagnostics if: always() uses: actions/upload-artifact@v4 with: name: chr-diagnostics path: | - /tmp/netcortex-chr/qemu.log - /tmp/netcortex-chr/serial.log + var/chr/qemu.log + var/chr/template-results.json if-no-files-found: ignore - name: Stop the isolated router if: always() - run: python .github/scripts/chr_bootstrap.py cleanup + run: uv run --locked python infra/chr/chr.py stop diff --git a/decision.md b/decision.md index a759ba0..3d369de 100644 --- a/decision.md +++ b/decision.md @@ -90,3 +90,11 @@ Main advanced during verification with Aun's CHR PR #6. The same branch was rebased again onto d70f76f and uv lock rerun. Main's four required root files remain identical. The combined suite passes 220 offline tests with three live tests deselected, including with unmocked Torch imports blocked. + +The newly enabled CHR harness exposed a CI topology mismatch: B's boot smoke +created one NIC with DHCP defaults, while Aun's template tests require the +three-NIC baseline, static primary route and existing DNS resolver. The workflow +now uses Aun's canonical start/stop commands and unchanged template harness. +Credentials are random per job, masked before sharing through GITHUB_ENV, and +only QEMU logs and the template JSON report are uploaded. Lead acceptance cases +were written first; a boot-only pass cannot substitute for four restored fixes. diff --git a/docs/CHR_CI_VALIDATION.md b/docs/CHR_CI_VALIDATION.md new file mode 100644 index 0000000..a34f94f --- /dev/null +++ b/docs/CHR_CI_VALIDATION.md @@ -0,0 +1,25 @@ +# Lead acceptance cases for the merged CHR harness + +Written before delegation. The failed PR run 39152162409 used B's one-NIC boot +smoke router for Aun's newly merged three-NIC template harness. Aun's baseline +provides a static primary default route, backup/LAN interfaces, subscriber queues +and an existing DNS resolver. Without it, failover targets a DHCP-owned route, +DNS rollback fails, and subsequent baseline comparisons also fail. + +1. The actual template job must run canonical `infra/chr/chr.py start`, then the + unmodified real template harness, then canonical stop on every outcome. + Keep the one-NIC helper only for the explicitly separate missing-harness smoke. +2. Generate a random job-only admin password, emit its GitHub mask before sharing + it through GITHUB_ENV, and configure core-compatible CHR settings. Never write + .env, reuse application credentials, or put password literals in YAML. +3. Retain only QEMU logs and the template JSON report. Never upload router disks, + baselines, environment files or generated credentials. +4. Unit checks verify workflow selection and credential wiring offline. The real + CI job must show all four templates actually applied and restored. Do not + change assertions or skip the harness to make this green. +5. Keep core, fixes, templates and Aun's router files unchanged. This correction + belongs to B's workflow/bootstrap wiring. Maintain .github decision/flow docs. +6. After the fix follow the user's merge sequence: clean status/save work, fetch, + merge main, restore main's five root files including uv.lock, regenerate with + uv lock, sync all packages, run non-live tests, commit actual changes and push + b/workstream-b. Skip empty commits. diff --git a/docs/progress/chr_ci.md b/docs/progress/chr_ci.md new file mode 100644 index 0000000..f45b425 --- /dev/null +++ b/docs/progress/chr_ci.md @@ -0,0 +1,14 @@ +# CHR template CI correction + +The template job now uses the canonical `infra/chr/chr.py start` lifecycle so +the real four-template harness sees the repository's three-NIC baseline. The +missing-harness smoke job continues to use the standalone one-NIC bootstrap. +The template job generates and masks a random job-only password before writing +its CHR settings to `GITHUB_ENV`, invokes the unmodified harness with a JSON +report destination, uploads only the QEMU log and report, and always requests +canonical cleanup. + +The offline acceptance tests cover workflow ordering, the always-run cleanup, +artifact allowlisting, and credential masking/environment-file output. No local +QEMU, router, or credentialed service was used for this change; the real CHR +template job remains the external integration check. diff --git a/flow.md b/flow.md index bec52ce..a251c67 100644 --- a/flow.md +++ b/flow.md @@ -94,3 +94,9 @@ through core's database pool. Public detect returns a core DetectionResult; the runner validates provenance, quantiles and horizons and compares forecast row counts. Exit is a sanitized JSON/Markdown report with measured timing and an explicit pass or failure. No migrations or live-router operations occur. + +The merged CHR template CI path generates a masked job-only router password, +calls `infra/chr/chr.py start` to provision the canonical three-NIC baseline, +then runs `infra/chr/test_templates.py` for actual apply/export/rollback checks. +It retains the QEMU log and structured test report and always calls canonical +stop. The old one-NIC bootstrap remains a separate missing-harness boot smoke. From bcf555cea2898446577e2e258a8d4c60a20364af Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Sun, 18 Oct 2026 23:11:14 +0500 Subject: [PATCH 15/21] chore: relock after merging main --- docs/progress/chr_ci.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/progress/chr_ci.md b/docs/progress/chr_ci.md index f45b425..500178f 100644 --- a/docs/progress/chr_ci.md +++ b/docs/progress/chr_ci.md @@ -12,3 +12,11 @@ The offline acceptance tests cover workflow ordering, the always-run cleanup, artifact allowlisting, and credential masking/environment-file output. No local QEMU, router, or credentialed service was used for this change; the real CHR template job remains the external integration check. + +The user's refresh sequence was executed on b/workstream-b: save the fix as wip, +fetch origin, merge origin/main (already included), restore main's pyproject.toml, +.gitignore, LICENSE, .gitattributes and uv.lock, then run uv lock, uv sync +--all-packages and uv run pytest -m "not live". All 222 selected tests passed; +three live tests were deselected. Regenerating from main reproduced the existing +B lockfile, so there is no effective lockfile diff and no extra merge commit. +Main's four required root files remain byte-identical. From 1c13c85b004882e2193fb1cdfc4834a434814f18 Mon Sep 17 00:00:00 2001 From: techieworld2 Date: Mon, 19 Oct 2026 00:51:46 +0500 Subject: [PATCH 16/21] feat: integrate merged API and detector runtime --- .github/workflows/ci.yml | 10 +- apps/web/README.md | 12 +- apps/web/app/globals.css | 19 + apps/web/components/dashboard.tsx | 51 +- apps/web/components/demo-panel.tsx | 58 +- apps/web/components/incident-detail.tsx | 51 +- apps/web/components/incident-list.tsx | 15 +- apps/web/components/latency-chart.tsx | 6 +- apps/web/components/shell.tsx | 48 +- apps/web/decision.md | 10 +- apps/web/e2e/dashboard.spec.ts | 11 +- apps/web/e2e/live-mode.spec.ts | 333 ++++++- apps/web/e2e/runtime-contract.spec.ts | 69 ++ apps/web/flow.md | 12 +- apps/web/lib/generated/openapi.d.ts | 896 ++++++++++++++++++ apps/web/lib/transport.ts | 465 ++++++--- apps/web/lib/types.ts | 19 +- apps/web/package.json | 1 + apps/web/playwright.api.config.ts | 38 + data/sites.yaml | 9 + decision.md | 42 + docs/RUNTIME_INTEGRATION_VALIDATION.md | 40 + docs/SETUP.md | 31 +- docs/progress/head.md | 26 + docs/progress/runtime_detector.md | 7 + docs/progress/runtime_simgen.md | 24 + docs/progress/runtime_ui.md | 11 + eval/api_demo.py | 38 + eval/results/runtime.md | 60 ++ eval/runtime_canary.py | 104 ++ flow.md | 20 + packages/detector/README.md | 13 +- packages/detector/decision.md | 1 + packages/detector/flow.md | 2 + packages/detector/pyproject.toml | 1 + .../detector/src/netcortex_detector/engine.py | 93 +- .../src/netcortex_detector/preparation.py | 9 +- .../src/netcortex_detector/providers.py | 331 ++++++- .../src/netcortex_detector/runtime.py | 40 + packages/detector/tests/test_engine.py | 185 +++- packages/detector/tests/test_runtime_cli.py | 23 + .../detector/tests/test_runtime_inference.py | 112 +++ .../detector/tests/test_runtime_startup.py | 37 + packages/simgen/README.md | 4 + packages/simgen/decision.md | 1 + packages/simgen/flow.md | 7 +- .../src/netcortex_simgen/resources/sites.yaml | 9 + .../simgen/src/netcortex_simgen/simulator.py | 338 ++++++- .../simgen/tests/test_runtime_injection.py | 80 ++ packages/simgen/tests/test_runtime_safety.py | 196 ++++ 50 files changed, 3673 insertions(+), 345 deletions(-) create mode 100644 apps/web/e2e/runtime-contract.spec.ts create mode 100644 apps/web/lib/generated/openapi.d.ts create mode 100644 apps/web/playwright.api.config.ts create mode 100644 docs/RUNTIME_INTEGRATION_VALIDATION.md create mode 100644 docs/progress/runtime_detector.md create mode 100644 docs/progress/runtime_simgen.md create mode 100644 docs/progress/runtime_ui.md create mode 100644 eval/api_demo.py create mode 100644 eval/results/runtime.md create mode 100644 eval/runtime_canary.py create mode 100644 packages/detector/src/netcortex_detector/runtime.py create mode 100644 packages/detector/tests/test_runtime_cli.py create mode 100644 packages/detector/tests/test_runtime_inference.py create mode 100644 packages/detector/tests/test_runtime_startup.py create mode 100644 packages/simgen/tests/test_runtime_injection.py create mode 100644 packages/simgen/tests/test_runtime_safety.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42ad250..926bb39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,13 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 22 + - uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + - name: Install merged API for browser contract tests + run: | + uv python install 3.12 + uv sync --all-packages --locked - name: Run web checks when the app exists shell: bash run: | @@ -54,7 +61,7 @@ jobs: const p = JSON.parse( fs.readFileSync('apps/web/package.json', 'utf8') ); - for (const script of ['lint', 'typecheck', 'build', 'test:e2e', 'test:e2e:live']) { + for (const script of ['lint', 'typecheck', 'build', 'test:e2e', 'test:e2e:live', 'test:e2e:api']) { if (!p.scripts?.[script]) { throw new Error(`Missing required npm script: ${script}`); } @@ -81,6 +88,7 @@ jobs: npx playwright install --with-deps chromium npm run test:e2e npm run test:e2e:live + npm run test:e2e:api - name: Keep browser failure diagnostics if: failure() uses: actions/upload-artifact@v4 diff --git a/apps/web/README.md b/apps/web/README.md index 946a368..3b82600 100644 --- a/apps/web/README.md +++ b/apps/web/README.md @@ -1,6 +1,6 @@ # NetCortex web dashboard -Next.js App Router dashboard for the NetCortex operator. It supports a deterministic local fixture mode and a live API mode. +Next.js App Router dashboard for network operators. It supports local fixture mode and the merged FastAPI contract. ## Run locally @@ -11,8 +11,12 @@ $env:NEXT_PUBLIC_API_MODE = 'mock' npm run dev ``` -Use `NEXT_PUBLIC_API_MODE=live` and `NEXT_PUBLIC_API_BASE_URL` to connect to Aun's API. Live mode calls the draft routes in `decision.md`; request timeouts and errors appear in the UI and never switch to fixtures. Those API payload types remain provisional until Aun publishes OpenAPI and shared contracts. The fixture values and CHR outcomes are invented demo records; the UI labels them “Demo: replayed data.” Mock approval simulates workflow states in browser memory only. No router is contacted. Customer messages remain English or Urdu text. +For the API, set `NEXT_PUBLIC_API_MODE=live` and `NEXT_PUBLIC_API_BASE_URL` to the service origin. The app reads `/health` to distinguish a live operation from saved `DEMO_MODE` replay. API replay is read only for scenario injection; its incident approvals update the saved snapshot. Live injection targets the API simulator and approval can run the approved commands against the connected CHR. Requests have finite timeouts and visible errors; a failed API call never falls back to local fixtures. -`NEXT_PUBLIC_SENTRY_DSN` enables browser monitoring; server monitoring reads `SENTRY_DSN`. No DSN is committed. Sentry setup is code-ready but not connected or verified without the project DSN. +Live payloads use generated `lib/generated/openapi.d.ts` types and explicit adapters in `lib/transport.ts`. Fields absent from the API, such as site location and subscriber totals, display as unavailable. Incident details render the nested report, fix plan, timeline and English/Urdu customer messages. Metric values and forecast bands are joined by timestamp. Metric views refresh every 30 seconds and named stream events trigger an immediate refresh. -For production, run `npm run build` then `npm run start -- --hostname 0.0.0.0 --port 3000`. Render should run the app as a Node web service, not a static export. When Aun publishes the schema, run `$env:OPENAPI_URL = 'http://…/openapi.json'; npm run api:types`. The generator requires that URL, uses a bounded fetch, and writes `lib/generated/openapi.d.ts`. No generated API types are included until the actual schema is available. +Run `npm run test:e2e` for fixture browser coverage, `npm run test:e2e:live` for HTTP failure/stream contract mocks, and `npm run test:e2e:api` for browser coverage against the saved API replay. The API replay test starts a private in-memory snapshot service and needs no database, Temporal, model provider or router. + +`NEXT_PUBLIC_SENTRY_DSN` enables browser monitoring; server monitoring reads `SENTRY_DSN`. No DSN is committed, and monitoring is not claimed as connected or verified without the project DSN. + +For production, run `npm run build` and `npm run start -- --hostname 0.0.0.0 --port 3000`. Render should run the app as a Node service, not a static export. Regenerate API types from an authorized running API using `OPENAPI_URL=/openapi.json npm run api:types`. diff --git a/apps/web/app/globals.css b/apps/web/app/globals.css index 3eb7216..db32010 100644 --- a/apps/web/app/globals.css +++ b/apps/web/app/globals.css @@ -464,6 +464,9 @@ select:focus-visible { background: #ec7177; box-shadow: 0 0 8px #ec717755; } +.health-unknown { + background: #74838d; +} .site-health-label { font-size: 10px; color: #9eacb3; @@ -882,6 +885,22 @@ select:focus-visible { color: #c5d1d5; margin: 19px 0; } +.customer-messages { + border-top: 1px solid #27343d; + margin-top: 18px; + padding-top: 14px; +} +.customer-messages h3 { + color: #a9bac2; + font-size: 11px; + margin: 0 0 8px; +} +.customer-messages p { + color: #d3dfe3; + font-size: 13px; + line-height: 1.7; + margin: 8px 0; +} .evidence-block { border-top: 1px solid #283740; padding-top: 14px; diff --git a/apps/web/components/dashboard.tsx b/apps/web/components/dashboard.tsx index b36ed17..ce4bad7 100644 --- a/apps/web/components/dashboard.tsx +++ b/apps/web/components/dashboard.tsx @@ -47,14 +47,16 @@ export function Dashboard() { [error, setError] = useState(""); const refresh = async () => { try { - const [s, i, m] = await Promise.all([ + const [siteRows, i] = await Promise.all([ transport.sites(), transport.incidents(), - transport.metrics("north-tower"), ]); - setSites(s); + const metrics = siteRows.length + ? await transport.metrics(siteRows[0].id) + : []; + setSites(siteRows); setIncidents(i); - setSeries(m); + setSeries(metrics); setError(""); } catch (e) { setError(e instanceof Error ? e.message : "Could not load network data."); @@ -62,12 +64,14 @@ export function Dashboard() { }; useEffect(() => { const timer = window.setTimeout(() => void refresh(), 0); + const interval = window.setInterval(() => void refresh(), 30000); const unsubscribe = transport.subscribe( () => void refresh(), () => void refresh(), ); return () => { window.clearTimeout(timer); + window.clearInterval(interval); unsubscribe(); }; }, []); @@ -76,12 +80,9 @@ export function Dashboard() { ); return (
- +
- Updating every minute{" "} + Refreshing every 30 seconds{" "}
@@ -98,7 +99,7 @@ export function Dashboard() {
Sites monitored - {sites.length} of 3 + {sites.length} connected
@@ -168,7 +169,9 @@ export function Dashboard() { ? "Operational" : s.health === "degraded" ? "Degraded" - : "Down"} + : s.health === "down" + ? "Down" + : "Unknown"}