Use active web surface command boundaries
This commit is contained in:
parent
5d58f3e414
commit
707112ae70
9 changed files with 63 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ export interface EveProviderAdvertisement {
|
|||
};
|
||||
}
|
||||
export interface EveBrowserLoweringOptions {
|
||||
activeSurfaceId?: string;
|
||||
assetBaseUrl?: string;
|
||||
assetUrlResolver?: (uri: string, surface: EveSurfaceDocument | undefined) => string;
|
||||
body?: HTMLElement;
|
||||
|
|
|
|||
2
packages/eve-browser-lowering/dist/index.js
vendored
2
packages/eve-browser-lowering/dist/index.js
vendored
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
39
packages/eve-browser-lowering/test/browser-lowering.test.mjs
Normal file
39
packages/eve-browser-lowering/test/browser-lowering.test.mjs
Normal file
|
|
@ -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");
|
||||
});
|
||||
|
|
@ -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"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
],
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue