Add EveUnity scene semantic capture artifact
This commit is contained in:
parent
3f7e381ea8
commit
9e60693dd6
13 changed files with 644 additions and 16 deletions
|
|
@ -571,6 +571,15 @@ Recently cut:
|
|||
`scripts/run-eveunity-capture-contract-smoke.ps1` proves that request path
|
||||
without pretending a Unity PNG has been captured. The actual capture artifact
|
||||
remains a split blocker for EveUnity.
|
||||
- Unity scene capture now has the same semantic artifact boundary as Electron
|
||||
without pretending it is a rendered Unity frame. `tools/eveunity/eveunity-scene-capture-artifact.mjs`
|
||||
lowers `web/fixtures/aetheria-world-surface.json` into
|
||||
`gamecult.eve.unity_scene_projection.v1`, writes
|
||||
`artifacts/eveunity-scene-capture/latest/unity-scene-projection.json`, and
|
||||
exports it as `runtime.captureArtifacts[]`. The builder also proves Sai,
|
||||
Norn, and TeX remain sidecar plugin projections when a visual-novel surface
|
||||
is lowered. The remaining EveUnity blocker is an owner-repo Unity screenshot
|
||||
or frame-capture PNG, not absence of semantic scene projection evidence.
|
||||
- EveElectron capture lifecycle now carries the same kind of structured pending
|
||||
capture contract. `captureContract` names the Electron shell runtime, capture
|
||||
kind, PNG artifact pattern, conformance attachment point, required Aetheria
|
||||
|
|
|
|||
|
|
@ -337,8 +337,9 @@ 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
|
||||
a narrow scene graph command surface, preserves embedded document slot identity,
|
||||
and exposes a typed capture request contract, while actual scene capture,
|
||||
release, and plugin projection adapters remain explicit blockers.
|
||||
and exposes a typed capture request contract plus a schema-backed JSON scene
|
||||
projection artifact, while actual scene/frame PNG capture and release remain
|
||||
explicit blockers.
|
||||
|
||||
The Flutter widget smoke also exercises `EveProviderCatalog` and
|
||||
`EveProviderPicker` against a conformance-export-shaped provider list. That is
|
||||
|
|
@ -411,6 +412,14 @@ lowers the Aetheria world surface through `EveElectronShell` into
|
|||
`artifacts/eveelectron-capture/latest/electron-shell-projection.json`. The
|
||||
remaining blocker is packaged Electron window capture.
|
||||
|
||||
Unity scene semantic capture evidence follows the same rule without pretending
|
||||
it is a rendered Unity frame. `tools/eveunity/eveunity-scene-capture-artifact.mjs`
|
||||
lowers the Aetheria world surface into `gamecult.eve.unity_scene_projection.v1`
|
||||
and writes `artifacts/eveunity-scene-capture/latest/unity-scene-projection.json`.
|
||||
It records scene graph projection, embedded slots, and sidecar plugin projection
|
||||
metadata. The remaining blocker is Unity screenshot or frame-capture PNG
|
||||
production from EveUnity.
|
||||
|
||||
EveUnity split handoff evidence:
|
||||
|
||||
```powershell
|
||||
|
|
|
|||
|
|
@ -155,20 +155,35 @@
|
|||
"requiredProvider": "aetheria",
|
||||
"requiredSurface": "aetheria.daemon.game",
|
||||
"authority": "Capture observes Unity scene projection only; provider state, command acceptance, and receipts stay provider-owned.",
|
||||
"publishProof": "Unity scene screenshot or frame-capture artifact is attached to the runtime conformance report from EveUnity."
|
||||
"publishProof": "Unity scene screenshot or frame-capture PNG artifact is attached to the runtime conformance report from EveUnity."
|
||||
},
|
||||
"evidencePaths": [
|
||||
"tools/eveunity/eveunity-capture-contract.mjs",
|
||||
"tools/eveunity/eveunity-capture-contract.test.mjs",
|
||||
"scripts/run-eveunity-scene-capture-contract-smoke.ps1"
|
||||
"tools/eveunity/eveunity-scene-capture-artifact.mjs",
|
||||
"tools/eveunity/eveunity-scene-capture-artifact.test.mjs",
|
||||
"scripts/run-eveunity-scene-capture-contract-smoke.ps1",
|
||||
"scripts/run-eveunity-scene-capture-smoke.ps1"
|
||||
],
|
||||
"pendingProofs": [
|
||||
"Unity scene screenshot or frame-capture artifact is attached to the runtime conformance report."
|
||||
"Unity scene screenshot or frame-capture PNG artifact is attached to the runtime conformance report."
|
||||
]
|
||||
}
|
||||
},
|
||||
"capture": {
|
||||
"status": "missing",
|
||||
"note": "Unity scene capture is a split blocker until EveUnity attaches provider-agnostic scene frame artifacts."
|
||||
"status": "json-projection",
|
||||
"note": "Unity scene attaches a provider-advertisement-backed gamecult.eve.unity_scene_projection.v1 JSON projection artifact; Unity screenshot or frame-capture PNG remains an EveUnity split blocker.",
|
||||
"artifacts": [
|
||||
{
|
||||
"kind": "json-projection",
|
||||
"schema": "gamecult.eve.unity_scene_projection.v1",
|
||||
"path": "artifacts/eveunity-scene-capture/latest/unity-scene-projection.json",
|
||||
"runtimeId": "unity-scene",
|
||||
"providerId": "aetheria",
|
||||
"surfaceId": "aetheria.daemon.game",
|
||||
"sourceSurfacePath": "web/fixtures/aetheria-world-surface.json",
|
||||
"requestPath": "artifacts/eveunity-scene-capture/latest/capture-request.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -92,10 +92,13 @@
|
|||
"currentPaths": [
|
||||
"tools/eveunity/eveunity-capture-contract.mjs",
|
||||
"tools/eveunity/eveunity-capture-contract.test.mjs",
|
||||
"scripts/run-eveunity-scene-capture-contract-smoke.ps1"
|
||||
"tools/eveunity/eveunity-scene-capture-artifact.mjs",
|
||||
"tools/eveunity/eveunity-scene-capture-artifact.test.mjs",
|
||||
"scripts/run-eveunity-scene-capture-contract-smoke.ps1",
|
||||
"scripts/run-eveunity-scene-capture-smoke.ps1"
|
||||
],
|
||||
"destinationOwner": "EveUnity",
|
||||
"replacementProof": "EveUnity builds a provider-advertisement-backed Unity scene capture request now; the split is not complete until EveUnity attaches Unity scene screenshot or frame-capture artifacts to conformance output for at least one provider-authored world surface."
|
||||
"replacementProof": "EveUnity builds a provider-advertisement-backed Unity scene capture request and deterministic gamecult.eve.unity_scene_projection.v1 JSON projection artifact now; the split is not complete until EveUnity attaches Unity scene screenshot or frame-capture PNG artifacts to conformance output for at least one provider-authored world surface."
|
||||
}
|
||||
],
|
||||
"contractInputs": [
|
||||
|
|
@ -125,6 +128,6 @@
|
|||
"EveUnity lowers at least one non-Aetheria provider-authored world surface into Unity scene objects.",
|
||||
"EveUnity lowers Aetheria's game world surface through provider advertisements without importing Aetheria internals.",
|
||||
"Unity scene input emits gamecult.eve.command.v1 intents and renders provider receipts.",
|
||||
"Unity scene screenshot or frame-capture artifacts are attached to conformance output."
|
||||
"Unity scene screenshot or frame-capture PNG artifacts are attached to conformance output."
|
||||
]
|
||||
}
|
||||
|
|
|
|||
127
schemas/gamecult.eve.unity_scene_projection.v1.schema.json
Normal file
127
schemas/gamecult.eve.unity_scene_projection.v1.schema.json
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "gamecult.eve.unity_scene_projection.v1",
|
||||
"title": "Eve Unity Scene Projection",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"type",
|
||||
"schema",
|
||||
"runtimeId",
|
||||
"providerId",
|
||||
"surfaceId",
|
||||
"projectionKind",
|
||||
"commandBoundary",
|
||||
"receiptSchema",
|
||||
"ownership",
|
||||
"root"
|
||||
],
|
||||
"properties": {
|
||||
"type": {
|
||||
"const": "unity-scene-projection"
|
||||
},
|
||||
"schema": {
|
||||
"const": "gamecult.eve.unity_scene_projection.v1"
|
||||
},
|
||||
"runtimeId": {
|
||||
"const": "unity-scene"
|
||||
},
|
||||
"providerId": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"surfaceId": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"projectionKind": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"commandBoundary": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"receiptSchema": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"ownership": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"root": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"id",
|
||||
"componentKind",
|
||||
"sceneObjectKind",
|
||||
"stateBindingCount",
|
||||
"embeddedDocumentCount",
|
||||
"children"
|
||||
],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"componentKind": {
|
||||
"type": "string"
|
||||
},
|
||||
"sceneObjectKind": {
|
||||
"type": "string",
|
||||
"minLength": 1
|
||||
},
|
||||
"props": {
|
||||
"type": "object"
|
||||
},
|
||||
"layout": {
|
||||
"type": "object"
|
||||
},
|
||||
"style": {
|
||||
"type": "object"
|
||||
},
|
||||
"stateBindingCount": {
|
||||
"type": "number"
|
||||
},
|
||||
"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
|
||||
}
|
||||
},
|
||||
"pluginProjection": {
|
||||
"type": "object"
|
||||
},
|
||||
"children": {
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
}
|
||||
|
|
@ -91,6 +91,7 @@ foreach ($contract in @(
|
|||
"gamecult.eve.provider_advertisement.v1",
|
||||
"gamecult.eve.provider_handoff.v1",
|
||||
"gamecult.eve.electron_shell_projection.v1",
|
||||
"gamecult.eve.unity_scene_projection.v1",
|
||||
"gamecult.eve.tui_grid.v1",
|
||||
"gamecult.eve.web_layout_probe.v1",
|
||||
"gamecult.eve.runtime_capability.v1",
|
||||
|
|
@ -128,6 +129,7 @@ if (Test-Path -LiteralPath (Join-Path $absoluteExportDirectory "index.json")) {
|
|||
"gamecult.eve.provider_advertisement.v1",
|
||||
"gamecult.eve.provider_handoff.v1",
|
||||
"gamecult.eve.electron_shell_projection.v1",
|
||||
"gamecult.eve.unity_scene_projection.v1",
|
||||
"gamecult.eve.tui_grid.v1",
|
||||
"gamecult.eve.web_layout_probe.v1",
|
||||
"gamecult.eve.runtime_capability.v1",
|
||||
|
|
|
|||
73
scripts/run-eveunity-scene-capture-smoke.ps1
Normal file
73
scripts/run-eveunity-scene-capture-smoke.ps1
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
param(
|
||||
[string] $CapabilityManifestPath = "runtimes\incubating\eve-unity-scene\eve-runtime-capability.json",
|
||||
[string] $AdvertisementPath = "web\fixtures\aetheria.provider-advertisement.json",
|
||||
[string] $SurfacePath = "web\fixtures\aetheria-world-surface.json",
|
||||
[string] $OutputPath = "artifacts\eveunity-scene-capture\latest\unity-scene-projection.json",
|
||||
[string] $RequestOutputPath = "artifacts\eveunity-scene-capture\latest\capture-request.json",
|
||||
[string] $Stamp = "latest"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$projectRoot = Split-Path -Parent $PSScriptRoot
|
||||
function Resolve-RepoPath([string] $candidate) {
|
||||
if ([System.IO.Path]::IsPathRooted($candidate)) {
|
||||
return $candidate
|
||||
}
|
||||
return Join-Path $projectRoot $candidate
|
||||
}
|
||||
|
||||
$absoluteCapabilityPath = Resolve-RepoPath $CapabilityManifestPath
|
||||
$absoluteAdvertisementPath = Resolve-RepoPath $AdvertisementPath
|
||||
$absoluteSurfacePath = Resolve-RepoPath $SurfacePath
|
||||
$absoluteOutputPath = Resolve-RepoPath $OutputPath
|
||||
$absoluteRequestOutputPath = Resolve-RepoPath $RequestOutputPath
|
||||
|
||||
foreach ($path in @($absoluteCapabilityPath, $absoluteAdvertisementPath, $absoluteSurfacePath)) {
|
||||
if (-not (Test-Path -LiteralPath $path)) {
|
||||
throw "EveUnity scene capture input not found: $path"
|
||||
}
|
||||
}
|
||||
|
||||
node --test (Join-Path $projectRoot "tools\eveunity\eveunity-scene-capture-artifact.test.mjs")
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveUnity scene capture artifact tests failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
node (Join-Path $projectRoot "tools\eveunity\eveunity-scene-capture-artifact.mjs") `
|
||||
--capability $absoluteCapabilityPath `
|
||||
--advertisement $absoluteAdvertisementPath `
|
||||
--surface $absoluteSurfacePath `
|
||||
--output $absoluteOutputPath `
|
||||
--request-output $absoluteRequestOutputPath `
|
||||
--stamp $Stamp
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "EveUnity scene capture artifact builder failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
foreach ($path in @($absoluteOutputPath, $absoluteRequestOutputPath)) {
|
||||
if (-not (Test-Path -LiteralPath $path)) {
|
||||
throw "EveUnity scene capture artifact output missing: $path"
|
||||
}
|
||||
}
|
||||
|
||||
$projection = Get-Content -LiteralPath $absoluteOutputPath -Raw | ConvertFrom-Json
|
||||
foreach ($expectation in @(
|
||||
@{ field = "schema"; value = "gamecult.eve.unity_scene_projection.v1" },
|
||||
@{ field = "runtimeId"; value = "unity-scene" },
|
||||
@{ field = "providerId"; value = "aetheria" },
|
||||
@{ field = "surfaceId"; value = "aetheria.daemon.game" },
|
||||
@{ field = "commandBoundary"; value = "aetheria.daemon.commands" },
|
||||
@{ field = "receiptSchema"; value = "aetheria.eve_command_acceptance_status.v1" },
|
||||
@{ field = "artifactKind"; value = "json-projection" },
|
||||
@{ field = "captureKind"; value = "unity-scene-projection-json" }
|
||||
)) {
|
||||
if ($projection.($expectation.field) -ne $expectation.value) {
|
||||
throw "EveUnity scene projection $($expectation.field) expected $($expectation.value) got $($projection.($expectation.field))"
|
||||
}
|
||||
}
|
||||
if (-not $projection.root.id) {
|
||||
throw "EveUnity scene projection capture must contain a root scene node"
|
||||
}
|
||||
|
||||
Write-Host "EveUnity scene capture smoke passed: $absoluteOutputPath"
|
||||
|
|
@ -213,5 +213,6 @@ foreach ($pathProperty in @("requestBuilder", "advertisementPath")) {
|
|||
& (Join-Path $projectRoot "scripts\run-eveunity-scene-provider-shell-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-eveunity-scene-release-contract-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-eveunity-scene-capture-contract-smoke.ps1")
|
||||
& (Join-Path $projectRoot "scripts\run-eveunity-scene-capture-smoke.ps1")
|
||||
|
||||
Write-Host "EveUnity scene lifecycle smoke passed: $absoluteManifestPath"
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ node $consumerScript $consumerExport `
|
|||
--expect-schema gamecult.eve.runtime_lifecycle.v1 `
|
||||
--expect-schema gamecult.eve.runtime_split_handoff.v1 `
|
||||
--expect-schema gamecult.eve.electron_shell_projection.v1 `
|
||||
--expect-schema gamecult.eve.unity_scene_projection.v1 `
|
||||
--expect-schema gamecult.eve.tui_grid.v1 `
|
||||
--expect-schema gamecult.eve.web_layout_probe.v1 `
|
||||
--expect-runtime-status web:active `
|
||||
|
|
@ -132,7 +133,8 @@ node $consumerScript $consumerExport `
|
|||
--expect-runtime-capture-status linux-flutter:ssh-golden `
|
||||
--expect-runtime-capture-status android-flutter:adb-png `
|
||||
--expect-runtime-capture-status unity-uitoolkit:semantic `
|
||||
--expect-runtime-capture-status unity-scene:missing `
|
||||
--expect-runtime-capture-status unity-scene:json-projection `
|
||||
--expect-runtime-capture-artifact unity-scene:json-projection:gamecult.eve.unity_scene_projection.v1:aetheria:aetheria.daemon.game `
|
||||
--expect-runtime-capture-status electron-shell:json-projection `
|
||||
--expect-runtime-capture-artifact electron-shell:json-projection:gamecult.eve.electron_shell_projection.v1:aetheria:aetheria.daemon.game `
|
||||
--expect-runtime-capture-status tui:json-grid `
|
||||
|
|
@ -180,7 +182,7 @@ node $consumerScript $consumerExport `
|
|||
--expect-runtime-lifecycle-status unity-scene:capture:pending-unity-scene-capture `
|
||||
--expect-runtime-lifecycle-pending "unity-scene:release:Unity scene package release" `
|
||||
--expect-runtime-lifecycle-pending "unity-scene:test:Unity scene provider-advertisement smoke" `
|
||||
--expect-runtime-lifecycle-pending "unity-scene:capture:Unity scene screenshot or frame-capture artifact" `
|
||||
--expect-runtime-lifecycle-pending "unity-scene:capture:Unity scene screenshot or frame-capture PNG artifact" `
|
||||
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.packageName:org.gamecult.eve.unity-scene" `
|
||||
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.artifactKind:upm-package" `
|
||||
--expect-runtime-lifecycle-field "unity-scene:release:releaseContract.tagPattern:eveunity-scene-v{version}" `
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
"schemas/gamecult.eve.provider_advertisement.v1.schema.json",
|
||||
"schemas/gamecult.eve.provider_handoff.v1.schema.json",
|
||||
"schemas/gamecult.eve.electron_shell_projection.v1.schema.json",
|
||||
"schemas/gamecult.eve.unity_scene_projection.v1.schema.json",
|
||||
"schemas/gamecult.eve.tui_grid.v1.schema.json",
|
||||
"schemas/gamecult.eve.web_layout_probe.v1.schema.json",
|
||||
"schemas/gamecult.eve.runtime_capability.v1.schema.json",
|
||||
|
|
@ -92,6 +93,7 @@
|
|||
"gamecult.eve.provider_advertisement.v1",
|
||||
"gamecult.eve.provider_handoff.v1",
|
||||
"gamecult.eve.electron_shell_projection.v1",
|
||||
"gamecult.eve.unity_scene_projection.v1",
|
||||
"gamecult.eve.tui_grid.v1",
|
||||
"gamecult.eve.web_layout_probe.v1",
|
||||
"gamecult.eve.runtime_capability.v1",
|
||||
|
|
|
|||
305
tools/eveunity/eveunity-scene-capture-artifact.mjs
Normal file
305
tools/eveunity/eveunity-scene-capture-artifact.mjs
Normal file
|
|
@ -0,0 +1,305 @@
|
|||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { buildUnityCaptureRequest, loadJsonFile, writeCaptureRequest } from "./eveunity-capture-contract.mjs";
|
||||
|
||||
export function buildUnitySceneCaptureArtifact({
|
||||
advertisement,
|
||||
capabilityManifest,
|
||||
surfaceDocument,
|
||||
advertisementPath = "",
|
||||
capabilityManifestPath = "",
|
||||
stamp = "latest",
|
||||
} = {}) {
|
||||
const request = buildUnityCaptureRequest({
|
||||
advertisement,
|
||||
capabilityManifest,
|
||||
advertisementPath,
|
||||
capabilityManifestPath,
|
||||
stamp,
|
||||
});
|
||||
const projection = buildUnitySceneProjection(surfaceDocument, advertisement, request.surfaceId);
|
||||
validateProjectionArtifact(projection, request);
|
||||
|
||||
return {
|
||||
request,
|
||||
projection: {
|
||||
...projection,
|
||||
artifactKind: "json-projection",
|
||||
captureKind: "unity-scene-projection-json",
|
||||
sourceAdvertisementPath: request.sourceAdvertisementPath,
|
||||
sourceCapabilityManifestPath: request.sourceCapabilityManifestPath,
|
||||
issuedAtUtc: request.issuedAtUtc,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function buildUnitySceneProjection(surfaceDocument, providerAdvertisement, requestedSurfaceId = "") {
|
||||
const selected = selectSurface(providerAdvertisement, requestedSurfaceId);
|
||||
const document = normalizeSurfaceDocument(surfaceDocument);
|
||||
if (document.surfaceId !== selected.surfaceId) {
|
||||
throw new Error(`Surface document ${document.surfaceId} does not match advertised Unity scene surface ${selected.surfaceId}.`);
|
||||
}
|
||||
|
||||
return {
|
||||
type: "unity-scene-projection",
|
||||
schema: "gamecult.eve.unity_scene_projection.v1",
|
||||
runtimeId: "unity-scene",
|
||||
providerId: selected.providerId,
|
||||
surfaceId: selected.surfaceId,
|
||||
projectionKind: selected.worldInteraction.projectionKind,
|
||||
commandBoundary: selected.worldInteraction.commandBoundary,
|
||||
receiptSchema: selected.worldInteraction.receiptSchema,
|
||||
ownership: selected.worldInteraction.ownership,
|
||||
root: buildSceneNode(document.root),
|
||||
};
|
||||
}
|
||||
|
||||
export function writeUnitySceneCaptureArtifact({ request, projection }, { outputPath, requestOutputPath = "" } = {}) {
|
||||
if (!outputPath) throw new Error("outputPath is required");
|
||||
mkdirSync(path.dirname(outputPath), { recursive: true });
|
||||
writeFileSync(outputPath, `${JSON.stringify(projection, null, 2)}\n`, "utf8");
|
||||
if (requestOutputPath) {
|
||||
writeCaptureRequest(request, requestOutputPath);
|
||||
}
|
||||
}
|
||||
|
||||
function selectSurface(providerAdvertisement, requestedSurfaceId = "") {
|
||||
const provider = normalizeProviderAdvertisement(providerAdvertisement);
|
||||
const surface = requestedSurfaceId
|
||||
? provider.surfaces.find(candidate => candidate.surfaceId === requestedSurfaceId)
|
||||
: provider.surfaces[0];
|
||||
|
||||
if (!surface) {
|
||||
throw new Error(`Provider ${provider.providerId} does not advertise surface ${requestedSurfaceId || "(first)"}`);
|
||||
}
|
||||
|
||||
return {
|
||||
providerId: provider.providerId,
|
||||
surfaceId: surface.surfaceId,
|
||||
worldInteraction: normalizeWorldInteraction(surface.worldInteraction),
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeProviderAdvertisement(providerAdvertisement) {
|
||||
if (!providerAdvertisement || typeof providerAdvertisement !== "object") {
|
||||
throw new Error("Provider advertisement is required.");
|
||||
}
|
||||
const providerId = String(providerAdvertisement.providerId || "");
|
||||
if (!providerId) throw new Error("Provider advertisement missing providerId.");
|
||||
const surfaces = Array.isArray(providerAdvertisement.surfaces)
|
||||
? providerAdvertisement.surfaces
|
||||
.filter(surface => surface && typeof surface === "object" && surface.surfaceId)
|
||||
.map(surface => ({
|
||||
...surface,
|
||||
surfaceId: String(surface.surfaceId),
|
||||
}))
|
||||
: [];
|
||||
if (!surfaces.length) throw new Error(`Provider ${providerId} advertises no surfaces.`);
|
||||
return { ...providerAdvertisement, providerId, surfaces };
|
||||
}
|
||||
|
||||
function normalizeSurfaceDocument(surfaceDocument) {
|
||||
if (!surfaceDocument || typeof surfaceDocument !== "object") {
|
||||
throw new Error("Surface document is required.");
|
||||
}
|
||||
if (surfaceDocument.schema !== "gamecult.eve.surface.v1") {
|
||||
throw new Error(`Unexpected surface schema: ${surfaceDocument.schema || ""}`);
|
||||
}
|
||||
const surface = objectValue(surfaceDocument.surface);
|
||||
const surfaceId = firstString(surface.id);
|
||||
if (!surfaceId) throw new Error("Surface document missing surface.id.");
|
||||
const root = objectValue(surface.root);
|
||||
if (!root.id) throw new Error(`Surface document ${surfaceId} missing surface.root.`);
|
||||
return { ...surfaceDocument, surfaceId, root };
|
||||
}
|
||||
|
||||
function buildSceneNode(component) {
|
||||
const source = objectValue(component);
|
||||
const children = Array.isArray(source.children) ? source.children.map(buildSceneNode) : [];
|
||||
const embeddedDocuments = normalizeEmbeddedDocuments(source.embeddedDocuments);
|
||||
const componentKind = firstString(source.kind);
|
||||
const pluginProjection = buildPluginProjection(componentKind, source);
|
||||
return {
|
||||
id: firstString(source.id),
|
||||
componentKind,
|
||||
sceneObjectKind: sceneObjectKind(componentKind),
|
||||
props: objectValue(source.props),
|
||||
layout: objectValue(source.layout),
|
||||
style: objectValue(source.style),
|
||||
stateBindingCount: Array.isArray(source.stateBindings) ? source.stateBindings.length : 0,
|
||||
embeddedDocumentCount: embeddedDocuments.length,
|
||||
embeddedDocuments,
|
||||
...(pluginProjection ? { pluginProjection } : {}),
|
||||
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 sceneObjectKind(componentKind) {
|
||||
if (!componentKind) return "empty";
|
||||
if (componentKind === "vn.stage") return "sai-vn-scene-stage";
|
||||
if (componentKind === "panel.dialogue" || componentKind === "text.dialogue") return "sai-vn-scene-dialogue";
|
||||
if (componentKind === "rail.actions") return "sai-vn-scene-action-rail";
|
||||
if (componentKind.startsWith("control.")) return "command-control";
|
||||
if (componentKind === "embed.norn") return "norn-graph-scene-projection";
|
||||
if (componentKind === "embed.tex") return "tex-math-scene-projection";
|
||||
if (componentKind.startsWith("embed.")) return "plugin-placeholder";
|
||||
if (componentKind === "surface.slot") return "embedded-surface-slot";
|
||||
if (componentKind.startsWith("field.") || componentKind.startsWith("world.")) return "world-projection-node";
|
||||
if (componentKind.startsWith("text.") || componentKind === "text" || componentKind === "label") return "scene-label";
|
||||
return "scene-node";
|
||||
}
|
||||
|
||||
function buildPluginProjection(componentKind, component) {
|
||||
const props = objectValue(component.props);
|
||||
if (componentKind === "vn.stage") {
|
||||
return {
|
||||
pluginId: "sai.vn",
|
||||
projectionKind: "sai-vn-scene-stage",
|
||||
abiSchema: "gamecult.eve.plugin_abi.v1",
|
||||
commandBoundary: "sidecar-advertised-plugin-abi",
|
||||
capabilities: ["vn.stage", "story.choose", "story.continue", "story.jump"],
|
||||
command: "story.choose",
|
||||
documentId: firstString(props.storyId, component.id),
|
||||
semanticOwner: "Sai",
|
||||
};
|
||||
}
|
||||
|
||||
if (componentKind === "embed.norn") {
|
||||
return {
|
||||
pluginId: "norn.graph",
|
||||
projectionKind: "norn-graph-scene-projection",
|
||||
abiSchema: "gamecult.eve.plugin_abi.v1",
|
||||
commandBoundary: "sidecar-advertised-plugin-abi",
|
||||
capabilities: ["embed.norn"],
|
||||
command: "graph.node.activate",
|
||||
documentId: firstString(props.sourceUri, props.documentId, component.id),
|
||||
semanticOwner: "Norn",
|
||||
};
|
||||
}
|
||||
|
||||
if (componentKind === "embed.tex") {
|
||||
return {
|
||||
pluginId: "tex.math",
|
||||
projectionKind: texProjectionKind(props),
|
||||
abiSchema: "gamecult.eve.plugin_abi.v1",
|
||||
commandBoundary: "sidecar-advertised-plugin-abi",
|
||||
capabilities: ["embed.tex", "tex.inline", "tex.block", "tex.scene-placement"],
|
||||
command: "",
|
||||
documentId: firstString(props.sourceUri, props.source, component.id),
|
||||
semanticOwner: "EvePlugins",
|
||||
};
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function texProjectionKind(props) {
|
||||
const display = firstString(props.display, "inline");
|
||||
if (display === "block") return "tex-math-scene-projection";
|
||||
if (display === "page") return "tex-math-scene-page-projection";
|
||||
return "tex-math-scene-inline-projection";
|
||||
}
|
||||
|
||||
function normalizeWorldInteraction(value) {
|
||||
const source = objectValue(value);
|
||||
return {
|
||||
projectionKind: firstString(source.projectionKind),
|
||||
commandBoundary: firstString(source.commandBoundary),
|
||||
receiptSchema: firstString(source.receiptSchema),
|
||||
ownership: firstString(source.ownership),
|
||||
};
|
||||
}
|
||||
|
||||
function validateProjectionArtifact(projection, request) {
|
||||
if (projection.schema !== "gamecult.eve.unity_scene_projection.v1") {
|
||||
throw new Error(`Unexpected Unity scene projection schema: ${projection.schema || ""}`);
|
||||
}
|
||||
for (const [field, expected] of [
|
||||
["runtimeId", request.runtimeId],
|
||||
["providerId", request.providerId],
|
||||
["surfaceId", request.surfaceId],
|
||||
["projectionKind", request.projectionKind],
|
||||
["commandBoundary", request.commandBoundary],
|
||||
["receiptSchema", request.receiptSchema],
|
||||
]) {
|
||||
if ((projection[field] || "") !== (expected || "")) {
|
||||
throw new Error(`Unity scene projection ${field} expected ${expected || ""} got ${projection[field] || ""}`);
|
||||
}
|
||||
}
|
||||
if (!projection.root || !projection.root.id) {
|
||||
throw new Error("Unity scene projection artifact must contain a root scene node");
|
||||
}
|
||||
}
|
||||
|
||||
function objectValue(value) {
|
||||
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
||||
}
|
||||
|
||||
function firstString(...values) {
|
||||
for (const value of values) {
|
||||
if (typeof value === "string" && value.trim()) return value;
|
||||
if (typeof value === "number" && Number.isFinite(value)) return String(value);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function parseArgs(argv) {
|
||||
const args = {};
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const value = argv[index];
|
||||
if (!value.startsWith("--")) continue;
|
||||
const key = value.slice(2);
|
||||
const next = argv[index + 1];
|
||||
if (!next || next.startsWith("--")) {
|
||||
args[key] = true;
|
||||
} else {
|
||||
args[key] = next;
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
function runCli() {
|
||||
const args = parseArgs(process.argv.slice(2));
|
||||
for (const required of ["advertisement", "capability", "surface", "output"]) {
|
||||
if (!args[required]) {
|
||||
throw new Error(`missing required --${required}`);
|
||||
}
|
||||
}
|
||||
const stamp = args.stamp || "latest";
|
||||
const artifact = buildUnitySceneCaptureArtifact({
|
||||
advertisement: loadJsonFile(args.advertisement),
|
||||
capabilityManifest: loadJsonFile(args.capability),
|
||||
surfaceDocument: loadJsonFile(args.surface),
|
||||
advertisementPath: args.advertisement,
|
||||
capabilityManifestPath: args.capability,
|
||||
stamp,
|
||||
});
|
||||
writeUnitySceneCaptureArtifact(artifact, {
|
||||
outputPath: args.output,
|
||||
requestOutputPath: args["request-output"] || "",
|
||||
});
|
||||
process.stdout.write(`${args.output}\n`);
|
||||
}
|
||||
|
||||
const invokedPath = process.argv[1] ? path.resolve(process.argv[1]) : "";
|
||||
const modulePath = fileURLToPath(import.meta.url);
|
||||
if (invokedPath === modulePath) {
|
||||
runCli();
|
||||
}
|
||||
56
tools/eveunity/eveunity-scene-capture-artifact.test.mjs
Normal file
56
tools/eveunity/eveunity-scene-capture-artifact.test.mjs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
import assert from "node:assert/strict";
|
||||
import { readFileSync } from "node:fs";
|
||||
import test from "node:test";
|
||||
import { buildUnitySceneCaptureArtifact, buildUnitySceneProjection } from "./eveunity-scene-capture-artifact.mjs";
|
||||
|
||||
const aetheriaAdvertisement = JSON.parse(readFileSync(new URL("../../web/fixtures/aetheria.provider-advertisement.json", import.meta.url), "utf8"));
|
||||
const capabilityManifest = JSON.parse(readFileSync(new URL("../../runtimes/incubating/eve-unity-scene/eve-runtime-capability.json", import.meta.url), "utf8"));
|
||||
const aetheriaSurfaceDocument = JSON.parse(readFileSync(new URL("../../web/fixtures/aetheria-world-surface.json", import.meta.url), "utf8"));
|
||||
const saiAdvertisement = JSON.parse(readFileSync(new URL("../../web/fixtures/sai-vn.provider-advertisement.json", import.meta.url), "utf8"));
|
||||
const saiSurfaceDocument = JSON.parse(readFileSync(new URL("../../web/fixtures/sai-vn-surface.json", import.meta.url), "utf8"));
|
||||
|
||||
test("builds Unity scene projection capture artifact from provider advertisement and surface", () => {
|
||||
const { request, projection } = buildUnitySceneCaptureArtifact({
|
||||
advertisement: aetheriaAdvertisement,
|
||||
capabilityManifest,
|
||||
surfaceDocument: aetheriaSurfaceDocument,
|
||||
advertisementPath: "web/fixtures/aetheria.provider-advertisement.json",
|
||||
capabilityManifestPath: "runtimes/incubating/eve-unity-scene/eve-runtime-capability.json",
|
||||
stamp: "smoke",
|
||||
});
|
||||
|
||||
assert.equal(request.artifactPath, "artifacts/eveunity-scene-capture/smoke/unity-scene.png");
|
||||
assert.equal(projection.schema, "gamecult.eve.unity_scene_projection.v1");
|
||||
assert.equal(projection.runtimeId, "unity-scene");
|
||||
assert.equal(projection.providerId, "aetheria");
|
||||
assert.equal(projection.surfaceId, "aetheria.daemon.game");
|
||||
assert.equal(projection.commandBoundary, "aetheria.daemon.commands");
|
||||
assert.equal(projection.receiptSchema, "aetheria.eve_command_acceptance_status.v1");
|
||||
assert.equal(projection.artifactKind, "json-projection");
|
||||
assert.equal(projection.captureKind, "unity-scene-projection-json");
|
||||
assert.equal(projection.root.id, "aetheria.daemon.game.root");
|
||||
assert.equal(projection.root.children[1].children[0].sceneObjectKind, "world-projection-node");
|
||||
});
|
||||
|
||||
test("keeps Sai, Norn, and TeX semantics in sidecar plugin projections", () => {
|
||||
const advertisement = structuredClone(saiAdvertisement);
|
||||
advertisement.surfaces[0].worldInteraction = {
|
||||
projectionKind: "provider-authored-visual-novel-surface",
|
||||
commandBoundary: "sai.vn.plugin.commands",
|
||||
receiptSchema: "gamecult.eve.command_receipt.v1",
|
||||
loweringTargets: ["unity-scene"],
|
||||
ownership: "provider-owns-story-state-plugin-sidecars-own-nested-semantics",
|
||||
};
|
||||
|
||||
const projection = buildUnitySceneProjection(saiSurfaceDocument, advertisement, "sai.visual_novel.surface");
|
||||
const graphNode = projection.root.children.find(child => child.id === "sai.graph");
|
||||
const texLayer = projection.root.children.find(child => child.id === "sai.embeds");
|
||||
const texNode = texLayer.children.find(child => child.id === "sai.tex.log-power");
|
||||
|
||||
assert.equal(projection.root.pluginProjection.pluginId, "sai.vn");
|
||||
assert.equal(projection.root.pluginProjection.semanticOwner, "Sai");
|
||||
assert.equal(graphNode.pluginProjection.pluginId, "norn.graph");
|
||||
assert.equal(graphNode.pluginProjection.semanticOwner, "Norn");
|
||||
assert.equal(texNode.pluginProjection.pluginId, "tex.math");
|
||||
assert.equal(texNode.pluginProjection.semanticOwner, "EvePlugins");
|
||||
});
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
"gamecult.eve.provider_handoff.v1": "schemas/gamecult.eve.provider_handoff.v1.schema.json",
|
||||
"gamecult.eve.conformance_handoff.v1": "schemas/gamecult.eve.conformance_handoff.v1.schema.json",
|
||||
"gamecult.eve.electron_shell_projection.v1": "schemas/gamecult.eve.electron_shell_projection.v1.schema.json",
|
||||
"gamecult.eve.unity_scene_projection.v1": "schemas/gamecult.eve.unity_scene_projection.v1.schema.json",
|
||||
"gamecult.eve.tui_grid.v1": "schemas/gamecult.eve.tui_grid.v1.schema.json"
|
||||
},
|
||||
"conformancePacks": [
|
||||
|
|
@ -630,7 +631,7 @@
|
|||
"Unity batchmode EditMode runner is owned by EveUnity rather than Eve incubation.",
|
||||
"Unity batchmode or editor capture artifact is attached to the runtime conformance report.",
|
||||
"Unity scene runtime body graduates to EveUnity outside Aetheria product code.",
|
||||
"Unity scene screenshot or frame-capture artifact is attached to the runtime conformance report."
|
||||
"Unity scene screenshot or frame-capture PNG artifact is attached to the runtime conformance report."
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
@ -1023,10 +1024,13 @@
|
|||
"scripts/run-eveunity-scene-release-contract-smoke.ps1",
|
||||
"scripts/run-eveunity-scene-provider-shell-smoke.ps1",
|
||||
"scripts/run-eveunity-scene-capture-contract-smoke.ps1",
|
||||
"scripts/run-eveunity-scene-capture-smoke.ps1",
|
||||
"tools/eveunity/eveunity-release-contract.mjs",
|
||||
"tools/eveunity/eveunity-release-contract.test.mjs",
|
||||
"tools/eveunity/eveunity-capture-contract.mjs",
|
||||
"tools/eveunity/eveunity-capture-contract.test.mjs"
|
||||
"tools/eveunity/eveunity-capture-contract.test.mjs",
|
||||
"tools/eveunity/eveunity-scene-capture-artifact.mjs",
|
||||
"tools/eveunity/eveunity-scene-capture-artifact.test.mjs"
|
||||
],
|
||||
"expectedSourceSymbols": [
|
||||
{
|
||||
|
|
@ -1053,14 +1057,34 @@
|
|||
"path": "tools/eveunity/eveunity-capture-contract.test.mjs",
|
||||
"contains": ["builds Unity scene capture request from provider advertisement", "unity-scene", "artifacts/eveunity-scene-capture/smoke/unity-scene.png"]
|
||||
},
|
||||
{
|
||||
"path": "tools/eveunity/eveunity-scene-capture-artifact.mjs",
|
||||
"contains": ["buildUnitySceneCaptureArtifact", "buildUnitySceneProjection", "gamecult.eve.unity_scene_projection.v1", "unity-scene-projection-json", "writeUnitySceneCaptureArtifact", "request-output"]
|
||||
},
|
||||
{
|
||||
"path": "tools/eveunity/eveunity-scene-capture-artifact.test.mjs",
|
||||
"contains": ["builds Unity scene projection capture artifact", "keeps Sai, Norn, and TeX semantics in sidecar plugin projections", "gamecult.eve.unity_scene_projection.v1", "unity-scene-projection-json"]
|
||||
},
|
||||
{
|
||||
"path": "tools/eveunity/eveunity-release-contract.test.mjs",
|
||||
"contains": ["builds EveUnity scene UPM release request from package manifest", "eveunity-scene-v0.1.0", "artifacts/eveunity-scene-release/0.1.0/org.gamecult.eve.unity-scene-0.1.0.tgz"]
|
||||
}
|
||||
],
|
||||
"capture": {
|
||||
"status": "missing",
|
||||
"note": "Unity scene capture is a split blocker until EveUnity attaches provider-agnostic scene frame artifacts."
|
||||
"status": "json-projection",
|
||||
"note": "Unity scene attaches a provider-advertisement-backed gamecult.eve.unity_scene_projection.v1 JSON projection artifact; Unity screenshot or frame-capture PNG remains an EveUnity split blocker.",
|
||||
"artifacts": [
|
||||
{
|
||||
"kind": "json-projection",
|
||||
"schema": "gamecult.eve.unity_scene_projection.v1",
|
||||
"path": "artifacts/eveunity-scene-capture/latest/unity-scene-projection.json",
|
||||
"runtimeId": "unity-scene",
|
||||
"providerId": "aetheria",
|
||||
"surfaceId": "aetheria.daemon.game",
|
||||
"sourceSurfacePath": "web/fixtures/aetheria-world-surface.json",
|
||||
"requestPath": "artifacts/eveunity-scene-capture/latest/capture-request.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue