From 707112ae705073e86f593b4261ce89f0986ec63a Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Thu, 9 Jul 2026 10:28:22 +0100 Subject: [PATCH] Use active web surface command boundaries --- docs/eve-migration-roadmap.md | 5 +++ packages/eve-browser-lowering/dist/index.d.ts | 1 + packages/eve-browser-lowering/dist/index.js | 2 +- packages/eve-browser-lowering/package.json | 3 +- packages/eve-browser-lowering/src/index.ts | 3 +- .../test/browser-lowering.test.mjs | 39 +++++++++++++++++++ tools/parity/parity-manifest.json | 14 +++++-- web/eve-runtime-capability.json | 3 +- web/surface.js | 1 + 9 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 packages/eve-browser-lowering/test/browser-lowering.test.mjs diff --git a/docs/eve-migration-roadmap.md b/docs/eve-migration-roadmap.md index 7953818..908e03f 100644 --- a/docs/eve-migration-roadmap.md +++ b/docs/eve-migration-roadmap.md @@ -321,6 +321,11 @@ Recently cut: `worldInteraction.receiptSchema` into each `gamecult.eve.command.v1` intent. It can use component action metadata as a fallback, but the provider advertisement is the authority when present. +- The browser lowerer command intent path now passes the active surface id + explicitly and tests that a provider with multiple world surfaces uses the + active surface advertisement instead of the provider's first advertised + surface. This keeps Aetheria game/editor command boundaries from collapsing + inside the generic web reference. - The conformance export carries `splitHandoffMoveCoverage[]`, joining runtime split handoff move sets to source path status. EveElectron now exposes the existing Aetheria `Aetheria.Rts.Web/Electron` and command transport paths as diff --git a/packages/eve-browser-lowering/dist/index.d.ts b/packages/eve-browser-lowering/dist/index.d.ts index a756418..046831e 100644 --- a/packages/eve-browser-lowering/dist/index.d.ts +++ b/packages/eve-browser-lowering/dist/index.d.ts @@ -61,6 +61,7 @@ export interface EveProviderAdvertisement { }; } export interface EveBrowserLoweringOptions { + activeSurfaceId?: string; assetBaseUrl?: string; assetUrlResolver?: (uri: string, surface: EveSurfaceDocument | undefined) => string; body?: HTMLElement; diff --git a/packages/eve-browser-lowering/dist/index.js b/packages/eve-browser-lowering/dist/index.js index ff3612a..c1a9573 100644 --- a/packages/eve-browser-lowering/dist/index.js +++ b/packages/eve-browser-lowering/dist/index.js @@ -1841,7 +1841,7 @@ export function applyEveSurfaceStyles(styles, body = document.body) { export function createEveCommandIntent(commandId, props = {}, options = currentOptions) { const action = objectProps(props.action); const providerId = options.provider?.providerId || currentSurfaceDocument?.providerId || "surface unknown"; - const surfaceId = options.provider?.surfaces?.[0]?.surfaceId || currentSurfaceDocument?.surface?.id || providerId; + const surfaceId = options.activeSurfaceId || currentSurfaceDocument?.surface?.id || options.provider?.surfaces?.[0]?.surfaceId || providerId; const worldInteraction = resolveAdvertisedWorldInteraction(options, surfaceId); const commandBoundary = firstString(worldInteraction.commandBoundary, props.commandBoundary, action.commandBoundary, action.target); const receiptSchema = firstString(worldInteraction.receiptSchema, props.receiptSchema, action.receiptSchema); diff --git a/packages/eve-browser-lowering/package.json b/packages/eve-browser-lowering/package.json index 328dceb..e56ce93 100644 --- a/packages/eve-browser-lowering/package.json +++ b/packages/eve-browser-lowering/package.json @@ -9,7 +9,8 @@ "styles.css" ], "scripts": { - "build": "C:\\Progra~1\\nodejs\\node.exe ./node_modules/typescript/bin/tsc -p tsconfig.json" + "build": "C:\\Progra~1\\nodejs\\node.exe ./node_modules/typescript/bin/tsc -p tsconfig.json", + "test": "C:\\Progra~1\\nodejs\\node.exe --test test/*.test.mjs" }, "devDependencies": { "typescript": "^5.6.3" diff --git a/packages/eve-browser-lowering/src/index.ts b/packages/eve-browser-lowering/src/index.ts index 610db99..25c1aa2 100644 --- a/packages/eve-browser-lowering/src/index.ts +++ b/packages/eve-browser-lowering/src/index.ts @@ -63,6 +63,7 @@ export interface EveProviderAdvertisement { } export interface EveBrowserLoweringOptions { + activeSurfaceId?: string; assetBaseUrl?: string; assetUrlResolver?: (uri: string, surface: EveSurfaceDocument | undefined) => string; body?: HTMLElement; @@ -2193,7 +2194,7 @@ export function createEveCommandIntent( ): EveCommandIntent { const action = objectProps(props.action); const providerId = options.provider?.providerId || currentSurfaceDocument?.providerId || "surface unknown"; - const surfaceId = options.provider?.surfaces?.[0]?.surfaceId || currentSurfaceDocument?.surface?.id || providerId; + const surfaceId = options.activeSurfaceId || currentSurfaceDocument?.surface?.id || options.provider?.surfaces?.[0]?.surfaceId || providerId; const worldInteraction = resolveAdvertisedWorldInteraction(options, surfaceId); const commandBoundary = firstString(worldInteraction.commandBoundary, props.commandBoundary, action.commandBoundary, action.target); const receiptSchema = firstString(worldInteraction.receiptSchema, props.receiptSchema, action.receiptSchema); diff --git a/packages/eve-browser-lowering/test/browser-lowering.test.mjs b/packages/eve-browser-lowering/test/browser-lowering.test.mjs new file mode 100644 index 0000000..668787f --- /dev/null +++ b/packages/eve-browser-lowering/test/browser-lowering.test.mjs @@ -0,0 +1,39 @@ +import assert from "node:assert/strict"; +import test from "node:test"; +import { createEveCommandIntent } from "../dist/index.js"; + +test("command intents use the active surface advertisement boundary", () => { + const intent = createEveCommandIntent("aetheria.daemon.editor.inspect", { + action: { + commandBoundary: "component.fallback.boundary", + receiptSchema: "component.fallback.receipt.v1", + target: "component.fallback.target", + }, + }, { + activeSurfaceId: "aetheria.daemon.editor", + clientId: "browser.reference", + provider: { + providerId: "aetheria", + surfaces: [ + { + surfaceId: "aetheria.daemon.game", + worldInteraction: { + commandBoundary: "aetheria.daemon.game.commands", + receiptSchema: "aetheria.game_receipt.v1", + }, + }, + { + surfaceId: "aetheria.daemon.editor", + worldInteraction: { + commandBoundary: "aetheria.daemon.editor.commands", + receiptSchema: "aetheria.editor_receipt.v1", + }, + }, + ], + }, + }); + + assert.equal(intent.surfaceId, "aetheria.daemon.editor"); + assert.equal(intent.commandBoundary, "aetheria.daemon.editor.commands"); + assert.equal(intent.receiptSchema, "aetheria.editor_receipt.v1"); +}); diff --git a/tools/parity/parity-manifest.json b/tools/parity/parity-manifest.json index 6e4c7f4..0423aa1 100644 --- a/tools/parity/parity-manifest.json +++ b/tools/parity/parity-manifest.json @@ -871,20 +871,24 @@ }, { "path": "packages/eve-browser-lowering/src/index.ts", - "contains": ["surface.slot", "embeddedDocuments", "cultui-embedded-slot", "createEveCommandIntent", "resolveComponentCommandId", "localAdvertisement"] + "contains": ["surface.slot", "embeddedDocuments", "cultui-embedded-slot", "createEveCommandIntent", "resolveComponentCommandId", "localAdvertisement", "activeSurfaceId"] } ], "commandTransportSmoke": { "schema": "gamecult.eve.command.v1", - "expectedPaths": ["packages/eve-browser-lowering/src/index.ts", "web/surface.js"], + "expectedPaths": ["packages/eve-browser-lowering/src/index.ts", "packages/eve-browser-lowering/test/browser-lowering.test.mjs", "web/surface.js"], "expectedSourceSymbols": [ { "path": "packages/eve-browser-lowering/src/index.ts", - "contains": ["EveCommandIntent", "createEveCommandIntent", "schema: \"gamecult.eve.command.v1\"", "clientId", "commandBoundary", "receiptSchema"] + "contains": ["EveCommandIntent", "createEveCommandIntent", "schema: \"gamecult.eve.command.v1\"", "clientId", "commandBoundary", "receiptSchema", "activeSurfaceId"] + }, + { + "path": "packages/eve-browser-lowering/test/browser-lowering.test.mjs", + "contains": ["activeSurfaceId", "aetheria.daemon.editor", "aetheria.daemon.editor.commands", "component.fallback.boundary"] }, { "path": "web/surface.js", - "contains": ["publishCommandIntent", "/hermodr/commands/eve", "createEveCommandIntent", "browser.reference"] + "contains": ["publishCommandIntent", "/hermodr/commands/eve", "createEveCommandIntent", "browser.reference", "activeSurfaceId"] } ] }, @@ -904,8 +908,10 @@ "test": { "ownerRepo": "Eve", "status": "node-tests-and-parity-harness", + "command": "node --test web/eve-dsl.test.mjs && npm --prefix packages/eve-browser-lowering test && powershell -ExecutionPolicy Bypass -File .\\scripts\\run-parity-harness.ps1", "evidencePaths": [ "web/eve-dsl.test.mjs", + "packages/eve-browser-lowering/test/browser-lowering.test.mjs", "tools/parity/parity-manifest.json", "scripts/run-parity-harness.ps1" ], diff --git a/web/eve-runtime-capability.json b/web/eve-runtime-capability.json index a650f0e..12fc411 100644 --- a/web/eve-runtime-capability.json +++ b/web/eve-runtime-capability.json @@ -78,9 +78,10 @@ "test": { "ownerRepo": "Eve", "status": "node-tests-and-parity-harness", - "command": "node --test web/eve-dsl.test.mjs && powershell -ExecutionPolicy Bypass -File .\\scripts\\run-parity-harness.ps1", + "command": "node --test web/eve-dsl.test.mjs && npm --prefix packages/eve-browser-lowering test && powershell -ExecutionPolicy Bypass -File .\\scripts\\run-parity-harness.ps1", "evidencePaths": [ "web/eve-dsl.test.mjs", + "packages/eve-browser-lowering/test/browser-lowering.test.mjs", "tools/parity/parity-manifest.json", "scripts/run-parity-harness.ps1" ], diff --git a/web/surface.js b/web/surface.js index fcd2384..62d13ba 100644 --- a/web/surface.js +++ b/web/surface.js @@ -168,6 +168,7 @@ function renderSurface(state, source) { surfaceVersion.textContent = `v${state.version ?? "?"}`; const providerId = state.providerId || currentProvider?.providerId || ""; renderEveSurface(state, app, { + activeSurfaceId: state.surface?.id, body: document.body, clientId: liveHermodr ? "hermodr.browser" : "browser.reference", commandSink: publishCommandIntent,