Merged latest main (2.48.23) into fix/hardcoded-engine-urls. Resolved the
single conflict in package.json by taking main's changes and bumping the
version to 2.48.24 per the patch-level commit rule.
* docs(rules): add seeder authoring contract to data-engine-architecture rule
Adds section 8 documenting how to write a seeder: the auto-discovery model,
the three module shapes (interval+fetch, cron+fn, init), the { redis }-only
ctx, and publishing via @worldwideview/seeder-sdk. Includes good/bad examples
contrasting the ctx.setLiveSnapshot trap (which caused a silent CI failure)
against the two correct shapes. This rule auto-loads on local-seeders/** edits.
* docs(rules): add close-context-gaps AI meta-directive to AGENTS.md
When missing/wrong/undocumented context causes an error, a long struggle, or
slow understanding, agents must fix the doc/context (or add a guardrail) at its
source, or ask the user to; in autonomous mode, log the gap to revisit. Codifies
the lesson from the seeder ctx.setLiveSnapshot incident for all contributors.
Rename the env var to make its scope unambiguous: it is a local dev
override only and must never be set in production. Split the old single
var into two with clearly documented purposes:
- NEXT_PUBLIC_WWV_LOCAL_ENGINE_URL (local dev, .env.local, browser+server)
Used by resolveEngineUrl.ts and engineManifest.ts to redirect WS
connections to a locally-running engine during plugin development.
Each worktree should use a different port to avoid collisions.
- WWV_DATA_ENGINE_URL (production, docker-compose/Coolify, server-side only)
Used by service.ts for MCP REST calls to the engine. NOT read by
the browser. Set in docker-compose, not in .env.local.
service.ts shim reads WWV_DATA_ENGINE_URL first so existing production
docker-compose deployments are not broken by this rename.
Also fixes stale dataengine.worldwideview.dev subdomain references in
hostGlobals.ts (cloud fallback URLs now correctly point to dataenginev2).
Companion to wwv-data-engine fix/ci-stub-interval-fetch. The source-of-truth
stub (docker/ci/stub-seeder) used cron+fn and called ctx.setLiveSnapshot,
which the seeder ctx ({ redis }) does not expose — the snapshot never landed.
Switch to interval+fetch (return the array; scheduler auto-wraps + stores it).
Also remove the plugin-CI compose's ./stub-seeder volume mount and the stale
'Known foundation gap (deferred)' comment: the stub is now baked into the :ci
image at /app/seeders/stub, so the compose needs no host path and a consumer
repo can run it with only this YAML.
* feat: CI smoke-test foundation (probe + docker compose + rule updates)
Phase 1 of multi-repo CI initiative for catching plugin/seeder integration
failures (ADR-0002 id drift, missing mapWebsocketPayload, namespace
collisions, BOM in package.json) that current CI misses.
- packages/wwv-ci-probe: shared CLI with `seeder`, `ws`, `id-contract`
subcommands. README documents why no `plugin` subcommand (Playwright belongs
in wwv-plugins, not coupled to this probe). `files` + `prepublishOnly`
configured for clean npm publish.
- docker/ci/: reusable docker-compose stacks for plugin-CI and seeder-CI,
plus mock-upstream HTTP fixture server and CI-only stub-seeder. Compose
comments document scope boundary (consumer workflow owns user/plugin-row
injection via Playwright globalSetup pattern) and the deferred stub-seeder
bake-in for wwv-data-engine.
- .github/workflows/docker-publish.yml: adds `:ci` tag alias for downstream
consumers (one-line edit).
- .agents/rules/*: rename worldwideview-plugins → wwv-plugins (4 files) to
reflect repo rename + clarify it lives at local-plugins/ as its own git
working tree.
Bump 2.15.16 → 2.16.0 (Minor — new ci-probe package + new docker/ci
infrastructure are net-new features for the CI ecosystem).
Foundation has NOT been booted end-to-end yet — ghcr.io/silvertakana/
worldwideview:ci doesn't exist until this lands on main and the workflow
publishes. Next session: validate via real compose-up, then mirror the :ci
tag in wwv-data-engine repo and wire consumer workflows in wwv-plugins.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
* refactor(ci-probe): extract shared payload-shape validator with contract tests
* fix(ci): add /__health route to mock-upstream and gate engine on service_healthy
* chore: bump version to 2.48.18 for CI foundation landing
* chore: bump to 2.48.19 and reconcile lockfile after merging main (validateManifest fix)
---------
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
hostGlobals.ts and resolveEngineUrl.ts comment both referenced the old
dataengine.worldwideview.dev subdomain; updated to dataenginev2.worldwideview.dev.
Replaces two separate env vars (NEXT_PUBLIC_WWV_LOCAL_ENGINE_PORT and
WWV_DATA_ENGINE_URL) with one: NEXT_PUBLIC_WWV_DATA_ENGINE_URL (full
HTTP base URL, default http://localhost:5000). Available both client-side
and server-side so it only needs to be defined once.
- engineManifest.ts: getLocalEngineBase() reads the new var directly
- resolveEngineUrl.ts: getLocalWsUrl() converts http->ws from the new var
- service.ts: getEngineUrl() reads the new var (fixes 5001->5000 default)
- Tests updated to set the full URL instead of a port number
- .env.example documents the new var with local and Docker examples
Deduplicates the WWV_DATA_ENGINE_URL fallback: discoveryHelpers.ts now
calls getEngineUrl() from data-query/service instead of inlining the
same logic. Comments and test mocks that referenced literal localhost:5001
or localhost:5000 now reference NEXT_PUBLIC_WWV_LOCAL_ENGINE_PORT or use
a generic test host. Closes#182.
- ts-ignore/ts-nocheck detector now only flags real suppression directives
(token immediately after the // or /* comment opener), not prose mentions
- outdated-dep detector now parses pnpm's Unicode box-drawing table, skipping
header/separator rows; surfaces real outdated deps instead of one garbage row
Guard the resize pointermove handler with an isDraggingRef flag instead of
hasPointerCapture(), which behaves inconsistently across webkit versions in
CI for repeated drag sequences. setPointerCapture still delivers move/up
events when the pointer leaves the handle bounds.
Salvaged from the retired feat/phase-2-auth-gate branch (orig d91cc429); the
setPointerCapture work it built on is already on main.
- User.sessionVersion + jwt-callback revalidation rejects deleted-user,
cross-database, and stale-version tokens (fixes cross-worktree stay-logged-in)
- POST /api/auth/revoke ("sign out everywhere") bumps sessionVersion
- proxy: deny-by-default /api with public allowlist + CORS preflight passthrough;
anchored static-asset allowlist closes the path.includes(".") bypass
- harden session cookie options (httpOnly/sameSite/secure) and cut maxAge to 7 days
- unify https/secure-context detection in isHttpsDeployment() so the cookie
writer (auth) and edge reader (proxy) never disagree on the __Secure- prefix
- augment next-auth User/Session/JWT types
Verified: 1009/1009 tests, build exit 0, live HTTP reproduction of all gates.
A 'pnpm install --lockfile-only' re-resolved local-plugins/wwv-plugin-nz-traffic-cameras
back to the vulnerable [email protected] (GHSA-5xrq-8626-4rwp), undoing #219's pin and
failing the Dependency Audit. Pin it durably via a pnpm override so any future
regen stays clean (closes the recurrence behind #97).
Verified: [email protected] gone from lockfile, frozen-lockfile exit 0,
pnpm audit --audit-level high exit 0 (7 moderate, 0 high/critical).
The main merge resolved package.json with --ours, dropping the two
workspace deps that main's #220 (per-plugin bundling) added. Restore them
and regenerate the lockfile so 'pnpm install --frozen-lockfile' (CI) passes.
Verified: frozen-lockfile install exits 0.
The quickstart was cloud-only: it told self-hosters MCP is a 'cloud-edition
feature', pointed them at worldmonitor.app, and used the cloud endpoint -
actively wrong for the local edition that actually ships MCP today.
- lead with the local self-host flow: pnpm install/setup/dev(:all) -> sign in
at localhost:3000 -> generate key -> paste localhost:3000/api/mcp -> open tab
- document pnpm dev vs pnpm dev:all (Redis + engine needed for command tools,
geocoding, and live data); clarify which tools need which
- add update_favorite + fly_to to the tier tables; localhost-ize troubleshooting
- preserve cloud guidance under 'Cloud edition (coming soon)' for the future
hosted launch (not deleted)
The migration history only contained 20260509061229_init (6 tables), but
schema.prisma declares UserApiKey (user_api_keys) and MarketplaceCredential
(marketplace_credentials). Those tables existed only via the dev-only
'prisma db push' hook, so a fresh production 'prisma migrate deploy' built a
DB missing user_api_keys -> all MCP API-key auth threw 'relation does not
exist' (DOA in production).
- add 20260510000000_add_marketplace_credentials_and_api_keys (slots between
init and add_favorite_notes); columns/constraints/indexes/FK mirror schema
- track the previously-untracked 20260531214034_add_favorite_notes migration
Verified: 'migrate deploy' on a fresh DB yields all 8 tables, zero drift
(prisma migrate diff: No difference detected). Dev DB baselined via
'migrate resolve --applied'; prisma validate + generate + tsc clean.
Phase 35 of v1.5 MCP Public-Launch Hardening (DEPLOY-01..04):
- DEPLOY-01: production and cloud compose now provision a co-located Redis
(password-protected via REDIS_PASSWORD, internal-only) and wire REDIS_URL,
so sessions, command queue, geocode cache, and rate limiters work in prod.
- DEPLOY-02: set WWV_DATA_ENGINE_URL to the engine REST base (not the
NEXT_PUBLIC_.../stream WS URL) so MCP data tools reach /manifest.
- DEPLOY-03: a single global 1 req/s Nominatim throttle (peek/commit sliding
window with a queued-waiter cap and an in-process fallback) protects the
shared geocoder; the 24h cache is checked before the throttle.
- DEPLOY-04: deploy/INFRA-CHECKLIST.md documents the operator actions
(managed Redis rediss://, WWV_DATA_ENGINE_URL, distinct API_KEY_HMAC_SECRET,
AUTH_SECRET, WWV_TRUSTED_IP_HEADER for multi-proxy, health semantics).
Security hardening from review: require AUTH_SECRET (no weak committed
fallback), password the co-located Redis, bind cloud Postgres to loopback,
de-duplicate the geocode result normaliser. Patch.
Phase 34 of v1.5 MCP Public-Launch Hardening (OBS-01):
- /api/health now probes Redis (ping), the database (SELECT 1), the data
engine (manifest reachable), and HMAC config in parallel with 2s timeouts,
returning {status, checks, edition, timestamp}.
- HTTP 503 when the DB is down or the HMAC secret is misconfigured
(cloud/demo); HTTP 200 'degraded' when Redis or the engine is down so a
serving-but-degraded container is not killed.
- Extract isSigningKeyValid() (src/lib/signingKeyConfig.ts) as the single
source of truth for the SEC-01 rule, reused by getSigningKey and the health
config probe (closes the Phase 32 deferred 'surface misconfig at deploy').
- Add ping() to the RedisClient interface; reuse getEngineUrl() so the probe
and data layer resolve the same engine URL.
Patch: turns the always-healthy stub into real dependency observability.
Phase 33 of v1.5 MCP Public-Launch Hardening (TOOL-01..05):
- TOOL-01: data-query tools never report no_session_active; they return
the true reason (no_data_matches / engine_unreachable / no_active_plugins).
Verified live: an empty region query with no browser session now returns
no_data_matches.
- TOOL-02: toggle_layer / set_filter validate the id against the live plugin
set and warn instead of returning success for an unrecognized id;
focus_entity resolves entityId+pluginId to coordinates server-side and
returns an honest error when it cannot.
- TOOL-03: get_entities_in_region returns count + truncated + totalMatched and
tightens radiusKmToBbox (cos(lat), clamped to a full-globe span).
- TOOL-04: investigate_area and get_plugin_data cap output (200) with a
truncated flag so a single response cannot blow client context.
- TOOL-05: MCP_SERVER_INSTRUCTIONS match the real response shapes;
list_available_plugins distinguishes engine_unreachable from
no_active_plugins and surfaces local sources distinctly.
Patch: corrects misleading tool behavior, no API removal.
Phase 32 of v1.5 MCP Public-Launch Hardening (SEC-01..04):
- SEC-01: require a dedicated API_KEY_HMAC_SECRET in cloud/demo editions;
getSigningKey fails closed if it is unset or equal to AUTH_SECRET.
Local dev keeps the AUTH_SECRET fallback.
- SEC-02: Redis-backed per-key sliding-window rate limit (120/60s) applied
after auth, returns JSON-RPC -32000 / HTTP 429, fails open on Redis outage
behind the existing per-IP pre-auth gate.
- SEC-03: derive client IP from the trusted-proxy (rightmost X-Forwarded-For)
hop with an optional WWV_TRUSTED_IP_HEADER override, defeating spoofing.
- SEC-04: length + charset bounds on entityId/pluginId/layerId/name/notes
(shared identifierSchemas) and in isValidGlobeCommand; favorites capped at
500 per user.
Consolidates id schemas, extracts MCP response helpers, accurate Retry-After,
unique sliding-window members. Minor semver bump: adds new guardrails.
Phase 31 of v1.5 MCP Public-Launch Hardening (TRANS-01..04):
- Wrap the MCP route handler in a top-level try/catch returning a
well-formed JSON-RPC -32603 (id:null, 500) instead of bare HTTP 500s
when auth/Redis/transport throws.
- authenticateApiKey now returns null (clean 401) on a DB outage instead
of rejecting; logs only the error class name (no connection strings).
- Add explicit maxDuration=30 on the MCP route, above the 10s relay blpop.
- Stop advertising tools.listChanged (stateless server cannot push);
document the re-call tools/list contract in server instructions.
Sanitize the catch-all log so a Redis/Prisma error message cannot leak
credentials to server logs. Patch: behavior-hardening, no API change.
The toggle_layer MCP command only flipped the Zustand UI switch via the
command bridge and never started the plugin data lifecycle, so an
agent-enabled layer showed as toggled but rendered no data.
Extract the shared setLayerActive() helper (src/core/plugins/layerActivation.ts)
that drives pluginManager.enablePlugin/disablePlugin plus store state, and
route both the UI click (LayerPanel) and the agent command bridge
(useGlobeCommandBridge) through it so agent toggles trigger the identical
data fetch/stream path. Verified live: an MCP toggle_layer(camera) loads
2,376 camera entities with no browser interaction.
Patch: behavior fix, no API change.
- service.ts: getEngineUrl() now reads WWV_DATA_ENGINE_URL (server-side HTTP URL)
instead of NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL (a wss:// WebSocket URL).
Fallback changed from localhost:5000 to localhost:5001 (data engine dev port).
This unblocks all MCP data-query tools from reaching the data engine locally.
- tools.ts: get_entity_details empty path no longer calls toolError(JSON.stringify(...))
which double-encoded emptyReason inside an error string. Now returns the standard
success envelope { success: true, data: null, emptyReason } matching search_entities
and get_entities_in_region contracts (Phase 28 emptyReason discrimination).
- Register update_favorite(favoriteId, {name?, notes?}) tool keyed on (userId, entityId)
- Partial updates: name-only changes label, notes-only changes notes, both changes both
- Neither field supplied returns 'nothing to update' without DB write
- P2025 not-found returns 'update_favorite: favorite not found'
- list_favorites description updated to document notes field in output shape
- userId scoped via ctx only (SAFE-02 pattern, T-28-06 mitigated)
- Add notes String? field to Favorite model in prisma/schema.prisma
- Applied to live DB via prisma db push (schema drift from prior db push workflow)
- Regenerated Prisma client (v7.8.0)
- Cover plugin_not_streaming when snapshot null
- Cover no_data_matches when streaming but zero matches
- Cover no_session_active session-first precedence overriding plugin reason
- Cover non-empty result has no emptyReason key in envelope
- Add EmptyReason union type and QueryResult/SingleResult generics to types.ts
- Refactor searchEntities/getEntitiesInRegion to return QueryResult with plugin_not_streaming vs no_data_matches
- Refactor getEntityDetails/getPluginData to return SingleResult discriminating null causes
- Add registerDataQueryTools(server, { userId }) signature; thread resolveActiveSessionId for no_session_active precedence
- Pass emptyReason through all four MCP tool response envelopes (only on empty results)
- Wire registerDataQueryTools with userId in route.ts registration seam
- Update all callers (REST routes, favoritesTools) and fix existing tests for new return shapes
- geocode_location/fly_to/save_favorite/list_favorites/remove_favorite/set_filter/clear_filter/get_plugin_filters now document inputs, output shape, and a usage example
- bump 2.46.1 -> 2.46.2
- Drop trailing export { readSessionCatalog } from catalog/route.ts (Next.js App Router rejects non-route-handler exports -> TS2344 in generated route types)
- Trim now-unused readSessionCatalog import (only existed to support the re-export)
- All consumers already import readSessionCatalog from @/lib/mcpSessionCatalog
- Bump 2.45.0 -> 2.45.1
- collectCatalog gathers getFilterDefinitions() from each loaded plugin (D-05)
- filter-only plugins now publish (early-return guards on tools AND filterDefinitions empty)
- catalog route validates and forwards optional filterDefinitions, identity still from auth only
- gives get_plugin_filters a data source
- searchEntities applies filters on full GeoEntity.properties via matchFilterValue before SearchResult conversion (D-07/D-08)
- limit counts only matching entities; missing property key fails filter
- search_entities MCP tool exposes optional filters inputSchema via filterValueSchema
- SearchOptions type gains optional filters field
- 4 new filters tests GREEN, no regression