Build typed Aetheria client surfaces

This commit is contained in:
Meta Vens 2026-06-25 18:09:33 +01:00
commit 2e96660d48
246 changed files with 37893 additions and 6728 deletions

View file

@ -0,0 +1,10 @@
import { copyFileSync, rmSync } from "node:fs";
import { resolve } from "node:path";
const root = resolve(import.meta.dirname, "..");
const source = resolve(root, "Electron", "preload.cjs");
const legacyOutput = resolve(root, "electron-dist", "preload.js");
const output = resolve(root, "electron-dist", "preload.cjs");
rmSync(legacyOutput, { force: true });
copyFileSync(source, output);

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,531 @@
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
Set-Location $root
& node scripts/generate-rts-bindings.mjs --check
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: generated RTS bindings are stale."
}
$forbidden = @(
'window\.aetheriaRts\.command',
'window\.aetheriaRts\.viewport',
'ipcMain\.handle\("aetheria-rts:command',
'ipcMain\.handle\("aetheria-rts:viewport',
'function createCommandDocument',
'export type RtsCommandRequest',
'public async command\(',
'public async viewport\('
)
$forbiddenPattern = ($forbidden -join '|')
$forbiddenHits = & rg -n $forbiddenPattern Client Electron 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: public generic RTS command/viewport surface still exists.`n$forbiddenHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for forbidden public surfaces."
}
$required = @(
'mapViewport',
'objectsViewport',
'gravityViewport',
'selectedObject',
'inventory',
'daemonHealth',
'authorityStatus',
'starbridgeSession',
'setMoveVector',
'setTarget',
'surfaceCatalogIndex',
'AetheriaRtsIpcChannels'
)
foreach ($symbol in $required) {
& rg -q $symbol Client Electron
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: expected typed RTS client symbol '$symbol' was not found."
}
}
if (-not (Get-Content Client/app.ts -Raw).Contains('window.aetheriaRts.surfaceCatalogIndex()')) {
Write-Error "Stage 7B verifier failed: RTS renderer does not read the shared CultMesh surface catalog index."
}
$rendererText = Get-Content Client/app.ts -Raw
if (-not $rendererText.Contains('surface.routeHint.kind') -or -not $rendererText.Contains('surface.sources.length')) {
Write-Error "Stage 7B verifier failed: RTS renderer does not expose CultMesh surface route and source metadata."
}
if (-not $rendererText.Contains('latestOperationReceipt') -or
-not $rendererText.Contains('receipt.commandId') -or
-not $rendererText.Contains('receipt.operationId') -or
-not $rendererText.Contains('receipt.accepted') -or
-not $rendererText.Contains('receipt.route.kind')) {
Write-Error "Stage 7B verifier failed: RTS renderer does not expose CultMesh operation receipt metadata."
}
if (-not (Get-Content wwwroot/index.html -Raw).Contains('runtime-surface-details')) {
Write-Error "Stage 7B verifier failed: RTS renderer does not expose runtime surface diagnostics in the shell."
}
$transportLayoutPatterns = @(
'\[[0-9]+\]',
'new Array<unknown>',
'command\[',
'value\[',
'bounds\[',
'viewportSchema',
'commandSchema',
'createBaseCommandDocument',
'decodeViewObject',
'decodeInventoryItem',
'decodeGravityInfluence',
'decodeBodyView',
'fetchViewportDocument',
'fetchDocument\(',
'sendSnapshotRequest',
'schemaIds',
'recordKeys',
'CultNetSnapshotResponseRawMessage',
'AetheriaRtsSchemas\.rtsViewport'
)
$transportLayoutPattern = ($transportLayoutPatterns -join '|')
$transportLayoutHits = & rg -n $transportLayoutPattern Electron/aetheria-cultmesh.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: RTS CultMesh transport wrapper still owns document layout/codec details.`n$transportLayoutHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for transport wrapper layout checks."
}
$requiredBindingSymbols = @(
'createAetheriaRuntimeRtsOperationHandles',
'createAetheriaRuntimeRtsQueryHandles',
'AetheriaRtsSchemas'
)
foreach ($symbol in $requiredBindingSymbols) {
& rg -q $symbol Electron/aetheria-rts-bindings.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: expected RTS binding symbol '$symbol' was not found."
}
}
$requiredGeneratedBindingSymbols = @(
'AetheriaRtsIpcChannels',
'registerAetheriaRtsIpcHandlers',
'export type AetheriaRtsMainClient',
'aetheria-rts:map-viewport',
'aetheria-rts:objects-viewport',
'aetheria-rts:viewport-feed',
'aetheria-rts:viewport-feed-update',
'aetheria-rts:set-move-vector',
'export type AetheriaRuntimeSelectedObjectRequest',
'export type AetheriaRuntimeViewportFeedRequest',
'export type AetheriaRuntimeViewportFeedSnapshot',
'aetheriaRuntimeDaemonCommandDocumentSlots',
'encodeSetMoveVectorCommand',
'encodeSetTargetCommand',
'AetheriaRuntimeRtsProjectionSources',
'AetheriaRuntimeRtsProjectionDiagnostic',
'AetheriaRuntimeRtsLiveFeedDiagnostic',
'AetheriaRuntimeRtsSurfaceCatalogDiagnostic',
'AetheriaRuntimeRtsStatePointers',
'AetheriaRuntimeRtsStatePointerResolvers',
'CultMeshSurfaceCatalogDiagnostic',
'CultMeshSurfaceCatalogIndexDiagnostic',
'CultMeshOperationReceipt',
'aetheria-rts:surface-catalog',
'aetheria-rts:surface-catalog-index',
'surfaceCatalogDiagnostics(): CultMeshSurfaceCatalogDiagnostic',
'surfaceCatalogIndexDiagnostics(): CultMeshSurfaceCatalogIndexDiagnostic',
'ipcMain.handle(AetheriaRtsIpcChannels.surfaceCatalog',
'ipcMain.handle(AetheriaRtsIpcChannels.surfaceCatalogIndex',
'CultMesh.projectionSource',
'CultMesh.projectionRecipe',
'CultMeshProjectionSource',
'routeHint: CultMeshRouteHint',
'CultMeshQueryWatcher',
'AetheriaRuntimeRtsQueryWatchers',
'createAetheriaRuntimeRtsStatePointers',
'CultMesh.statePointer',
'CultMesh.bindStatePointer',
'CultMesh.describeSurface(statePointers.daemonFrame)',
'routeHint, watchProjection',
'watchProjection: watchers.objectsViewport',
'.asQuerySurface()',
'describeAetheriaRuntimeRtsQueryHandles',
'describeAetheriaRuntimeRtsLiveFeedSurface',
'describeAetheriaRuntimeRtsSurfaceCatalog',
'CultMesh.describeQuerySurface',
'CultMesh.describeLiveFeed',
'CultMesh.describeSurfaceCatalog',
'CultMesh.describeSurface',
'CultMesh.describeSurface(operations.setMoveVector)',
'CultMesh.describeSurface(operations.setTarget)',
'CultMesh.operation',
'CultMesh.operationReceipt',
'AetheriaRuntimeRtsOperationHandles',
'AetheriaRuntimeRtsVerseFacade',
'createAetheriaRuntimeRtsVerseFacade',
'CultMesh.bindQuery',
'CultMesh.bindOperation',
'zone: (_zoneId =',
'visibleWithin',
'entity: (entityKey: string)',
'pilot',
'selectedObject: CultMesh.projectionRecipe',
'inventory: CultMesh.projectionRecipe',
'daemonHealth: CultMesh.projectionRecipe',
'authorityStatus: CultMesh.projectionRecipe',
'starbridgeSession: CultMesh.projectionRecipe'
)
foreach ($symbol in $requiredGeneratedBindingSymbols) {
& rg -F -q $symbol Electron/aetheria-rts-generated-bindings.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: expected generated RTS binding symbol '$symbol' was not found."
}
}
$forbiddenGeneratedQuerySurfaceHits = & rg -n 'CultMesh\.query\s*[<(]' Electron/aetheria-rts-generated-bindings.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: generated RTS read surfaces should use CultMesh projection recipes, not raw query wrappers.`n$forbiddenGeneratedQuerySurfaceHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for generated projection recipe checks."
}
$forbiddenGeneratedContextPlumbingHits = & rg -n 'CultMesh\.(queryContextFromVerse|operationContextFromVerse)|\.execute\([^,\n]+,\s*queryContext\(|\.invoke\([^,\n]+,\s*operationContext\(' Electron/aetheria-rts-generated-bindings.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: generated RTS facade should bind surfaces to Verse contexts instead of threading context plumbing.`n$forbiddenGeneratedContextPlumbingHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for generated Verse binding checks."
}
& rg -q 'createAetheriaRuntimeRtsQueryHandles\(' Electron/aetheria-cultmesh.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: RTS client is not creating generated query handles."
}
$clientText = Get-Content Electron/aetheria-cultmesh.ts -Raw
if (-not $clientText.Contains('this.statePointers = createAetheriaRuntimeRtsStatePointers(') -or
-not $clientText.Contains('this.queryVerse.context.routeHint,')) {
Write-Error "Stage 7B verifier failed: RTS client is not creating generated state pointers with its shared Verse route."
}
if (-not $clientText.Contains('daemonFrame: async () => this.fetchLatestFrameDocument()') -or
-not $clientText.Contains('authorityPolicy: async () => this.fetchAuthorityPolicyDocument()')) {
Write-Error "Stage 7B verifier failed: RTS client state pointers are not resolving through daemon publication readers."
}
if (-not $clientText.Contains('this.verse = CultMesh.verse("aetheria.local", this.runtimeId)')) {
Write-Error "Stage 7B verifier failed: RTS client should bind to the shared CultMesh Verse primitive instead of constructing local contexts directly."
}
if (-not $clientText.Contains('this.queryVerse = this.verse.withRoute("shared-memory"')) {
Write-Error "Stage 7B verifier failed: RTS client is not deriving a shared-memory Verse view for local projection reads."
}
if (-not $clientText.Contains('this.commandVerse = this.verse') -or
-not $clientText.Contains('.withRoute("network", this.endpoint)') -or
-not $clientText.Contains('.withClaim("commander-control"')) {
Write-Error "Stage 7B verifier failed: RTS client is not deriving a network Verse view with an explicit command authority claim."
}
if (-not $clientText.Contains('this.publications.statePathDescription')) {
Write-Error "Stage 7B verifier failed: RTS client projection route metadata does not include the local publication source description."
}
if (-not $clientText.Contains('return this.queryVerse.queryContext();')) {
Write-Error "Stage 7B verifier failed: RTS query call sites should derive query contexts from the shared Verse primitive."
}
if (-not $clientText.Contains('this.aetheria = createAetheriaRuntimeRtsVerseFacade(')) {
Write-Error "Stage 7B verifier failed: RTS client should bind generated Aetheria domain sugar to its Verse contexts."
}
if (-not $clientText.Contains('return this.aetheria.zone().objects.visibleWithin(request);') -or
-not $clientText.Contains('return this.aetheria.entity(request.actorEntityKey).pilot.move(') -or
-not $clientText.Contains('return this.aetheria.entity(request.actorEntityKey).pilot.target(')) {
Write-Error "Stage 7B verifier failed: RTS client should route viewport and pilot operations through generated Verse domain sugar."
}
$forbiddenRawContextHits = & rg -n 'CultMesh\.(operationContext|queryContext)\(this\.runtimeId' Electron/aetheria-cultmesh.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: RTS client still constructs raw runtime-id contexts instead of using the shared Verse primitive.`n$forbiddenRawContextHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for raw context checks."
}
if (-not $clientText.Contains('projectionDiagnostics()')) {
Write-Error "Stage 7B verifier failed: RTS client does not expose generated projection diagnostics."
}
if (-not $clientText.Contains('describeAetheriaRuntimeRtsQueryHandles(this.queries)')) {
Write-Error "Stage 7B verifier failed: RTS projection diagnostics should be read from generated query handle metadata."
}
if (-not $clientText.Contains('liveFeedDiagnostics()')) {
Write-Error "Stage 7B verifier failed: RTS client does not expose generated live feed diagnostics."
}
if (-not $clientText.Contains('describeAetheriaRuntimeRtsLiveFeedSurface(this.createViewportFeed())')) {
Write-Error "Stage 7B verifier failed: RTS live feed diagnostics should be read from generated live feed metadata."
}
if (-not $clientText.Contains('surfaceCatalogDiagnostics()')) {
Write-Error "Stage 7B verifier failed: RTS client does not expose a unified CultMesh surface catalog diagnostic."
}
if (-not $clientText.Contains('surfaceCatalogIndexDiagnostics()')) {
Write-Error "Stage 7B verifier failed: RTS client does not expose a grouped CultMesh surface catalog diagnostic."
}
if (-not $clientText.Contains('CultMesh.surfaceCatalogIndex(this.surfaceCatalogDiagnostics())')) {
Write-Error "Stage 7B verifier failed: RTS grouped surface catalog should use the shared CultMesh catalog index primitive."
}
if (-not $clientText.Contains('describeAetheriaRuntimeRtsSurfaceCatalog(this.queries, this.operations, this.statePointers)')) {
Write-Error "Stage 7B verifier failed: RTS surface catalog should be read from generated query, operation, and state pointer metadata."
}
$forbiddenDirectClientOperationHits = & rg -n 'operations\.set(MoveVector|Target)\.invoke' Electron/aetheria-cultmesh.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: RTS client still invokes operation handles directly instead of generated domain sugar.`n$forbiddenDirectClientOperationHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for direct operation handle checks."
}
if (-not $clientText.Contains('CultMesh.liveFeed<AetheriaRuntimeViewportFeedRequest, AetheriaRuntimeViewportFeedSnapshot>')) {
Write-Error "Stage 7B verifier failed: RTS viewport feed should use the shared CultMesh live feed primitive."
}
$requiredGeneratedPreloadSymbols = @(
'<auto-generated',
'channels.mapViewport',
'channels.objectsViewport',
'channels.gravityViewport',
'watchViewportFeed',
'channels.viewportFeedUpdate',
'channels.viewportFeedStop',
'channels.setMoveVector',
'channels.setTarget',
'channels.surfaceCatalog',
'channels.surfaceCatalogIndex'
)
foreach ($symbol in $requiredGeneratedPreloadSymbols) {
& rg -F -q $symbol Electron/preload.cjs
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: expected generated preload symbol '$symbol' was not found."
}
}
$forbiddenMainIpcStringHits = & rg -n 'ipcMain\.handle\("aetheria-rts:' Electron/main.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: Electron main still registers raw RTS IPC channel strings.`n$forbiddenMainIpcStringHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for raw Electron main IPC checks."
}
$forbiddenMainGeneratedHandlerMirrors = @(
'AetheriaRtsIpcChannels\.mapViewport',
'AetheriaRtsIpcChannels\.objectsViewport',
'AetheriaRtsIpcChannels\.setMoveVector'
)
$forbiddenMainGeneratedHandlerPattern = ($forbiddenMainGeneratedHandlerMirrors -join '|')
$forbiddenMainGeneratedHandlerHits = & rg -n $forbiddenMainGeneratedHandlerPattern Electron/main.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: Electron main still mirrors generated IPC handler registration.`n$forbiddenMainGeneratedHandlerHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for generated IPC handler mirror checks."
}
& rg -q 'registerAetheriaRtsIpcHandlers' Electron/main.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: Electron main is not using generated RTS IPC handler registration."
}
$forbiddenClientDirectProjectionReturns = @(
'return projectSelectedObjectFromFrame',
'return projectInventoryFromFrame',
'return projectDaemonHealth',
'return projectAuthorityStatus',
'return projectStarbridgeSessionSummary'
)
$forbiddenClientDirectProjectionPattern = ($forbiddenClientDirectProjectionReturns -join '|')
$forbiddenClientDirectProjectionHits = & rg -n $forbiddenClientDirectProjectionPattern Electron/aetheria-cultmesh.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: RTS client read methods bypass generated query handles.`n$forbiddenClientDirectProjectionHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for direct projection return checks."
}
$requiredRendererContractSymbols = @(
'export type AetheriaRtsApi',
'export type ViewportResponse',
'export type ObjectsViewportResponse',
'export type GravityViewportResponse',
'export type AetheriaRuntimeViewportFeedRequest',
'export type AetheriaRuntimeViewportFeedSnapshot',
'watchViewportFeed',
'export type AetheriaRuntimeSetMoveVectorRequest',
'export type AetheriaRuntimeSetTargetRequest'
)
foreach ($symbol in $requiredRendererContractSymbols) {
& rg -q $symbol Client/aetheria-rts-contract.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: expected generated renderer contract symbol '$symbol' was not found."
}
}
$forbiddenRendererAppPatterns = @(
'^type ViewportResponse =',
'^type ObjectsViewportResponse =',
'^type GravityViewportResponse =',
'^type AetheriaRtsApi =',
'^type ViewObject =',
'^type InventoryItem ='
)
$forbiddenRendererAppPattern = ($forbiddenRendererAppPatterns -join '|')
$forbiddenRendererAppHits = & rg -n $forbiddenRendererAppPattern Client/app.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: renderer still owns duplicated RTS contract types.`n$forbiddenRendererAppHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for duplicated renderer contract checks."
}
$forbiddenRendererPollingHits = & rg -n 'setInterval|objectsViewport\(viewport\)|gravityViewport\(viewport\)' Client/app.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: renderer still owns the RTS viewport polling loop instead of subscribing to the generated feed.`n$forbiddenRendererPollingHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for renderer polling checks."
}
& rg -q 'watchViewportFeed' Client/app.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: renderer is not subscribing to the generated viewport feed."
}
$forbiddenBindingPatterns = @(
'decodeViewportDocument',
'viewportRecordKey',
'aetheriaRuntimeRtsViewportDocumentSlots',
'aetheriaRuntimeRtsViewportObjectSlots',
'^export type ViewportResponse =',
'^export type ObjectsViewportResponse =',
'^export type GravityViewportResponse =',
'^export type ViewObject =',
'^export type InventoryItem =',
'^export type SelectedObjectRequest ='
)
$forbiddenBindingPattern = ($forbiddenBindingPatterns -join '|')
$forbiddenBindingHits = & rg -n $forbiddenBindingPattern Electron/aetheria-rts-bindings.ts 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Error "Stage 7B verifier failed: stale remote viewport decoder surface still exists in RTS bindings.`n$forbiddenBindingHits"
}
if ($LASTEXITCODE -gt 1) {
Write-Error "Stage 7B verifier could not run rg for stale binding checks."
}
& rg -q 'projectViewportFromFrame' Electron/aetheria-rts-local-projection.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: local RTS frame projection entry point was not found."
}
$requiredProjectionSymbols = @(
'projectObjectsViewportFromFrame',
'projectGravityViewportFromFrame',
'AetheriaRtsSchemas.objectsViewport',
'AetheriaRtsSchemas.gravityViewport',
'projectSelectedObjectFromFrame',
'projectInventoryFromFrame',
'AetheriaRtsSchemas.selectedObject',
'AetheriaRtsSchemas.inventory',
'projectDaemonHealth',
'projectAuthorityStatus',
'projectStarbridgeSessionSummary',
'AetheriaRtsSchemas.starbridgeSessionSummary'
)
foreach ($symbol in $requiredProjectionSymbols) {
& rg -q $symbol Electron/aetheria-rts-local-projection.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: expected local RTS projection symbol '$symbol' was not found."
}
}
& rg -q 'SingleFileMessagePackBackingStore' Electron/aetheria-local-publication-reader.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: local CultCache publication reader was not found."
}
& rg -q 'readStarbridgeSessionSummary' Electron/aetheria-local-publication-reader.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: local Starbridge summary publication reader was not found."
}
& rg -q '.daemon.starbridge.session.cc' Electron/aetheria-local-publication-reader.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: RTS client is not reading the daemon Starbridge sidecar publication."
}
$requiredGeneratedBindingSymbols = @(
'aetheriaRuntimeDaemonCommandDocumentSlots',
'aetheriaRuntimeDaemonFrameDocumentSlots',
'aetheriaRuntimeDaemonHealthDocumentSlots',
'aetheriaRuntimeRtsViewportDocumentSlots',
'aetheriaRuntimeObjectsViewportDocumentSlots',
'aetheriaRuntimeGravityViewportDocumentSlots',
'aetheriaRuntimeSelectedObjectDocumentSlots',
'aetheriaRuntimeInventoryDocumentSlots',
'aetheriaRuntimeStarbridgeScenarioDocumentSlots',
'aetheriaRuntimeStarbridgeSessionDocumentSlots',
'aetheriaRuntimeStarbridgeSessionSummaryDocumentSlots',
'aetheriaRuntimeStarbridgeStationStockItemSlots',
'aetheriaRuntimeStarbridgeWaveDefinitionSlots',
'aetheriaRuntimeStarbridgeWaveForecastSlots',
'aetheriaRuntimeStarbridgeRuntimeRoleSlots',
'aetheriaRuntimeStarbridgeBaseStatusSlots',
'aetheriaRuntimeRtsViewportBoundsSlots',
'aetheriaRuntimeRtsViewportObjectSlots',
'aetheriaRuntimeVerseAuthorityPolicyDocumentSlots',
'aetheriaRuntimeAuthorityRuleSlots',
'aetheriaRuntimeAuthorityLeaseDocumentSlots',
'aetheriaRuntimeRunCheckpointCommitSlots',
'aetheriaRuntimeZoneSnapshotCommitSlots',
'aetheriaRuntimeEntitySnapshotCommitSlots',
'aetheriaRuntimeBodySnapshotCommitSlots',
'aetheriaRuntimeEntityStatGridCommitSlots',
'aetheriaRuntimeCargoBayLoadoutCommitSlots',
'aetheriaRuntimeLoadoutItemSlotCommitSlots',
'aetheriaRuntimeLoadoutItemCommitSlots',
'AetheriaRuntimeDaemonCommandKinds',
'AetheriaRtsSchemas'
)
foreach ($symbol in $requiredGeneratedBindingSymbols) {
& rg -q $symbol Electron/aetheria-rts-generated-bindings.ts
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7B verifier failed: expected generated RTS binding symbol '$symbol' was not found."
}
}
Write-Host "Stage 7B RTS client verifier passed."

View file

@ -0,0 +1,90 @@
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
Set-Location $root
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7C Electron shell verifier failed: RTS build failed."
}
if (-not (Get-Content wwwroot\index.html -Raw).Contains('runtime-surface-details')) {
Write-Error "Stage 7C Electron shell verifier failed: built renderer markup does not expose runtime surface diagnostics."
}
if (-not (Get-Content wwwroot\app.js -Raw).Contains('window.aetheriaRts.surfaceCatalogIndex()')) {
Write-Error "Stage 7C Electron shell verifier failed: built renderer script does not read the CultMesh surface catalog index."
}
$mainText = Get-Content Electron\main.ts -Raw
if (-not $mainText.Contains('await api.surfaceCatalog()') -or -not $mainText.Contains('await api.surfaceCatalogIndex()')) {
Write-Error "Stage 7C Electron shell verifier failed: Electron smoke does not call the preload CultMesh surface catalog APIs."
}
if (-not $mainText.Contains('runtimeSurfaceDetails.includes("shared-memory")') -or -not $mainText.Contains('daemon:aetheria.frame.latest.v1')) {
Write-Error "Stage 7C Electron shell verifier failed: Electron smoke does not verify rendered CultMesh route/source metadata."
}
if (-not $mainText.Contains('await api.setMoveVector') -or
-not $mainText.Contains('moveReceipt?.commandId') -or
-not $mainText.Contains('moveReceipt?.operationId') -or
-not $mainText.Contains('moveReceipt?.accepted') -or
-not $mainText.Contains('moveReceipt?.route')) {
Write-Error "Stage 7C Electron shell verifier failed: Electron smoke does not verify typed operation receipts through preload."
}
if (-not $mainText.Contains('AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS') -or
-not $mainText.Contains('--peer-cultmesh-endpoint') -or
-not $mainText.Contains('AETHERIA_RTS_VERSE_ID') -or
-not $mainText.Contains('--verse-id') -or
-not $mainText.Contains('AETHERIA_RTS_DAEMON_ID') -or
-not $mainText.Contains('--daemon-id')) {
Write-Error "Stage 7C Electron shell verifier failed: Electron launcher does not pass Verse identity and peer CultMesh endpoints into the local daemon."
}
$electron = Join-Path $root "node_modules\electron\dist\electron.exe"
if (!(Test-Path -LiteralPath $electron)) {
Write-Error "Stage 7C Electron shell verifier failed: electron.exe was not found at $electron."
}
$tempRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("aetheria-stage7c-electron-" + [Guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $tempRoot | Out-Null
$resultPath = Join-Path $tempRoot "electron-smoke-result.json"
$udp = [System.Net.Sockets.UdpClient]::new(0)
$port = ([System.Net.IPEndPoint]$udp.Client.LocalEndPoint).Port
$udp.Close()
try {
$env:AETHERIA_RTS_ELECTRON_SMOKE = "1"
$env:AETHERIA_RTS_RUNTIME_ROOT = $tempRoot
$env:AETHERIA_RTS_CULTMESH_PORT = $port.ToString()
$env:AETHERIA_RTS_VERSE_ID = "aetheria.stage7c.electron"
$env:AETHERIA_RTS_DAEMON_ID = "stage7c-starfire"
$env:AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS = "rudp://127.0.0.1:1"
$env:AETHERIA_RTS_ELECTRON_SMOKE_RESULT = $resultPath
$process = Start-Process -FilePath $electron -ArgumentList "." -WorkingDirectory $root -Wait -PassThru
if ($process.ExitCode -ne 0) {
Write-Error "Stage 7C Electron shell verifier failed: Electron exited with code $($process.ExitCode)."
}
if (!(Test-Path -LiteralPath $resultPath)) {
Write-Error "Stage 7C Electron shell verifier failed: Electron did not write a smoke result."
}
$result = Get-Content -Raw -LiteralPath $resultPath | ConvertFrom-Json
if ($result.ok -ne $true) {
Write-Error "Stage 7C Electron shell verifier failed: $($result.error)"
}
}
finally {
Remove-Item Env:\AETHERIA_RTS_ELECTRON_SMOKE -ErrorAction SilentlyContinue
Remove-Item Env:\AETHERIA_RTS_RUNTIME_ROOT -ErrorAction SilentlyContinue
Remove-Item Env:\AETHERIA_RTS_CULTMESH_PORT -ErrorAction SilentlyContinue
Remove-Item Env:\AETHERIA_RTS_VERSE_ID -ErrorAction SilentlyContinue
Remove-Item Env:\AETHERIA_RTS_DAEMON_ID -ErrorAction SilentlyContinue
Remove-Item Env:\AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS -ErrorAction SilentlyContinue
Remove-Item Env:\AETHERIA_RTS_ELECTRON_SMOKE_RESULT -ErrorAction SilentlyContinue
Remove-Item -LiteralPath $tempRoot -Recurse -Force -ErrorAction SilentlyContinue
}
Write-Host "Stage 7C Electron shell verifier passed."

View file

@ -0,0 +1,156 @@
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$repoRoot = Split-Path -Parent $root
Set-Location $root
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7C verifier failed: RTS build failed."
}
$tempRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("aetheria-stage7c-" + [Guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $tempRoot | Out-Null
$statePath = Join-Path $tempRoot "aetheria-rts.cc"
$endpoint = $null
try {
$daemonOutput = dotnet run --project (Join-Path $repoRoot "Aetheria.State.Daemon\Aetheria.State.Daemon.csproj") -- `
--state $statePath `
--once `
--rts-cultmesh-port 0 2>&1
$daemonOutput | Out-Host
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7C verifier failed: one-shot daemon did not complete."
}
foreach ($line in $daemonOutput) {
if ($line -match "Aetheria RTS CultMesh endpoint: (rudp://127\.0\.0\.1:\d+)") {
$endpoint = $Matches[1]
}
}
if ([string]::IsNullOrWhiteSpace($endpoint)) {
Write-Error "Stage 7C verifier failed: one-shot daemon did not report an RTS CultMesh endpoint."
}
$smokeScript = Join-Path $tempRoot "stage7c-smoke.mjs"
@'
import { pathToFileURL } from "node:url";
const statePath = process.env.AETHERIA_STAGE7C_STATE_PATH;
const endpoint = process.env.AETHERIA_STAGE7C_ENDPOINT;
const clientModulePath = process.env.AETHERIA_STAGE7C_CLIENT_MODULE;
if (!statePath || !endpoint)
throw new Error("Stage 7C verifier missing state path or endpoint.");
if (!clientModulePath)
throw new Error("Stage 7C verifier missing compiled client module path.");
const { AetheriaCultMeshClient } = await import(pathToFileURL(clientModulePath).href);
const client = new AetheriaCultMeshClient(endpoint, statePath, "stage7c-verifier");
const viewport = await client.mapViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
const objectsViewport = await client.objectsViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
const gravityViewport = await client.gravityViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
if (!Number.isFinite(viewport.frameId))
throw new Error("Viewport projection did not produce a frame id.");
if (!Array.isArray(viewport.objects) || viewport.objects.length === 0)
throw new Error("Viewport projection did not expose visible objects.");
if (objectsViewport.schema !== "gamecult.aetheria.objects_viewport.v1")
throw new Error(`Objects viewport used unexpected schema: ${objectsViewport.schema}`);
if (gravityViewport.schema !== "gamecult.aetheria.gravity_viewport.v1")
throw new Error(`Gravity viewport used unexpected schema: ${gravityViewport.schema}`);
if (!Array.isArray(objectsViewport.objects) || objectsViewport.objects.length !== viewport.objects.length)
throw new Error("Objects viewport did not match composed map object set.");
if (!Array.isArray(gravityViewport.gravityInfluences) || gravityViewport.gravityInfluences.length !== viewport.gravityInfluences.length)
throw new Error("Gravity viewport did not match composed map gravity set.");
const selectedIndex = viewport.controlledEntityIndices[0] ?? viewport.objects[0]?.entityIndex;
if (!Number.isFinite(selectedIndex))
throw new Error("No entity was available for selected-object projection.");
const selected = await client.selectedObject({ entityIndex: selectedIndex });
if (!selected.selected)
throw new Error(`Selected-object projection did not resolve entity ${selectedIndex}.`);
const inventory = await client.inventory({ entityIndex: selectedIndex });
if (!Array.isArray(inventory.equipment) || !Array.isArray(inventory.cargo))
throw new Error("Inventory projection did not return equipment and cargo arrays.");
const health = await client.daemonHealth();
if (health.status !== "healthy")
throw new Error(`Daemon health projection was not healthy: ${health.status}`);
const authority = await client.authorityStatus();
if (authority.policyId !== "aetheria.trusted-coop.v1")
throw new Error(`Unexpected authority policy id: ${authority.policyId}`);
const starbridge = await client.starbridgeSession();
if (starbridge.schema !== "gamecult.aetheria.starbridge_session_summary.v1")
throw new Error(`Unexpected Starbridge schema: ${starbridge.schema}`);
if (starbridge.scenarioName !== "Frontier Fabricator Defense")
throw new Error(`Unexpected Starbridge scenario: ${starbridge.scenarioName}`);
if (!Array.isArray(starbridge.stationStock) || !starbridge.stationStock.some(item => item.itemKey === "repair-parts"))
throw new Error("Starbridge session did not expose daemon-seeded station stock.");
if (!Array.isArray(starbridge.waveForecast) || !starbridge.waveForecast.some(wave => wave.displayName === "Scout Probe"))
throw new Error("Starbridge session did not expose daemon-seeded wave forecast.");
const surfaceCatalog = client.surfaceCatalogDiagnostics();
if (surfaceCatalog.catalogId !== "gamecult.aetheria.rts.surfaces.v1")
throw new Error(`Unexpected RTS surface catalog id: ${surfaceCatalog.catalogId}`);
if (!surfaceCatalog.surfaces.some(surface => surface.surfaceId === "gamecult.aetheria.rts.viewport_feed.v1" && surface.kind === "live-feed"))
throw new Error("RTS surface catalog did not expose the viewport live feed.");
if (!surfaceCatalog.surfaces.some(surface => surface.surfaceId === "gamecult.aetheria.pilot.set_move_vector.v1" && surface.kind === "operation"))
throw new Error("RTS surface catalog did not expose the move operation.");
if (!surfaceCatalog.surfaces.some(surface =>
surface.surfaceId === "daemon:aetheria.frame.latest.v1" &&
surface.kind === "state-pointer" &&
surface.routeHint?.kind === "shared-memory" &&
surface.sources?.some(source => source.schemaId === "gamecult.aetheria.daemon_frame.v1")))
throw new Error("RTS surface catalog did not expose the daemon frame state pointer with shared route/source metadata.");
const surfaceIndex = client.surfaceCatalogIndexDiagnostics();
if (surfaceIndex.catalogId !== surfaceCatalog.catalogId)
throw new Error("RTS surface catalog index did not preserve the catalog id.");
if (!Array.isArray(surfaceIndex.operations) || surfaceIndex.operations.length < 2)
throw new Error("RTS surface catalog index did not group operation surfaces.");
if (!Array.isArray(surfaceIndex.liveFeeds) || !surfaceIndex.liveFeeds.some(surface => surface.surfaceId === "gamecult.aetheria.rts.viewport_feed.v1"))
throw new Error("RTS surface catalog index did not group the viewport live feed.");
if (!Array.isArray(surfaceIndex.queries) || !surfaceIndex.queries.some(surface => surface.surfaceId === "gamecult.aetheria.objects_viewport.v1"))
throw new Error("RTS surface catalog index did not group generated query surfaces.");
if (!Array.isArray(surfaceIndex.statePointers) || !surfaceIndex.statePointers.some(surface => surface.surfaceId === "daemon:aetheria.frame.latest.v1"))
throw new Error("RTS surface catalog index did not group generated state pointer surfaces.");
console.log(JSON.stringify({
frameId: viewport.frameId,
visibleObjects: viewport.objects.length,
gravityInfluences: gravityViewport.gravityInfluences.length,
selectedEntityIndex: selected.selected.entityIndex,
equipmentItems: inventory.equipment.length,
cargoItems: inventory.cargo.length,
health: health.status,
policyId: authority.policyId,
starbridgeScenario: starbridge.scenarioName,
starbridgeStock: starbridge.stationStock.length,
surfaceCatalog: {
surfaces: surfaceCatalog.surfaces.length,
operations: surfaceIndex.operations.length,
queries: surfaceIndex.queries.length,
liveFeeds: surfaceIndex.liveFeeds.length,
statePointers: surfaceIndex.statePointers.length
}
}, null, 2));
'@ | Set-Content -LiteralPath $smokeScript -Encoding UTF8
$env:AETHERIA_STAGE7C_STATE_PATH = $statePath
$env:AETHERIA_STAGE7C_ENDPOINT = $endpoint
$env:AETHERIA_STAGE7C_CLIENT_MODULE = Join-Path $root "electron-dist\aetheria-cultmesh.js"
node $smokeScript
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7C verifier failed: local Electron runtime facade could not read daemon publications."
}
}
finally {
Remove-Item -LiteralPath $tempRoot -Recurse -Force -ErrorAction SilentlyContinue
}
Write-Host "Stage 7C local runtime verifier passed."

View file

@ -0,0 +1,139 @@
$ErrorActionPreference = "Stop"
$root = Split-Path -Parent $PSScriptRoot
$repoRoot = Split-Path -Parent $root
Set-Location $root
npm run build
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7D remote CultMesh verifier failed: RTS build failed."
}
$daemonProject = Join-Path $repoRoot "Aetheria.State.Daemon\Aetheria.State.Daemon.csproj"
dotnet build $daemonProject -v:minimal
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7D remote CultMesh verifier failed: daemon build failed."
}
$tempRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("aetheria-stage7d-remote-" + [Guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $tempRoot | Out-Null
$statePath = Join-Path $tempRoot "aetheria-raven.cc"
$daemonOut = Join-Path $tempRoot "daemon.out.log"
$daemonErr = Join-Path $tempRoot "daemon.err.log"
$port = Get-Random -Minimum 41000 -Maximum 64000
$endpoint = "rudp://127.0.0.1:$port"
$daemon = $null
try {
$daemon = Start-Process -FilePath "dotnet" -ArgumentList @(
"run",
"--no-build",
"--project",
$daemonProject,
"--",
"--state",
$statePath,
"--rts-cultmesh-host",
"127.0.0.1",
"--rts-cultmesh-port",
$port,
"--tick-interval-ms",
"20",
"--fixed-delta-ms",
"20",
"--api-publication-interval-ms",
"100000"
) -RedirectStandardOutput $daemonOut -RedirectStandardError $daemonErr -WindowStyle Hidden -PassThru
$deadline = (Get-Date).AddSeconds(40)
while ((Get-Date) -lt $deadline) {
if ($daemon.HasExited) {
Write-Error "Stage 7D remote CultMesh verifier failed: daemon exited early ($($daemon.ExitCode)).`n$(Get-Content $daemonErr -Raw)`n$(Get-Content $daemonOut -Raw)"
}
if ((Test-Path $daemonOut) -and ((Get-Content $daemonOut -Raw) -match "Aetheria Verse daemon published frame")) {
break
}
Start-Sleep -Milliseconds 250
}
if (-not (Test-Path $daemonOut) -or -not ((Get-Content $daemonOut -Raw) -match "Aetheria Verse daemon published frame")) {
Write-Error "Stage 7D remote CultMesh verifier failed: daemon did not publish a frame.`n$(if (Test-Path $daemonOut) { Get-Content $daemonOut -Raw })"
}
$smokeScript = Join-Path $tempRoot "remote-smoke.mjs"
@'
import { pathToFileURL } from "node:url";
const endpoint = process.env.AETHERIA_STAGE7D_REMOTE_ENDPOINT;
const clientModulePath = process.env.AETHERIA_STAGE7D_REMOTE_CLIENT_MODULE;
if (!endpoint)
throw new Error("Stage 7D verifier missing remote endpoint.");
if (!clientModulePath)
throw new Error("Stage 7D verifier missing compiled client module path.");
const { AetheriaCultMeshClient } = await import(pathToFileURL(clientModulePath).href);
const client = new AetheriaCultMeshClient(endpoint, "unused-local-state.cc", "stage7d-starfire", {
publicationMode: "remote",
snapshotTimeoutMs: 5000,
});
try {
await client.waitForFrame(15000);
const viewport = await client.mapViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
const actor = viewport.objects.find(object => object.controlled);
if (!actor)
throw new Error("Remote CultMesh viewport did not expose a controlled unit.");
const health = await client.daemonHealth();
const authority = await client.authorityStatus();
const starbridge = await client.starbridgeSession();
const receipt = await client.setMoveVector({
actorEntityKey: actor.entityKey,
directionX: 1,
directionY: 0,
scalar: 0.1,
observedFrameId: viewport.frameId,
});
if (health.status !== "healthy")
throw new Error(`Unexpected daemon health ${health.status}.`);
if (authority.policyId !== "aetheria.trusted-coop.v1")
throw new Error(`Unexpected authority policy ${authority.policyId}.`);
if (starbridge.scenarioName !== "Frontier Fabricator Defense")
throw new Error(`Unexpected Starbridge scenario ${starbridge.scenarioName}.`);
if (!receipt.accepted)
throw new Error(`Remote setMoveVector was rejected: ${receipt.diagnostic ?? "no diagnostic"}`);
console.log(JSON.stringify({
endpoint,
frameId: viewport.frameId,
visibleObjects: viewport.objects.length,
health: health.status,
policyId: authority.policyId,
starbridgeScenario: starbridge.scenarioName,
operationId: receipt.operationId,
}, null, 2));
} finally {
await client.close();
}
'@ | Set-Content -LiteralPath $smokeScript -Encoding UTF8
$env:AETHERIA_STAGE7D_REMOTE_ENDPOINT = $endpoint
$env:AETHERIA_STAGE7D_REMOTE_CLIENT_MODULE = Join-Path $root "electron-dist\aetheria-cultmesh.js"
node $smokeScript
if ($LASTEXITCODE -ne 0) {
Write-Error "Stage 7D remote CultMesh verifier failed: remote RTS client could not read or command the daemon over CultMesh."
}
}
finally {
Remove-Item Env:\AETHERIA_STAGE7D_REMOTE_ENDPOINT -ErrorAction SilentlyContinue
Remove-Item Env:\AETHERIA_STAGE7D_REMOTE_CLIENT_MODULE -ErrorAction SilentlyContinue
if ($daemon -and -not $daemon.HasExited) {
Stop-Process -Id $daemon.Id -Force
}
Remove-Item -LiteralPath $tempRoot -Recurse -Force -ErrorAction SilentlyContinue
}
Write-Host "Stage 7D remote CultMesh verifier passed."