@cyberart-io/engine 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -540,9 +540,17 @@ type SnapshotIntegrity = {
540
540
  alg: string;
541
541
  hash: string;
542
542
  };
543
+ type SnapshotSignatureRef = {
544
+ id: string;
545
+ alg: string;
546
+ };
543
547
  type SnapshotProvenance = {
544
548
  source?: string;
545
549
  integrity?: SnapshotIntegrity;
550
+ publisher?: string;
551
+ version?: string;
552
+ signature?: SnapshotSignatureRef;
553
+ grants?: string[];
546
554
  };
547
555
  type SnapshotEnvelope = {
548
556
  schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;
@@ -634,7 +642,7 @@ declare function engineStateFromEnvelope(snapshot: SnapshotEnvelope): CartStateB
634
642
 
635
643
  declare const ASSET_KINDS: readonly ["image", "audio", "font", "spritesheet"];
636
644
  type AssetKind = (typeof ASSET_KINDS)[number];
637
- declare const ASSET_FAILURE_CODES: readonly ["timeout", "cors", "not-found", "invalid", "aborted", "resolver"];
645
+ declare const ASSET_FAILURE_CODES: readonly ["timeout", "cors", "not-found", "invalid", "aborted", "resolver", "undeclared", "hash-mismatch", "unsigned"];
638
646
  type AssetFailureCode = (typeof ASSET_FAILURE_CODES)[number];
639
647
  type AssetCorsMode = 'anonymous' | 'use-credentials' | 'omit';
640
648
  /** Logical silent placeholder. Carts/hosts may treat it as “no media”. */
@@ -775,6 +783,26 @@ declare function assetStatusEvent(status: 'ready' | 'failed', payload: {
775
783
  declare function rewriteHostedAssetRef(ref: string, cdnBase: string): string;
776
784
  declare function createFixtureAssetResolver(catalog: FixtureAssetCatalog): AssetResolver;
777
785
  declare function createHostedAssetResolver(options: HostedAssetResolverOptions): AssetResolver;
786
+ type DeclaredAssetBytes = {
787
+ url: string;
788
+ hash: string;
789
+ alg?: 'sha256';
790
+ };
791
+ type DeclaredAssetResolverOptions = {
792
+ /** Logical refs this cart may load. Unknown refs fail `undeclared`. */
793
+ declared: Readonly<Record<string, DeclaredAssetBytes>>;
794
+ /**
795
+ * Byte source keyed by declared URL. Tests inject a map. Missing bytes
796
+ * fail `unsigned`. The resolver does not call ambient `fetch`.
797
+ */
798
+ fetchBytes: (url: string) => Promise<Uint8Array | undefined>;
799
+ hashBytes?: (bytes: Uint8Array) => Promise<string>;
800
+ };
801
+ /**
802
+ * Resolve only declared asset refs. Bytes must match the declared hash.
803
+ * Unsigned or mismatched payloads fail closed.
804
+ */
805
+ declare function createDeclaredAssetResolver(options: DeclaredAssetResolverOptions): AssetResolver;
778
806
  declare function createAssetPreloader(options: CreateAssetPreloaderOptions): AssetPreloader;
779
807
 
780
808
  declare const DEFAULT_DUCK_GAIN = 0.25;
@@ -1594,6 +1622,9 @@ declare const CAPABILITY_CLEAR_POLICIES: readonly ["transparent", "opaque"];
1594
1622
  type CapabilityClearPolicy = (typeof CAPABILITY_CLEAR_POLICIES)[number];
1595
1623
  declare const CAPABILITY_CART_KINDS: readonly ["render", "calculation"];
1596
1624
  type CapabilityCartKind = (typeof CAPABILITY_CART_KINDS)[number];
1625
+ /** Device/host grants a remote cart may request. Omitted on existing manifests. */
1626
+ declare const CAPABILITY_DEVICE_GRANTS: readonly ["audio", "controller", "network", "persistence", "fullscreen"];
1627
+ type CapabilityDeviceGrant = (typeof CAPABILITY_DEVICE_GRANTS)[number];
1597
1628
  type CapabilityDiagnostic = {
1598
1629
  code: string;
1599
1630
  detail: string;
@@ -1650,6 +1681,8 @@ type CapabilityManifest = {
1650
1681
  modules?: CapabilityModuleRequirements;
1651
1682
  /** Omitted means `'render'`. `'calculation'` carts have no surface. */
1652
1683
  kind?: CapabilityCartKind;
1684
+ /** Optional device grants (CYB-74). Omitted on existing manifests. */
1685
+ grants?: CapabilityDeviceGrant[];
1653
1686
  };
1654
1687
  type CapabilityManifestInput = {
1655
1688
  version?: number;
@@ -1666,6 +1699,7 @@ type CapabilityManifestInput = {
1666
1699
  layers?: CapabilityLayerRequirements;
1667
1700
  modules?: CapabilityModuleRequirements;
1668
1701
  kind?: CapabilityCartKind;
1702
+ grants?: CapabilityDeviceGrant[];
1669
1703
  };
1670
1704
  type HostCapabilities = {
1671
1705
  contractVersion: number;
@@ -1681,6 +1715,11 @@ type HostCapabilities = {
1681
1715
  modules?: CapabilityModuleRequirements;
1682
1716
  /** Cart kinds this host can run. Omitted: kind is not checked. */
1683
1717
  kinds?: CapabilityCartKind[];
1718
+ /**
1719
+ * Device grants this host is willing to give. Omitted is treated as an
1720
+ * empty set (deny-by-default) when the cart listed `grants`.
1721
+ */
1722
+ grants?: CapabilityDeviceGrant[];
1684
1723
  };
1685
1724
  type DefineCapabilityManifestResult = {
1686
1725
  ok: true;
@@ -1875,6 +1914,8 @@ declare function validateGeometry(doc: GeometryDocument): GeometryValidation;
1875
1914
  declare function drawGeometryDebug(ctx: GeometryDebugContext, layout: PresentationLayout, doc: GeometryDocument, diagnostics?: readonly GeometryDiagnostic[]): DebugDrawCall[];
1876
1915
  declare function serializeGeometry(doc: GeometryDocument): string;
1877
1916
  declare function parseGeometry(json: string): GeometryDocument;
1917
+ /** True when the normalized point is inside the hitbox rect or polygon. */
1918
+ declare function pointInHitbox(region: GeometryHitbox, point: NormalizedPoint): boolean;
1878
1919
 
1879
1920
  /**
1880
1921
  * Copyright (c) 2026 Aaron Boyarsky
@@ -1945,10 +1986,14 @@ type RuntimeGroupParticipantInspect = {
1945
1986
  emit: string[];
1946
1987
  subscribe: string[];
1947
1988
  authoritative: boolean;
1989
+ /** True when the group skips this slot on `step` (portal parent suspend). */
1990
+ suspended: boolean;
1948
1991
  };
1949
1992
  type RuntimeGroupDiagnostics = {
1950
1993
  paused: boolean;
1951
1994
  participantIds: string[];
1995
+ /** Participants skipped by `step` until `resumeParticipant`. Sorted. */
1996
+ suspendedIds: string[];
1952
1997
  clocks: Record<string, ClockSnapshot>;
1953
1998
  rejections: unknown[];
1954
1999
  };
@@ -1980,6 +2025,13 @@ type RuntimeGroup = {
1980
2025
  resize(width: number, height: number): void;
1981
2026
  /** Tear down one participant without destroying the group or blanking siblings. */
1982
2027
  detach(id: string): void;
2028
+ /**
2029
+ * Pause this cart's live loop and skip it on group `step`. Snapshot-safe
2030
+ * state is retained. Used by portal lifecycle; does not pause siblings.
2031
+ */
2032
+ suspendParticipant(id: string): void;
2033
+ resumeParticipant(id: string): void;
2034
+ isParticipantSuspended(id: string): boolean;
1983
2035
  dispatch(participantId: string, event: HostEvent): void;
1984
2036
  publish(event: EventInput, extras?: PublishExtras): EventEnvelope | undefined;
1985
2037
  inspectParticipants(): Array<RouterParticipantInspect & {
@@ -1990,184 +2042,1450 @@ type RuntimeGroup = {
1990
2042
  };
1991
2043
  declare function createRuntimeGroup(options: CreateRuntimeGroupOptions): RuntimeGroup;
1992
2044
 
1993
- declare const REPLAY_INSPECTOR_SCHEMA_VERSION: 1;
1994
- declare const DEFAULT_MAX_INSPECTOR_RECORDS = 512;
1995
- declare const REDACTED_VALUE = "[REDACTED]";
1996
- type ReplayTraceFilter = {
1997
- types?: string[];
1998
- sources?: string[];
1999
- outcomes?: RouterDecisionOutcome[];
2000
- correlationId?: string;
2045
+ /**
2046
+ * Copyright (c) 2026 Aaron Boyarsky
2047
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2048
+ * See packages/engine/LICENSE
2049
+ *
2050
+ * Trusted, versioned executable-module host. Factories are registered by
2051
+ * exact id+version; the host allowlists which refs may load. Untrusted
2052
+ * source strings are not compiled. Per-module failures do not stop siblings.
2053
+ */
2054
+ declare const EXECUTABLE_MODULE_ERROR_CODES: readonly ["invalid-ref", "unknown-module", "version-mismatch", "not-allowlisted", "load-failed", "invoke-failed", "timeout", "rate-limited", "destroyed"];
2055
+ type ExecutableModuleErrorCode = (typeof EXECUTABLE_MODULE_ERROR_CODES)[number];
2056
+ type ExecutableModuleRef = {
2057
+ id: string;
2058
+ version: string;
2001
2059
  };
2002
- type CreateReplayInspectorOptions = {
2003
- redactedKeys?: string[];
2004
- maxRecords?: number;
2005
- /** Optional contracts so records can include payload schema version. */
2006
- registry?: Pick<ContractRegistry, 'get'>;
2060
+ type ExecutableModuleError = {
2061
+ code: ExecutableModuleErrorCode;
2062
+ detail: string;
2063
+ ref?: ExecutableModuleRef;
2007
2064
  };
2008
- type InspectorRecord = {
2009
- index: number;
2065
+ type ExecutableModuleDiagnostic = ExecutableModuleError;
2066
+ type ExecutableModuleCapabilities = {
2067
+ readonly [key: string]: unknown;
2068
+ };
2069
+ type ExecutableModuleInvokeContext = {
2070
+ signal: AbortSignal;
2010
2071
  turn: number;
2011
- time: number;
2012
- outcome: RouterDecisionOutcome;
2013
- reason?: RouterDecisionReason;
2014
- detail?: string;
2015
- source: string;
2016
- target?: string;
2017
- type: string;
2018
- kind?: EventKind;
2019
- envelopeId?: string;
2020
- priorEnvelopeId?: string;
2021
- correlationId?: string;
2022
- causationId?: string;
2023
- hops?: number;
2024
- seq?: number;
2025
- idempotencyKey?: string;
2026
- schemaVersion?: number;
2027
- payloadSchemaVersion?: number;
2028
- deliveredTo: string[];
2029
- payload?: unknown;
2030
2072
  };
2031
- type CausationTreeNode = {
2032
- envelopeId?: string;
2033
- type: string;
2034
- source: string;
2035
- outcome: RouterDecisionOutcome;
2036
- reason?: RouterDecisionReason;
2037
- children: CausationTreeNode[];
2073
+ type ExecutableModuleInstance = {
2074
+ invoke(input: unknown, context: ExecutableModuleInvokeContext): unknown | Promise<unknown>;
2075
+ destroy?: () => void;
2038
2076
  };
2039
- type ReplayParticipantSummary = {
2077
+ type ExecutableModuleFactory = (capabilities: ExecutableModuleCapabilities) => ExecutableModuleInstance;
2078
+ type ExecutableModuleRegistration = {
2040
2079
  id: string;
2041
- kind?: RuntimeGroupKind;
2042
- emit: string[];
2043
- subscribe: string[];
2044
- authoritative: boolean;
2045
- seed?: string;
2046
- clock?: ClockSnapshot;
2047
- state?: unknown;
2048
- errorCount: number;
2049
- lastError?: string;
2080
+ version: string;
2081
+ create: ExecutableModuleFactory;
2082
+ capabilities?: ExecutableModuleCapabilities;
2050
2083
  };
2051
- type ReplayInspectorReport = {
2052
- schemaVersion: typeof REPLAY_INSPECTOR_SCHEMA_VERSION;
2053
- participants: ReplayParticipantSummary[];
2054
- records: InspectorRecord[];
2055
- trees: CausationTreeNode[];
2056
- dropped: number;
2084
+ type ExecutableModuleLimits = {
2085
+ /** Cooperative timeout; the invoke AbortSignal aborts after this many ms. */
2086
+ maxInvokeMs?: number;
2087
+ maxInvokesPerTurn?: number;
2057
2088
  };
2058
- type ReplayTapeAction = {
2059
- kind: 'publish';
2060
- event: EventInput;
2061
- extras?: PublishExtras;
2062
- } | {
2063
- kind: 'dispatch';
2064
- participantId: string;
2065
- event: HostEvent;
2066
- } | {
2067
- kind: 'step';
2068
- frames: number;
2069
- } | {
2070
- kind: 'asset';
2071
- participantId: string;
2072
- event: HostEvent;
2089
+ type CreateExecutableModuleHostOptions = {
2090
+ allowlist: readonly ExecutableModuleRef[];
2091
+ modules: readonly ExecutableModuleRegistration[];
2092
+ limits?: ExecutableModuleLimits;
2093
+ /** Default capability bag. Frozen per module; class instances stay shared handles. */
2094
+ capabilities?: ExecutableModuleCapabilities;
2073
2095
  };
2074
- type ReplayInspectorExport = {
2075
- schemaVersion: typeof REPLAY_INSPECTOR_SCHEMA_VERSION;
2076
- origin: number;
2077
- redactedKeys: string[];
2078
- participants: ReplayParticipantSummary[];
2079
- tape: ReplayTapeAction[];
2080
- records: InspectorRecord[];
2081
- snapshots: Record<string, unknown>;
2096
+ type ExecutableModuleInvokeResult = {
2097
+ ok: true;
2098
+ value: unknown;
2099
+ } | {
2100
+ ok: false;
2101
+ error: ExecutableModuleError;
2082
2102
  };
2083
- type ReplayCompareResult = {
2103
+ type ExecutableModuleLoadResult = {
2084
2104
  ok: true;
2105
+ ref: ExecutableModuleRef;
2085
2106
  } | {
2086
2107
  ok: false;
2087
- detail: string;
2108
+ error: ExecutableModuleError;
2088
2109
  };
2089
- type BoundReplaySession = {
2090
- publish(event: EventInput, extras?: PublishExtras): EventEnvelope | undefined;
2091
- dispatch(participantId: string, event: HostEvent): void;
2092
- step(frames?: number): Promise<void>;
2093
- report(): Promise<ReplayInspectorReport>;
2094
- exportTrace(filter?: ReplayTraceFilter): Promise<ReplayInspectorExport>;
2095
- unbind(): void;
2110
+ type ExecutableModuleHostInspect = {
2111
+ allowlist: ExecutableModuleRef[];
2112
+ registered: ExecutableModuleRef[];
2113
+ loaded: ExecutableModuleRef[];
2114
+ turn: number;
2115
+ invokesThisTurn: number;
2116
+ diagnostics: ExecutableModuleDiagnostic[];
2096
2117
  };
2097
- type ReplayInspector = {
2098
- watchRouter(router: EventRouter): () => void;
2099
- bind(group: RuntimeGroup): BoundReplaySession;
2100
- importTrace(exported: ReplayInspectorExport | string): void;
2101
- exportTrace(filter?: ReplayTraceFilter): ReplayInspectorExport;
2102
- report(filter?: ReplayTraceFilter): ReplayInspectorReport;
2103
- causationTree(correlationId?: string): CausationTreeNode[];
2104
- records(): InspectorRecord[];
2105
- reset(): void;
2118
+ type ExecutableModuleHost = {
2119
+ load(ref: ExecutableModuleRef): ExecutableModuleLoadResult;
2120
+ invoke(ref: ExecutableModuleRef, input?: unknown): Promise<ExecutableModuleInvokeResult>;
2121
+ beginTurn(): void;
2122
+ inspect(): ExecutableModuleHostInspect;
2106
2123
  destroy(): void;
2107
2124
  };
2108
- declare function compareReplayTraces(expected: InspectorRecord[], actual: InspectorRecord[]): ReplayCompareResult;
2109
- declare function createReplayInspector(options?: CreateReplayInspectorOptions): ReplayInspector;
2110
- declare function replayExportedTrace(exported: ReplayInspectorExport, group: RuntimeGroup, options?: CreateReplayInspectorOptions): Promise<{
2111
- inspector: ReplayInspector;
2112
- report: ReplayInspectorReport;
2113
- }>;
2125
+ /**
2126
+ * Deep-freeze JSON-like values so modules cannot rewrite the bag. Class
2127
+ * instances (and other non-plain objects) are passed through as host handles.
2128
+ */
2129
+ declare function freezeCapabilityBag(value: unknown): unknown;
2130
+ declare function createExecutableModuleHost(options: CreateExecutableModuleHostOptions): ExecutableModuleHost;
2114
2131
 
2115
- declare const COMPOSITOR_BLEND_MODES: readonly ["source-over", "screen"];
2116
- type CompositorBlendMode = (typeof COMPOSITOR_BLEND_MODES)[number];
2117
- declare const COMPOSITOR_CLEAR_POLICIES: readonly ["transparent", "opaque"];
2118
- type CompositorClearPolicy = (typeof COMPOSITOR_CLEAR_POLICIES)[number];
2119
- type CompositorPointerEvents = 'auto' | 'none';
2120
- declare const COMPOSITOR_SOURCE_KINDS: readonly ["participant", "image", "canvas"];
2121
- type CompositorSourceKind = (typeof COMPOSITOR_SOURCE_KINDS)[number];
2122
- type CompositorParticipantSource = {
2123
- kind: 'participant';
2132
+ /**
2133
+ * Copyright (c) 2026 Aaron Boyarsky
2134
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2135
+ * See packages/engine/LICENSE
2136
+ *
2137
+ * Signed, versioned remote-cart manifests. HMAC signatures, declared-asset
2138
+ * loads, and deny-by-default host grants. Trusted factories only — no eval.
2139
+ */
2140
+
2141
+ declare const REMOTE_CART_MANIFEST_VERSION: 1;
2142
+ declare const REMOTE_CART_SIGNATURE_ALG: "hmac-sha256";
2143
+ declare const HOST_GRANT_SNAPSHOT_SCHEMA_VERSION: 1;
2144
+ declare const REMOTE_CART_GRANTS: readonly ["audio", "controller", "network", "persistence", "fullscreen"];
2145
+ type RemoteCartGrant = CapabilityDeviceGrant;
2146
+ declare const REMOTE_CART_ERROR_CODES: readonly ["invalid-json", "invalid-manifest", "invalid-version", "invalid-signature", "unknown-publisher", "unknown-key", "undeclared-asset", "hash-mismatch", "unsigned-bytes", "capability-denied", "destroyed", "load-failed"];
2147
+ type RemoteCartErrorCode = (typeof REMOTE_CART_ERROR_CODES)[number];
2148
+ type RemoteCartDiagnostic = {
2149
+ code: RemoteCartErrorCode | string;
2150
+ detail: string;
2151
+ path?: string;
2124
2152
  };
2125
- type CompositorImageSource = {
2126
- kind: 'image';
2127
- image: ImageData;
2153
+ type RemoteCartAsset = {
2154
+ id: string;
2155
+ kind: AssetKind;
2156
+ url: string;
2157
+ hash: string;
2158
+ alg: 'sha256';
2128
2159
  };
2129
- type CompositorCanvasSource = {
2130
- kind: 'canvas';
2131
- canvas: HTMLCanvasElement;
2160
+ type RemoteCartManifestBody = {
2161
+ version: typeof REMOTE_CART_MANIFEST_VERSION;
2162
+ id: string;
2163
+ cartVersion: string;
2164
+ publisher: string;
2165
+ assets: RemoteCartAsset[];
2166
+ requestedGrants: RemoteCartGrant[];
2167
+ module?: ExecutableModuleRef;
2168
+ capabilities?: CapabilityManifest;
2169
+ };
2170
+ type RemoteCartSignature = {
2171
+ alg: typeof REMOTE_CART_SIGNATURE_ALG;
2172
+ keyId: string;
2173
+ mac: string;
2174
+ };
2175
+ type SignedRemoteCartManifest = {
2176
+ body: RemoteCartManifestBody;
2177
+ signature: RemoteCartSignature;
2178
+ };
2179
+ type DefineRemoteCartResult = {
2180
+ ok: true;
2181
+ manifest: SignedRemoteCartManifest;
2182
+ } | {
2183
+ ok: false;
2184
+ errors: RemoteCartDiagnostic[];
2132
2185
  };
2133
- type CompositorLayerSource = CompositorParticipantSource | CompositorImageSource | CompositorCanvasSource;
2134
- type CompositorClip = {
2135
- x: number;
2136
- y: number;
2137
- width: number;
2138
- height: number;
2186
+ type VerifyRemoteCartResult = {
2187
+ ok: true;
2188
+ manifest: SignedRemoteCartManifest;
2189
+ } | {
2190
+ ok: false;
2191
+ errors: RemoteCartDiagnostic[];
2139
2192
  };
2140
- type CompositorLayerConfig = {
2193
+ type RemoteCartLoadSource = {
2194
+ kind: 'registry';
2141
2195
  id: string;
2142
- order: number;
2143
- visible?: boolean;
2144
- opacity?: number;
2145
- blend?: CompositorBlendMode;
2146
- clip?: CompositorClip;
2147
- pointerEvents?: CompositorPointerEvents;
2148
- clearPolicy?: CompositorClearPolicy;
2149
- /**
2150
- * Pixel source. Default `participant` reads the runtime-group canvas.
2151
- * `image` / `canvas` swap atomically via `setLayer` / `addLayer`.
2152
- */
2153
- source?: CompositorLayerSource;
2196
+ } | {
2197
+ kind: 'url';
2198
+ url: string;
2154
2199
  };
2155
- type CompositorLayerInspect = {
2156
- id: string;
2157
- order: number;
2158
- visible: boolean;
2159
- opacity: number;
2160
- blend: CompositorBlendMode;
2161
- clip: CompositorClip | null;
2162
- pointerEvents: CompositorPointerEvents;
2163
- clearPolicy: CompositorClearPolicy;
2164
- sourceKind: CompositorSourceKind;
2200
+ type RemoteCartFetchAdapter = (url: string) => Promise<unknown>;
2201
+ type RemoteCartRegistry = {
2202
+ get(id: string): SignedRemoteCartManifest | undefined;
2165
2203
  };
2166
- type CompositorHostOptions = {
2167
- /** Back-layer pixels. Scaled nearest-neighbor to the compositor viewport. */
2168
- image?: ImageData;
2169
- /** Opaque CSS `#rgb` / `#rrggbb` fill when `image` is omitted. */
2170
- color?: string;
2204
+ type HostGrantSnapshot = {
2205
+ schemaVersion: typeof HOST_GRANT_SNAPSHOT_SCHEMA_VERSION;
2206
+ grants: RemoteCartGrant[];
2207
+ };
2208
+ type HostGrantRestoreResult = {
2209
+ ok: true;
2210
+ grants: RemoteCartGrant[];
2211
+ } | {
2212
+ ok: false;
2213
+ errors: RemoteCartDiagnostic[];
2214
+ };
2215
+ type HostGrantSet = {
2216
+ grant(capability: RemoteCartGrant): HostGrantRestoreResult;
2217
+ revoke(capability: RemoteCartGrant): HostGrantRestoreResult;
2218
+ has(capability: RemoteCartGrant): boolean;
2219
+ list(): RemoteCartGrant[];
2220
+ inspect(): HostGrantSnapshot;
2221
+ restore(input: unknown): HostGrantRestoreResult;
2222
+ };
2223
+ declare class RemoteCartCapabilityError extends Error {
2224
+ readonly code: "capability-denied";
2225
+ readonly grant: RemoteCartGrant;
2226
+ constructor(grant: RemoteCartGrant, api: string);
2227
+ }
2228
+ type RemoteCartNetworkApi = {
2229
+ fetch(url: string): Promise<Uint8Array>;
2230
+ };
2231
+ type RemoteCartStorageApi = {
2232
+ getItem(key: string): string | null;
2233
+ setItem(key: string, value: string): void;
2234
+ removeItem(key: string): void;
2235
+ clear(): void;
2236
+ };
2237
+ type RemoteCartDeviceApi = {
2238
+ request(): {
2239
+ ok: true;
2240
+ };
2241
+ };
2242
+ type RemoteCartCapabilityBag = ExecutableModuleCapabilities & {
2243
+ grants: readonly RemoteCartGrant[];
2244
+ network: RemoteCartNetworkApi;
2245
+ storage: RemoteCartStorageApi;
2246
+ audio: RemoteCartDeviceApi;
2247
+ controller: RemoteCartDeviceApi;
2248
+ fullscreen: RemoteCartDeviceApi;
2249
+ };
2250
+ type RemoteCartInspect = {
2251
+ id: string;
2252
+ cartVersion: string;
2253
+ publisher: string;
2254
+ signature: {
2255
+ id: string;
2256
+ alg: string;
2257
+ };
2258
+ requestedGrants: RemoteCartGrant[];
2259
+ grants: RemoteCartGrant[];
2260
+ assets: Array<{
2261
+ id: string;
2262
+ url: string;
2263
+ hash: string;
2264
+ }>;
2265
+ loaded: boolean;
2266
+ destroyed: boolean;
2267
+ diagnostics: RemoteCartDiagnostic[];
2268
+ };
2269
+ type RemoteCartSandbox = {
2270
+ listRequestedGrants(): RemoteCartGrant[];
2271
+ grants: HostGrantSet;
2272
+ loadAssets(): Promise<{
2273
+ ok: true;
2274
+ snapshot: AssetPreloadSnapshot;
2275
+ } | {
2276
+ ok: false;
2277
+ errors: RemoteCartDiagnostic[];
2278
+ }>;
2279
+ capabilities(): RemoteCartCapabilityBag | {
2280
+ ok: false;
2281
+ errors: RemoteCartDiagnostic[];
2282
+ };
2283
+ inspect(): RemoteCartInspect;
2284
+ snapshotProvenance(): SnapshotProvenance;
2285
+ destroy(): void;
2286
+ };
2287
+ type CreateRemoteCartSandboxOptions = {
2288
+ manifest: SignedRemoteCartManifest;
2289
+ /** Host HMAC secrets keyed by `signature.keyId`. Sandbox re-verifies before load. */
2290
+ keys: Readonly<Record<string, string>>;
2291
+ grants?: Iterable<RemoteCartGrant>;
2292
+ bytesByUrl: Readonly<Record<string, Uint8Array>>;
2293
+ modules?: readonly ExecutableModuleRegistration[];
2294
+ };
2295
+ type LoadRemoteCartOptions = {
2296
+ source: RemoteCartLoadSource;
2297
+ keys: Readonly<Record<string, string>>;
2298
+ registry?: RemoteCartRegistry;
2299
+ fetch?: RemoteCartFetchAdapter;
2300
+ expectedVersion?: string;
2301
+ };
2302
+ declare function sha256Hex(data: Uint8Array | string): Promise<string>;
2303
+ declare function hmacSha256Hex(secret: string, message: string): Promise<string>;
2304
+ declare function canonicalizeRemoteCartBody(body: RemoteCartManifestBody): string;
2305
+ declare function defineRemoteCartManifest(input: unknown): DefineRemoteCartResult;
2306
+ declare function parseRemoteCartManifest(json: string | unknown): DefineRemoteCartResult;
2307
+ declare function signRemoteCartManifest(bodyInput: unknown, secret: string, keyId: string): Promise<DefineRemoteCartResult>;
2308
+ declare function verifyRemoteCartSignature(signed: unknown, keys: Readonly<Record<string, string>>, expectedVersion?: string): Promise<VerifyRemoteCartResult>;
2309
+ declare function createRemoteCartRegistry(entries: Readonly<Record<string, SignedRemoteCartManifest | string>>): RemoteCartRegistry;
2310
+ declare function loadRemoteCart(options: LoadRemoteCartOptions): Promise<VerifyRemoteCartResult>;
2311
+ declare function listRequestedRemoteCartGrants(manifest: SignedRemoteCartManifest): RemoteCartGrant[];
2312
+ declare function createHostGrantSet(initial?: Iterable<RemoteCartGrant>): HostGrantSet;
2313
+ declare function remoteCartProvenanceForSnapshot(manifest: SignedRemoteCartManifest, grants: readonly RemoteCartGrant[]): SnapshotProvenance;
2314
+ declare function createRemoteCartSandbox(options: CreateRemoteCartSandboxOptions): RemoteCartSandbox;
2315
+
2316
+ /**
2317
+ * Copyright (c) 2026 Aaron Boyarsky
2318
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2319
+ * See packages/engine/LICENSE
2320
+ *
2321
+ * Universal portal/experience lifecycle: enter another cart exclusively,
2322
+ * suspend the parent, transfer host grants, return a versioned outcome.
2323
+ * Cabinet, painting, and other host metaphors are the same primitive.
2324
+ */
2325
+
2326
+ declare const PORTAL_LIFECYCLE_SNAPSHOT_SCHEMA_VERSION: 1;
2327
+ declare const PORTAL_OUTCOME_SCHEMA_VERSION: 1;
2328
+ declare const DEFAULT_PORTAL_MAX_DEPTH = 8;
2329
+ declare const PORTAL_METAPHORS: readonly ["cabinet", "painting", "dream", "wormhole", "book", "nested-world"];
2330
+ type PortalMetaphor = (typeof PORTAL_METAPHORS)[number];
2331
+ declare const PORTAL_OUTCOME_KINDS: readonly ["completed", "aborted"];
2332
+ type PortalOutcomeKind = (typeof PORTAL_OUTCOME_KINDS)[number];
2333
+ /** Exclusive device grants transferred for the child's lifetime. */
2334
+ declare const PORTAL_EXCLUSIVE_GRANTS: readonly ["audio", "controller", "fullscreen"];
2335
+ type PortalExclusiveGrant = (typeof PORTAL_EXCLUSIVE_GRANTS)[number];
2336
+ declare const PORTAL_ENTERED_EVENT = "portal.lifecycle.entered";
2337
+ declare const PORTAL_EXITED_EVENT = "portal.lifecycle.exited";
2338
+ declare const PORTAL_ABORTED_EVENT = "portal.lifecycle.aborted";
2339
+ declare const PORTAL_LIFECYCLE_EVENTS: readonly ["portal.lifecycle.entered", "portal.lifecycle.exited", "portal.lifecycle.aborted"];
2340
+ type PortalLifecycleEventType = (typeof PORTAL_LIFECYCLE_EVENTS)[number];
2341
+ type PortalDiagnostic = {
2342
+ code: string;
2343
+ detail: string;
2344
+ path?: string;
2345
+ };
2346
+ type PortalOutcome = {
2347
+ schemaVersion: typeof PORTAL_OUTCOME_SCHEMA_VERSION;
2348
+ kind: PortalOutcomeKind;
2349
+ payload?: unknown;
2350
+ };
2351
+ type PortalCartDeclaration = {
2352
+ id: string;
2353
+ /** Cart ids this cart may enter. */
2354
+ targets: readonly string[];
2355
+ acceptedOutcomeSchemaVersion?: number;
2356
+ emittedOutcomeSchemaVersion?: number;
2357
+ };
2358
+ type PortalEnterRequest = {
2359
+ from: string;
2360
+ to: string;
2361
+ metaphor?: PortalMetaphor;
2362
+ seed?: string;
2363
+ clock?: number;
2364
+ /** Extra grants to give the child (exclusive ones are transferred from parent). */
2365
+ grants?: readonly CapabilityDeviceGrant[];
2366
+ state?: unknown;
2367
+ persistence?: unknown;
2368
+ };
2369
+ type PortalFrameInspect = {
2370
+ id: string;
2371
+ parentId: string;
2372
+ childId: string;
2373
+ metaphor: PortalMetaphor;
2374
+ seed: string | null;
2375
+ clock: number | null;
2376
+ parentState: unknown;
2377
+ parentGrants: CapabilityDeviceGrant[];
2378
+ /** Live child grants after transfer + extras. */
2379
+ childGrants: CapabilityDeviceGrant[];
2380
+ /** Child grants before enter, used to restore and revert extras. */
2381
+ childGrantsBefore: CapabilityDeviceGrant[];
2382
+ extraChildGrants: CapabilityDeviceGrant[];
2383
+ persistence: unknown;
2384
+ transferred: PortalExclusiveGrant[];
2385
+ enterCue: typeof PORTAL_ENTERED_EVENT;
2386
+ exitCue: typeof PORTAL_EXITED_EVENT | typeof PORTAL_ABORTED_EVENT | null;
2387
+ };
2388
+ type PortalLifecycleSnapshot = {
2389
+ schemaVersion: typeof PORTAL_LIFECYCLE_SNAPSHOT_SCHEMA_VERSION;
2390
+ activeId: string | null;
2391
+ stack: PortalFrameInspect[];
2392
+ lastOutcome: PortalOutcome | null;
2393
+ cues: PortalLifecycleEventType[];
2394
+ };
2395
+ type PortalInspect = {
2396
+ destroyed: boolean;
2397
+ activeId: string | null;
2398
+ stack: PortalFrameInspect[];
2399
+ lastOutcome: PortalOutcome | null;
2400
+ cues: PortalLifecycleEventType[];
2401
+ grants: Record<string, CapabilityDeviceGrant[]>;
2402
+ };
2403
+ type PortalMutationResult = {
2404
+ ok: true;
2405
+ inspect: PortalInspect;
2406
+ outcome?: PortalOutcome;
2407
+ } | {
2408
+ ok: false;
2409
+ errors: PortalDiagnostic[];
2410
+ };
2411
+ type RestorePortalResult = {
2412
+ ok: true;
2413
+ snapshot: PortalLifecycleSnapshot;
2414
+ } | {
2415
+ ok: false;
2416
+ errors: PortalDiagnostic[];
2417
+ };
2418
+ type CreatePortalLifecycleOptions = {
2419
+ group?: RuntimeGroup;
2420
+ /** Per-participant grant sets. Missing ids get an empty HostGrantSet. */
2421
+ grants?: Readonly<Record<string, HostGrantSet>>;
2422
+ audioBroker?: AudioBroker;
2423
+ declarations?: readonly PortalCartDeclaration[];
2424
+ rootId?: string;
2425
+ maxDepth?: number;
2426
+ createId?: () => string;
2427
+ };
2428
+ type PortalLifecycle = {
2429
+ enter(request: PortalEnterRequest): PortalMutationResult;
2430
+ exit(payload?: unknown): PortalMutationResult;
2431
+ abort(payload?: unknown): PortalMutationResult;
2432
+ stack(): PortalFrameInspect[];
2433
+ activeId(): string | null;
2434
+ inspect(): PortalInspect;
2435
+ snapshot(): PortalLifecycleSnapshot;
2436
+ restore(input: unknown): RestorePortalResult;
2437
+ grantsOf(participantId: string): HostGrantSet;
2438
+ destroy(): void;
2439
+ };
2440
+ /**
2441
+ * Same `enter` / `exit` / `abort` as the session. Metaphor is fixed so cabinet
2442
+ * and painting hosts share lifecycle code.
2443
+ */
2444
+ declare function cabinetPortal(portal: PortalLifecycle): {
2445
+ enter: (request: Omit<PortalEnterRequest, 'metaphor'>) => PortalMutationResult;
2446
+ exit: (payload?: unknown) => PortalMutationResult;
2447
+ abort: (payload?: unknown) => PortalMutationResult;
2448
+ };
2449
+ declare function paintingPortal(portal: PortalLifecycle): {
2450
+ enter: (request: Omit<PortalEnterRequest, 'metaphor'>) => PortalMutationResult;
2451
+ exit: (payload?: unknown) => PortalMutationResult;
2452
+ abort: (payload?: unknown) => PortalMutationResult;
2453
+ };
2454
+ declare function createPortalLifecycle(options?: CreatePortalLifecycleOptions): PortalLifecycle;
2455
+
2456
+ /**
2457
+ * Copyright (c) 2026 Aaron Boyarsky
2458
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2459
+ * See packages/engine/LICENSE
2460
+ *
2461
+ * Durable asynchronous job orchestration: lifecycle, persistence, worker
2462
+ * boundary, evaluator feedback, and host-owned apply. Wall-clock completion
2463
+ * never mutates authoritative host state.
2464
+ */
2465
+
2466
+ declare const JOB_ORCHESTRATION_SNAPSHOT_SCHEMA_VERSION: 1;
2467
+ declare const JOB_RESULT_REF_SCHEMA_VERSION: 1;
2468
+ declare const JOB_STATES: readonly ["queued", "claimed", "awaiting-evaluation", "retry-scheduled", "ready", "applied", "failed", "canceled", "superseded"];
2469
+ type JobState = (typeof JOB_STATES)[number];
2470
+ declare const JOB_RETRYABILITY: readonly ["retryable", "permanent", "unknown"];
2471
+ type JobRetryability = (typeof JOB_RETRYABILITY)[number];
2472
+ declare const JOB_EVALUATOR_DECISIONS: readonly ["accept", "reject", "revise"];
2473
+ type JobEvaluatorDecision = (typeof JOB_EVALUATOR_DECISIONS)[number];
2474
+ declare const JOB_SUBMITTED_EVENT = "job.intent.submitted";
2475
+ declare const JOB_QUEUED_EVENT = "job.state.queued";
2476
+ declare const JOB_CLAIMED_EVENT = "job.state.claimed";
2477
+ declare const JOB_PROGRESS_EVENT = "job.state.progress";
2478
+ declare const JOB_AWAITING_EVALUATION_EVENT = "job.state.awaiting-evaluation";
2479
+ declare const JOB_RETRY_SCHEDULED_EVENT = "job.state.retry-scheduled";
2480
+ declare const JOB_READY_EVENT = "job.state.ready";
2481
+ declare const JOB_APPLIED_EVENT = "job.state.applied";
2482
+ declare const JOB_FAILED_EVENT = "job.state.failed";
2483
+ declare const JOB_CANCELED_EVENT = "job.state.canceled";
2484
+ declare const JOB_SUPERSEDED_EVENT = "job.state.superseded";
2485
+ declare const JOB_DIAGNOSTIC_EVENT = "job.diagnostic.lifecycle";
2486
+ declare const JOB_LIFECYCLE_EVENTS: readonly ["job.intent.submitted", "job.state.queued", "job.state.claimed", "job.state.progress", "job.state.awaiting-evaluation", "job.state.retry-scheduled", "job.state.ready", "job.state.applied", "job.state.failed", "job.state.canceled", "job.state.superseded", "job.diagnostic.lifecycle"];
2487
+ type JobLifecycleEventType = (typeof JOB_LIFECYCLE_EVENTS)[number];
2488
+ /** Keys replaced with REDACTED_VALUE in exported traces. */
2489
+ declare const JOB_REDACTED_KEYS: readonly ["prompt", "credentials", "credential", "authorization", "apiKey", "secret"];
2490
+ type JobDiagnostic = {
2491
+ code: string;
2492
+ detail: string;
2493
+ path?: string;
2494
+ };
2495
+ type JobResultRef = {
2496
+ schemaVersion: typeof JOB_RESULT_REF_SCHEMA_VERSION;
2497
+ kind: string;
2498
+ uri: string;
2499
+ contentType?: string;
2500
+ bytes?: number;
2501
+ };
2502
+ type JobRetryPolicy = {
2503
+ maxAttempts: number;
2504
+ backoffMs: readonly number[];
2505
+ retryableCodes: readonly string[];
2506
+ };
2507
+ type JobFallback = {
2508
+ reasonCode: string;
2509
+ resultRef?: JobResultRef;
2510
+ };
2511
+ type JobDefinition = {
2512
+ id: string;
2513
+ version: number;
2514
+ requestSchema: PayloadSchema;
2515
+ resultKind: string;
2516
+ retry: JobRetryPolicy;
2517
+ timeoutMs: number;
2518
+ leaseMs: number;
2519
+ fallback: JobFallback;
2520
+ };
2521
+ type JobProgress = {
2522
+ value: number;
2523
+ stage: string;
2524
+ message?: string;
2525
+ };
2526
+ type JobFailureRecord = {
2527
+ attempt: number;
2528
+ code: string;
2529
+ retryability: JobRetryability;
2530
+ at: number;
2531
+ detail?: string;
2532
+ };
2533
+ type JobEvaluatorRecord = {
2534
+ decision: JobEvaluatorDecision;
2535
+ at: number;
2536
+ correction?: string;
2537
+ };
2538
+ type JobRecord = {
2539
+ jobId: string;
2540
+ definitionId: string;
2541
+ definitionVersion: number;
2542
+ idempotencyKey: string;
2543
+ state: JobState;
2544
+ request: unknown;
2545
+ resultRef: JobResultRef | null;
2546
+ progress: JobProgress;
2547
+ attempt: number;
2548
+ failureHistory: JobFailureRecord[];
2549
+ evaluatorHistory: JobEvaluatorRecord[];
2550
+ correlationId: string;
2551
+ causationId?: string;
2552
+ workerId: string | null;
2553
+ leaseUntil: number | null;
2554
+ createdAt: number;
2555
+ updatedAt: number;
2556
+ timeoutAt: number;
2557
+ nextRetryAt: number | null;
2558
+ supersededBy: string | null;
2559
+ fallbackApplied: boolean;
2560
+ fallback?: JobFallback;
2561
+ };
2562
+ type JobCoordinatorSnapshot = {
2563
+ schemaVersion: typeof JOB_ORCHESTRATION_SNAPSHOT_SCHEMA_VERSION;
2564
+ jobs: JobRecord[];
2565
+ hostAcceptedJobIds: string[];
2566
+ };
2567
+ type JobInspect = {
2568
+ destroyed: boolean;
2569
+ jobs: JobRecord[];
2570
+ events: JobLifecycleEventType[];
2571
+ };
2572
+ type JobMutationResult = {
2573
+ ok: true;
2574
+ job: JobRecord;
2575
+ } | {
2576
+ ok: false;
2577
+ errors: JobDiagnostic[];
2578
+ };
2579
+ type RestoreJobResult = {
2580
+ ok: true;
2581
+ snapshot: JobCoordinatorSnapshot;
2582
+ } | {
2583
+ ok: false;
2584
+ errors: JobDiagnostic[];
2585
+ };
2586
+ type JobSubmitRequest = {
2587
+ definitionId: string;
2588
+ idempotencyKey: string;
2589
+ request: unknown;
2590
+ correlationId: string;
2591
+ causationId?: string;
2592
+ supersedeJobId?: string;
2593
+ };
2594
+ type JobPersistenceAdapter = {
2595
+ save(job: JobRecord): void;
2596
+ get(jobId: string): JobRecord | undefined;
2597
+ getByIdempotencyKey(key: string): JobRecord | undefined;
2598
+ list(): JobRecord[];
2599
+ replaceAll(jobs: JobRecord[]): void;
2600
+ };
2601
+ type JobWorkRequest = {
2602
+ jobId: string;
2603
+ workerId: string;
2604
+ definitionId: string;
2605
+ request: unknown;
2606
+ attempt: number;
2607
+ };
2608
+ type JobWorkerCallbacks = {
2609
+ reportProgress(jobId: string, progress: JobProgress): JobMutationResult;
2610
+ complete(jobId: string, resultRef: JobResultRef): JobMutationResult;
2611
+ fail(jobId: string, failure: {
2612
+ code: string;
2613
+ retryability: JobRetryability;
2614
+ detail?: string;
2615
+ }): JobMutationResult;
2616
+ heartbeat(jobId: string): JobMutationResult;
2617
+ };
2618
+ type JobWorkerAdapter = {
2619
+ bind(callbacks: JobWorkerCallbacks): void;
2620
+ start(work: JobWorkRequest): void;
2621
+ cancel?(jobId: string): void;
2622
+ };
2623
+ type HeadlessJobWorker = JobWorkerAdapter & {
2624
+ complete(jobId: string, resultRef: JobResultRef): JobMutationResult;
2625
+ fail(jobId: string, failure: {
2626
+ code: string;
2627
+ retryability: JobRetryability;
2628
+ detail?: string;
2629
+ }): JobMutationResult;
2630
+ started(): string[];
2631
+ };
2632
+ type CreateJobCoordinatorOptions = {
2633
+ definitions: readonly JobDefinition[];
2634
+ persistence?: JobPersistenceAdapter;
2635
+ worker?: JobWorkerAdapter;
2636
+ router?: Pick<EventRouter, 'publish'>;
2637
+ now?: () => number;
2638
+ createId?: () => string;
2639
+ maxCorrectionChars?: number;
2640
+ maxFailureHistory?: number;
2641
+ };
2642
+ type JobCoordinator = {
2643
+ submit(request: JobSubmitRequest): JobMutationResult;
2644
+ claim(workerId: string): JobMutationResult;
2645
+ reportProgress(jobId: string, progress: JobProgress): JobMutationResult;
2646
+ heartbeat(jobId: string): JobMutationResult;
2647
+ complete(jobId: string, resultRef: JobResultRef): JobMutationResult;
2648
+ fail(jobId: string, failure: {
2649
+ code: string;
2650
+ retryability: JobRetryability;
2651
+ detail?: string;
2652
+ }): JobMutationResult;
2653
+ evaluate(jobId: string, decision: JobEvaluatorDecision, correction?: string): JobMutationResult;
2654
+ cancel(jobId: string): JobMutationResult;
2655
+ recoverStale(): JobRecord[];
2656
+ tick(): JobRecord[];
2657
+ /** Host policy gate. Ready jobs become applied; never called from worker complete. */
2658
+ accept(jobId: string): JobMutationResult;
2659
+ get(jobId: string): JobRecord | undefined;
2660
+ getByIdempotencyKey(key: string): JobRecord | undefined;
2661
+ inspect(): JobInspect;
2662
+ snapshot(): JobCoordinatorSnapshot;
2663
+ restore(input: unknown): RestoreJobResult;
2664
+ exportTrace(): {
2665
+ jobs: unknown[];
2666
+ events: JobLifecycleEventType[];
2667
+ };
2668
+ destroy(): void;
2669
+ };
2670
+ declare function jobEventContracts(): EventContract[];
2671
+ declare function createMemoryJobPersistence(): JobPersistenceAdapter;
2672
+ declare function createHeadlessJobWorker(): HeadlessJobWorker;
2673
+ declare function createJobCoordinator(options: CreateJobCoordinatorOptions): JobCoordinator;
2674
+
2675
+ /**
2676
+ * Copyright (c) 2026 Aaron Boyarsky
2677
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2678
+ * See packages/engine/LICENSE
2679
+ *
2680
+ * Optional spatial world graph: nodes, edges, discovery projections, entity
2681
+ * transit, and host-owned path policy. Semantic time and story rules stay
2682
+ * with the host. No economy, combat, quest, or narrative.
2683
+ */
2684
+
2685
+ declare const WORLD_GRAPH_SNAPSHOT_SCHEMA_VERSION: 1;
2686
+ declare const WORLD_NODE_KINDS: readonly ["room", "region", "landmark", "frontier"];
2687
+ type WorldNodeKind = (typeof WORLD_NODE_KINDS)[number];
2688
+ declare const WORLD_MAP_LAYERS: readonly ["local", "regional"];
2689
+ type WorldMapLayer = (typeof WORLD_MAP_LAYERS)[number];
2690
+ declare const WORLD_EDGE_VISIBILITIES: readonly ["canonical", "discoverable", "hidden"];
2691
+ type WorldEdgeVisibility = (typeof WORLD_EDGE_VISIBILITIES)[number];
2692
+ declare const WORLD_EDGE_ACCESS: readonly ["open", "locked", "disabled"];
2693
+ type WorldEdgeAccess = (typeof WORLD_EDGE_ACCESS)[number];
2694
+ declare const WORLD_ENTITY_KINDS: readonly ["character", "party"];
2695
+ type WorldEntityKind = (typeof WORLD_ENTITY_KINDS)[number];
2696
+ declare const WORLD_ENTITY_STATUSES: readonly ["available", "busy", "traveling"];
2697
+ type WorldEntityStatus = (typeof WORLD_ENTITY_STATUSES)[number];
2698
+ declare const WORLD_NODE_ADDED_EVENT = "world.graph.state.node-added";
2699
+ declare const WORLD_EDGE_ADDED_EVENT = "world.graph.state.edge-added";
2700
+ declare const WORLD_DISCOVERED_EVENT = "world.graph.state.discovered";
2701
+ declare const WORLD_TRANSIT_EVENT = "world.graph.state.transit";
2702
+ declare const WORLD_GRAPH_DIAGNOSTIC_EVENT = "world.graph.diagnostic.lifecycle";
2703
+ declare const WORLD_GRAPH_EVENTS: readonly ["world.graph.state.node-added", "world.graph.state.edge-added", "world.graph.state.discovered", "world.graph.state.transit", "world.graph.diagnostic.lifecycle"];
2704
+ type WorldGraphEventType = (typeof WORLD_GRAPH_EVENTS)[number];
2705
+ type WorldGraphDiagnostic = {
2706
+ code: string;
2707
+ detail: string;
2708
+ path?: string;
2709
+ };
2710
+ type WorldNode = {
2711
+ id: string;
2712
+ version: number;
2713
+ kind: WorldNodeKind;
2714
+ mapLayer: WorldMapLayer;
2715
+ frontier?: boolean;
2716
+ metadata?: Record<string, unknown>;
2717
+ };
2718
+ type WorldEdge = {
2719
+ id: string;
2720
+ version: number;
2721
+ from: string;
2722
+ to: string;
2723
+ directed: boolean;
2724
+ kind: string;
2725
+ visibility: WorldEdgeVisibility;
2726
+ access: WorldEdgeAccess;
2727
+ requirements?: Record<string, unknown>;
2728
+ cost?: Record<string, number>;
2729
+ metadata?: Record<string, unknown>;
2730
+ };
2731
+ type WorldTransit = {
2732
+ originNodeId: string;
2733
+ destinationNodeId: string;
2734
+ routeEdgeIds: readonly string[];
2735
+ departedAt: number;
2736
+ expectedArrival: number;
2737
+ };
2738
+ type WorldEntity = {
2739
+ id: string;
2740
+ kind: WorldEntityKind;
2741
+ status: WorldEntityStatus;
2742
+ locationNodeId: string | null;
2743
+ transit: WorldTransit | null;
2744
+ metadata?: Record<string, unknown>;
2745
+ };
2746
+ type WorldObserverDiscovery = {
2747
+ observerId: string;
2748
+ nodeIds: readonly string[];
2749
+ edgeIds: readonly string[];
2750
+ };
2751
+ type WorldGraphSnapshot = {
2752
+ schemaVersion: typeof WORLD_GRAPH_SNAPSHOT_SCHEMA_VERSION;
2753
+ graphId: string;
2754
+ nodes: WorldNode[];
2755
+ edges: WorldEdge[];
2756
+ entities: WorldEntity[];
2757
+ discovery: WorldObserverDiscovery[];
2758
+ };
2759
+ type WorldGraphProjection = {
2760
+ kind: 'canonical' | 'known' | 'local' | 'regional';
2761
+ observerId?: string;
2762
+ focusNodeId?: string;
2763
+ nodes: WorldNode[];
2764
+ edges: WorldEdge[];
2765
+ frontiers: WorldNode[];
2766
+ entities: WorldEntity[];
2767
+ };
2768
+ type WorldPathStep = {
2769
+ edgeId: string;
2770
+ from: string;
2771
+ to: string;
2772
+ cost: number;
2773
+ };
2774
+ type WorldPath = {
2775
+ from: string;
2776
+ to: string;
2777
+ nodeIds: string[];
2778
+ steps: WorldPathStep[];
2779
+ totalCost: number;
2780
+ };
2781
+ type WorldTraversalContext = {
2782
+ semanticTime: number;
2783
+ observerId?: string;
2784
+ hostState?: unknown;
2785
+ };
2786
+ type WorldTraversalPolicy = {
2787
+ canTraverse(edge: WorldEdge, from: string, to: string, ctx: WorldTraversalContext): boolean;
2788
+ cost(edge: WorldEdge, from: string, to: string, ctx: WorldTraversalContext): number;
2789
+ };
2790
+ type WorldQueryBounds = {
2791
+ maxVisits?: number;
2792
+ };
2793
+ type WorldGraphInspect = {
2794
+ destroyed: boolean;
2795
+ graphId: string;
2796
+ nodeCount: number;
2797
+ edgeCount: number;
2798
+ entityCount: number;
2799
+ observerCount: number;
2800
+ events: WorldGraphEventType[];
2801
+ };
2802
+ type WorldMutationResult = {
2803
+ ok: true;
2804
+ } | {
2805
+ ok: false;
2806
+ errors: WorldGraphDiagnostic[];
2807
+ };
2808
+ type RestoreWorldGraphResult = {
2809
+ ok: true;
2810
+ snapshot: WorldGraphSnapshot;
2811
+ } | {
2812
+ ok: false;
2813
+ errors: WorldGraphDiagnostic[];
2814
+ };
2815
+ type WorldPathResult = {
2816
+ ok: true;
2817
+ path: WorldPath;
2818
+ } | {
2819
+ ok: false;
2820
+ errors: WorldGraphDiagnostic[];
2821
+ };
2822
+ type WorldReachabilityResult = {
2823
+ nodeIds: string[];
2824
+ };
2825
+ type WorldGraphPatch = {
2826
+ nodes?: readonly WorldNode[];
2827
+ edges?: readonly WorldEdge[];
2828
+ };
2829
+ type CreateWorldGraphOptions = {
2830
+ graphId?: string;
2831
+ migrations?: readonly SnapshotMigration[];
2832
+ router?: Pick<EventRouter, 'publish'>;
2833
+ source?: string;
2834
+ maxPathVisits?: number;
2835
+ };
2836
+ type WorldGraph = {
2837
+ addNode(node: WorldNode): WorldMutationResult;
2838
+ addEdge(edge: WorldEdge): WorldMutationResult;
2839
+ applyPatch(patch: WorldGraphPatch): WorldMutationResult;
2840
+ removeNode(nodeId: string): WorldMutationResult;
2841
+ removeEdge(edgeId: string): WorldMutationResult;
2842
+ setEdgeAccess(edgeId: string, access: WorldEdgeAccess): WorldMutationResult;
2843
+ discover(observerId: string, known: {
2844
+ nodeIds?: readonly string[];
2845
+ edgeIds?: readonly string[];
2846
+ }): WorldMutationResult;
2847
+ upsertEntity(entity: WorldEntity): WorldMutationResult;
2848
+ startTransit(entityId: string, transit: WorldTransit, status?: Exclude<WorldEntityStatus, 'available'>): WorldMutationResult;
2849
+ completeTransit(entityId: string, semanticTime: number): WorldMutationResult;
2850
+ setEntityStatus(entityId: string, status: WorldEntityStatus): WorldMutationResult;
2851
+ getNode(nodeId: string): WorldNode | undefined;
2852
+ getEdge(edgeId: string): WorldEdge | undefined;
2853
+ getEntity(entityId: string): WorldEntity | undefined;
2854
+ projectCanonical(): WorldGraphProjection;
2855
+ projectKnown(observerId: string): WorldGraphProjection;
2856
+ projectLocal(observerId: string, focusNodeId: string, hops?: number): WorldGraphProjection;
2857
+ projectRegional(observerId: string): WorldGraphProjection;
2858
+ findPath(from: string, to: string, policy: WorldTraversalPolicy, ctx: WorldTraversalContext, bounds?: WorldQueryBounds): WorldPathResult;
2859
+ reachable(from: string, policy: WorldTraversalPolicy, ctx: WorldTraversalContext, bounds?: WorldQueryBounds): WorldReachabilityResult;
2860
+ inspect(): WorldGraphInspect;
2861
+ snapshot(): WorldGraphSnapshot;
2862
+ restore(input: unknown): RestoreWorldGraphResult;
2863
+ events(): readonly EventInput[];
2864
+ destroy(): void;
2865
+ };
2866
+ declare function worldGraphEventContracts(): EventContract[];
2867
+ declare function createWorldGraph(options?: CreateWorldGraphOptions): WorldGraph;
2868
+
2869
+ /**
2870
+ * Copyright (c) 2026 Aaron Boyarsky
2871
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2872
+ * See packages/engine/LICENSE
2873
+ *
2874
+ * Transactional world-patch validation and atomic application. A generated
2875
+ * result becomes one world revision or none — never a half-installed world.
2876
+ * Cyberart is not the host's database of record.
2877
+ */
2878
+
2879
+ declare const WORLD_PATCH_SCHEMA_VERSION: 1;
2880
+ declare const WORLD_PATCH_SNAPSHOT_SCHEMA_VERSION: 1;
2881
+ declare const WORLD_PATCH_OPS: readonly ["add", "replace", "revise", "remove", "tombstone", "link", "unlink"];
2882
+ type WorldPatchOp = (typeof WORLD_PATCH_OPS)[number];
2883
+ declare const WORLD_PATCH_PRECONDITION_TYPES: readonly ["base-revision", "entity-revision", "entity-hash", "identity-required", "identity-absent", "capability", "schema"];
2884
+ type WorldPatchPreconditionType = (typeof WORLD_PATCH_PRECONDITION_TYPES)[number];
2885
+ declare const WORLD_PATCH_ACCEPTED_EVENT: "world.patch.state.accepted";
2886
+ declare const WORLD_PATCH_REJECTED_EVENT: "world.patch.state.rejected";
2887
+ declare const WORLD_PATCH_SUPERSEDED_EVENT: "world.patch.state.superseded";
2888
+ declare const WORLD_PATCH_DIAGNOSTIC_EVENT: "world.patch.diagnostic.lifecycle";
2889
+ declare const WORLD_PATCH_EVENTS: readonly ["world.patch.state.accepted", "world.patch.state.rejected", "world.patch.state.superseded", "world.patch.diagnostic.lifecycle"];
2890
+ type WorldPatchEventType = (typeof WORLD_PATCH_EVENTS)[number];
2891
+ declare const WORLD_PATCH_ERROR_CODES: readonly ["invalid-schema", "unknown-field", "unknown-op", "missing-field", "missing-ref", "referential-integrity", "stale-base", "precondition-failed", "asset-unavailable", "content-unavailable", "binding-unavailable", "cycle", "over-limit", "idempotency-conflict", "superseded", "invalid-snapshot", "invalid-version", "destroyed", "domain", "capability-denied", "schema-mismatch", "identity-required", "identity-absent", "entity-revision", "entity-hash", "duplicate-id", "graph-apply-failed", "publish-failed"];
2892
+ type WorldPatchErrorCode = (typeof WORLD_PATCH_ERROR_CODES)[number];
2893
+ /** Keys replaced with REDACTED_VALUE in audit export. */
2894
+ declare const WORLD_PATCH_REDACTED_KEYS: readonly ["prompt", "credentials", "credential", "authorization", "apiKey", "secret"];
2895
+ type WorldPatchDiagnostic = {
2896
+ code: WorldPatchErrorCode | string;
2897
+ detail: string;
2898
+ path?: string;
2899
+ expectedRevision?: number;
2900
+ actualRevision?: number;
2901
+ };
2902
+ type WorldPatchProvenance = {
2903
+ producer: string;
2904
+ jobId?: string;
2905
+ contentRevisions?: string[];
2906
+ };
2907
+ type WorldPatchRefs = {
2908
+ contentId?: string;
2909
+ contentRevision?: string;
2910
+ binding?: string;
2911
+ asset?: string;
2912
+ identity?: string;
2913
+ };
2914
+ type WorldPatchOperation = {
2915
+ op: WorldPatchOp;
2916
+ kind: string;
2917
+ id: string;
2918
+ order?: number;
2919
+ value?: unknown;
2920
+ from?: string;
2921
+ to?: string;
2922
+ refs?: WorldPatchRefs;
2923
+ };
2924
+ type WorldPatchPrecondition = {
2925
+ type: 'base-revision';
2926
+ revision: number;
2927
+ } | {
2928
+ type: 'entity-revision';
2929
+ kind: string;
2930
+ id: string;
2931
+ revision: number;
2932
+ } | {
2933
+ type: 'entity-hash';
2934
+ kind: string;
2935
+ id: string;
2936
+ hash: string;
2937
+ } | {
2938
+ type: 'identity-required';
2939
+ kind: string;
2940
+ id: string;
2941
+ } | {
2942
+ type: 'identity-absent';
2943
+ kind: string;
2944
+ id: string;
2945
+ } | {
2946
+ type: 'capability';
2947
+ name: string;
2948
+ } | {
2949
+ type: 'schema';
2950
+ schemaVersion: number;
2951
+ };
2952
+ type WorldPatch = {
2953
+ patchId: string;
2954
+ schemaVersion: typeof WORLD_PATCH_SCHEMA_VERSION;
2955
+ baseRevision: number;
2956
+ idempotencyKey: string;
2957
+ preconditions?: WorldPatchPrecondition[];
2958
+ operations: WorldPatchOperation[];
2959
+ provenance: WorldPatchProvenance;
2960
+ supersedes?: string;
2961
+ };
2962
+ type WorldEntityRecord = {
2963
+ kind: string;
2964
+ id: string;
2965
+ revision: number;
2966
+ hash: string;
2967
+ value: unknown;
2968
+ tombstoned: boolean;
2969
+ refs?: WorldPatchRefs;
2970
+ };
2971
+ type WorldLinkRecord = {
2972
+ id: string;
2973
+ kind: string;
2974
+ from: string;
2975
+ to: string;
2976
+ value?: unknown;
2977
+ };
2978
+ type WorldAcceptedPatch = {
2979
+ patchId: string;
2980
+ idempotencyKey: string;
2981
+ revision: number;
2982
+ provenance: WorldPatchProvenance;
2983
+ supersededBy?: string;
2984
+ };
2985
+ type WorldRevisionState = {
2986
+ revision: number;
2987
+ entities: WorldEntityRecord[];
2988
+ links: WorldLinkRecord[];
2989
+ accepted: WorldAcceptedPatch[];
2990
+ };
2991
+ type WorldIdentityChange = {
2992
+ op: WorldPatchOp;
2993
+ kind: string;
2994
+ id: string;
2995
+ };
2996
+ type WorldPatchAuditRecord = {
2997
+ outcome: 'accepted' | 'rejected' | 'superseded';
2998
+ patchId: string;
2999
+ idempotencyKey: string;
3000
+ at: number;
3001
+ oldRevision: number;
3002
+ newRevision: number;
3003
+ reasonCodes: string[];
3004
+ changedIdentities: WorldIdentityChange[];
3005
+ provenance: WorldPatchProvenance | Record<string, unknown>;
3006
+ patch: unknown;
3007
+ };
3008
+ type WorldPatchSnapshot = {
3009
+ schemaVersion: typeof WORLD_PATCH_SNAPSHOT_SCHEMA_VERSION;
3010
+ world: WorldRevisionState;
3011
+ audit: WorldPatchAuditRecord[];
3012
+ graph?: WorldGraphSnapshot;
3013
+ };
3014
+ type WorldPatchInspect = {
3015
+ destroyed: boolean;
3016
+ revision: number;
3017
+ entities: WorldEntityRecord[];
3018
+ links: WorldLinkRecord[];
3019
+ acceptedPatchIds: string[];
3020
+ events: WorldPatchEventType[];
3021
+ lastRejection: WorldPatchDiagnostic[] | null;
3022
+ };
3023
+ type WorldPatchDryRunResult = {
3024
+ ok: true;
3025
+ previewRevision: number;
3026
+ changedIdentities: WorldIdentityChange[];
3027
+ diagnostics: WorldPatchDiagnostic[];
3028
+ } | {
3029
+ ok: false;
3030
+ errors: WorldPatchDiagnostic[];
3031
+ };
3032
+ type WorldPatchCommitResult = {
3033
+ ok: true;
3034
+ patchId: string;
3035
+ oldRevision: number;
3036
+ newRevision: number;
3037
+ changedIdentities: WorldIdentityChange[];
3038
+ idempotent?: boolean;
3039
+ inspect: WorldPatchInspect;
3040
+ } | {
3041
+ ok: false;
3042
+ errors: WorldPatchDiagnostic[];
3043
+ inspect: WorldPatchInspect;
3044
+ };
3045
+ type RestoreWorldPatchResult = {
3046
+ ok: true;
3047
+ snapshot: WorldPatchSnapshot;
3048
+ } | {
3049
+ ok: false;
3050
+ errors: WorldPatchDiagnostic[];
3051
+ };
3052
+ type WorldPersistenceTransaction = {
3053
+ applyWorldRevision(next: WorldRevisionState): void;
3054
+ commit(): void;
3055
+ rollback(): void;
3056
+ };
3057
+ type WorldPatchAcceptedPayload = {
3058
+ patchId: string;
3059
+ oldRevision: number;
3060
+ newRevision: number;
3061
+ changedIdentities: WorldIdentityChange[];
3062
+ producer: string;
3063
+ jobId?: string;
3064
+ contentRevisions?: string[];
3065
+ };
3066
+ type WorldPersistenceAdapter = {
3067
+ begin(): WorldPersistenceTransaction;
3068
+ current(): WorldRevisionState;
3069
+ publish?(payload: WorldPatchAcceptedPayload): void;
3070
+ };
3071
+ type WorldPatchLimits = {
3072
+ maxOperations?: number;
3073
+ maxDiagnostics?: number;
3074
+ maxEntities?: number;
3075
+ maxBytes?: number;
3076
+ };
3077
+ type WorldPatchContentAvailability = {
3078
+ hasRevision?(contentId: string, revision: string): boolean;
3079
+ available?: ReadonlyArray<{
3080
+ contentId?: string;
3081
+ revision: string;
3082
+ }>;
3083
+ };
3084
+ type WorldPatchBindingAvailability = {
3085
+ listedIds?: readonly string[];
3086
+ };
3087
+ type WorldPatchAssetAvailability = {
3088
+ availableIds?: readonly string[];
3089
+ };
3090
+ type WorldPatchGraphPolicy = {
3091
+ allowCycles?: boolean;
3092
+ detectCycle?(preview: WorldRevisionState): boolean;
3093
+ };
3094
+ type WorldPatchDomainValidator = (ctx: {
3095
+ patch: WorldPatch;
3096
+ current: WorldRevisionState;
3097
+ preview: WorldRevisionState;
3098
+ }) => WorldPatchDiagnostic[];
3099
+ type CreateWorldPatchApplierOptions = {
3100
+ persistence?: WorldPersistenceAdapter;
3101
+ graph?: WorldGraph;
3102
+ content?: WorldPatchContentAvailability;
3103
+ bindings?: WorldPatchBindingAvailability;
3104
+ assets?: WorldPatchAssetAvailability;
3105
+ now?: () => number;
3106
+ limits?: WorldPatchLimits;
3107
+ redact?: readonly string[];
3108
+ router?: Pick<EventRouter, 'publish'>;
3109
+ onEvent?: (event: EventInput) => void;
3110
+ domainValidators?: readonly WorldPatchDomainValidator[];
3111
+ capabilities?: readonly string[];
3112
+ graphPolicy?: WorldPatchGraphPolicy;
3113
+ source?: string;
3114
+ };
3115
+ type WorldPatchApplier = {
3116
+ dryRun(patch: unknown): WorldPatchDryRunResult;
3117
+ commit(patch: unknown): WorldPatchCommitResult;
3118
+ inspect(): WorldPatchInspect;
3119
+ snapshot(): WorldPatchSnapshot;
3120
+ restore(input: unknown): RestoreWorldPatchResult;
3121
+ audit(options?: {
3122
+ redact?: boolean;
3123
+ }): WorldPatchAuditRecord[];
3124
+ events(): readonly EventInput[];
3125
+ destroy(): void;
3126
+ };
3127
+ declare function worldPatchEventContracts(): EventContract[];
3128
+ declare function isWorldPatchErrorCode(value: unknown): value is WorldPatchErrorCode;
3129
+ declare function createMemoryWorldPersistence(): WorldPersistenceAdapter;
3130
+ declare function createWorldPatchApplier(options?: CreateWorldPatchApplierOptions): WorldPatchApplier;
3131
+
3132
+ declare const REPLAY_INSPECTOR_SCHEMA_VERSION: 1;
3133
+ declare const DEFAULT_MAX_INSPECTOR_RECORDS = 512;
3134
+ declare const REDACTED_VALUE = "[REDACTED]";
3135
+ /** Always redacted in traces (CYB-80 prompts/credentials plus user keys). */
3136
+ declare const DEFAULT_SENSITIVE_KEYS: readonly ["prompt", "credentials", "credential", "authorization", "apiKey", "secret"];
3137
+ type ReplayTraceFilter = {
3138
+ types?: string[];
3139
+ sources?: string[];
3140
+ outcomes?: RouterDecisionOutcome[];
3141
+ correlationId?: string;
3142
+ };
3143
+ type CreateReplayInspectorOptions = {
3144
+ redactedKeys?: string[];
3145
+ maxRecords?: number;
3146
+ /** Optional contracts so records can include payload schema version. */
3147
+ registry?: Pick<ContractRegistry, 'get'>;
3148
+ };
3149
+ type InspectorRecord = {
3150
+ index: number;
3151
+ turn: number;
3152
+ time: number;
3153
+ outcome: RouterDecisionOutcome;
3154
+ reason?: RouterDecisionReason;
3155
+ detail?: string;
3156
+ source: string;
3157
+ target?: string;
3158
+ type: string;
3159
+ kind?: EventKind;
3160
+ envelopeId?: string;
3161
+ priorEnvelopeId?: string;
3162
+ correlationId?: string;
3163
+ causationId?: string;
3164
+ hops?: number;
3165
+ seq?: number;
3166
+ idempotencyKey?: string;
3167
+ schemaVersion?: number;
3168
+ payloadSchemaVersion?: number;
3169
+ deliveredTo: string[];
3170
+ payload?: unknown;
3171
+ };
3172
+ type CausationTreeNode = {
3173
+ envelopeId?: string;
3174
+ type: string;
3175
+ source: string;
3176
+ outcome: RouterDecisionOutcome;
3177
+ reason?: RouterDecisionReason;
3178
+ children: CausationTreeNode[];
3179
+ };
3180
+ type ReplayParticipantSummary = {
3181
+ id: string;
3182
+ kind?: RuntimeGroupKind;
3183
+ emit: string[];
3184
+ subscribe: string[];
3185
+ authoritative: boolean;
3186
+ seed?: string;
3187
+ clock?: ClockSnapshot;
3188
+ state?: unknown;
3189
+ errorCount: number;
3190
+ lastError?: string;
3191
+ };
3192
+ type ReplayInspectorReport = {
3193
+ schemaVersion: typeof REPLAY_INSPECTOR_SCHEMA_VERSION;
3194
+ participants: ReplayParticipantSummary[];
3195
+ records: InspectorRecord[];
3196
+ trees: CausationTreeNode[];
3197
+ dropped: number;
3198
+ };
3199
+ type ReplayTapeAction = {
3200
+ kind: 'publish';
3201
+ event: EventInput;
3202
+ extras?: PublishExtras;
3203
+ } | {
3204
+ kind: 'dispatch';
3205
+ participantId: string;
3206
+ event: HostEvent;
3207
+ } | {
3208
+ kind: 'step';
3209
+ frames: number;
3210
+ } | {
3211
+ kind: 'asset';
3212
+ participantId: string;
3213
+ event: HostEvent;
3214
+ };
3215
+ type ReplayInspectorExport = {
3216
+ schemaVersion: typeof REPLAY_INSPECTOR_SCHEMA_VERSION;
3217
+ origin: number;
3218
+ redactedKeys: string[];
3219
+ participants: ReplayParticipantSummary[];
3220
+ tape: ReplayTapeAction[];
3221
+ records: InspectorRecord[];
3222
+ snapshots: Record<string, unknown>;
3223
+ };
3224
+ type ReplayCompareResult = {
3225
+ ok: true;
3226
+ } | {
3227
+ ok: false;
3228
+ detail: string;
3229
+ };
3230
+ type BoundReplaySession = {
3231
+ publish(event: EventInput, extras?: PublishExtras): EventEnvelope | undefined;
3232
+ dispatch(participantId: string, event: HostEvent): void;
3233
+ step(frames?: number): Promise<void>;
3234
+ report(): Promise<ReplayInspectorReport>;
3235
+ exportTrace(filter?: ReplayTraceFilter): Promise<ReplayInspectorExport>;
3236
+ unbind(): void;
3237
+ };
3238
+ type ReplayInspector = {
3239
+ watchRouter(router: EventRouter): () => void;
3240
+ bind(group: RuntimeGroup): BoundReplaySession;
3241
+ importTrace(exported: ReplayInspectorExport | string): void;
3242
+ exportTrace(filter?: ReplayTraceFilter): ReplayInspectorExport;
3243
+ report(filter?: ReplayTraceFilter): ReplayInspectorReport;
3244
+ causationTree(correlationId?: string): CausationTreeNode[];
3245
+ records(): InspectorRecord[];
3246
+ reset(): void;
3247
+ destroy(): void;
3248
+ };
3249
+ declare function compareReplayTraces(expected: InspectorRecord[], actual: InspectorRecord[]): ReplayCompareResult;
3250
+ declare function createReplayInspector(options?: CreateReplayInspectorOptions): ReplayInspector;
3251
+ declare function replayExportedTrace(exported: ReplayInspectorExport, group: RuntimeGroup, options?: CreateReplayInspectorOptions): Promise<{
3252
+ inspector: ReplayInspector;
3253
+ report: ReplayInspectorReport;
3254
+ }>;
3255
+
3256
+ /**
3257
+ * Copyright (c) 2026 Aaron Boyarsky
3258
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
3259
+ * See packages/engine/LICENSE
3260
+ *
3261
+ * Content-selection and presentation-decision traces. Hosts record why a
3262
+ * binding, revision, asset, sequence, or fallback won. Reuses CYB-65
3263
+ * redaction, bounded retention, and correlation ids. There is no Player UI.
3264
+ */
3265
+
3266
+ declare const SELECTION_TRACE_SCHEMA_VERSION: 1;
3267
+ declare const DEFAULT_MAX_SELECTION_RECORDS = 512;
3268
+ declare const SELECTION_REASON_CODES: readonly ["binding-conflict", "asset-failure", "revision-rollback", "sequence-interruption", "text-only-fallback"];
3269
+ type SelectionReasonCode = (typeof SELECTION_REASON_CODES)[number];
3270
+ declare const SELECTION_DECISION_KINDS: readonly ["state-projection", "binding", "content-revision", "staging", "asset", "sequence", "presentation", "snapshot"];
3271
+ type SelectionDecisionKind = (typeof SELECTION_DECISION_KINDS)[number];
3272
+ declare const SELECTION_TRACE_SENSITIVE_KEYS: readonly ["prompt", "credentials", "credential", "authorization", "apiKey", "secret", "privatePrompt", "signedUrl", "signedURL", "signed_url", "presignedUrl", "password"];
3273
+ declare function isSelectionReasonCode(value: unknown): value is SelectionReasonCode;
3274
+ declare function isSelectionDecisionKind(value: unknown): value is SelectionDecisionKind;
3275
+ type SelectionBindingEvaluation = {
3276
+ bindingId: string;
3277
+ priority: number;
3278
+ predicateResult: boolean;
3279
+ winner?: boolean;
3280
+ rejectedReason?: string;
3281
+ };
3282
+ type SelectionContentIdentity = {
3283
+ contentId: string;
3284
+ revision: string;
3285
+ manifestVersion?: number;
3286
+ source?: string;
3287
+ publisher?: string;
3288
+ hashes?: Record<string, string>;
3289
+ };
3290
+ type SelectionStagingOutcome = 'validated' | 'rejected' | 'cache-hit' | 'cache-miss' | 'superseded' | 'rollback' | 'retained';
3291
+ type SelectionStagingResult = {
3292
+ outcome: SelectionStagingOutcome;
3293
+ cache?: 'hit' | 'miss';
3294
+ detail?: string;
3295
+ };
3296
+ type SelectionAssetResolution = {
3297
+ logicalRef: string;
3298
+ resolver?: string;
3299
+ adapter?: string;
3300
+ mediaHash?: string;
3301
+ ready: boolean;
3302
+ failure?: string;
3303
+ fallback?: string | null;
3304
+ };
3305
+ type SelectionSequenceDecision = {
3306
+ sequenceId: string;
3307
+ invocationId: string;
3308
+ stepId?: string | null;
3309
+ track?: string | null;
3310
+ decision: 'play' | 'skip' | 'interrupt' | 'replay' | 'complete';
3311
+ capabilityFallback?: string | null;
3312
+ };
3313
+ type SelectionPresentationDecision = {
3314
+ layerId?: string;
3315
+ variant?: string;
3316
+ regionId?: string;
3317
+ maskRevision?: string | number;
3318
+ blend?: string;
3319
+ hitTest?: boolean;
3320
+ caption?: string | null;
3321
+ audioIntent?: string | null;
3322
+ };
3323
+ type SelectionSnapshotProvenance = {
3324
+ revision?: string | number | null;
3325
+ schemaVersion?: number;
3326
+ seed?: string;
3327
+ };
3328
+ type SelectionDecisionInput = {
3329
+ kind: SelectionDecisionKind;
3330
+ reason: SelectionReasonCode | string;
3331
+ summary: string;
3332
+ turn?: number;
3333
+ time?: number;
3334
+ correlationId?: string;
3335
+ causationId?: string;
3336
+ envelopeId?: string;
3337
+ initiatingEventType?: string;
3338
+ projectionRevision?: string | number;
3339
+ projection?: unknown;
3340
+ hostState?: unknown;
3341
+ bindings?: readonly SelectionBindingEvaluation[];
3342
+ winningBindingId?: string | null;
3343
+ rejectedBindingIds?: readonly string[];
3344
+ defaultFallback?: boolean;
3345
+ requestedContent?: SelectionContentIdentity;
3346
+ activatedContent?: SelectionContentIdentity | null;
3347
+ staging?: SelectionStagingResult;
3348
+ lastKnownGood?: SelectionContentIdentity | null;
3349
+ asset?: SelectionAssetResolution;
3350
+ sequence?: SelectionSequenceDecision;
3351
+ presentation?: SelectionPresentationDecision;
3352
+ snapshot?: SelectionSnapshotProvenance;
3353
+ };
3354
+ type SelectionDecisionRecord = {
3355
+ index: number;
3356
+ kind: SelectionDecisionKind;
3357
+ reason: string;
3358
+ summary: string;
3359
+ turn?: number;
3360
+ time?: number;
3361
+ correlationId?: string;
3362
+ causationId?: string;
3363
+ envelopeId?: string;
3364
+ initiatingEventType?: string;
3365
+ projectionRevision?: string | number;
3366
+ projection?: unknown;
3367
+ bindings?: SelectionBindingEvaluation[];
3368
+ winningBindingId?: string | null;
3369
+ rejectedBindingIds?: string[];
3370
+ defaultFallback?: boolean;
3371
+ requestedContent?: SelectionContentIdentity;
3372
+ activatedContent?: SelectionContentIdentity | null;
3373
+ staging?: SelectionStagingResult;
3374
+ lastKnownGood?: SelectionContentIdentity | null;
3375
+ asset?: SelectionAssetResolution;
3376
+ sequence?: SelectionSequenceDecision;
3377
+ presentation?: SelectionPresentationDecision;
3378
+ snapshot?: SelectionSnapshotProvenance;
3379
+ };
3380
+ type SelectionTraceFilter = {
3381
+ kinds?: readonly SelectionDecisionKind[];
3382
+ reasons?: readonly string[];
3383
+ correlationId?: string;
3384
+ causationId?: string;
3385
+ envelopeId?: string;
3386
+ contentId?: string;
3387
+ sequenceId?: string;
3388
+ };
3389
+ type CreateSelectionTraceOptions = {
3390
+ redactedKeys?: readonly string[];
3391
+ maxRecords?: number;
3392
+ sampleRate?: number;
3393
+ /** Safe host-projection field names. All other projection/hostState keys redact. */
3394
+ projectionWhitelist?: readonly string[];
3395
+ inspector?: Pick<ReplayInspector, 'records'>;
3396
+ };
3397
+ type SelectionTraceExport = {
3398
+ schemaVersion: typeof SELECTION_TRACE_SCHEMA_VERSION;
3399
+ redactedKeys: string[];
3400
+ projectionWhitelist: string[];
3401
+ dropped: number;
3402
+ sampledOut: number;
3403
+ records: SelectionDecisionRecord[];
3404
+ inspectorRecords: InspectorRecord[];
3405
+ snapshotRevision?: string | number | null;
3406
+ snapshotSchemaVersion?: number;
3407
+ snapshotSeed?: string;
3408
+ };
3409
+ type SelectionTraceReport = {
3410
+ schemaVersion: typeof SELECTION_TRACE_SCHEMA_VERSION;
3411
+ records: SelectionDecisionRecord[];
3412
+ dropped: number;
3413
+ sampledOut: number;
3414
+ };
3415
+ type SelectionTrace = {
3416
+ recordSelectionDecision(input: SelectionDecisionInput): SelectionDecisionRecord | null;
3417
+ records(filter?: SelectionTraceFilter): SelectionDecisionRecord[];
3418
+ query(filter?: SelectionTraceFilter): SelectionDecisionRecord[];
3419
+ chain(correlationId: string): SelectionDecisionRecord[];
3420
+ exportTrace(filter?: SelectionTraceFilter): SelectionTraceExport;
3421
+ importTrace(exported: SelectionTraceExport | string): void;
3422
+ report(filter?: SelectionTraceFilter): SelectionTraceReport;
3423
+ setSnapshotProvenance(meta: SelectionSnapshotProvenance): void;
3424
+ reset(): void;
3425
+ destroy(): void;
3426
+ };
3427
+ declare function recordSelectionDecision(trace: SelectionTrace, input: SelectionDecisionInput): SelectionDecisionRecord | null;
3428
+ declare function attachSelectionTrace<T extends object>(bundle: T, trace: SelectionTraceExport | null): T & {
3429
+ selectionTrace: SelectionTraceExport | null;
3430
+ };
3431
+ declare function createSelectionTrace(options?: CreateSelectionTraceOptions): SelectionTrace;
3432
+
3433
+ declare const COMPOSITOR_BLEND_MODES: readonly ["source-over", "screen"];
3434
+ type CompositorBlendMode = (typeof COMPOSITOR_BLEND_MODES)[number];
3435
+ declare const COMPOSITOR_CLEAR_POLICIES: readonly ["transparent", "opaque"];
3436
+ type CompositorClearPolicy = (typeof COMPOSITOR_CLEAR_POLICIES)[number];
3437
+ type CompositorPointerEvents = 'auto' | 'none';
3438
+ declare const COMPOSITOR_SOURCE_KINDS: readonly ["participant", "image", "canvas"];
3439
+ type CompositorSourceKind = (typeof COMPOSITOR_SOURCE_KINDS)[number];
3440
+ type CompositorParticipantSource = {
3441
+ kind: 'participant';
3442
+ };
3443
+ type CompositorImageSource = {
3444
+ kind: 'image';
3445
+ image: ImageData;
3446
+ };
3447
+ type CompositorCanvasSource = {
3448
+ kind: 'canvas';
3449
+ canvas: HTMLCanvasElement;
3450
+ };
3451
+ type CompositorLayerSource = CompositorParticipantSource | CompositorImageSource | CompositorCanvasSource;
3452
+ type CompositorClip = {
3453
+ x: number;
3454
+ y: number;
3455
+ width: number;
3456
+ height: number;
3457
+ };
3458
+ type CompositorLayerConfig = {
3459
+ id: string;
3460
+ order: number;
3461
+ visible?: boolean;
3462
+ opacity?: number;
3463
+ blend?: CompositorBlendMode;
3464
+ clip?: CompositorClip;
3465
+ pointerEvents?: CompositorPointerEvents;
3466
+ clearPolicy?: CompositorClearPolicy;
3467
+ /**
3468
+ * Pixel source. Default `participant` reads the runtime-group canvas.
3469
+ * `image` / `canvas` swap atomically via `setLayer` / `addLayer`.
3470
+ */
3471
+ source?: CompositorLayerSource;
3472
+ };
3473
+ type CompositorLayerInspect = {
3474
+ id: string;
3475
+ order: number;
3476
+ visible: boolean;
3477
+ opacity: number;
3478
+ blend: CompositorBlendMode;
3479
+ clip: CompositorClip | null;
3480
+ pointerEvents: CompositorPointerEvents;
3481
+ clearPolicy: CompositorClearPolicy;
3482
+ sourceKind: CompositorSourceKind;
3483
+ };
3484
+ type CompositorHostOptions = {
3485
+ /** Back-layer pixels. Scaled nearest-neighbor to the compositor viewport. */
3486
+ image?: ImageData;
3487
+ /** Opaque CSS `#rgb` / `#rrggbb` fill when `image` is omitted. */
3488
+ color?: string;
2171
3489
  };
2172
3490
  type CreateCompositorOptions = {
2173
3491
  group: RuntimeGroup;
@@ -2330,152 +3648,882 @@ type VisualLayerSnapshotRow = {
2330
3648
  id: string;
2331
3649
  kind: VisualLayerKind;
2332
3650
  visible: boolean;
2333
- committedVersion: string | null;
2334
- pendingVersion: string | null;
2335
- activeVersion: string | null;
2336
- opacity: number;
2337
- order: number;
2338
- overrideVersion: string | null;
2339
- provenance: AssetProvenance | null;
2340
- fallback: VisualLayerFallbackPolicy;
2341
- transition: VisualLayerTransitionInspect | null;
3651
+ committedVersion: string | null;
3652
+ pendingVersion: string | null;
3653
+ activeVersion: string | null;
3654
+ opacity: number;
3655
+ order: number;
3656
+ overrideVersion: string | null;
3657
+ provenance: AssetProvenance | null;
3658
+ fallback: VisualLayerFallbackPolicy;
3659
+ transition: VisualLayerTransitionInspect | null;
3660
+ };
3661
+ type VisualLayerControllerSnapshot = {
3662
+ schemaVersion: typeof VISUAL_LAYER_SNAPSHOT_SCHEMA_VERSION;
3663
+ frame: number;
3664
+ sceneId: string | null;
3665
+ reducedMotion: boolean;
3666
+ layers: VisualLayerSnapshotRow[];
3667
+ assets: Record<string, VisualLayerAssetStatus>;
3668
+ events: VisualLayerEvent[];
3669
+ diagnostics: VisualLayerDiagnostic[];
3670
+ };
3671
+ type PlayVisualLayerResult = PlayCueResult;
3672
+ type RestoreVisualLayerResult = {
3673
+ ok: true;
3674
+ snapshot: VisualLayerControllerSnapshot;
3675
+ } | {
3676
+ ok: false;
3677
+ errors: VisualLayerDiagnostic[];
3678
+ };
3679
+ type CreateVisualLayerControllerOptions = {
3680
+ compositor: Compositor;
3681
+ layers: readonly VisualLayerDeclaration[];
3682
+ preloader?: AssetPreloader;
3683
+ originFrame?: number;
3684
+ reducedMotion?: boolean;
3685
+ sceneId?: string;
3686
+ fallback?: VisualLayerFallbackPolicy;
3687
+ onAccepted?: readonly VisualLayerAcceptedBinding[];
3688
+ dispatch?: (event: HostEvent) => void;
3689
+ };
3690
+ type VisualLayerController = {
3691
+ registerSource(assetId: string, source: ImageData | HTMLCanvasElement): void;
3692
+ handleHostEvent(event: HostEvent): void;
3693
+ override(layerId: string, version: string | null): void;
3694
+ play(spec: VisualLayerCueSpec): PlayVisualLayerResult;
3695
+ step(frames?: number): VisualLayerEvent[];
3696
+ snapshot(): VisualLayerControllerSnapshot;
3697
+ restore(input: unknown): RestoreVisualLayerResult;
3698
+ inspect(): VisualLayerInspect[];
3699
+ captureComposedFrame(): ComposedFrame;
3700
+ destroy(): void;
3701
+ readonly frame: number;
3702
+ readonly sceneId: string | null;
3703
+ readonly compositor: Compositor;
3704
+ };
3705
+ type VisualLayerCapture = {
3706
+ frame: ComposedFrame;
3707
+ layers: VisualLayerInspect[];
3708
+ };
3709
+ declare function isVisualLayerKind(value: unknown): value is VisualLayerKind;
3710
+ declare function isVisualLayerTransitionKind(value: unknown): value is VisualLayerTransitionKind;
3711
+ declare function isVisualLayerEventType(value: unknown): value is VisualLayerEventType;
3712
+ declare function visualIncomingLayerId(layerId: string): string;
3713
+ declare function captureVisualLayers(controller: VisualLayerController): VisualLayerCapture;
3714
+ declare function createVisualLayerController(options: CreateVisualLayerControllerOptions): VisualLayerController;
3715
+
3716
+ /**
3717
+ * Copyright (c) 2026 Aaron Boyarsky
3718
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
3719
+ * See packages/engine/LICENSE
3720
+ *
3721
+ * Cart-published named semantic regions (mask / polygon / depth) in normalized
3722
+ * space. The host drives hover/focus/selected and supplies a11y names/roles.
3723
+ * Geometry, blend, and hit-test policy stay with the cart. Snapshot JSON is
3724
+ * hostState-safe. Headless inspect does not require a DOM overlay.
3725
+ */
3726
+
3727
+ declare const SEMANTIC_LAYER_SNAPSHOT_SCHEMA_VERSION: 1;
3728
+ declare const SEMANTIC_GEOMETRY_KINDS: readonly ["mask", "polygon", "rect", "depth"];
3729
+ type SemanticGeometryKind = (typeof SEMANTIC_GEOMETRY_KINDS)[number];
3730
+ declare const SEMANTIC_HIT_TEST_POLICIES: readonly ["pass-through", "absorb", "exclusive", "depth-ordered"];
3731
+ type SemanticHitTestPolicy = (typeof SEMANTIC_HIT_TEST_POLICIES)[number];
3732
+ declare const SEMANTIC_INTERACTION_KEYS: readonly ["hover", "focus", "selected"];
3733
+ type SemanticInteractionKey = (typeof SEMANTIC_INTERACTION_KEYS)[number];
3734
+ declare const SEMANTIC_APPEARANCE_KEYS: readonly ["idle", "hover", "focus", "selected"];
3735
+ type SemanticAppearanceKey = (typeof SEMANTIC_APPEARANCE_KEYS)[number];
3736
+ type SemanticRegionState = {
3737
+ hover: boolean;
3738
+ focus: boolean;
3739
+ selected: boolean;
3740
+ };
3741
+ type SemanticRegionA11y = {
3742
+ name: string;
3743
+ role: string;
3744
+ };
3745
+ type SemanticMaskGrid = {
3746
+ width: number;
3747
+ height: number;
3748
+ /** Row-major coverage in [0, 1]. Length must be width * height. */
3749
+ alpha: readonly number[];
3750
+ /** Where the grid maps in normalized space. Default full content box. */
3751
+ bounds?: NormalizedRect;
3752
+ };
3753
+ type SemanticRegionGeometry = {
3754
+ mask?: SemanticMaskGrid;
3755
+ polygon?: NormalizedPolygon;
3756
+ rect?: NormalizedRect;
3757
+ /** Higher values are closer to the viewer. Default 0. */
3758
+ depth?: number;
3759
+ };
3760
+ type SemanticRegionVisual = {
3761
+ opacity?: number;
3762
+ blend?: CompositorBlendMode;
3763
+ /** Visual-layer version applied when `visualLayerId` is set. */
3764
+ version?: string;
3765
+ };
3766
+ type SemanticRegionVisuals = Partial<Record<SemanticAppearanceKey, SemanticRegionVisual>>;
3767
+ type SemanticRegionDeclaration = {
3768
+ id: string;
3769
+ geometry: SemanticRegionGeometry;
3770
+ hitTest?: SemanticHitTestPolicy;
3771
+ blend?: CompositorBlendMode;
3772
+ order?: number;
3773
+ compositorLayerId?: string;
3774
+ visualLayerId?: string;
3775
+ visuals?: SemanticRegionVisuals;
3776
+ initialState?: Partial<SemanticRegionState>;
3777
+ };
3778
+ type SemanticRegionInspect = {
3779
+ id: string;
3780
+ geometryKinds: SemanticGeometryKind[];
3781
+ hitTest: SemanticHitTestPolicy;
3782
+ blend: CompositorBlendMode;
3783
+ order: number;
3784
+ depth: number;
3785
+ state: SemanticRegionState;
3786
+ appearance: SemanticAppearanceKey;
3787
+ a11y: SemanticRegionA11y | null;
3788
+ visual: SemanticRegionVisual;
3789
+ };
3790
+ type SemanticPublishedRegion = {
3791
+ id: string;
3792
+ geometryKinds: SemanticGeometryKind[];
3793
+ a11y: SemanticRegionA11y | null;
3794
+ };
3795
+ type SemanticRegionSnapshotRow = {
3796
+ id: string;
3797
+ geometry: SemanticRegionGeometry;
3798
+ hitTest: SemanticHitTestPolicy;
3799
+ blend: CompositorBlendMode;
3800
+ order: number;
3801
+ compositorLayerId: string | null;
3802
+ visualLayerId: string | null;
3803
+ visuals: SemanticRegionVisuals;
3804
+ state: SemanticRegionState;
3805
+ a11y: SemanticRegionA11y | null;
3806
+ };
3807
+ type SemanticLayerControllerSnapshot = {
3808
+ schemaVersion: typeof SEMANTIC_LAYER_SNAPSHOT_SCHEMA_VERSION;
3809
+ frame: number;
3810
+ regions: SemanticRegionSnapshotRow[];
3811
+ };
3812
+ type RestoreSemanticLayerResult = {
3813
+ ok: true;
3814
+ snapshot: SemanticLayerControllerSnapshot;
3815
+ } | {
3816
+ ok: false;
3817
+ errors: string[];
3818
+ };
3819
+ type CreateSemanticLayerControllerOptions = {
3820
+ regions: readonly SemanticRegionDeclaration[];
3821
+ compositor?: Compositor;
3822
+ visualLayers?: VisualLayerController;
3823
+ originFrame?: number;
3824
+ };
3825
+ type SemanticLayerController = {
3826
+ list(): SemanticRegionInspect[];
3827
+ inspect(): SemanticRegionInspect[];
3828
+ inspectPublished(): SemanticPublishedRegion[];
3829
+ get(id: string): SemanticRegionInspect | undefined;
3830
+ geometryOf(id: string): SemanticRegionGeometry | undefined;
3831
+ setRegionState(id: string, state: Partial<SemanticRegionState>): void;
3832
+ setRegionA11y(id: string, a11y: SemanticRegionA11y | null): void;
3833
+ hitTest(point: NormalizedPoint): SemanticRegionInspect | undefined;
3834
+ hitTestAll(point: NormalizedPoint): SemanticRegionInspect[];
3835
+ snapshot(): SemanticLayerControllerSnapshot;
3836
+ restore(input: unknown): RestoreSemanticLayerResult;
3837
+ destroy(): void;
3838
+ readonly frame: number;
3839
+ };
3840
+ declare function isSemanticGeometryKind(value: unknown): value is SemanticGeometryKind;
3841
+ declare function isSemanticHitTestPolicy(value: unknown): value is SemanticHitTestPolicy;
3842
+ declare function isSemanticBlendMode(value: unknown): value is CompositorBlendMode;
3843
+ declare function geometryKindsOf(geometry: SemanticRegionGeometry): SemanticGeometryKind[];
3844
+ declare function appearanceForState(state: SemanticRegionState): SemanticAppearanceKey;
3845
+ declare function pointInSemanticGeometry(geometry: SemanticRegionGeometry, point: NormalizedPoint): boolean;
3846
+ declare function createSemanticLayerController(options: CreateSemanticLayerControllerOptions): SemanticLayerController;
3847
+
3848
+ /**
3849
+ * Copyright (c) 2026 Aaron Boyarsky
3850
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
3851
+ * See packages/engine/LICENSE
3852
+ *
3853
+ * Cross-modal presentation sequences. One frame-stepped clock coordinates
3854
+ * audio, captions, semantic-region state, visual layers, and typed cues.
3855
+ * Authored content is JSON-serializable: no callbacks, no ambient host access.
3856
+ * Dialogue graphs and game rules stay with the host.
3857
+ */
3858
+
3859
+ declare const PRESENTATION_SEQUENCE_SNAPSHOT_SCHEMA_VERSION: 1;
3860
+ declare const PRESENTATION_SEQUENCE_REQUESTED_EVENT: "presentation.sequence.state.requested";
3861
+ declare const PRESENTATION_SEQUENCE_PRELOADING_EVENT: "presentation.sequence.state.preloading";
3862
+ declare const PRESENTATION_SEQUENCE_READY_EVENT: "presentation.sequence.state.ready";
3863
+ declare const PRESENTATION_SEQUENCE_STARTED_EVENT: "presentation.sequence.state.started";
3864
+ declare const PRESENTATION_SEQUENCE_STEP_STARTED_EVENT: "presentation.sequence.state.step-started";
3865
+ declare const PRESENTATION_SEQUENCE_STEP_COMPLETED_EVENT: "presentation.sequence.state.step-completed";
3866
+ declare const PRESENTATION_SEQUENCE_SKIPPED_EVENT: "presentation.sequence.state.skipped";
3867
+ declare const PRESENTATION_SEQUENCE_INTERRUPTED_EVENT: "presentation.sequence.state.interrupted";
3868
+ declare const PRESENTATION_SEQUENCE_FAILED_EVENT: "presentation.sequence.state.failed";
3869
+ declare const PRESENTATION_SEQUENCE_COMPLETED_EVENT: "presentation.sequence.state.completed";
3870
+ declare const PRESENTATION_SEQUENCE_DIAGNOSTIC_EVENT: "presentation.sequence.diagnostic.lifecycle";
3871
+ declare const PRESENTATION_SEQUENCE_EVENTS: readonly ["presentation.sequence.state.requested", "presentation.sequence.state.preloading", "presentation.sequence.state.ready", "presentation.sequence.state.started", "presentation.sequence.state.step-started", "presentation.sequence.state.step-completed", "presentation.sequence.state.skipped", "presentation.sequence.state.interrupted", "presentation.sequence.state.failed", "presentation.sequence.state.completed", "presentation.sequence.diagnostic.lifecycle"];
3872
+ type PresentationSequenceEventType = (typeof PRESENTATION_SEQUENCE_EVENTS)[number];
3873
+ declare const PRESENTATION_TRACK_KINDS: readonly ["audio", "caption", "semantic-region", "visual-layer", "cue"];
3874
+ type PresentationTrackKind = (typeof PRESENTATION_TRACK_KINDS)[number];
3875
+ declare const PRESENTATION_INTERRUPTION_POLICIES: readonly ["replace", "queue", "reject", "ignore"];
3876
+ type PresentationInterruptionPolicy = (typeof PRESENTATION_INTERRUPTION_POLICIES)[number];
3877
+ declare const PRESENTATION_COMPLETION_RULES: readonly ["duration", "immediate"];
3878
+ type PresentationCompletionRule = (typeof PRESENTATION_COMPLETION_RULES)[number];
3879
+ declare const PRESENTATION_AUDIO_CAPABILITY_STATUSES: readonly ["unavailable", "failed", "unauthorized", "muted"];
3880
+ type PresentationAudioCapabilityStatus = (typeof PRESENTATION_AUDIO_CAPABILITY_STATUSES)[number];
3881
+ declare const PRESENTATION_INVOCATION_PHASES: readonly ["requested", "preloading", "ready", "playing", "paused", "skipped", "interrupted", "failed", "completed"];
3882
+ type PresentationInvocationPhase = (typeof PRESENTATION_INVOCATION_PHASES)[number];
3883
+ type PresentationSequenceDiagnostic = {
3884
+ code: string;
3885
+ detail: string;
3886
+ path?: string;
3887
+ };
3888
+ type PresentationStepTiming = {
3889
+ kind: 'absolute';
3890
+ atFrame: number;
3891
+ } | {
3892
+ kind: 'relative';
3893
+ afterStepId?: string;
3894
+ delayFrames?: number;
3895
+ } | {
3896
+ kind: 'simultaneous';
3897
+ withStepId: string;
3898
+ order?: number;
3899
+ delayFrames?: number;
3900
+ };
3901
+ type PresentationStepEffect = {
3902
+ kind: 'audio';
3903
+ assetBinding: string;
3904
+ channelBinding?: string;
3905
+ } | {
3906
+ kind: 'caption';
3907
+ textBinding: string;
3908
+ visible: boolean;
3909
+ } | {
3910
+ kind: 'semantic-region';
3911
+ regionBinding: string;
3912
+ state: Partial<Pick<SemanticRegionState, 'hover' | 'focus' | 'selected'>>;
3913
+ } | {
3914
+ kind: 'visual-layer';
3915
+ layerBinding: string;
3916
+ transition: Extract<VisualLayerTransitionKind, 'show' | 'hide'>;
3917
+ versionBinding?: string;
3918
+ } | {
3919
+ kind: 'cue';
3920
+ name: string;
3921
+ easing?: CueEasing;
3922
+ };
3923
+ type PresentationStepDefinition = {
3924
+ id: string;
3925
+ timing: PresentationStepTiming;
3926
+ durationFrames: number;
3927
+ delayFrames?: number;
3928
+ completion?: PresentationCompletionRule;
3929
+ effect: PresentationStepEffect;
3930
+ restoreOnComplete?: boolean;
3931
+ reducedMotion?: CueReducedMotionPolicy;
3932
+ reducedSensory?: 'keep' | 'skip-audio' | 'complete';
3933
+ };
3934
+ type PresentationTrackDefinition = {
3935
+ id: string;
3936
+ kind: PresentationTrackKind;
3937
+ steps: readonly PresentationStepDefinition[];
3938
+ };
3939
+ type PresentationFallbackWhen = {
3940
+ capability: 'audio';
3941
+ status: PresentationAudioCapabilityStatus;
3942
+ };
3943
+ type PresentationFallbackDefinition = {
3944
+ id: string;
3945
+ when: PresentationFallbackWhen;
3946
+ omitTrackIds?: readonly string[];
3947
+ };
3948
+ type PresentationSequenceDefinition = {
3949
+ id: string;
3950
+ tracks: readonly PresentationTrackDefinition[];
3951
+ interruptionPolicy?: PresentationInterruptionPolicy;
3952
+ fallbacks?: readonly PresentationFallbackDefinition[];
3953
+ };
3954
+ type PresentationSequenceBindings = {
3955
+ assets?: Record<string, string>;
3956
+ captions?: Record<string, string>;
3957
+ regions?: Record<string, string>;
3958
+ layers?: Record<string, string>;
3959
+ versions?: Record<string, string>;
3960
+ channels?: Record<string, string>;
3961
+ };
3962
+ type PlaySequenceOptions = {
3963
+ invocationId: string;
3964
+ idempotencyKey?: string;
3965
+ bindings?: PresentationSequenceBindings;
3966
+ };
3967
+ type DefinePresentationSequenceResult = {
3968
+ ok: true;
3969
+ sequence: PresentationSequenceDefinition;
3970
+ } | {
3971
+ ok: false;
3972
+ errors: PresentationSequenceDiagnostic[];
3973
+ };
3974
+ type PlaySequenceResult = {
3975
+ ok: true;
3976
+ invocation: PresentationInvocationView;
3977
+ } | {
3978
+ ok: false;
3979
+ reason: 'unknown-sequence' | 'invalid' | 'busy' | 'duplicate';
3980
+ detail: string;
3981
+ };
3982
+ type RestorePresentationSequenceResult = {
3983
+ ok: true;
3984
+ snapshot: PresentationSequenceSnapshot;
3985
+ } | {
3986
+ ok: false;
3987
+ errors: PresentationSequenceDiagnostic[];
3988
+ };
3989
+ type PresentationSequenceEvent = {
3990
+ type: PresentationSequenceEventType;
3991
+ atFrame: number;
3992
+ sequenceId: string;
3993
+ invocationId: string;
3994
+ idempotencyKey: string;
3995
+ stepId?: string;
3996
+ fallbackId?: string;
3997
+ reason?: string;
3998
+ };
3999
+ type PresentationCaptionView = {
4000
+ id: string;
4001
+ text: string;
4002
+ visible: boolean;
4003
+ };
4004
+ type PresentationCueIntent = {
4005
+ sequenceId: string;
4006
+ stepId: string;
4007
+ trackId: string;
4008
+ kind: PresentationTrackKind;
4009
+ startFrame: number;
4010
+ durationFrames: number;
4011
+ order: number;
4012
+ effect: PresentationStepEffect;
4013
+ };
4014
+ type PresentationInvocationView = {
4015
+ sequenceId: string;
4016
+ invocationId: string;
4017
+ idempotencyKey: string;
4018
+ phase: PresentationInvocationPhase;
4019
+ playhead: number;
4020
+ startedAtFrame: number;
4021
+ completedStepIds: string[];
4022
+ activeStepIds: string[];
4023
+ selectedFallbackId: string | null;
4024
+ };
4025
+ type PresentationSequenceSnapshot = {
4026
+ schemaVersion: typeof PRESENTATION_SEQUENCE_SNAPSHOT_SCHEMA_VERSION;
4027
+ frame: number;
4028
+ reducedMotion: boolean;
4029
+ reducedSensory: boolean;
4030
+ paused: boolean;
4031
+ active: PresentationInvocationView | null;
4032
+ queue: PresentationSequenceSnapshotQueued[];
4033
+ captions: PresentationCaptionView[];
4034
+ events: PresentationSequenceEvent[];
4035
+ bindings: PresentationSequenceBindings | null;
4036
+ };
4037
+ type PresentationSequenceSnapshotQueued = {
4038
+ sequenceId: string;
4039
+ invocationId: string;
4040
+ idempotencyKey: string;
4041
+ bindings: PresentationSequenceBindings;
4042
+ };
4043
+ type PresentationSequenceInspect = {
4044
+ frame: number;
4045
+ paused: boolean;
4046
+ reducedMotion: boolean;
4047
+ reducedSensory: boolean;
4048
+ active: PresentationInvocationView | null;
4049
+ queue: PresentationInvocationView[];
4050
+ captions: PresentationCaptionView[];
4051
+ cueIntent: PresentationCueIntent[];
4052
+ };
4053
+ type CreatePresentationSequencePlayerOptions = {
4054
+ originFrame?: number;
4055
+ reducedMotion?: boolean;
4056
+ reducedSensory?: boolean;
4057
+ audio?: AudioCueTimeline | HeadlessAudioAdapter;
4058
+ semantic?: SemanticLayerController;
4059
+ visual?: VisualLayerController;
4060
+ sequences?: readonly PresentationSequenceDefinition[];
4061
+ };
4062
+ type PresentationSequencePlayer = {
4063
+ define(input: PresentationSequenceDefinition): DefinePresentationSequenceResult;
4064
+ playSequence(sequenceId: string, options: PlaySequenceOptions): PlaySequenceResult;
4065
+ skip(invocationId?: string): boolean;
4066
+ replay(invocationId?: string): PlaySequenceResult;
4067
+ pause(): boolean;
4068
+ resume(): boolean;
4069
+ cancel(invocationId?: string): boolean;
4070
+ step(frames?: number): PresentationSequenceEvent[];
4071
+ snapshot(): PresentationSequenceSnapshot;
4072
+ restore(input: unknown): RestorePresentationSequenceResult;
4073
+ inspect(): PresentationSequenceInspect;
4074
+ inspectCueIntent(sequenceId: string, options?: {
4075
+ fallbackId?: string;
4076
+ }): PresentationCueIntent[];
4077
+ get(sequenceId: string): PresentationSequenceDefinition | undefined;
4078
+ destroy(): void;
4079
+ readonly frame: number;
4080
+ readonly reducedMotion: boolean;
4081
+ readonly reducedSensory: boolean;
4082
+ };
4083
+ declare function presentationSequenceEventContracts(): EventContract[];
4084
+ declare function isPresentationSequenceEventType(value: unknown): value is PresentationSequenceEventType;
4085
+ declare function definePresentationSequence(input: unknown): DefinePresentationSequenceResult;
4086
+ declare function createPresentationSequencePlayer(options?: CreatePresentationSequencePlayerOptions): PresentationSequencePlayer;
4087
+
4088
+ /**
4089
+ * Copyright (c) 2026 Aaron Boyarsky
4090
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
4091
+ * See packages/engine/LICENSE
4092
+ *
4093
+ * Declarative projection of host-authoritative state into presentation
4094
+ * resources. The host reducer stays the owner; this module evaluates a
4095
+ * bounded, JSON-serializable binding manifest and applies one coherent
4096
+ * presentation revision (or the declared fail-closed defaults).
4097
+ */
4098
+
4099
+ declare const PRESENTATION_BINDING_SNAPSHOT_SCHEMA_VERSION: 1;
4100
+ declare const PRESENTATION_BINDING_MANIFEST_VERSION: 1;
4101
+ declare const PRESENTATION_BINDING_APPLIED_EVENT: "presentation.binding.state.applied";
4102
+ declare const PRESENTATION_BINDING_REJECTED_EVENT: "presentation.binding.state.rejected";
4103
+ declare const PRESENTATION_BINDING_DIAGNOSTIC_EVENT: "presentation.binding.diagnostic.lifecycle";
4104
+ declare const PRESENTATION_BINDING_EVENTS: readonly ["presentation.binding.state.applied", "presentation.binding.state.rejected", "presentation.binding.diagnostic.lifecycle"];
4105
+ type PresentationBindingEventType = (typeof PRESENTATION_BINDING_EVENTS)[number];
4106
+ declare const PRESENTATION_BINDING_TARGET_KINDS: readonly ["visual-layer", "presence", "prop", "semantic-region", "hotspot", "sequence", "asset"];
4107
+ type PresentationBindingTargetKind = (typeof PRESENTATION_BINDING_TARGET_KINDS)[number];
4108
+ declare const PRESENTATION_BINDING_ERROR_CODES: readonly ["invalid-manifest", "invalid-schema", "invalid-version", "invalid-id", "unknown-field", "unknown-resource", "unknown-selector", "duplicate-id", "duplicate-priority", "uncovered-default", "impossible-target", "callbacks-forbidden", "invalid-predicate", "invalid-projection", "invalid-snapshot", "destroyed"];
4109
+ type PresentationBindingErrorCode = (typeof PRESENTATION_BINDING_ERROR_CODES)[number];
4110
+ type PresentationBindingDiagnostic = {
4111
+ code: PresentationBindingErrorCode | string;
4112
+ detail: string;
4113
+ path?: string;
4114
+ };
4115
+ type JsonPrimitive = string | number | boolean | null;
4116
+ type JsonObject = {
4117
+ [key: string]: JsonValue;
4118
+ };
4119
+ type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
4120
+ type PresentationPredicate = {
4121
+ path: string;
4122
+ eq: JsonPrimitive;
4123
+ } | {
4124
+ path: string;
4125
+ neq: JsonPrimitive;
4126
+ } | {
4127
+ path: string;
4128
+ present: boolean;
4129
+ } | {
4130
+ selector: string;
4131
+ } | {
4132
+ all: PresentationPredicate[];
4133
+ } | {
4134
+ any: PresentationPredicate[];
4135
+ } | {
4136
+ not: PresentationPredicate;
4137
+ };
4138
+ type PresentationBindingTarget = {
4139
+ kind: 'visual-layer';
4140
+ layerId: string;
4141
+ version: string;
4142
+ transition?: Extract<VisualLayerTransitionKind, 'show' | 'hide' | 'replace'>;
4143
+ } | {
4144
+ kind: 'presence';
4145
+ entityId: string;
4146
+ present: boolean;
4147
+ regionId?: string;
4148
+ } | {
4149
+ kind: 'prop';
4150
+ propId: string;
4151
+ visible: boolean;
4152
+ layerId?: string;
4153
+ } | {
4154
+ kind: 'semantic-region';
4155
+ regionId: string;
4156
+ state?: Partial<Pick<SemanticRegionState, 'hover' | 'focus' | 'selected'>>;
4157
+ hitTestEnabled?: boolean;
4158
+ } | {
4159
+ kind: 'hotspot';
4160
+ hotspotId: string;
4161
+ enabled: boolean;
4162
+ regionId?: string;
4163
+ } | {
4164
+ kind: 'sequence';
4165
+ sequenceId: string;
4166
+ play?: boolean;
4167
+ } | {
4168
+ kind: 'asset';
4169
+ bindingId: string;
4170
+ assetId: string;
2342
4171
  };
2343
- type VisualLayerControllerSnapshot = {
2344
- schemaVersion: typeof VISUAL_LAYER_SNAPSHOT_SCHEMA_VERSION;
2345
- frame: number;
2346
- sceneId: string | null;
2347
- reducedMotion: boolean;
2348
- layers: VisualLayerSnapshotRow[];
2349
- assets: Record<string, VisualLayerAssetStatus>;
2350
- events: VisualLayerEvent[];
2351
- diagnostics: VisualLayerDiagnostic[];
4172
+ type PresentationBinding = {
4173
+ id: string;
4174
+ priority: number;
4175
+ when: PresentationPredicate;
4176
+ targets: readonly PresentationBindingTarget[];
4177
+ };
4178
+ type PresentationBindingResources = {
4179
+ layers?: readonly string[];
4180
+ versions?: Readonly<Record<string, readonly string[]>>;
4181
+ regions?: readonly string[];
4182
+ sequences?: readonly string[];
4183
+ hotspots?: readonly string[];
4184
+ entities?: readonly string[];
4185
+ props?: readonly string[];
4186
+ assets?: readonly string[];
4187
+ };
4188
+ type PresentationBindingManifest = {
4189
+ id: string;
4190
+ schemaVersion: typeof PRESENTATION_BINDING_MANIFEST_VERSION;
4191
+ bindings: readonly PresentationBinding[];
4192
+ defaults: readonly PresentationBindingTarget[];
4193
+ resources?: PresentationBindingResources;
2352
4194
  };
2353
- type PlayVisualLayerResult = PlayCueResult;
2354
- type RestoreVisualLayerResult = {
4195
+ type DefinePresentationBindingsResult = {
2355
4196
  ok: true;
2356
- snapshot: VisualLayerControllerSnapshot;
4197
+ manifest: PresentationBindingManifest;
2357
4198
  } | {
2358
4199
  ok: false;
2359
- errors: VisualLayerDiagnostic[];
4200
+ errors: PresentationBindingDiagnostic[];
2360
4201
  };
2361
- type CreateVisualLayerControllerOptions = {
2362
- compositor: Compositor;
2363
- layers: readonly VisualLayerDeclaration[];
2364
- preloader?: AssetPreloader;
2365
- originFrame?: number;
4202
+ type PresentationBindingSelector = (projection: JsonObject) => boolean;
4203
+ type PresentationBindingConsidered = {
4204
+ bindingId: string;
4205
+ predicateResult: boolean;
4206
+ detail?: string;
4207
+ };
4208
+ type PresentationBindingRejected = {
4209
+ bindingId: string;
4210
+ targetKey: string;
4211
+ reason: 'lower-priority' | 'predicate-false';
4212
+ };
4213
+ type PresentationBindingFallback = {
4214
+ targetKey: string;
4215
+ reason: 'uncovered-default' | 'missing-state' | 'invalid-projection';
4216
+ };
4217
+ type PresentationBindingExplanation = {
4218
+ considered: PresentationBindingConsidered[];
4219
+ winners: Record<string, {
4220
+ bindingId: string | null;
4221
+ target: PresentationBindingTarget;
4222
+ }>;
4223
+ rejected: PresentationBindingRejected[];
4224
+ fallbacks: PresentationBindingFallback[];
4225
+ fallbackReason: 'missing-state' | 'invalid-projection' | null;
4226
+ };
4227
+ type PresentationBindingEvaluation = {
4228
+ selectedBindingIds: string[];
4229
+ targets: PresentationBindingTarget[];
4230
+ usedFallback: boolean;
4231
+ fallbackReason: 'missing-state' | 'invalid-projection' | null;
4232
+ explanation: PresentationBindingExplanation;
4233
+ };
4234
+ type HostPresentationOverride = {
4235
+ labels?: Record<string, string | Pick<SemanticRegionA11y, 'name' | 'role'>>;
4236
+ reducedSensory?: boolean;
2366
4237
  reducedMotion?: boolean;
2367
- sceneId?: string;
2368
- fallback?: VisualLayerFallbackPolicy;
2369
- onAccepted?: readonly VisualLayerAcceptedBinding[];
2370
- dispatch?: (event: HostEvent) => void;
2371
4238
  };
2372
- type VisualLayerController = {
2373
- registerSource(assetId: string, source: ImageData | HTMLCanvasElement): void;
2374
- handleHostEvent(event: HostEvent): void;
2375
- override(layerId: string, version: string | null): void;
2376
- play(spec: VisualLayerCueSpec): PlayVisualLayerResult;
2377
- step(frames?: number): VisualLayerEvent[];
2378
- snapshot(): VisualLayerControllerSnapshot;
2379
- restore(input: unknown): RestoreVisualLayerResult;
2380
- inspect(): VisualLayerInspect[];
2381
- captureComposedFrame(): ComposedFrame;
2382
- destroy(): void;
2383
- readonly frame: number;
2384
- readonly sceneId: string | null;
2385
- readonly compositor: Compositor;
4239
+ type PresentationBindingInspect = {
4240
+ revision: string | number | null;
4241
+ selectedBindingIds: string[];
4242
+ layers: Record<string, string>;
4243
+ presence: Record<string, boolean>;
4244
+ props: Record<string, boolean>;
4245
+ regions: Record<string, Partial<SemanticRegionState> & {
4246
+ hitTestEnabled?: boolean;
4247
+ }>;
4248
+ hotspots: Record<string, boolean>;
4249
+ sequences: Record<string, 'playing' | 'idle'>;
4250
+ assets: Record<string, string>;
4251
+ override: HostPresentationOverride | null;
4252
+ usedFallback: boolean;
4253
+ fallbackReason: 'missing-state' | 'invalid-projection' | null;
4254
+ explanation: PresentationBindingExplanation | null;
4255
+ };
4256
+ type PresentationBindingSnapshot = {
4257
+ schemaVersion: typeof PRESENTATION_BINDING_SNAPSHOT_SCHEMA_VERSION;
4258
+ manifestId: string;
4259
+ projectionRevision: string | number | null;
4260
+ selectedBindingIds: string[];
4261
+ targets: PresentationBindingTarget[];
4262
+ usedFallback: boolean;
4263
+ fallbackReason: 'missing-state' | 'invalid-projection' | null;
4264
+ override: HostPresentationOverride | null;
4265
+ };
4266
+ type PresentationBindingEvent = {
4267
+ type: PresentationBindingEventType;
4268
+ atRevision: string | number | null;
4269
+ manifestId: string;
4270
+ selectedBindingIds: string[];
4271
+ reason?: string;
2386
4272
  };
2387
- type VisualLayerCapture = {
2388
- frame: ComposedFrame;
2389
- layers: VisualLayerInspect[];
4273
+ type ApplyPresentationBindingsResult = {
4274
+ ok: true;
4275
+ revision: string | number;
4276
+ selectedBindingIds: string[];
4277
+ usedFallback: boolean;
4278
+ fallbackReason: 'missing-state' | 'invalid-projection' | null;
4279
+ explanation: PresentationBindingExplanation;
4280
+ inspect: PresentationBindingInspect;
4281
+ } | {
4282
+ ok: false;
4283
+ errors: PresentationBindingDiagnostic[];
4284
+ inspect: PresentationBindingInspect;
2390
4285
  };
2391
- declare function isVisualLayerKind(value: unknown): value is VisualLayerKind;
2392
- declare function isVisualLayerTransitionKind(value: unknown): value is VisualLayerTransitionKind;
2393
- declare function isVisualLayerEventType(value: unknown): value is VisualLayerEventType;
2394
- declare function visualIncomingLayerId(layerId: string): string;
2395
- declare function captureVisualLayers(controller: VisualLayerController): VisualLayerCapture;
2396
- declare function createVisualLayerController(options: CreateVisualLayerControllerOptions): VisualLayerController;
4286
+ type RestorePresentationBindingsResult = {
4287
+ ok: true;
4288
+ snapshot: PresentationBindingSnapshot;
4289
+ } | {
4290
+ ok: false;
4291
+ errors: PresentationBindingDiagnostic[];
4292
+ };
4293
+ type CreatePresentationBindingRuntimeOptions = {
4294
+ manifest: PresentationBindingManifest | unknown;
4295
+ visual?: VisualLayerController;
4296
+ semantic?: SemanticLayerController;
4297
+ sequences?: PresentationSequencePlayer;
4298
+ selectors?: Readonly<Record<string, PresentationBindingSelector>>;
4299
+ router?: Pick<EventRouter, 'publish'>;
4300
+ onEvent?: (event: EventInput) => void;
4301
+ };
4302
+ type PresentationBindingRuntime = {
4303
+ apply(projection: unknown, options?: {
4304
+ revision?: string | number;
4305
+ }): ApplyPresentationBindingsResult;
4306
+ setOverride(override: HostPresentationOverride | null): void;
4307
+ evaluate(projection: unknown): PresentationBindingEvaluation;
4308
+ inspect(): PresentationBindingInspect;
4309
+ snapshot(): PresentationBindingSnapshot;
4310
+ restore(input: unknown): RestorePresentationBindingsResult;
4311
+ destroy(): void;
4312
+ readonly manifest: PresentationBindingManifest;
4313
+ };
4314
+ declare function isPresentationBindingEventType(value: unknown): value is PresentationBindingEventType;
4315
+ declare function isPresentationBindingErrorCode(value: unknown): value is PresentationBindingErrorCode;
4316
+ declare function presentationBindingEventContracts(): EventContract[];
4317
+ declare function presentationBindingTargetKey(target: PresentationBindingTarget): string;
4318
+ declare function definePresentationBindings(input: unknown): DefinePresentationBindingsResult;
4319
+ declare function evaluatePresentationBindings(manifest: PresentationBindingManifest, projection: unknown, selectors?: Readonly<Record<string, PresentationBindingSelector>>): PresentationBindingEvaluation;
4320
+ declare function createPresentationBindingRuntime(options: CreatePresentationBindingRuntimeOptions): PresentationBindingRuntime;
2397
4321
 
2398
4322
  /**
2399
4323
  * Copyright (c) 2026 Aaron Boyarsky
2400
4324
  * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2401
4325
  * See packages/engine/LICENSE
2402
4326
  *
2403
- * Trusted, versioned executable-module host. Factories are registered by
2404
- * exact id+version; the host allowlists which refs may load. Untrusted
2405
- * source strings are not compiled. Per-module failures do not stop siblings.
4327
+ * Atomic external content-revision activation. Adapters discover and load
4328
+ * revision catalogs; the activator stages every declared asset, then commits
4329
+ * one complete bundle (or keeps the last known good). Consumers never see a
4330
+ * mixed old/new scene.
2406
4331
  */
2407
- declare const EXECUTABLE_MODULE_ERROR_CODES: readonly ["invalid-ref", "unknown-module", "version-mismatch", "not-allowlisted", "load-failed", "invoke-failed", "timeout", "rate-limited", "destroyed"];
2408
- type ExecutableModuleErrorCode = (typeof EXECUTABLE_MODULE_ERROR_CODES)[number];
2409
- type ExecutableModuleRef = {
2410
- id: string;
2411
- version: string;
2412
- };
2413
- type ExecutableModuleError = {
2414
- code: ExecutableModuleErrorCode;
4332
+
4333
+ declare const CONTENT_REVISION_SNAPSHOT_SCHEMA_VERSION: 1;
4334
+ declare const CONTENT_REVISION_MANIFEST_VERSION: 1;
4335
+ declare const CONTENT_REVISION_DISCOVERED_EVENT: "content.revision.state.discovered";
4336
+ declare const CONTENT_REVISION_STAGING_EVENT: "content.revision.state.staging";
4337
+ declare const CONTENT_REVISION_VALIDATED_EVENT: "content.revision.state.validated";
4338
+ declare const CONTENT_REVISION_REJECTED_EVENT: "content.revision.state.rejected";
4339
+ declare const CONTENT_REVISION_ACTIVATED_EVENT: "content.revision.state.activated";
4340
+ declare const CONTENT_REVISION_ROLLED_BACK_EVENT: "content.revision.state.rolled-back";
4341
+ declare const CONTENT_REVISION_SUPERSEDED_EVENT: "content.revision.state.superseded";
4342
+ declare const CONTENT_REVISION_DIAGNOSTIC_EVENT: "content.revision.diagnostic.lifecycle";
4343
+ declare const CONTENT_REVISION_EVENTS: readonly ["content.revision.state.discovered", "content.revision.state.staging", "content.revision.state.validated", "content.revision.state.rejected", "content.revision.state.activated", "content.revision.state.rolled-back", "content.revision.state.superseded", "content.revision.diagnostic.lifecycle"];
4344
+ type ContentRevisionEventType = (typeof CONTENT_REVISION_EVENTS)[number];
4345
+ declare const CONTENT_REVISION_ERROR_CODES: readonly ["invalid-manifest", "invalid-schema", "invalid-version", "invalid-snapshot", "unknown-revision", "unknown-adapter", "hash-mismatch", "capability-denied", "pinned", "staging-failed", "activation-failed", "health-check-failed", "stale-health-check", "superseded", "destroyed", "adapter-missing", "asset-failed", "unsigned"];
4346
+ type ContentRevisionErrorCode = (typeof CONTENT_REVISION_ERROR_CODES)[number];
4347
+ type ContentRevisionDiagnostic = {
4348
+ code: ContentRevisionErrorCode | string;
2415
4349
  detail: string;
2416
- ref?: ExecutableModuleRef;
2417
- };
2418
- type ExecutableModuleDiagnostic = ExecutableModuleError;
2419
- type ExecutableModuleCapabilities = {
2420
- readonly [key: string]: unknown;
2421
- };
2422
- type ExecutableModuleInvokeContext = {
2423
- signal: AbortSignal;
2424
- turn: number;
2425
- };
2426
- type ExecutableModuleInstance = {
2427
- invoke(input: unknown, context: ExecutableModuleInvokeContext): unknown | Promise<unknown>;
2428
- destroy?: () => void;
4350
+ path?: string;
2429
4351
  };
2430
- type ExecutableModuleFactory = (capabilities: ExecutableModuleCapabilities) => ExecutableModuleInstance;
2431
- type ExecutableModuleRegistration = {
4352
+ type ContentRevisionAssetDecl = {
2432
4353
  id: string;
2433
- version: string;
2434
- create: ExecutableModuleFactory;
2435
- capabilities?: ExecutableModuleCapabilities;
4354
+ kind: AssetKind;
4355
+ url: string;
4356
+ hash: string;
4357
+ alg: 'sha256';
4358
+ optional?: boolean;
4359
+ fallback?: {
4360
+ id: string;
4361
+ kind: AssetKind;
4362
+ url: string;
4363
+ hash: string;
4364
+ alg: 'sha256';
4365
+ };
2436
4366
  };
2437
- type ExecutableModuleLimits = {
2438
- /** Cooperative timeout; the invoke AbortSignal aborts after this many ms. */
2439
- maxInvokeMs?: number;
2440
- maxInvokesPerTurn?: number;
4367
+ type ContentRevisionCatalog = {
4368
+ contentId: string;
4369
+ revision: string;
4370
+ manifestVersion: typeof CONTENT_REVISION_MANIFEST_VERSION;
4371
+ publisher: string;
4372
+ source: string;
4373
+ adapterId: string;
4374
+ assets: ContentRevisionAssetDecl[];
4375
+ requestedGrants?: RemoteCartGrant[];
4376
+ capabilities?: CapabilityManifest;
4377
+ signature?: {
4378
+ id: string;
4379
+ alg: string;
4380
+ };
2441
4381
  };
2442
- type CreateExecutableModuleHostOptions = {
2443
- allowlist: readonly ExecutableModuleRef[];
2444
- modules: readonly ExecutableModuleRegistration[];
2445
- limits?: ExecutableModuleLimits;
2446
- /** Default capability bag. Frozen per module; class instances stay shared handles. */
2447
- capabilities?: ExecutableModuleCapabilities;
4382
+ type ContentRevisionDescriptor = {
4383
+ contentId: string;
4384
+ revision: string;
4385
+ adapterId: string;
4386
+ publisher: string;
4387
+ source: string;
2448
4388
  };
2449
- type ExecutableModuleInvokeResult = {
4389
+ type ContentRevisionResource = {
4390
+ id: string;
4391
+ kind: AssetKind;
4392
+ ref: string;
4393
+ hash: string;
4394
+ url: string;
4395
+ optional: boolean;
4396
+ usedFallback: boolean;
4397
+ };
4398
+ type ContentRevisionBundle = {
4399
+ bundleId: string;
4400
+ contentId: string;
4401
+ revision: string;
4402
+ manifestVersion: typeof CONTENT_REVISION_MANIFEST_VERSION;
4403
+ publisher: string;
4404
+ source: string;
4405
+ adapterId: string;
4406
+ signature?: {
4407
+ id: string;
4408
+ alg: string;
4409
+ };
4410
+ resources: Record<string, ContentRevisionResource>;
4411
+ };
4412
+ type ContentRevisionStagingView = {
4413
+ contentId: string;
4414
+ revision: string;
4415
+ adapterId: string;
4416
+ bundleId: string;
4417
+ };
4418
+ type ContentRevisionInspect = {
4419
+ destroyed: boolean;
4420
+ pinned: boolean;
4421
+ active: ContentRevisionBundle | null;
4422
+ lastKnownGood: ContentRevisionBundle | null;
4423
+ staging: ContentRevisionStagingView | null;
4424
+ events: ContentRevisionEventType[];
4425
+ lastRejection: ContentRevisionDiagnostic[] | null;
4426
+ };
4427
+ type ContentRevisionSnapshot = {
4428
+ schemaVersion: typeof CONTENT_REVISION_SNAPSHOT_SCHEMA_VERSION;
4429
+ pinned: boolean;
4430
+ active: ContentRevisionBundle | null;
4431
+ lastKnownGood: ContentRevisionBundle | null;
4432
+ previous: ContentRevisionBundle | null;
4433
+ };
4434
+ type ContentRevisionMutationResult = {
2450
4435
  ok: true;
2451
- value: unknown;
4436
+ bundle: ContentRevisionBundle | null;
4437
+ idempotent?: boolean;
2452
4438
  } | {
2453
4439
  ok: false;
2454
- error: ExecutableModuleError;
4440
+ errors: ContentRevisionDiagnostic[];
2455
4441
  };
2456
- type ExecutableModuleLoadResult = {
4442
+ type RestoreContentRevisionResult = {
2457
4443
  ok: true;
2458
- ref: ExecutableModuleRef;
4444
+ snapshot: ContentRevisionSnapshot;
2459
4445
  } | {
2460
4446
  ok: false;
2461
- error: ExecutableModuleError;
4447
+ errors: ContentRevisionDiagnostic[];
2462
4448
  };
2463
- type ExecutableModuleHostInspect = {
2464
- allowlist: ExecutableModuleRef[];
2465
- registered: ExecutableModuleRef[];
2466
- loaded: ExecutableModuleRef[];
2467
- turn: number;
2468
- invokesThisTurn: number;
2469
- diagnostics: ExecutableModuleDiagnostic[];
4449
+ type ActivateContentRevisionRequest = {
4450
+ contentId: string;
4451
+ revision?: string;
4452
+ adapterId?: string;
2470
4453
  };
2471
- type ExecutableModuleHost = {
2472
- load(ref: ExecutableModuleRef): ExecutableModuleLoadResult;
2473
- invoke(ref: ExecutableModuleRef, input?: unknown): Promise<ExecutableModuleInvokeResult>;
2474
- beginTurn(): void;
2475
- inspect(): ExecutableModuleHostInspect;
4454
+ type ContentRevisionFetchBytes = (url: string, signal?: AbortSignal) => Promise<Uint8Array | undefined>;
4455
+ type ContentRegistryAdapter = {
4456
+ readonly id: string;
4457
+ hasRevision(contentId: string, revision: string): boolean;
4458
+ discover(contentId: string): Promise<ContentRevisionDescriptor | undefined>;
4459
+ loadRevision(contentId: string, revision: string, signal?: AbortSignal): Promise<{
4460
+ ok: true;
4461
+ catalog: ContentRevisionCatalog;
4462
+ } | {
4463
+ ok: false;
4464
+ errors: ContentRevisionDiagnostic[];
4465
+ }>;
4466
+ fetchBytes: ContentRevisionFetchBytes;
4467
+ };
4468
+ type CreateStaticContentAdapterOptions = {
4469
+ id?: string;
4470
+ revisions: readonly ContentRevisionCatalog[];
4471
+ bytesByUrl: Readonly<Record<string, Uint8Array>>;
4472
+ fetchBytes?: ContentRevisionFetchBytes;
4473
+ };
4474
+ type RemoteContentEnvelope = {
4475
+ world: string;
4476
+ revision: string;
4477
+ manifest: SignedRemoteCartManifest;
4478
+ };
4479
+ type CreateRemoteContentAdapterOptions = {
4480
+ id?: string;
4481
+ fetch: (url: string, signal?: AbortSignal) => Promise<unknown>;
4482
+ keys: Readonly<Record<string, string>>;
4483
+ bytesByUrl?: Readonly<Record<string, Uint8Array>>;
4484
+ fetchBytes?: ContentRevisionFetchBytes;
4485
+ catalogUrl?: (contentId: string, revision?: string) => string;
4486
+ known?: ReadonlyArray<{
4487
+ contentId: string;
4488
+ revision: string;
4489
+ }>;
4490
+ };
4491
+ type ContentRevisionHealthCheck = (bundle: ContentRevisionBundle) => boolean | Promise<boolean>;
4492
+ type CreateContentRevisionActivatorOptions = {
4493
+ adapters: readonly ContentRegistryAdapter[];
4494
+ pin?: boolean;
4495
+ grants?: HostGrantSet;
4496
+ hostCapabilities?: HostCapabilities;
4497
+ healthCheck?: ContentRevisionHealthCheck;
4498
+ router?: Pick<EventRouter, 'publish'>;
4499
+ onEvent?: (event: EventInput) => void;
4500
+ };
4501
+ type ContentRevisionActivator = {
4502
+ pin(frozen?: boolean): void;
4503
+ unpin(): void;
4504
+ isPinned(): boolean;
4505
+ discover(contentId: string, adapterId?: string): Promise<ContentRevisionDescriptor | undefined>;
4506
+ activate(request: ActivateContentRevisionRequest): Promise<ContentRevisionMutationResult>;
4507
+ rollback(): ContentRevisionMutationResult;
4508
+ inspect(): ContentRevisionInspect;
4509
+ activeBundle(): ContentRevisionBundle | null;
4510
+ snapshot(): ContentRevisionSnapshot;
4511
+ restore(input: unknown): RestoreContentRevisionResult;
4512
+ provenance(): SnapshotProvenance | undefined;
2476
4513
  destroy(): void;
2477
4514
  };
2478
- declare function createExecutableModuleHost(options: CreateExecutableModuleHostOptions): ExecutableModuleHost;
4515
+ declare function contentRevisionEventContracts(): EventContract[];
4516
+ declare function parseContentRevisionCatalog(input: unknown): {
4517
+ ok: true;
4518
+ catalog: ContentRevisionCatalog;
4519
+ } | {
4520
+ ok: false;
4521
+ errors: ContentRevisionDiagnostic[];
4522
+ };
4523
+ declare function createStaticContentAdapter(options: CreateStaticContentAdapterOptions): ContentRegistryAdapter;
4524
+ declare function createRemoteContentAdapter(options: CreateRemoteContentAdapterOptions): ContentRegistryAdapter;
4525
+ declare function createContentRevisionActivator(options: CreateContentRevisionActivatorOptions): ContentRevisionActivator;
4526
+ declare function isContentRevisionErrorCode(value: unknown): value is ContentRevisionErrorCode;
2479
4527
 
2480
4528
  /**
2481
4529
  * Copyright (c) 2026 Aaron Boyarsky
@@ -2540,6 +4588,12 @@ type BrowserA11ySnapshot = {
2540
4588
  };
2541
4589
  live: string;
2542
4590
  html: string;
4591
+ publishedRegions: Array<{
4592
+ id: string;
4593
+ geometryKinds: string[];
4594
+ name: string | null;
4595
+ role: string | null;
4596
+ }>;
2543
4597
  };
2544
4598
  type BrowserReproductionMetadata = {
2545
4599
  seed: string;
@@ -2581,6 +4635,7 @@ type CreateBrowserHarnessOptions = {
2581
4635
  origin?: number;
2582
4636
  createId?: () => string;
2583
4637
  geometry?: GeometryDocument;
4638
+ semanticLayers?: SemanticLayerController;
2584
4639
  contentWidth?: number;
2585
4640
  contentHeight?: number;
2586
4641
  fit?: PresentationFitMode;
@@ -2593,6 +4648,7 @@ type BrowserHarnessInspect = {
2593
4648
  participantEvents: Record<string, HostEvent[]>;
2594
4649
  state: Record<string, unknown>;
2595
4650
  focus: BrowserA11ySnapshot['focus'];
4651
+ publishedRegions: BrowserA11ySnapshot['publishedRegions'];
2596
4652
  scrollTop: number;
2597
4653
  clock: {
2598
4654
  framesElapsed: number;
@@ -2653,6 +4709,272 @@ type PlaywrightCompatibleAdapter = {
2653
4709
  };
2654
4710
  declare function createPlaywrightCompatibleAdapter(harness: BrowserHarness): PlaywrightCompatibleAdapter;
2655
4711
 
4712
+ /**
4713
+ * Copyright (c) 2026 Aaron Boyarsky
4714
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
4715
+ * See packages/engine/LICENSE
4716
+ *
4717
+ * End-to-end production composition scenario harness. Composes the real
4718
+ * browser host, runtime group, compositor, visual/semantic layers, bindings,
4719
+ * sequences, headless audio, snapshots, and replay inspector. Does not
4720
+ * introduce a second runtime. Authored scenarios are JSON-serializable.
4721
+ */
4722
+
4723
+ declare const PRODUCTION_SCENARIO_SCHEMA_VERSION: 1;
4724
+ declare const PRODUCTION_SCENARIO_SNAPSHOT_SCHEMA_VERSION: 1;
4725
+ declare const PRODUCTION_SCENARIO_OBSERVED_EVENT: "production.scenario.state.observed";
4726
+ declare const PRODUCTION_SCENARIO_FAILED_EVENT: "production.scenario.state.failed";
4727
+ declare const PRODUCTION_SCENARIO_DIAGNOSTIC_EVENT: "production.scenario.diagnostic.lifecycle";
4728
+ declare const PRODUCTION_SCENARIO_EVENTS: readonly ["production.scenario.state.observed", "production.scenario.state.failed", "production.scenario.diagnostic.lifecycle"];
4729
+ type ProductionScenarioEventType = (typeof PRODUCTION_SCENARIO_EVENTS)[number];
4730
+ declare const PRODUCTION_SCENARIO_BOUNDARIES: readonly ["input", "reducer", "routing", "binding", "cue", "pixels", "caption", "audio", "save-replay"];
4731
+ type ProductionScenarioBoundary = (typeof PRODUCTION_SCENARIO_BOUNDARIES)[number];
4732
+ declare const PRODUCTION_SCENARIO_ERROR_CODES: readonly ["invalid-scenario", "invalid-schema", "unknown-field", "missing-field", "callbacks-forbidden", "missing-participant", "missing-layer", "destroyed", "assertion-failed"];
4733
+ type ProductionScenarioErrorCode = (typeof PRODUCTION_SCENARIO_ERROR_CODES)[number];
4734
+ declare const PRODUCTION_SCENARIO_VIEWPORT_PRESETS: readonly ["desktop", "mobile"];
4735
+ type ProductionScenarioViewportPreset = (typeof PRODUCTION_SCENARIO_VIEWPORT_PRESETS)[number];
4736
+ declare const DEFAULT_PRODUCTION_SCENARIO_VIEWPORTS: {
4737
+ readonly desktop: {
4738
+ readonly width: 64;
4739
+ readonly height: 48;
4740
+ readonly deviceScaleFactor: 1;
4741
+ };
4742
+ readonly mobile: {
4743
+ readonly width: 48;
4744
+ readonly height: 64;
4745
+ readonly deviceScaleFactor: 2;
4746
+ };
4747
+ };
4748
+ type ProductionScenarioDiagnostic = {
4749
+ code: ProductionScenarioErrorCode | string;
4750
+ detail: string;
4751
+ path?: string;
4752
+ boundary?: ProductionScenarioBoundary;
4753
+ };
4754
+ type ProductionScenarioRequired = {
4755
+ participants: readonly string[];
4756
+ layers: readonly string[];
4757
+ };
4758
+ type ProductionScenarioMatrix = {
4759
+ viewport?: ProductionScenarioViewportPreset;
4760
+ width?: number;
4761
+ height?: number;
4762
+ dpr?: number;
4763
+ reducedMotion?: boolean;
4764
+ mute?: boolean;
4765
+ failedAssetIds?: readonly string[];
4766
+ fallback?: boolean;
4767
+ inputModality?: BrowserInputModality;
4768
+ };
4769
+ type ProductionScenarioStep = {
4770
+ type: 'click';
4771
+ selector?: string;
4772
+ x?: number;
4773
+ y?: number;
4774
+ } | {
4775
+ type: 'key';
4776
+ key: string;
4777
+ } | {
4778
+ type: 'focus';
4779
+ selector: string;
4780
+ } | {
4781
+ type: 'step';
4782
+ frames: number;
4783
+ } | {
4784
+ type: 'viewport';
4785
+ kind?: ProductionScenarioViewportPreset;
4786
+ width?: number;
4787
+ height?: number;
4788
+ dpr?: number;
4789
+ } | {
4790
+ type: 'reducedMotion';
4791
+ value: boolean;
4792
+ } | {
4793
+ type: 'mute';
4794
+ value: boolean;
4795
+ } | {
4796
+ type: 'failAsset';
4797
+ assetId: string;
4798
+ } | {
4799
+ type: 'save';
4800
+ } | {
4801
+ type: 'reload';
4802
+ } | {
4803
+ type: 'replay';
4804
+ };
4805
+ type ProductionScenarioDefinition = {
4806
+ id: string;
4807
+ schemaVersion: typeof PRODUCTION_SCENARIO_SCHEMA_VERSION;
4808
+ seed: string;
4809
+ required: ProductionScenarioRequired;
4810
+ matrix?: ProductionScenarioMatrix;
4811
+ steps?: readonly ProductionScenarioStep[];
4812
+ };
4813
+ type DefineProductionScenarioResult = {
4814
+ ok: true;
4815
+ scenario: ProductionScenarioDefinition;
4816
+ } | {
4817
+ ok: false;
4818
+ errors: ProductionScenarioDiagnostic[];
4819
+ };
4820
+ type ProductionScenarioReduceResult = {
4821
+ accepted: boolean;
4822
+ state: JsonObject;
4823
+ reason?: string;
4824
+ playSequence?: string;
4825
+ };
4826
+ type ProductionScenarioHost = {
4827
+ initialState: JsonObject;
4828
+ reduce(state: JsonObject, intent: EventInput): ProductionScenarioReduceResult;
4829
+ project?(state: JsonObject): JsonObject;
4830
+ };
4831
+ type ProductionScenarioLocalization = {
4832
+ boundary: ProductionScenarioBoundary;
4833
+ code: ProductionScenarioErrorCode;
4834
+ detail: string;
4835
+ };
4836
+ type ProductionScenarioObservation = {
4837
+ inputDispatched: boolean;
4838
+ inputTarget?: string;
4839
+ reducerAccepted?: boolean;
4840
+ reducerRejected?: boolean;
4841
+ reducerReason?: string;
4842
+ routedTypes: string[];
4843
+ rejected: boolean;
4844
+ selectedBindingIds: string[];
4845
+ sequenceId?: string | null;
4846
+ sequencePhase?: string | null;
4847
+ captions: string[];
4848
+ declaredOrder: string[];
4849
+ requiredParticipantsPresent: boolean;
4850
+ requiredLayersPresent: boolean;
4851
+ missingParticipants: string[];
4852
+ missingLayers: string[];
4853
+ audioInvoked: boolean;
4854
+ audioFailed: boolean;
4855
+ muted: boolean;
4856
+ replayMatch?: boolean;
4857
+ snapshotOk?: boolean;
4858
+ };
4859
+ type ProductionScenarioExpectation = {
4860
+ inputDispatched?: boolean;
4861
+ reducerAccepted?: boolean;
4862
+ reducerRejected?: boolean;
4863
+ routedTypes?: readonly string[];
4864
+ selectedBindingIds?: readonly string[];
4865
+ sequenceId?: string;
4866
+ captions?: readonly string[];
4867
+ requiredParticipantsPresent?: boolean;
4868
+ requiredLayersPresent?: boolean;
4869
+ audioInvoked?: boolean;
4870
+ audioFailed?: boolean;
4871
+ replayMatch?: boolean;
4872
+ snapshotOk?: boolean;
4873
+ };
4874
+ type ProductionScenarioEvidenceBundle = {
4875
+ schemaVersion: typeof PRODUCTION_SCENARIO_SNAPSHOT_SCHEMA_VERSION;
4876
+ scenarioId: string;
4877
+ seed: string;
4878
+ matrix: Required<Pick<ProductionScenarioMatrix, 'viewport' | 'width' | 'height' | 'dpr'>> & ProductionScenarioMatrix;
4879
+ hashes: {
4880
+ pixels: string;
4881
+ semantic: string;
4882
+ a11y: string;
4883
+ trace: string;
4884
+ snapshot: string;
4885
+ assets: string;
4886
+ };
4887
+ revisions: {
4888
+ world: string | number | null;
4889
+ bindings: string | number | null;
4890
+ snapshot: number;
4891
+ };
4892
+ traces: {
4893
+ envelopes: EventEnvelope[];
4894
+ inspector: InspectorRecord[];
4895
+ audio: AudioCueEvent[];
4896
+ actions: ProductionScenarioStep[];
4897
+ };
4898
+ screenshot: {
4899
+ pngDataUrl: string | null;
4900
+ declaredOrder: string[];
4901
+ width: number;
4902
+ height: number;
4903
+ };
4904
+ semantic: SemanticPublishedRegion[];
4905
+ a11y: BrowserA11ySnapshot;
4906
+ firstBrokenBoundary: ProductionScenarioBoundary | null;
4907
+ localization: ProductionScenarioLocalization | null;
4908
+ participants: string[];
4909
+ layers: string[];
4910
+ observation: ProductionScenarioObservation;
4911
+ selectionTrace?: SelectionTraceExport | null;
4912
+ };
4913
+ type CreateProductionScenarioRunnerOptions = {
4914
+ scenario: ProductionScenarioDefinition | unknown;
4915
+ participants: RuntimeGroupParticipantConfig[];
4916
+ compositorLayers: CompositorLayerConfig[];
4917
+ visualLayers?: readonly VisualLayerDeclaration[];
4918
+ visualSources?: Readonly<Record<string, ImageData>>;
4919
+ semanticRegions?: readonly SemanticRegionDeclaration[];
4920
+ sequences?: readonly PresentationSequenceDefinition[];
4921
+ bindings?: PresentationBindingManifest | unknown;
4922
+ geometry?: GeometryDocument;
4923
+ host: ProductionScenarioHost;
4924
+ sequenceBindings?: Readonly<Record<string, PresentationSequenceBindings>>;
4925
+ contentWidth?: number;
4926
+ contentHeight?: number;
4927
+ origin?: number;
4928
+ createId?: () => string;
4929
+ mapClick?: (hotspotId: string) => EventInput;
4930
+ mapKey?: (key: string) => EventInput | undefined;
4931
+ router?: Pick<EventRouter, 'publish'>;
4932
+ };
4933
+ type ProductionScenarioRunner = {
4934
+ readonly scenario: ProductionScenarioDefinition;
4935
+ readonly harness: BrowserHarness;
4936
+ readonly audio: HeadlessAudioAdapter;
4937
+ readonly inspector: ReplayInspector;
4938
+ goto(): void;
4939
+ click(selectorOrX: string | number, y?: number): void;
4940
+ key(key: string): void;
4941
+ focus(selector: string): void;
4942
+ setViewport(width: number, height: number, dpr?: number): void;
4943
+ setReducedMotion(value: boolean): void;
4944
+ mute(value?: boolean): void;
4945
+ failAsset(assetId: string): void;
4946
+ step(frames?: number): Promise<void>;
4947
+ applyHostIntent(intent: EventInput): ProductionScenarioReduceResult;
4948
+ playSequence(sequenceId: string, invocationId?: string): void;
4949
+ publish(event: EventInput): EventEnvelope | undefined;
4950
+ save(): SnapshotEnvelope;
4951
+ reload(snapshot?: SnapshotEnvelope): void;
4952
+ replay(): Promise<ReplayCompareResult>;
4953
+ run(steps?: readonly ProductionScenarioStep[]): Promise<ProductionScenarioEvidenceBundle>;
4954
+ captureEvidence(expected?: ProductionScenarioExpectation): ProductionScenarioEvidenceBundle;
4955
+ inspect(): {
4956
+ host: JsonObject;
4957
+ lastDecision: ProductionScenarioReduceResult | null;
4958
+ bindings: ReturnType<PresentationBindingRuntime['inspect']> | null;
4959
+ sequences: ReturnType<PresentationSequencePlayer['inspect']> | null;
4960
+ visual: ReturnType<VisualLayerController['inspect']> | null;
4961
+ semantic: ReturnType<SemanticLayerController['inspect']> | null;
4962
+ audio: ReturnType<HeadlessAudioAdapter['snapshot']>;
4963
+ participants: string[];
4964
+ layers: string[];
4965
+ composition: ProductionScenarioLocalization | null;
4966
+ };
4967
+ destroy(): void;
4968
+ };
4969
+ declare function productionScenarioEventContracts(): EventContract[];
4970
+ declare function isProductionScenarioEventType(value: unknown): value is ProductionScenarioEventType;
4971
+ declare function isProductionScenarioErrorCode(value: unknown): value is ProductionScenarioErrorCode;
4972
+ declare function isProductionScenarioBoundary(value: unknown): value is ProductionScenarioBoundary;
4973
+ declare function defineProductionScenario(input: unknown): DefineProductionScenarioResult;
4974
+ declare function fnv1aHex(data: string | Uint8Array): string;
4975
+ declare function localizeProductionScenarioFailure(observed: ProductionScenarioObservation, expected?: ProductionScenarioExpectation): ProductionScenarioLocalization | null;
4976
+ declare function createProductionScenarioRunner(options: CreateProductionScenarioRunnerOptions): ProductionScenarioRunner;
4977
+
2656
4978
  /**
2657
4979
  * Copyright (c) 2026 Aaron Boyarsky
2658
4980
  * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
@@ -2843,4 +5165,4 @@ declare class MidiManager {
2843
5165
  private detachHardware;
2844
5166
  }
2845
5167
 
2846
- export { ANCHOR_ORIGINS, ASSET_FAILED_EVENT, ASSET_FAILURE_CODES, ASSET_KINDS, ASSET_READY_EVENT, AUDIO_CUE_EVENTS, AUDIO_CUE_FAILED_EVENT, AUDIO_CUE_SCHEDULED_EVENT, AUDIO_CUE_SKIPPED_EVENT, AUDIO_CUE_STARTED_EVENT, type ActiveAudioCue, type AnchorOrigin, type AnimationCart, type AnimationTiming, type AppliedAction, type ApplySnapshotMigrationsResult, type AssetCorsMode, type AssetDeclaration, type AssetFailure, type AssetFailureCode, type AssetItemStatus, type AssetKind, type AssetPreloadSnapshot, type AssetPreloader, type AssetProvenance, type AssetResolveRequest, type AssetResolver, type AssetRuntimeOptions, type AttachOptions, type AttachPresentationAdapterOptions, type AudioAssetStatus, type AudioBroker, type AudioBrokerInspect, type AudioBrokerListener, type AudioBrokerNotice, type AudioChannelInspect, type AudioCueEvent, type AudioCueEventType, type AudioCueFailReason, type AudioCueReason, type AudioCueSkipReason, type AudioCueSpec, type AudioCueTimeline, type AudioCueTimelineSnapshot, type AudioCueView, type AudioLibraryId, type AudioLibrarySpec, type AudioUnlockState, type AudioUnlockStatus, type BoundReplaySession, type BrowserA11ySnapshot, type BrowserCompositorConfig, type BrowserHarness, type BrowserHarnessAction, type BrowserHarnessInspect, type BrowserHarnessMountContext, type BrowserHarnessRuntimeContext, type BrowserHarnessScreenshot, type BrowserHostSession, type BrowserInputModality, type BrowserReproductionMetadata, type BrowserViewport, CAPABILITY_ASSET_KINDS, CAPABILITY_BLEND_MODES, CAPABILITY_CART_KINDS, CAPABILITY_CLEAR_POLICIES, CAPABILITY_INTEGRATIONS, CAPABILITY_MANAGERS, CAPABILITY_MANIFEST_VERSION, CAPABILITY_PHASES, COMPOSITOR_BLEND_MODES, COMPOSITOR_CLEAR_POLICIES, COMPOSITOR_SOURCE_KINDS, COORDINATE_SPACES, CUE_CANCELLED_EVENT, CUE_COMPLETED_EVENT, CUE_LIFECYCLE_EVENTS, CUE_REPLACED_EVENT, CUE_STARTED_EVENT, CYBERART_CANVAS_ATTR, type CapabilityAssetDeclarationSummary, type CapabilityAssetKind, type CapabilityAssetSummary, type CapabilityBlendMode, type CapabilityCartKind, type CapabilityClearPolicy, type CapabilityDiagnostic, type CapabilityIntegration, type CapabilityLayerRequirements, type CapabilityManager, type CapabilityManifest, type CapabilityManifestInput, type CapabilityModuleRef, type CapabilityModuleRequirements, type CapabilityPermissions, type CapabilityPhase, type CapabilityRuntime, type CapabilitySurfaceRequirements, type CartHandle, type CartKind, type CartSnapshot, type CartStateBundle, type CartStateHotkeyOptions, type CartStateMessageHandler, type CartStatePersister, type CausationTreeNode, type Clock, type ClockSnapshot, type ComposedFrame, type Compositor, type CompositorBlendMode, type CompositorCanvasSource, type CompositorClearPolicy, type CompositorClip, type CompositorHostOptions, type CompositorImageSource, type CompositorInspect, type CompositorLayerConfig, type CompositorLayerInspect, type CompositorLayerSource, type CompositorParticipantSource, type CompositorPointerEvents, type CompositorSourceKind, type ContractDiagnostic, type ContractFieldType, type ContractRegistry, type CoordinateSpace, type CreateAssetPreloaderOptions, type CreateAudioBrokerOptions, type CreateAudioCueTimelineOptions, type CreateBrowserHarnessOptions, type CreateCompositorOptions, type CreateExecutableModuleHostOptions, type CreatePresentationLayoutInput, type CreatePresentationTimelineOptions, type CreateReplayInspectorOptions, type CreateRuntimeGroupOptions, type CreateRuntimeOptions, type CreateVisualLayerControllerOptions, type CueDuplicatePolicy, type CueEasing, type CueLifecycleEvent, type CueLifecycleType, type CuePhase, type CueReducedMotionPolicy, type CueRepeatPolicy, type CueSpec, type CueTimelineSnapshot, type CueView, type CyberArtRuntime, DEFAULT_BROWSER_VIEWPORT, DEFAULT_DUCK_GAIN, DEFAULT_GROUP_HEIGHT, DEFAULT_GROUP_WIDTH, DEFAULT_MAX_HOPS, DEFAULT_MAX_INSPECTOR_RECORDS, type DebugDrawCall, type DefineCapabilityManifestResult, type DefineContractResult, type DefineSnapshotResult, type DeterministicRuntimeOptions, type DimensionContext, ENGINE_SNAPSHOT_RUNTIME, EVENT_ENVELOPE_VERSION, EXECUTABLE_MODULE_ERROR_CODES, type EventContract, type EventContractManifest, type EventEnvelope, type EventInput, type EventKind, type EventRouter, type EventRouterOptions, type ExecutableModuleCapabilities, type ExecutableModuleDiagnostic, type ExecutableModuleError, type ExecutableModuleErrorCode, type ExecutableModuleFactory, type ExecutableModuleHost, type ExecutableModuleHostInspect, type ExecutableModuleInstance, type ExecutableModuleInvokeContext, type ExecutableModuleInvokeResult, type ExecutableModuleLimits, type ExecutableModuleLoadResult, type ExecutableModuleRef, type ExecutableModuleRegistration, type ExportSnapshotOptions, type FixtureAssetCatalog, type FixtureAssetRecord, type FrameErrorInfo, type FrameTimingSample, GEOMETRY_CONTRACT_VERSION, type GeometryAnchor, type GeometryDebugContext, type GeometryDiagnostic, type GeometryDocument, type GeometryHitbox, type GeometryPadding, type GeometrySafeArea, type GeometryValidation, HOST_STATE_ACCEPTED_EVENT, type HeadlessAudioAdapter, type HostCapabilities, HostChannel, type HostEvent, type HostEventListener, type HostedAssetResolverOptions, INVALID_PRESENTATION_MODEL_MESSAGE, type ImportCartStateExtras, IncompatibleCartStateError, type InferredPayload, type InspectorRecord, KeyboardManager, LEGACY_SNAPSHOT_SCHEMA_VERSION, type LandmarkRegisterResult, type LandmarkRegistry, type LegacySnapshot, MIDI_CHANNEL_MAX, MIDI_CHANNEL_MIN, MIDI_CONTROL_CHANGE, MIDI_DATA_MAX, MIDI_NOTE_OFF, MIDI_NOTE_ON, MIDI_PITCH_BEND, MIDI_PITCH_CENTER, MIDI_PITCH_MAX, type MidiAccessFailureReason, type MidiAccessLike, type MidiAccessResult, type MidiCcMessage, type MidiChannel, type MidiInjectInput, type MidiInputLike, MidiManager, type MidiManagerOptions, type MidiMessage, type MidiNoteMessage, type MidiOutputPort, type MidiPitchMessage, type MidiRawMessage, type MidiRequestAccess, type MidiSendFailureReason, type MidiSendResult, type MidiStatusByte, type MidiSubscribeKind, type MidiSubscribeListener, type MidiVoiceInput, type MountOptions, type MountPresentationAdapterOptions, type NormalizeContext, type NormalizeResult, type NormalizedPoint, type NormalizedPolygon, type NormalizedRect, PRESENTATION_ADAPTER_VERSION, PRESENTATION_MODEL_EVENT, PRESENTATION_PHASES, PRESENTATION_SUBSCRIBE_PATTERNS, PRESENTATION_UNSUPPORTED_EVENT, type ParseSnapshotResult, type PayloadFieldSpec, type PayloadSchema, type PayloadValidation, type PixelPoint, type PixelRect, type PlayAudioCueResult, type PlayCueResult, type PlayVisualLayerResult, type PlaywrightCompatibleAdapter, type PlaywrightCompatibleViewport, type PointerClick, PointerManager, type PointerSpace, type PresentationAdapter, type PresentationAdapterTarget, type PresentationCartState, type PresentationFitMode, type PresentationLayout, type PresentationModel, type PresentationPhase, type PresentationRegion, type PresentationTimeline, type PresentationView, type PublishExtras, REDACTED_VALUE, REJECTED_EVENT_TYPE, REPLAY_INSPECTOR_SCHEMA_VERSION, ROUND_TRIP_TOLERANCE, ROUND_TRIP_TOLERANCE_CANVAS_PX, Random, type RandomState, type RejectionPayload, type RejectionReason, type ReplayCompareResult, type ReplayInspector, type ReplayInspectorExport, type ReplayInspectorReport, type ReplayMetadata, type ReplayParticipantSummary, type ReplayTapeAction, type ReplayTraceFilter, type ResolveImportableCartStateResult, type ResolvedAsset, type RestoreVisualLayerResult, type RouterDecision, type RouterDecisionOutcome, type RouterDecisionReason, type RouterParticipantInspect, type RuntimeGroup, type RuntimeGroupCapability, type RuntimeGroupDiagnostics, type RuntimeGroupFrameError, type RuntimeGroupInspect, type RuntimeGroupKind, type RuntimeGroupParticipantConfig, type RuntimeGroupParticipantHandle, type RuntimeGroupParticipantInspect, SILENT_ASSET_FALLBACK_REF, SNAPSHOT_SCHEMA_VERSION, type SchemaCompatibility, type ScriptedAction, type SnapshotAssetRef, type SnapshotCartRef, type SnapshotClock, type SnapshotDiagnostic, type SnapshotEnvelope, type SnapshotEnvelopeInput, type SnapshotIntegrity, type SnapshotMigration, type SnapshotMigrationRegistry, type SnapshotModuleRef, type SnapshotProvenance, type TokenData, UNVERSIONED_CART_VERSION, VISUAL_LAYER_EVENTS, VISUAL_LAYER_FAILED_EVENT, VISUAL_LAYER_FAILURE_CODES, VISUAL_LAYER_HIDDEN_EVENT, VISUAL_LAYER_INCOMING_SUFFIX, VISUAL_LAYER_KINDS, VISUAL_LAYER_REVEALED_EVENT, VISUAL_LAYER_SNAPSHOT_SCHEMA_VERSION, VISUAL_LAYER_TRANSITIONS, VISUAL_LAYER_TRANSITION_COMPLETED_EVENT, VISUAL_LAYER_TRANSITION_STARTED_EVENT, type ValidateCapabilityManifestResult, type ValidateResult, type ValidateSnapshotResult, type VersionedSnapshot, type VirtualClock, type VisualLayerAcceptedBinding, type VisualLayerAssetStatus, type VisualLayerCapture, type VisualLayerController, type VisualLayerControllerSnapshot, type VisualLayerCueSpec, type VisualLayerDeclaration, type VisualLayerDiagnostic, type VisualLayerEvent, type VisualLayerEventType, type VisualLayerFailureCode, type VisualLayerFallbackPolicy, type VisualLayerInspect, type VisualLayerKind, type VisualLayerSnapshotRow, type VisualLayerTransitionInspect, type VisualLayerTransitionKind, type VisualLayerVersionDeclaration, applyCueEasing, applySnapshotMigrations, assetStatusEvent, assetToNormalized, attachCartStatePersistence, attachPresentationAdapter, canonicalizeSeed, canvasToCss, canvasToNormalized, toJSON as capabilityManifestToJSON, captureVisualLayers, cloneSnapshotJson, comparePayloadSchemas, compareReplayTraces, createAssetFailure, createAssetPreloader, createAudioBroker, createAudioCueTimeline, createBrowserHarness, createCompositor, createContractRegistry, createEngineSnapshotMigrations, createEventRouter, createExecutableModuleHost, createFixtureAssetResolver, createHeadlessAudioAdapter, createHostedAssetResolver, createLandmarkRegistry, createPlaywrightCompatibleAdapter, createPresentationLayout, createPresentationModelEvent, createPresentationTimeline, createReferencePresentationCart, createReplayInspector, createRuntime, createRuntimeGroup, createSnapshotMigrationRegistry, createVirtualClock, createVisualLayerController, createWallClock, cssToCanvas, cssToNormalized, defaultSnapshotMigrationRegistry, defineCapabilityManifest, defineDiagnostic, defineIntent, defineSnapshot, defineStateEvent, deriveAttachOptions, describeReplayMismatch, detectSnapshotSchemaVersion, drawGeometryDebug, encodeMidiMessage, engineStateFromEnvelope, familyPatternForType, inferEventKind, isAssetFailure, isAssetFailureCode, isAssetKind, isAudioCueEventType, isCueLifecycleType, isLegacyCartStateBundle, isMidiChannel, isMidiData, isPresentationModel, isPresentationPhase, isSnapshotEnvelope, isVersionedSnapshot, isVisualLayerEventType, isVisualLayerKind, isVisualLayerTransitionKind, kindSegmentInType, matchEventPattern, midiChannelFromStatus, midiStatus, mountPresentationAdapter, normalizeEvent, normalizedToAsset, normalizedToCanvas, normalizedToCss, parseCapabilityManifest, parseGeometry, parseMidiBytes, parseSnapshot, pointFromOrigin, pointerToRegion, rectToCanvas, rectToCss, regionToViewport, registerCartStateHotkeys, replayExportedTrace, resolveImportableCartState, resolveRuntimeSeed, restoreSnapshotFromUnknown, rewriteHostedAssetRef, scheduleAudioCue, serializeGeometry, snapshotErrorsToMessage, snapshotFromCartBundle, validateCapabilityManifest, validateGeometry, validateSnapshot, verifyAttachOptions, visualIncomingLayerId };
5168
+ export { ANCHOR_ORIGINS, ASSET_FAILED_EVENT, ASSET_FAILURE_CODES, ASSET_KINDS, ASSET_READY_EVENT, AUDIO_CUE_EVENTS, AUDIO_CUE_FAILED_EVENT, AUDIO_CUE_SCHEDULED_EVENT, AUDIO_CUE_SKIPPED_EVENT, AUDIO_CUE_STARTED_EVENT, type ActivateContentRevisionRequest, type ActiveAudioCue, type AnchorOrigin, type AnimationCart, type AnimationTiming, type AppliedAction, type ApplyPresentationBindingsResult, type ApplySnapshotMigrationsResult, type AssetCorsMode, type AssetDeclaration, type AssetFailure, type AssetFailureCode, type AssetItemStatus, type AssetKind, type AssetPreloadSnapshot, type AssetPreloader, type AssetProvenance, type AssetResolveRequest, type AssetResolver, type AssetRuntimeOptions, type AttachOptions, type AttachPresentationAdapterOptions, type AudioAssetStatus, type AudioBroker, type AudioBrokerInspect, type AudioBrokerListener, type AudioBrokerNotice, type AudioChannelInspect, type AudioCueEvent, type AudioCueEventType, type AudioCueFailReason, type AudioCueReason, type AudioCueSkipReason, type AudioCueSpec, type AudioCueTimeline, type AudioCueTimelineSnapshot, type AudioCueView, type AudioLibraryId, type AudioLibrarySpec, type AudioUnlockState, type AudioUnlockStatus, type BoundReplaySession, type BrowserA11ySnapshot, type BrowserCompositorConfig, type BrowserHarness, type BrowserHarnessAction, type BrowserHarnessInspect, type BrowserHarnessMountContext, type BrowserHarnessRuntimeContext, type BrowserHarnessScreenshot, type BrowserHostSession, type BrowserInputModality, type BrowserReproductionMetadata, type BrowserViewport, CAPABILITY_ASSET_KINDS, CAPABILITY_BLEND_MODES, CAPABILITY_CART_KINDS, CAPABILITY_CLEAR_POLICIES, CAPABILITY_DEVICE_GRANTS, CAPABILITY_INTEGRATIONS, CAPABILITY_MANAGERS, CAPABILITY_MANIFEST_VERSION, CAPABILITY_PHASES, COMPOSITOR_BLEND_MODES, COMPOSITOR_CLEAR_POLICIES, COMPOSITOR_SOURCE_KINDS, CONTENT_REVISION_ACTIVATED_EVENT, CONTENT_REVISION_DIAGNOSTIC_EVENT, CONTENT_REVISION_DISCOVERED_EVENT, CONTENT_REVISION_ERROR_CODES, CONTENT_REVISION_EVENTS, CONTENT_REVISION_MANIFEST_VERSION, CONTENT_REVISION_REJECTED_EVENT, CONTENT_REVISION_ROLLED_BACK_EVENT, CONTENT_REVISION_SNAPSHOT_SCHEMA_VERSION, CONTENT_REVISION_STAGING_EVENT, CONTENT_REVISION_SUPERSEDED_EVENT, CONTENT_REVISION_VALIDATED_EVENT, COORDINATE_SPACES, CUE_CANCELLED_EVENT, CUE_COMPLETED_EVENT, CUE_LIFECYCLE_EVENTS, CUE_REPLACED_EVENT, CUE_STARTED_EVENT, CYBERART_CANVAS_ATTR, type CapabilityAssetDeclarationSummary, type CapabilityAssetKind, type CapabilityAssetSummary, type CapabilityBlendMode, type CapabilityCartKind, type CapabilityClearPolicy, type CapabilityDeviceGrant, type CapabilityDiagnostic, type CapabilityIntegration, type CapabilityLayerRequirements, type CapabilityManager, type CapabilityManifest, type CapabilityManifestInput, type CapabilityModuleRef, type CapabilityModuleRequirements, type CapabilityPermissions, type CapabilityPhase, type CapabilityRuntime, type CapabilitySurfaceRequirements, type CartHandle, type CartKind, type CartSnapshot, type CartStateBundle, type CartStateHotkeyOptions, type CartStateMessageHandler, type CartStatePersister, type CausationTreeNode, type Clock, type ClockSnapshot, type ComposedFrame, type Compositor, type CompositorBlendMode, type CompositorCanvasSource, type CompositorClearPolicy, type CompositorClip, type CompositorHostOptions, type CompositorImageSource, type CompositorInspect, type CompositorLayerConfig, type CompositorLayerInspect, type CompositorLayerSource, type CompositorParticipantSource, type CompositorPointerEvents, type CompositorSourceKind, type ContentRegistryAdapter, type ContentRevisionActivator, type ContentRevisionAssetDecl, type ContentRevisionBundle, type ContentRevisionCatalog, type ContentRevisionDescriptor, type ContentRevisionDiagnostic, type ContentRevisionErrorCode, type ContentRevisionEventType, type ContentRevisionInspect, type ContentRevisionMutationResult, type ContentRevisionResource, type ContentRevisionSnapshot, type ContentRevisionStagingView, type ContractDiagnostic, type ContractFieldType, type ContractRegistry, type CoordinateSpace, type CreateAssetPreloaderOptions, type CreateAudioBrokerOptions, type CreateAudioCueTimelineOptions, type CreateBrowserHarnessOptions, type CreateCompositorOptions, type CreateContentRevisionActivatorOptions, type CreateExecutableModuleHostOptions, type CreateJobCoordinatorOptions, type CreatePortalLifecycleOptions, type CreatePresentationBindingRuntimeOptions, type CreatePresentationLayoutInput, type CreatePresentationSequencePlayerOptions, type CreatePresentationTimelineOptions, type CreateProductionScenarioRunnerOptions, type CreateRemoteCartSandboxOptions, type CreateRemoteContentAdapterOptions, type CreateReplayInspectorOptions, type CreateRuntimeGroupOptions, type CreateRuntimeOptions, type CreateSelectionTraceOptions, type CreateSemanticLayerControllerOptions, type CreateStaticContentAdapterOptions, type CreateVisualLayerControllerOptions, type CreateWorldGraphOptions, type CreateWorldPatchApplierOptions, type CueDuplicatePolicy, type CueEasing, type CueLifecycleEvent, type CueLifecycleType, type CuePhase, type CueReducedMotionPolicy, type CueRepeatPolicy, type CueSpec, type CueTimelineSnapshot, type CueView, type CyberArtRuntime, DEFAULT_BROWSER_VIEWPORT, DEFAULT_DUCK_GAIN, DEFAULT_GROUP_HEIGHT, DEFAULT_GROUP_WIDTH, DEFAULT_MAX_HOPS, DEFAULT_MAX_INSPECTOR_RECORDS, DEFAULT_MAX_SELECTION_RECORDS, DEFAULT_PORTAL_MAX_DEPTH, DEFAULT_PRODUCTION_SCENARIO_VIEWPORTS, DEFAULT_SENSITIVE_KEYS, type DebugDrawCall, type DeclaredAssetBytes, type DeclaredAssetResolverOptions, type DefineCapabilityManifestResult, type DefineContractResult, type DefinePresentationBindingsResult, type DefinePresentationSequenceResult, type DefineProductionScenarioResult, type DefineRemoteCartResult, type DefineSnapshotResult, type DeterministicRuntimeOptions, type DimensionContext, ENGINE_SNAPSHOT_RUNTIME, EVENT_ENVELOPE_VERSION, EXECUTABLE_MODULE_ERROR_CODES, type EventContract, type EventContractManifest, type EventEnvelope, type EventInput, type EventKind, type EventRouter, type EventRouterOptions, type ExecutableModuleCapabilities, type ExecutableModuleDiagnostic, type ExecutableModuleError, type ExecutableModuleErrorCode, type ExecutableModuleFactory, type ExecutableModuleHost, type ExecutableModuleHostInspect, type ExecutableModuleInstance, type ExecutableModuleInvokeContext, type ExecutableModuleInvokeResult, type ExecutableModuleLimits, type ExecutableModuleLoadResult, type ExecutableModuleRef, type ExecutableModuleRegistration, type ExportSnapshotOptions, type FixtureAssetCatalog, type FixtureAssetRecord, type FrameErrorInfo, type FrameTimingSample, GEOMETRY_CONTRACT_VERSION, type GeometryAnchor, type GeometryDebugContext, type GeometryDiagnostic, type GeometryDocument, type GeometryHitbox, type GeometryPadding, type GeometrySafeArea, type GeometryValidation, HOST_GRANT_SNAPSHOT_SCHEMA_VERSION, HOST_STATE_ACCEPTED_EVENT, type HeadlessAudioAdapter, type HeadlessJobWorker, type HostCapabilities, HostChannel, type HostEvent, type HostEventListener, type HostGrantRestoreResult, type HostGrantSet, type HostGrantSnapshot, type HostPresentationOverride, type HostedAssetResolverOptions, INVALID_PRESENTATION_MODEL_MESSAGE, type ImportCartStateExtras, IncompatibleCartStateError, type InferredPayload, type InspectorRecord, JOB_APPLIED_EVENT, JOB_AWAITING_EVALUATION_EVENT, JOB_CANCELED_EVENT, JOB_CLAIMED_EVENT, JOB_DIAGNOSTIC_EVENT, JOB_EVALUATOR_DECISIONS, JOB_FAILED_EVENT, JOB_LIFECYCLE_EVENTS, JOB_ORCHESTRATION_SNAPSHOT_SCHEMA_VERSION, JOB_PROGRESS_EVENT, JOB_QUEUED_EVENT, JOB_READY_EVENT, JOB_REDACTED_KEYS, JOB_RESULT_REF_SCHEMA_VERSION, JOB_RETRYABILITY, JOB_RETRY_SCHEDULED_EVENT, JOB_STATES, JOB_SUBMITTED_EVENT, JOB_SUPERSEDED_EVENT, type JobCoordinator, type JobCoordinatorSnapshot, type JobDefinition, type JobDiagnostic, type JobEvaluatorDecision, type JobFailureRecord, type JobInspect, type JobLifecycleEventType, type JobMutationResult, type JobPersistenceAdapter, type JobProgress, type JobRecord, type JobResultRef, type JobRetryPolicy, type JobRetryability, type JobState, type JobSubmitRequest, type JobWorkerAdapter, type JsonObject, type JsonPrimitive, type JsonValue, KeyboardManager, LEGACY_SNAPSHOT_SCHEMA_VERSION, type LandmarkRegisterResult, type LandmarkRegistry, type LegacySnapshot, type LoadRemoteCartOptions, MIDI_CHANNEL_MAX, MIDI_CHANNEL_MIN, MIDI_CONTROL_CHANGE, MIDI_DATA_MAX, MIDI_NOTE_OFF, MIDI_NOTE_ON, MIDI_PITCH_BEND, MIDI_PITCH_CENTER, MIDI_PITCH_MAX, type MidiAccessFailureReason, type MidiAccessLike, type MidiAccessResult, type MidiCcMessage, type MidiChannel, type MidiInjectInput, type MidiInputLike, MidiManager, type MidiManagerOptions, type MidiMessage, type MidiNoteMessage, type MidiOutputPort, type MidiPitchMessage, type MidiRawMessage, type MidiRequestAccess, type MidiSendFailureReason, type MidiSendResult, type MidiStatusByte, type MidiSubscribeKind, type MidiSubscribeListener, type MidiVoiceInput, type MountOptions, type MountPresentationAdapterOptions, type NormalizeContext, type NormalizeResult, type NormalizedPoint, type NormalizedPolygon, type NormalizedRect, PORTAL_ABORTED_EVENT, PORTAL_ENTERED_EVENT, PORTAL_EXCLUSIVE_GRANTS, PORTAL_EXITED_EVENT, PORTAL_LIFECYCLE_EVENTS, PORTAL_LIFECYCLE_SNAPSHOT_SCHEMA_VERSION, PORTAL_METAPHORS, PORTAL_OUTCOME_KINDS, PORTAL_OUTCOME_SCHEMA_VERSION, PRESENTATION_ADAPTER_VERSION, PRESENTATION_AUDIO_CAPABILITY_STATUSES, PRESENTATION_BINDING_APPLIED_EVENT, PRESENTATION_BINDING_DIAGNOSTIC_EVENT, PRESENTATION_BINDING_ERROR_CODES, PRESENTATION_BINDING_EVENTS, PRESENTATION_BINDING_MANIFEST_VERSION, PRESENTATION_BINDING_REJECTED_EVENT, PRESENTATION_BINDING_SNAPSHOT_SCHEMA_VERSION, PRESENTATION_BINDING_TARGET_KINDS, PRESENTATION_COMPLETION_RULES, PRESENTATION_INTERRUPTION_POLICIES, PRESENTATION_INVOCATION_PHASES, PRESENTATION_MODEL_EVENT, PRESENTATION_PHASES, PRESENTATION_SEQUENCE_COMPLETED_EVENT, PRESENTATION_SEQUENCE_DIAGNOSTIC_EVENT, PRESENTATION_SEQUENCE_EVENTS, PRESENTATION_SEQUENCE_FAILED_EVENT, PRESENTATION_SEQUENCE_INTERRUPTED_EVENT, PRESENTATION_SEQUENCE_PRELOADING_EVENT, PRESENTATION_SEQUENCE_READY_EVENT, PRESENTATION_SEQUENCE_REQUESTED_EVENT, PRESENTATION_SEQUENCE_SKIPPED_EVENT, PRESENTATION_SEQUENCE_SNAPSHOT_SCHEMA_VERSION, PRESENTATION_SEQUENCE_STARTED_EVENT, PRESENTATION_SEQUENCE_STEP_COMPLETED_EVENT, PRESENTATION_SEQUENCE_STEP_STARTED_EVENT, PRESENTATION_SUBSCRIBE_PATTERNS, PRESENTATION_TRACK_KINDS, PRESENTATION_UNSUPPORTED_EVENT, PRODUCTION_SCENARIO_BOUNDARIES, PRODUCTION_SCENARIO_DIAGNOSTIC_EVENT, PRODUCTION_SCENARIO_ERROR_CODES, PRODUCTION_SCENARIO_EVENTS, PRODUCTION_SCENARIO_FAILED_EVENT, PRODUCTION_SCENARIO_OBSERVED_EVENT, PRODUCTION_SCENARIO_SCHEMA_VERSION, PRODUCTION_SCENARIO_SNAPSHOT_SCHEMA_VERSION, PRODUCTION_SCENARIO_VIEWPORT_PRESETS, type ParseSnapshotResult, type PayloadFieldSpec, type PayloadSchema, type PayloadValidation, type PixelPoint, type PixelRect, type PlayAudioCueResult, type PlayCueResult, type PlaySequenceOptions, type PlaySequenceResult, type PlayVisualLayerResult, type PlaywrightCompatibleAdapter, type PlaywrightCompatibleViewport, type PointerClick, PointerManager, type PointerSpace, type PortalCartDeclaration, type PortalDiagnostic, type PortalEnterRequest, type PortalExclusiveGrant, type PortalFrameInspect, type PortalInspect, type PortalLifecycle, type PortalLifecycleEventType, type PortalLifecycleSnapshot, type PortalMetaphor, type PortalMutationResult, type PortalOutcome, type PortalOutcomeKind, type PresentationAdapter, type PresentationAdapterTarget, type PresentationAudioCapabilityStatus, type PresentationBinding, type PresentationBindingConsidered, type PresentationBindingDiagnostic, type PresentationBindingErrorCode, type PresentationBindingEvaluation, type PresentationBindingEvent, type PresentationBindingEventType, type PresentationBindingExplanation, type PresentationBindingFallback, type PresentationBindingInspect, type PresentationBindingManifest, type PresentationBindingRejected, type PresentationBindingResources, type PresentationBindingRuntime, type PresentationBindingSelector, type PresentationBindingSnapshot, type PresentationBindingTarget, type PresentationBindingTargetKind, type PresentationCaptionView, type PresentationCartState, type PresentationCompletionRule, type PresentationCueIntent, type PresentationFallbackDefinition, type PresentationFallbackWhen, type PresentationFitMode, type PresentationInterruptionPolicy, type PresentationInvocationPhase, type PresentationInvocationView, type PresentationLayout, type PresentationModel, type PresentationPhase, type PresentationPredicate, type PresentationRegion, type PresentationSequenceBindings, type PresentationSequenceDefinition, type PresentationSequenceDiagnostic, type PresentationSequenceEvent, type PresentationSequenceEventType, type PresentationSequenceInspect, type PresentationSequencePlayer, type PresentationSequenceSnapshot, type PresentationSequenceSnapshotQueued, type PresentationStepDefinition, type PresentationStepEffect, type PresentationStepTiming, type PresentationTimeline, type PresentationTrackDefinition, type PresentationTrackKind, type PresentationView, type ProductionScenarioBoundary, type ProductionScenarioDefinition, type ProductionScenarioDiagnostic, type ProductionScenarioErrorCode, type ProductionScenarioEventType, type ProductionScenarioEvidenceBundle, type ProductionScenarioExpectation, type ProductionScenarioHost, type ProductionScenarioLocalization, type ProductionScenarioMatrix, type ProductionScenarioObservation, type ProductionScenarioReduceResult, type ProductionScenarioRequired, type ProductionScenarioRunner, type ProductionScenarioStep, type ProductionScenarioViewportPreset, type PublishExtras, REDACTED_VALUE, REJECTED_EVENT_TYPE, REMOTE_CART_ERROR_CODES, REMOTE_CART_GRANTS, REMOTE_CART_MANIFEST_VERSION, REMOTE_CART_SIGNATURE_ALG, REPLAY_INSPECTOR_SCHEMA_VERSION, ROUND_TRIP_TOLERANCE, ROUND_TRIP_TOLERANCE_CANVAS_PX, Random, type RandomState, type RejectionPayload, type RejectionReason, type RemoteCartAsset, type RemoteCartCapabilityBag, RemoteCartCapabilityError, type RemoteCartDiagnostic, type RemoteCartErrorCode, type RemoteCartFetchAdapter, type RemoteCartGrant, type RemoteCartInspect, type RemoteCartLoadSource, type RemoteCartManifestBody, type RemoteCartNetworkApi, type RemoteCartRegistry, type RemoteCartSandbox, type RemoteCartSignature, type RemoteCartStorageApi, type RemoteContentEnvelope, type ReplayCompareResult, type ReplayInspector, type ReplayInspectorExport, type ReplayInspectorReport, type ReplayMetadata, type ReplayParticipantSummary, type ReplayTapeAction, type ReplayTraceFilter, type ResolveImportableCartStateResult, type ResolvedAsset, type RestoreContentRevisionResult, type RestoreJobResult, type RestorePortalResult, type RestorePresentationBindingsResult, type RestorePresentationSequenceResult, type RestoreSemanticLayerResult, type RestoreVisualLayerResult, type RestoreWorldGraphResult, type RestoreWorldPatchResult, type RouterDecision, type RouterDecisionOutcome, type RouterDecisionReason, type RouterParticipantInspect, type RuntimeGroup, type RuntimeGroupCapability, type RuntimeGroupDiagnostics, type RuntimeGroupFrameError, type RuntimeGroupInspect, type RuntimeGroupKind, type RuntimeGroupParticipantConfig, type RuntimeGroupParticipantHandle, type RuntimeGroupParticipantInspect, SELECTION_DECISION_KINDS, SELECTION_REASON_CODES, SELECTION_TRACE_SCHEMA_VERSION, SELECTION_TRACE_SENSITIVE_KEYS, SEMANTIC_APPEARANCE_KEYS, SEMANTIC_GEOMETRY_KINDS, SEMANTIC_HIT_TEST_POLICIES, SEMANTIC_INTERACTION_KEYS, SEMANTIC_LAYER_SNAPSHOT_SCHEMA_VERSION, SILENT_ASSET_FALLBACK_REF, SNAPSHOT_SCHEMA_VERSION, type SchemaCompatibility, type ScriptedAction, type SelectionAssetResolution, type SelectionBindingEvaluation, type SelectionContentIdentity, type SelectionDecisionInput, type SelectionDecisionKind, type SelectionDecisionRecord, type SelectionPresentationDecision, type SelectionReasonCode, type SelectionSequenceDecision, type SelectionSnapshotProvenance, type SelectionStagingOutcome, type SelectionStagingResult, type SelectionTrace, type SelectionTraceExport, type SelectionTraceFilter, type SelectionTraceReport, type SemanticAppearanceKey, type SemanticGeometryKind, type SemanticHitTestPolicy, type SemanticInteractionKey, type SemanticLayerController, type SemanticLayerControllerSnapshot, type SemanticMaskGrid, type SemanticPublishedRegion, type SemanticRegionA11y, type SemanticRegionDeclaration, type SemanticRegionGeometry, type SemanticRegionInspect, type SemanticRegionSnapshotRow, type SemanticRegionState, type SemanticRegionVisual, type SemanticRegionVisuals, type SignedRemoteCartManifest, type SnapshotAssetRef, type SnapshotCartRef, type SnapshotClock, type SnapshotDiagnostic, type SnapshotEnvelope, type SnapshotEnvelopeInput, type SnapshotIntegrity, type SnapshotMigration, type SnapshotMigrationRegistry, type SnapshotModuleRef, type SnapshotProvenance, type SnapshotSignatureRef, type TokenData, UNVERSIONED_CART_VERSION, VISUAL_LAYER_EVENTS, VISUAL_LAYER_FAILED_EVENT, VISUAL_LAYER_FAILURE_CODES, VISUAL_LAYER_HIDDEN_EVENT, VISUAL_LAYER_INCOMING_SUFFIX, VISUAL_LAYER_KINDS, VISUAL_LAYER_REVEALED_EVENT, VISUAL_LAYER_SNAPSHOT_SCHEMA_VERSION, VISUAL_LAYER_TRANSITIONS, VISUAL_LAYER_TRANSITION_COMPLETED_EVENT, VISUAL_LAYER_TRANSITION_STARTED_EVENT, type ValidateCapabilityManifestResult, type ValidateResult, type ValidateSnapshotResult, type VerifyRemoteCartResult, type VersionedSnapshot, type VirtualClock, type VisualLayerAcceptedBinding, type VisualLayerAssetStatus, type VisualLayerCapture, type VisualLayerController, type VisualLayerControllerSnapshot, type VisualLayerCueSpec, type VisualLayerDeclaration, type VisualLayerDiagnostic, type VisualLayerEvent, type VisualLayerEventType, type VisualLayerFailureCode, type VisualLayerFallbackPolicy, type VisualLayerInspect, type VisualLayerKind, type VisualLayerSnapshotRow, type VisualLayerTransitionInspect, type VisualLayerTransitionKind, type VisualLayerVersionDeclaration, WORLD_DISCOVERED_EVENT, WORLD_EDGE_ACCESS, WORLD_EDGE_ADDED_EVENT, WORLD_EDGE_VISIBILITIES, WORLD_ENTITY_KINDS, WORLD_ENTITY_STATUSES, WORLD_GRAPH_DIAGNOSTIC_EVENT, WORLD_GRAPH_EVENTS, WORLD_GRAPH_SNAPSHOT_SCHEMA_VERSION, WORLD_MAP_LAYERS, WORLD_NODE_ADDED_EVENT, WORLD_NODE_KINDS, WORLD_PATCH_ACCEPTED_EVENT, WORLD_PATCH_DIAGNOSTIC_EVENT, WORLD_PATCH_ERROR_CODES, WORLD_PATCH_EVENTS, WORLD_PATCH_OPS, WORLD_PATCH_PRECONDITION_TYPES, WORLD_PATCH_REDACTED_KEYS, WORLD_PATCH_REJECTED_EVENT, WORLD_PATCH_SCHEMA_VERSION, WORLD_PATCH_SNAPSHOT_SCHEMA_VERSION, WORLD_PATCH_SUPERSEDED_EVENT, WORLD_TRANSIT_EVENT, type WorldAcceptedPatch, type WorldEdge, type WorldEdgeAccess, type WorldEdgeVisibility, type WorldEntity, type WorldEntityKind, type WorldEntityRecord, type WorldEntityStatus, type WorldGraph, type WorldGraphDiagnostic, type WorldGraphEventType, type WorldGraphInspect, type WorldGraphPatch, type WorldGraphProjection, type WorldGraphSnapshot, type WorldIdentityChange, type WorldLinkRecord, type WorldMapLayer, type WorldMutationResult, type WorldNode, type WorldNodeKind, type WorldObserverDiscovery, type WorldPatch, type WorldPatchAcceptedPayload, type WorldPatchApplier, type WorldPatchAssetAvailability, type WorldPatchAuditRecord, type WorldPatchBindingAvailability, type WorldPatchCommitResult, type WorldPatchContentAvailability, type WorldPatchDiagnostic, type WorldPatchDomainValidator, type WorldPatchDryRunResult, type WorldPatchErrorCode, type WorldPatchEventType, type WorldPatchGraphPolicy, type WorldPatchInspect, type WorldPatchLimits, type WorldPatchOp, type WorldPatchOperation, type WorldPatchPrecondition, type WorldPatchPreconditionType, type WorldPatchProvenance, type WorldPatchRefs, type WorldPatchSnapshot, type WorldPath, type WorldPathResult, type WorldPersistenceAdapter, type WorldPersistenceTransaction, type WorldQueryBounds, type WorldReachabilityResult, type WorldRevisionState, type WorldTransit, type WorldTraversalContext, type WorldTraversalPolicy, appearanceForState, applyCueEasing, applySnapshotMigrations, assetStatusEvent, assetToNormalized, attachCartStatePersistence, attachPresentationAdapter, attachSelectionTrace, cabinetPortal, canonicalizeRemoteCartBody, canonicalizeSeed, canvasToCss, canvasToNormalized, toJSON as capabilityManifestToJSON, captureVisualLayers, cloneSnapshotJson, comparePayloadSchemas, compareReplayTraces, contentRevisionEventContracts, createAssetFailure, createAssetPreloader, createAudioBroker, createAudioCueTimeline, createBrowserHarness, createCompositor, createContentRevisionActivator, createContractRegistry, createDeclaredAssetResolver, createEngineSnapshotMigrations, createEventRouter, createExecutableModuleHost, createFixtureAssetResolver, createHeadlessAudioAdapter, createHeadlessJobWorker, createHostGrantSet, createHostedAssetResolver, createJobCoordinator, createLandmarkRegistry, createMemoryJobPersistence, createMemoryWorldPersistence, createPlaywrightCompatibleAdapter, createPortalLifecycle, createPresentationBindingRuntime, createPresentationLayout, createPresentationModelEvent, createPresentationSequencePlayer, createPresentationTimeline, createProductionScenarioRunner, createReferencePresentationCart, createRemoteCartRegistry, createRemoteCartSandbox, createRemoteContentAdapter, createReplayInspector, createRuntime, createRuntimeGroup, createSelectionTrace, createSemanticLayerController, createSnapshotMigrationRegistry, createStaticContentAdapter, createVirtualClock, createVisualLayerController, createWallClock, createWorldGraph, createWorldPatchApplier, cssToCanvas, cssToNormalized, defaultSnapshotMigrationRegistry, defineCapabilityManifest, defineDiagnostic, defineIntent, definePresentationBindings, definePresentationSequence, defineProductionScenario, defineRemoteCartManifest, defineSnapshot, defineStateEvent, deriveAttachOptions, describeReplayMismatch, detectSnapshotSchemaVersion, drawGeometryDebug, encodeMidiMessage, engineStateFromEnvelope, evaluatePresentationBindings, familyPatternForType, fnv1aHex, freezeCapabilityBag, geometryKindsOf, hmacSha256Hex, inferEventKind, isAssetFailure, isAssetFailureCode, isAssetKind, isAudioCueEventType, isContentRevisionErrorCode, isCueLifecycleType, isLegacyCartStateBundle, isMidiChannel, isMidiData, isPresentationBindingErrorCode, isPresentationBindingEventType, isPresentationModel, isPresentationPhase, isPresentationSequenceEventType, isProductionScenarioBoundary, isProductionScenarioErrorCode, isProductionScenarioEventType, isSelectionDecisionKind, isSelectionReasonCode, isSemanticBlendMode, isSemanticGeometryKind, isSemanticHitTestPolicy, isSnapshotEnvelope, isVersionedSnapshot, isVisualLayerEventType, isVisualLayerKind, isVisualLayerTransitionKind, isWorldPatchErrorCode, jobEventContracts, kindSegmentInType, listRequestedRemoteCartGrants, loadRemoteCart, localizeProductionScenarioFailure, matchEventPattern, midiChannelFromStatus, midiStatus, mountPresentationAdapter, normalizeEvent, normalizedToAsset, normalizedToCanvas, normalizedToCss, paintingPortal, parseCapabilityManifest, parseContentRevisionCatalog, parseGeometry, parseMidiBytes, parseRemoteCartManifest, parseSnapshot, pointFromOrigin, pointInHitbox, pointInSemanticGeometry, pointerToRegion, presentationBindingEventContracts, presentationBindingTargetKey, presentationSequenceEventContracts, productionScenarioEventContracts, recordSelectionDecision, rectToCanvas, rectToCss, regionToViewport, registerCartStateHotkeys, remoteCartProvenanceForSnapshot, replayExportedTrace, resolveImportableCartState, resolveRuntimeSeed, restoreSnapshotFromUnknown, rewriteHostedAssetRef, scheduleAudioCue, serializeGeometry, sha256Hex, signRemoteCartManifest, snapshotErrorsToMessage, snapshotFromCartBundle, validateCapabilityManifest, validateGeometry, validateSnapshot, verifyAttachOptions, verifyRemoteCartSignature, visualIncomingLayerId, worldGraphEventContracts, worldPatchEventContracts };