Preserve embedded slots in Electron and TUI

This commit is contained in:
Meta Vens 2026-07-09 12:45:49 +01:00
commit eeedb00905
15 changed files with 159 additions and 26 deletions

View file

@ -602,17 +602,17 @@ Recently cut:
the `eveunity-scene-v{version}` tag/artifact pattern.
`scripts/run-eveunity-scene-release-contract-smoke.ps1` proves the request
without pretending the tagged UPM package has been published.
- EveTui capture lifecycle now carries a structured pending capture request
contract for terminal artifacts. `captureContract` names the TUI runtime,
transcript/cell-grid capture kind, ANSI transcript or JSON grid artifact kind,
conformance attachment point, required Aetheria provider surface, request
schema, request builder, advertisement input, and authority rule.
- EveTui capture lifecycle now carries a structured terminal cell-grid capture
contract and typed artifact. `captureContract` names the TUI runtime,
`terminal-cell-grid` capture kind, `json-grid` artifact kind, conformance
attachment point, required Aetheria provider surface, request schema, request
builder, advertisement input, and authority rule.
`tools/evetui/evetui-capture-contract.mjs` builds a
`gamecult.eve.runtime_capture_request.v1` request from the runtime capability
manifest and provider advertisement, and
`scripts/run-evetui-capture-contract-smoke.ps1` proves that request path
without pretending a durable terminal transcript has been captured. The
actual transcript or cell-grid artifact remains a split blocker for EveTui.
`tools/evetui/evetui-capture-artifact.mjs` writes
`gamecult.eve.tui_grid.v1` evidence. The remaining blocker is owner-repo
production of the same capture path, not absence of a cell-grid artifact.
- Runtime-owner conformance consumption now asserts EveUnity lifecycle stage
evidence directly. The generic consumer supports
`--expect-runtime-lifecycle-status` and

View file

@ -321,12 +321,13 @@ Electron source paths named by the handoff currently exist as
`observed-provider` sources, so the extraction pressure is visible without
turning those paths into EveElectron authority. The Electron runtime now claims
a narrow provider-advertised surface-tree command surface and exposes a typed
capture request contract, while packaged rendering, embedded document
rendering, actual window capture, and plugin projection remain blockers.
capture request contract. It preserves embedded document slot identity in the
generic shell projection, while packaged rendering, actual window capture, and
plugin projection remain blockers.
EveTui is also intentionally pending: it now claims a lossy
provider-advertised terminal-grid command surface and exposes a typed terminal
capture request contract, while actual transcript/cell-grid capture, embedded
document rendering, plugin projection, and repo graduation remain blockers.
provider-advertised terminal-grid command surface, preserves embedded document
slot identity in the grid artifact, and attaches a typed JSON grid capture.
Plugin projection and repo graduation remain blockers.
EveUnity includes both the active `unity-uitoolkit` package proof
and the pending `unity-scene` runtime boundary; UI Toolkit support is not
treated as full Unity scene/world lowering. The `unity-scene` runtime now claims

View file

@ -16,7 +16,8 @@
"supportedFeatures": [
"providerAdvertisements",
"commandTransport",
"surfaceTreeProjection"
"surfaceTreeProjection",
"embeddedDocuments"
],
"supportedPlugins": [],
"unsupportedPlugins": [

View file

@ -115,6 +115,7 @@ export function normalizeSurfaceDocument(surfaceDocument) {
function buildShellNode(component) {
const source = objectValue(component);
const children = Array.isArray(source.children) ? source.children.map(buildShellNode) : [];
const embeddedDocuments = normalizeEmbeddedDocuments(source.embeddedDocuments);
return {
id: firstString(source.id),
componentKind: firstString(source.kind),
@ -123,11 +124,26 @@ function buildShellNode(component) {
layout: objectValue(source.layout),
style: objectValue(source.style),
stateBindingCount: Array.isArray(source.stateBindings) ? source.stateBindings.length : 0,
embeddedDocumentCount: Array.isArray(source.embeddedDocuments) ? source.embeddedDocuments.length : 0,
embeddedDocumentCount: embeddedDocuments.length,
embeddedDocuments,
children,
};
}
function normalizeEmbeddedDocuments(value) {
return Array.isArray(value)
? value
.filter(document => document && typeof document === "object")
.map(document => ({
slotId: firstString(document.slotId, document.id),
documentId: firstString(document.documentId, document.href, document.url),
schemaId: firstString(document.schemaId, document.schema),
presentationKind: firstString(document.presentationKind, document.kind),
}))
.filter(document => document.slotId || document.documentId)
: [];
}
function shellElementKind(componentKind) {
if (!componentKind) return "empty";
if (componentKind.startsWith("control.")) return "command-control";

View file

@ -66,6 +66,14 @@ test("lowers provider surface trees into an Electron shell projection", () => {
assert.equal(projection.root.children[1].props.command, "aetheria.daemon.commands");
assert.equal(projection.root.children[2].shellElementKind, "plugin-placeholder");
assert.equal(projection.root.children[2].embeddedDocumentCount, 1);
assert.deepEqual(projection.root.children[2].embeddedDocuments, [
{
slotId: "norn.map",
documentId: "cultmesh://aetheria/norn/map",
schemaId: "gamecult.eve.surface.v1",
presentationKind: "electron-overlay",
},
]);
});
test("rejects surface documents that do not match the advertised target", () => {

View file

@ -17,7 +17,8 @@
"providerAdvertisements",
"commandTransport",
"terminalGridSummary",
"terminalGridLowering"
"terminalGridLowering",
"embeddedDocuments"
],
"supportedPlugins": [],
"unsupportedPlugins": [

View file

@ -81,6 +81,7 @@ export class EveTuiShell {
ownership: selected.worldInteraction.ownership,
width: this.width,
lines,
embeddedDocumentSlots: collectEmbeddedDocumentSlots(document.root),
lossiness: "terminal-grid-command-surface; summarizes provider-authored world surface without owning provider state",
};
}
@ -155,12 +156,40 @@ function buildComponentLines(component, width, depth = 0) {
const indent = " ".repeat(Math.min(depth, 6));
const ownLine = fitLine(`${indent}${terminalElementKind(kind)} ${id}${label ? ` ${label}` : ""}`, width);
const children = Array.isArray(source.children) ? source.children : [];
const embeddedDocuments = normalizeEmbeddedDocuments(source.embeddedDocuments);
return [
ownLine,
...embeddedDocuments.map(document => fitLine(`${indent} slot ${document.slotId || "(slot)"} ${document.documentId || "(document)"}`, width)),
...children.flatMap(child => buildComponentLines(child, width, depth + 1)),
];
}
function collectEmbeddedDocumentSlots(component, slots = []) {
const source = objectValue(component);
const ownerId = firstString(source.id);
for (const document of normalizeEmbeddedDocuments(source.embeddedDocuments)) {
slots.push({ ownerId, ...document });
}
for (const child of Array.isArray(source.children) ? source.children : []) {
collectEmbeddedDocumentSlots(child, slots);
}
return slots;
}
function normalizeEmbeddedDocuments(value) {
return Array.isArray(value)
? value
.filter(document => document && typeof document === "object")
.map(document => ({
slotId: firstString(document.slotId, document.id),
documentId: firstString(document.documentId, document.href, document.url),
schemaId: firstString(document.schemaId, document.schema),
presentationKind: firstString(document.presentationKind, document.kind),
}))
.filter(document => document.slotId || document.documentId)
: [];
}
function terminalElementKind(componentKind) {
if (!componentKind) return "empty";
if (componentKind.startsWith("control.")) return "command";

View file

@ -75,6 +75,16 @@ test("lowers provider surface trees into a terminal grid", () => {
assert.ok(grid.lines.some(line => line.includes("world aetheria.daemon.game.gravity")));
assert.ok(grid.lines.some(line => line.includes("command aetheria.daemon.game.focus")));
assert.ok(grid.lines.some(line => line.includes("plugin aetheria.daemon.game.norn")));
assert.ok(grid.lines.some(line => line.includes("slot norn.map")));
assert.deepEqual(grid.embeddedDocumentSlots, [
{
ownerId: "aetheria.daemon.game.norn",
slotId: "norn.map",
documentId: "cultmesh://aetheria/norn/map",
schemaId: "gamecult.eve.surface.v1",
presentationKind: "terminal-grid-slot",
},
]);
});
test("rejects surface documents that do not match the advertised TUI target", () => {
@ -159,6 +169,14 @@ function surfaceDocument(surfaceId = "aetheria.daemon.game") {
props: {
label: "Norn tactical map",
},
embeddedDocuments: [
{
slotId: "norn.map",
documentId: "cultmesh://aetheria/norn/map",
schemaId: "gamecult.eve.surface.v1",
presentationKind: "terminal-grid-slot",
},
],
children: [],
},
],

View file

@ -82,6 +82,33 @@
"embeddedDocumentCount": {
"type": "number"
},
"embeddedDocuments": {
"type": "array",
"items": {
"type": "object",
"required": [
"slotId",
"documentId"
],
"properties": {
"slotId": {
"type": "string",
"minLength": 1
},
"documentId": {
"type": "string",
"minLength": 1
},
"schemaId": {
"type": "string"
},
"presentationKind": {
"type": "string"
}
},
"additionalProperties": true
}
},
"children": {
"type": "array"
}

View file

@ -49,6 +49,38 @@
"type": "string"
}
},
"embeddedDocumentSlots": {
"type": "array",
"items": {
"type": "object",
"required": [
"ownerId",
"slotId",
"documentId"
],
"properties": {
"ownerId": {
"type": "string",
"minLength": 1
},
"slotId": {
"type": "string",
"minLength": 1
},
"documentId": {
"type": "string",
"minLength": 1
},
"schemaId": {
"type": "string"
},
"presentationKind": {
"type": "string"
}
},
"additionalProperties": true
}
},
"lossiness": {
"type": "string",
"minLength": 1

View file

@ -39,7 +39,7 @@ if (-not $manifest.incubation.splitHandoff.manifestPath) {
throw "EveElectron manifest missing split handoff path"
}
foreach ($feature in @("providerAdvertisements", "commandTransport", "surfaceTreeProjection")) {
foreach ($feature in @("providerAdvertisements", "commandTransport", "surfaceTreeProjection", "embeddedDocuments")) {
if (-not (@($manifest.supportedFeatures) -contains $feature)) {
throw "EveElectron manifest missing provider-shell feature: $feature"
}

View file

@ -36,7 +36,7 @@ if ($manifest.incubation.splitTarget -ne "EveTui") {
throw "Unexpected EveTui split target: $($manifest.incubation.splitTarget)"
}
foreach ($feature in @("providerAdvertisements", "commandTransport", "terminalGridSummary", "terminalGridLowering")) {
foreach ($feature in @("providerAdvertisements", "commandTransport", "terminalGridSummary", "terminalGridLowering", "embeddedDocuments")) {
if (-not (@($manifest.supportedFeatures) -contains $feature)) {
throw "EveTui manifest missing provider-shell feature: $feature"
}

View file

@ -66,10 +66,12 @@ node $consumerScript $consumerExport `
--expect-runtime-feature electron-shell:providerAdvertisements `
--expect-runtime-feature electron-shell:commandTransport `
--expect-runtime-feature electron-shell:surfaceTreeProjection `
--expect-runtime-feature electron-shell:embeddedDocuments `
--expect-runtime-feature tui:providerAdvertisements `
--expect-runtime-feature tui:commandTransport `
--expect-runtime-feature tui:terminalGridSummary `
--expect-runtime-feature tui:terminalGridLowering `
--expect-runtime-feature tui:embeddedDocuments `
--expect-runtime-feature direct2d:embeddedDocuments `
--expect-runtime-world-target web:web-reference `
--expect-runtime-world-field web:web-reference:supportLevel:reference-dom-canvas-command-boundary `

View file

@ -61,7 +61,6 @@ try {
--expect-split-target-proof "EveElectron:EveElectron lifecycle contract is machine-readable" `
--expect-split-target-blocker "EveElectron:runtime:electron-shell:status:pending" `
--expect-split-target-blocker-record EveElectron:runtime-status:electron-shell `
--expect-split-target-blocker-record EveElectron:runtime-feature:electron-shell:embeddedDocuments `
--expect-split-handoff-move EveElectron:electron-shell:electron-shell-runtime:current:exists:eve-electron-shell.mjs `
--expect-split-handoff-move EveElectron:electron-shell:electron-command-transport:current:exists:eve-electron-shell.mjs `
--expect-split-handoff-move EveElectron:electron-shell:electron-world-surface-lowering:current:exists:eve-electron-shell.mjs `
@ -75,7 +74,6 @@ try {
--expect-split-target-proof "EveTui:EveTui split handoff is machine-readable" `
--expect-split-target-proof "EveTui:EveTui lifecycle contract is machine-readable" `
--expect-split-target-blocker "EveTui:runtime:tui:status:pending" `
--expect-split-target-blocker-record EveTui:runtime-feature:tui:embeddedDocuments `
--expect-split-handoff-move EveTui:tui:tui-runtime-body:current:exists:eve-tui-shell.mjs `
--expect-split-handoff-move EveTui:tui:tui-world-surface-lowering:current:exists:eve-tui-shell.mjs `
--expect-split-handoff-move EveTui:tui:tui-command-transport:current:exists:eve-tui-shell.mjs `

View file

@ -736,7 +736,7 @@
"splitHandoffPath": "runtimes/incubating/eve-electron/eveelectron-split-handoff.json",
"requiredFixtures": ["embedded-surface", "aetheria-world"],
"pluginFixtures": [],
"supportedFeatures": ["providerAdvertisements", "commandTransport", "surfaceTreeProjection"],
"supportedFeatures": ["providerAdvertisements", "commandTransport", "surfaceTreeProjection", "embeddedDocuments"],
"supportedPlugins": [],
"unsupportedPlugins": [
{
@ -784,11 +784,11 @@
"expectedSourceSymbols": [
{
"path": "runtimes/incubating/eve-electron/src/eve-electron-shell.mjs",
"contains": ["EveElectronShell", "selectSurface", "lowerSurface", "createCommandIntent", "normalizeSurfaceDocument", "buildShellNode", "shellElementKind", "worldInteraction", "commandBoundary", "receiptSchema", "electron-shell"]
"contains": ["EveElectronShell", "selectSurface", "lowerSurface", "createCommandIntent", "normalizeSurfaceDocument", "buildShellNode", "normalizeEmbeddedDocuments", "embeddedDocuments", "shellElementKind", "worldInteraction", "commandBoundary", "receiptSchema", "electron-shell"]
},
{
"path": "runtimes/incubating/eve-electron/test/eve-electron-shell.test.mjs",
"contains": ["selects the active advertised provider surface", "lowers provider surface trees into an Electron shell projection", "rejects surface documents that do not match the advertised target", "command intents carry provider-advertised boundaries", "aetheria.daemon.commands", "aetheria.eve_command_acceptance_status.v1"]
"contains": ["selects the active advertised provider surface", "lowers provider surface trees into an Electron shell projection", "embeddedDocuments", "norn.map", "rejects surface documents that do not match the advertised target", "command intents carry provider-advertised boundaries", "aetheria.daemon.commands", "aetheria.eve_command_acceptance_status.v1"]
},
{
"path": "tools/eveelectron/eveelectron-capture-contract.mjs",
@ -827,7 +827,7 @@
"splitHandoffPath": "runtimes/incubating/eve-tui/evetui-split-handoff.json",
"requiredFixtures": ["embedded-surface", "aetheria-world"],
"pluginFixtures": [],
"supportedFeatures": ["providerAdvertisements", "commandTransport", "terminalGridSummary", "terminalGridLowering"],
"supportedFeatures": ["providerAdvertisements", "commandTransport", "terminalGridSummary", "terminalGridLowering", "embeddedDocuments"],
"supportedPlugins": [],
"unsupportedPlugins": [
{
@ -880,11 +880,11 @@
"expectedSourceSymbols": [
{
"path": "runtimes/incubating/eve-tui/src/eve-tui-shell.mjs",
"contains": ["EveTuiShell", "selectSurface", "lowerSurface", "normalizeSurfaceDocument", "buildComponentLines", "terminalElementKind", "createCommandIntent", "renderSummary", "gamecult.eve.tui_grid.v1", "commandBoundary", "receiptSchema"]
"contains": ["EveTuiShell", "selectSurface", "lowerSurface", "normalizeSurfaceDocument", "buildComponentLines", "collectEmbeddedDocumentSlots", "normalizeEmbeddedDocuments", "embeddedDocumentSlots", "terminalElementKind", "createCommandIntent", "renderSummary", "gamecult.eve.tui_grid.v1", "commandBoundary", "receiptSchema"]
},
{
"path": "runtimes/incubating/eve-tui/test/eve-tui-shell.test.mjs",
"contains": ["selects advertised provider surfaces", "command intents carry provider-advertised boundaries", "summary grid is explicitly lossy", "lowers provider surface trees into a terminal grid", "rejects surface documents that do not match the advertised TUI target", "aetheria.daemon.commands"]
"contains": ["selects advertised provider surfaces", "command intents carry provider-advertised boundaries", "summary grid is explicitly lossy", "lowers provider surface trees into a terminal grid", "embeddedDocumentSlots", "norn.map", "rejects surface documents that do not match the advertised TUI target", "aetheria.daemon.commands"]
},
{
"path": "tools/evetui/evetui-capture-contract.mjs",