Skip to content

The platform for continuously improving AI agents.

Re-land Overwatch product insights with deployment keys (#261)

Pritam Soni180500bd7c9a
diff --git a/.env.example b/.env.example
index 60ef1d66..f87e5eb1 100644
--- a/.env.example
+++ b/.env.example
@@ -45,11 +45,21 @@ OPENAI_API_KEY=
FRONTEND_URL=http://localhost:5173
-# Optional. MCP analytics: the server sends $mcp_* events to this PostHog project.
+# Optional. Existing core MCP telemetry uses this PostHog project.
# Empty disables it. Unset, hosted deployments (Clerk, not DEBUG) use the Overmind
# project's token from settings.py. Project token (phc_...) from PostHog project settings.
POSTHOG_PROJECT_TOKEN=
POSTHOG_HOST=https://eu.i.posthog.com
+# Optional read-only PostHog query access for Overwatch product usage and conversion insights.
+# Use a personal or project secret key with project query read permission.
+POSTHOG_PERSONAL_API_KEY=
+POSTHOG_PROJECT_ID=
+# Private API host (EU: https://eu.posthog.com, US: https://us.posthog.com).
+POSTHOG_API_HOST=https://eu.posthog.com
+
+# Overwatch Slack runs in the Overlord repository. This server only exposes reads.
+# Dedicated service key, distinct from SALES_DASHBOARD_TOKEN. Generate: openssl rand -hex 32
+OVERWATCH_SERVICE_TOKEN=
# ─── Stripe billing ─────────────────────────────────────────────────
# Set STRIPE_SECRET_KEY to inject remaining-credit billing (cloud). Leave it
@@ -66,9 +76,9 @@ STRIPE_PRO_PRICE_ID=price_1TvfC1CgXbweROl8gtGzCSV6
# price_1TxoTvCgXbweROl8s9G4WsfI (product prod_UxjxGrapXS061n).
STRIPE_CREDIT_PRICE_ID=price_1TxoWdCjF8jVtWKgOWHw2oFE
-# ─── Internal sales dashboard ──────────────────────────────────────
-# Bearer token for the cross-tenant GET /api/internal/sales/* endpoints.
-# Empty disables them. Generate with: openssl rand -hex 32
+# ─── Internal Overwatch user insights ───────────────────────────────
+# Existing bearer token for /api/internal/overwatch/* (legacy env var name).
+# Empty disables the endpoints. Generate with: openssl rand -hex 32
SALES_DASHBOARD_TOKEN=
# ─── AWS (optional — needed for Textract OCR and Comprehend PII) ─────
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index db9eb2f2..36174983 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -15,6 +15,26 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
+ overwatch:
+ if: github.event_name == 'push' || github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: sales-dashboard
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: oven-sh/setup-bun@v2
+ with:
+ bun-version: "1.4.2"
+ - run: bun install --frozen-lockfile
+ - run: bun audit --audit-level=high
+ - run: bun run lint
+ - run: bun run typecheck
+ - run: bun run test
+ - run: bun run build
+
lint:
if: github.event_name == 'push' || github.event.pull_request.draft == false
runs-on: ubuntu-latest
diff --git a/.github/workflows/deploy-sales-frontend.yml b/.github/workflows/deploy-sales-frontend.yml
index c648633c..f35f57aa 100644
--- a/.github/workflows/deploy-sales-frontend.yml
+++ b/.github/workflows/deploy-sales-frontend.yml
@@ -1,10 +1,9 @@
-name: Deploy Sales Frontend
+name: Deploy Overwatch User Insights
on:
workflow_dispatch:
- push:
- branches: [main]
- paths-ignore:
- - "*.md"
+ # Ships with the production API (deploy-api.yml); main only reaches staging.
+ release:
+ types: [published]
permissions:
contents: read
@@ -14,7 +13,7 @@ concurrency:
cancel-in-progress: false
jobs:
- deploy-sales-frontend:
+ deploy-overwatch:
runs-on: ubuntu-latest
defaults:
run:
@@ -36,8 +35,7 @@ jobs:
restore-keys: |
${{ runner.os }}-bun-sales-
- # Runs alongside the Console's production deploy; sales-dashboard/.env.production
- # holds the API it reads.
+ # sales-dashboard/.env.production holds the API it reads.
- run: bun install --frozen-lockfile
- run: bun run build --mode production
diff --git a/AGENTS.md b/AGENTS.md
index 267c4b3d..68f57c61 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -61,7 +61,7 @@ Each line is the invariant; the named skill section carries the mechanics.
- Tenancy is project-scoped, no org layer. Auth is Clerk when `CLERK_API_SECRET_KEY` is set; blank secret plus Console `VITE_SELF_HOSTED=true` uses local JWT: email/password (`POST /api/auth/local/`, create-on-first-use, no verification) only. ChatGPT login, account linking and credentials are removed. A guest holds one project and can only read and claim; a view that accepts guest writes opts in with `guest_allowed = True` — never a permission class or middleware. API keys are `scope=account` or `scope=project`. MCP `create_api_key` mints one with the Console dialog's name, description and expiry (30, 90, 180, 365 days or never). Omitting `project_id` mints an account key; passing it mints a project key. The plaintext is returned once, and a project key cannot mint an account key. Detail: backend-architecture § Auth and tenancy.
-- `GET /api/internal/sales/{overview,funnel,accounts,accounts/<id>}/` are cross-tenant sales metrics behind one static bearer token, `SALES_DASHBOARD_TOKEN`. `overbae/urls.py` registers them only when that token is set at import; `tests/settings.py` sets one. Each path and query is computed at most once an hour (Django cache), and responses carry `computed_at`/`refreshes_at`. They run no user authentication, stay out of MCP and the OpenAPI schema, and exclude guests and guest-only projects (`services/sales_metrics.py`). `sales-dashboard/` is their standalone Vite app: it imports the Console's `styles.css`, `public/` and `components/ui` through the `@` alias (keep those primitives free of app-level imports), stores the token in localStorage, and `bun run dev` proxies `/api` to `SALES_API_PROXY` (default `http://localhost:8000`).
+- The Overwatch user insights dashboard endpoints use `/api/internal/overwatch/*`, gated by the existing `SALES_DASHBOARD_TOKEN` environment variable (legacy name retained for deployment compatibility). They are registered only when the token is set at import; `tests/settings.py` sets one. Each path and query is computed at most once an hour (Django cache), and responses carry `computed_at`/`refreshes_at`. They run no user authentication, stay out of MCP and the OpenAPI schema, and exclude guests and guest-only projects. The source directory remains `sales-dashboard/` because the deployment workflow and Pages project use that path; the user-facing name is Overwatch. It imports the Console's `styles.css`, `public/` and `components/ui` through the `@` alias (keep those primitives free of app-level imports), keeps the admin token in sessionStorage for 30 minutes, clears legacy localStorage tokens, and `bun run dev` proxies `/api` to `SALES_API_PROXY` (default `http://localhost:8000`). Optional PostHog aggregate insights require a project-query read key and project ID in the backend environment; keep the key server-side and return validated aggregate event counts only. Responses prohibit browser/shared caches. Internal reads have SQL and report time budgets. Overwatch must only read product records: no product database models, migrations, notification ledger, periodic writer or event emitter. Notification state belongs in Overwatch storage outside this backend; archived prototypes under docs/proposals are not executable code. Shared backend dependency upgrades require a separate platform review. Slack Q&A runs as a separate profile in the Overlord repository using its shared engine; the standalone backend Slack/model adapter is archived, with no active routes or Celery tasks. `POST /api/internal/overwatch/agent/query/` uses a dedicated `OVERWATCH_SERVICE_TOKEN`, rejects dashboard/product/staff credentials, validates five bounded read tools, and enforces a PostgreSQL read-only transaction. POST keeps customer email arguments out of URL logs. The service key cannot authenticate product writes. The Slack profile requires its own app/workspace credentials, an explicit user ID allowlist and a linked unrestricted internal employee; HR admins do not bypass it. Customer reports terminate locally in private replies without returning records to the model. Overwatch must not use Overlord HR tools, conversation storage, extraction or training traces. Direct Anthropic use is disabled by default and needs an approved data/retention policy.
- Compute estimates use live provider rates with fetch timestamps and durable worker usage receipts; they never create ledger charges. Training forecasts use compatible completed execution measurements, with evidence, uncertainty and missing components explicit. Current GPU hourly rates remain visible when duration and total cost are unmeasured; one quote uses one fetched rate snapshot. Native progress reports elapsed time and a remaining-time range rather than a single countdown or finish timestamp. Detail: backend-architecture § Native decision training.
diff --git a/docs/branch-cleanup.md b/docs/branch-cleanup.md
deleted file mode 100644
index a7b79c10..00000000
--- a/docs/branch-cleanup.md
+++ /dev/null
@@ -1,81 +0,0 @@
-# Branch cleanup — 2026-10-12
-
-The Ponytail sweep compared `codex/general-decision-training` with merge base
-`5a0bd483e1800477ad0905e0bc43a359893d6a35`. The pre-cleanup snapshot is
-`63caac868ac9fc1cf6b66525f029e84e1b90a0de`.
-
-| Measure | Before | After |
-| ------------------- | ------: | ------: |
-| Added lines | 242,872 | 82,514 |
-| Deleted lines | 21,790 | 22,500 |
-| Total changed lines | 264,662 | 105,014 |
-| Net growth | 221,082 | 60,014 |
-
-Total changed lines fell by approximately 61%. Counts include the compact
-replacement documentation; line count was not a stopping condition.
-
-## Removed
-
-- Generated JSON receipts, screenshots, local probes and one-off replay scripts
- from `tests/evidence/`; superseded experiment notes and six unreferenced manual
- frontend harness files. All 352 files were copied to ignored
- `scratch/branch-cleanup-2026-10-12/` and verified against their original SHA-256
- content. They also remain recoverable from the pre-cleanup commit.
-- Unused frontend exports, the superseded synchronous inference helper, unused
- serializers and scoring/preparation helpers, and obsolete in-memory sampling
- and provenance implementations. Their reference checks included tests and
- configuration; dynamic framework entry points were retained.
-- Unused `datasketch`, `langdetect` and `rapidfuzz` dependencies and lock entries.
-
-Historical Banking77, SST-5 and BoolQ results and their frozen protocol remain in
-[the benchmark record](decision-benchmarks.md). Provenance and mixed-target tests
-now exercise production file-lineage and sampling-profile services.
-
-## Runtime simplification
-
-- Experiment preparation verifies and scans each shared source once per attempt,
- reusing its frozen metadata across model variants. Two variants sharing train
- and development data now issue two cell reads instead of four. Changed files
- still fail preparation; no cache survives an attempt.
-- Evaluation monitoring calibrates predictions in batches of at most 256 rows,
- using the indexed participant/key cursor. A 513-row regression covers multiple
- batches, invalid predictions, retained raw probabilities and repeat refreshes.
- Summary aggregation reads each participant's predictions once instead of three
- times; a differential check matched the previous results across 10,000 samples.
- A non-unique input-hash index speeds external prediction matching while keeping
- duplicate observations.
-- Monitoring overviews no longer deep-copy freshly loaded metric receipts before
- removing paginated fields. REST/MCP evidence pagination tests retain the full
- stored values and checksums.
-- Seven MCP modules use the installed async adapter directly. Dataset resolution
- delegates directly to the shared resolver; UUID parsing has one implementation.
- Project filters, error conversion and thread-sensitive database access remain.
-- Nine live charts share one renderer with their existing labels, colours,
- numeric formatting, checkpoint markers and empty states. The duplicated Discord
- SVG now lives in the shared icon registry.
-
-## Preserved and verified
-
-The cleanup leaves generated API clients, database migrations, the SDK, training
-assets and pinned GPU worker sources unchanged. It does not remove product
-features, contract checks, billing, cancellation or error handling. Similar code
-with different selection, authorization or probability semantics was not merged
-merely to shorten it. Static scans do not prove that no future simplification is
-possible.
-
-- Backend: 4,386 passed, 10 skipped; 319 MCP tests passed after the final
- reference-helper consolidation. All 15 native evaluation tests passed after
- the final aggregation/index changes.
-- End-to-end journeys: 76 passed against local ASGI, Celery, Postgres and Redis;
- the three native benchmark journeys also passed after the final query changes,
- covering REST, MCP and Console progress, samples and historical backfill.
-- Frontend: 894 passed; final icon registry: 113 passed. Type checking, lint and
- design checks passed.
-- SDK: 591 passed. Backend lint/format and lock consistency checks passed.
-- Required pre-commit checks and `git diff --check` passed.
-
-External providers are faked in automated tests. No live GPU training, hosted
-deployment or production write was part of this cleanup.
-
-Backend skips cover absent Torch/Truss packages and opt-in Docker/Redis fixtures.
-The journey suite supplies its own local Redis/worker integration checks.
diff --git a/docs/decision-benchmarks.md b/docs/decision-benchmarks.md
deleted file mode 100644
index 3f94a12b..00000000
--- a/docs/decision-benchmarks.md
+++ /dev/null
@@ -1,94 +0,0 @@
-# Decision benchmark results
-
-Three full training epochs; fixed recipe and last-checkpoint selection. Accuracy and probability metrics use complete official held-out splits. The base is an unchanged foundation with its initialized decision head, not a prompted chat classifier.
-
-| Benchmark | Participant | Accuracy | Macro F1 | Raw cross entropy | Calibrated cross entropy | Raw Brier | Scored |
-| --------- | -------------------- | -------: | -------: | ----------------: | -----------------------: | --------: | -----: |
-| banking77 | Qwen3 0.6B base | 12.27% | 0.0885 | 4.3256 | 3.9926 | 0.9865 | 3,080 |
-| banking77 | Qwen3 0.6B trained | 92.66% | 0.9266 | 0.3676 | 0.2730 | 0.1170 | 3,080 |
-| banking77 | Qwen3.5 0.8B base | 8.83% | 0.0526 | 4.3333 | 4.2006 | 0.9867 | 3,080 |
-| banking77 | Qwen3.5 0.8B trained | 93.57% | 0.9356 | 0.3817 | 0.2583 | 0.1096 | 3,080 |
-| banking77 | Jev 1.13 | 80.29% | 0.7952 | 1.8732 | 0.9391 | 0.2989 | 3,080 |
-| sst5 | Qwen3 0.6B base | 20.18% | 0.1045 | 1.6086 | 1.6091 | 0.7997 | 2,210 |
-| sst5 | Qwen3 0.6B trained | 55.75% | 0.5472 | 1.4181 | 1.0341 | 0.6830 | 2,210 |
-| sst5 | Qwen3.5 0.8B base | 29.41% | 0.2116 | 1.6087 | 1.6094 | 0.7997 | 2,210 |
-| sst5 | Qwen3.5 0.8B trained | 54.30% | 0.5313 | 1.4195 | 1.0484 | 0.6981 | 2,210 |
-| sst5 | Jev 1.13 | 58.64% | 0.5547 | 2.0028 | 1.1108 | 0.5958 | 2,210 |
-| boolq | Qwen3 0.6B base | 62.17% | 0.3834 | 0.6881 | 0.6643 | 0.4949 | 3,270 |
-| boolq | Qwen3 0.6B trained | 82.75% | 0.8143 | 0.7254 | 0.4129 | 0.3110 | 3,270 |
-| boolq | Qwen3.5 0.8B base | 60.86% | 0.4608 | 0.6905 | 0.6633 | 0.4974 | 3,270 |
-| boolq | Qwen3.5 0.8B trained | 84.16% | 0.8296 | 0.6589 | 0.3889 | 0.2825 | 3,270 |
-| boolq | Jev 1.13 | 91.53% | 0.9108 | 0.2367 | 0.2332 | 0.1339 | 3,270 |
-
-The constant-label baseline selects the most frequent training label, then scores the unchanged final split: banking77 1.30%; sst5 23.08%; boolq 62.17%. Label-selection receipts and checksums are in the archived run evidence.
-
-| Benchmark | Trained model | Gain over own base | Difference from Jev |
-| --------- | -------------------- | -----------------: | ------------------: |
-| banking77 | Qwen3 0.6B trained | +80.39 pp | +12.37 pp |
-| banking77 | Qwen3.5 0.8B trained | +84.74 pp | +13.28 pp |
-| sst5 | Qwen3 0.6B trained | +35.57 pp | -2.90 pp |
-| sst5 | Qwen3.5 0.8B trained | +24.89 pp | -4.34 pp |
-| boolq | Qwen3 0.6B trained | +20.58 pp | -8.78 pp |
-| boolq | Qwen3.5 0.8B trained | +23.30 pp | -7.37 pp |
-
-BoolQ final evaluation uses the complete public validation split. Training excludes text/passage groups overlapping reserved splits. All duplicate final observations are retained. Calibration uses its own frozen rows and never changes the training recipe. One seed does not estimate training-run variance; pretraining exposure to these public benchmarks is unknown. Recorded provider usage is not an all-in invoice. Full metrics, intervals, coverage, fits, costs and provider identities remain in the archived run evidence.
-
-## Recorded protocol
-
-- Train Qwen/Qwen3-0.6B and Qwen/Qwen3.5-0.8B separately on each benchmark.
-- Compare the unchanged foundation decision head, trained decision model, and
- `typesafe/jev-1.13`. The foundation baseline is not a prompted chat classifier.
-- Use every official test example for Banking77 (3,080) and SST-5 (2,210).
- BoolQ uses all 3,270 labeled validation examples as final evaluation because its
- public dataset has no labeled test split.
-- Retain original labels, duplicate observations, exact option order, source
- revision, file checksums, original split and row identities. Banking77 uses the
- complete JSONL mirror, not the deduplicated Parquet mirror.
-- Group normalized identical text for Banking77/SST-5 and normalized identical
- passages for BoolQ. Keep final examples unchanged; exclude lower-priority
- overlapping groups from training/development, retaining exclusion evidence in
- an earlier Workshop cell. SST-5's official validation split supplies development.
-- Reserve approximately 10% of original training data for development and 10%
- for calibration for Banking77/BoolQ. SST-5 reserves 10% of training for
- calibration and uses its official development split. Group-preserving split
- allocation uses seed 73491. No final labels select recipes or checkpoints.
-- Recipe: three complete epochs, effective batch 16, learning rate 0.0002,
- LoRA rank 16 / alpha 32 / dropout 0, training seed 0, context 4096, maximum
- provider runtime 10,800 seconds. No optimizer-step cap. Monitor each epoch and
- select the last checkpoint. Keep the initial development baseline enabled.
-- Fit Clef temperature calibration only on the calibration role, separately per
- participant. Report raw accuracy, cross entropy, Brier, coverage and available
- paired uncertainty, plus calibrated probability metrics. One training seed
- does not measure training-run variance. Public benchmark pretraining exposure
- for foundations and Jev is unknown.
-
-Before launch, verify labels/options and split identities across all exported
-rows, exact tokenization readiness, frozen source boundaries, cost forecasts,
-and the current pinned worker release. Verify checkpoint reload and full final
-coverage after training. Preserve failed attempts and repair their causes before
-retesting; do not silently replace participant models or benchmark rows.
-
-Concrete failure checks: altered mirror row counts; wrong class-index mapping;
-target fields entering model inputs; cross-role duplicate/group leakage; lost
-duplicate observations; context truncation; incomplete tokenization; unstable
-provider submission; checkpoint reload mismatch; missing/invalid probabilities;
-evaluation rows dropped; unreported versus measured costs.
-
-Sources: [Banking77](https://huggingface.co/datasets/PolyAI/banking77),
-[Banking77 JSONL mirror](https://huggingface.co/datasets/mteb/banking77),
-[SST-5](https://huggingface.co/datasets/SetFit/sst5),
-[BoolQ](https://huggingface.co/datasets/google/boolq).
-
-## Evidence and reproduction
-
-These are historical measurements from 2026-10-10, not results rerun by the cleanup.
-The original scripts and receipts remain recoverable from commit
-`63caac868ac9fc1cf6b66525f029e84e1b90a0de` under `tests/evidence/`.
-Local copies were retained under ignored `scratch/branch-cleanup-2026-10-12/`.
-The receipts pin the source revisions, packages, cells, provider calls and model artifacts.
-
-For new measurements, use the current local MCP preparation, experiment and
-evaluation workflows with fresh request keys. `scripts/decision_benchmarks.py`
-converts downloaded source rows; `scripts/score_decision_benchmarks.py` scores
-saved predictions. Old local replay scripts contain project-specific identities
-and are not portable benchmark tooling.
diff --git a/docs/ocr-staging-benchmark.md b/docs/ocr-staging-benchmark.md
deleted file mode 100644
index 270ce438..00000000
--- a/docs/ocr-staging-benchmark.md
+++ /dev/null
@@ -1,112 +0,0 @@
-# Staging OCR benchmark
-
-Candidate: `35164343` (OCR with rolling-deployment compatibility, transfer language snapshots and unsupported-script provenance).
-
-Baseline: `51b7c2313719099fe48cc483f0ad7b89addb3350`. Fixed PDF samples retain the same bytes/checksums across variants. Runs are serial in one staging project. Candidate extraction reported a one-worker limit in staging; these timings therefore do not establish a staging speedup from parallel page execution. The underlying staging CPU/memory allocation was not independently measured. Each sample/variant has one observation; these are paired smoke measurements, not a production load or accuracy study.
-
-| Sample | Baseline landing | Candidate English | Automatic language | Cached automatic |
-| ------ | ---------------: | ----------------: | -----------------: | ---------------: |
-| 24-a | 17.137s | 12.865s | 16.107s | 4.592s |
-| 24-b | 19.390s | 13.439s | 21.395s | 4.751s |
-| 24-c | 28.086s | 16.461s | 30.940s | 4.699s |
-| 96 | 65.216s | 36.249s | 68.409s | 5.109s |
-
-The measurements support improved OCR performance: comparable English extraction
-took 25–44% less time across all four samples, reuse avoided every OCR page, and
-intermediate progress publications fell while completion was retained. The local
-worker comparison below separately demonstrates faster parallel extraction.
-
-For the 96-page sample, explicit English landing took 44.4% less time than the
-baseline, and cached automatic extraction took 92.5% less time than cold automatic
-extraction. The default automatic cold path took 4.9% more time than the old
-English-only baseline; automatic extraction also performs language-selection
-work. These observations do not isolate individual changes or control staging host
-allocation across deployments; they do not establish a speedup for every default
-cold import.
-
-## Output, cache and backend events
-
-| Variant | Sample | Rows | OCR worker limit | Reused pages | OCR progress events |
-| -------------- | ------ | ---: | ---------------: | ------------: | ------------------: |
-| baseline | 24-a | 52 | not recorded | not supported | 25 |
-| baseline | 24-b | 120 | not recorded | not supported | 25 |
-| baseline | 24-c | 242 | not recorded | not supported | 25 |
-| baseline | 96 | 570 | not recorded | not supported | 97 |
-| candidate-eng | 24-a | 52 | 1 | 0 | 5 |
-| candidate-eng | 24-b | 120 | 1 | 0 | 6 |
-| candidate-eng | 24-c | 242 | 1 | 0 | 7 |
-| candidate-eng | 96 | 570 | 1 | 0 | 16 |
-| candidate-auto | 24-a | 52 | 1 | 0 | 6 |
-| candidate-auto | 24-b | 120 | 1 | 0 | 8 |
-| candidate-auto | 24-c | 242 | 1 | 0 | 11 |
-| candidate-auto | 96 | 570 | 1 | 0 | 28 |
-| reused-auto | 24-a | 52 | 1 | 24 | 1 |
-| reused-auto | 24-b | 120 | 1 | 24 | 1 |
-| reused-auto | 24-c | 242 | 1 | 24 | 1 |
-| reused-auto | 96 | 570 | 1 | 96 | 1 |
-
-## Checks
-
-All four samples passed the same checks:
-
-- Baseline and candidate English: identical row counts, page coverage and ordered text hashes.
-- Cold and cached automatic extraction: every ordered row value matches, including regions and provenance, when compared in a fixed column order.
-- Cached automatic extraction: every page reused, with no pages newly OCR'd.
-
-Cold and cached imports expose different column order (`text, page` versus `page, text`), so their whole-file fingerprints differ. All six row fields, including source identity, page regions and recognition provenance, match in source-row order when compared with a fixed column order. Cache reuse preserves the extracted values; this benchmark does not claim identical file identity or column presentation. Complete backend event replays retain contiguous sequence numbers and terminal events, with no internal checkpoint payloads exposed.
-
-## Local parallelism check
-
-The same 96-page PDF was also extracted in a network-isolated local container limited to two CPUs and 2 GiB. This separates worker count from language selection; it is not a staging throughput claim.
-
-| Mode | One worker | Two workers |
-| --------- | ---------: | ----------: |
-| english | 28.351s | 17.165s |
-| automatic | 55.497s | 34.880s |
-| cached | 0.134s | 0.120s |
-
-## Retained source identities
-
-| Sample | SHA-256 |
-| ------ | ------------------------------------------------------------------ |
-| 24-a | `c03e4b1f3c36ef62f4a336f215034383aa5fb79db80ac1bdc6e76fd04032cc07` |
-| 24-b | `416604ab0fe65239c8dc81870f0bfa2228cac46bd7ee9dc33feeec4f0d74042a` |
-| 24-c | `fc2384c9c5f4ae64000a1e6747999cfa182144885eb948dd92b5db1d72a2e6cc` |
-| 96 | `c7cc5d7cc5413146ab610c68c67ee71dc437b6ebd62588d8cc7fe0819832d17a` |
-
-## Dataset receipts
-
-Staging project: `16563f1e-d63b-4225-a72d-19a2ebcc4577`. Dataset IDs are readable through staging MCP `inspect_dataset` and `get_job(kind=dataset_run)`; the account connection must remain bound to the staging endpoint.
-
-| Variant | Sample | Dataset |
-| -------------- | ------ | -------------------------------------- |
-| baseline | 24-a | `73c98dcd-f9ac-4ac8-9a79-0e98234829a7` |
-| baseline | 24-b | `35e1664d-7a31-4fb5-afa3-cbfeb25c82c3` |
-| baseline | 24-c | `0287302b-4c0b-4b7d-a9a8-454ea087b048` |
-| baseline | 96 | `9d090e5f-ea73-4cb6-86cf-9ee0133cf818` |
-| candidate-auto | 24-a | `2c43fff7-3edb-4632-bd59-0b110939f5ae` |
-| candidate-auto | 24-b | `ee93c5db-263e-4b81-b184-a6f34c20de4a` |
-| candidate-auto | 24-c | `a12d4724-6800-419a-9bca-f9f040352f03` |
-| candidate-auto | 96 | `a62e074a-1c4f-4d9c-8c19-cbc8393a7f0b` |
-| candidate-eng | 24-a | `4ff395ce-d812-42ea-bc2b-dad8cc7f29e0` |
-| candidate-eng | 24-b | `b2d435db-f9c1-413b-a0fa-80442c659a48` |
-| candidate-eng | 24-c | `31e514ee-82d3-428a-941d-adfe0b462a5f` |
-| candidate-eng | 96 | `dbb4b2a2-7ba6-4c27-9aac-5e21e6afdff4` |
-| reused-auto | 24-a | `99c39caa-dfbb-498c-955e-7f9d32cab509` |
-| reused-auto | 24-b | `40df17b6-443f-48d5-b81a-5d6644af4a19` |
-| reused-auto | 24-c | `84d2c15e-12e7-4388-a39d-5612df033f78` |
-| reused-auto | 96 | `0d6df44e-a9fe-4bce-8b98-63f267b3397f` |
-
-## Regressions found during staging
-
-The initial candidate lost MCP language preferences on the CLI transfer path. The corrected transfer snapshots preferences into both initial-import and append receipts, and repeated completion preserves them. Four policy/retry cases and the strengthened MCP/CLI/OCR journey passed.
-
-Automatic script detection also labelled two Spanish screenshots as Fraktur and rejected a whole PDF. Policy version 3 retains that unsupported guess, uses English for the first recognition pass and allows stronger text evidence to select a supported language. The exact failing screenshot is retained as a regression fixture. The final document/transfer regression run passed all 68 tests; a local two-CPU/2 GiB check completed all 96 pages in explicit English, automatic and cached modes with exact cached-row equality. Earlier policy-version-2 timings are diagnostic only and excluded from the tables above.
-
-Staging rollout: [GitHub Actions run 39213207362](https://github.com/overmind-core/overmind/actions/runs/39213207362). The full application image and every service passed the ordered deployment health gates.
-
-## Measurement scope
-
-Landing seconds come from durable admission start/finish timestamps and exclude queue delay and client polling. OCR-only seconds, client-observed time and queue delay remain in each result receipt. Event counts come from complete backend SSE replays; they measure publications, not a direct PostgreSQL query count. Internal checkpoint payloads must not appear in those events. Language changes may legitimately change automatic-mode OCR text; they do not establish better accuracy without labelled evidence. The benchmark does not exercise concurrent tenants, forced worker crashes or large-file memory limits. Recovery and project isolation have local regression coverage; large-file memory stress was not performed.
-
-No production deployment, training, evaluation or inference is part of this benchmark.
diff --git a/docs/training-monitoring-validation.md b/docs/training-monitoring-validation.md
deleted file mode 100644
index 1321ce9c..00000000
--- a/docs/training-monitoring-validation.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# Training monitoring validation
-
-## Failure contracts recorded before implementation
-
-- Invalid, unknown, contradictory or unsupported monitoring configuration must
- not be silently accepted or clamped.
-- Duplicate visits and protected groups must survive probe selection; a frozen
- sample must not change as scheduling adapts or a worker restarts.
-- Validation/checkpoint time must not inflate measured optimiser step duration.
-- Slow checks must not create a queue of overdue checks. Overhead conflicts must
- remain visible without silently shrinking samples or removing metrics.
-- Generated outputs must use input-only prompts; failed generations and invalid
- labels must remain in coverage and cannot be scored as successful examples.
-- Check records must survive poll duplication, restart, cancellation and partial
- publication. Failed scorer construction must not remain pending indefinitely.
-- Development evidence must not be mistaken for final-test evidence; selection
- and early stopping cannot use unavailable/non-finite metrics.
-- Checks/checkpoints must remain project scoped and passive reads must not call
- providers. Cancellation must preserve already completed evidence.
-- The old job and its immutable launch record must remain unchanged.
-
-## Local verification
-
-Use the repository uv development/test environment and local test database. Tests
-replace provider calls; they are not evidence of a live GPU qualification.
-
-Initial command:
-
-```sh
-uv run pytest tests/test_training_monitoring.py -q
-```
-
-Live qualification uses the fresh $100 allowance authorised on 2026-10-10,
-separate from earlier testing. Native mixed-target training completed three times;
-the latest run retains sample weights and reproduces the prior loss values and
-all checkpoint probability vectors exactly. Structured-output training succeeded
-with development checks and checkpoint verification; its deployment is ready but
-was not activated. The first Qwen3.5-4B qualification failed with GPU memory
-exhaustion after the initial check. The repaired GPU retest completed eight updates,
-all 44,800 final development rows and four reload-verified checkpoints. The provider
-reports success; artifact registration is separate. Loss fell substantially but
-the small generated-output probe remains poor, demonstrating the importance of
-coverage and task metrics alongside loss. The full original-data relaunch is now
-submitted as `d41d3526-d703-499b-aaee-663c2da0908d`, with adaptive monitoring and a
-two-hour provider limit. The original cancelled job is unchanged.
-
-Exact recipes, commands, observed metrics, failures and qualification limits are
-recorded in the historical `tests/evidence/training-monitoring-implementation-2026-10-10.md`
-in commit `63caac868ac9fc1cf6b66525f029e84e1b90a0de`.
-CPU qualification does not substitute for model-family GPU verification.
diff --git a/docs/workshop-ocr.md b/docs/workshop-ocr.md
deleted file mode 100644
index 9e4b73d2..00000000
--- a/docs/workshop-ocr.md
+++ /dev/null
@@ -1,102 +0,0 @@
-# OCR extraction
-
-PDF and PNG/JPEG/WebP landing runs in the isolated document sandbox. OCR uses
-English by default. A native coding agent can set
-`update_dataset(dataset=..., ocr_languages=["eng", "fra"])` on a draft before
-uploading source bytes. REST uses `PATCH /api/datasets/{id}/` with the same field.
-An empty list uses English; null and unsupported codes fail. Settings affect
-subsequent imports. Published cells and settings pinned by an existing import
-receipt do not change.
-
-Recognition uses the requested languages in one pass, without script guessing or
-text-based language detection. Tesseract still handles page orientation. Requested
-and actual languages and trained-data checksums remain in extraction provenance.
-Non-English and mixed-language documents need explicit supported language choices
-and quality review. Missing requested language data fails without publishing a
-partial source. No provider calls or downloaded models run during extraction.
-
-## Parallelism and bounds
-
-`SANDBOX_OCR_WORKERS` defaults to two and is capped at four, the container CPU
-quota, and the extraction memory reservation. The scheduler reserves 768 MiB for
-the parser and budgets 512 MiB per page worker. Each spawned process owns its
-PDFium document and raster; native handles are never shared across threads.
-At most one outstanding page per worker is submitted. Results are assembled in
-page order, independent of completion order. Native text is masked before OCR.
-
-The existing sandbox watchdog enforces combined process-tree RSS and scratch use,
-CPU and wall deadlines, UID isolation, and process-group teardown on disconnect.
-Raster pixel limits and per-page recognition timeouts remain enforced. Memory
-budgeting is conservative admission, not a promise that arbitrary malformed PDFs
-will fit; exceeding the measured limit fails without publishing a partial source.
-
-## Durable checkpoints
-
-Completed pages stream as bounded internal checkpoint frames to the application.
-They are never published in dataset events. The application validates their shape,
-size and checksum before storing them in `DocumentExtractionPage`, scoped to the
-project. The sandbox receives only that project's applicable checkpoints with the
-source bytes; it has no database credentials or shared media access.
-
-Identity covers the document checksum, requested language policy, Tesseract
-version and trained-data hashes, parser/library versions, rendering/masking
-settings and extraction implementation version. Actual languages and model identities are retained in each completed page. Renaming a source does not
-invalidate OCR; evidence binds the current source filename during final assembly.
-Changed source bytes, language preferences or extraction identity cannot reuse
-old OCR results. This cache skips recognition, not native PDF parsing.
-
-Each checkpoint is limited to 900 KiB. Checkpoint transfer is bounded to 128 MiB;
-additional pages are recomputed. The sandbox includes checkpoint transfer expansion
-in memory admission. Interrupted work can reuse completed pages; a page interrupted
-before its checkpoint reaches the application is recomputed. No partial dataset is
-published. Cancellation still fences publication and never implies that a remote
-process has already stopped.
-
-Checkpoints expire after 30 days. The existing import reconciler deletes up to
-1,000 expired pages per pass. Deleting a project cascades to its checkpoints.
-Source metadata exposes `pages_reused`, `pages_processed`, `recipe_sha256`, OCR
-elapsed seconds, configured worker limit, and actual languages.
-
-## Progress and rollout
-
-Language policy version 4 invalidates checkpoints produced by automatic detection.
-Reload the sandbox service before resuming a blocked import to use the new policy.
-The retained bytes and frozen import language settings remain unchanged.
-
-Intermediate landing counters are coalesced to at most one write every two seconds
-per import. Stage/file boundaries, completed OCR counters and terminal operation
-events remain immediate. Stale import attempts cannot overwrite current progress.
-Dataset event publishers reuse process-local Redis clients with bounded socket
-timeouts; event delivery remains advisory. Checkpoint frames require explicit
-client opt-in; older landing clients keep English OCR and receive only ordinary
-progress. The language column retains its database default so older API instances
-can create datasets while the migration and service rollout are in progress.
-
-Deploy the migration first, then the sandbox image with the language packs, landing
-workers, remaining workers and API through the existing staged rollout. Older
-sandbox images do not implement checkpoints or language selection, so a mixed
-rollout is not sufficient to claim the feature is available. Production rollout
-requires validation of the same runtime image. The full candidate image and every
-staging service passed rollout at `35164343`. See the
-[staging benchmark](ocr-staging-benchmark.md) for paired timings, output checks and
-limits; these measurements do not establish production throughput.
-
-## Verification
-
-The staging measurements below describe PR #218 before automatic language
-detection was removed; they are historical evidence, not current-policy results.
-
-- Document service tests exercise interrupted extraction, exact page reuse, page
- order, changed-language invalidation, project isolation and real French OCR.
-- Workshop journey sets languages through MCP, uploads through the CLI and reads
- actual extraction provenance and reuse through MCP.
-- Existing document tests retain native text, page regions, orientations, original
- byte downloads and atomic publication on failures.
-- Paired staging runs cover three 24-page PDFs and one 96-page PDF from the
- retained CSIRT source, with explicit English, automatic language selection and
- complete cached reuse. All 68 document/transfer regressions passed, including
- the retained unsupported-script screenshot; the strengthened MCP/CLI/OCR
- journey also passed.
-- Cached row values and evidence match exactly. Cached imports currently expose
- `page` before `text`, so their column order and whole-file fingerprints differ
- from cold imports. The benchmark records this limitation explicitly.
diff --git a/docs/workshop-performance-benchmark.md b/docs/workshop-performance-benchmark.md
deleted file mode 100644
index 93578faf..00000000
--- a/docs/workshop-performance-benchmark.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# Workshop batch and validation benchmark
-
-## Method
-
-Compared main `5cbca9b9` with the application implementation in `2f07b9af` on staging, using the same seven ordered AURA CSVs and unchanged retained `group.py` and `decision.py` scripts. The only package-manifest adjustment from the earlier production run was binding the existing staging sandbox runtime. No training, evaluation, inference or Modal jobs were launched.
-
-The source contains 113,013 rows. Both imports produced source SHA-256 `35a1cbb86b3310ebad7958624d26b063598ddbe5e63d15e6d5102a60760bda89`. File order was CEAS_08, Nazario, Nazario_5, Nigerian_5, Nigerian_Fraud, SpamAssasin, TREC_07. The existing script's declared truncation and duplicate grouping were unchanged.
-
-Each landing/interactive task retained 1 vCPU and 4 GiB. The existing CPU autoscaler changed interactive desired count from one to two during the baseline; a transformation executes on one worker and was not parallelized across those tasks. The benchmark did not change autoscaling limits, CPU, memory or provisioned disk capacity. Durable data remained on EFS; candidate temporary data used the task's existing ephemeral disk. These are observed paired-run timings, not a concurrency-capacity guarantee.
-
-## Results
-
-| Measurement | Baseline | Candidate |
-| ----------------------------------------------------- | --------: | --------: |
-| Source cells for seven files | 7 | 1 |
-| Rows in cumulative source versions | 399,488 | 113,013 |
-| Server-side landing execution | 202.983 s | 62.134 s |
-| Import wall time, including transfer and polling | 541.013 s | 313.287 s |
-| Full two-step transformation | 537.252 s | 393.141 s |
-| Combined server processing (landing + transformation) | 740.235 s | 455.275 s |
-| Impact measurement across both steps | 196.939 s | 37.151 s |
-
-Observed improvements: landing 69.4%, transformation 26.8%, combined server processing 38.5%, and impact measurement 81.1%. Publication/profile time did not improve in this pair (84.611 s versus 92.313 s); it remains a substantial CPU/scan cost. The result does not claim every phase became faster.
-
-Transfer time is not treated as a server-performance result: the same bytes crossed the local network in both runs, and Wi-Fi/polling variation affects wall time. Landing execution comes from durable admission timestamps; transformation phases come from saved pipeline receipts.
-
-Two exact-file local comparisons independently verified ordered row content, lineage, impact findings and full measurements (excluding timestamps and file identity). Mean validation/measurement time fell from 17.576 s to 11.404 s, about 35%. This local subset is separate from the full staging measurement.
-
-## Changes
-
-- One resumable transfer binds ordered file hashes, sizes and destination settings; incomplete or invalid batches publish no source version. Existing single-file clients use the same service.
-- One SQLite source index is shared by lineage and impact checks for each step. Review flags are removed during the lineage write instead of another full-file rewrite.
-- Known-schema writes stream directly to Parquet; statistics are collected during profiling. Publication measurements run before acquiring the dataset lock, with settings and cancellation rechecked before atomic publication.
-- Staging landing/interactive tasks use local temporary storage. Each run cleans up its scratch directory, and file locks protect active runs while abandoned scratch is reclaimed.
-- Validation receipts expose measured row counters and preserve runner heartbeat separately from forward progress.
-- MCP upload guidance, SDK/plugin versions, generated API client and documentation were updated. The deployment renderer accepts AWS's normalized empty-host representation, preserving repeat deployment.
-
-## Verification
-
-- Backend: 3,311 passed, seven skipped.
-- End-to-end journeys: 92 passed, including CLI batch retry, mixed workload capacity and recovery.
-- SDK: 634 passed.
-- Frontend: 905 tests passed; typecheck, Biome, design/contrast/control checks passed.
-- Deployment renderer: 22 passed, including repeat deployment using AWS's normalized volume shape.
-- Batch tests cover incomplete/bad members, one-cell attachment, file-order conflicts, lost acknowledgements and managed-upload isolation.
-- Storage tests preserve the previous file on interrupted writes. Scratch tests retain active leases and reclaim abandoned directories.
-
-Live MCP queries verified all 113,013 unique row identities, identical ordered transformed-content and lineage-key checksums, matching per-source label/truncation counts, correct target probability ordering for every row, and valid parent-cell/row bindings for every row. The final consumer schema check passed. An additional full-source run was cancelled during the first lineage check. It remained cancelled, preserved the same active version and all three published cells, and a subsequent 1,000-row preview completed. During that run, a separate project landed 100 actual AURA rows in 0.436 seconds of server execution (5.970 seconds including transfer and observation). Read-only MCP polling remained responsive during this probe. This is a bounded cross-project smoke check, not a general capacity bound.
-
-One local polling request encountered a connection timeout during the candidate run. Observation resumed against the exact recorded job ID; no duplicate transformation was submitted. Server-side timings above come from the completed receipts, not local polling intervals.
-
-Implementation review: https://github.com/overmind-core/overmind/pull/216. Companion docs: https://github.com/overmind-core/docs/pull/77. Production was not deployed.
diff --git a/docs/workshop-pipelines.md b/docs/workshop-pipelines.md
deleted file mode 100644
index d5b02776..00000000
--- a/docs/workshop-pipelines.md
+++ /dev/null
@@ -1,352 +0,0 @@
-# Reusable Workshop transformations
-
-## Version-bound analytics
-
-Overmind measures every newly published cell during its existing full-row profile
-pass, including final transformation and partition outputs. `stats.analytics` is
-bound to the cell fingerprint and rule version. Terminal cells expose Metrics
-beside Script/Data; collapsed Metrics leave warning/error and unchecked chips on
-Data. No training or row transformation is triggered by opening these sections.
-
-REST cells and MCP `inspect_dataset` return the same `analytics` report. Completed
-pipeline `get_job` receipts include final-output analytics. For historical cells,
-`explore_dataset` computes and persists the report asynchronously, preserving the
-rows and fingerprint. Stale/missing reports are explicitly `unmeasured`; reads do
-not scan data. Completion notifies the Console to refresh.
-
-Version 2 measures target validity, declared categorical class counts, majority
-accuracy baseline, rare/missing classes, observation weights, and missing/constant
-input values. Class shares below 5% and class counts below 20 are advisory
-heuristics, not launch gates. Probability/ordinal targets are never converted to
-gold labels; ordered options and declared semantics define separate families.
-All rows are scanned; details are bounded to 8 families, 32 options and 100 input
-fields, with uncovered data explicit. Prose states receive whole-text checks,
-not inferred field parsing. Cross-split leakage, feature availability/outliers
-and evaluation strategy remain `not_checked`. Source label correctness is not
-established by declared semantics. Neither scan completion nor format validity
-means the data is suitable for training.
-
-Regression coverage: `tests/test_workshop_analytics.py`, the cell analytics UI
-tests, and `make test-journeys test_args="-k test_workshop_publishes_version_bound_analytics_to_mcp_and_rest"`.
-
-The native coding agent writes and interprets transformations. Overmind retains
-their code, immutable revisions, exact inputs, step outputs and measured receipts.
-Reuse a revision with compatible sources in the same project. If a source needs
-different logic, save a new family with `derived_from` pointing to the original
-revision. Updating a family instead requires its family ID and `expected_revision`.
-Neither operation changes old revisions or their consumer cells.
-
-New transformations require a retained Python package. `save_dataset_pipeline`
-accepts its uploaded package UUID, not inline operation definitions. Each entrypoint
-contains the meaningful logic for that stage. Historical package-free revisions and
-receipts remain readable, but cannot execute or be enabled in bindings; author and
-upload a package and save a new revision instead. External-result imports retain
-their own producer attribution and do not establish reproducible script execution.
-
-## Isolated runtime setup
-
-Packages execute in main's isolated sandbox service through the interactive Celery
-workers. The sandbox has no provider credentials, shared media or outbound network.
-Each execution has its own unprivileged UID and private scratch directory; process
-groups and detached descendants are stopped before output is read. The API and
-Celery workers never execute uploaded Python in their own interpreters.
-
-Deploy the same application release to the sandbox and workers. Dependencies are
-locked in the application image, including main's data-science libraries and
-offline tokenizer cache. The sandbox authenticates streamed requests with
-SANDBOX_TOKEN. There is no Docker socket, separate EC2 controller or image pull.
-
-Inspect runtime availability with inspect_dataset_workbench. The existing
-runtime.images field advertises the sandbox source-and-lockfile SHA-256 identity.
-Packages pin that identity. Old Docker-pinned packages and their completed
-receipts remain readable; save a new revision with the advertised sandbox identity
-to execute them. Existing immutable revisions are never silently rebound.
-
-Interactive consumers retain four local processes by default and a shared Redis
-limit of four simultaneous runs per project (WORKSHOP_PROJECT_CONCURRENCY).
-Different projects can use additional worker capacity independently. Pipeline
-demand feeds interactive autoscaling; evaluation demand stays on batch.
-Runtime availability is sampled by interactive consumers independently of run progress; it does not certify
-execution progress or replace the interactive consumer's health check.
-
-## Package contract
-
-A package is a ZIP or directory containing `manifest.json` and UTF-8 Python,
-JSON, text or lock files. Maximum: 100 regular files, 10 MiB compressed and expanded.
-Traversal paths, symlinks, duplicates and invalid Python syntax are rejected.
-
-```json
-{
- "version": 1,
- "runtime": "sha256:<advertised 64-character sandbox runtime digest>",
- "parameters": {"prefix": "string"},
- "limits": {"seconds": 300},
- "steps": [{
- "name": "Normalize questions",
- "entrypoint": "normalize.py",
- "input_schema": {"question": "string"},
- "output_schema": {"question": "string", "source_row": "integer"},
- "checks": {"preserve_rows": true}
- }]
-}
-```
-
-Each script receives three arguments: input JSONL path, output JSONL path and
-parameters JSON path. It writes one object per output line. Stream large inputs.
-Preserve `source_row`, or supply `_overmind_parent_rows` with every immediate
-input parent for a merged/expanded output. Every logical step gets its own cell;
-the platform validates lineage and publishes the complete chain atomically.
-Duplicates, row order, nested targets and weights are not implicitly cleaned.
-Semantic correctness remains unmeasured.
-
-Column types are `string`, `integer`, `number`, `boolean`, `object`, `array`, `null`
-and `any`; these are required-field type contracts, not arbitrary JSON Schema.
-Parameters must exactly match the declared names/types. Row checks support
-`min_rows`, `max_rows`, `preserve_rows`. Limits are per step: 1–1,200 seconds,
-64–4,096 MiB memory, 16–4,096 MiB scratch and 1–4 CPUs. Omitted limits
-use 300 seconds, dynamic memory admission, 2 GiB scratch and two CPU cores.
-The input-size estimate retains main's 5.5 expansion factor plus 256 MiB baseline,
-including package bytes and at least 1 GiB reserved before upload. The worker admits
-against 60% of its cgroup memory; its watchdog includes RSS, scratch, unlinked
-files and memfd allocations. An explicit memory limit below the estimate is
-rejected. Use batch_rows only for independent row transformations.
-
-A complete pipeline has a 25-minute interactive-task deadline, with a 26-minute
-hard limit; queued runs expire after 15 minutes. Scripts and partial pipelines
-are never automatically replayed after an ambiguous result or lost worker.
-Output lines are bounded to 4 MiB and 200 columns, total output to 2 GiB.
-Retained stdout contains its final 4,000 characters and failures up to 1,200.
-Resource receipts distinguish configured limits from sampled peak usage.
-
-Absolute `min_rows` and `max_rows` apply to full publication, not a bounded preview.
-Preview receipts list these under `check_results.deferred`. Row preservation,
-schema and lineage checks apply in both modes. Failed checks retain expected and
-actual counts. Validation warns when no output lineage field is declared; this
-is advisory because column contracts do not prohibit additional fields.
-
-```sh
-overmind dataset pipeline-upload ./my-transform --project-id PROJECT --json
-overmind dataset pipeline-download PACKAGE --project-id PROJECT --output package.zip
-```
-
-Upload uses the same address-bound local account connection and preflight as
-dataset transfer; it retains the exact ZIP checksum and does not run code.
-Download verifies that checksum and refuses to overwrite an existing file.
-
-## MCP workflow
-
-Use the `author-dataset-transformation` native prompt for the live catalogue's
-authoring, retrieval and verification contract. It distinguishes row conditions
-from separate graph branches and code declarations from measured outcomes.
-
-1. `list_projects`; pass the selected `project_id` explicitly.
-1. `inspect_dataset_workbench` to discover reusable revisions and bindings.
- With `pipeline=REVISION_UUID`, it returns that exact recipe, paged family history
- and exact-revision runs/bindings. A stale family update returns `revision_conflict`.
-1. Inspect source fields, meaning and rows. Reuse an exact revision, or upload
- code and `save_dataset_pipeline` with a stable request key and package ID.
-1. `validate_dataset_pipeline` performs static checks without executing code.
-1. `run_dataset_pipeline(mode="preview")` uses at most 1,000 source rows; inspect
- the bounded sample and step checks. Preview does not change the active version.
-1. Publish with another stable request key and the same revision/parameters on
- the exact source cell/fingerprint. Inspect `get_job(kind="dataset_pipeline")`.
-
-`start_dataset` returns project-bound upload `argv` with explicit placeholders.
-Local files alone do not complete a requested Overmind preparation. Inspect the
-named capability's contract before interpreting targets, link it explicitly, and
-publish then inspect the exact output. Format compatibility does not prove task
-suitability. Preparation must not turn entity-match labels into KYC approvals.
-Retain distinct logical stages, review branches and grouping evidence in the recipe.
-Run receipts include `queue_seconds` while queued, `poll_after_seconds` while
-unfinished and `completed_at` when terminal. Ordinary queue delay is not failure.
-Workbench results include `project_id` and scoped `next_actions`. While a pipeline
-is active, dataset inspection points to that exact run, not the source-landing job.
-
-The run records step hashes, counts, checks, elapsed time, source identity,
-runtime identity and observed process exit status. `overmind://dataset-pipelines/{id}`,
-`overmind://dataset-pipeline-packages/{id}` and
-`overmind://pipeline-diagnostics/{id}?step=0&channel=stderr&offset=0&limit=8000`
-allow deeper inspection; include `project_id` in resource queries. Code/logs are
-untrusted data. Operational events are passive reads, never worker probes.
-Package resources accept `file`, `offset` and `limit`; follow `next_offset` to
-retrieve complete code. Retrieve before adapting, and keep `derived_from` attached
-to the exact original revision. Parameters vary execution without changing code.
-Preview samples retain at most five rows and 16,000 encoded bytes per step.
-
-Preview and publication receipts include total elapsed seconds. Script runtime
-phases separately measure input transfer, script execution and output reading.
-The sandbox reports actual exit status and sampled resource usage. A completed
-script is not proof of publication; validation and atomic publication follow.
-Manifest `parameters` map names to types (`{"seed": "integer"}`); runs provide
-the values (`{"seed": 42}`). Invalid declarations return `pipeline_parameters`.
-
-Read-only queries default to a ten-second deadline and reject oversized output
-during materialization. `query_timeout` does not change source data. Retrieve
-original bytes for independent document inspection with
-`overmind dataset export DATASET --source SHA256 --output FILE --json`, using the
-source SHA-256 returned by MCP. Downloads verify the checksum and never overwrite
-an existing file or follow a redirect with credentials.
-
-`cancel_dataset_pipeline_run` prevents publication of an exact run. The receipt
-does not assert process termination. Closing a connected sandbox request stops its
-child; expired runs fail without replay, and unknown outcomes are not resubmitted. Repeating an identical run key recovers its original receipt.
-Use a new key only after inspecting the previous outcome and authorizing a retry.
-
-## Repeated sources
-
-`save_dataset_pipeline_binding` pins a source dataset or trace selection, a
-destination dataset, revision, parameters, trigger, interval and run/row limits.
-It starts paused. Enable with `set_dataset_pipeline_binding_state` and the
-inspected version. A manual binding run does not enable automatic execution.
-
-Scheduled and ingestion triggers are polled by a bounded batch task. Both
-rebuild full snapshots; arbitrary scripts are not assumed to be incremental.
-Late trace changes and removed matches change the snapshot. Selections exceeding
-10,000 traces are rejected without dropping rows. Checkpoints advance only with
-successful atomic publication. No-change inspections publish nothing.
-
-Failures pause automatic processing on its next inspection. Inspect the exact
-run before explicitly re-enabling or adopting a corrected revision. Revision
-adoption pauses the binding and resets its checkpoint for an explicit rebuild.
-Pause stops new work, not an already running batch. Run limits remain cumulative.
-Project admission is shared across independently scalable interactive workers.
-Existing training/evaluation consumers remain pinned to their original cells.
-
-Run the retained-package and publication regressions without provider calls:
-
-```sh
-uv run pytest tests/test_reusable_workshop_journey.py tests/test_workshop_package_transfer_journey.py -q
-```
-
-## Source fingerprints and rebuilding historical imports
-
-Raw tabular records do not declare model features or targets. Overmind fingerprints
-all their fields except platform row/provenance identities, using the
-`record:v1:` namespace. Familiar names such as `state`, `text`, `score` or `label`
-do not cause other fields to be ignored. This is exact source-record identity,
-not a claim about semantic similarity or customer independence.
-
-Use supported explicit `input`, chat-message or native-decision structures to
-declare model input. Complete flat native decisions include `state`, `question`,
-`kind`, `options` and `target`; partial flat rows remain raw records. Native
-decision targets and weights do not affect model-input equivalence. Flat, nested
-and wrapped native decisions share that equivalence. Source/seed fingerprints
-and declared groups are preserved through transformations and remain partition
-constraints, including when the visible grouping columns are projected away.
-
-Older imports may retain incorrect fingerprints inferred from column names.
-Updating the code does not repair those immutable cells. Do not strip provenance,
-relax partition checks, append the same file to an existing source (which adds
-rows), or reuse an old transfer request key expecting new execution.
-
-To rebuild an affected import:
-
-1. Export each retained original source with `overmind dataset export DATASET --source SHA256 --output FILE --json`. Verify the original byte identities and
- record the affected dataset/cell IDs and checksums in the replacement brief.
-1. Create an explicit replacement source and upload the original bytes through the
- normal upload workflow after deploying the corrected code. For multi-file
- sources, retain the same file order and extraction settings. A new destination
- and request identity distinguish this rebuild from an upload retry. Preserve
- the old source and every consumer-pinned version; there is no automatic in-place
- migration of historical fingerprints.
-1. Reuse the retained transformation or save an attributed revision for the new
- source. Preview, publish and inspect counts, target semantics, record identities
- and intended group boundaries before partitioning.
-1. Build fresh partitions and consumer snapshots. Confirm coverage and absence of
- unintended overlap. Historical training/evaluation evidence remains pinned to
- its original artifacts and must not be relabelled as rebuilt evidence.
-
-This recovery uses original bytes, never a locally transformed derivative uploaded
-as an unrelated source. If original bytes or extraction settings are unavailable,
-retain the failure and investigate; do not guess which inherited keys to remove.
-
-Regression commands (compose PostgreSQL and Redis required for the journey):
-
-```sh
-uv run pytest tests/test_dataset_fingerprints.py tests/test_dataset_split.py tests/test_dataset_preparation.py -q
-TEST_REDIS_URL=redis://localhost:6379/15 uv run pytest tests/journeys/test_tabular_partition.py -q
-```
-
-The journey uploads a table with shared `state` and `text` values, imports an
-explicit decision transformation with lineage, creates four time-ordered roles,
-and checks that the original source is unchanged. Journey evidence is retained
-under `tests/journeys/.runs/`.
-
-## Explicit flow, authored by the native agent
-
-Every retained revision returns `flow`: named nodes, input edges, branch conditions
-and the selected output. Both MCP inspection and `overmind://dataset-pipelines/{id}`
-return the same structure. An agent does not have to reverse-engineer the scripts.
-
-Each step may declare `id` and `input` (`source` or an earlier step ID). Two steps
-with the same input are a fork; they each receive that complete immutable input.
-Omitted IDs are stable `step_1`, `step_2`, etc.; omitted inputs mean the preceding
-step. Cycles, duplicate IDs, forward references and dangling inputs are rejected.
-Execution uses those dependencies, not the order of displayed cells. The last
-declared step is the active output; all successful step outputs remain available.
-
-A Python step can also declare `condition: {"expression": "row['eligible'] is True", "line": 5}`. Overmind binds this explanation to the retained entrypoint and checks
-that the line exists. It labels the explanation `agent_declared`, not independently
-verified. The script implements the row selection; Overmind never evaluates the
-expression string. Empty branches still run and publish a measured zero-row output.
-This is row-routing, not conditional skipping of arbitrary jobs. A step can instead
-declare `inputs: ["review", "unflagged"]`. These frames concatenate in declared
-order before the retained script runs. An identity script can retain all incoming rows. Overlapping `source_row` identities fail atomically; duplicate
-observations with distinct identities remain intact. Empty branches are valid.
-Nonempty inputs must have matching data columns and types; normalize branch
-schemas explicitly before merging. Incompatible inputs fail rather than coerce values.
-This is a disjoint union, not a relational key join; cyclic workflows remain unsupported.
-`flow.terminal_steps` and `flow.unconsumed_steps` expose disconnected outputs.
-Training recipes should converge intended branches into the last, trainable output
-and retain unresolved review flags separately from model inputs.
-
-Run receipts separately record `step_id`, `input_steps`, exact `input_cells`,
-fingerprints, execution state and row counts. These receipts drive the Console's
-elbow connectors. Each input also records its own row count and fingerprint.
-The existing cells sit on a 20px grid-snapped flow canvas;
-steps cascade downward, with sibling branches side by side on the same horizontal
-layer. Cells open at scale 1 with the original notebook width and responsive padding.
-Zoom controls, Fit view, pinch and the toggleable minimap navigate the canvas
-without changing cell dimensions. Reset and linked-cell focus return to scale 1;
-resize preserves the chosen zoom. Minimap visibility is remembered in this browser.
-Its toggle shares the left-hand box with the dataset sidebar button; cell search
-and the cell-selector strip are removed.
-Moving cells never rewires a transformation. Positions are saved in this browser
-per project/dataset. The version chip beside the dataset name previews historical
-iterations and restores an exact cell as active, without rerunning code or changing
-consumer snapshots. The default canvas shows the current output's ancestors;
-All iterations explicitly reveals historical branches. Condition chips sit just
-above their receiving cell's connector. Execution details remain in the chip's popover.
-
-Verify expected row members independently of the scripts, not merely counts.
-Exercise boundaries, null/missing values, nested conditions, duplicates, Unicode
-and zero-row branches. Intended partitions need measured disjointness and coverage;
-the platform does not infer those guarantees from condition labels. The retained
-contract and MCP regressions cover these boundaries:
-
-```sh
-uv run pytest tests/test_workshop_retained_code_contract.py tests/test_workshop_mcp_acceptance.py -q
-```
-
-## Batched local sources and validation performance
-
-`overmind dataset upload first.csv second.csv --project-id PROJECT --json`
-reserves one ordered, resumable transfer (up to 100 files and 2 GiB total, subject
-to each file type's limit). Each file retains its checksum, original bytes and
-row evidence. Publication waits for all files and creates one source cell; with
-`--dataset`, one attachment adds the entire batch to the existing version.
-Retry the same command to recover byte offsets or an acknowledged publication.
-Changing content, order or destination under an existing request key conflicts.
-
-Lineage and impact share one per-step source index. Untrusted review flags are
-removed while writing the validated output. Known-schema writes stream directly;
-statistics and profiles share a decoded scan. Cell measurements complete before
-the short, fenced publication transaction. Cancellation never publishes partial
-steps, and source/consumer versions remain immutable.
-
-Staging landing and interactive workers use the task's existing ephemeral disk
-for temporary files through `TMPDIR=/scratch/tmp`; durable sources and cells stay
-on EFS. Validation receipts include measured row counts. Runs check scratch use
-and available disk during validation; completed runs remove scratch files, and a
-subsequent run reclaims abandoned directories only after acquiring their lease
-lock. No training or inference is needed to benchmark this path.
diff --git a/overbae/api/overwatch_agent.py b/overbae/api/overwatch_agent.py
new file mode 100644
index 00000000..15e4d17f
--- /dev/null
+++ b/overbae/api/overwatch_agent.py
@@ -0,0 +1,168 @@
+"""Internal analytics reads for Overwatch's shared Overlord runtime.
+
+POST carries private query arguments in the body, never in access-log URLs.
+It performs no product mutations and is deliberately absent from public OpenAPI/MCP.
+"""
+
+import hashlib
+import hmac
+import json
+import logging
+
+from django.conf import settings
+from django.core.cache import cache
+from django.db import connection, transaction
+from django.utils import timezone
+from django.views.decorators.debug import sensitive_variables
+from drf_spectacular.utils import extend_schema
+from jsonschema import ValidationError, validate
+from rest_framework import serializers
+from rest_framework.permissions import BasePermission
+from rest_framework.response import Response
+from rest_framework.views import APIView
+
+from overbae.services import overwatch_tools, user_insights
+
+logger = logging.getLogger(__name__)
+TOOL_CACHE_SECONDS = 3600
+# product_usage keeps its own PostHog cache and still reads product rows live.
+CACHED_TOOLS = frozenset(
+ {"activation_funnel", "billing_summary", "customer_activity", "customers_at_step"}
+)
+DAYS = {"type": "integer", "minimum": 1, "maximum": 365}
+SCHEMAS = {
+ name: {
+ "type": "object",
+ "properties": {"days": DAYS},
+ "required": ["days"],
+ "additionalProperties": False,
+ }
+ for name in ("activation_funnel", "product_usage", "billing_summary")
+}
+SCHEMAS["customer_activity"] = {
+ "type": "object",
+ "properties": {"days": DAYS, "email": {"type": "string", "minLength": 3, "maxLength": 254}},
+ "required": ["days", "email"],
+ "additionalProperties": False,
+}
+SCHEMAS["customers_at_step"] = {
+ "type": "object",
+ "properties": {
+ "days": DAYS,
+ "step": {"enum": list(user_insights.ACTIVATION_STEPS)},
+ "limit": {"type": "integer", "minimum": 1, "maximum": 25},
+ },
+ "required": ["days", "step"],
+ "additionalProperties": False,
+}
+
+
+class HasOverwatchServiceToken(BasePermission):
+ def has_permission(self, request, view):
+ expected = settings.OVERWATCH_SERVICE_TOKEN
+ scheme, _, value = request.headers.get("Authorization", "").partition(" ")
+ return (
+ bool(expected)
+ and expected != settings.SALES_DASHBOARD_TOKEN
+ and scheme == "Bearer"
+ and hmac.compare_digest(value.encode(), expected.encode())
+ )
+
+
+class QuerySerializer(serializers.Serializer):
+ tool = serializers.ChoiceField(choices=tuple(SCHEMAS))
+ arguments = serializers.JSONField()
+
+ def validate(self, attrs):
+ if set(self.initial_data) != {"tool", "arguments"}:
+ raise serializers.ValidationError("Invalid query fields.")
+ try:
+ validate(attrs["arguments"], SCHEMAS[attrs["tool"]])
+ if attrs["tool"] == "customer_activity":
+ serializers.EmailField().run_validation(attrs["arguments"]["email"])
+ except (ValidationError, serializers.ValidationError):
+ raise serializers.ValidationError("Invalid query arguments.") from None
+ return attrs
+
+
+def _tool_cache_key(tool: str, arguments: dict) -> str:
+ # One snapshot per tool and arguments. Hash the query so a customer email is
+ # not a Redis key, and never include the bearer token.
+ normalized = dict(arguments)
+ if tool == "customer_activity":
+ normalized["email"] = normalized["email"].casefold()
+ elif tool == "customers_at_step":
+ # The handler treats a missing limit as 25; the snapshot must too.
+ normalized["limit"] = normalized.get("limit", 25)
+ fingerprint = hashlib.sha256(
+ json.dumps({"tool": tool, "arguments": normalized}, sort_keys=True).encode()
+ ).hexdigest()
+ return f"overwatch:agent:query:{fingerprint}"
+
+
+class QueryResultSerializer(serializers.Serializer):
+ content = serializers.CharField()
+ private = serializers.BooleanField()
+ source = serializers.CharField()
+ as_of = serializers.DateTimeField()
+ window_days = serializers.IntegerField()
+ window_start = serializers.DateTimeField()
+
+
+class OverwatchQueryView(APIView):
+ authentication_classes = []
+ permission_classes = [HasOverwatchServiceToken]
+ http_method_names = ["post", "options"]
+
+ def finalize_response(self, request, response, *args, **kwargs):
+ response = super().finalize_response(request, response, *args, **kwargs)
+ response["Cache-Control"] = "private, no-store"
+ response["Referrer-Policy"] = "no-referrer"
+ return response
+
+ @extend_schema(exclude=True)
+ @sensitive_variables()
+ def post(self, request):
+ if len(request.body) > 4096:
+ return Response({"error": "invalid_query"}, status=400)
+ query = QuerySerializer(data=request.data)
+ if not query.is_valid():
+ return Response({"error": "invalid_query"}, status=400)
+ tool, args = query.validated_data["tool"], dict(query.validated_data["arguments"])
+ try:
+ minute = int(timezone.now().timestamp()) // 60
+ rate_key = f"overwatch:service:rate:{minute}"
+ cache.add(rate_key, 0, timeout=120)
+ if cache.incr(rate_key) > 120:
+ return Response({"error": "query_limit"}, status=429)
+ result_key = _tool_cache_key(tool, args) if tool in CACHED_TOOLS else None
+ if result_key is not None:
+ cached = cache.get(result_key)
+ if cached is not None:
+ return Response(cached)
+ # Dedicated top-level transaction: PostgreSQL itself rejects writes,
+ # including accidental future ORM writes and data-modifying CTEs.
+ with transaction.atomic():
+ if connection.vendor != "postgresql":
+ raise RuntimeError("unsupported_analytics_database")
+ with connection.cursor() as cursor:
+ cursor.execute("SET TRANSACTION READ ONLY")
+ content, private = overwatch_tools.query(tool, args)
+ result = QueryResultSerializer(
+ {
+ "content": content,
+ "private": private,
+ "source": "Overmind product/billing records"
+ + (" and PostHog aggregates" if tool == "product_usage" else ""),
+ "as_of": timezone.now(),
+ "window_days": args["days"],
+ "window_start": user_insights.window_start(args["days"]),
+ }
+ )
+ payload = dict(result.data)
+ if result_key is not None:
+ cache.set(result_key, payload, TOOL_CACHE_SECONDS)
+ return Response(payload)
+ except Exception:
+ logger.warning("overwatch_service_query_failed")
+ return Response({"error": "analytics_unavailable"}, status=503)
diff --git a/overbae/api/sales_dashboard.py b/overbae/api/overwatch_dashboard.py
similarity index 56%
rename from overbae/api/sales_dashboard.py
rename to overbae/api/overwatch_dashboard.py
index 85948b34..fdb87ab7 100644
--- a/overbae/api/sales_dashboard.py
+++ b/overbae/api/overwatch_dashboard.py
@@ -1,11 +1,14 @@
from __future__ import annotations
+import hashlib
import hmac
+from contextlib import nullcontext
from datetime import timedelta
from urllib.parse import urlencode
from django.conf import settings
from django.core.cache import cache
+from django.db import DatabaseError
from django.shortcuts import get_object_or_404
from django.utils import timezone
from drf_spectacular.utils import extend_schema
@@ -16,17 +19,21 @@ from rest_framework.views import APIView
from overbae.api.config import PageNumberPagination
from overbae.api.ordering import TableOrderingFilter
-from overbae.services import sales_metrics
+from overbae.services import overwatch_insights, user_insights
ACTIVE_DAYS = 7
CACHE_SECONDS = 3600
-class HasSalesDashboardToken(BasePermission):
+class HasOverwatchToken(BasePermission):
def has_permission(self, request, view) -> bool:
expected = settings.SALES_DASHBOARD_TOKEN
scheme, _, presented = request.headers.get("Authorization", "").partition(" ")
- return bool(expected) and scheme == "Bearer" and hmac.compare_digest(presented, expected)
+ return (
+ bool(expected)
+ and scheme == "Bearer"
+ and hmac.compare_digest(presented.encode("utf-8"), expected.encode("utf-8"))
+ )
class WindowSerializer(serializers.Serializer):
@@ -48,59 +55,75 @@ class BaseModelUsageSerializer(serializers.Serializer):
jobs = serializers.IntegerField()
-class SalesOverviewSerializer(serializers.Serializer):
- accounts_total = serializers.IntegerField()
+class OverviewSerializer(serializers.Serializer):
+ users_total = serializers.IntegerField()
signups = DailyCountSerializer(many=True)
sign_on_methods = serializers.DictField(child=serializers.IntegerField())
projects_created = DailyCountSerializer(many=True)
- active_accounts_7d = serializers.IntegerField()
- active_accounts_window = serializers.IntegerField()
- subscriptions = serializers.DictField(child=serializers.IntegerField())
- paying_accounts = serializers.IntegerField()
- cancelling_accounts = serializers.IntegerField()
- free_accounts = serializers.IntegerField()
- low_balance_accounts = serializers.IntegerField()
- topups_usd = DailyUsdSerializer(many=True)
- spend_by_service = serializers.DictField(
- child=serializers.DecimalField(max_digits=14, decimal_places=7)
- )
+ trace_active_users_7d = serializers.IntegerField()
+ trace_active_users_window = serializers.IntegerField()
spans = DailyCountSerializer(many=True)
traces = DailyCountSerializer(many=True)
training_jobs = serializers.DictField(child=serializers.IntegerField())
top_base_models = BaseModelUsageSerializer(many=True)
live_deployments = serializers.IntegerField()
inference_calls = DailyCountSerializer(many=True)
+ subscriptions = serializers.DictField(child=serializers.IntegerField())
+ paying_users = serializers.IntegerField()
+ cancelling_users = serializers.IntegerField()
+ free_users = serializers.IntegerField()
+ low_balance_users = serializers.IntegerField()
+ topups_usd = DailyUsdSerializer(many=True)
+ spend_usd = DailyUsdSerializer(many=True)
+ spend_by_service = serializers.DictField(
+ child=serializers.DecimalField(max_digits=14, decimal_places=7)
+ )
-class FunnelStepSerializer(serializers.Serializer):
+class ActivationStepSerializer(serializers.Serializer):
step = serializers.CharField()
- accounts = serializers.IntegerField()
+ users = serializers.IntegerField()
-class SalesFunnelSerializer(serializers.Serializer):
- steps = FunnelStepSerializer(many=True)
+class ActivationSerializer(serializers.Serializer):
+ steps = ActivationStepSerializer(many=True)
median_hours_to_first_span = serializers.FloatField(allow_null=True)
-class SalesAccountSerializer(serializers.Serializer):
+class ProductUsageSerializer(serializers.Serializer):
+ available = serializers.BooleanField()
+ reason = serializers.CharField(required=False)
+ identity_basis = serializers.CharField(required=False)
+ window_start = serializers.DateTimeField(required=False)
+ window_end = serializers.DateTimeField(required=False)
+ active_users = serializers.IntegerField(required=False)
+ totals = serializers.DictField(child=serializers.IntegerField(), required=False)
+ daily = serializers.ListField(child=serializers.DictField(), required=False)
+ top_mcp_tools = serializers.ListField(child=serializers.DictField(), required=False)
+ top_cli_commands = serializers.ListField(child=serializers.DictField(), required=False)
+ mcp_tool_errors = serializers.IntegerField(required=False)
+ mcp_tool_error_rate = serializers.FloatField(required=False)
+
+
+class UserSerializer(serializers.Serializer):
id = serializers.IntegerField()
email = serializers.EmailField()
date_joined = serializers.DateTimeField()
sign_on_method = serializers.CharField()
- subscription_status = serializers.CharField(allow_null=True)
projects = serializers.IntegerField()
seats = serializers.IntegerField()
last_span_at = serializers.DateTimeField(allow_null=True)
spans = serializers.IntegerField()
- spend_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
- topups_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
- balance_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
training_jobs = serializers.IntegerField()
live_deployments = serializers.IntegerField()
stage = serializers.SerializerMethodField()
+ subscription_status = serializers.CharField(allow_null=True)
+ spend_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
+ topups_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
+ balance_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
def get_stage(self, account) -> str:
- return sales_metrics.stage(account)
+ return user_insights.stage(account)
class DailyBreakdownSerializer(serializers.Serializer):
@@ -155,8 +178,18 @@ class WorkflowActivitySerializer(serializers.Serializer):
daily = DailyCountSerializer(many=True)
-class SalesAccountActivitySerializer(serializers.Serializer):
- account = SalesAccountSerializer()
+class BillingActivitySerializer(serializers.Serializer):
+ subscription_status = serializers.CharField(allow_null=True)
+ spend_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
+ topups_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
+ balance_usd = serializers.DecimalField(max_digits=14, decimal_places=7)
+ spend_daily = DailyUsdSerializer(many=True)
+ topups_daily = DailyUsdSerializer(many=True)
+
+
+class UserActivitySerializer(serializers.Serializer):
+ user = UserSerializer()
+ billing = BillingActivitySerializer()
training = TrainingActivitySerializer()
traces = TraceActivitySerializer()
inference = InferenceActivitySerializer()
@@ -168,65 +201,89 @@ class SalesAccountActivitySerializer(serializers.Serializer):
def _since(request):
window = WindowSerializer(data=request.query_params)
window.is_valid(raise_exception=True)
- return timezone.now() - timedelta(days=window.validated_data["days"])
+ return user_insights.window_start(window.validated_data["days"])
-def _cached(request, compute) -> Response:
+def _cached(request, compute, *, database: bool = True) -> Response:
"""Serve one computation per path and query for an hour, stamped with its freshness."""
- key = f"sales-dashboard:{request.path}?{urlencode(sorted(request.query_params.items()))}"
+ # Hash untrusted query strings to keep cache keys bounded. Never cache a token.
+ fingerprint = hashlib.sha256(
+ f"{request.path}?{urlencode(sorted(request.query_params.items()))}".encode()
+ ).hexdigest()
+ key = f"overwatch:v2:{fingerprint}"
payload = cache.get(key)
if payload is None:
computed_at = timezone.now()
+ try:
+ with user_insights.analytics_read_budget() if database else nullcontext():
+ data = compute()
+ except (DatabaseError, TimeoutError):
+ response = Response({"detail": "Analytics are temporarily unavailable."}, status=503)
+ response["Cache-Control"] = "private, no-store"
+ return response
+ ttl = 60 if data.get("available") is False else CACHE_SECONDS
payload = {
- **compute(),
+ **data,
"computed_at": computed_at.isoformat(),
- "refreshes_at": (computed_at + timedelta(seconds=CACHE_SECONDS)).isoformat(),
+ "refreshes_at": (computed_at + timedelta(seconds=ttl)).isoformat(),
}
- cache.set(key, payload, CACHE_SECONDS)
- return Response(payload)
+ cache.set(key, payload, ttl)
+ response = Response(payload)
+ response["Cache-Control"] = "private, no-store"
+ response["Referrer-Policy"] = "no-referrer"
+ return response
-class SalesDashboardView:
+class OverwatchView:
authentication_classes = []
- permission_classes = [HasSalesDashboardToken]
+ permission_classes = [HasOverwatchToken]
@extend_schema(exclude=True)
-class SalesOverviewView(SalesDashboardView, APIView):
+class OverviewView(OverwatchView, APIView):
def get(self, request):
def compute():
- data = sales_metrics.overview(
- _since(request), timezone.now() - timedelta(days=ACTIVE_DAYS)
- )
- return SalesOverviewSerializer(data).data
+ data = user_insights.overview(_since(request), user_insights.window_start(ACTIVE_DAYS))
+ return OverviewSerializer(data).data
return _cached(request, compute)
@extend_schema(exclude=True)
-class SalesFunnelView(SalesDashboardView, APIView):
+class ActivationView(OverwatchView, APIView):
+ def get(self, request):
+ return _cached(
+ request, lambda: ActivationSerializer(user_insights.activation(_since(request))).data
+ )
+
+
+@extend_schema(exclude=True)
+class ProductUsageView(OverwatchView, APIView):
def get(self, request):
+ window = WindowSerializer(data=request.query_params)
+ window.is_valid(raise_exception=True)
+ days = window.validated_data["days"]
return _cached(
- request, lambda: SalesFunnelSerializer(sales_metrics.funnel(_since(request))).data
+ request,
+ lambda: ProductUsageSerializer(overwatch_insights.product_usage(days)).data,
+ database=False,
)
@extend_schema(exclude=True)
-class SalesAccountActivityView(SalesDashboardView, APIView):
+class UserActivityView(OverwatchView, APIView):
def get(self, request, pk: int):
def compute():
since = _since(request)
- account = get_object_or_404(sales_metrics.accounts(since), pk=pk)
- return SalesAccountActivitySerializer(
- sales_metrics.account_activity(account, since)
- ).data
+ user = get_object_or_404(user_insights.users(since), pk=pk)
+ return UserActivitySerializer(user_insights.user_activity(user, since)).data
return _cached(request, compute)
@extend_schema(exclude=True)
-class SalesAccountsView(SalesDashboardView, generics.ListAPIView):
- serializer_class = SalesAccountSerializer
+class UsersView(OverwatchView, generics.ListAPIView):
+ serializer_class = UserSerializer
pagination_class = PageNumberPagination
filter_backends = [TableOrderingFilter]
ordering_fields = [
@@ -236,16 +293,17 @@ class SalesAccountsView(SalesDashboardView, generics.ListAPIView):
"seats",
"last_span_at",
"spans",
+ "training_jobs",
+ "live_deployments",
+ "subscription_status",
"spend_usd",
"topups_usd",
"balance_usd",
- "training_jobs",
- "live_deployments",
]
ordering = ["-date_joined"]
def get_queryset(self):
- return sales_metrics.accounts(_since(self.request))
+ return user_insights.users(_since(self.request))
def list(self, request, *args, **kwargs):
- return _cached(request, lambda: super(SalesAccountsView, self).list(request).data)
+ return _cached(request, lambda: super(UsersView, self).list(request).data)
diff --git a/overbae/services/overwatch_insights.py b/overbae/services/overwatch_insights.py
new file mode 100644
index 00000000..8d8ebfc0
--- /dev/null
+++ b/overbae/services/overwatch_insights.py
@@ -0,0 +1,172 @@
+"""Bounded aggregate PostHog queries. Raw event/person rows never leave this layer."""
+
+from __future__ import annotations
+
+import hashlib
+import json
+import re
+from concurrent.futures import ThreadPoolExecutor
+from datetime import date
+from typing import Any
+
+import requests
+from django.conf import settings
+from django.core.cache import cache
+from django.utils import timezone
+
+from overbae.services.overwatch_privacy import model_question, posthog_url
+from overbae.services.user_insights import window_start
+
+EVENT_METRICS = {
+ "cli.completed": "cli_completions",
+ "$mcp_tool_call": "mcp_tool_calls",
+ "training_result_available": "training_results_available",
+ "training_check_finished": "training_checks_finished",
+}
+ACTIVE_USER_EVENTS = ("cli.completed", "$mcp_tool_call")
+
+
+def cached_product_usage(days: int) -> dict[str, Any]:
+ # Source changes and UTC rollover must not reuse another source/window's data.
+ # Hash credentials in the fingerprint; never put a key itself in Redis keys.
+ source = [
+ settings.POSTHOG_API_HOST,
+ settings.POSTHOG_PROJECT_ID,
+ settings.POSTHOG_PERSONAL_API_KEY,
+ days,
+ window_start(days).isoformat(),
+ ]
+ fingerprint = hashlib.sha256(json.dumps(source).encode()).hexdigest()
+ key = f"overwatch:agent:posthog:{fingerprint}"
+ result = cache.get(key)
+ if result is None:
+ result = product_usage(days)
+ cache.set(key, result, timeout=3600 if result.get("available") is True else 60)
+ return result
+
+
+def _query(hogql: str, *, require_complete: bool = True) -> list[list[Any]]:
+ project = settings.POSTHOG_PROJECT_ID
+ if not str(project).isascii() or not str(project).isdecimal():
+ raise ValueError("invalid_posthog_project")
+ response = requests.post(
+ posthog_url(settings.POSTHOG_API_HOST, f"/api/projects/{project}/query/"),
+ headers={"Authorization": f"Bearer {settings.POSTHOG_PERSONAL_API_KEY}"},
+ json={"query": {"kind": "HogQLQuery", "query": hogql}},
+ timeout=(2, 6),
+ allow_redirects=False,
+ )
+ if not 200 <= response.status_code < 300 or len(response.content) > 256_000:
+ raise ValueError("posthog_query_failed")
+ payload = response.json()
+ if not isinstance(payload, dict):
+ raise ValueError("invalid_posthog_response")
+ if require_complete and payload.get("hasMore", False):
+ raise ValueError("incomplete_posthog_results")
+ rows = payload["results"]
+ if (
+ not isinstance(rows, list)
+ or len(rows) > 2000
+ or any(not isinstance(row, list) for row in rows)
+ ):
+ raise ValueError("invalid_posthog_results")
+ return rows
+
+
+def _count(value: Any) -> int:
+ if isinstance(value, bool) or not isinstance(value, (int, str)):
+ raise ValueError("invalid_count")
+ count = int(value)
+ if not 0 <= count <= 2**53 - 1:
+ raise ValueError("invalid_count")
+ return count
+
+
+def _name(value: Any, fallback: str) -> str:
+ # Names are controlled identifiers, never arbitrary event-property payloads.
+ if not isinstance(value, str) or not re.fullmatch(r"[a-z][a-z0-9_ -]{0,79}", value):
+ return fallback
+ try:
+ model_question(value)
+ except ValueError:
+ return fallback
+ return value
+
+
+def product_usage(days: int) -> dict[str, Any]:
+ """Return aggregates with explicit source, identity and calendar-window semantics."""
+ since = window_start(days)
+ if not settings.POSTHOG_PERSONAL_API_KEY or not settings.POSTHOG_PROJECT_ID:
+ return {"available": False, "reason": "PostHog read access is not configured."}
+ until = timezone.now()
+ window = f"timestamp >= toDateTime('{since.strftime('%Y-%m-%d %H:%M:%S')}', 'UTC') AND timestamp <= toDateTime('{until.strftime('%Y-%m-%d %H:%M:%S')}', 'UTC')"
+ events = ", ".join(f"'{event}'" for event in EVENT_METRICS)
+ active_events = ", ".join(f"'{event}'" for event in ACTIVE_USER_EVENTS)
+ day_expression = "toDate(toTimeZone(timestamp, 'UTC'))"
+ daily_limit = days * len(EVENT_METRICS)
+ queries = {
+ "daily": f"SELECT {day_expression}, event, count() FROM events WHERE {window} AND event IN ({events}) GROUP BY {day_expression}, event ORDER BY {day_expression}, event LIMIT {daily_limit + 1}",
+ "active": f"SELECT uniq(person_id) FROM events WHERE {window} AND event IN ({active_events})",
+ "tools": f"SELECT properties.$mcp_tool_name, count(), uniq(person_id) FROM events WHERE {window} AND event = '$mcp_tool_call' GROUP BY properties.$mcp_tool_name ORDER BY count() DESC LIMIT 8",
+ "commands": f"SELECT properties.command_path, count(), uniq(person_id) FROM events WHERE {window} AND event = 'cli.completed' GROUP BY properties.command_path ORDER BY count() DESC LIMIT 8",
+ "errors": f"SELECT count(), countIf(toBool(properties.$mcp_is_error)) FROM events WHERE {window} AND event = '$mcp_tool_call'",
+ }
+ try:
+ # Five independent, bounded reads; at most three requests run concurrently.
+ with ThreadPoolExecutor(max_workers=3, thread_name_prefix="overwatch-posthog") as pool:
+ pending = {
+ name: pool.submit(_query, query, require_complete=name not in {"tools", "commands"})
+ for name, query in queries.items()
+ }
+ rows, active, tools, commands, errors = (
+ pending[name].result()
+ for name in ("daily", "active", "tools", "commands", "errors")
+ )
+ # Aggregate SELECTs return one row even when the matching event set is empty.
+ # A missing row is an incomplete response, not evidence of zero usage.
+ if len(active) != 1 or len(active[0]) != 1 or len(errors) != 1 or len(errors[0]) != 2:
+ raise ValueError("incomplete_posthog_aggregate")
+ if len(rows) > daily_limit or len(tools) > 8 or len(commands) > 8:
+ raise ValueError("unexpected_posthog_row_count")
+ by_day: dict[str, dict[str, int]] = {}
+ totals = dict.fromkeys(EVENT_METRICS.values(), 0)
+ for raw_day, event, raw_count in rows:
+ day = raw_day.isoformat() if isinstance(raw_day, date) else str(raw_day)
+ if not since.date() <= date.fromisoformat(day) <= until.date():
+ raise ValueError("posthog_day_outside_window")
+ metric = EVENT_METRICS[event]
+ count = _count(raw_count)
+ by_day.setdefault(day, dict.fromkeys(totals, 0))[metric] += count
+ totals[metric] += count
+ total_calls, failed_calls = (_count(value) for value in errors[0])
+ if failed_calls > total_calls:
+ raise ValueError("invalid_error_count")
+ return {
+ "available": True,
+ "identity_basis": "PostHog identities, including unlinked CLI installations; not a count of registered customers.",
+ "window_start": since.isoformat(),
+ "window_end": until.isoformat(),
+ "active_users": _count(active[0][0]),
+ "totals": totals,
+ "daily": [{"day": day, **values} for day, values in sorted(by_day.items())],
+ "top_mcp_tools": [
+ {
+ "name": _name(name, "Unknown tool"),
+ "calls": _count(calls),
+ "users": _count(users),
+ }
+ for name, calls, users in tools
+ ],
+ "top_cli_commands": [
+ {
+ "name": _name(name, "Unknown command"),
+ "completions": _count(count),
+ "users": _count(users),
+ }
+ for name, count, users in commands
+ ],
+ "mcp_tool_errors": failed_calls,
+ "mcp_tool_error_rate": failed_calls / total_calls if total_calls else 0.0,
+ }
+ except (requests.RequestException, KeyError, TypeError, ValueError, IndexError):
+ return {"available": False, "reason": "PostHog usage data could not be loaded."}
diff --git a/overbae/services/overwatch_privacy.py b/overbae/services/overwatch_privacy.py
new file mode 100644
index 00000000..4ee466b4
--- /dev/null
+++ b/overbae/services/overwatch_privacy.py
@@ -0,0 +1,49 @@
+"""Explicit data boundaries for internal analytics and Slack delivery."""
+
+from __future__ import annotations
+
+import re
+
+EMAIL = re.compile(r"[A-Za-z0-9.!#$%&'*+/=?^_`{|}~-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)+")
+_CREDENTIAL = re.compile(
+ r"-----BEGIN [A-Z ]*PRIVATE KEY-----"
+ r"|\b(?:sk[-_]|rk_live_|gh[pousr]_|github_pat_|xox[baprs]-|phx_|phs_|ovr_)[A-Za-z0-9_\-]{8,}"
+ r"|\b(?:AKIA|ASIA)[A-Z0-9]{16}\b"
+ r"|\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+"
+ r"|(?i:\b(?:api[_ -]?key|authorization|password|secret|token)\s*[:=]\s*\S+)"
+)
+
+
+def model_question(question: str) -> tuple[str, dict[str, str]]:
+ """Reject credential-like input; replace emails with request-local references."""
+ if _CREDENTIAL.search(question):
+ raise ValueError("credential_like_input")
+ identities: dict[str, str] = {}
+
+ def replace(match: re.Match) -> str:
+ email = match.group().lower()
+ for reference, existing in identities.items():
+ if existing == email:
+ return reference
+ reference = f"customer_{len(identities) + 1}"
+ identities[reference] = email
+ return reference
+
+ question = re.sub(r"<mailto:([^|>]+)(?:\|[^>]+)?>", r"\1", question)
+ question = EMAIL.sub(replace, question)
+ question = re.sub(r"https?://\S+", "[link omitted]", question)
+ question = re.sub(r"<[@#!][^>]+>", "[Slack reference omitted]", question)
+ return question, identities
+
+
+def posthog_url(host: str, path: str, *, ingest: bool = False) -> str:
+ """Never send a read key or customer identifier to a redirect or arbitrary host."""
+ allowed = (
+ {"https://eu.i.posthog.com", "https://us.i.posthog.com"}
+ if ingest
+ else {"https://eu.posthog.com", "https://us.posthog.com"}
+ )
+ host = host.rstrip("/")
+ if host not in allowed:
+ raise ValueError("unapproved_posthog_host")
+ return host + path
diff --git a/overbae/services/overwatch_tools.py b/overbae/services/overwatch_tools.py
new file mode 100644
index 00000000..aea47f89
--- /dev/null
+++ b/overbae/services/overwatch_tools.py
@@ -0,0 +1,152 @@
+"""Bounded read-only analytics contract shared by the dashboard and agent runtime."""
+
+from __future__ import annotations
+
+import json
+from decimal import Decimal
+from typing import Any
+
+from overbae.services import overwatch_insights, user_insights
+
+
+def _activation_funnel(args: dict[str, Any]) -> dict[str, Any]:
+ days = args["days"]
+ return user_insights.activation(user_insights.window_start(days))
+
+
+def _product_usage(args: dict[str, Any]) -> dict[str, Any]:
+ days = args["days"]
+ since = user_insights.window_start(days)
+ with user_insights.analytics_read_budget():
+ overview = user_insights.overview(since, user_insights.window_start(7))
+ return {
+ "window_days": days,
+ "registered_users": overview["users_total"],
+ "trace_active_users": overview["trace_active_users_window"],
+ "projects_created": sum(point["value"] for point in overview["projects_created"]),
+ "traces": sum(point["value"] for point in overview["traces"]),
+ "training_jobs": overview["training_jobs"],
+ "live_deployments": overview["live_deployments"],
+ "inference_calls": sum(point["value"] for point in overview["inference_calls"]),
+ "posthog": overwatch_insights.cached_product_usage(days),
+ }
+
+
+def _billing_summary(args: dict[str, Any]) -> dict[str, Any]:
+ days = args["days"]
+ overview = user_insights.overview(
+ user_insights.window_start(days), user_insights.window_start(7)
+ )
+ return {
+ "window_days": days,
+ "subscription_statuses": overview["subscriptions"],
+ "paying_users": overview["paying_users"],
+ "cancelling_users": overview["cancelling_users"],
+ "free_users": overview["free_users"],
+ "low_balance_users": overview["low_balance_users"],
+ "topups_usd": sum((point["value"] for point in overview["topups_usd"]), Decimal("0")),
+ "spend_usd": sum((point["value"] for point in overview["spend_usd"]), Decimal("0")),
+ "spend_by_service_usd": overview["spend_by_service"],
+ }
+
+
+def _customer_activity(args: dict[str, Any]) -> dict[str, Any]:
+ email = str(args.get("email", "")).strip()[:254]
+ days = args["days"]
+ user = user_insights.users(user_insights.window_start(days)).filter(email__iexact=email).first()
+ if user is None:
+ return {"found": False}
+ activity = user_insights.user_activity(user, user_insights.window_start(days))
+ return {
+ "found": True,
+ "email": user.email,
+ "signed_up_at": user.date_joined.isoformat(),
+ "activation_stage": user_insights.stage(user),
+ "subscription_status": activity["billing"]["subscription_status"],
+ "lifetime_spend_usd": activity["billing"]["spend_usd"],
+ "lifetime_topups_usd": activity["billing"]["topups_usd"],
+ "current_credit_balance_usd": activity["billing"]["balance_usd"],
+ "projects": user.projects,
+ "trace_count_in_window": user.spans,
+ "last_trace_at": user.last_span_at.isoformat() if user.last_span_at else None,
+ "training": activity["training"]["totals"],
+ "traces_total": activity["traces"]["total"],
+ "inference_calls": activity["inference"]["calls"],
+ "evaluations": activity["evaluations"]["total"],
+ }
+
+
+def _customers_at_step(args: dict[str, Any]) -> dict[str, Any]:
+ step = args["step"]
+ if step in user_insights.RESETTABLE_MILESTONE_STEPS:
+ return {
+ "available": False,
+ "reason": (
+ f"First-time activity for {step} cannot be determined from retained product records. "
+ "Deployment and alias timestamps reset on redeployment or model switching. "
+ "No first-time customer count or list is available."
+ ),
+ }
+ days = args["days"]
+ limit = args.get("limit", 25)
+ since = user_insights.window_start(days)
+ return {
+ "available": True,
+ "step": step,
+ "window_days": days,
+ **user_insights.milestone_customers(since, step=step, limit=limit),
+ }
+
+
+def _private_result(name: str, result: dict[str, Any]) -> str:
+ """Format customer records in-process, without another model request."""
+ if name == "customer_activity":
+ if not result.get("found"):
+ return "No matching customer was found."
+ return (
+ f"Customer: {result['email']}\n"
+ f"Signed up: {result['signed_up_at']}\n"
+ f"Milestone: {result['activation_stage']}\n"
+ f"Subscription: {result['subscription_status'] or 'None'}\n"
+ f"Lifetime spend: ${result['lifetime_spend_usd']}\n"
+ f"Lifetime top-ups: ${result['lifetime_topups_usd']}\n"
+ f"Credit balance: ${result['current_credit_balance_usd']}\n"
+ f"Spans in the selected UTC window: {result['trace_count_in_window']}\n"
+ f"Project lifetime totals: {result['traces_total']} traces, "
+ f"{result['inference_calls']} model calls, {result['evaluations']} evaluations.\n"
+ "Project activity belongs to the customer's projects; it does not identify the actor."
+ )
+ if not result["available"]:
+ return result["reason"]
+ rows = []
+ for row in result.get("customers", []):
+ line = f"{row['email']}: {row['reached_at']}"
+ if sum(len(value) + 1 for value in rows) + len(line) > 2400:
+ break
+ rows.append(line)
+ listing = "\n".join(rows)
+ return (
+ f"{result['step']}: {result['total']} users with their earliest retained record "
+ f"in the last {result['window_days']} UTC days.\n"
+ f"Showing {len(rows)} results.\n{listing}\n"
+ "Retained records do not prove lifetime-first activity if history was deleted. "
+ "Project milestones are attributed to memberships, not individual actions."
+ )
+
+
+def query(tool: str, arguments: dict[str, Any]) -> tuple[str, bool]:
+ """Arguments are validated by the internal API before any query executes."""
+ handlers = {
+ "activation_funnel": _activation_funnel,
+ "product_usage": _product_usage,
+ "billing_summary": _billing_summary,
+ "customers_at_step": _customers_at_step,
+ "customer_activity": _customer_activity,
+ }
+ if tool == "product_usage":
+ result = handlers[tool](arguments)
+ else:
+ with user_insights.analytics_read_budget():
+ result = handlers[tool](arguments)
+ private = tool in {"customer_activity", "customers_at_step"}
+ return (_private_result(tool, result) if private else json.dumps(result, default=str)), private
diff --git a/overbae/services/sales_metrics.py b/overbae/services/sales_metrics.py
deleted file mode 100644
index 128a02f7..00000000
--- a/overbae/services/sales_metrics.py
+++ /dev/null
@@ -1,352 +0,0 @@
-"""Cross-tenant metrics for the internal sales dashboard. Guest users and the
-projects only guests belong to are excluded everywhere."""
-
-from __future__ import annotations
-
-from collections.abc import Callable
-from datetime import datetime
-from decimal import Decimal
-from statistics import median
-from typing import Any
-
-from django.db.models import (
- Aggregate,
- Count,
- DecimalField,
- Exists,
- F,
- Max,
- OuterRef,
- Q,
- QuerySet,
- Subquery,
- Sum,
- Value,
-)
-from django.db.models.functions import Coalesce, TruncDay
-
-from overbae.models import (
- BillingService,
- BillingTelemetry,
- Capability,
- Dataset,
- DeployedModel,
- EvalRun,
- FinetuningJob,
- InferenceCall,
- OptimizerExperiment,
- Project,
- ProjectMembership,
- Span,
- Subscription,
- SubscriptionStatus,
- User,
-)
-
-FUNNEL_STEPS = (
- "signed_up",
- "created_project",
- "sent_first_span",
- "synced_capabilities",
- "ran_evaluation",
- "started_training",
- "deployed_model",
- "called_alias",
-)
-LOW_BALANCE_USD = Decimal("5")
-TOP_BASE_MODELS = 5
-RECENT_TRAINING_JOBS = 20
-
-TRAINING_OUTCOMES = {
- FinetuningJob.Status.SUCCEEDED: "completed",
- FinetuningJob.Status.FAILED: "failed",
- FinetuningJob.Status.CANCELLED: "cancelled",
-}
-
-USD = DecimalField(max_digits=12, decimal_places=7)
-
-
-def _customers() -> QuerySet[User]:
- return User.objects.filter(is_guest=False)
-
-
-def _customer_project_ids() -> QuerySet[ProjectMembership]:
- return ProjectMembership.objects.filter(user__is_guest=False).values("project_id")
-
-
-def _daily(queryset: QuerySet, field: str, value: Aggregate | None = None) -> list[dict[str, Any]]:
- return list(
- queryset.annotate(day=TruncDay(field))
- .values("day")
- .annotate(value=value or Count("pk"))
- .order_by("day")
- .values("day", "value")
- )
-
-
-def _counts(queryset: QuerySet, field: str) -> dict[str, int]:
- return dict(queryset.order_by().values_list(field).annotate(n=Count("pk")))
-
-
-def _daily_by(
- queryset: QuerySet, field: str, group: str, bucket: Callable[[str], str]
-) -> list[dict[str, Any]]:
- days: dict[datetime, dict[str, int]] = {}
- for row in (
- queryset.annotate(day=TruncDay(field))
- .values("day", group)
- .annotate(n=Count("pk"))
- .order_by("day")
- ):
- values = days.setdefault(row["day"], {})
- key = bucket(row[group])
- values[key] = values.get(key, 0) + row["n"]
- return [{"day": day, "values": values} for day, values in days.items()]
-
-
-def _training_outcome(status: str) -> str:
- return TRAINING_OUTCOMES.get(status, "in_progress")
-
-
-def _workflow(queryset: QuerySet, since: datetime) -> dict[str, Any]:
- return {
- "total": queryset.count(),
- "by_status": _counts(queryset, "status"),
- "daily": _daily(queryset.filter(created_at__gte=since), "created_at"),
- }
-
-
-def _scalar(queryset: QuerySet, aggregate: Aggregate) -> Subquery:
- return Subquery(
- queryset.order_by().annotate(grp=Value(1)).values("grp").annotate(v=aggregate).values("v")
- )
-
-
-def _reached() -> dict[str, Exists]:
- """Per-user funnel flags, keyed ``reached_<step>``; correlate on the outer user."""
- member = OuterRef("pk")
- return {
- "reached_created_project": Exists(ProjectMembership.objects.filter(user=member)),
- "reached_sent_first_span": Exists(Span.objects.filter(project__memberships__user=member)),
- "reached_synced_capabilities": Exists(
- Capability.objects.filter(project__memberships__user=member, observed=False).exclude(
- status=Capability.Status.DELETED
- )
- ),
- "reached_ran_evaluation": Exists(EvalRun.objects.filter(project__memberships__user=member)),
- "reached_started_training": Exists(
- FinetuningJob.objects.filter(project__memberships__user=member)
- ),
- "reached_deployed_model": Exists(
- DeployedModel.objects.filter(
- project__memberships__user=member, deployed_at__isnull=False
- )
- ),
- "reached_called_alias": Exists(
- Capability.objects.filter(
- project__memberships__user=member, first_application_request_at__isnull=False
- )
- ),
- }
-
-
-def stage(account: User) -> str:
- """The furthest funnel step an annotated ``accounts()`` row reached."""
- reached = [step for step in FUNNEL_STEPS[1:] if getattr(account, f"reached_{step}")]
- return reached[-1] if reached else FUNNEL_STEPS[0]
-
-
-def _active_accounts(since: datetime) -> int:
- return (
- _customers()
- .filter(
- Exists(
- Span.objects.filter(
- project__memberships__user=OuterRef("pk"), received_at__gte=since
- )
- )
- )
- .count()
- )
-
-
-def overview(since: datetime, active_since: datetime) -> dict[str, Any]:
- customers = _customers()
- project_ids = _customer_project_ids()
- subscriptions = Subscription.objects.filter(user__is_guest=False)
- ledger = BillingTelemetry.objects.filter(user__is_guest=False)
- window_ledger = ledger.filter(timestamp__gte=since)
- spans = Span.objects.filter(project_id__in=project_ids, received_at__gte=since)
- jobs = FinetuningJob.objects.filter(project_id__in=project_ids, created_at__gte=since)
- status_counts = _counts(subscriptions, "status")
- return {
- "accounts_total": customers.count(),
- "signups": _daily(customers.filter(date_joined__gte=since), "date_joined"),
- "sign_on_methods": _counts(customers, "sign_on_method"),
- "projects_created": _daily(
- Project.objects.filter(pk__in=project_ids, created_at__gte=since), "created_at"
- ),
- "active_accounts_7d": _active_accounts(active_since),
- "active_accounts_window": _active_accounts(since),
- "subscriptions": status_counts,
- "paying_accounts": status_counts.get(SubscriptionStatus.ACTIVE, 0),
- "cancelling_accounts": subscriptions.filter(
- status=SubscriptionStatus.ACTIVE, cancel_at_period_end=True
- ).count(),
- "free_accounts": customers.filter(project_memberships__isnull=False)
- .exclude(pk__in=subscriptions.filter(status=SubscriptionStatus.ACTIVE).values("user_id"))
- .distinct()
- .count(),
- "low_balance_accounts": ledger.order_by()
- .values("user")
- .annotate(balance=Sum("amount"), spent=Sum("amount", filter=Q(amount__lt=0)))
- .filter(balance__lt=LOW_BALANCE_USD, spent__isnull=False)
- .count(),
- "topups_usd": _daily(
- window_ledger.filter(service=BillingService.STRIPE_TOPUP, amount__gt=0),
- "timestamp",
- Sum("amount"),
- ),
- "spend_by_service": {
- service: -total
- for service, total in window_ledger.filter(amount__lt=0)
- .order_by()
- .values_list("service")
- .annotate(total=Sum("amount"))
- },
- "spans": _daily(spans, "received_at"),
- "traces": _daily(spans.filter(parent_span_id__isnull=True), "received_at"),
- "training_jobs": _counts(jobs, "status"),
- "top_base_models": list(
- jobs.order_by()
- .values("base_model")
- .annotate(jobs=Count("pk"))
- .order_by("-jobs", "base_model")[:TOP_BASE_MODELS]
- ),
- "live_deployments": DeployedModel.objects.filter(
- project_id__in=project_ids, status=DeployedModel.Status.READY
- ).count(),
- "inference_calls": _daily(
- InferenceCall.objects.filter(project_id__in=project_ids, created_at__gte=since),
- "created_at",
- ),
- }
-
-
-def funnel(since: datetime) -> dict[str, Any]:
- cohort = _customers().filter(date_joined__gte=since)
- counts = cohort.annotate(**_reached()).aggregate(
- signed_up=Count("pk"),
- **{step: Count("pk", filter=Q(**{f"reached_{step}": True})) for step in FUNNEL_STEPS[1:]},
- )
- first_span = (
- Span.objects.filter(project__memberships__user=OuterRef("pk"))
- .order_by("received_at")
- .values("received_at")[:1]
- )
- hours = [
- max((first - joined).total_seconds(), 0) / 3600
- for joined, first in cohort.annotate(first=Subquery(first_span))
- .filter(first__isnull=False)
- .values_list("date_joined", "first")
- ]
- return {
- "steps": [{"step": step, "accounts": counts[step]} for step in FUNNEL_STEPS],
- "median_hours_to_first_span": median(hours) if hours else None,
- }
-
-
-def accounts(since: datetime) -> QuerySet[User]:
- member = OuterRef("pk")
- spans = Span.objects.filter(project__memberships__user=member)
- ledger = BillingTelemetry.objects.filter(user=member)
- zero_usd = Value(Decimal("0"), output_field=USD)
- return _customers().annotate(
- **_reached(),
- subscription_status=F("subscription__status"),
- projects=Coalesce(_scalar(ProjectMembership.objects.filter(user=member), Count("pk")), 0),
- seats=Coalesce(
- _scalar(
- ProjectMembership.objects.filter(project__memberships__user=member),
- Count("user", distinct=True),
- ),
- 0,
- ),
- last_span_at=_scalar(spans, Max("received_at")),
- spans=Coalesce(_scalar(spans.filter(received_at__gte=since), Count("pk")), 0),
- spend_usd=Coalesce(
- _scalar(
- ledger.filter(amount__lt=0, timestamp__gte=since),
- Sum(-F("amount"), output_field=USD),
- ),
- zero_usd,
- ),
- topups_usd=Coalesce(
- _scalar(
- ledger.filter(service=BillingService.STRIPE_TOPUP, amount__gt=0), Sum("amount")
- ),
- zero_usd,
- ),
- balance_usd=Coalesce(_scalar(ledger, Sum("amount")), zero_usd),
- training_jobs=Coalesce(
- _scalar(FinetuningJob.objects.filter(project__memberships__user=member), Count("pk")),
- 0,
- ),
- live_deployments=Coalesce(
- _scalar(
- DeployedModel.objects.filter(
- project__memberships__user=member, status=DeployedModel.Status.READY
- ),
- Count("pk"),
- ),
- 0,
- ),
- )
-
-
-def account_activity(account: User, since: datetime) -> dict[str, Any]:
- """Lifetime totals and in-window daily series across the account's projects."""
- project_ids = ProjectMembership.objects.filter(user=account).values("project_id")
- jobs = FinetuningJob.objects.filter(project_id__in=project_ids)
- totals = {"started": 0, "completed": 0, "failed": 0, "cancelled": 0, "in_progress": 0}
- for status, n in _counts(jobs, "status").items():
- totals["started"] += n
- totals[_training_outcome(status)] += n
- roots = Span.objects.filter(project_id__in=project_ids, parent_span_id__isnull=True)
- calls = InferenceCall.objects.filter(project_id__in=project_ids)
- by_model = _counts(calls, "deployed_model__model_id")
- datasets = Dataset.objects.filter(project_id__in=project_ids)
- return {
- "account": account,
- "training": {
- "totals": totals,
- "daily": _daily_by(
- jobs.filter(created_at__gte=since), "created_at", "status", _training_outcome
- ),
- "recent": list(
- jobs.order_by("-created_at").values(
- "id", "base_model", "status", "created_at", "completed_at"
- )[:RECENT_TRAINING_JOBS]
- ),
- },
- "traces": {
- "total": roots.count(),
- "daily": _daily(roots.filter(received_at__gte=since), "received_at"),
- },
- "inference": {
- "calls": sum(by_model.values()),
- "models": len(by_model),
- "by_model": by_model,
- "daily": _daily(calls.filter(created_at__gte=since), "created_at"),
- },
- "datasets": {
- "total": datasets.count(),
- "by_source": _counts(datasets, "source_kind"),
- "by_intent": _counts(datasets, "intent"),
- "daily": _daily(datasets.filter(created_at__gte=since), "created_at"),
- },
- "optimizer": _workflow(
- OptimizerExperiment.objects.filter(project_id__in=project_ids), since
- ),
- "evaluations": _workflow(EvalRun.objects.filter(project_id__in=project_ids), since),
- }
diff --git a/overbae/services/user_insights.py b/overbae/services/user_insights.py
new file mode 100644
index 00000000..9988dc14
--- /dev/null
+++ b/overbae/services/user_insights.py
@@ -0,0 +1,506 @@
+"""Cross-tenant product usage metrics for Overwatch. Guest users and the
+projects only guests belong to are excluded everywhere."""
+
+from __future__ import annotations
+
+from collections.abc import Callable
+from contextlib import contextmanager
+from datetime import UTC, datetime, timedelta
+from decimal import Decimal
+from statistics import median
+from time import monotonic
+from typing import Any
+
+from django.db import connection, transaction
+from django.db.models import (
+ Aggregate,
+ Count,
+ DecimalField,
+ Exists,
+ F,
+ Max,
+ OuterRef,
+ Q,
+ QuerySet,
+ Subquery,
+ Sum,
+ Value,
+)
+from django.db.models.functions import Coalesce, TruncDay
+from django.utils import timezone
+
+from overbae.models import (
+ BillingService,
+ BillingTelemetry,
+ Capability,
+ Dataset,
+ DeployedModel,
+ EvalRun,
+ FinetuningJob,
+ InferenceCall,
+ OptimizerExperiment,
+ Project,
+ ProjectMembership,
+ Span,
+ Subscription,
+ SubscriptionStatus,
+ User,
+)
+
+ACTIVATION_STEPS = (
+ "signed_up",
+ "joined_project",
+ "sent_first_span",
+ "synced_capabilities",
+ "ran_evaluation",
+ "started_training",
+ "deployed_model",
+ "called_alias",
+)
+RESETTABLE_MILESTONE_STEPS = frozenset({"deployed_model", "called_alias"})
+TOP_BASE_MODELS = 5
+RECENT_TRAINING_JOBS = 20
+LOW_BALANCE_USD = Decimal("5")
+USD = DecimalField(max_digits=12, decimal_places=7)
+
+TRAINING_OUTCOMES = {
+ FinetuningJob.Status.SUCCEEDED: "completed",
+ FinetuningJob.Status.FAILED: "failed",
+ FinetuningJob.Status.CANCELLED: "cancelled",
+}
+
+
+@contextmanager
+def analytics_read_budget(seconds: float = 15):
+ """Bound each SQL statement and stop a multi-query report after its budget."""
+ deadline = monotonic() + seconds
+
+ def bounded(execute, sql, params, many, context):
+ if monotonic() >= deadline:
+ raise TimeoutError("analytics_read_timeout")
+ return execute(sql, params, many, context)
+
+ with transaction.atomic():
+ previous = None
+ if connection.vendor == "postgresql":
+ with connection.cursor() as cursor:
+ cursor.execute("SHOW statement_timeout")
+ previous = cursor.fetchone()[0]
+ cursor.execute(
+ "SELECT set_config('statement_timeout', %s, true)",
+ [f"{max(1, min(5000, int(seconds * 1000)))}ms"],
+ )
+ with connection.execute_wrapper(bounded):
+ yield
+ # On failure the atomic rollback restores SET LOCAL automatically.
+ if previous is not None:
+ with connection.cursor() as cursor:
+ cursor.execute("SELECT set_config('statement_timeout', %s, true)", [previous])
+
+
+def window_start(days: int) -> datetime:
+ """Start of the first UTC calendar day, including today in the day count."""
+ if isinstance(days, bool) or not isinstance(days, int) or not 1 <= days <= 365:
+ raise ValueError("days must be an integer from 1 to 365")
+ return timezone.now().astimezone(UTC).replace(
+ hour=0, minute=0, second=0, microsecond=0
+ ) - timedelta(days=days - 1)
+
+
+def _users() -> QuerySet[User]:
+ return User.objects.filter(is_guest=False)
+
+
+def _user_project_ids() -> QuerySet[ProjectMembership]:
+ return ProjectMembership.objects.filter(user__is_guest=False).values("project_id")
+
+
+def _daily(queryset: QuerySet, field: str, value: Aggregate | None = None) -> list[dict[str, Any]]:
+ return list(
+ queryset.annotate(day=TruncDay(field))
+ .values("day")
+ .annotate(value=value or Count("pk"))
+ .order_by("day")
+ .values("day", "value")
+ )
+
+
+def _counts(queryset: QuerySet, field: str) -> dict[str, int]:
+ return dict(queryset.order_by().values_list(field).annotate(n=Count("pk")))
+
+
+def _daily_by(
+ queryset: QuerySet, field: str, group: str, bucket: Callable[[str], str]
+) -> list[dict[str, Any]]:
+ days: dict[datetime, dict[str, int]] = {}
+ for row in (
+ queryset.annotate(day=TruncDay(field))
+ .values("day", group)
+ .annotate(n=Count("pk"))
+ .order_by("day")
+ ):
+ values = days.setdefault(row["day"], {})
+ key = bucket(row[group])
+ values[key] = values.get(key, 0) + row["n"]
+ return [{"day": day, "values": values} for day, values in days.items()]
+
+
+def _training_outcome(status: str) -> str:
+ return TRAINING_OUTCOMES.get(status, "in_progress")
+
+
+def _workflow(queryset: QuerySet, since: datetime) -> dict[str, Any]:
+ return {
+ "total": queryset.count(),
+ "by_status": _counts(queryset, "status"),
+ "daily": _daily(queryset.filter(created_at__gte=since), "created_at"),
+ }
+
+
+def _scalar(queryset: QuerySet, aggregate: Aggregate) -> Subquery:
+ return Subquery(
+ queryset.order_by().annotate(grp=Value(1)).values("grp").annotate(v=aggregate).values("v")
+ )
+
+
+def _reached() -> dict[str, Exists]:
+ """Per-user activation flags, keyed ``reached_<step>``; correlate on the outer user."""
+ member = OuterRef("pk")
+ return {
+ "reached_joined_project": Exists(ProjectMembership.objects.filter(user=member)),
+ "reached_sent_first_span": Exists(
+ Span.objects.filter(
+ project__memberships__user=member,
+ received_at__gte=F("project__memberships__created_at"),
+ )
+ ),
+ "reached_synced_capabilities": Exists(
+ Capability.objects.filter(
+ project__memberships__user=member,
+ observed=False,
+ created_at__gte=F("project__memberships__created_at"),
+ ).exclude(status=Capability.Status.DELETED)
+ ),
+ "reached_ran_evaluation": Exists(
+ EvalRun.objects.filter(
+ project__memberships__user=member,
+ created_at__gte=F("project__memberships__created_at"),
+ )
+ ),
+ "reached_started_training": Exists(
+ FinetuningJob.objects.filter(
+ project__memberships__user=member,
+ created_at__gte=F("project__memberships__created_at"),
+ )
+ ),
+ "reached_deployed_model": Exists(
+ DeployedModel.objects.filter(
+ project__memberships__user=member,
+ deployed_at__isnull=False,
+ deployed_at__gte=F("project__memberships__created_at"),
+ )
+ ),
+ "reached_called_alias": Exists(
+ Capability.objects.filter(
+ project__memberships__user=member,
+ first_application_request_at__isnull=False,
+ first_application_request_at__gte=F("project__memberships__created_at"),
+ )
+ ),
+ }
+
+
+def stage(user: User) -> str:
+ """The furthest activation step an annotated user row reached."""
+ reached = [step for step in ACTIVATION_STEPS[1:] if getattr(user, f"reached_{step}")]
+ return reached[-1] if reached else ACTIVATION_STEPS[0]
+
+
+def _active_users(since: datetime) -> int:
+ return (
+ _users()
+ .filter(
+ Exists(
+ Span.objects.filter(
+ Q(received_at__gte=since),
+ project__memberships__user=OuterRef("pk"),
+ received_at__gte=F("project__memberships__created_at"),
+ )
+ )
+ )
+ .count()
+ )
+
+
+def overview(since: datetime, active_since: datetime) -> dict[str, Any]:
+ users = _users()
+ project_ids = _user_project_ids()
+ spans = Span.objects.filter(project_id__in=project_ids, received_at__gte=since)
+ jobs = FinetuningJob.objects.filter(project_id__in=project_ids, created_at__gte=since)
+ subscriptions = Subscription.objects.filter(user__is_guest=False)
+ ledger = BillingTelemetry.objects.filter(user__is_guest=False)
+ window_ledger = ledger.filter(timestamp__gte=since)
+ subscription_counts = _counts(subscriptions, "status")
+ ledger_balances = (
+ ledger.order_by()
+ .values("user")
+ .annotate(
+ balance=Sum("amount"),
+ spent=Sum("amount", filter=Q(amount__lt=0)),
+ )
+ )
+ return {
+ "users_total": users.count(),
+ "signups": _daily(users.filter(date_joined__gte=since), "date_joined"),
+ "sign_on_methods": _counts(users, "sign_on_method"),
+ "projects_created": _daily(
+ Project.objects.filter(pk__in=project_ids, created_at__gte=since), "created_at"
+ ),
+ "trace_active_users_7d": _active_users(active_since),
+ "trace_active_users_window": _active_users(since),
+ "spans": _daily(spans, "received_at"),
+ "traces": _daily(spans.filter(parent_span_id__isnull=True), "received_at"),
+ "training_jobs": _counts(jobs, "status"),
+ "top_base_models": list(
+ jobs.order_by()
+ .values("base_model")
+ .annotate(jobs=Count("pk"))
+ .order_by("-jobs", "base_model")[:TOP_BASE_MODELS]
+ ),
+ "live_deployments": DeployedModel.objects.filter(
+ project_id__in=project_ids, status=DeployedModel.Status.READY
+ ).count(),
+ "inference_calls": _daily(
+ InferenceCall.objects.filter(project_id__in=project_ids, created_at__gte=since),
+ "created_at",
+ ),
+ "subscriptions": subscription_counts,
+ "paying_users": subscription_counts.get(SubscriptionStatus.ACTIVE, 0),
+ "cancelling_users": subscriptions.filter(
+ status=SubscriptionStatus.ACTIVE, cancel_at_period_end=True
+ ).count(),
+ "free_users": users.filter(project_memberships__isnull=False)
+ .exclude(pk__in=subscriptions.filter(status=SubscriptionStatus.ACTIVE).values("user_id"))
+ .distinct()
+ .count(),
+ "low_balance_users": ledger_balances.filter(
+ balance__lt=LOW_BALANCE_USD, spent__isnull=False
+ ).count(),
+ "topups_usd": _daily(
+ window_ledger.filter(service=BillingService.STRIPE_TOPUP, amount__gt=0),
+ "timestamp",
+ Sum("amount"),
+ ),
+ "spend_usd": _daily(
+ window_ledger.filter(amount__lt=0), "timestamp", Sum(-F("amount"), output_field=USD)
+ ),
+ "spend_by_service": {
+ service: -total
+ for service, total in window_ledger.filter(amount__lt=0)
+ .order_by()
+ .values_list("service")
+ .annotate(total=Sum("amount"))
+ },
+ }
+
+
+def activation(since: datetime) -> dict[str, Any]:
+ cohort = _users().filter(date_joined__gte=since)
+ counts = cohort.annotate(**_reached()).aggregate(
+ signed_up=Count("pk"),
+ **{
+ step: Count("pk", filter=Q(**{f"reached_{step}": True}))
+ for step in ACTIVATION_STEPS[1:]
+ },
+ )
+ first_span = (
+ Span.objects.filter(
+ project__memberships__user=OuterRef("pk"),
+ received_at__gte=F("project__memberships__created_at"),
+ )
+ .order_by("received_at")
+ .values("received_at")[:1]
+ )
+ hours = [
+ max((first - joined).total_seconds(), 0) / 3600
+ for joined, first in cohort.annotate(first=Subquery(first_span))
+ .filter(first__isnull=False)
+ .values_list("date_joined", "first")
+ ]
+ return {
+ "steps": [{"step": step, "users": counts[step]} for step in ACTIVATION_STEPS],
+ "median_hours_to_first_span": median(hours) if hours else None,
+ }
+
+
+def milestone_customers(since: datetime, *, step: str, limit: int) -> dict[str, Any]:
+ """Count retained milestones separately from the bounded newest-customer list."""
+ if step in RESETTABLE_MILESTONE_STEPS:
+ raise ValueError("First-time deployment and alias activity cannot be determined.")
+ if not 1 <= limit <= 25:
+ raise ValueError("Invalid customer report limit.")
+ until = timezone.now()
+ if step == "signed_up":
+ matched = _users().filter(date_joined__gte=since, date_joined__lte=until)
+ rows = matched.annotate(at=F("date_joined"))
+ else:
+ sources = {
+ "joined_project": (ProjectMembership, "user_id", "created_at", Q(user__is_guest=False)),
+ "sent_first_span": (Span, "project__memberships__user_id", "received_at", Q()),
+ "synced_capabilities": (
+ Capability,
+ "project__memberships__user_id",
+ "created_at",
+ Q(observed=False) & ~Q(status=Capability.Status.DELETED),
+ ),
+ "ran_evaluation": (EvalRun, "project__memberships__user_id", "created_at", Q()),
+ "started_training": (FinetuningJob, "project__memberships__user_id", "created_at", Q()),
+ }
+ model, user_field, at_field, condition = sources[step]
+ if step != "joined_project":
+ condition &= Q(
+ project__memberships__user__is_guest=False,
+ **{f"{at_field}__gte": F("project__memberships__created_at")},
+ )
+ # Correlate on a scalar user PK across all memberships. Earlier retained
+ # activity excludes the user even if they reached the step in another project.
+ earlier = model.objects.filter(
+ condition, **{user_field: OuterRef("pk"), f"{at_field}__lt": since}
+ )
+ candidates = model.objects.filter(
+ condition,
+ **{user_field: OuterRef("pk"), f"{at_field}__gte": since, f"{at_field}__lte": until},
+ )
+ matched = _users().filter(Exists(candidates), ~Exists(earlier))
+ rows = matched.annotate(at=Subquery(candidates.order_by(at_field).values(at_field)[:1]))
+ return {
+ "total": matched.count(),
+ "customers": [
+ {"email": row["email"], "reached_at": row["at"].isoformat()}
+ for row in rows.order_by("-at", "pk").values("email", "at")[:limit]
+ ],
+ }
+
+
+def users(since: datetime) -> QuerySet[User]:
+ member = OuterRef("pk")
+ spans = Span.objects.filter(project__memberships__user=member)
+ ledger = BillingTelemetry.objects.filter(user=member)
+ zero_usd = Value(Decimal("0"), output_field=USD)
+ return _users().annotate(
+ **_reached(),
+ projects=Coalesce(_scalar(ProjectMembership.objects.filter(user=member), Count("pk")), 0),
+ seats=Coalesce(
+ _scalar(
+ ProjectMembership.objects.filter(
+ project__memberships__user=member, user__is_guest=False
+ ),
+ Count("user", distinct=True),
+ ),
+ 0,
+ ),
+ last_span_at=_scalar(spans, Max("received_at")),
+ spans=Coalesce(_scalar(spans.filter(received_at__gte=since), Count("pk")), 0),
+ training_jobs=Coalesce(
+ _scalar(FinetuningJob.objects.filter(project__memberships__user=member), Count("pk")),
+ 0,
+ ),
+ live_deployments=Coalesce(
+ _scalar(
+ DeployedModel.objects.filter(
+ project__memberships__user=member, status=DeployedModel.Status.READY
+ ),
+ Count("pk"),
+ ),
+ 0,
+ ),
+ subscription_status=F("subscription__status"),
+ spend_usd=Coalesce(
+ _scalar(
+ ledger.filter(amount__lt=0, timestamp__gte=since),
+ Sum(-F("amount"), output_field=USD),
+ ),
+ zero_usd,
+ ),
+ topups_usd=Coalesce(
+ _scalar(
+ ledger.filter(service=BillingService.STRIPE_TOPUP, amount__gt=0),
+ Sum("amount"),
+ ),
+ zero_usd,
+ ),
+ balance_usd=Coalesce(_scalar(ledger, Sum("amount")), zero_usd),
+ )
+
+
+def user_activity(user: User, since: datetime) -> dict[str, Any]:
+ """Lifetime totals and in-window daily series across the user's projects."""
+ project_ids = ProjectMembership.objects.filter(user=user).values("project_id")
+ jobs = FinetuningJob.objects.filter(project_id__in=project_ids)
+ totals = {"started": 0, "completed": 0, "failed": 0, "cancelled": 0, "in_progress": 0}
+ for status, n in _counts(jobs, "status").items():
+ totals["started"] += n
+ totals[_training_outcome(status)] += n
+ roots = Span.objects.filter(project_id__in=project_ids, parent_span_id__isnull=True)
+ calls = InferenceCall.objects.filter(project_id__in=project_ids)
+ by_model = _counts(calls, "deployed_model__model_id")
+ datasets = Dataset.objects.filter(project_id__in=project_ids)
+ ledger = BillingTelemetry.objects.filter(user=user)
+ spend = Sum(-F("amount"), output_field=USD)
+ topups = Sum("amount")
+ return {
+ "user": user,
+ "billing": {
+ "subscription_status": getattr(user, "subscription_status", None),
+ "spend_usd": ledger.filter(amount__lt=0).aggregate(value=spend)["value"]
+ or Decimal("0"),
+ "topups_usd": ledger.filter(
+ service=BillingService.STRIPE_TOPUP, amount__gt=0
+ ).aggregate(value=topups)["value"]
+ or Decimal("0"),
+ "balance_usd": ledger.aggregate(value=Sum("amount"))["value"] or Decimal("0"),
+ "spend_daily": _daily(
+ ledger.filter(amount__lt=0, timestamp__gte=since), "timestamp", spend
+ ),
+ "topups_daily": _daily(
+ ledger.filter(
+ service=BillingService.STRIPE_TOPUP,
+ amount__gt=0,
+ timestamp__gte=since,
+ ),
+ "timestamp",
+ topups,
+ ),
+ },
+ "training": {
+ "totals": totals,
+ "daily": _daily_by(
+ jobs.filter(created_at__gte=since), "created_at", "status", _training_outcome
+ ),
+ "recent": list(
+ jobs.order_by("-created_at").values(
+ "id", "base_model", "status", "created_at", "completed_at"
+ )[:RECENT_TRAINING_JOBS]
+ ),
+ },
+ "traces": {
+ "total": roots.count(),
+ "daily": _daily(roots.filter(received_at__gte=since), "received_at"),
+ },
+ "inference": {
+ "calls": sum(by_model.values()),
+ "models": len(by_model),
+ "by_model": by_model,
+ "daily": _daily(calls.filter(created_at__gte=since), "created_at"),
+ },
+ "datasets": {
+ "total": datasets.count(),
+ "by_source": _counts(datasets, "source_kind"),
+ "by_intent": _counts(datasets, "intent"),
+ "daily": _daily(datasets.filter(created_at__gte=since), "created_at"),
+ },
+ "optimizer": _workflow(
+ OptimizerExperiment.objects.filter(project_id__in=project_ids), since
+ ),
+ "evaluations": _workflow(EvalRun.objects.filter(project_id__in=project_ids), since),
+ }
diff --git a/overbae/settings.py b/overbae/settings.py
index d62e7a7d..6712c9ea 100644
--- a/overbae/settings.py
+++ b/overbae/settings.py
@@ -293,7 +293,7 @@ STRIPE_PRO_PRICE_ID = os.environ.get("STRIPE_PRO_PRICE_ID")
# One-time price of a single Overmind Credit ($0.01); top-up quantity = credits bought.
STRIPE_CREDIT_PRICE_ID = os.environ.get("STRIPE_CREDIT_PRICE_ID")
-# Bearer token for the cross-tenant /api/internal/sales/ endpoints; blank denies every request.
+# Existing bearer token for /api/internal/overwatch/* (legacy name); blank disables endpoints.
SALES_DASHBOARD_TOKEN = os.environ.get("SALES_DASHBOARD_TOKEN", "")
AUTH_USER_MODEL = "overbae.User"
@@ -594,6 +594,8 @@ OPENROUTER_API_KEY = os.environ.get("OPENROUTER_API_KEY", "")
# Feedback-channel incoming webhook; blank disables the notification.
SLACK_FEEDBACK_WEBHOOK_URL = os.environ.get("SLACK_FEEDBACK_WEBHOOK_URL", "")
+# Dedicated read-only analytics service credential, never shared with the dashboard.
+OVERWATCH_SERVICE_TOKEN = os.environ.get("OVERWATCH_SERVICE_TOKEN", "")
# Blank disables Clerk; self-hosted Console uses /api/auth/local/ instead.
# API keys and guest sessions still authenticate either way.
@@ -615,6 +617,12 @@ POSTHOG_PROJECT_TOKEN = (
)
)
POSTHOG_HOST = os.environ.get("POSTHOG_HOST", "https://eu.i.posthog.com")
+# Optional read-only access used by the internal Overwatch product insights view.
+POSTHOG_PERSONAL_API_KEY = os.environ.get("POSTHOG_PERSONAL_API_KEY", "")
+POSTHOG_PROJECT_ID = os.environ.get("POSTHOG_PROJECT_ID", "")
+POSTHOG_API_HOST = os.environ.get(
+ "POSTHOG_API_HOST", POSTHOG_HOST.replace(".i.posthog.com", ".posthog.com")
+).rstrip("/")
# TLS terminates at the Fly proxy, which forwards X-Forwarded-Proto: trusting it
# is how Django sees a client's HTTPS behind plain HTTP on the machine.
diff --git a/overbae/urls.py b/overbae/urls.py
index 9ebdb600..82fd8627 100644
--- a/overbae/urls.py
+++ b/overbae/urls.py
@@ -49,6 +49,7 @@ from overbae.api.mcp_oauth import MCPConsentView
from overbae.api.native_evaluation import NativeEvaluationViewSet
from overbae.api.optimizer import OptimizerCandidateViewSet, OptimizerExperimentViewSet
from overbae.api.otlp import otlp_traces
+from overbae.api.overwatch_agent import OverwatchQueryView
from overbae.api.public_models import PublicModelLibraryDetailView, PublicModelLibraryListView
from overbae.api.robots import robots_txt
from overbae.api.signal_views import SignalEventViewSet, SignalSubscriptionViewSet
@@ -135,27 +136,42 @@ router.register(r"signal-events", SignalEventViewSet, basename="signalevent")
urlpatterns = []
-# Self-hosted instances (no Clerk) never expose cross-tenant sales metrics.
+# Register internal Overwatch metrics only when an admin token is configured.
if settings.SALES_DASHBOARD_TOKEN:
- from overbae.api.sales_dashboard import (
- SalesAccountActivityView,
- SalesAccountsView,
- SalesFunnelView,
- SalesOverviewView,
+ from overbae.api.overwatch_dashboard import (
+ ActivationView,
+ OverviewView,
+ ProductUsageView,
+ UserActivityView,
+ UsersView,
)
urlpatterns += [
- path("api/internal/sales/overview/", SalesOverviewView.as_view(), name="sales-overview"),
- path("api/internal/sales/funnel/", SalesFunnelView.as_view(), name="sales-funnel"),
- path("api/internal/sales/accounts/", SalesAccountsView.as_view(), name="sales-accounts"),
+ path("api/internal/overwatch/overview/", OverviewView.as_view(), name="overwatch-overview"),
path(
- "api/internal/sales/accounts/<int:pk>/",
- SalesAccountActivityView.as_view(),
- name="sales-account-activity",
+ "api/internal/overwatch/activation/",
+ ActivationView.as_view(),
+ name="overwatch-activation",
+ ),
+ path(
+ "api/internal/overwatch/product-usage/",
+ ProductUsageView.as_view(),
+ name="overwatch-product-usage",
+ ),
+ path("api/internal/overwatch/users/", UsersView.as_view(), name="overwatch-users"),
+ path(
+ "api/internal/overwatch/users/<int:pk>/",
+ UserActivityView.as_view(),
+ name="overwatch-user-activity",
),
]
urlpatterns += [
+ path(
+ "api/internal/overwatch/agent/query/",
+ OverwatchQueryView.as_view(),
+ name="overwatch-agent-query",
+ ),
path("api/decision-models/", DecisionModelListView.as_view(), name="decision-model-list"),
path(
"api/deployed-models/<uuid:deployment_id>/inference/",
diff --git a/sales-dashboard/bun.lock b/sales-dashboard/bun.lock
index 843f45cf..7e0fbd2c 100644
--- a/sales-dashboard/bun.lock
+++ b/sales-dashboard/bun.lock
@@ -3,7 +3,7 @@
"configVersion": 1,
"workspaces": {
"": {
- "name": "overmind-sales-dashboard",
+ "name": "overmind-overwatch",
"dependencies": {
"@tanstack/react-query": "^5.101.2",
"@tanstack/react-router": "^1.170.17",
@@ -31,6 +31,9 @@
},
},
},
+ "overrides": {
+ "undici": "7.30.1",
+ },
"packages": {
"@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.29.7", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw=="],
@@ -680,7 +683,7 @@
"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
- "undici": ["[email protected]", "", {}, "sha512-RYONW2MeafgYlkVOKYKkA/Ag7BmXqgIWCa8t1m0JcxrQg9pI9lEqRhAOruOBCbAohOa/gkCF+iPi9hrgvTzu6Q=="],
+ "undici": ["[email protected]", "", {}, "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg=="],
"undici-types": ["[email protected]", "", {}, "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg=="],
diff --git a/sales-dashboard/index.html b/sales-dashboard/index.html
index 91c82993..df80df03 100644
--- a/sales-dashboard/index.html
+++ b/sales-dashboard/index.html
@@ -5,9 +5,9 @@
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="dark" name="color-scheme" />
<meta content="noindex, nofollow" name="robots" />
- <title>Overmind Sales</title>
+ <title>Overwatch</title>
<link as="font" crossorigin href="/fonts/GeistPixel-Square.woff2" rel="preload" type="font/woff2" />
- <link href="/favicon.png" rel="icon" type="image/png" />
+ <link href="/src/assets/overwatch-logo.svg" rel="icon" type="image/svg+xml" />
<meta content="#0b0b0c" name="theme-color" />
</head>
<body>
diff --git a/sales-dashboard/package.json b/sales-dashboard/package.json
index d75026a1..75dd2228 100644
--- a/sales-dashboard/package.json
+++ b/sales-dashboard/package.json
@@ -25,8 +25,8 @@
"wrangler": "^4.107.0"
},
"license": "AGPL-3.0",
- "name": "overmind-sales-dashboard",
- "packageManager": "[email protected]",
+ "name": "overmind-overwatch",
+ "packageManager": "[email protected]",
"private": true,
"scripts": {
"build": "vite build",
@@ -34,7 +34,11 @@
"lint": "biome lint",
"lint-format": "biome check --write",
"preview": "vite preview",
+ "test": "bun test",
"typecheck": "tsc --noEmit"
},
- "type": "module"
+ "type": "module",
+ "overrides": {
+ "undici": "7.30.1"
+ }
}
diff --git a/sales-dashboard/src/assets/overwatch-logo.svg b/sales-dashboard/src/assets/overwatch-logo.svg
new file mode 100644
index 00000000..f04443dc
--- /dev/null
+++ b/sales-dashboard/src/assets/overwatch-logo.svg
@@ -0,0 +1,814 @@
+<svg width="192" height="192" viewBox="0 0 192 192" fill="none" xmlns="http://www.w3.org/2000/svg">
+<rect x="66" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="72" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="78" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="84" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="90" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="96" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="102" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="108" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="114" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="120" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="60" y="6" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="66" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="72" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="78" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="84" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="90" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="96" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="102" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="108" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="114" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="120" y="6" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="6" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="42" y="12" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="48" y="12" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="54" y="12" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="60" y="12" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="12" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="72" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="78" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="84" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="90" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="96" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="102" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="108" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="114" y="12" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="120" y="12" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="12" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="12" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="138" y="12" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="144" y="12" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="36" y="18" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="42" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="48" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="54" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="60" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="18" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="18" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="78" y="18" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="84" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="90" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="96" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="102" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="108" y="18" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="114" y="18" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="120" y="18" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="138" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="144" y="18" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="150" y="18" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="30" y="24" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="36" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="42" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="48" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="54" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="78" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="84" y="24" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="24" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="24" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="24" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="114" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="120" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="24" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="144" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="150" y="24" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="156" y="24" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="24" y="30" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="30" y="30" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="36" y="30" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="42" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="30" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="78" y="30" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="30" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="30" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="30" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="30" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="30" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="30" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="120" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="30" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="30" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="156" y="30" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="162" y="30" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="36" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="24" y="36" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="36" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="36" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="36" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="78" y="36" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="84" y="36" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="90" y="36" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="36" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="36" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="36" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="36" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="120" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="36" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="36" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="162" y="36" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="36" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="42" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="42" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="42" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="42" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="72" y="42" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="78" y="42" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="84" y="42" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="90" y="42" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="96" y="42" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="42" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="42" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="42" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="42" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="42" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="42" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="42" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="42" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="48" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="48" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="48" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="48" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="72" y="48" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="78" y="48" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="84" y="48" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="90" y="48" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="48" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="48" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="48" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="48" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="48" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="48" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="48" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="48" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="48" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="54" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="54" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="54" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="54" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="72" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="54" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="54" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="54" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="54" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="54" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="54" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="60" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="60" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="18" y="60" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="30" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="60" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="72" y="60" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="60" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="60" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="90" y="60" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="96" y="60" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="60" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="60" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="60" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="60" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="60" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="168" y="60" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="60" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="180" y="60" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="66" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="66" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="66" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="18" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="24" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="30" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="66" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="66" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="84" y="66" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="90" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="66" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="66" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="168" y="66" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="174" y="66" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="180" y="66" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="66" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="72" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="72" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="72" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="18" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="24" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="30" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="72" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="72" width="6" height="6" fill="#EAF9FE" style="fill:#EAF9FE;fill:color(display-p3 0.9176 0.9765 0.9961);fill-opacity:1;"/>
+<rect x="84" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="72" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="72" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="168" y="72" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="174" y="72" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="180" y="72" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="72" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="78" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="78" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="18" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="24" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="30" y="78" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="78" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="78" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="78" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="78" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="78" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="78" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="78" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="78" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="168" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="174" y="78" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="180" y="78" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="78" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="84" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="84" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="84" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="18" y="84" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="24" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="30" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="84" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="84" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="84" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="84" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="84" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="84" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="168" y="84" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="174" y="84" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="180" y="84" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="84" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="90" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="90" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="90" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="18" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="24" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="30" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="90" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="90" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="90" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="90" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="90" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="168" y="90" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="174" y="90" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="180" y="90" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="90" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="96" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="96" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="96" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="18" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="24" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="30" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="96" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="96" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="96" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="168" y="96" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="174" y="96" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="180" y="96" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="96" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="102" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="102" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="102" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="18" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="24" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="30" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="102" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="102" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="102" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="168" y="102" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="174" y="102" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="180" y="102" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="102" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="108" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="108" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="108" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="18" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="24" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="30" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="108" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="108" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="108" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="168" y="108" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="174" y="108" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="180" y="108" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="108" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="114" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="114" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="114" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="18" y="114" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="24" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="30" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="114" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="114" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="114" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="114" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="168" y="114" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="174" y="114" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="180" y="114" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="114" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect y="120" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="120" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="12" y="120" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="18" y="120" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="24" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="30" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="120" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="72" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="120" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="126" y="120" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="120" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="168" y="120" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="174" y="120" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="180" y="120" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="186" y="120" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="6" y="126" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="126" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="18" y="126" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="126" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="30" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="36" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="66" y="126" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="126" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="126" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="132" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="126" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="162" y="126" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="168" y="126" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="126" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="180" y="126" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="132" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="132" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="132" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="132" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="66" y="132" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="132" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="132" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="132" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="132" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="132" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="132" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="132" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="132" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="138" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="138" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="138" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="138" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="66" y="138" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="138" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="138" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="132" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="138" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="138" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="138" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="138" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="138" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="12" y="144" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="144" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="24" y="144" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="144" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="36" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="42" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="66" y="144" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="78" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="144" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="120" y="144" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="132" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="144" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="156" y="144" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="162" y="144" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="144" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="174" y="144" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="18" y="150" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="24" y="150" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="30" y="150" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="36" y="150" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="42" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="48" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="54" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="60" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="66" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="72" y="150" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="78" y="150" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="150" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="150" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="150" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="150" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="150" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="150" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="120" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="126" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="132" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="138" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="144" y="150" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="150" y="150" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="156" y="150" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="162" y="150" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="168" y="150" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="24" y="156" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="30" y="156" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="36" y="156" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="42" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="48" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="54" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="60" y="156" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="66" y="156" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="72" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="78" y="156" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="84" y="156" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="90" y="156" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="156" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="156" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="108" y="156" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="114" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="120" y="156" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="126" y="156" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="132" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="138" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="144" y="156" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="150" y="156" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="156" y="156" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="162" y="156" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="30" y="162" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="36" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="42" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="48" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="54" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="60" y="162" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="66" y="162" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="72" y="162" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="78" y="162" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="84" y="162" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="90" y="162" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="96" y="162" width="6" height="6" fill="#051A19" style="fill:#051A19;fill:color(display-p3 0.0196 0.1020 0.0980);fill-opacity:1;"/>
+<rect x="102" y="162" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="108" y="162" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="114" y="162" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="120" y="162" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="126" y="162" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="132" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="138" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="144" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="150" y="162" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="156" y="162" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="36" y="168" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="42" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="48" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="54" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="60" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="168" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="72" y="168" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="78" y="168" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="84" y="168" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="90" y="168" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="96" y="168" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="102" y="168" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="108" y="168" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="114" y="168" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="120" y="168" width="6" height="6" fill="#48E0F1" style="fill:#48E0F1;fill:color(display-p3 0.2808 0.8794 0.9436);fill-opacity:1;"/>
+<rect x="126" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="138" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="144" y="168" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="150" y="168" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="42" y="174" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="48" y="174" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="54" y="174" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="60" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="66" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="72" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="78" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="84" y="174" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="90" y="174" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="96" y="174" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="102" y="174" width="6" height="6" fill="#B5F2FC" style="fill:#B5F2FC;fill:color(display-p3 0.7098 0.9490 0.9882);fill-opacity:1;"/>
+<rect x="108" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="114" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="120" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="174" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="132" y="174" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="138" y="174" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="144" y="174" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="60" y="180" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="66" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="72" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="78" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="84" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="90" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="96" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="102" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="108" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="114" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="120" y="180" width="6" height="6" fill="#177487" style="fill:#177487;fill:color(display-p3 0.0902 0.4549 0.5294);fill-opacity:1;"/>
+<rect x="126" y="180" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="66" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="72" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="78" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="84" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="90" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="96" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="102" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="108" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="114" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+<rect x="120" y="186" width="6" height="6" fill="#093434" style="fill:#093434;fill:color(display-p3 0.0353 0.2039 0.2039);fill-opacity:1;"/>
+</svg>
diff --git a/sales-dashboard/src/components/freshness.tsx b/sales-dashboard/src/components/freshness.tsx
index 7bd1d854..32eb651d 100644
--- a/sales-dashboard/src/components/freshness.tsx
+++ b/sales-dashboard/src/components/freshness.tsx
@@ -8,6 +8,7 @@ const time = new Intl.DateTimeFormat("en-GB", {
hour: "2-digit",
minute: "2-digit",
month: "short",
+ timeZoneName: "short",
});
export function Freshness({ data }: { data?: Cached }) {
diff --git a/sales-dashboard/src/lib/api.ts b/sales-dashboard/src/lib/api.ts
index eb8d14e1..f6b66a5c 100644
--- a/sales-dashboard/src/lib/api.ts
+++ b/sales-dashboard/src/lib/api.ts
@@ -1,58 +1,111 @@
-const TOKEN_KEY = "overmind.sales.token";
+const TOKEN_KEY = "overmind.overwatch.session";
const API_URL = import.meta.env.VITE_API_URL ?? "";
+const SESSION_MS = 30 * 60 * 1000;
-export const getToken = () => localStorage.getItem(TOKEN_KEY);
-export const setToken = (token: string) => localStorage.setItem(TOKEN_KEY, token);
-export const clearToken = () => localStorage.removeItem(TOKEN_KEY);
+export function clearToken() {
+ sessionStorage.removeItem(TOKEN_KEY);
+ localStorage.removeItem("overmind.sales.token");
+}
+
+export function getToken(): string | null {
+ // Retire the legacy persistent token, even for a previously signed-in browser.
+ localStorage.removeItem("overmind.sales.token");
+ try {
+ const value = JSON.parse(sessionStorage.getItem(TOKEN_KEY) ?? "null");
+ if (
+ typeof value?.token === "string" &&
+ typeof value?.expiresAt === "number" &&
+ value.expiresAt > Date.now()
+ ) {
+ return value.token;
+ }
+ } catch {
+ // Invalid or expired session state requires a fresh sign-in.
+ }
+ sessionStorage.removeItem(TOKEN_KEY);
+ return null;
+}
+
+export function setToken(token: string) {
+ clearToken();
+ sessionStorage.setItem(TOKEN_KEY, JSON.stringify({ expiresAt: Date.now() + SESSION_MS, token }));
+}
export class Unauthorized extends Error {}
export type Daily = { day: string; value: number };
export type DailyUsd = { day: string; value: string };
-export type Overview = {
- accounts_total: number;
+export type Overview = Cached & {
+ users_total: number;
signups: Daily[];
sign_on_methods: Record<string, number>;
projects_created: Daily[];
- active_accounts_7d: number;
- active_accounts_window: number;
- subscriptions: Record<string, number>;
- paying_accounts: number;
- cancelling_accounts: number;
- free_accounts: number;
- low_balance_accounts: number;
- topups_usd: DailyUsd[];
- spend_by_service: Record<string, string>;
+ trace_active_users_7d: number;
+ trace_active_users_window: number;
spans: Daily[];
traces: Daily[];
training_jobs: Record<string, number>;
top_base_models: { base_model: string; jobs: number }[];
live_deployments: number;
inference_calls: Daily[];
+ subscriptions: Record<string, number>;
+ paying_users: number;
+ cancelling_users: number;
+ free_users: number;
+ low_balance_users: number;
+ topups_usd: DailyUsd[];
+ spend_usd: DailyUsd[];
+ spend_by_service: Record<string, string>;
};
-export type Funnel = {
- steps: { step: string; accounts: number }[];
+export type Activation = {
+ steps: { step: string; users: number }[];
median_hours_to_first_span: number | null;
};
-export type Account = {
+export type ProductUsage = Cached & {
+ available: boolean;
+ reason?: string;
+ identity_basis?: string;
+ window_start?: string;
+ window_end?: string;
+ active_users?: number;
+ totals?: {
+ cli_completions: number;
+ mcp_tool_calls: number;
+ training_results_available: number;
+ training_checks_finished: number;
+ };
+ daily?: {
+ day: string;
+ cli_completions: number;
+ mcp_tool_calls: number;
+ training_results_available: number;
+ training_checks_finished: number;
+ }[];
+ top_mcp_tools?: { name: string; calls: number; users: number }[];
+ top_cli_commands?: { name: string; completions: number; users: number }[];
+ mcp_tool_errors?: number;
+ mcp_tool_error_rate?: number;
+};
+
+export type User = {
id: number;
email: string;
date_joined: string;
sign_on_method: string;
- subscription_status: string | null;
projects: number;
seats: number;
last_span_at: string | null;
spans: number;
- spend_usd: string;
- topups_usd: string;
- balance_usd: string;
training_jobs: number;
live_deployments: number;
stage: string;
+ subscription_status: string | null;
+ spend_usd: string;
+ topups_usd: string;
+ balance_usd: string;
};
export type Page<T> = { count: number; next: string | null; previous: string | null; results: T[] };
@@ -64,8 +117,16 @@ type Workflow = { total: number; by_status: Record<string, number>; daily: Daily
export type TrainingOutcome = "completed" | "failed" | "cancelled" | "in_progress";
-export type AccountActivity = {
- account: Account;
+export type UserActivity = Cached & {
+ user: User;
+ billing: {
+ subscription_status: string | null;
+ spend_usd: string;
+ topups_usd: string;
+ balance_usd: string;
+ spend_daily: DailyUsd[];
+ topups_daily: DailyUsd[];
+ };
training: {
totals: Record<"started" | TrainingOutcome, number>;
daily: { day: string; values: Partial<Record<TrainingOutcome, number>> }[];
@@ -89,8 +150,8 @@ export type AccountActivity = {
evaluations: Workflow;
};
-export async function salesGet<T>(
- path: "overview" | "funnel" | "accounts" | `accounts/${number}`,
+export async function overwatchGet<T>(
+ path: "overview" | "activation" | "product-usage" | "users" | `users/${number}`,
params: Record<string, string | number | undefined>,
token = getToken()
): Promise<T & Cached> {
@@ -98,8 +159,11 @@ export async function salesGet<T>(
for (const [key, value] of Object.entries(params)) {
if (value !== undefined) query.set(key, String(value));
}
- const response = await fetch(`${API_URL}/api/internal/sales/${path}/?${query}`, {
+ const response = await fetch(`${API_URL}/api/internal/overwatch/${path}/?${query}`, {
+ cache: "no-store",
headers: { Authorization: `Bearer ${token ?? ""}` },
+ redirect: "error",
+ referrerPolicy: "no-referrer",
});
if (response.status === 401 || response.status === 403) throw new Unauthorized();
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
diff --git a/sales-dashboard/src/lib/format.ts b/sales-dashboard/src/lib/format.ts
index 31203100..b69071fe 100644
--- a/sales-dashboard/src/lib/format.ts
+++ b/sales-dashboard/src/lib/format.ts
@@ -1,7 +1,12 @@
const integer = new Intl.NumberFormat("en-GB");
const usd = new Intl.NumberFormat("en-US", { currency: "USD", style: "currency" });
-const date = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short", year: "numeric" });
-const day = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short" });
+const date = new Intl.DateTimeFormat("en-GB", {
+ day: "numeric",
+ month: "short",
+ timeZone: "UTC",
+ year: "numeric",
+});
+const day = new Intl.DateTimeFormat("en-GB", { day: "numeric", month: "short", timeZone: "UTC" });
export const formatInt = (value: number) => integer.format(value);
export const formatUsd = (value: string | number) => usd.format(Number(value));
@@ -22,10 +27,11 @@ export const humanize = (key: string) =>
/** One point per calendar day in the window; the API omits days with no rows. */
export function fillDays<T extends { day: string; value: number | string }>(
series: T[],
- days: number
+ days: number,
+ anchor?: string
): { day: string; value: number }[] {
const byDay = new Map(series.map((point) => [point.day.slice(0, 10), Number(point.value)]));
- const today = new Date();
+ const today = anchor ? new Date(anchor) : new Date();
return Array.from({ length: days }, (_, index) => {
const d = new Date(today);
d.setUTCDate(today.getUTCDate() - (days - 1 - index));
@@ -36,3 +42,17 @@ export function fillDays<T extends { day: string; value: number | string }>(
export const sum = (series: { value: number | string }[]) =>
series.reduce((total, point) => total + Number(point.value), 0);
+
+export const MILESTONES = [
+ { label: "Signed up", step: "signed_up" },
+ { label: "Joined a project", step: "joined_project" },
+ { label: "Sent a first trace", step: "sent_first_span" },
+ { label: "Synced capabilities", step: "synced_capabilities" },
+ { label: "Ran an evaluation", step: "ran_evaluation" },
+ { label: "Started training", step: "started_training" },
+ { label: "Deployed a model", step: "deployed_model" },
+ { label: "Made a first model call", step: "called_alias" },
+] as const;
+
+export const milestoneLabel = (key: string) =>
+ MILESTONES.find((milestone) => milestone.step === key)?.label ?? humanize(key);
diff --git a/sales-dashboard/src/routes/_app.tsx b/sales-dashboard/src/routes/_app.tsx
index c83f5e7b..c4752d75 100644
--- a/sales-dashboard/src/routes/_app.tsx
+++ b/sales-dashboard/src/routes/_app.tsx
@@ -1,6 +1,9 @@
+import { useEffect } from "react";
+
import { useQueryClient } from "@tanstack/react-query";
import { createFileRoute, Link, Outlet, redirect, useNavigate } from "@tanstack/react-router";
+import overwatchLogo from "~/assets/overwatch-logo.svg";
import { clearToken, getToken } from "~/lib/api";
import { Button } from "@/components/ui/button";
@@ -12,8 +15,8 @@ const WINDOWS = [7, 30, 90, 365] as const;
const NAV = [
{ label: "Overview", to: "/" },
- { label: "Funnel", to: "/funnel" },
- { label: "Accounts", to: "/accounts" },
+ { label: "Activation", to: "/funnel" },
+ { label: "Users", to: "/accounts" },
] as const;
export const Route = createFileRoute("/_app")({
@@ -32,6 +35,21 @@ function Shell() {
const navigate = useNavigate();
const queryClient = useQueryClient();
+ useEffect(() => {
+ const checkSession = () => {
+ if (!getToken()) {
+ queryClient.clear();
+ void navigate({ to: "/login" });
+ }
+ };
+ const interval = window.setInterval(checkSession, 5000);
+ document.addEventListener("visibilitychange", checkSession);
+ return () => {
+ window.clearInterval(interval);
+ document.removeEventListener("visibilitychange", checkSession);
+ };
+ }, [navigate, queryClient]);
+
function signOut() {
clearToken();
queryClient.clear();
@@ -42,8 +60,8 @@ function Shell() {
<div className="flex h-screen flex-col">
<header className="flex flex-wrap items-center gap-x-6 gap-y-3 border-b border-border/70 bg-card px-6 py-3">
<div className="flex items-center gap-2">
- <Icon.overmind className="size-5" />
- <span className={LABEL.sidebar}>Sales</span>
+ <img alt="" className="size-6 shrink-0" height={24} src={overwatchLogo} width={24} />
+ <span className={LABEL.sidebar}>Overwatch</span>
</div>
<nav aria-label="Sections" className="flex gap-1">
{NAV.map((item) => (
diff --git a/sales-dashboard/src/routes/_app/accounts.tsx b/sales-dashboard/src/routes/_app/accounts.tsx
index 9f0ab264..839b17c6 100644
--- a/sales-dashboard/src/routes/_app/accounts.tsx
+++ b/sales-dashboard/src/routes/_app/accounts.tsx
@@ -3,8 +3,15 @@ import { createFileRoute, Link, useNavigate } from "@tanstack/react-router";
import { Failure } from "~/components/failure";
import { Freshness } from "~/components/freshness";
-import { type Account, type Page, salesGet } from "~/lib/api";
-import { formatAgo, formatDate, formatInt, formatUsd, humanize } from "~/lib/format";
+import { overwatchGet, type Page, type User } from "~/lib/api";
+import {
+ formatAgo,
+ formatDate,
+ formatInt,
+ formatUsd,
+ humanize,
+ milestoneLabel,
+} from "~/lib/format";
import { Badge } from "@/components/ui/badge";
import { PageHeader } from "@/components/ui/page-header";
@@ -20,33 +27,22 @@ import {
TableRow,
} from "@/components/ui/table";
import { TablePagination } from "@/components/ui/table-pagination";
-import { cn } from "@/lib/utils";
const COLUMNS = [
{ key: "date_joined", label: "Joined" },
{ key: "projects", label: "Projects" },
{ key: "seats", label: "Seats" },
- { key: "last_span_at", label: "Last span" },
+ { key: "last_span_at", label: "Last activity" },
{ key: "spans", label: "Spans" },
+ { key: "training_jobs", label: "Training runs" },
+ { key: "live_deployments", label: "Live" },
{ key: "spend_usd", label: "Spend" },
{ key: "topups_usd", label: "Top-ups" },
{ key: "balance_usd", label: "Balance" },
- { key: "training_jobs", label: "Training" },
- { key: "live_deployments", label: "Live" },
] as const;
type SortKey = "email" | (typeof COLUMNS)[number]["key"];
const SORT_KEYS: string[] = ["email", ...COLUMNS.map((column) => column.key)];
-const LOW_BALANCE_USD = 5;
-
-const SUBSCRIPTION_VARIANT: Record<string, "success" | "warning" | "error" | "neutral"> = {
- active: "success",
- canceled: "neutral",
- incomplete: "warning",
- past_due: "error",
- unpaid: "error",
-};
-
type AccountsSearch = { page: number; page_size: number; ordering: string };
export const Route = createFileRoute("/_app/accounts")({
@@ -68,8 +64,8 @@ function AccountsPage() {
const navigate = useNavigate({ from: Route.fullPath });
const query = useQuery({
placeholderData: keepPreviousData,
- queryFn: () => salesGet<Page<Account>>("accounts", { days, ordering, page, page_size }),
- queryKey: ["accounts", days, ordering, page, page_size],
+ queryFn: () => overwatchGet<Page<User>>("users", { days, ordering, page, page_size }),
+ queryKey: ["users", days, ordering, page, page_size],
});
const sort: SortState<SortKey> = {
dir: ordering.startsWith("-") ? "desc" : "asc",
@@ -88,22 +84,23 @@ function AccountsPage() {
<>
<PageHeader
actions={<Freshness data={query.data} />}
+ className="flex-col sm:flex-row"
count={query.data?.count}
- description={`Spans and spend cover the last ${days} days. Top-ups and balance are lifetime.`}
- title="Accounts"
+ description={`Spans and spend cover ${days} UTC days. Training and top-ups are lifetime totals. Activity is shared across each user's projects.`}
+ title="Users"
/>
{query.isPending ? (
- <LoadingState fullPage label="Loading accounts" />
+ <LoadingState fullPage label="Loading users" />
) : query.isError ? (
<Failure error={query.error} onRetry={query.refetch} />
) : (
- <SectionCard contentClassName="p-0" title="Customer accounts">
+ <SectionCard contentClassName="p-0" title="User activity">
<Table>
<TableHeader>
<TableRow>
- <SortableHeader label="Email" onSort={onSort} sort={sort} sortKey="email" />
- <TableHead>Plan</TableHead>
- <TableHead>Stage</TableHead>
+ <SortableHeader label="User" onSort={onSort} sort={sort} sortKey="email" />
+ <TableHead>Milestone reached</TableHead>
+ <TableHead>Subscription</TableHead>
{COLUMNS.map((column) => (
<SortableHeader
key={column.key}
@@ -116,8 +113,8 @@ function AccountsPage() {
</TableRow>
</TableHeader>
<TableBody>
- {query.data.results.map((account) => (
- <AccountRow account={account} days={days} key={account.id} />
+ {query.data.results.map((user) => (
+ <UserRow days={days} key={user.id} user={user} />
))}
</TableBody>
</Table>
@@ -137,47 +134,53 @@ function AccountsPage() {
);
}
-function AccountRow({ account, days }: { account: Account; days: number }) {
- const status = account.subscription_status;
- const lowBalance = Number(account.balance_usd) < LOW_BALANCE_USD;
+function UserRow({ user, days }: { user: User; days: number }) {
const number = "font-mono tabular-nums";
return (
<TableRow>
- <TableCell className="max-w-64 truncate" title={account.email}>
+ <TableCell className="max-w-64 truncate" title={user.email}>
<Link
className="hover:underline"
- params={{ accountId: String(account.id) }}
+ params={{ accountId: String(user.id) }}
search={{ days }}
to="/accounts/$accountId"
>
- {account.email}
+ {user.email}
</Link>
</TableCell>
<TableCell>
- <Badge
- size="chip"
- variant={status ? (SUBSCRIPTION_VARIANT[status] ?? "neutral") : "neutral"}
- >
- {status ? humanize(status) : "Free"}
+ <Badge size="chip" variant={user.stage === "called_alias" ? "success" : "info"}>
+ {milestoneLabel(user.stage)}
</Badge>
</TableCell>
<TableCell>
- <Badge size="chip" variant={account.stage === "called_alias" ? "success" : "info"}>
- {humanize(account.stage)}
+ <Badge
+ size="chip"
+ variant={
+ user.subscription_status === "active"
+ ? "success"
+ : user.subscription_status === "past_due" || user.subscription_status === "unpaid"
+ ? "error"
+ : user.subscription_status === "incomplete"
+ ? "warning"
+ : "neutral"
+ }
+ >
+ {user.subscription_status ? humanize(user.subscription_status) : "Free"}
</Badge>
</TableCell>
- <TableCell className="whitespace-nowrap">{formatDate(account.date_joined)}</TableCell>
- <TableCell className={number}>{formatInt(account.projects)}</TableCell>
- <TableCell className={number}>{formatInt(account.seats)}</TableCell>
- <TableCell className="whitespace-nowrap">{formatAgo(account.last_span_at)}</TableCell>
- <TableCell className={number}>{formatInt(account.spans)}</TableCell>
- <TableCell className={number}>{formatUsd(account.spend_usd)}</TableCell>
- <TableCell className={number}>{formatUsd(account.topups_usd)}</TableCell>
- <TableCell className={cn(number, lowBalance && "text-warning")}>
- {formatUsd(account.balance_usd)}
+ <TableCell className="whitespace-nowrap">{formatDate(user.date_joined)}</TableCell>
+ <TableCell className={number}>{formatInt(user.projects)}</TableCell>
+ <TableCell className={number}>{formatInt(user.seats)}</TableCell>
+ <TableCell className="whitespace-nowrap">{formatAgo(user.last_span_at)}</TableCell>
+ <TableCell className={number}>{formatInt(user.spans)}</TableCell>
+ <TableCell className={number}>{formatInt(user.training_jobs)}</TableCell>
+ <TableCell className={number}>{formatInt(user.live_deployments)}</TableCell>
+ <TableCell className={number}>{formatUsd(user.spend_usd)}</TableCell>
+ <TableCell className={number}>{formatUsd(user.topups_usd)}</TableCell>
+ <TableCell className={`${number} ${Number(user.balance_usd) < 5 ? "text-warning" : ""}`}>
+ {formatUsd(user.balance_usd)}
</TableCell>
- <TableCell className={number}>{formatInt(account.training_jobs)}</TableCell>
- <TableCell className={number}>{formatInt(account.live_deployments)}</TableCell>
</TableRow>
);
}
diff --git a/sales-dashboard/src/routes/_app/accounts_.$accountId.tsx b/sales-dashboard/src/routes/_app/accounts_.$accountId.tsx
index ec255dcf..1db3d699 100644
--- a/sales-dashboard/src/routes/_app/accounts_.$accountId.tsx
+++ b/sales-dashboard/src/routes/_app/accounts_.$accountId.tsx
@@ -6,8 +6,8 @@ import { DailyChart } from "~/components/daily-chart";
import { Failure } from "~/components/failure";
import { Freshness } from "~/components/freshness";
import { Stat } from "~/components/stat";
-import { type AccountActivity, salesGet, type TrainingOutcome } from "~/lib/api";
-import { fillDays, formatDate, formatInt, humanize, sum } from "~/lib/format";
+import { overwatchGet, type TrainingOutcome, type UserActivity } from "~/lib/api";
+import { fillDays, formatDate, formatInt, formatUsd, humanize, sum } from "~/lib/format";
import { Badge } from "@/components/ui/badge";
import { Icon } from "@/components/ui/icons";
@@ -42,8 +42,8 @@ function AccountPage() {
const { days } = Route.useSearch();
const { accountId } = Route.useParams();
const query = useQuery({
- queryFn: () => salesGet<AccountActivity>(`accounts/${Number(accountId)}`, { days }),
- queryKey: ["account", accountId, days],
+ queryFn: () => overwatchGet<UserActivity>(`users/${Number(accountId)}`, { days }),
+ queryKey: ["user", accountId, days],
});
return (
@@ -54,15 +54,16 @@ function AccountPage() {
to="/accounts"
>
<Icon.back className="size-3.5" />
- Accounts
+ Users
</Link>
<PageHeader
actions={<Freshness data={query.data} />}
- description={`Totals are lifetime. Charts cover the last ${days} days.`}
- title={query.data?.account.email ?? "Account"}
+ className="flex-col sm:flex-row"
+ description={`Project usage, spend and payment totals are lifetime. Charts cover ${days} UTC days. Project records do not identify which member performed an action.`}
+ title={query.data?.user.email ?? "User"}
/>
{query.isPending ? (
- <LoadingState fullPage label="Loading account" />
+ <LoadingState fullPage label="Loading user" />
) : query.isError ? (
<Failure error={query.error} onRetry={query.refetch} />
) : (
@@ -72,10 +73,10 @@ function AccountPage() {
);
}
-function AccountBody({ data, days }: { data: AccountActivity; days: number }) {
- const { training, traces, inference, datasets, optimizer, evaluations } = data;
+function AccountBody({ data, days }: { data: UserActivity; days: number }) {
+ const { training, traces, inference, datasets, optimizer, evaluations, billing } = data;
const trainingByDay = new Map(training.daily.map((point) => [point.day.slice(0, 10), point]));
- const trainingDaily = fillDays([], days).map(({ day }) => {
+ const trainingDaily = fillDays([], days, data.computed_at).map(({ day }) => {
const values = trainingByDay.get(day)?.values ?? {};
return Object.fromEntries([
["day", day],
@@ -85,12 +86,19 @@ function AccountBody({ data, days }: { data: AccountActivity; days: number }) {
const trainingInWindow = training.daily
.flatMap((point) => Object.values(point.values))
.reduce((total, n) => total + n, 0);
- const tracesDaily = fillDays(traces.daily, days);
- const inferenceDaily = fillDays(inference.daily, days);
+ const tracesDaily = fillDays(traces.daily, days, data.computed_at);
+ const inferenceDaily = fillDays(inference.daily, days, data.computed_at);
return (
<>
<div className="grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-7">
+ <Stat
+ label="Subscription"
+ value={billing.subscription_status ? humanize(billing.subscription_status) : "Free"}
+ />
+ <Stat label="Stripe top-ups" value={formatUsd(billing.topups_usd)} />
+ <Stat label="Product spend" value={formatUsd(billing.spend_usd)} />
+ <Stat label="Credit balance" value={formatUsd(billing.balance_usd)} />
<Stat
detail={`${formatInt(training.totals.completed)} completed · ${formatInt(training.totals.failed)} failed`}
label="Training jobs"
@@ -106,9 +114,23 @@ function AccountBody({ data, days }: { data: AccountActivity; days: number }) {
<Stat label="Datasets" value={formatInt(datasets.total)} />
<Stat label="Optimiser runs" value={formatInt(optimizer.total)} />
<Stat label="Evaluations" value={formatInt(evaluations.total)} />
- <Stat label="Projects" value={formatInt(data.account.projects)} />
+ <Stat label="Projects" value={formatInt(data.user.projects)} />
</div>
<div className="grid gap-4 lg:grid-cols-2">
+ <DailyChart
+ data={fillDays(billing.spend_daily, days, data.computed_at)}
+ format={formatUsd}
+ series={[{ color: "var(--chart-4)", key: "value", label: "Spend" }]}
+ title="Product spend"
+ total={formatUsd(sum(billing.spend_daily))}
+ />
+ <DailyChart
+ data={fillDays(billing.topups_daily, days, data.computed_at)}
+ format={formatUsd}
+ series={[{ color: "var(--chart-2)", key: "value", label: "Stripe top-ups" }]}
+ title="Payments and top-ups"
+ total={formatUsd(sum(billing.topups_daily))}
+ />
<DailyChart
data={trainingDaily}
format={formatInt}
diff --git a/sales-dashboard/src/routes/_app/funnel.tsx b/sales-dashboard/src/routes/_app/funnel.tsx
index 1a57c13a..85c27245 100644
--- a/sales-dashboard/src/routes/_app/funnel.tsx
+++ b/sales-dashboard/src/routes/_app/funnel.tsx
@@ -4,55 +4,56 @@ import { createFileRoute } from "@tanstack/react-router";
import { Failure } from "~/components/failure";
import { Freshness } from "~/components/freshness";
import { Stat } from "~/components/stat";
-import { type Funnel, salesGet } from "~/lib/api";
-import { formatInt, humanize } from "~/lib/format";
+import { type Activation, overwatchGet } from "~/lib/api";
+import { formatInt, milestoneLabel } from "~/lib/format";
import { PageHeader } from "@/components/ui/page-header";
import { SectionCard } from "@/components/ui/section-card";
import { LoadingState } from "@/components/ui/spinner";
-export const Route = createFileRoute("/_app/funnel")({ component: FunnelPage });
+export const Route = createFileRoute("/_app/funnel")({ component: ActivationPage });
const percent = (part: number, whole: number) =>
whole ? `${Math.round((part / whole) * 100)}%` : "–";
-function FunnelPage() {
+function ActivationPage() {
const { days } = Route.useSearch();
const query = useQuery({
- queryFn: () => salesGet<Funnel>("funnel", { days }),
- queryKey: ["funnel", days],
+ queryFn: () => overwatchGet<Activation>("activation", { days }),
+ queryKey: ["activation", days],
});
return (
<>
<PageHeader
actions={<Freshness data={query.data} />}
- description={`Accounts that signed up in the last ${days} days, by step reached. Steps can be reached out of order.`}
- title="Activation funnel"
+ className="flex-col sm:flex-row"
+ description={`Users who signed up in the last ${days} UTC days. Counts show independent milestones in retained records. Project milestones are attributed to memberships.`}
+ title="Activation"
/>
{query.isPending ? (
- <LoadingState fullPage label="Loading funnel" />
+ <LoadingState fullPage label="Loading activation" />
) : query.isError ? (
<Failure error={query.error} onRetry={query.refetch} />
) : (
- <FunnelBody data={query.data} />
+ <ActivationBody data={query.data} />
)}
</>
);
}
-function FunnelBody({ data }: { data: Funnel }) {
- const top = data.steps[0]?.accounts ?? 0;
+function ActivationBody({ data }: { data: Activation }) {
+ const top = data.steps[0]?.users ?? 0;
const median = data.median_hours_to_first_span;
- const last = data.steps.at(-1)?.accounts ?? 0;
+ const last = data.steps.at(-1)?.users ?? 0;
return (
<div className="space-y-6">
<section aria-label="Summary" className="grid grid-cols-2 gap-3 md:grid-cols-3">
- <Stat label="Signed up" value={formatInt(top)} />
+ <Stat label="New users" value={formatInt(top)} />
<Stat
detail="Median"
- label="Sign-up to first span"
+ label="Sign-up to first retained trace"
value={
median == null
? "–"
@@ -61,26 +62,36 @@ function FunnelBody({ data }: { data: Funnel }) {
: `${(median / 24).toFixed(1)}d`
}
/>
- <Stat detail="Signed up to alias call" label="Conversion" value={percent(last, top)} />
+ <Stat
+ detail="New users who reached a model call"
+ label="Model call adoption"
+ value={percent(last, top)}
+ />
</section>
- <SectionCard title="Steps">
+ <SectionCard title="Milestone adoption">
+ <p className="mb-4 text-sm text-muted-foreground">
+ Milestones can be reached in any order. Use PostHog to measure ordered conversion.
+ </p>
<ol className="space-y-3">
{data.steps.map((step, index) => {
return (
- <li className="grid grid-cols-[10rem_1fr_9rem] items-center gap-3" key={step.step}>
- <span className="text-sm">{humanize(step.step)}</span>
- <div className="h-6 rounded-xs bg-wash-raised">
+ <li
+ className="grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 sm:grid-cols-[10rem_minmax(0,1fr)_9rem]"
+ key={step.step}
+ >
+ <span className="text-sm">{milestoneLabel(step.step)}</span>
+ <div className="order-3 col-span-2 h-6 rounded-xs bg-wash-raised sm:order-none sm:col-span-1">
<div
className="h-full rounded-xs bg-chart-1"
- style={{ width: top ? `${(step.accounts / top) * 100}%` : 0 }}
+ style={{ width: top ? `${(step.users / top) * 100}%` : 0 }}
/>
</div>
<span className="text-right font-mono text-sm tabular-nums">
- {formatInt(step.accounts)}
+ {formatInt(step.users)}
{index ? (
<span className="ml-2 text-xs text-muted-foreground">
- {percent(step.accounts, top)}
+ {percent(step.users, top)}
</span>
) : null}
</span>
diff --git a/sales-dashboard/src/routes/_app/index.tsx b/sales-dashboard/src/routes/_app/index.tsx
index 59af0638..f477ee1d 100644
--- a/sales-dashboard/src/routes/_app/index.tsx
+++ b/sales-dashboard/src/routes/_app/index.tsx
@@ -6,7 +6,7 @@ import { DailyChart } from "~/components/daily-chart";
import { Failure } from "~/components/failure";
import { Freshness } from "~/components/freshness";
import { Stat } from "~/components/stat";
-import { type Overview, salesGet } from "~/lib/api";
+import { type Overview, overwatchGet, type ProductUsage } from "~/lib/api";
import { fillDays, formatInt, formatUsd, sum } from "~/lib/format";
import { PageHeader } from "@/components/ui/page-header";
@@ -26,33 +26,53 @@ export const Route = createFileRoute("/_app/")({ component: OverviewPage });
function OverviewPage() {
const { days } = Route.useSearch();
const query = useQuery({
- queryFn: () => salesGet<Overview>("overview", { days }),
+ queryFn: () => overwatchGet<Overview>("overview", { days }),
queryKey: ["overview", days],
});
+ const usageQuery = useQuery({
+ queryFn: () => overwatchGet<ProductUsage>("product-usage", { days }),
+ queryKey: ["product-usage", days],
+ });
return (
<>
<PageHeader
actions={<Freshness data={query.data} />}
- description={`Last ${days} days. Guests excluded.`}
- title="Overview"
+ className="flex-col sm:flex-row"
+ description={`Product activity over the last ${days} days. Guest-only projects excluded. Project activity does not identify the individual who performed it.`}
+ title="User insights"
/>
{query.isPending ? (
<LoadingState fullPage label="Loading overview" />
) : query.isError ? (
<Failure error={query.error} onRetry={query.refetch} />
) : (
- <OverviewBody data={query.data} days={days} />
+ <OverviewBody
+ data={query.data}
+ days={days}
+ usage={usageQuery.data}
+ usageFailed={usageQuery.isError}
+ />
)}
</>
);
}
-function OverviewBody({ data, days }: { data: Overview; days: number }) {
- const signups = fillDays(data.signups, days);
- const projects = fillDays(data.projects_created, days);
- const spans = fillDays(data.spans, days);
- const traces = fillDays(data.traces, days);
+function OverviewBody({
+ data,
+ days,
+ usage,
+ usageFailed,
+}: {
+ data: Overview;
+ days: number;
+ usage?: ProductUsage;
+ usageFailed: boolean;
+}) {
+ const signups = fillDays(data.signups, days, data.computed_at);
+ const projects = fillDays(data.projects_created, days, data.computed_at);
+ const spans = fillDays(data.spans, days, data.computed_at);
+ const traces = fillDays(data.traces, days, data.computed_at);
const traffic = spans.map((point, index) => ({
day: point.day,
spans: point.value,
@@ -63,33 +83,98 @@ function OverviewBody({ data, days }: { data: Overview; days: number }) {
projects: projects[index].value,
signups: point.value,
}));
- const spend = sum(Object.values(data.spend_by_service).map((value) => ({ value })));
+ const posthogDays = fillDays(
+ (usage?.daily ?? []).map(({ day, cli_completions: value }) => ({ day, value })),
+ days,
+ usage?.computed_at ?? data.computed_at
+ );
+ const posthogByDay = new Map((usage?.daily ?? []).map((point) => [point.day, point]));
+ const productEvents = posthogDays.map(({ day }) => {
+ const point = posthogByDay.get(day);
+ return {
+ cli_completions: point?.cli_completions ?? 0,
+ day,
+ mcp_tool_calls: point?.mcp_tool_calls ?? 0,
+ training_checks_finished: point?.training_checks_finished ?? 0,
+ training_results_available: point?.training_results_available ?? 0,
+ };
+ });
+ const productActionTotal = Object.values(usage?.totals ?? {}).reduce(
+ (total, count) => total + count,
+ 0
+ );
+ const dailyTopups = fillDays(data.topups_usd, days, data.computed_at);
+ const dailySpend = new Map(
+ fillDays(data.spend_usd, days, data.computed_at).map(({ day, value }) => [day, value])
+ );
+ const financial = dailyTopups.map(({ day, value }) => ({
+ day,
+ spend: dailySpend.get(day) ?? 0,
+ topups: value,
+ }));
+ const totalSpend = Object.values(data.spend_by_service).reduce(
+ (total, amount) => total + Number(amount),
+ 0
+ );
return (
<div className="space-y-6">
- <section
- aria-label="Accounts"
- className="grid grid-cols-2 gap-3 md:grid-cols-4 xl:grid-cols-5"
- >
- <Stat label="Accounts" value={formatInt(data.accounts_total)} />
+ <section aria-label="Product activity" className="grid grid-cols-2 gap-3 md:grid-cols-4">
+ <Stat label="Users" value={formatInt(data.users_total)} />
<Stat label="Sign-ups" value={formatInt(sum(data.signups))} />
- <Stat label="Active, 7 days" value={formatInt(data.active_accounts_7d)} />
- <Stat label={`Active, ${days} days`} value={formatInt(data.active_accounts_window)} />
- <Stat label="Live deployments" value={formatInt(data.live_deployments)} />
- <Stat label="Paying" tone="success" value={formatInt(data.paying_accounts)} />
- <Stat label="Free with a project" value={formatInt(data.free_accounts)} />
<Stat
- label="Cancelling"
- tone={data.cancelling_accounts ? "warning" : undefined}
- value={formatInt(data.cancelling_accounts)}
+ detail="Members of projects that received traces in the last 7 days"
+ label="Members of trace-active projects"
+ value={formatInt(data.trace_active_users_7d)}
/>
<Stat
- detail="Under $5 after spending"
- label="Low balance"
- tone={data.low_balance_accounts ? "warning" : undefined}
- value={formatInt(data.low_balance_accounts)}
+ detail={`Members of projects that received traces in the last ${days} UTC days`}
+ label={`Members of active projects, ${days} days`}
+ value={formatInt(data.trace_active_users_window)}
/>
- <Stat label="Platform spend" value={formatUsd(spend)} />
+ <Stat label="Live deployments" value={formatInt(data.live_deployments)} />
+ {usage?.available ? (
+ <Stat
+ detail={`Last ${days} days · CLI and MCP`}
+ label="Active CLI/MCP identities"
+ value={formatInt(usage.active_users ?? 0)}
+ />
+ ) : null}
+ {usage?.available ? (
+ <Stat
+ detail={`${formatInt(usage.mcp_tool_errors ?? 0)} failed MCP calls`}
+ label="MCP tool error rate"
+ value={`${((usage.mcp_tool_error_rate ?? 0) * 100).toFixed(1)}%`}
+ />
+ ) : null}
+ </section>
+
+ <section aria-label="Spend and payments" className="space-y-4">
+ <h2 className="text-sm font-medium text-muted-foreground">Spend and payments</h2>
+ <div className="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6">
+ <Stat
+ detail="Active subscriptions"
+ label="Paying users"
+ value={formatInt(data.paying_users)}
+ />
+ <Stat
+ detail="Cancel at period end"
+ label="Cancelling"
+ value={formatInt(data.cancelling_users)}
+ />
+ <Stat label="Free users" value={formatInt(data.free_users)} />
+ <Stat detail={`Last ${days} days`} label="Product spend" value={formatUsd(totalSpend)} />
+ <Stat
+ detail={`Last ${days} days`}
+ label="Stripe top-ups"
+ value={formatUsd(sum(data.topups_usd))}
+ />
+ <Stat
+ detail="Current balance below $5 after spend"
+ label="Low balance users"
+ value={formatInt(data.low_balance_users)}
+ />
+ </div>
</section>
<section aria-label="Trends" className="grid gap-4 lg:grid-cols-2">
@@ -103,13 +188,38 @@ function OverviewBody({ data, days }: { data: Overview; days: number }) {
title="Sign-ups and projects"
total={`${formatInt(sum(signups))} sign-ups`}
/>
- <DailyChart
- data={fillDays(data.topups_usd, days)}
- format={formatUsd}
- series={[{ color: "var(--chart-3)", key: "value", label: "Top-ups" }]}
- title="Stripe top-ups"
- total={formatUsd(sum(data.topups_usd))}
- />
+ {usage?.available ? (
+ <DailyChart
+ data={productEvents}
+ format={formatInt}
+ series={[
+ { color: "var(--chart-1)", key: "cli_completions", label: "CLI completions" },
+ { color: "var(--chart-3)", key: "mcp_tool_calls", label: "MCP tool calls" },
+ {
+ color: "var(--chart-4)",
+ key: "training_results_available",
+ label: "Training results",
+ },
+ {
+ color: "var(--chart-5)",
+ key: "training_checks_finished",
+ label: "Training checks finished",
+ },
+ ]}
+ stacked
+ title="Product actions"
+ total={`${formatInt(productActionTotal)} actions`}
+ />
+ ) : (
+ <SectionCard title="PostHog product events">
+ <p className="text-sm text-muted-foreground">
+ {usage?.reason ??
+ (usageFailed
+ ? "PostHog product event data could not be loaded."
+ : "Loading product event data…")}
+ </p>
+ </SectionCard>
+ )}
<DailyChart
data={traffic}
format={formatInt}
@@ -121,19 +231,89 @@ function OverviewBody({ data, days }: { data: Overview; days: number }) {
total={`${formatInt(sum(spans))} spans`}
/>
<DailyChart
- data={fillDays(data.inference_calls, days)}
+ data={fillDays(data.inference_calls, days, data.computed_at)}
format={formatInt}
series={[{ color: "var(--chart-2)", key: "value", label: "Calls" }]}
title="Inference calls"
total={formatInt(sum(data.inference_calls))}
/>
+ <DailyChart
+ data={financial}
+ format={formatUsd}
+ series={[
+ { color: "var(--chart-2)", key: "topups", label: "Stripe top-ups" },
+ { color: "var(--chart-4)", key: "spend", label: "Product spend" },
+ ]}
+ title="Spend and payments"
+ total={`${formatUsd(sum(data.topups_usd))} topped up`}
+ />
</section>
- <section aria-label="Breakdowns" className="grid gap-4 md:grid-cols-2 xl:grid-cols-4">
- <Breakdown format={formatUsd} title="Spend by service" values={data.spend_by_service} />
- <Breakdown format={formatInt} title="Subscriptions" values={data.subscriptions} />
+ <section aria-label="Product breakdowns" className="grid gap-4 md:grid-cols-2 xl:grid-cols-3">
<Breakdown format={formatInt} title="Training jobs" values={data.training_jobs} />
- <Breakdown format={formatInt} title="Sign-on method" values={data.sign_on_methods} />
+ <Breakdown format={formatUsd} title="Spend by service" values={data.spend_by_service} />
+ <Breakdown format={formatInt} title="Subscription status" values={data.subscriptions} />
+ <Breakdown format={formatInt} title="Sign-in method" values={data.sign_on_methods} />
+ {usage?.available ? (
+ <SectionCard contentClassName="p-0" title="Most used CLI commands">
+ {usage.top_cli_commands?.length ? (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Command</TableHead>
+ <TableHead className="text-right">Runs</TableHead>
+ <TableHead className="text-right">Identities</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {usage.top_cli_commands.map((command) => (
+ <TableRow key={command.name}>
+ <TableCell className="font-mono">{command.name}</TableCell>
+ <TableCell className="text-right font-mono tabular-nums">
+ {formatInt(command.completions)}
+ </TableCell>
+ <TableCell className="text-right font-mono tabular-nums">
+ {formatInt(command.users)}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ ) : (
+ <p className="p-4 text-xs text-muted-foreground">No CLI command events</p>
+ )}
+ </SectionCard>
+ ) : null}
+ {usage?.available ? (
+ <SectionCard contentClassName="p-0" title="Most used MCP tools">
+ {usage.top_mcp_tools?.length ? (
+ <Table>
+ <TableHeader>
+ <TableRow>
+ <TableHead>Tool</TableHead>
+ <TableHead className="text-right">Calls</TableHead>
+ <TableHead className="text-right">Identities</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody>
+ {usage.top_mcp_tools.map((tool) => (
+ <TableRow key={tool.name}>
+ <TableCell className="font-mono">{tool.name}</TableCell>
+ <TableCell className="text-right font-mono tabular-nums">
+ {formatInt(tool.calls)}
+ </TableCell>
+ <TableCell className="text-right font-mono tabular-nums">
+ {formatInt(tool.users)}
+ </TableCell>
+ </TableRow>
+ ))}
+ </TableBody>
+ </Table>
+ ) : (
+ <p className="p-4 text-xs text-muted-foreground">No MCP tool calls</p>
+ )}
+ </SectionCard>
+ ) : null}
</section>
<SectionCard contentClassName="p-0" title="Top base models">
diff --git a/sales-dashboard/src/routes/login.tsx b/sales-dashboard/src/routes/login.tsx
index 0161f8d9..f2283bff 100644
--- a/sales-dashboard/src/routes/login.tsx
+++ b/sales-dashboard/src/routes/login.tsx
@@ -2,7 +2,8 @@ import { type FormEvent, useState } from "react";
import { createFileRoute, redirect, useNavigate } from "@tanstack/react-router";
-import { getToken, salesGet, setToken, Unauthorized } from "~/lib/api";
+import overwatchLogo from "~/assets/overwatch-logo.svg";
+import { getToken, overwatchGet, setToken, Unauthorized } from "~/lib/api";
import { Alert } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
@@ -33,7 +34,7 @@ function Login() {
setChecking(true);
setError("");
try {
- await salesGet("funnel", { days: 1 }, token.trim());
+ await overwatchGet("activation", { days: 1 }, token.trim());
setToken(token.trim());
await navigate({ search: { days: 30 }, to: "/" });
} catch (failure) {
@@ -47,8 +48,8 @@ function Login() {
<div className="flex h-screen items-center justify-center p-6">
<Card className="w-full max-w-sm space-y-4 bg-wash-subtle p-6">
<div className="flex items-center gap-2">
- <Icon.overmind className="size-5" />
- <h1 className={TITLE.card}>Overmind Sales</h1>
+ <img alt="" className="size-6 shrink-0" height={24} src={overwatchLogo} width={24} />
+ <h1 className={TITLE.card}>Overwatch</h1>
</div>
<form className="space-y-3" onSubmit={submit}>
<label className="block space-y-1.5 text-sm" htmlFor="token">
diff --git a/sales-dashboard/tests/session.test.ts b/sales-dashboard/tests/session.test.ts
new file mode 100644
index 00000000..db33e941
--- /dev/null
+++ b/sales-dashboard/tests/session.test.ts
@@ -0,0 +1,85 @@
+import { afterEach, beforeEach, describe, expect, mock, spyOn, test } from "bun:test";
+
+import { clearToken, getToken, overwatchGet, setToken } from "../src/lib/api";
+
+class MemoryStorage {
+ private values = new Map<string, string>();
+ getItem(key: string) {
+ return this.values.get(key) ?? null;
+ }
+ setItem(key: string, value: string) {
+ this.values.set(key, String(value));
+ }
+ removeItem(key: string) {
+ this.values.delete(key);
+ }
+ clear() {
+ this.values.clear();
+ }
+}
+
+const originalFetch = globalThis.fetch;
+beforeEach(() => {
+ Object.defineProperty(globalThis, "localStorage", {
+ configurable: true,
+ value: new MemoryStorage(),
+ });
+ Object.defineProperty(globalThis, "sessionStorage", {
+ configurable: true,
+ value: new MemoryStorage(),
+ });
+});
+afterEach(() => {
+ mock.restore();
+ globalThis.fetch = originalFetch;
+});
+
+describe("analytics session", () => {
+ test("retires persistent tokens and expires tab credentials", () => {
+ localStorage.setItem("overmind.sales.token", "legacy-test-value");
+ expect(getToken()).toBeNull();
+ expect(localStorage.getItem("overmind.sales.token")).toBeNull();
+ const clock = spyOn(Date, "now").mockReturnValue(1000);
+ setToken("test-overwatch-session");
+ expect(getToken()).toBe("test-overwatch-session");
+ expect(localStorage.getItem("overmind.overwatch.session")).toBeNull();
+ clock.mockReturnValue(1000 + 30 * 60 * 1000);
+ expect(getToken()).toBeNull();
+ expect(sessionStorage.getItem("overmind.overwatch.session")).toBeNull();
+ });
+
+ test("malformed session data fails closed", () => {
+ sessionStorage.setItem("overmind.overwatch.session", "invalid-json");
+ expect(getToken()).toBeNull();
+ setToken("test-overwatch-session");
+ clearToken();
+ expect(getToken()).toBeNull();
+ });
+
+ test("authenticated requests forbid caches, redirects and referrers", async () => {
+ let calledUrl = "";
+ let options: RequestInit | undefined;
+ globalThis.fetch = mock(async (url: string | URL | Request, init?: RequestInit) => {
+ calledUrl = String(url);
+ options = init;
+ return new Response(JSON.stringify({ available: false }), { status: 200 });
+ }) as typeof fetch;
+ await overwatchGet("product-usage", { days: 7 }, "test-overwatch-session");
+ expect(calledUrl).not.toContain("test-overwatch-session");
+ expect(options?.cache).toBe("no-store");
+ expect(options?.redirect).toBe("error");
+ expect(options?.referrerPolicy).toBe("no-referrer");
+ });
+});
+
+test("chart windows stay anchored to the cached report across midnight", async () => {
+ const { fillDays } = await import("../src/lib/format");
+ expect(fillDays([{ day: "2026-10-25T00:00:00Z", value: 3 }], 1, "2026-10-25T23:59:00Z")).toEqual([
+ { day: "2026-10-25", value: 3 },
+ ]);
+});
+
+test("UTC chart buckets do not shift to the previous local date", async () => {
+ const { formatDay } = await import("../src/lib/format");
+ expect(formatDay("2026-10-25T00:00:00Z")).toBe("25 Oct");
+});
diff --git a/sales-dashboard/tsconfig.json b/sales-dashboard/tsconfig.json
index 30028714..b6440147 100644
--- a/sales-dashboard/tsconfig.json
+++ b/sales-dashboard/tsconfig.json
@@ -8,7 +8,13 @@
"noFallthroughCasesInSwitch": true,
"paths": {
"@/*": ["../frontend/src/*"],
- "~/*": ["./src/*"]
+ "~/*": ["./src/*"],
+ "class-variance-authority": ["./node_modules/class-variance-authority"],
+ "clsx": ["./node_modules/clsx"],
+ "radix-ui": ["./node_modules/radix-ui"],
+ "react": ["./node_modules/@types/react/index.d.ts"],
+ "react/*": ["./node_modules/@types/react/*"],
+ "tailwind-merge": ["./node_modules/tailwind-merge"]
},
"skipLibCheck": true,
"strict": true,
diff --git a/sales-dashboard/vite.config.ts b/sales-dashboard/vite.config.ts
index b5dbe56b..d64970ea 100644
--- a/sales-dashboard/vite.config.ts
+++ b/sales-dashboard/vite.config.ts
@@ -2,40 +2,69 @@ import { fileURLToPath, URL } from "node:url";
import tailwindcss from "@tailwindcss/vite";
import { tanstackRouter } from "@tanstack/router-plugin/vite";
import viteReact from "@vitejs/plugin-react";
-import { defineConfig } from "vite";
+import { defineConfig, loadEnv } from "vite";
-export default defineConfig({
- plugins: [
- tailwindcss(),
- tanstackRouter({
- autoCodeSplitting: true,
- generatedRouteTree: "./src/routeTree.gen.ts",
- routesDirectory: "./src/routes",
- target: "react",
- }),
- viteReact(),
- ],
- // The Console's fonts and cursors, referenced by its styles.css as root URLs.
- publicDir: "../frontend/public",
- resolve: {
- alias: {
- "@": fileURLToPath(new URL("../frontend/src", import.meta.url)),
- "~": fileURLToPath(new URL("./src", import.meta.url)),
- },
- // Console components live outside this root; without dedupe their bare
- // imports resolve to frontend/node_modules and load a second React.
- dedupe: [
- "react",
- "react-dom",
- "class-variance-authority",
- "clsx",
- "radix-ui",
- "tailwind-merge",
+export default defineConfig(({ mode }) => {
+ const apiUrl = loadEnv(mode, process.cwd(), "VITE_").VITE_API_URL;
+ const apiOrigin = apiUrl ? new URL(apiUrl).origin : "";
+ if (mode === "production" && apiOrigin && !apiOrigin.startsWith("https://")) {
+ throw new Error("Overwatch's production API must use HTTPS.");
+ }
+ return {
+ plugins: [
+ {
+ generateBundle() {
+ const policy = [
+ "default-src 'self'",
+ "script-src 'self'",
+ "style-src 'self' 'unsafe-inline'",
+ "img-src 'self' data:",
+ "font-src 'self'",
+ `connect-src 'self' ${apiOrigin}`,
+ "frame-ancestors 'none'",
+ "base-uri 'none'",
+ "form-action 'self'",
+ "object-src 'none'",
+ ].join("; ");
+ this.emitFile({
+ fileName: "_headers",
+ source: `/*\n Content-Security-Policy: ${policy}\n Cache-Control: no-store\n X-Content-Type-Options: nosniff\n Referrer-Policy: no-referrer\n X-Frame-Options: DENY\n`,
+ type: "asset",
+ });
+ },
+ name: "overwatch-security-headers",
+ },
+ tailwindcss(),
+ tanstackRouter({
+ autoCodeSplitting: true,
+ generatedRouteTree: "./src/routeTree.gen.ts",
+ routesDirectory: "./src/routes",
+ target: "react",
+ }),
+ viteReact(),
],
- },
- server: {
- proxy: {
- "/api": process.env.SALES_API_PROXY ?? "http://localhost:8000",
+ // The Console's fonts and cursors, referenced by its styles.css as root URLs.
+ publicDir: "../frontend/public",
+ resolve: {
+ alias: {
+ "@": fileURLToPath(new URL("../frontend/src", import.meta.url)),
+ "~": fileURLToPath(new URL("./src", import.meta.url)),
+ },
+ // Console components live outside this root; without dedupe their bare
+ // imports resolve to frontend/node_modules and load a second React.
+ dedupe: [
+ "react",
+ "react-dom",
+ "class-variance-authority",
+ "clsx",
+ "radix-ui",
+ "tailwind-merge",
+ ],
+ },
+ server: {
+ proxy: {
+ "/api": process.env.SALES_API_PROXY ?? "http://localhost:8000",
+ },
},
- },
+ };
});
diff --git a/tests/settings.py b/tests/settings.py
index f7067981..1aee5f63 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -43,10 +43,20 @@ DATABASES = {
LANGFUSE_PUBLIC_KEY = ""
LANGFUSE_SECRET_KEY = ""
+# Never inherit live analytics/Slack destinations from a developer's local .env.
+# The focused tests explicitly enable their fake destinations when required.
+POSTHOG_PROJECT_TOKEN = ""
+POSTHOG_PERSONAL_API_KEY = ""
+POSTHOG_PROJECT_ID = ""
+SLACK_BOT_TOKEN = ""
+SLACK_SIGNING_SECRET = ""
+OVERWATCH_AGENT_ENABLED = False
+OVERWATCH_SLACK_ALLOWED_USER_IDS = ""
+
# Remaining-credit billing on unless a test clears the key.
STRIPE_SECRET_KEY = "sk_test_billing"
-# overbae.urls registers the sales routes only when this is set at import.
+# overbae.urls registers internal Overwatch metrics only when this is set at import.
SALES_DASHBOARD_TOKEN = "sales-test-token"
# Local .env often points Celery at docker Redis, and an unmocked `.delay()` burns
diff --git a/tests/test_celery_topology.py b/tests/test_celery_topology.py
index 3c2a95fc..dda51964 100644
--- a/tests/test_celery_topology.py
+++ b/tests/test_celery_topology.py
@@ -11,6 +11,7 @@ import subprocess
import sys
from pathlib import Path
+import pytest
import yaml
from django.conf import settings
@@ -205,6 +206,12 @@ def test_training_preparation_does_not_wait_for_live_trace_scoring():
assert all("--disable-prefetch" in command for command in [*io_workers, *trace_workers])
+def test_overwatch_slack_is_not_a_product_worker():
+ assert not any(
+ name.startswith("overbae.tasks.overwatch.") for name in settings.CELERY_TASK_ROUTES
+ )
+
+
def test_new_producers_wait_for_healthy_landing_capacity():
workflow = yaml.safe_load((REPO_ROOT / ".github/workflows/deploy-api.yml").read_text())
jobs = workflow["jobs"]
@@ -264,3 +271,10 @@ def test_redis_redelivers_only_after_every_late_ack_task_has_hit_its_time_limit(
assert not offenders, (
f"late-ack time limits at or above visibility_timeout={visibility}: {offenders}"
)
+
+
[email protected](autouse=True)
+def _sandbox(settings):
+ # These tests never call the parser sandbox; outbound requests remain guarded.
+ settings.SANDBOX_URL = "http://sandbox.test"
+ settings.SANDBOX_TOKEN = "analytics-test"
diff --git a/tests/test_overwatch_agent_api.py b/tests/test_overwatch_agent_api.py
new file mode 100644
index 00000000..4937d789
--- /dev/null
+++ b/tests/test_overwatch_agent_api.py
@@ -0,0 +1,410 @@
+"""The agent credential can only run bounded analytics reads, never product actions."""
+
+import json
+from datetime import UTC, datetime, timedelta
+
+import pytest
+from django.core.cache import cache
+from django.db import connection
+from django.utils import timezone
+from factories import (
+ api_key_client,
+ auth_client,
+ make_capability,
+ make_project,
+ make_span,
+ make_user,
+)
+from rest_framework.test import APIClient
+
+from overbae.models import Dataset, DeployedModel, EvalRun, FinetuningJob, ProjectMembership, User
+
+pytestmark = pytest.mark.django_db(transaction=True)
+URL = "/api/internal/overwatch/agent/query/"
+TOKEN = "agent-test-service-token"
+
+
[email protected](autouse=True)
+def _sandbox(settings):
+ settings.SANDBOX_URL = "http://sandbox.test"
+ settings.SANDBOX_TOKEN = "analytics-test"
+
+
[email protected](autouse=True)
+def configured(settings):
+ settings.OVERWATCH_SERVICE_TOKEN = TOKEN
+ settings.SALES_DASHBOARD_TOKEN = "dashboard-test-token"
+ cache.clear()
+
+
+def client(token=TOKEN):
+ instance = APIClient()
+ instance.credentials(HTTP_AUTHORIZATION=f"Bearer {token}")
+ return instance
+
+
[email protected]("kind", ["anonymous", "dashboard", "staff", "project"])
+def test_service_boundary_rejects_other_credentials(kind):
+ user = make_user(is_staff=True)
+ caller = {
+ "anonymous": APIClient,
+ "dashboard": lambda: client("dashboard-test-token"),
+ "staff": lambda: auth_client(user),
+ "project": lambda: api_key_client(user),
+ }[kind]()
+ assert (
+ caller.post(
+ URL, {"tool": "billing_summary", "arguments": {"days": 7}}, format="json"
+ ).status_code
+ == 403
+ )
+
+
+def test_blank_or_shared_credentials_fail_closed(settings):
+ for value in ("", settings.SALES_DASHBOARD_TOKEN):
+ settings.OVERWATCH_SERVICE_TOKEN = value
+ assert client(value).post(URL, {}, format="json").status_code == 403
+
+
+ "payload",
+ [
+ {"tool": "request_leave", "arguments": {}},
+ {"tool": "billing_summary", "arguments": {"days": 366}},
+ {"tool": "billing_summary", "arguments": {"days": True}},
+ {"tool": "billing_summary", "arguments": {"days": 7, "sql": "SELECT * FROM users"}},
+ {"tool": "customer_activity", "arguments": {"days": 7, "email": "bad"}},
+ {"tool": "billing_summary", "arguments": {"days": 7}, "employee_id": "invented"},
+ ],
+)
+def test_invalid_queries_are_rejected(payload):
+ assert client().post(URL, payload, format="json").status_code == 400
+
+
+def test_aggregate_query_runs_under_database_read_only_budget():
+ observed = []
+ read_only = []
+
+ def record(execute, sql, params, many, context):
+ observed.append(sql)
+ if sql.startswith("SELECT") and "transaction_read_only" not in sql:
+ execute("SHOW transaction_read_only", None, False, context)
+ read_only.append(context["cursor"].fetchone()[0])
+ return execute(sql, params, many, context)
+
+ with connection.execute_wrapper(record):
+ response = client().post(
+ URL, {"tool": "billing_summary", "arguments": {"days": 7}}, format="json"
+ )
+ assert response.status_code == 200
+ assert response.data["private"] is False
+ assert response.data["source"] == "Overmind product/billing records"
+ assert response.data["window_days"] == 7
+ assert response.data["as_of"]
+ assert response["Cache-Control"] == "private, no-store"
+ assert read_only and set(read_only) == {"on"}
+ assert any("SET TRANSACTION READ ONLY" in sql for sql in observed)
+ assert not any(
+ sql.lstrip().upper().startswith(("INSERT", "UPDATE", "DELETE")) for sql in observed
+ )
+
+
+def test_customer_records_are_terminal_private_reports():
+ make_user(email="[email protected]")
+ response = client().post(
+ URL,
+ {"tool": "customer_activity", "arguments": {"email": "[email protected]", "days": 7}},
+ format="json",
+ )
+ assert response.status_code == 200
+ assert response.data["private"] is True
+ assert "[email protected]" in response.data["content"]
+ assert "Signed up" in response.data["content"]
+
+
+def test_service_token_cannot_use_dashboard_or_product_writes():
+ assert client().get("/api/internal/overwatch/overview/").status_code == 403
+ assert client().post("/api/projects/", {"name": "not allowed"}).status_code in (401, 403)
+ assert client().get(URL).status_code == 405
+
+
+def test_retired_backend_slack_paths_are_gone():
+ for path in ("command", "events"):
+ assert (
+ APIClient()
+ .post(f"/api/internal/overwatch/slack/{path}/", {}, format="json")
+ .status_code
+ == 404
+ )
+
+
+ "tool,args",
+ [
+ ("activation_funnel", {"days": 7}),
+ ("product_usage", {"days": 7}),
+ ("customers_at_step", {"days": 7, "step": "signed_up", "limit": 2}),
+ ],
+)
+def test_all_read_tools_share_the_validated_contract(tool, args):
+ response = client().post(URL, {"tool": tool, "arguments": args}, format="json")
+ assert response.status_code == 200
+ assert response.data["private"] is (tool == "customers_at_step")
+ assert response.data["content"]
+
+
[email protected]("step", ["deployed_model", "called_alias"])
+def test_resettable_milestones_do_not_claim_first_time_customers(step):
+ user = make_user(email="[email protected]")
+ project = make_project(member=user)
+ earlier = timezone.now() - timedelta(days=60)
+ ProjectMembership.objects.filter(project=project).update(created_at=earlier)
+ deployed = DeployedModel.objects.create(
+ project=project,
+ model_id="ft-returning",
+ status=DeployedModel.Status.READY,
+ deployed_at=earlier,
+ )
+ capability = make_capability(project, first_application_request_at=earlier)
+ # The persisted state after a redeploy/model switch no longer retains the first date.
+ DeployedModel.objects.filter(pk=deployed.pk).update(deployed_at=timezone.now())
+ type(capability).objects.filter(pk=capability.pk).update(
+ first_application_request_at=timezone.now()
+ )
+ response = client().post(
+ URL,
+ {"tool": "customers_at_step", "arguments": {"days": 7, "step": step}},
+ format="json",
+ )
+ assert response.status_code == 200
+ assert response.data["private"] is True
+ assert "cannot be determined" in response.data["content"]
+ assert "[email protected]" not in response.data["content"]
+ assert "0 users" not in response.data["content"]
+
+
+ "step",
+ [
+ "signed_up",
+ "joined_project",
+ "sent_first_span",
+ "synced_capabilities",
+ "ran_evaluation",
+ "started_training",
+ ],
+)
+def test_milestone_report_counts_all_matches_but_fetches_only_newest_customers(step, time_machine):
+ time_machine.move_to(datetime(2026, 10, 25, 12, tzinfo=UTC), tick=False)
+ now = timezone.now()
+
+ def add_milestone(user, at):
+ if step == "signed_up":
+ User.objects.filter(pk=user.pk).update(date_joined=at)
+ return
+ project = make_project(member=user)
+ ProjectMembership.objects.filter(project=project).update(
+ created_at=at if step == "joined_project" else at - timedelta(days=1)
+ )
+ if step == "joined_project":
+ return
+ if step == "sent_first_span":
+ record = make_span(project, trace_id="a" * 32)
+ field = "received_at"
+ elif step == "synced_capabilities":
+ record = make_capability(project)
+ field = "created_at"
+ elif step == "ran_evaluation":
+ record = EvalRun.objects.create(project=project, status=EvalRun.Status.COMPLETED)
+ field = "created_at"
+ else:
+ dataset = Dataset.objects.create(project=project, name="Train", intent="train")
+ record = FinetuningJob.objects.create(
+ project=project,
+ dataset=dataset,
+ base_model="Qwen/Qwen3-4B",
+ status=FinetuningJob.Status.SUCCEEDED,
+ )
+ field = "created_at"
+ type(record).objects.filter(pk=record.pk).update(**{field: at})
+
+ expected = []
+ for index in range(30):
+ user = make_user(email=f"bounded-{index:02}@example.com")
+ # Ties must keep deterministic user order, not duplicate a customer.
+ at = now - timedelta(hours=index // 2 + 1)
+ add_milestone(user, at)
+ expected.append(user.email)
+ guest = make_user(email="[email protected]", is_guest=True)
+ add_milestone(guest, now)
+ old = make_user(email="[email protected]")
+ add_milestone(old, now - timedelta(days=60))
+ if step != "signed_up":
+ add_milestone(old, now - timedelta(hours=1))
+ row_counts = []
+
+ def observe_rows(execute, sql, params, many, context):
+ result = execute(sql, params, many, context)
+ if sql.startswith("SELECT") and User._meta.db_table in sql:
+ row_counts.append(context["cursor"].rowcount)
+ return result
+
+ with connection.execute_wrapper(observe_rows):
+ response = client().post(
+ URL,
+ {"tool": "customers_at_step", "arguments": {"days": 7, "step": step, "limit": 3}},
+ format="json",
+ )
+ assert response.status_code == 200
+ report = response.data["content"]
+ assert "30 users" in report and "Showing 3 results" in report
+ actual = [line.split(": ")[0] for line in report.splitlines() if "@" in line]
+ assert actual == expected[:3]
+ # Observe real PostgreSQL result sizes: a small response must not fetch all matches.
+ assert row_counts and max(row_counts) <= 3
+
+
+def test_agent_reads_share_one_snapshot_for_an_hour(time_machine):
+ time_machine.move_to(datetime(2026, 10, 25, 12, tzinfo=UTC), tick=False)
+ make_user(email="[email protected]")
+ calls = [
+ ("activation_funnel", {"days": 7}),
+ ("billing_summary", {"days": 7}),
+ ("customer_activity", {"days": 7, "email": "[email protected]"}),
+ ("customers_at_step", {"days": 7, "step": "signed_up"}),
+ ]
+
+ def ask(tool, arguments):
+ response = client().post(URL, {"tool": tool, "arguments": arguments}, format="json")
+ assert response.status_code == 200
+ assert response["Cache-Control"] == "private, no-store"
+ return response.data
+
+ first = {tool: ask(tool, arguments) for tool, arguments in calls}
+ make_user(email="[email protected]")
+ User.objects.filter(email="[email protected]").update(
+ date_joined=timezone.now() - timedelta(days=2)
+ )
+ time_machine.shift(3599)
+ observed = []
+
+ def record(execute, sql, params, many, context):
+ observed.append(sql)
+ return execute(sql, params, many, context)
+
+ with connection.execute_wrapper(record):
+ again = ask("billing_summary", {"days": 7})
+ assert again == first["billing_summary"]
+ assert observed == []
+ assert ask("activation_funnel", {"days": 7}) == first["activation_funnel"]
+ assert (
+ ask("customer_activity", {"days": 7, "email": "[email protected]"})
+ == first["customer_activity"]
+ )
+ assert (
+ ask("customers_at_step", {"days": 7, "step": "signed_up", "limit": 25})
+ == first["customers_at_step"]
+ )
+ other_window = ask("activation_funnel", {"days": 30})
+ assert other_window["content"] != first["activation_funnel"]["content"]
+ assert other_window["as_of"] != first["activation_funnel"]["as_of"]
+ assert "[email protected]" not in first["customers_at_step"]["content"]
+
+ time_machine.shift(2)
+ refreshed = ask("activation_funnel", {"days": 7})
+ customer = ask("customer_activity", {"days": 7, "email": "[email protected]"})
+ assert refreshed["content"] != first["activation_funnel"]["content"]
+ assert refreshed["as_of"] != first["activation_funnel"]["as_of"]
+ assert customer["content"] != first["customer_activity"]["content"]
+ assert (
+ in ask("customers_at_step", {"days": 7, "step": "signed_up", "limit": 25})["content"]
+ )
+
+
+def posthog_usage_source(settings, scripted):
+ settings.POSTHOG_PERSONAL_API_KEY = "posthog-cache-test"
+ settings.POSTHOG_PROJECT_ID = "42"
+ settings.POSTHOG_API_HOST = "https://eu.posthog.com"
+ state = {"available": True, "count": 1}
+
+ def answer(request):
+ if not state["available"]:
+ return 503, {"content-type": "application/json"}, b"{}"
+ query = request.json["query"]["query"]
+ rows = []
+ if "SELECT toDate(" in query:
+ rows = [[timezone.now().date().isoformat(), "cli.completed", state["count"]]]
+ elif "SELECT uniq(person_id)" in query:
+ rows = [[state["count"]]]
+ elif "countIf(" in query:
+ rows = [[0, 0]]
+ return 200, {"content-type": "application/json"}, json.dumps({"results": rows}).encode()
+
+ return scripted("https://eu.posthog.com").then(answer), state
+
+
+def usage(days=7):
+ response = client().post(
+ URL, {"tool": "product_usage", "arguments": {"days": days}}, format="json"
+ )
+ assert response.status_code == 200
+ return json.loads(response.data["content"])
+
+
+def test_agent_usage_reuses_source_snapshot_for_an_hour_without_caching_product_rows(
+ posthog_usage_source, time_machine
+):
+ time_machine.move_to(datetime(2026, 10, 25, 12, tzinfo=UTC), tick=False)
+ api, state = posthog_usage_source
+ first = usage()
+ assert first["posthog"]["available"] is True and len(api.calls) == 5
+ state["count"] = 2
+ make_user()
+ time_machine.shift(3599)
+ cached = usage()
+ assert cached["posthog"] == first["posthog"]
+ assert cached["registered_users"] == first["registered_users"] + 1
+ assert len(api.calls) == 5
+ time_machine.shift(2)
+ refreshed = usage()
+ assert refreshed["posthog"]["totals"]["cli_completions"] == 2
+ assert refreshed["posthog"]["window_end"] != first["posthog"]["window_end"]
+ assert len(api.calls) == 10
+
+
+def test_agent_usage_failure_is_cached_briefly_then_recovers(posthog_usage_source, time_machine):
+ time_machine.move_to(datetime(2026, 10, 25, 12, tzinfo=UTC), tick=False)
+ api, state = posthog_usage_source
+ state["available"] = False
+ first = usage()["posthog"]
+ assert first["available"] is False and "totals" not in first
+ assert len(api.calls) == 5
+ state["available"] = True
+ time_machine.shift(59)
+ assert usage()["posthog"] == first
+ assert len(api.calls) == 5
+ time_machine.shift(2)
+ assert usage()["posthog"]["available"] is True
+ assert len(api.calls) == 10
+
+
+def test_agent_usage_cache_separates_window_source_and_utc_day(
+ posthog_usage_source, time_machine, settings
+):
+ time_machine.move_to(datetime(2026, 10, 25, 23, 59, tzinfo=UTC), tick=False)
+ api, state = posthog_usage_source
+ first = usage()["posthog"]
+ assert first["available"] is True
+ state["count"] = 2
+ assert usage(30)["posthog"]["totals"]["cli_completions"] == 2
+ settings.POSTHOG_PROJECT_ID = "43"
+ assert usage()["posthog"]["totals"]["cli_completions"] == 2
+ settings.POSTHOG_PERSONAL_API_KEY = "rotated-read-key"
+ state["count"] = 3
+ assert usage()["posthog"]["totals"]["cli_completions"] == 3
+ time_machine.shift(120)
+ today = usage()["posthog"]
+ assert today["window_start"] != first["window_start"]
+ assert len(api.calls) == 25
diff --git a/tests/test_overwatch_dashboard.py b/tests/test_overwatch_dashboard.py
new file mode 100644
index 00000000..ad9dbe9f
--- /dev/null
+++ b/tests/test_overwatch_dashboard.py
@@ -0,0 +1,546 @@
+from __future__ import annotations
+
+import json
+import re
+from datetime import datetime, timedelta
+
+import pytest
+from django.apps import apps
+from django.db import connection
+from django.utils import timezone
+from factories import (
+ api_key_client,
+ auth_client,
+ make_capability,
+ make_project,
+ make_span,
+ make_user,
+)
+from rest_framework.test import APIClient
+
+from overbae.models import (
+ BillingService,
+ BillingTelemetry,
+ Dataset,
+ DeployedModel,
+ EvalRun,
+ FinetuningJob,
+ InferenceCall,
+ OptimizerExperiment,
+ ProjectMembership,
+ Subscription,
+ SubscriptionStatus,
+ User,
+)
+
+pytestmark = pytest.mark.django_db
+
+TOKEN = "overwatch-test-token"
+
+
[email protected](autouse=True)
+def _token(settings):
+ settings.SALES_DASHBOARD_TOKEN = TOKEN
+
+
+def overwatch_client(token: str = TOKEN) -> APIClient:
+ client = APIClient()
+ client.credentials(HTTP_AUTHORIZATION=f"Bearer {token}")
+ return client
+
+
+def accounts():
+ guest = make_user(email="[email protected]", is_guest=True)
+ guest_project = make_project(member=guest)
+ make_span(guest_project, trace_id="a" * 32)
+
+ active = make_user(email="[email protected]")
+ project = make_project(member=active)
+ make_span(project, trace_id="b" * 32)
+ make_span(project, trace_id="b" * 32, parent_span_id="c" * 16)
+ capability = make_capability(project)
+ dataset = Dataset.objects.create(project=project, name="Train", intent="train")
+ EvalRun.objects.create(project=project, name="Eval", status=EvalRun.Status.COMPLETED)
+ job = FinetuningJob.objects.create(
+ project=project,
+ dataset=dataset,
+ base_model="Qwen/Qwen3-4B",
+ status=FinetuningJob.Status.SUCCEEDED,
+ )
+ deployed = DeployedModel.objects.create(
+ project=project,
+ finetuning_job=job,
+ model_id="ft-qwen-1",
+ status=DeployedModel.Status.READY,
+ deployed_at=timezone.now(),
+ )
+ capability.active_model = deployed
+ capability.first_application_request_at = timezone.now()
+ capability.save(update_fields=["active_model", "first_application_request_at"])
+ paying = make_user(email="[email protected]")
+
+ old = make_user(email="[email protected]")
+ User.objects.filter(pk=old.pk).update(date_joined=timezone.now() - timedelta(days=60))
+ return {"active": active, "paying": paying, "old": old}
+
+
[email protected]("path", ["overview", "activation", "users", "users/{id}"])
+def test_rejects_anything_but_the_configured_token(settings, path):
+ user = make_user()
+ url = f"/api/internal/overwatch/{path.format(id=user.id)}/"
+
+ assert APIClient().get(url).status_code == 403
+ assert overwatch_client("wrong").get(url).status_code == 403
+ assert auth_client(user).get(url).status_code == 403
+ assert api_key_client(user).get(url).status_code == 403
+ assert overwatch_client().get(url).status_code == 200
+
+ settings.SALES_DASHBOARD_TOKEN = ""
+ assert overwatch_client("").get(url).status_code == 403
+
+
+def test_overview_counts_customers_only(accounts):
+ body = overwatch_client().get("/api/internal/overwatch/overview/").json()
+
+ assert body["users_total"] == 3
+ assert sum(point["value"] for point in body["signups"]) == 2
+ assert body["trace_active_users_7d"] == 1
+ assert sum(point["value"] for point in body["spans"]) == 2
+ assert sum(point["value"] for point in body["traces"]) == 1
+ assert body["training_jobs"] == {"succeeded": 1}
+ assert body["top_base_models"] == [{"base_model": "Qwen/Qwen3-4B", "jobs": 1}]
+ assert body["live_deployments"] == 1
+
+
+def test_overview_retains_subscription_spend_and_payment_insights(accounts):
+ paying = accounts["paying"]
+ Subscription.objects.create(
+ user=paying,
+ status=SubscriptionStatus.ACTIVE,
+ cancel_at_period_end=True,
+ )
+ BillingTelemetry.objects.create(
+ user=paying,
+ amount="-53.2500000",
+ service=BillingService.INFERENCE,
+ )
+ BillingTelemetry.objects.create(
+ user=paying,
+ amount="5.0000000",
+ service=BillingService.STRIPE_TOPUP,
+ )
+
+ body = overwatch_client().get("/api/internal/overwatch/overview/").json()
+
+ assert body["subscriptions"] == {SubscriptionStatus.ACTIVE: 1}
+ assert body["paying_users"] == 1
+ assert body["cancelling_users"] == 1
+ assert body["free_users"] == 1
+ assert body["low_balance_users"] == 1
+ assert body["spend_by_service"] == {BillingService.INFERENCE: "53.2500000"}
+ assert sum(float(point["value"]) for point in body["topups_usd"]) == 5
+ assert sum(float(point["value"]) for point in body["spend_usd"]) == 53.25
+
+
+def test_user_activity_retains_lifetime_billing_and_window_history(accounts):
+ paying = accounts["paying"]
+ Subscription.objects.create(user=paying, status=SubscriptionStatus.PAST_DUE)
+ BillingTelemetry.objects.create(
+ user=paying,
+ amount="-7.5000000",
+ service=BillingService.FINETUNING_JOB,
+ )
+ BillingTelemetry.objects.create(
+ user=paying,
+ amount="10.0000000",
+ service=BillingService.STRIPE_TOPUP,
+ )
+
+ body = overwatch_client().get(f"/api/internal/overwatch/users/{paying.id}/").json()
+
+ assert body["user"]["subscription_status"] == SubscriptionStatus.PAST_DUE
+ assert body["user"]["spend_usd"] == "7.5000000"
+ assert body["user"]["topups_usd"] == "10.0000000"
+ assert body["user"]["balance_usd"] == "52.5000000"
+ assert body["billing"]["subscription_status"] == SubscriptionStatus.PAST_DUE
+ assert body["billing"]["spend_usd"] == "7.5000000"
+ assert body["billing"]["topups_usd"] == "10.0000000"
+ assert body["billing"]["balance_usd"] == "52.5000000"
+ assert sum(float(point["value"]) for point in body["billing"]["spend_daily"]) == 7.5
+ assert sum(float(point["value"]) for point in body["billing"]["topups_daily"]) == 10
+
+
+def test_posthog_usage_survives_http_and_serializer_boundary(settings, scripted):
+ settings.POSTHOG_PERSONAL_API_KEY = "posthog-read-test"
+ settings.POSTHOG_PROJECT_ID = "42"
+ settings.POSTHOG_API_HOST = "https://eu.posthog.com"
+ queries = []
+
+ def answer(call):
+ hogql = call.json["query"]["query"]
+ queries.append(hogql)
+ if "SELECT toDate(" in hogql:
+ rows = [[timezone.now().date().isoformat(), "cli.completed", 4]]
+ elif "SELECT uniq(person_id)" in hogql:
+ rows = [[3]]
+ elif "properties.$mcp_tool_name" in hogql:
+ rows = [["list_projects", 5, 2]]
+ elif "properties.command_path" in hogql:
+ rows = [["sync", 7, 3]]
+ elif "countIf(toBool(properties.$mcp_is_error))" in hogql:
+ rows = [[5, 1]]
+ else:
+ raise AssertionError("Unexpected aggregate query")
+ return 200, {"content-type": "application/json"}, json.dumps({"results": rows}).encode()
+
+ api = scripted("https://eu.posthog.com").then(answer)
+ response = overwatch_client().get("/api/internal/overwatch/product-usage/?days=14")
+ result = response.json()
+ assert result["available"] is True
+ assert result["active_users"] == 3
+ assert result["totals"]["cli_completions"] == 4
+ assert "funnel_steps" not in result
+ assert result["top_mcp_tools"] == [{"name": "list_projects", "calls": 5, "users": 2}]
+ assert result["top_cli_commands"] == [{"name": "sync", "completions": 7, "users": 3}]
+ assert result["mcp_tool_errors"] == 1
+ assert result["mcp_tool_error_rate"] == 0.2
+ assert len(api.calls) == 5
+ assert all("overwatch_funnel_step" not in query for query in queries)
+ assert response["Cache-Control"] == "private, no-store"
+ assert all("timestamp <= toDateTime" in query for query in queries)
+
+
+ "rows", [None, [["bad-date", "cli.completed", 1]], [["2026-10-25", "unknown", 1]]]
+)
+def test_malformed_posthog_results_are_unavailable_not_zero(settings, scripted, rows):
+ settings.POSTHOG_PERSONAL_API_KEY = "posthog-read-test"
+ settings.POSTHOG_PROJECT_ID = "42"
+ settings.POSTHOG_API_HOST = "https://eu.posthog.com"
+ scripted("https://eu.posthog.com").reply(json_body={"results": rows})
+ result = overwatch_client().get("/api/internal/overwatch/product-usage/").json()
+ assert result["available"] is False
+ assert "active_users" not in result
+
+
+ ("section", "replacement", "available"),
+ [
+ ("active", [], False),
+ ("active", [[0, 1]], False),
+ ("errors", [], False),
+ ("errors", [[0]], False),
+ ("daily", [["2000-01-01", "cli.completed", 1]], False),
+ ("tools", [["list_projects", 1, 1]] * 9, False),
+ ("daily", [], True),
+ ],
+)
+def test_posthog_empty_events_differ_from_incomplete_aggregates(
+ settings, scripted, section, replacement, available
+):
+ settings.POSTHOG_PERSONAL_API_KEY = "posthog-read-test"
+ settings.POSTHOG_PROJECT_ID = "42"
+ settings.POSTHOG_API_HOST = "https://eu.posthog.com"
+
+ def answer(request):
+ query = request.json["query"]["query"]
+ key, rows = "other", []
+ if "SELECT uniq(person_id)" in query:
+ key, rows = "active", [[0]]
+ elif "countIf(toBool(properties.$mcp_is_error))" in query:
+ key, rows = "errors", [[0, 0]]
+ elif "SELECT toDate(" in query:
+ key = "daily"
+ elif "properties.$mcp_tool_name" in query:
+ key = "tools"
+ return (
+ 200,
+ {"content-type": "application/json"},
+ json.dumps({"results": replacement if key == section else rows}).encode(),
+ )
+
+ scripted("https://eu.posthog.com").then(answer)
+ result = overwatch_client().get("/api/internal/overwatch/product-usage/").json()
+ assert result["available"] is available
+ if available:
+ assert result["active_users"] == result["mcp_tool_errors"] == 0
+ else:
+ assert "active_users" not in result
+
+
[email protected]("days", [30, 365])
+def test_posthog_daily_totals_include_the_complete_window(settings, scripted, days):
+ settings.POSTHOG_PERSONAL_API_KEY = "posthog-read-test"
+ settings.POSTHOG_PROJECT_ID = "42"
+ settings.POSTHOG_API_HOST = "https://eu.posthog.com"
+ today = timezone.now().date()
+ events = [
+ "cli.completed",
+ "$mcp_tool_call",
+ "training_result_available",
+ "training_check_finished",
+ ]
+ daily = [
+ [(today - timedelta(days=offset)).isoformat(), event, 1]
+ for offset in reversed(range(days))
+ for event in events
+ ]
+
+ def answer(request):
+ query = request.json["query"]["query"]
+ if "GROUP BY" in query and "timestamp" in query and "properties." not in query:
+ # Reproduce the external API's implicit result cap, not an unlimited fake.
+ match = re.search(r"LIMIT (\d+)\s*$", query)
+ limit = int(match[1]) if match else 100
+ payload = {"results": daily[:limit], "hasMore": len(daily) > limit}
+ elif "SELECT uniq(person_id)" in query:
+ payload = {"results": [[1]]}
+ elif "countIf(" in query:
+ payload = {"results": [[days, 0]]}
+ else:
+ payload = {"results": []}
+ return 200, {"content-type": "application/json"}, json.dumps(payload).encode()
+
+ scripted("https://eu.posthog.com").then(answer)
+ result = overwatch_client().get(f"/api/internal/overwatch/product-usage/?days={days}").json()
+ assert result["available"] is True
+ assert list(result["totals"].values()) == [days] * 4
+ assert len(result["daily"]) == days
+ assert result["daily"][-1]["day"] == today.isoformat()
+ assert result["daily"][-1]["cli_completions"] == 1
+
+
[email protected]("section", ["daily", "active", "errors", "tools"])
+def test_posthog_truncation_is_only_allowed_for_top_lists(settings, scripted, section):
+ settings.POSTHOG_PERSONAL_API_KEY = "posthog-read-test"
+ settings.POSTHOG_PROJECT_ID = "42"
+ settings.POSTHOG_API_HOST = "https://eu.posthog.com"
+
+ def answer(request):
+ query = request.json["query"]["query"]
+ key, rows = "daily", [[timezone.now().date().isoformat(), "cli.completed", 1]]
+ if "SELECT uniq(person_id)" in query:
+ key, rows = "active", [[1]]
+ elif "countIf(" in query:
+ key, rows = "errors", [[1, 0]]
+ elif "properties.$mcp_tool_name" in query:
+ key, rows = "tools", [["list_projects", 1, 1]] * 8
+ elif "properties.command_path" in query:
+ key, rows = "commands", []
+ return (
+ 200,
+ {"content-type": "application/json"},
+ json.dumps({"results": rows, "hasMore": key == section}).encode(),
+ )
+
+ scripted("https://eu.posthog.com").then(answer)
+ result = overwatch_client().get("/api/internal/overwatch/product-usage/?days=7").json()
+ assert result["available"] is (section == "tools")
+ if section != "tools":
+ assert "totals" not in result
+
+
+def test_unicode_bearer_token_is_rejected_safely():
+ assert overwatch_client("☃").get("/api/internal/overwatch/overview/").status_code == 403
+
+
[email protected]("path", ["overview", "activation", "users", "users/{id}", "product-usage"])
+def test_product_analytics_endpoints_only_read_the_database(accounts, path):
+ url = f"/api/internal/overwatch/{path.format(id=accounts['active'].pk)}/"
+
+ def only_reads(execute, sql, params, many, context):
+ assert (
+ sql.lstrip().upper().startswith(("SELECT", "SHOW", "SAVEPOINT", "RELEASE", "ROLLBACK"))
+ ), "An Overwatch analytics request attempted a database write."
+ return execute(sql, params, many, context)
+
+ client = overwatch_client()
+ with connection.execute_wrapper(only_reads):
+ assert client.get(url).status_code == 200
+ for method in (client.post, client.patch, client.delete):
+ assert method(url).status_code == 405
+
+
+def test_overwatch_has_no_product_models_or_periodic_writers(settings):
+ assert not any(model.__name__.startswith("Overwatch") for model in apps.get_models())
+ assert not any(
+ schedule["task"].startswith("overbae.tasks.overwatch.")
+ for schedule in settings.CELERY_BEAT_SCHEDULE.values()
+ )
+
+
+def test_dashboard_credential_cannot_create_a_core_product_project():
+ response = overwatch_client().post(
+ "/api/projects/", {"name": "Overwatch must not create this"}, format="json"
+ )
+ assert response.status_code in {401, 403}
+ assert not ProjectMembership.objects.filter(
+ project__name="Overwatch must not create this"
+ ).exists()
+
+
+def test_funnel_follows_window_signups(accounts):
+ body = overwatch_client().get("/api/internal/overwatch/activation/").json()
+
+ assert body["steps"] == [
+ {"step": "signed_up", "users": 2},
+ {"step": "joined_project", "users": 1},
+ {"step": "sent_first_span", "users": 1},
+ {"step": "synced_capabilities", "users": 1},
+ {"step": "ran_evaluation", "users": 1},
+ {"step": "started_training", "users": 1},
+ {"step": "deployed_model", "users": 1},
+ {"step": "called_alias", "users": 1},
+ ]
+ assert body["median_hours_to_first_span"] is not None
+
+ widened = overwatch_client().get("/api/internal/overwatch/activation/?days=90").json()
+ assert widened["steps"][0] == {"step": "signed_up", "users": 3}
+
+
+def test_project_activity_only_counts_after_a_user_joins(accounts):
+ active = accounts["active"]
+ project = active.project_memberships.get().project
+ invited = make_user(email="[email protected]")
+ ProjectMembership.objects.create(user=invited, project=project)
+
+ body = overwatch_client().get("/api/internal/overwatch/activation/").json()
+ steps = {step["step"]: step["users"] for step in body["steps"]}
+
+ assert steps["signed_up"] == 3
+ assert steps["joined_project"] == 2
+ assert steps["sent_first_span"] == 1
+ assert steps["synced_capabilities"] == 1
+ assert steps["ran_evaluation"] == 1
+ assert steps["started_training"] == 1
+ assert steps["deployed_model"] == 1
+ assert steps["called_alias"] == 1
+ overview = overwatch_client().get("/api/internal/overwatch/overview/").json()
+ assert overview["trace_active_users_7d"] == overview["trace_active_users_window"] == 1
+
+
+def test_accounts_table_pages_and_orders(accounts):
+ first = overwatch_client().get("/api/internal/overwatch/users/?ordering=-spans&page_size=1")
+ body = first.json()
+
+ assert body["count"] == 3
+ assert body["next"]
+ row = body["results"][0]
+ assert row["email"] == "[email protected]"
+ assert row["projects"] == 1
+ assert row["seats"] == 1
+ assert row["spans"] == 2
+ assert row["training_jobs"] == 1
+ assert row["live_deployments"] == 1
+ assert row["stage"] == "called_alias"
+
+ by_projects = overwatch_client().get("/api/internal/overwatch/users/?ordering=-projects").json()
+ assert by_projects["results"][0]["email"] == "[email protected]"
+
+ assert overwatch_client().get("/api/internal/overwatch/overview/?days=0").status_code == 400
+
+
+def test_account_activity_breaks_down_each_workflow(accounts):
+ active = accounts["active"]
+ project = active.project_memberships.get().project
+ dataset = project.datasets.get()
+ FinetuningJob.objects.create(
+ project=project,
+ dataset=dataset,
+ base_model="Qwen/Qwen3-4B",
+ status=FinetuningJob.Status.FAILED,
+ )
+ deployed = DeployedModel.objects.get(model_id="ft-qwen-1")
+ InferenceCall.objects.create(deployed_model=deployed, project=project)
+ InferenceCall.objects.create(deployed_model=deployed, project=project)
+ Dataset.objects.create(project=project, name="Traces", source_kind="traces", intent="eval")
+ OptimizerExperiment.objects.create(
+ project=project, capability=project.capabilities.get(), dataset=dataset
+ )
+
+ body = overwatch_client().get(f"/api/internal/overwatch/users/{active.id}/").json()
+
+ assert body["user"]["email"] == "[email protected]"
+ training = body["training"]
+ assert training["totals"] == {
+ "started": 2,
+ "completed": 1,
+ "failed": 1,
+ "cancelled": 0,
+ "in_progress": 0,
+ }
+ assert sum(sum(point["values"].values()) for point in training["daily"]) == 2
+ assert {job["status"] for job in training["recent"]} == {"succeeded", "failed"}
+ assert body["traces"]["total"] == 1
+ assert sum(point["value"] for point in body["traces"]["daily"]) == 1
+ assert body["inference"]["calls"] == 2
+ assert body["inference"]["models"] == 1
+ assert body["inference"]["by_model"] == {"ft-qwen-1": 2}
+ assert body["datasets"]["total"] == 2
+ assert body["datasets"]["by_source"] == {"file": 1, "traces": 1}
+ assert body["datasets"]["by_intent"] == {"train": 1, "eval": 1}
+ assert body["optimizer"]["by_status"] == {"scheduled": 1}
+ assert body["evaluations"]["by_status"] == {"completed": 1}
+
+ guest = User.objects.get(email="[email protected]")
+ assert overwatch_client().get(f"/api/internal/overwatch/users/{guest.id}/").status_code == 404
+
+
+def test_responses_are_cached_for_an_hour(accounts):
+ first = overwatch_client().get("/api/internal/overwatch/overview/").json()
+ make_user()
+ again = overwatch_client().get("/api/internal/overwatch/overview/").json()
+
+ assert again["users_total"] == first["users_total"] == 3
+ assert again["computed_at"] == first["computed_at"]
+ computed = datetime.fromisoformat(first["computed_at"])
+ assert datetime.fromisoformat(first["refreshes_at"]) - computed == timedelta(hours=1)
+
+ other_window = overwatch_client().get("/api/internal/overwatch/overview/?days=7").json()
+ assert other_window["users_total"] == 4
+
+ page = overwatch_client().get("/api/internal/overwatch/users/").json()
+ assert page["count"] == 4 and page["computed_at"]
+
+
[email protected](autouse=True)
+def _sandbox(settings):
+ # These tests never call the parser sandbox; outbound requests remain guarded.
+ settings.SANDBOX_URL = "http://sandbox.test"
+ settings.SANDBOX_TOKEN = "analytics-test"
+
+
+def test_one_day_window_starts_at_utc_midnight():
+ from overbae.services.user_insights import window_start
+
+ start = window_start(1)
+ assert (start.hour, start.minute, start.second, start.microsecond) == (0, 0, 0, 0)
+ assert start.date() == timezone.now().date()
+
+
+def test_database_timeout_is_bounded_and_restores_connection():
+ from django.db import DatabaseError, connection
+
+ from overbae.services.user_insights import analytics_read_budget
+
+ with connection.cursor() as cursor:
+ cursor.execute("SHOW statement_timeout")
+ before = cursor.fetchone()[0]
+ with pytest.raises(DatabaseError), analytics_read_budget(0.05), connection.cursor() as cursor:
+ cursor.execute("SELECT pg_sleep(0.3)")
+ with connection.cursor() as cursor:
+ cursor.execute("SHOW statement_timeout")
+ assert cursor.fetchone()[0] == before
+ cursor.execute("SELECT 1")
+ assert cursor.fetchone() == (1,)
+
+
+def test_posthog_credentials_cannot_be_sent_to_unapproved_host(settings, scripted):
+ settings.POSTHOG_PERSONAL_API_KEY = "posthog-read-test"
+ settings.POSTHOG_PROJECT_ID = "42"
+ settings.POSTHOG_API_HOST = "https://attacker.test"
+ attacker = scripted("https://attacker.test").reply(json_body={"results": []})
+ response = overwatch_client().get("/api/internal/overwatch/product-usage/")
+ assert response.json()["available"] is False
+ assert attacker.calls == []
diff --git a/tests/test_sales_dashboard.py b/tests/test_sales_dashboard.py
deleted file mode 100644
index 4558abe0..00000000
--- a/tests/test_sales_dashboard.py
+++ /dev/null
@@ -1,241 +0,0 @@
-from __future__ import annotations
-
-from datetime import datetime, timedelta
-from decimal import Decimal
-
-import pytest
-from django.utils import timezone
-from factories import (
- api_key_client,
- auth_client,
- make_capability,
- make_project,
- make_span,
- make_user,
-)
-from rest_framework.test import APIClient
-
-from overbae.models import (
- BillingService,
- BillingTelemetry,
- Dataset,
- DeployedModel,
- EvalRun,
- FinetuningJob,
- InferenceCall,
- OptimizerExperiment,
- Subscription,
- SubscriptionStatus,
- User,
-)
-from overbae.services.billing_ledger import FREE_CREDITS_USD
-
-pytestmark = pytest.mark.django_db
-
-TOKEN = "sales-test-token"
-
-
[email protected](autouse=True)
-def _token(settings):
- settings.SALES_DASHBOARD_TOKEN = TOKEN
-
-
-def sales_client(token: str = TOKEN) -> APIClient:
- client = APIClient()
- client.credentials(HTTP_AUTHORIZATION=f"Bearer {token}")
- return client
-
-
-def accounts():
- guest = make_user(email="[email protected]", is_guest=True)
- guest_project = make_project(member=guest)
- make_span(guest_project, trace_id="a" * 32)
- BillingTelemetry.objects.create(
- user=guest, amount=Decimal("-9"), service=BillingService.INFERENCE
- )
-
- active = make_user(email="[email protected]")
- project = make_project(member=active)
- make_span(project, trace_id="b" * 32)
- make_span(project, trace_id="b" * 32, parent_span_id="c" * 16)
- capability = make_capability(project)
- dataset = Dataset.objects.create(project=project, name="Train", intent="train")
- EvalRun.objects.create(project=project, name="Eval", status=EvalRun.Status.COMPLETED)
- job = FinetuningJob.objects.create(
- project=project,
- dataset=dataset,
- base_model="Qwen/Qwen3-4B",
- status=FinetuningJob.Status.SUCCEEDED,
- )
- deployed = DeployedModel.objects.create(
- project=project,
- finetuning_job=job,
- model_id="ft-qwen-1",
- status=DeployedModel.Status.READY,
- deployed_at=timezone.now(),
- )
- capability.active_model = deployed
- capability.first_application_request_at = timezone.now()
- capability.save(update_fields=["active_model", "first_application_request_at"])
- BillingTelemetry.objects.create(
- user=active, project=project, amount=Decimal("-1.5"), service=BillingService.INFERENCE
- )
- BillingTelemetry.objects.create(
- user=active, project=project, amount=Decimal("-0.5"), service=BillingService.EVALUATION
- )
-
- paying = make_user(email="[email protected]")
- make_project(member=paying)
- Subscription.objects.create(user=paying, status=SubscriptionStatus.ACTIVE)
- BillingTelemetry.objects.create(
- user=paying, amount=Decimal("25"), service=BillingService.STRIPE_TOPUP
- )
-
- old = make_user(email="[email protected]")
- User.objects.filter(pk=old.pk).update(date_joined=timezone.now() - timedelta(days=60))
- return {"active": active, "paying": paying, "old": old}
-
-
[email protected]("path", ["overview", "funnel", "accounts", "accounts/{id}"])
-def test_rejects_anything_but_the_configured_token(settings, path):
- user = make_user()
- url = f"/api/internal/sales/{path.format(id=user.id)}/"
-
- assert APIClient().get(url).status_code == 403
- assert sales_client("wrong").get(url).status_code == 403
- assert auth_client(user).get(url).status_code == 403
- assert api_key_client(user).get(url).status_code == 403
- assert sales_client().get(url).status_code == 200
-
- settings.SALES_DASHBOARD_TOKEN = ""
- assert sales_client("").get(url).status_code == 403
-
-
-def test_overview_counts_customers_only(accounts):
- body = sales_client().get("/api/internal/sales/overview/").json()
-
- assert body["accounts_total"] == 3
- assert sum(point["value"] for point in body["signups"]) == 2
- assert body["active_accounts_7d"] == 1
- assert body["subscriptions"] == {"active": 1}
- assert body["paying_accounts"] == 1
- assert body["free_accounts"] == 1
- assert Decimal(body["topups_usd"][0]["value"]) == Decimal("25")
- assert {k: Decimal(v) for k, v in body["spend_by_service"].items()} == {
- "inference": Decimal("1.5"),
- "evaluation": Decimal("0.5"),
- }
- assert sum(point["value"] for point in body["spans"]) == 2
- assert sum(point["value"] for point in body["traces"]) == 1
- assert body["training_jobs"] == {"succeeded": 1}
- assert body["top_base_models"] == [{"base_model": "Qwen/Qwen3-4B", "jobs": 1}]
- assert body["live_deployments"] == 1
-
-
-def test_funnel_follows_window_signups(accounts):
- body = sales_client().get("/api/internal/sales/funnel/").json()
-
- assert body["steps"] == [
- {"step": "signed_up", "accounts": 2},
- {"step": "created_project", "accounts": 2},
- {"step": "sent_first_span", "accounts": 1},
- {"step": "synced_capabilities", "accounts": 1},
- {"step": "ran_evaluation", "accounts": 1},
- {"step": "started_training", "accounts": 1},
- {"step": "deployed_model", "accounts": 1},
- {"step": "called_alias", "accounts": 1},
- ]
- assert body["median_hours_to_first_span"] is not None
-
- widened = sales_client().get("/api/internal/sales/funnel/?days=90").json()
- assert widened["steps"][0] == {"step": "signed_up", "accounts": 3}
-
-
-def test_accounts_table_pages_and_orders(accounts):
- first = sales_client().get("/api/internal/sales/accounts/?ordering=-spend_usd&page_size=1")
- body = first.json()
-
- assert body["count"] == 3
- assert body["next"]
- row = body["results"][0]
- assert row["email"] == "[email protected]"
- assert Decimal(row["spend_usd"]) == Decimal("2")
- assert row["projects"] == 1
- assert row["seats"] == 1
- assert row["spans"] == 2
- assert row["training_jobs"] == 1
- assert row["live_deployments"] == 1
- assert row["stage"] == "called_alias"
-
- by_topups = sales_client().get("/api/internal/sales/accounts/?ordering=-topups_usd").json()
- paying = by_topups["results"][0]
- assert paying["email"] == "[email protected]"
- assert paying["subscription_status"] == "active"
- assert Decimal(paying["balance_usd"]) == FREE_CREDITS_USD + Decimal("25")
- assert paying["stage"] == "created_project"
-
- assert sales_client().get("/api/internal/sales/overview/?days=0").status_code == 400
-
-
-def test_account_activity_breaks_down_each_workflow(accounts):
- active = accounts["active"]
- project = active.project_memberships.get().project
- dataset = project.datasets.get()
- FinetuningJob.objects.create(
- project=project,
- dataset=dataset,
- base_model="Qwen/Qwen3-4B",
- status=FinetuningJob.Status.FAILED,
- )
- deployed = DeployedModel.objects.get(model_id="ft-qwen-1")
- InferenceCall.objects.create(deployed_model=deployed, project=project)
- InferenceCall.objects.create(deployed_model=deployed, project=project)
- Dataset.objects.create(project=project, name="Traces", source_kind="traces", intent="eval")
- OptimizerExperiment.objects.create(
- project=project, capability=project.capabilities.get(), dataset=dataset
- )
-
- body = sales_client().get(f"/api/internal/sales/accounts/{active.id}/").json()
-
- assert body["account"]["email"] == "[email protected]"
- training = body["training"]
- assert training["totals"] == {
- "started": 2,
- "completed": 1,
- "failed": 1,
- "cancelled": 0,
- "in_progress": 0,
- }
- assert sum(sum(point["values"].values()) for point in training["daily"]) == 2
- assert {job["status"] for job in training["recent"]} == {"succeeded", "failed"}
- assert body["traces"]["total"] == 1
- assert sum(point["value"] for point in body["traces"]["daily"]) == 1
- assert body["inference"]["calls"] == 2
- assert body["inference"]["models"] == 1
- assert body["inference"]["by_model"] == {"ft-qwen-1": 2}
- assert body["datasets"]["total"] == 2
- assert body["datasets"]["by_source"] == {"file": 1, "traces": 1}
- assert body["datasets"]["by_intent"] == {"train": 1, "eval": 1}
- assert body["optimizer"]["by_status"] == {"scheduled": 1}
- assert body["evaluations"]["by_status"] == {"completed": 1}
-
- guest = User.objects.get(email="[email protected]")
- assert sales_client().get(f"/api/internal/sales/accounts/{guest.id}/").status_code == 404
-
-
-def test_responses_are_cached_for_an_hour(accounts):
- first = sales_client().get("/api/internal/sales/overview/").json()
- make_user()
- again = sales_client().get("/api/internal/sales/overview/").json()
-
- assert again["accounts_total"] == first["accounts_total"] == 3
- assert again["computed_at"] == first["computed_at"]
- computed = datetime.fromisoformat(first["computed_at"])
- assert datetime.fromisoformat(first["refreshes_at"]) - computed == timedelta(hours=1)
-
- other_window = sales_client().get("/api/internal/sales/overview/?days=7").json()
- assert other_window["accounts_total"] == 4
-
- page = sales_client().get("/api/internal/sales/accounts/").json()
- assert page["count"] == 4 and page["computed_at"]