* refactor(marketplace): drive auto-seeding from signed verified registry Retires the hard-coded DEFAULT_PLUGIN_IDS list and makes the signed verified registry the single source of truth for what lands in a fresh install. Publishing a plugin to the verified registry now auto-seeds it; no code change required to add new defaults. Also fixes the diagnosed plugins-404: fortiguard and nz-traffic-cameras were in the static list but not published to npm, causing every fresh boot to hit manifest 404s. Those entries are gone with the list. - Delete src/lib/marketplace/defaultPlugins.ts (legacy static list). - Seeder iterates getVerifiedPluginIds() from registryClient. - Skip markSeeded when the verified set is empty so a registry outage doesn't lock fresh installs into zero plugins; the next request retries (5-min cache in registryClient bounds the request rate). - Stamp every seeded plugin as trust=verified by definition. - Tests rewritten against a fake verified set; new test asserts empty-registry deferral. - Sync marketplace-architecture rule + migrate-legacy-plugin skill with the new model. - Patch bump: 2.15.15 -> 2.15.16. * fix(engine): resolve plugin 404s and local engine routing (#fix/diagnose-plugins-404) - fix: engineManifest + resolveEngineUrl: port 5001→5000 to match docker-compose binding; removed NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL from local engine detection — it was poisoning local routing with the production engine URL (Patch) - fix: WsClient: added normalizePluginId() converting underscore IDs to kebab-case so engine WebSocket messages route to the correct frontend plugin (Patch) - fix: docker-compose: added ./local-seeders:/app/seeders volume mount to wwv-data-engine so locally-developed seeders are visible to the engine (Patch) - feat: sync-local-plugins: added wwvHostRedirectPlugin — Vite plugin that intercepts @/ host-app imports in local plugin builds and redirects them to runtime host globals, preventing full app tree from being bundled into plugins (Minor) - docs: plugin-architecture.md: added Plugin Data Delivery Types section (REST-only, WS-only, hybrid), peerDependencies rule, .tsx extension rule, mapWebsocketPayload signature contract (Patch) - docs: data-engine-architecture.md: added §7 WebSocket Payload Format Contract documenting WsClient's three payload handling cases and the silent-drop footgun for plugins that send object payloads without mapWebsocketPayload (Patch) - docs: worldwideview-plugin-creation SKILL.md: fixed ISS example which was missing mapWebsocketPayload and would have silently dropped all WS data; clarified mapWebsocketPayload requirement for non-array payloads; fixed architecture decision tree (Patch) - docs: cesium-rendering.md: added Sizing Conventions table with defaults/ranges for point/billboard/model, cross-plugin parity rules, and silent-ignore footgun warning for size on billboard entities (Patch) - docs: added ADR-0002 documenting seeder exported name as canonical plugin ID (Patch) Version bumps: fix × 3 (Patch), feat × 1 (Minor) → 2.15.16 → 2.16.0 Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * test(engine): update resolveEngineUrl test assertion from port 5001 to 5000 Follows the port correction in engineManifest.ts and resolveEngineUrl.ts. The test was asserting the old default (5001) instead of the corrected local engine port (5000), causing the Unit Tests CI check to fail. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
// src/core/data/resolveEngineUrl.ts
|
|
import { pluginManager } from "@/core/plugins/PluginManager";
|
|
import { localEngineHasPlugin } from "./engineManifest";
|
|
|
|
const CLOUD_ENGINE_URL = "wss://dataenginev2.worldwideview.dev/stream";
|
|
|
|
const RAW_ENGINE_URL = process.env.NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL || CLOUD_ENGINE_URL;
|
|
|
|
/** Normalize a base URL into a valid WebSocket stream URL. */
|
|
function toWsStreamUrl(url: string): string {
|
|
let normalized = url
|
|
.replace(/^https:\/\//, "wss://")
|
|
.replace(/^http:\/\//, "ws://");
|
|
if (!normalized.endsWith("/stream")) {
|
|
normalized = `${normalized.replace(/\/+$/, "")}/stream`;
|
|
}
|
|
return normalized;
|
|
}
|
|
|
|
const DEFAULT_ENGINE_URL = toWsStreamUrl(RAW_ENGINE_URL);
|
|
|
|
function getLocalWsUrl() {
|
|
if (typeof window === "undefined") return "ws://localhost:5000/stream";
|
|
return `${window.location.protocol === "https:" ? "wss:" : "ws:"}//${window.location.hostname}:5000/stream`;
|
|
}
|
|
/**
|
|
* Resolves the WebSocket engine URL for a given plugin.
|
|
*
|
|
* Resolution order:
|
|
* 1. Local engine (if running at localhost:5000 and has this plugin's seeder)
|
|
* 2. Plugin's ServerPluginConfig.streamUrl (code-based plugins)
|
|
* 3. Plugin's PluginManifest.dataSource.streamUrl (manifest-based plugins)
|
|
* 4. NEXT_PUBLIC_WWV_PLUGIN_DATA_ENGINE_URL env var
|
|
* 5. Fallback: wss://dataengine.worldwideview.dev/stream (cloud)
|
|
*/
|
|
export function resolveEngineUrl(pluginId: string): string {
|
|
// 1. Local engine (split-routing) - PRIORITY #1
|
|
if (localEngineHasPlugin(pluginId)) {
|
|
return getLocalWsUrl();
|
|
}
|
|
|
|
// 2. Code-based plugin server config
|
|
const managed = pluginManager.getPlugin(pluginId);
|
|
if (managed) {
|
|
const serverConfig = managed.plugin.getServerConfig?.();
|
|
if (serverConfig?.streamUrl) return serverConfig.streamUrl;
|
|
}
|
|
|
|
// 3. Manifest-based plugin data source config
|
|
const manifest = pluginManager.getManifest(pluginId);
|
|
if (manifest?.dataSource?.streamUrl) return manifest.dataSource.streamUrl;
|
|
|
|
// 4+5. Global default (env var or cloud)
|
|
return DEFAULT_ENGINE_URL;
|
|
}
|