@cyberart-io/engine 0.0.7 → 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/CHANGELOG.md +37 -0
- package/README.md +308 -1
- package/dist/headless.d.ts +2584 -61
- package/dist/headless.js +1 -1
- package/dist/index.d.ts +2585 -244
- package/dist/index.js +1 -1
- package/docs/asset-resolver.md +1 -1
- package/docs/browser-harness.md +1 -1
- package/docs/capability-manifest.md +1 -1
- package/docs/content-revision.md +64 -0
- package/docs/events.md +1 -1
- package/docs/frame-benchmark.md +107 -0
- package/docs/headless-harness.md +6 -2
- package/docs/job-orchestration.md +55 -0
- package/docs/portal-lifecycle.md +50 -0
- package/docs/presentation-bindings.md +93 -0
- package/docs/presentation-sequences.md +150 -0
- package/docs/production-scenario.md +81 -0
- package/docs/remote-cart-manifest.md +66 -0
- package/docs/replay-inspector.md +1 -1
- package/docs/runtime-group.md +1 -1
- package/docs/selection-trace.md +60 -0
- package/docs/semantic-layers.md +72 -0
- package/docs/snapshots.md +1 -1
- package/docs/visual-layers.md +1 -1
- package/docs/world-graph.md +39 -0
- package/docs/world-patch.md +61 -0
- package/package.json +3 -2
package/dist/headless.d.ts
CHANGED
|
@@ -333,6 +333,73 @@ type CartStateBundle = {
|
|
|
333
333
|
state: unknown;
|
|
334
334
|
};
|
|
335
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
338
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
339
|
+
* See packages/engine/LICENSE
|
|
340
|
+
*
|
|
341
|
+
* Host-controlled time, input, and asset completion for deterministic replays.
|
|
342
|
+
* Production kaleidoscope / Art Blocks playback does not enable this mode.
|
|
343
|
+
* Logical asset URLs are resolved by the host preloader (`assetResolver.ts`);
|
|
344
|
+
* this module only times `ASSET_READY_EVENT` / `ASSET_FAILED_EVENT` delivery.
|
|
345
|
+
*/
|
|
346
|
+
|
|
347
|
+
type PointerKind = 'down' | 'move' | 'up';
|
|
348
|
+
type ScriptedAction = {
|
|
349
|
+
atFrame: number;
|
|
350
|
+
} & ({
|
|
351
|
+
type: 'pointer';
|
|
352
|
+
pointer: {
|
|
353
|
+
kind: PointerKind;
|
|
354
|
+
x: number;
|
|
355
|
+
y: number;
|
|
356
|
+
};
|
|
357
|
+
} | {
|
|
358
|
+
type: 'key';
|
|
359
|
+
key: string;
|
|
360
|
+
} | {
|
|
361
|
+
type: 'event';
|
|
362
|
+
event: HostEvent;
|
|
363
|
+
} | {
|
|
364
|
+
type: 'asset';
|
|
365
|
+
id: string;
|
|
366
|
+
status: 'ready' | 'failed';
|
|
367
|
+
/** Optional structured failure or resolved resource. Envelope is unchanged. */
|
|
368
|
+
detail?: unknown;
|
|
369
|
+
});
|
|
370
|
+
type DeterministicRuntimeOptions = {
|
|
371
|
+
/** Virtual clock origin in ms. Default 0. */
|
|
372
|
+
origin?: number;
|
|
373
|
+
/** Actions applied at the start of `atFrame`, before `update`. */
|
|
374
|
+
actions?: ScriptedAction[];
|
|
375
|
+
};
|
|
376
|
+
type ClockSnapshot = {
|
|
377
|
+
now: number;
|
|
378
|
+
framesElapsed: number;
|
|
379
|
+
frameRate: number;
|
|
380
|
+
};
|
|
381
|
+
type ReplayMetadata = {
|
|
382
|
+
seed: string;
|
|
383
|
+
clock: ClockSnapshot;
|
|
384
|
+
rng: RandomState;
|
|
385
|
+
actions: ScriptedAction[];
|
|
386
|
+
applied: AppliedAction[];
|
|
387
|
+
events: HostEvent[];
|
|
388
|
+
state: unknown;
|
|
389
|
+
};
|
|
390
|
+
type AppliedAction = {
|
|
391
|
+
frame: number;
|
|
392
|
+
action: ScriptedAction;
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
type FrameTimingSample = {
|
|
396
|
+
frame: number;
|
|
397
|
+
updateMs: number;
|
|
398
|
+
renderMs: number;
|
|
399
|
+
drawMs: number;
|
|
400
|
+
totalMs: number;
|
|
401
|
+
};
|
|
402
|
+
|
|
336
403
|
/**
|
|
337
404
|
* Copyright (c) 2026 Aaron Boyarsky
|
|
338
405
|
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
@@ -373,9 +440,17 @@ type SnapshotIntegrity = {
|
|
|
373
440
|
alg: string;
|
|
374
441
|
hash: string;
|
|
375
442
|
};
|
|
443
|
+
type SnapshotSignatureRef = {
|
|
444
|
+
id: string;
|
|
445
|
+
alg: string;
|
|
446
|
+
};
|
|
376
447
|
type SnapshotProvenance = {
|
|
377
448
|
source?: string;
|
|
378
449
|
integrity?: SnapshotIntegrity;
|
|
450
|
+
publisher?: string;
|
|
451
|
+
version?: string;
|
|
452
|
+
signature?: SnapshotSignatureRef;
|
|
453
|
+
grants?: string[];
|
|
379
454
|
};
|
|
380
455
|
type SnapshotEnvelope = {
|
|
381
456
|
schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;
|
|
@@ -403,68 +478,9 @@ type ExportSnapshotOptions = {
|
|
|
403
478
|
runtimeVersion?: string;
|
|
404
479
|
};
|
|
405
480
|
|
|
406
|
-
/**
|
|
407
|
-
* Copyright (c) 2026 Aaron Boyarsky
|
|
408
|
-
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
409
|
-
* See packages/engine/LICENSE
|
|
410
|
-
*
|
|
411
|
-
* Host-controlled time, input, and asset completion for deterministic replays.
|
|
412
|
-
* Production kaleidoscope / Art Blocks playback does not enable this mode.
|
|
413
|
-
* Logical asset URLs are resolved by the host preloader (`assetResolver.ts`);
|
|
414
|
-
* this module only times `ASSET_READY_EVENT` / `ASSET_FAILED_EVENT` delivery.
|
|
415
|
-
*/
|
|
416
|
-
|
|
417
|
-
type PointerKind = 'down' | 'move' | 'up';
|
|
418
|
-
type ScriptedAction = {
|
|
419
|
-
atFrame: number;
|
|
420
|
-
} & ({
|
|
421
|
-
type: 'pointer';
|
|
422
|
-
pointer: {
|
|
423
|
-
kind: PointerKind;
|
|
424
|
-
x: number;
|
|
425
|
-
y: number;
|
|
426
|
-
};
|
|
427
|
-
} | {
|
|
428
|
-
type: 'key';
|
|
429
|
-
key: string;
|
|
430
|
-
} | {
|
|
431
|
-
type: 'event';
|
|
432
|
-
event: HostEvent;
|
|
433
|
-
} | {
|
|
434
|
-
type: 'asset';
|
|
435
|
-
id: string;
|
|
436
|
-
status: 'ready' | 'failed';
|
|
437
|
-
/** Optional structured failure or resolved resource. Envelope is unchanged. */
|
|
438
|
-
detail?: unknown;
|
|
439
|
-
});
|
|
440
|
-
type DeterministicRuntimeOptions = {
|
|
441
|
-
/** Virtual clock origin in ms. Default 0. */
|
|
442
|
-
origin?: number;
|
|
443
|
-
/** Actions applied at the start of `atFrame`, before `update`. */
|
|
444
|
-
actions?: ScriptedAction[];
|
|
445
|
-
};
|
|
446
|
-
type ClockSnapshot = {
|
|
447
|
-
now: number;
|
|
448
|
-
framesElapsed: number;
|
|
449
|
-
frameRate: number;
|
|
450
|
-
};
|
|
451
|
-
type ReplayMetadata = {
|
|
452
|
-
seed: string;
|
|
453
|
-
clock: ClockSnapshot;
|
|
454
|
-
rng: RandomState;
|
|
455
|
-
actions: ScriptedAction[];
|
|
456
|
-
applied: AppliedAction[];
|
|
457
|
-
events: HostEvent[];
|
|
458
|
-
state: unknown;
|
|
459
|
-
};
|
|
460
|
-
type AppliedAction = {
|
|
461
|
-
frame: number;
|
|
462
|
-
action: ScriptedAction;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
481
|
declare const ASSET_KINDS: readonly ["image", "audio", "font", "spritesheet"];
|
|
466
482
|
type AssetKind = (typeof ASSET_KINDS)[number];
|
|
467
|
-
declare const ASSET_FAILURE_CODES: readonly ["timeout", "cors", "not-found", "invalid", "aborted", "resolver"];
|
|
483
|
+
declare const ASSET_FAILURE_CODES: readonly ["timeout", "cors", "not-found", "invalid", "aborted", "resolver", "undeclared", "hash-mismatch", "unsigned"];
|
|
468
484
|
type AssetFailureCode = (typeof ASSET_FAILURE_CODES)[number];
|
|
469
485
|
type AssetCorsMode = 'anonymous' | 'use-credentials' | 'omit';
|
|
470
486
|
type AssetProvenance = {
|
|
@@ -630,6 +646,7 @@ type FrameErrorInfo = {
|
|
|
630
646
|
consecutive: number;
|
|
631
647
|
stopped: boolean;
|
|
632
648
|
};
|
|
649
|
+
|
|
633
650
|
type CreateRuntimeOptions = {
|
|
634
651
|
/** Required mount point. The runtime creates or adopts a canvas inside this element. */
|
|
635
652
|
container: HTMLElement;
|
|
@@ -679,6 +696,11 @@ type CreateRuntimeOptions = {
|
|
|
679
696
|
* `update`, and host-channel events still run. Default `'render'`.
|
|
680
697
|
*/
|
|
681
698
|
kind?: CartKind;
|
|
699
|
+
/**
|
|
700
|
+
* Optional per-frame update/render/draw timings. Can also be assigned later
|
|
701
|
+
* via `runtime.onFrameTiming`. Unset = no `performance.now` in the draw loop.
|
|
702
|
+
*/
|
|
703
|
+
onFrameTiming?: (sample: FrameTimingSample) => void;
|
|
682
704
|
};
|
|
683
705
|
type MountOptions<T = unknown> = {
|
|
684
706
|
/** Boot overrides passed as `customState` into `getDefaultState`. Not a live-state replay. */
|
|
@@ -760,6 +782,11 @@ type CyberArtRuntime = {
|
|
|
760
782
|
/** `'render'` (default) or `'calculation'` (no canvas / paint). */
|
|
761
783
|
readonly kind: CartKind;
|
|
762
784
|
onError?: (error: unknown, info: FrameErrorInfo) => void;
|
|
785
|
+
/**
|
|
786
|
+
* Optional per-frame update/render/draw timings. Unset = zero overhead in the
|
|
787
|
+
* draw loop (single null check). Same pattern as `onError`.
|
|
788
|
+
*/
|
|
789
|
+
onFrameTiming?: (sample: FrameTimingSample) => void;
|
|
763
790
|
};
|
|
764
791
|
|
|
765
792
|
/**
|
|
@@ -907,10 +934,14 @@ type RuntimeGroupParticipantInspect = {
|
|
|
907
934
|
emit: string[];
|
|
908
935
|
subscribe: string[];
|
|
909
936
|
authoritative: boolean;
|
|
937
|
+
/** True when the group skips this slot on `step` (portal parent suspend). */
|
|
938
|
+
suspended: boolean;
|
|
910
939
|
};
|
|
911
940
|
type RuntimeGroupDiagnostics = {
|
|
912
941
|
paused: boolean;
|
|
913
942
|
participantIds: string[];
|
|
943
|
+
/** Participants skipped by `step` until `resumeParticipant`. Sorted. */
|
|
944
|
+
suspendedIds: string[];
|
|
914
945
|
clocks: Record<string, ClockSnapshot>;
|
|
915
946
|
rejections: unknown[];
|
|
916
947
|
};
|
|
@@ -942,6 +973,13 @@ type RuntimeGroup = {
|
|
|
942
973
|
resize(width: number, height: number): void;
|
|
943
974
|
/** Tear down one participant without destroying the group or blanking siblings. */
|
|
944
975
|
detach(id: string): void;
|
|
976
|
+
/**
|
|
977
|
+
* Pause this cart's live loop and skip it on group `step`. Snapshot-safe
|
|
978
|
+
* state is retained. Used by portal lifecycle; does not pause siblings.
|
|
979
|
+
*/
|
|
980
|
+
suspendParticipant(id: string): void;
|
|
981
|
+
resumeParticipant(id: string): void;
|
|
982
|
+
isParticipantSuspended(id: string): boolean;
|
|
945
983
|
dispatch(participantId: string, event: HostEvent): void;
|
|
946
984
|
publish(event: EventInput, extras?: PublishExtras): EventEnvelope | undefined;
|
|
947
985
|
inspectParticipants(): Array<RouterParticipantInspect & {
|
|
@@ -1406,6 +1444,183 @@ declare function replayExportedTrace(exported: ReplayInspectorExport, group: Run
|
|
|
1406
1444
|
report: ReplayInspectorReport;
|
|
1407
1445
|
}>;
|
|
1408
1446
|
|
|
1447
|
+
/**
|
|
1448
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
1449
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
1450
|
+
* See packages/engine/LICENSE
|
|
1451
|
+
*
|
|
1452
|
+
* Content-selection and presentation-decision traces. Hosts record why a
|
|
1453
|
+
* binding, revision, asset, sequence, or fallback won. Reuses CYB-65
|
|
1454
|
+
* redaction, bounded retention, and correlation ids. There is no Player UI.
|
|
1455
|
+
*/
|
|
1456
|
+
|
|
1457
|
+
declare const SELECTION_TRACE_SCHEMA_VERSION: 1;
|
|
1458
|
+
declare const DEFAULT_MAX_SELECTION_RECORDS = 512;
|
|
1459
|
+
declare const SELECTION_REASON_CODES: readonly ["binding-conflict", "asset-failure", "revision-rollback", "sequence-interruption", "text-only-fallback"];
|
|
1460
|
+
type SelectionReasonCode = (typeof SELECTION_REASON_CODES)[number];
|
|
1461
|
+
declare const SELECTION_DECISION_KINDS: readonly ["state-projection", "binding", "content-revision", "staging", "asset", "sequence", "presentation", "snapshot"];
|
|
1462
|
+
type SelectionDecisionKind = (typeof SELECTION_DECISION_KINDS)[number];
|
|
1463
|
+
declare const SELECTION_TRACE_SENSITIVE_KEYS: readonly ["prompt", "credentials", "credential", "authorization", "apiKey", "secret", "privatePrompt", "signedUrl", "signedURL", "signed_url", "presignedUrl", "password"];
|
|
1464
|
+
declare function isSelectionReasonCode(value: unknown): value is SelectionReasonCode;
|
|
1465
|
+
declare function isSelectionDecisionKind(value: unknown): value is SelectionDecisionKind;
|
|
1466
|
+
type SelectionBindingEvaluation = {
|
|
1467
|
+
bindingId: string;
|
|
1468
|
+
priority: number;
|
|
1469
|
+
predicateResult: boolean;
|
|
1470
|
+
winner?: boolean;
|
|
1471
|
+
rejectedReason?: string;
|
|
1472
|
+
};
|
|
1473
|
+
type SelectionContentIdentity = {
|
|
1474
|
+
contentId: string;
|
|
1475
|
+
revision: string;
|
|
1476
|
+
manifestVersion?: number;
|
|
1477
|
+
source?: string;
|
|
1478
|
+
publisher?: string;
|
|
1479
|
+
hashes?: Record<string, string>;
|
|
1480
|
+
};
|
|
1481
|
+
type SelectionStagingOutcome = 'validated' | 'rejected' | 'cache-hit' | 'cache-miss' | 'superseded' | 'rollback' | 'retained';
|
|
1482
|
+
type SelectionStagingResult = {
|
|
1483
|
+
outcome: SelectionStagingOutcome;
|
|
1484
|
+
cache?: 'hit' | 'miss';
|
|
1485
|
+
detail?: string;
|
|
1486
|
+
};
|
|
1487
|
+
type SelectionAssetResolution = {
|
|
1488
|
+
logicalRef: string;
|
|
1489
|
+
resolver?: string;
|
|
1490
|
+
adapter?: string;
|
|
1491
|
+
mediaHash?: string;
|
|
1492
|
+
ready: boolean;
|
|
1493
|
+
failure?: string;
|
|
1494
|
+
fallback?: string | null;
|
|
1495
|
+
};
|
|
1496
|
+
type SelectionSequenceDecision = {
|
|
1497
|
+
sequenceId: string;
|
|
1498
|
+
invocationId: string;
|
|
1499
|
+
stepId?: string | null;
|
|
1500
|
+
track?: string | null;
|
|
1501
|
+
decision: 'play' | 'skip' | 'interrupt' | 'replay' | 'complete';
|
|
1502
|
+
capabilityFallback?: string | null;
|
|
1503
|
+
};
|
|
1504
|
+
type SelectionPresentationDecision = {
|
|
1505
|
+
layerId?: string;
|
|
1506
|
+
variant?: string;
|
|
1507
|
+
regionId?: string;
|
|
1508
|
+
maskRevision?: string | number;
|
|
1509
|
+
blend?: string;
|
|
1510
|
+
hitTest?: boolean;
|
|
1511
|
+
caption?: string | null;
|
|
1512
|
+
audioIntent?: string | null;
|
|
1513
|
+
};
|
|
1514
|
+
type SelectionSnapshotProvenance = {
|
|
1515
|
+
revision?: string | number | null;
|
|
1516
|
+
schemaVersion?: number;
|
|
1517
|
+
seed?: string;
|
|
1518
|
+
};
|
|
1519
|
+
type SelectionDecisionInput = {
|
|
1520
|
+
kind: SelectionDecisionKind;
|
|
1521
|
+
reason: SelectionReasonCode | string;
|
|
1522
|
+
summary: string;
|
|
1523
|
+
turn?: number;
|
|
1524
|
+
time?: number;
|
|
1525
|
+
correlationId?: string;
|
|
1526
|
+
causationId?: string;
|
|
1527
|
+
envelopeId?: string;
|
|
1528
|
+
initiatingEventType?: string;
|
|
1529
|
+
projectionRevision?: string | number;
|
|
1530
|
+
projection?: unknown;
|
|
1531
|
+
hostState?: unknown;
|
|
1532
|
+
bindings?: readonly SelectionBindingEvaluation[];
|
|
1533
|
+
winningBindingId?: string | null;
|
|
1534
|
+
rejectedBindingIds?: readonly string[];
|
|
1535
|
+
defaultFallback?: boolean;
|
|
1536
|
+
requestedContent?: SelectionContentIdentity;
|
|
1537
|
+
activatedContent?: SelectionContentIdentity | null;
|
|
1538
|
+
staging?: SelectionStagingResult;
|
|
1539
|
+
lastKnownGood?: SelectionContentIdentity | null;
|
|
1540
|
+
asset?: SelectionAssetResolution;
|
|
1541
|
+
sequence?: SelectionSequenceDecision;
|
|
1542
|
+
presentation?: SelectionPresentationDecision;
|
|
1543
|
+
snapshot?: SelectionSnapshotProvenance;
|
|
1544
|
+
};
|
|
1545
|
+
type SelectionDecisionRecord = {
|
|
1546
|
+
index: number;
|
|
1547
|
+
kind: SelectionDecisionKind;
|
|
1548
|
+
reason: string;
|
|
1549
|
+
summary: string;
|
|
1550
|
+
turn?: number;
|
|
1551
|
+
time?: number;
|
|
1552
|
+
correlationId?: string;
|
|
1553
|
+
causationId?: string;
|
|
1554
|
+
envelopeId?: string;
|
|
1555
|
+
initiatingEventType?: string;
|
|
1556
|
+
projectionRevision?: string | number;
|
|
1557
|
+
projection?: unknown;
|
|
1558
|
+
bindings?: SelectionBindingEvaluation[];
|
|
1559
|
+
winningBindingId?: string | null;
|
|
1560
|
+
rejectedBindingIds?: string[];
|
|
1561
|
+
defaultFallback?: boolean;
|
|
1562
|
+
requestedContent?: SelectionContentIdentity;
|
|
1563
|
+
activatedContent?: SelectionContentIdentity | null;
|
|
1564
|
+
staging?: SelectionStagingResult;
|
|
1565
|
+
lastKnownGood?: SelectionContentIdentity | null;
|
|
1566
|
+
asset?: SelectionAssetResolution;
|
|
1567
|
+
sequence?: SelectionSequenceDecision;
|
|
1568
|
+
presentation?: SelectionPresentationDecision;
|
|
1569
|
+
snapshot?: SelectionSnapshotProvenance;
|
|
1570
|
+
};
|
|
1571
|
+
type SelectionTraceFilter = {
|
|
1572
|
+
kinds?: readonly SelectionDecisionKind[];
|
|
1573
|
+
reasons?: readonly string[];
|
|
1574
|
+
correlationId?: string;
|
|
1575
|
+
causationId?: string;
|
|
1576
|
+
envelopeId?: string;
|
|
1577
|
+
contentId?: string;
|
|
1578
|
+
sequenceId?: string;
|
|
1579
|
+
};
|
|
1580
|
+
type CreateSelectionTraceOptions = {
|
|
1581
|
+
redactedKeys?: readonly string[];
|
|
1582
|
+
maxRecords?: number;
|
|
1583
|
+
sampleRate?: number;
|
|
1584
|
+
/** Safe host-projection field names. All other projection/hostState keys redact. */
|
|
1585
|
+
projectionWhitelist?: readonly string[];
|
|
1586
|
+
inspector?: Pick<ReplayInspector, 'records'>;
|
|
1587
|
+
};
|
|
1588
|
+
type SelectionTraceExport = {
|
|
1589
|
+
schemaVersion: typeof SELECTION_TRACE_SCHEMA_VERSION;
|
|
1590
|
+
redactedKeys: string[];
|
|
1591
|
+
projectionWhitelist: string[];
|
|
1592
|
+
dropped: number;
|
|
1593
|
+
sampledOut: number;
|
|
1594
|
+
records: SelectionDecisionRecord[];
|
|
1595
|
+
inspectorRecords: InspectorRecord[];
|
|
1596
|
+
snapshotRevision?: string | number | null;
|
|
1597
|
+
snapshotSchemaVersion?: number;
|
|
1598
|
+
snapshotSeed?: string;
|
|
1599
|
+
};
|
|
1600
|
+
type SelectionTraceReport = {
|
|
1601
|
+
schemaVersion: typeof SELECTION_TRACE_SCHEMA_VERSION;
|
|
1602
|
+
records: SelectionDecisionRecord[];
|
|
1603
|
+
dropped: number;
|
|
1604
|
+
sampledOut: number;
|
|
1605
|
+
};
|
|
1606
|
+
type SelectionTrace = {
|
|
1607
|
+
recordSelectionDecision(input: SelectionDecisionInput): SelectionDecisionRecord | null;
|
|
1608
|
+
records(filter?: SelectionTraceFilter): SelectionDecisionRecord[];
|
|
1609
|
+
query(filter?: SelectionTraceFilter): SelectionDecisionRecord[];
|
|
1610
|
+
chain(correlationId: string): SelectionDecisionRecord[];
|
|
1611
|
+
exportTrace(filter?: SelectionTraceFilter): SelectionTraceExport;
|
|
1612
|
+
importTrace(exported: SelectionTraceExport | string): void;
|
|
1613
|
+
report(filter?: SelectionTraceFilter): SelectionTraceReport;
|
|
1614
|
+
setSnapshotProvenance(meta: SelectionSnapshotProvenance): void;
|
|
1615
|
+
reset(): void;
|
|
1616
|
+
destroy(): void;
|
|
1617
|
+
};
|
|
1618
|
+
declare function recordSelectionDecision(trace: SelectionTrace, input: SelectionDecisionInput): SelectionDecisionRecord | null;
|
|
1619
|
+
declare function attachSelectionTrace<T extends object>(bundle: T, trace: SelectionTraceExport | null): T & {
|
|
1620
|
+
selectionTrace: SelectionTraceExport | null;
|
|
1621
|
+
};
|
|
1622
|
+
declare function createSelectionTrace(options?: CreateSelectionTraceOptions): SelectionTrace;
|
|
1623
|
+
|
|
1409
1624
|
type CueEasing = 'linear' | 'ease-out';
|
|
1410
1625
|
type CueDuplicatePolicy = 'ignore' | 'replace' | 'reject';
|
|
1411
1626
|
type CueRepeatPolicy = {
|
|
@@ -1689,6 +1904,2314 @@ type VisualLayerCapture = {
|
|
|
1689
1904
|
declare function captureVisualLayers(controller: VisualLayerController): VisualLayerCapture;
|
|
1690
1905
|
declare function createVisualLayerController(options: CreateVisualLayerControllerOptions): VisualLayerController;
|
|
1691
1906
|
|
|
1907
|
+
/**
|
|
1908
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
1909
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
1910
|
+
* See packages/engine/LICENSE
|
|
1911
|
+
*
|
|
1912
|
+
* Shared normalized coordinate, anchor, and hit-region contract. Hosts and
|
|
1913
|
+
* adapters may adopt this later; pixel `PresentationRegion` is unchanged.
|
|
1914
|
+
*
|
|
1915
|
+
* Coordinate spaces:
|
|
1916
|
+
* - `normalized` — 0–1 of the **content** box (full intrinsic artwork, not letterbox).
|
|
1917
|
+
* - `asset` — intrinsic content pixels (`contentWidth` × `contentHeight`).
|
|
1918
|
+
* - `css` / `viewport` — layout pixels (`viewportWidth` × `viewportHeight`).
|
|
1919
|
+
* - `canvas` — drawing-buffer pixels (`css * devicePixelRatio`). Pointers match
|
|
1920
|
+
* `PointerManager` / harness `click` when the buffer is the drawing canvas.
|
|
1921
|
+
*
|
|
1922
|
+
* Pointer helpers default to **canvas** space. Pass `{ space: 'css' }` for
|
|
1923
|
+
* layout pixels. Round-trip: `ROUND_TRIP_TOLERANCE` (1e-6 normalized) or
|
|
1924
|
+
* `ROUND_TRIP_TOLERANCE_CANVAS_PX` (0.5 canvas px).
|
|
1925
|
+
*/
|
|
1926
|
+
declare const GEOMETRY_CONTRACT_VERSION: 1;
|
|
1927
|
+
type PresentationFitMode = 'contain' | 'cover' | 'crop';
|
|
1928
|
+
declare const ANCHOR_ORIGINS: readonly ["center", "top-left", "top-right", "bottom-left", "bottom-right", "top", "bottom", "left", "right"];
|
|
1929
|
+
type AnchorOrigin = (typeof ANCHOR_ORIGINS)[number];
|
|
1930
|
+
type NormalizedPoint = {
|
|
1931
|
+
x: number;
|
|
1932
|
+
y: number;
|
|
1933
|
+
};
|
|
1934
|
+
type NormalizedRect = {
|
|
1935
|
+
x: number;
|
|
1936
|
+
y: number;
|
|
1937
|
+
width: number;
|
|
1938
|
+
height: number;
|
|
1939
|
+
};
|
|
1940
|
+
type NormalizedPolygon = readonly NormalizedPoint[];
|
|
1941
|
+
type GeometryPadding = {
|
|
1942
|
+
top: number;
|
|
1943
|
+
right: number;
|
|
1944
|
+
bottom: number;
|
|
1945
|
+
left: number;
|
|
1946
|
+
};
|
|
1947
|
+
/** Insets from the content edges in normalized units (0–1). */
|
|
1948
|
+
type GeometrySafeArea = GeometryPadding;
|
|
1949
|
+
type GeometryAnchor = {
|
|
1950
|
+
id: string;
|
|
1951
|
+
point: NormalizedPoint;
|
|
1952
|
+
origin?: AnchorOrigin;
|
|
1953
|
+
};
|
|
1954
|
+
type GeometryHitbox = {
|
|
1955
|
+
id: string;
|
|
1956
|
+
rect?: NormalizedRect;
|
|
1957
|
+
polygon?: NormalizedPolygon;
|
|
1958
|
+
};
|
|
1959
|
+
type GeometryDocument = {
|
|
1960
|
+
version: typeof GEOMETRY_CONTRACT_VERSION;
|
|
1961
|
+
landmarks: GeometryAnchor[];
|
|
1962
|
+
regions: GeometryHitbox[];
|
|
1963
|
+
padding?: GeometryPadding;
|
|
1964
|
+
safeArea?: GeometrySafeArea;
|
|
1965
|
+
};
|
|
1966
|
+
type PresentationLayout = {
|
|
1967
|
+
mode: PresentationFitMode;
|
|
1968
|
+
contentWidth: number;
|
|
1969
|
+
contentHeight: number;
|
|
1970
|
+
viewportWidth: number;
|
|
1971
|
+
viewportHeight: number;
|
|
1972
|
+
devicePixelRatio: number;
|
|
1973
|
+
/** Content → CSS pixels. */
|
|
1974
|
+
scale: number;
|
|
1975
|
+
/** Letterbox (positive) or crop (negative) offset of content origin in CSS. */
|
|
1976
|
+
offsetX: number;
|
|
1977
|
+
offsetY: number;
|
|
1978
|
+
canvasWidth: number;
|
|
1979
|
+
canvasHeight: number;
|
|
1980
|
+
/** Visible slice of the content box in normalized space. */
|
|
1981
|
+
visibleNormalizedRect: NormalizedRect;
|
|
1982
|
+
};
|
|
1983
|
+
|
|
1984
|
+
/**
|
|
1985
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
1986
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
1987
|
+
* See packages/engine/LICENSE
|
|
1988
|
+
*
|
|
1989
|
+
* Cart-published named semantic regions (mask / polygon / depth) in normalized
|
|
1990
|
+
* space. The host drives hover/focus/selected and supplies a11y names/roles.
|
|
1991
|
+
* Geometry, blend, and hit-test policy stay with the cart. Snapshot JSON is
|
|
1992
|
+
* hostState-safe. Headless inspect does not require a DOM overlay.
|
|
1993
|
+
*/
|
|
1994
|
+
|
|
1995
|
+
declare const SEMANTIC_LAYER_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
1996
|
+
declare const SEMANTIC_GEOMETRY_KINDS: readonly ["mask", "polygon", "rect", "depth"];
|
|
1997
|
+
type SemanticGeometryKind = (typeof SEMANTIC_GEOMETRY_KINDS)[number];
|
|
1998
|
+
declare const SEMANTIC_HIT_TEST_POLICIES: readonly ["pass-through", "absorb", "exclusive", "depth-ordered"];
|
|
1999
|
+
type SemanticHitTestPolicy = (typeof SEMANTIC_HIT_TEST_POLICIES)[number];
|
|
2000
|
+
declare const SEMANTIC_APPEARANCE_KEYS: readonly ["idle", "hover", "focus", "selected"];
|
|
2001
|
+
type SemanticAppearanceKey = (typeof SEMANTIC_APPEARANCE_KEYS)[number];
|
|
2002
|
+
type SemanticRegionState = {
|
|
2003
|
+
hover: boolean;
|
|
2004
|
+
focus: boolean;
|
|
2005
|
+
selected: boolean;
|
|
2006
|
+
};
|
|
2007
|
+
type SemanticRegionA11y = {
|
|
2008
|
+
name: string;
|
|
2009
|
+
role: string;
|
|
2010
|
+
};
|
|
2011
|
+
type SemanticMaskGrid = {
|
|
2012
|
+
width: number;
|
|
2013
|
+
height: number;
|
|
2014
|
+
/** Row-major coverage in [0, 1]. Length must be width * height. */
|
|
2015
|
+
alpha: readonly number[];
|
|
2016
|
+
/** Where the grid maps in normalized space. Default full content box. */
|
|
2017
|
+
bounds?: NormalizedRect;
|
|
2018
|
+
};
|
|
2019
|
+
type SemanticRegionGeometry = {
|
|
2020
|
+
mask?: SemanticMaskGrid;
|
|
2021
|
+
polygon?: NormalizedPolygon;
|
|
2022
|
+
rect?: NormalizedRect;
|
|
2023
|
+
/** Higher values are closer to the viewer. Default 0. */
|
|
2024
|
+
depth?: number;
|
|
2025
|
+
};
|
|
2026
|
+
type SemanticRegionVisual = {
|
|
2027
|
+
opacity?: number;
|
|
2028
|
+
blend?: CompositorBlendMode;
|
|
2029
|
+
/** Visual-layer version applied when `visualLayerId` is set. */
|
|
2030
|
+
version?: string;
|
|
2031
|
+
};
|
|
2032
|
+
type SemanticRegionVisuals = Partial<Record<SemanticAppearanceKey, SemanticRegionVisual>>;
|
|
2033
|
+
type SemanticRegionDeclaration = {
|
|
2034
|
+
id: string;
|
|
2035
|
+
geometry: SemanticRegionGeometry;
|
|
2036
|
+
hitTest?: SemanticHitTestPolicy;
|
|
2037
|
+
blend?: CompositorBlendMode;
|
|
2038
|
+
order?: number;
|
|
2039
|
+
compositorLayerId?: string;
|
|
2040
|
+
visualLayerId?: string;
|
|
2041
|
+
visuals?: SemanticRegionVisuals;
|
|
2042
|
+
initialState?: Partial<SemanticRegionState>;
|
|
2043
|
+
};
|
|
2044
|
+
type SemanticRegionInspect = {
|
|
2045
|
+
id: string;
|
|
2046
|
+
geometryKinds: SemanticGeometryKind[];
|
|
2047
|
+
hitTest: SemanticHitTestPolicy;
|
|
2048
|
+
blend: CompositorBlendMode;
|
|
2049
|
+
order: number;
|
|
2050
|
+
depth: number;
|
|
2051
|
+
state: SemanticRegionState;
|
|
2052
|
+
appearance: SemanticAppearanceKey;
|
|
2053
|
+
a11y: SemanticRegionA11y | null;
|
|
2054
|
+
visual: SemanticRegionVisual;
|
|
2055
|
+
};
|
|
2056
|
+
type SemanticPublishedRegion = {
|
|
2057
|
+
id: string;
|
|
2058
|
+
geometryKinds: SemanticGeometryKind[];
|
|
2059
|
+
a11y: SemanticRegionA11y | null;
|
|
2060
|
+
};
|
|
2061
|
+
type SemanticRegionSnapshotRow = {
|
|
2062
|
+
id: string;
|
|
2063
|
+
geometry: SemanticRegionGeometry;
|
|
2064
|
+
hitTest: SemanticHitTestPolicy;
|
|
2065
|
+
blend: CompositorBlendMode;
|
|
2066
|
+
order: number;
|
|
2067
|
+
compositorLayerId: string | null;
|
|
2068
|
+
visualLayerId: string | null;
|
|
2069
|
+
visuals: SemanticRegionVisuals;
|
|
2070
|
+
state: SemanticRegionState;
|
|
2071
|
+
a11y: SemanticRegionA11y | null;
|
|
2072
|
+
};
|
|
2073
|
+
type SemanticLayerControllerSnapshot = {
|
|
2074
|
+
schemaVersion: typeof SEMANTIC_LAYER_SNAPSHOT_SCHEMA_VERSION;
|
|
2075
|
+
frame: number;
|
|
2076
|
+
regions: SemanticRegionSnapshotRow[];
|
|
2077
|
+
};
|
|
2078
|
+
type RestoreSemanticLayerResult = {
|
|
2079
|
+
ok: true;
|
|
2080
|
+
snapshot: SemanticLayerControllerSnapshot;
|
|
2081
|
+
} | {
|
|
2082
|
+
ok: false;
|
|
2083
|
+
errors: string[];
|
|
2084
|
+
};
|
|
2085
|
+
type CreateSemanticLayerControllerOptions = {
|
|
2086
|
+
regions: readonly SemanticRegionDeclaration[];
|
|
2087
|
+
compositor?: Compositor;
|
|
2088
|
+
visualLayers?: VisualLayerController;
|
|
2089
|
+
originFrame?: number;
|
|
2090
|
+
};
|
|
2091
|
+
type SemanticLayerController = {
|
|
2092
|
+
list(): SemanticRegionInspect[];
|
|
2093
|
+
inspect(): SemanticRegionInspect[];
|
|
2094
|
+
inspectPublished(): SemanticPublishedRegion[];
|
|
2095
|
+
get(id: string): SemanticRegionInspect | undefined;
|
|
2096
|
+
geometryOf(id: string): SemanticRegionGeometry | undefined;
|
|
2097
|
+
setRegionState(id: string, state: Partial<SemanticRegionState>): void;
|
|
2098
|
+
setRegionA11y(id: string, a11y: SemanticRegionA11y | null): void;
|
|
2099
|
+
hitTest(point: NormalizedPoint): SemanticRegionInspect | undefined;
|
|
2100
|
+
hitTestAll(point: NormalizedPoint): SemanticRegionInspect[];
|
|
2101
|
+
snapshot(): SemanticLayerControllerSnapshot;
|
|
2102
|
+
restore(input: unknown): RestoreSemanticLayerResult;
|
|
2103
|
+
destroy(): void;
|
|
2104
|
+
readonly frame: number;
|
|
2105
|
+
};
|
|
2106
|
+
declare function createSemanticLayerController(options: CreateSemanticLayerControllerOptions): SemanticLayerController;
|
|
2107
|
+
|
|
2108
|
+
/**
|
|
2109
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
2110
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
2111
|
+
* See packages/engine/LICENSE
|
|
2112
|
+
*
|
|
2113
|
+
* Cross-modal presentation sequences. One frame-stepped clock coordinates
|
|
2114
|
+
* audio, captions, semantic-region state, visual layers, and typed cues.
|
|
2115
|
+
* Authored content is JSON-serializable: no callbacks, no ambient host access.
|
|
2116
|
+
* Dialogue graphs and game rules stay with the host.
|
|
2117
|
+
*/
|
|
2118
|
+
|
|
2119
|
+
declare const PRESENTATION_SEQUENCE_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
2120
|
+
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"];
|
|
2121
|
+
type PresentationSequenceEventType = (typeof PRESENTATION_SEQUENCE_EVENTS)[number];
|
|
2122
|
+
declare const PRESENTATION_TRACK_KINDS: readonly ["audio", "caption", "semantic-region", "visual-layer", "cue"];
|
|
2123
|
+
type PresentationTrackKind = (typeof PRESENTATION_TRACK_KINDS)[number];
|
|
2124
|
+
declare const PRESENTATION_INTERRUPTION_POLICIES: readonly ["replace", "queue", "reject", "ignore"];
|
|
2125
|
+
type PresentationInterruptionPolicy = (typeof PRESENTATION_INTERRUPTION_POLICIES)[number];
|
|
2126
|
+
declare const PRESENTATION_COMPLETION_RULES: readonly ["duration", "immediate"];
|
|
2127
|
+
type PresentationCompletionRule = (typeof PRESENTATION_COMPLETION_RULES)[number];
|
|
2128
|
+
declare const PRESENTATION_AUDIO_CAPABILITY_STATUSES: readonly ["unavailable", "failed", "unauthorized", "muted"];
|
|
2129
|
+
type PresentationAudioCapabilityStatus = (typeof PRESENTATION_AUDIO_CAPABILITY_STATUSES)[number];
|
|
2130
|
+
declare const PRESENTATION_INVOCATION_PHASES: readonly ["requested", "preloading", "ready", "playing", "paused", "skipped", "interrupted", "failed", "completed"];
|
|
2131
|
+
type PresentationInvocationPhase = (typeof PRESENTATION_INVOCATION_PHASES)[number];
|
|
2132
|
+
type PresentationSequenceDiagnostic = {
|
|
2133
|
+
code: string;
|
|
2134
|
+
detail: string;
|
|
2135
|
+
path?: string;
|
|
2136
|
+
};
|
|
2137
|
+
type PresentationStepTiming = {
|
|
2138
|
+
kind: 'absolute';
|
|
2139
|
+
atFrame: number;
|
|
2140
|
+
} | {
|
|
2141
|
+
kind: 'relative';
|
|
2142
|
+
afterStepId?: string;
|
|
2143
|
+
delayFrames?: number;
|
|
2144
|
+
} | {
|
|
2145
|
+
kind: 'simultaneous';
|
|
2146
|
+
withStepId: string;
|
|
2147
|
+
order?: number;
|
|
2148
|
+
delayFrames?: number;
|
|
2149
|
+
};
|
|
2150
|
+
type PresentationStepEffect = {
|
|
2151
|
+
kind: 'audio';
|
|
2152
|
+
assetBinding: string;
|
|
2153
|
+
channelBinding?: string;
|
|
2154
|
+
} | {
|
|
2155
|
+
kind: 'caption';
|
|
2156
|
+
textBinding: string;
|
|
2157
|
+
visible: boolean;
|
|
2158
|
+
} | {
|
|
2159
|
+
kind: 'semantic-region';
|
|
2160
|
+
regionBinding: string;
|
|
2161
|
+
state: Partial<Pick<SemanticRegionState, 'hover' | 'focus' | 'selected'>>;
|
|
2162
|
+
} | {
|
|
2163
|
+
kind: 'visual-layer';
|
|
2164
|
+
layerBinding: string;
|
|
2165
|
+
transition: Extract<VisualLayerTransitionKind, 'show' | 'hide'>;
|
|
2166
|
+
versionBinding?: string;
|
|
2167
|
+
} | {
|
|
2168
|
+
kind: 'cue';
|
|
2169
|
+
name: string;
|
|
2170
|
+
easing?: CueEasing;
|
|
2171
|
+
};
|
|
2172
|
+
type PresentationStepDefinition = {
|
|
2173
|
+
id: string;
|
|
2174
|
+
timing: PresentationStepTiming;
|
|
2175
|
+
durationFrames: number;
|
|
2176
|
+
delayFrames?: number;
|
|
2177
|
+
completion?: PresentationCompletionRule;
|
|
2178
|
+
effect: PresentationStepEffect;
|
|
2179
|
+
restoreOnComplete?: boolean;
|
|
2180
|
+
reducedMotion?: CueReducedMotionPolicy;
|
|
2181
|
+
reducedSensory?: 'keep' | 'skip-audio' | 'complete';
|
|
2182
|
+
};
|
|
2183
|
+
type PresentationTrackDefinition = {
|
|
2184
|
+
id: string;
|
|
2185
|
+
kind: PresentationTrackKind;
|
|
2186
|
+
steps: readonly PresentationStepDefinition[];
|
|
2187
|
+
};
|
|
2188
|
+
type PresentationFallbackWhen = {
|
|
2189
|
+
capability: 'audio';
|
|
2190
|
+
status: PresentationAudioCapabilityStatus;
|
|
2191
|
+
};
|
|
2192
|
+
type PresentationFallbackDefinition = {
|
|
2193
|
+
id: string;
|
|
2194
|
+
when: PresentationFallbackWhen;
|
|
2195
|
+
omitTrackIds?: readonly string[];
|
|
2196
|
+
};
|
|
2197
|
+
type PresentationSequenceDefinition = {
|
|
2198
|
+
id: string;
|
|
2199
|
+
tracks: readonly PresentationTrackDefinition[];
|
|
2200
|
+
interruptionPolicy?: PresentationInterruptionPolicy;
|
|
2201
|
+
fallbacks?: readonly PresentationFallbackDefinition[];
|
|
2202
|
+
};
|
|
2203
|
+
type PresentationSequenceBindings = {
|
|
2204
|
+
assets?: Record<string, string>;
|
|
2205
|
+
captions?: Record<string, string>;
|
|
2206
|
+
regions?: Record<string, string>;
|
|
2207
|
+
layers?: Record<string, string>;
|
|
2208
|
+
versions?: Record<string, string>;
|
|
2209
|
+
channels?: Record<string, string>;
|
|
2210
|
+
};
|
|
2211
|
+
type PlaySequenceOptions = {
|
|
2212
|
+
invocationId: string;
|
|
2213
|
+
idempotencyKey?: string;
|
|
2214
|
+
bindings?: PresentationSequenceBindings;
|
|
2215
|
+
};
|
|
2216
|
+
type DefinePresentationSequenceResult = {
|
|
2217
|
+
ok: true;
|
|
2218
|
+
sequence: PresentationSequenceDefinition;
|
|
2219
|
+
} | {
|
|
2220
|
+
ok: false;
|
|
2221
|
+
errors: PresentationSequenceDiagnostic[];
|
|
2222
|
+
};
|
|
2223
|
+
type PlaySequenceResult = {
|
|
2224
|
+
ok: true;
|
|
2225
|
+
invocation: PresentationInvocationView;
|
|
2226
|
+
} | {
|
|
2227
|
+
ok: false;
|
|
2228
|
+
reason: 'unknown-sequence' | 'invalid' | 'busy' | 'duplicate';
|
|
2229
|
+
detail: string;
|
|
2230
|
+
};
|
|
2231
|
+
type RestorePresentationSequenceResult = {
|
|
2232
|
+
ok: true;
|
|
2233
|
+
snapshot: PresentationSequenceSnapshot;
|
|
2234
|
+
} | {
|
|
2235
|
+
ok: false;
|
|
2236
|
+
errors: PresentationSequenceDiagnostic[];
|
|
2237
|
+
};
|
|
2238
|
+
type PresentationSequenceEvent = {
|
|
2239
|
+
type: PresentationSequenceEventType;
|
|
2240
|
+
atFrame: number;
|
|
2241
|
+
sequenceId: string;
|
|
2242
|
+
invocationId: string;
|
|
2243
|
+
idempotencyKey: string;
|
|
2244
|
+
stepId?: string;
|
|
2245
|
+
fallbackId?: string;
|
|
2246
|
+
reason?: string;
|
|
2247
|
+
};
|
|
2248
|
+
type PresentationCaptionView = {
|
|
2249
|
+
id: string;
|
|
2250
|
+
text: string;
|
|
2251
|
+
visible: boolean;
|
|
2252
|
+
};
|
|
2253
|
+
type PresentationCueIntent = {
|
|
2254
|
+
sequenceId: string;
|
|
2255
|
+
stepId: string;
|
|
2256
|
+
trackId: string;
|
|
2257
|
+
kind: PresentationTrackKind;
|
|
2258
|
+
startFrame: number;
|
|
2259
|
+
durationFrames: number;
|
|
2260
|
+
order: number;
|
|
2261
|
+
effect: PresentationStepEffect;
|
|
2262
|
+
};
|
|
2263
|
+
type PresentationInvocationView = {
|
|
2264
|
+
sequenceId: string;
|
|
2265
|
+
invocationId: string;
|
|
2266
|
+
idempotencyKey: string;
|
|
2267
|
+
phase: PresentationInvocationPhase;
|
|
2268
|
+
playhead: number;
|
|
2269
|
+
startedAtFrame: number;
|
|
2270
|
+
completedStepIds: string[];
|
|
2271
|
+
activeStepIds: string[];
|
|
2272
|
+
selectedFallbackId: string | null;
|
|
2273
|
+
};
|
|
2274
|
+
type PresentationSequenceSnapshot = {
|
|
2275
|
+
schemaVersion: typeof PRESENTATION_SEQUENCE_SNAPSHOT_SCHEMA_VERSION;
|
|
2276
|
+
frame: number;
|
|
2277
|
+
reducedMotion: boolean;
|
|
2278
|
+
reducedSensory: boolean;
|
|
2279
|
+
paused: boolean;
|
|
2280
|
+
active: PresentationInvocationView | null;
|
|
2281
|
+
queue: PresentationSequenceSnapshotQueued[];
|
|
2282
|
+
captions: PresentationCaptionView[];
|
|
2283
|
+
events: PresentationSequenceEvent[];
|
|
2284
|
+
bindings: PresentationSequenceBindings | null;
|
|
2285
|
+
};
|
|
2286
|
+
type PresentationSequenceSnapshotQueued = {
|
|
2287
|
+
sequenceId: string;
|
|
2288
|
+
invocationId: string;
|
|
2289
|
+
idempotencyKey: string;
|
|
2290
|
+
bindings: PresentationSequenceBindings;
|
|
2291
|
+
};
|
|
2292
|
+
type PresentationSequenceInspect = {
|
|
2293
|
+
frame: number;
|
|
2294
|
+
paused: boolean;
|
|
2295
|
+
reducedMotion: boolean;
|
|
2296
|
+
reducedSensory: boolean;
|
|
2297
|
+
active: PresentationInvocationView | null;
|
|
2298
|
+
queue: PresentationInvocationView[];
|
|
2299
|
+
captions: PresentationCaptionView[];
|
|
2300
|
+
cueIntent: PresentationCueIntent[];
|
|
2301
|
+
};
|
|
2302
|
+
type CreatePresentationSequencePlayerOptions = {
|
|
2303
|
+
originFrame?: number;
|
|
2304
|
+
reducedMotion?: boolean;
|
|
2305
|
+
reducedSensory?: boolean;
|
|
2306
|
+
audio?: AudioCueTimeline | HeadlessAudioAdapter;
|
|
2307
|
+
semantic?: SemanticLayerController;
|
|
2308
|
+
visual?: VisualLayerController;
|
|
2309
|
+
sequences?: readonly PresentationSequenceDefinition[];
|
|
2310
|
+
};
|
|
2311
|
+
type PresentationSequencePlayer = {
|
|
2312
|
+
define(input: PresentationSequenceDefinition): DefinePresentationSequenceResult;
|
|
2313
|
+
playSequence(sequenceId: string, options: PlaySequenceOptions): PlaySequenceResult;
|
|
2314
|
+
skip(invocationId?: string): boolean;
|
|
2315
|
+
replay(invocationId?: string): PlaySequenceResult;
|
|
2316
|
+
pause(): boolean;
|
|
2317
|
+
resume(): boolean;
|
|
2318
|
+
cancel(invocationId?: string): boolean;
|
|
2319
|
+
step(frames?: number): PresentationSequenceEvent[];
|
|
2320
|
+
snapshot(): PresentationSequenceSnapshot;
|
|
2321
|
+
restore(input: unknown): RestorePresentationSequenceResult;
|
|
2322
|
+
inspect(): PresentationSequenceInspect;
|
|
2323
|
+
inspectCueIntent(sequenceId: string, options?: {
|
|
2324
|
+
fallbackId?: string;
|
|
2325
|
+
}): PresentationCueIntent[];
|
|
2326
|
+
get(sequenceId: string): PresentationSequenceDefinition | undefined;
|
|
2327
|
+
destroy(): void;
|
|
2328
|
+
readonly frame: number;
|
|
2329
|
+
readonly reducedMotion: boolean;
|
|
2330
|
+
readonly reducedSensory: boolean;
|
|
2331
|
+
};
|
|
2332
|
+
declare function presentationSequenceEventContracts(): EventContract[];
|
|
2333
|
+
declare function definePresentationSequence(input: unknown): DefinePresentationSequenceResult;
|
|
2334
|
+
declare function createPresentationSequencePlayer(options?: CreatePresentationSequencePlayerOptions): PresentationSequencePlayer;
|
|
2335
|
+
|
|
2336
|
+
/**
|
|
2337
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
2338
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
2339
|
+
* See packages/engine/LICENSE
|
|
2340
|
+
*
|
|
2341
|
+
* Declarative projection of host-authoritative state into presentation
|
|
2342
|
+
* resources. The host reducer stays the owner; this module evaluates a
|
|
2343
|
+
* bounded, JSON-serializable binding manifest and applies one coherent
|
|
2344
|
+
* presentation revision (or the declared fail-closed defaults).
|
|
2345
|
+
*/
|
|
2346
|
+
|
|
2347
|
+
declare const PRESENTATION_BINDING_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
2348
|
+
declare const PRESENTATION_BINDING_MANIFEST_VERSION: 1;
|
|
2349
|
+
declare const PRESENTATION_BINDING_APPLIED_EVENT: "presentation.binding.state.applied";
|
|
2350
|
+
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"];
|
|
2351
|
+
type PresentationBindingErrorCode = (typeof PRESENTATION_BINDING_ERROR_CODES)[number];
|
|
2352
|
+
type PresentationBindingDiagnostic = {
|
|
2353
|
+
code: PresentationBindingErrorCode | string;
|
|
2354
|
+
detail: string;
|
|
2355
|
+
path?: string;
|
|
2356
|
+
};
|
|
2357
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
2358
|
+
type JsonObject = {
|
|
2359
|
+
[key: string]: JsonValue;
|
|
2360
|
+
};
|
|
2361
|
+
type JsonValue = JsonPrimitive | JsonValue[] | JsonObject;
|
|
2362
|
+
type PresentationPredicate = {
|
|
2363
|
+
path: string;
|
|
2364
|
+
eq: JsonPrimitive;
|
|
2365
|
+
} | {
|
|
2366
|
+
path: string;
|
|
2367
|
+
neq: JsonPrimitive;
|
|
2368
|
+
} | {
|
|
2369
|
+
path: string;
|
|
2370
|
+
present: boolean;
|
|
2371
|
+
} | {
|
|
2372
|
+
selector: string;
|
|
2373
|
+
} | {
|
|
2374
|
+
all: PresentationPredicate[];
|
|
2375
|
+
} | {
|
|
2376
|
+
any: PresentationPredicate[];
|
|
2377
|
+
} | {
|
|
2378
|
+
not: PresentationPredicate;
|
|
2379
|
+
};
|
|
2380
|
+
type PresentationBindingTarget = {
|
|
2381
|
+
kind: 'visual-layer';
|
|
2382
|
+
layerId: string;
|
|
2383
|
+
version: string;
|
|
2384
|
+
transition?: Extract<VisualLayerTransitionKind, 'show' | 'hide' | 'replace'>;
|
|
2385
|
+
} | {
|
|
2386
|
+
kind: 'presence';
|
|
2387
|
+
entityId: string;
|
|
2388
|
+
present: boolean;
|
|
2389
|
+
regionId?: string;
|
|
2390
|
+
} | {
|
|
2391
|
+
kind: 'prop';
|
|
2392
|
+
propId: string;
|
|
2393
|
+
visible: boolean;
|
|
2394
|
+
layerId?: string;
|
|
2395
|
+
} | {
|
|
2396
|
+
kind: 'semantic-region';
|
|
2397
|
+
regionId: string;
|
|
2398
|
+
state?: Partial<Pick<SemanticRegionState, 'hover' | 'focus' | 'selected'>>;
|
|
2399
|
+
hitTestEnabled?: boolean;
|
|
2400
|
+
} | {
|
|
2401
|
+
kind: 'hotspot';
|
|
2402
|
+
hotspotId: string;
|
|
2403
|
+
enabled: boolean;
|
|
2404
|
+
regionId?: string;
|
|
2405
|
+
} | {
|
|
2406
|
+
kind: 'sequence';
|
|
2407
|
+
sequenceId: string;
|
|
2408
|
+
play?: boolean;
|
|
2409
|
+
} | {
|
|
2410
|
+
kind: 'asset';
|
|
2411
|
+
bindingId: string;
|
|
2412
|
+
assetId: string;
|
|
2413
|
+
};
|
|
2414
|
+
type PresentationBinding = {
|
|
2415
|
+
id: string;
|
|
2416
|
+
priority: number;
|
|
2417
|
+
when: PresentationPredicate;
|
|
2418
|
+
targets: readonly PresentationBindingTarget[];
|
|
2419
|
+
};
|
|
2420
|
+
type PresentationBindingResources = {
|
|
2421
|
+
layers?: readonly string[];
|
|
2422
|
+
versions?: Readonly<Record<string, readonly string[]>>;
|
|
2423
|
+
regions?: readonly string[];
|
|
2424
|
+
sequences?: readonly string[];
|
|
2425
|
+
hotspots?: readonly string[];
|
|
2426
|
+
entities?: readonly string[];
|
|
2427
|
+
props?: readonly string[];
|
|
2428
|
+
assets?: readonly string[];
|
|
2429
|
+
};
|
|
2430
|
+
type PresentationBindingManifest = {
|
|
2431
|
+
id: string;
|
|
2432
|
+
schemaVersion: typeof PRESENTATION_BINDING_MANIFEST_VERSION;
|
|
2433
|
+
bindings: readonly PresentationBinding[];
|
|
2434
|
+
defaults: readonly PresentationBindingTarget[];
|
|
2435
|
+
resources?: PresentationBindingResources;
|
|
2436
|
+
};
|
|
2437
|
+
type DefinePresentationBindingsResult = {
|
|
2438
|
+
ok: true;
|
|
2439
|
+
manifest: PresentationBindingManifest;
|
|
2440
|
+
} | {
|
|
2441
|
+
ok: false;
|
|
2442
|
+
errors: PresentationBindingDiagnostic[];
|
|
2443
|
+
};
|
|
2444
|
+
type PresentationBindingSelector = (projection: JsonObject) => boolean;
|
|
2445
|
+
type PresentationBindingConsidered = {
|
|
2446
|
+
bindingId: string;
|
|
2447
|
+
predicateResult: boolean;
|
|
2448
|
+
detail?: string;
|
|
2449
|
+
};
|
|
2450
|
+
type PresentationBindingRejected = {
|
|
2451
|
+
bindingId: string;
|
|
2452
|
+
targetKey: string;
|
|
2453
|
+
reason: 'lower-priority' | 'predicate-false';
|
|
2454
|
+
};
|
|
2455
|
+
type PresentationBindingFallback = {
|
|
2456
|
+
targetKey: string;
|
|
2457
|
+
reason: 'uncovered-default' | 'missing-state' | 'invalid-projection';
|
|
2458
|
+
};
|
|
2459
|
+
type PresentationBindingExplanation = {
|
|
2460
|
+
considered: PresentationBindingConsidered[];
|
|
2461
|
+
winners: Record<string, {
|
|
2462
|
+
bindingId: string | null;
|
|
2463
|
+
target: PresentationBindingTarget;
|
|
2464
|
+
}>;
|
|
2465
|
+
rejected: PresentationBindingRejected[];
|
|
2466
|
+
fallbacks: PresentationBindingFallback[];
|
|
2467
|
+
fallbackReason: 'missing-state' | 'invalid-projection' | null;
|
|
2468
|
+
};
|
|
2469
|
+
type PresentationBindingEvaluation = {
|
|
2470
|
+
selectedBindingIds: string[];
|
|
2471
|
+
targets: PresentationBindingTarget[];
|
|
2472
|
+
usedFallback: boolean;
|
|
2473
|
+
fallbackReason: 'missing-state' | 'invalid-projection' | null;
|
|
2474
|
+
explanation: PresentationBindingExplanation;
|
|
2475
|
+
};
|
|
2476
|
+
type HostPresentationOverride = {
|
|
2477
|
+
labels?: Record<string, string | Pick<SemanticRegionA11y, 'name' | 'role'>>;
|
|
2478
|
+
reducedSensory?: boolean;
|
|
2479
|
+
reducedMotion?: boolean;
|
|
2480
|
+
};
|
|
2481
|
+
type PresentationBindingInspect = {
|
|
2482
|
+
revision: string | number | null;
|
|
2483
|
+
selectedBindingIds: string[];
|
|
2484
|
+
layers: Record<string, string>;
|
|
2485
|
+
presence: Record<string, boolean>;
|
|
2486
|
+
props: Record<string, boolean>;
|
|
2487
|
+
regions: Record<string, Partial<SemanticRegionState> & {
|
|
2488
|
+
hitTestEnabled?: boolean;
|
|
2489
|
+
}>;
|
|
2490
|
+
hotspots: Record<string, boolean>;
|
|
2491
|
+
sequences: Record<string, 'playing' | 'idle'>;
|
|
2492
|
+
assets: Record<string, string>;
|
|
2493
|
+
override: HostPresentationOverride | null;
|
|
2494
|
+
usedFallback: boolean;
|
|
2495
|
+
fallbackReason: 'missing-state' | 'invalid-projection' | null;
|
|
2496
|
+
explanation: PresentationBindingExplanation | null;
|
|
2497
|
+
};
|
|
2498
|
+
type PresentationBindingSnapshot = {
|
|
2499
|
+
schemaVersion: typeof PRESENTATION_BINDING_SNAPSHOT_SCHEMA_VERSION;
|
|
2500
|
+
manifestId: string;
|
|
2501
|
+
projectionRevision: string | number | null;
|
|
2502
|
+
selectedBindingIds: string[];
|
|
2503
|
+
targets: PresentationBindingTarget[];
|
|
2504
|
+
usedFallback: boolean;
|
|
2505
|
+
fallbackReason: 'missing-state' | 'invalid-projection' | null;
|
|
2506
|
+
override: HostPresentationOverride | null;
|
|
2507
|
+
};
|
|
2508
|
+
type ApplyPresentationBindingsResult = {
|
|
2509
|
+
ok: true;
|
|
2510
|
+
revision: string | number;
|
|
2511
|
+
selectedBindingIds: string[];
|
|
2512
|
+
usedFallback: boolean;
|
|
2513
|
+
fallbackReason: 'missing-state' | 'invalid-projection' | null;
|
|
2514
|
+
explanation: PresentationBindingExplanation;
|
|
2515
|
+
inspect: PresentationBindingInspect;
|
|
2516
|
+
} | {
|
|
2517
|
+
ok: false;
|
|
2518
|
+
errors: PresentationBindingDiagnostic[];
|
|
2519
|
+
inspect: PresentationBindingInspect;
|
|
2520
|
+
};
|
|
2521
|
+
type RestorePresentationBindingsResult = {
|
|
2522
|
+
ok: true;
|
|
2523
|
+
snapshot: PresentationBindingSnapshot;
|
|
2524
|
+
} | {
|
|
2525
|
+
ok: false;
|
|
2526
|
+
errors: PresentationBindingDiagnostic[];
|
|
2527
|
+
};
|
|
2528
|
+
type CreatePresentationBindingRuntimeOptions = {
|
|
2529
|
+
manifest: PresentationBindingManifest | unknown;
|
|
2530
|
+
visual?: VisualLayerController;
|
|
2531
|
+
semantic?: SemanticLayerController;
|
|
2532
|
+
sequences?: PresentationSequencePlayer;
|
|
2533
|
+
selectors?: Readonly<Record<string, PresentationBindingSelector>>;
|
|
2534
|
+
router?: Pick<EventRouter, 'publish'>;
|
|
2535
|
+
onEvent?: (event: EventInput) => void;
|
|
2536
|
+
};
|
|
2537
|
+
type PresentationBindingRuntime = {
|
|
2538
|
+
apply(projection: unknown, options?: {
|
|
2539
|
+
revision?: string | number;
|
|
2540
|
+
}): ApplyPresentationBindingsResult;
|
|
2541
|
+
setOverride(override: HostPresentationOverride | null): void;
|
|
2542
|
+
evaluate(projection: unknown): PresentationBindingEvaluation;
|
|
2543
|
+
inspect(): PresentationBindingInspect;
|
|
2544
|
+
snapshot(): PresentationBindingSnapshot;
|
|
2545
|
+
restore(input: unknown): RestorePresentationBindingsResult;
|
|
2546
|
+
destroy(): void;
|
|
2547
|
+
readonly manifest: PresentationBindingManifest;
|
|
2548
|
+
};
|
|
2549
|
+
declare function presentationBindingEventContracts(): EventContract[];
|
|
2550
|
+
declare function definePresentationBindings(input: unknown): DefinePresentationBindingsResult;
|
|
2551
|
+
declare function evaluatePresentationBindings(manifest: PresentationBindingManifest, projection: unknown, selectors?: Readonly<Record<string, PresentationBindingSelector>>): PresentationBindingEvaluation;
|
|
2552
|
+
declare function createPresentationBindingRuntime(options: CreatePresentationBindingRuntimeOptions): PresentationBindingRuntime;
|
|
2553
|
+
|
|
2554
|
+
/**
|
|
2555
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
2556
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
2557
|
+
* See packages/engine/LICENSE
|
|
2558
|
+
*
|
|
2559
|
+
* Versioned, JSON-serializable capability manifest for a cart/module.
|
|
2560
|
+
* Definition, parse, and host validation all return structured diagnostics
|
|
2561
|
+
* instead of throwing.
|
|
2562
|
+
*/
|
|
2563
|
+
declare const CAPABILITY_MANIFEST_VERSION: 1;
|
|
2564
|
+
declare const CAPABILITY_PHASES: readonly ["loading", "ready", "error", "unsupported"];
|
|
2565
|
+
type CapabilityPhase = (typeof CAPABILITY_PHASES)[number];
|
|
2566
|
+
declare const CAPABILITY_MANAGERS: readonly ["keyboard", "pointer", "audio", "assets", "hostChannel"];
|
|
2567
|
+
type CapabilityManager = (typeof CAPABILITY_MANAGERS)[number];
|
|
2568
|
+
declare const CAPABILITY_ASSET_KINDS: readonly ["image", "audio", "font", "spritesheet"];
|
|
2569
|
+
type CapabilityAssetKind = (typeof CAPABILITY_ASSET_KINDS)[number];
|
|
2570
|
+
declare const CAPABILITY_INTEGRATIONS: readonly ["tone", "midi"];
|
|
2571
|
+
type CapabilityIntegration = (typeof CAPABILITY_INTEGRATIONS)[number];
|
|
2572
|
+
declare const CAPABILITY_BLEND_MODES: readonly ["source-over", "screen"];
|
|
2573
|
+
type CapabilityBlendMode = (typeof CAPABILITY_BLEND_MODES)[number];
|
|
2574
|
+
declare const CAPABILITY_CLEAR_POLICIES: readonly ["transparent", "opaque"];
|
|
2575
|
+
type CapabilityClearPolicy = (typeof CAPABILITY_CLEAR_POLICIES)[number];
|
|
2576
|
+
declare const CAPABILITY_CART_KINDS: readonly ["render", "calculation"];
|
|
2577
|
+
type CapabilityCartKind = (typeof CAPABILITY_CART_KINDS)[number];
|
|
2578
|
+
/** Device/host grants a remote cart may request. Omitted on existing manifests. */
|
|
2579
|
+
declare const CAPABILITY_DEVICE_GRANTS: readonly ["audio", "controller", "network", "persistence", "fullscreen"];
|
|
2580
|
+
type CapabilityDeviceGrant = (typeof CAPABILITY_DEVICE_GRANTS)[number];
|
|
2581
|
+
type CapabilityRuntime = {
|
|
2582
|
+
minContractVersion: number;
|
|
2583
|
+
features: string[];
|
|
2584
|
+
};
|
|
2585
|
+
type CapabilityAssetDeclarationSummary = {
|
|
2586
|
+
id: string;
|
|
2587
|
+
kind: CapabilityAssetKind;
|
|
2588
|
+
};
|
|
2589
|
+
type CapabilityAssetSummary = {
|
|
2590
|
+
kinds: CapabilityAssetKind[];
|
|
2591
|
+
declarations: CapabilityAssetDeclarationSummary[];
|
|
2592
|
+
};
|
|
2593
|
+
type CapabilityPermissions = {
|
|
2594
|
+
emit: string[];
|
|
2595
|
+
subscribe: string[];
|
|
2596
|
+
authoritative?: boolean;
|
|
2597
|
+
};
|
|
2598
|
+
/** Optional surface requirements. Omitted on existing manifests. */
|
|
2599
|
+
type CapabilitySurfaceRequirements = {
|
|
2600
|
+
alpha?: boolean;
|
|
2601
|
+
clearPolicy?: CapabilityClearPolicy;
|
|
2602
|
+
};
|
|
2603
|
+
/** Optional compositor/layer requirements. Omitted on existing manifests. */
|
|
2604
|
+
type CapabilityLayerRequirements = {
|
|
2605
|
+
compositor?: boolean;
|
|
2606
|
+
blend?: CapabilityBlendMode[];
|
|
2607
|
+
};
|
|
2608
|
+
/** Optional executable-module refs. Omitted on existing manifests. */
|
|
2609
|
+
type CapabilityModuleRef = {
|
|
2610
|
+
id: string;
|
|
2611
|
+
version: string;
|
|
2612
|
+
};
|
|
2613
|
+
type CapabilityModuleRequirements = {
|
|
2614
|
+
refs?: CapabilityModuleRef[];
|
|
2615
|
+
};
|
|
2616
|
+
type CapabilityManifest = {
|
|
2617
|
+
version: typeof CAPABILITY_MANIFEST_VERSION;
|
|
2618
|
+
id: string;
|
|
2619
|
+
runtime: CapabilityRuntime;
|
|
2620
|
+
phases: CapabilityPhase[];
|
|
2621
|
+
managers: CapabilityManager[];
|
|
2622
|
+
assets: CapabilityAssetSummary;
|
|
2623
|
+
acceptedEvents: string[];
|
|
2624
|
+
emittedEvents: string[];
|
|
2625
|
+
permissions: CapabilityPermissions;
|
|
2626
|
+
integrations: CapabilityIntegration[];
|
|
2627
|
+
surface?: CapabilitySurfaceRequirements;
|
|
2628
|
+
layers?: CapabilityLayerRequirements;
|
|
2629
|
+
modules?: CapabilityModuleRequirements;
|
|
2630
|
+
/** Omitted means `'render'`. `'calculation'` carts have no surface. */
|
|
2631
|
+
kind?: CapabilityCartKind;
|
|
2632
|
+
/** Optional device grants (CYB-74). Omitted on existing manifests. */
|
|
2633
|
+
grants?: CapabilityDeviceGrant[];
|
|
2634
|
+
};
|
|
2635
|
+
type HostCapabilities = {
|
|
2636
|
+
contractVersion: number;
|
|
2637
|
+
features: string[];
|
|
2638
|
+
integrations: CapabilityIntegration[];
|
|
2639
|
+
managers?: CapabilityManager[];
|
|
2640
|
+
emit?: string[];
|
|
2641
|
+
subscribe?: string[];
|
|
2642
|
+
surface?: CapabilitySurfaceRequirements & {
|
|
2643
|
+
clearPolicy?: CapabilityClearPolicy | CapabilityClearPolicy[];
|
|
2644
|
+
};
|
|
2645
|
+
layers?: CapabilityLayerRequirements;
|
|
2646
|
+
modules?: CapabilityModuleRequirements;
|
|
2647
|
+
/** Cart kinds this host can run. Omitted: kind is not checked. */
|
|
2648
|
+
kinds?: CapabilityCartKind[];
|
|
2649
|
+
/**
|
|
2650
|
+
* Device grants this host is willing to give. Omitted is treated as an
|
|
2651
|
+
* empty set (deny-by-default) when the cart listed `grants`.
|
|
2652
|
+
*/
|
|
2653
|
+
grants?: CapabilityDeviceGrant[];
|
|
2654
|
+
};
|
|
2655
|
+
|
|
2656
|
+
type ExecutableModuleRef = {
|
|
2657
|
+
id: string;
|
|
2658
|
+
version: string;
|
|
2659
|
+
};
|
|
2660
|
+
type ExecutableModuleCapabilities = {
|
|
2661
|
+
readonly [key: string]: unknown;
|
|
2662
|
+
};
|
|
2663
|
+
type ExecutableModuleInvokeContext = {
|
|
2664
|
+
signal: AbortSignal;
|
|
2665
|
+
turn: number;
|
|
2666
|
+
};
|
|
2667
|
+
type ExecutableModuleInstance = {
|
|
2668
|
+
invoke(input: unknown, context: ExecutableModuleInvokeContext): unknown | Promise<unknown>;
|
|
2669
|
+
destroy?: () => void;
|
|
2670
|
+
};
|
|
2671
|
+
type ExecutableModuleFactory = (capabilities: ExecutableModuleCapabilities) => ExecutableModuleInstance;
|
|
2672
|
+
type ExecutableModuleRegistration = {
|
|
2673
|
+
id: string;
|
|
2674
|
+
version: string;
|
|
2675
|
+
create: ExecutableModuleFactory;
|
|
2676
|
+
capabilities?: ExecutableModuleCapabilities;
|
|
2677
|
+
};
|
|
2678
|
+
|
|
2679
|
+
/**
|
|
2680
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
2681
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
2682
|
+
* See packages/engine/LICENSE
|
|
2683
|
+
*
|
|
2684
|
+
* Signed, versioned remote-cart manifests. HMAC signatures, declared-asset
|
|
2685
|
+
* loads, and deny-by-default host grants. Trusted factories only — no eval.
|
|
2686
|
+
*/
|
|
2687
|
+
|
|
2688
|
+
declare const REMOTE_CART_MANIFEST_VERSION: 1;
|
|
2689
|
+
declare const REMOTE_CART_SIGNATURE_ALG: "hmac-sha256";
|
|
2690
|
+
declare const HOST_GRANT_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
2691
|
+
type RemoteCartGrant = CapabilityDeviceGrant;
|
|
2692
|
+
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"];
|
|
2693
|
+
type RemoteCartErrorCode = (typeof REMOTE_CART_ERROR_CODES)[number];
|
|
2694
|
+
type RemoteCartDiagnostic = {
|
|
2695
|
+
code: RemoteCartErrorCode | string;
|
|
2696
|
+
detail: string;
|
|
2697
|
+
path?: string;
|
|
2698
|
+
};
|
|
2699
|
+
type RemoteCartAsset = {
|
|
2700
|
+
id: string;
|
|
2701
|
+
kind: AssetKind;
|
|
2702
|
+
url: string;
|
|
2703
|
+
hash: string;
|
|
2704
|
+
alg: 'sha256';
|
|
2705
|
+
};
|
|
2706
|
+
type RemoteCartManifestBody = {
|
|
2707
|
+
version: typeof REMOTE_CART_MANIFEST_VERSION;
|
|
2708
|
+
id: string;
|
|
2709
|
+
cartVersion: string;
|
|
2710
|
+
publisher: string;
|
|
2711
|
+
assets: RemoteCartAsset[];
|
|
2712
|
+
requestedGrants: RemoteCartGrant[];
|
|
2713
|
+
module?: ExecutableModuleRef;
|
|
2714
|
+
capabilities?: CapabilityManifest;
|
|
2715
|
+
};
|
|
2716
|
+
type RemoteCartSignature = {
|
|
2717
|
+
alg: typeof REMOTE_CART_SIGNATURE_ALG;
|
|
2718
|
+
keyId: string;
|
|
2719
|
+
mac: string;
|
|
2720
|
+
};
|
|
2721
|
+
type SignedRemoteCartManifest = {
|
|
2722
|
+
body: RemoteCartManifestBody;
|
|
2723
|
+
signature: RemoteCartSignature;
|
|
2724
|
+
};
|
|
2725
|
+
type HostGrantSnapshot = {
|
|
2726
|
+
schemaVersion: typeof HOST_GRANT_SNAPSHOT_SCHEMA_VERSION;
|
|
2727
|
+
grants: RemoteCartGrant[];
|
|
2728
|
+
};
|
|
2729
|
+
type HostGrantRestoreResult = {
|
|
2730
|
+
ok: true;
|
|
2731
|
+
grants: RemoteCartGrant[];
|
|
2732
|
+
} | {
|
|
2733
|
+
ok: false;
|
|
2734
|
+
errors: RemoteCartDiagnostic[];
|
|
2735
|
+
};
|
|
2736
|
+
type HostGrantSet = {
|
|
2737
|
+
grant(capability: RemoteCartGrant): HostGrantRestoreResult;
|
|
2738
|
+
revoke(capability: RemoteCartGrant): HostGrantRestoreResult;
|
|
2739
|
+
has(capability: RemoteCartGrant): boolean;
|
|
2740
|
+
list(): RemoteCartGrant[];
|
|
2741
|
+
inspect(): HostGrantSnapshot;
|
|
2742
|
+
restore(input: unknown): HostGrantRestoreResult;
|
|
2743
|
+
};
|
|
2744
|
+
type RemoteCartNetworkApi = {
|
|
2745
|
+
fetch(url: string): Promise<Uint8Array>;
|
|
2746
|
+
};
|
|
2747
|
+
type RemoteCartStorageApi = {
|
|
2748
|
+
getItem(key: string): string | null;
|
|
2749
|
+
setItem(key: string, value: string): void;
|
|
2750
|
+
removeItem(key: string): void;
|
|
2751
|
+
clear(): void;
|
|
2752
|
+
};
|
|
2753
|
+
type RemoteCartDeviceApi = {
|
|
2754
|
+
request(): {
|
|
2755
|
+
ok: true;
|
|
2756
|
+
};
|
|
2757
|
+
};
|
|
2758
|
+
type RemoteCartCapabilityBag = ExecutableModuleCapabilities & {
|
|
2759
|
+
grants: readonly RemoteCartGrant[];
|
|
2760
|
+
network: RemoteCartNetworkApi;
|
|
2761
|
+
storage: RemoteCartStorageApi;
|
|
2762
|
+
audio: RemoteCartDeviceApi;
|
|
2763
|
+
controller: RemoteCartDeviceApi;
|
|
2764
|
+
fullscreen: RemoteCartDeviceApi;
|
|
2765
|
+
};
|
|
2766
|
+
type RemoteCartInspect = {
|
|
2767
|
+
id: string;
|
|
2768
|
+
cartVersion: string;
|
|
2769
|
+
publisher: string;
|
|
2770
|
+
signature: {
|
|
2771
|
+
id: string;
|
|
2772
|
+
alg: string;
|
|
2773
|
+
};
|
|
2774
|
+
requestedGrants: RemoteCartGrant[];
|
|
2775
|
+
grants: RemoteCartGrant[];
|
|
2776
|
+
assets: Array<{
|
|
2777
|
+
id: string;
|
|
2778
|
+
url: string;
|
|
2779
|
+
hash: string;
|
|
2780
|
+
}>;
|
|
2781
|
+
loaded: boolean;
|
|
2782
|
+
destroyed: boolean;
|
|
2783
|
+
diagnostics: RemoteCartDiagnostic[];
|
|
2784
|
+
};
|
|
2785
|
+
type RemoteCartSandbox = {
|
|
2786
|
+
listRequestedGrants(): RemoteCartGrant[];
|
|
2787
|
+
grants: HostGrantSet;
|
|
2788
|
+
loadAssets(): Promise<{
|
|
2789
|
+
ok: true;
|
|
2790
|
+
snapshot: AssetPreloadSnapshot;
|
|
2791
|
+
} | {
|
|
2792
|
+
ok: false;
|
|
2793
|
+
errors: RemoteCartDiagnostic[];
|
|
2794
|
+
}>;
|
|
2795
|
+
capabilities(): RemoteCartCapabilityBag | {
|
|
2796
|
+
ok: false;
|
|
2797
|
+
errors: RemoteCartDiagnostic[];
|
|
2798
|
+
};
|
|
2799
|
+
inspect(): RemoteCartInspect;
|
|
2800
|
+
snapshotProvenance(): SnapshotProvenance;
|
|
2801
|
+
destroy(): void;
|
|
2802
|
+
};
|
|
2803
|
+
type CreateRemoteCartSandboxOptions = {
|
|
2804
|
+
manifest: SignedRemoteCartManifest;
|
|
2805
|
+
/** Host HMAC secrets keyed by `signature.keyId`. Sandbox re-verifies before load. */
|
|
2806
|
+
keys: Readonly<Record<string, string>>;
|
|
2807
|
+
grants?: Iterable<RemoteCartGrant>;
|
|
2808
|
+
bytesByUrl: Readonly<Record<string, Uint8Array>>;
|
|
2809
|
+
modules?: readonly ExecutableModuleRegistration[];
|
|
2810
|
+
};
|
|
2811
|
+
declare function createHostGrantSet(initial?: Iterable<RemoteCartGrant>): HostGrantSet;
|
|
2812
|
+
declare function createRemoteCartSandbox(options: CreateRemoteCartSandboxOptions): RemoteCartSandbox;
|
|
2813
|
+
|
|
2814
|
+
/**
|
|
2815
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
2816
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
2817
|
+
* See packages/engine/LICENSE
|
|
2818
|
+
*
|
|
2819
|
+
* Universal portal/experience lifecycle: enter another cart exclusively,
|
|
2820
|
+
* suspend the parent, transfer host grants, return a versioned outcome.
|
|
2821
|
+
* Cabinet, painting, and other host metaphors are the same primitive.
|
|
2822
|
+
*/
|
|
2823
|
+
|
|
2824
|
+
declare const PORTAL_LIFECYCLE_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
2825
|
+
declare const PORTAL_OUTCOME_SCHEMA_VERSION: 1;
|
|
2826
|
+
declare const PORTAL_METAPHORS: readonly ["cabinet", "painting", "dream", "wormhole", "book", "nested-world"];
|
|
2827
|
+
type PortalMetaphor = (typeof PORTAL_METAPHORS)[number];
|
|
2828
|
+
declare const PORTAL_OUTCOME_KINDS: readonly ["completed", "aborted"];
|
|
2829
|
+
type PortalOutcomeKind = (typeof PORTAL_OUTCOME_KINDS)[number];
|
|
2830
|
+
/** Exclusive device grants transferred for the child's lifetime. */
|
|
2831
|
+
declare const PORTAL_EXCLUSIVE_GRANTS: readonly ["audio", "controller", "fullscreen"];
|
|
2832
|
+
type PortalExclusiveGrant = (typeof PORTAL_EXCLUSIVE_GRANTS)[number];
|
|
2833
|
+
declare const PORTAL_ENTERED_EVENT = "portal.lifecycle.entered";
|
|
2834
|
+
declare const PORTAL_EXITED_EVENT = "portal.lifecycle.exited";
|
|
2835
|
+
declare const PORTAL_ABORTED_EVENT = "portal.lifecycle.aborted";
|
|
2836
|
+
declare const PORTAL_LIFECYCLE_EVENTS: readonly ["portal.lifecycle.entered", "portal.lifecycle.exited", "portal.lifecycle.aborted"];
|
|
2837
|
+
type PortalLifecycleEventType = (typeof PORTAL_LIFECYCLE_EVENTS)[number];
|
|
2838
|
+
type PortalDiagnostic = {
|
|
2839
|
+
code: string;
|
|
2840
|
+
detail: string;
|
|
2841
|
+
path?: string;
|
|
2842
|
+
};
|
|
2843
|
+
type PortalOutcome = {
|
|
2844
|
+
schemaVersion: typeof PORTAL_OUTCOME_SCHEMA_VERSION;
|
|
2845
|
+
kind: PortalOutcomeKind;
|
|
2846
|
+
payload?: unknown;
|
|
2847
|
+
};
|
|
2848
|
+
type PortalCartDeclaration = {
|
|
2849
|
+
id: string;
|
|
2850
|
+
/** Cart ids this cart may enter. */
|
|
2851
|
+
targets: readonly string[];
|
|
2852
|
+
acceptedOutcomeSchemaVersion?: number;
|
|
2853
|
+
emittedOutcomeSchemaVersion?: number;
|
|
2854
|
+
};
|
|
2855
|
+
type PortalEnterRequest = {
|
|
2856
|
+
from: string;
|
|
2857
|
+
to: string;
|
|
2858
|
+
metaphor?: PortalMetaphor;
|
|
2859
|
+
seed?: string;
|
|
2860
|
+
clock?: number;
|
|
2861
|
+
/** Extra grants to give the child (exclusive ones are transferred from parent). */
|
|
2862
|
+
grants?: readonly CapabilityDeviceGrant[];
|
|
2863
|
+
state?: unknown;
|
|
2864
|
+
persistence?: unknown;
|
|
2865
|
+
};
|
|
2866
|
+
type PortalFrameInspect = {
|
|
2867
|
+
id: string;
|
|
2868
|
+
parentId: string;
|
|
2869
|
+
childId: string;
|
|
2870
|
+
metaphor: PortalMetaphor;
|
|
2871
|
+
seed: string | null;
|
|
2872
|
+
clock: number | null;
|
|
2873
|
+
parentState: unknown;
|
|
2874
|
+
parentGrants: CapabilityDeviceGrant[];
|
|
2875
|
+
/** Live child grants after transfer + extras. */
|
|
2876
|
+
childGrants: CapabilityDeviceGrant[];
|
|
2877
|
+
/** Child grants before enter, used to restore and revert extras. */
|
|
2878
|
+
childGrantsBefore: CapabilityDeviceGrant[];
|
|
2879
|
+
extraChildGrants: CapabilityDeviceGrant[];
|
|
2880
|
+
persistence: unknown;
|
|
2881
|
+
transferred: PortalExclusiveGrant[];
|
|
2882
|
+
enterCue: typeof PORTAL_ENTERED_EVENT;
|
|
2883
|
+
exitCue: typeof PORTAL_EXITED_EVENT | typeof PORTAL_ABORTED_EVENT | null;
|
|
2884
|
+
};
|
|
2885
|
+
type PortalLifecycleSnapshot = {
|
|
2886
|
+
schemaVersion: typeof PORTAL_LIFECYCLE_SNAPSHOT_SCHEMA_VERSION;
|
|
2887
|
+
activeId: string | null;
|
|
2888
|
+
stack: PortalFrameInspect[];
|
|
2889
|
+
lastOutcome: PortalOutcome | null;
|
|
2890
|
+
cues: PortalLifecycleEventType[];
|
|
2891
|
+
};
|
|
2892
|
+
type PortalInspect = {
|
|
2893
|
+
destroyed: boolean;
|
|
2894
|
+
activeId: string | null;
|
|
2895
|
+
stack: PortalFrameInspect[];
|
|
2896
|
+
lastOutcome: PortalOutcome | null;
|
|
2897
|
+
cues: PortalLifecycleEventType[];
|
|
2898
|
+
grants: Record<string, CapabilityDeviceGrant[]>;
|
|
2899
|
+
};
|
|
2900
|
+
type PortalMutationResult = {
|
|
2901
|
+
ok: true;
|
|
2902
|
+
inspect: PortalInspect;
|
|
2903
|
+
outcome?: PortalOutcome;
|
|
2904
|
+
} | {
|
|
2905
|
+
ok: false;
|
|
2906
|
+
errors: PortalDiagnostic[];
|
|
2907
|
+
};
|
|
2908
|
+
type RestorePortalResult = {
|
|
2909
|
+
ok: true;
|
|
2910
|
+
snapshot: PortalLifecycleSnapshot;
|
|
2911
|
+
} | {
|
|
2912
|
+
ok: false;
|
|
2913
|
+
errors: PortalDiagnostic[];
|
|
2914
|
+
};
|
|
2915
|
+
type CreatePortalLifecycleOptions = {
|
|
2916
|
+
group?: RuntimeGroup;
|
|
2917
|
+
/** Per-participant grant sets. Missing ids get an empty HostGrantSet. */
|
|
2918
|
+
grants?: Readonly<Record<string, HostGrantSet>>;
|
|
2919
|
+
audioBroker?: AudioBroker;
|
|
2920
|
+
declarations?: readonly PortalCartDeclaration[];
|
|
2921
|
+
rootId?: string;
|
|
2922
|
+
maxDepth?: number;
|
|
2923
|
+
createId?: () => string;
|
|
2924
|
+
};
|
|
2925
|
+
type PortalLifecycle = {
|
|
2926
|
+
enter(request: PortalEnterRequest): PortalMutationResult;
|
|
2927
|
+
exit(payload?: unknown): PortalMutationResult;
|
|
2928
|
+
abort(payload?: unknown): PortalMutationResult;
|
|
2929
|
+
stack(): PortalFrameInspect[];
|
|
2930
|
+
activeId(): string | null;
|
|
2931
|
+
inspect(): PortalInspect;
|
|
2932
|
+
snapshot(): PortalLifecycleSnapshot;
|
|
2933
|
+
restore(input: unknown): RestorePortalResult;
|
|
2934
|
+
grantsOf(participantId: string): HostGrantSet;
|
|
2935
|
+
destroy(): void;
|
|
2936
|
+
};
|
|
2937
|
+
/**
|
|
2938
|
+
* Same `enter` / `exit` / `abort` as the session. Metaphor is fixed so cabinet
|
|
2939
|
+
* and painting hosts share lifecycle code.
|
|
2940
|
+
*/
|
|
2941
|
+
declare function cabinetPortal(portal: PortalLifecycle): {
|
|
2942
|
+
enter: (request: Omit<PortalEnterRequest, 'metaphor'>) => PortalMutationResult;
|
|
2943
|
+
exit: (payload?: unknown) => PortalMutationResult;
|
|
2944
|
+
abort: (payload?: unknown) => PortalMutationResult;
|
|
2945
|
+
};
|
|
2946
|
+
declare function paintingPortal(portal: PortalLifecycle): {
|
|
2947
|
+
enter: (request: Omit<PortalEnterRequest, 'metaphor'>) => PortalMutationResult;
|
|
2948
|
+
exit: (payload?: unknown) => PortalMutationResult;
|
|
2949
|
+
abort: (payload?: unknown) => PortalMutationResult;
|
|
2950
|
+
};
|
|
2951
|
+
declare function createPortalLifecycle(options?: CreatePortalLifecycleOptions): PortalLifecycle;
|
|
2952
|
+
|
|
2953
|
+
/**
|
|
2954
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
2955
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
2956
|
+
* See packages/engine/LICENSE
|
|
2957
|
+
*
|
|
2958
|
+
* Durable asynchronous job orchestration: lifecycle, persistence, worker
|
|
2959
|
+
* boundary, evaluator feedback, and host-owned apply. Wall-clock completion
|
|
2960
|
+
* never mutates authoritative host state.
|
|
2961
|
+
*/
|
|
2962
|
+
|
|
2963
|
+
declare const JOB_ORCHESTRATION_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
2964
|
+
declare const JOB_RESULT_REF_SCHEMA_VERSION: 1;
|
|
2965
|
+
declare const JOB_STATES: readonly ["queued", "claimed", "awaiting-evaluation", "retry-scheduled", "ready", "applied", "failed", "canceled", "superseded"];
|
|
2966
|
+
type JobState = (typeof JOB_STATES)[number];
|
|
2967
|
+
declare const JOB_RETRYABILITY: readonly ["retryable", "permanent", "unknown"];
|
|
2968
|
+
type JobRetryability = (typeof JOB_RETRYABILITY)[number];
|
|
2969
|
+
declare const JOB_EVALUATOR_DECISIONS: readonly ["accept", "reject", "revise"];
|
|
2970
|
+
type JobEvaluatorDecision = (typeof JOB_EVALUATOR_DECISIONS)[number];
|
|
2971
|
+
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"];
|
|
2972
|
+
type JobLifecycleEventType = (typeof JOB_LIFECYCLE_EVENTS)[number];
|
|
2973
|
+
type JobDiagnostic = {
|
|
2974
|
+
code: string;
|
|
2975
|
+
detail: string;
|
|
2976
|
+
path?: string;
|
|
2977
|
+
};
|
|
2978
|
+
type JobResultRef = {
|
|
2979
|
+
schemaVersion: typeof JOB_RESULT_REF_SCHEMA_VERSION;
|
|
2980
|
+
kind: string;
|
|
2981
|
+
uri: string;
|
|
2982
|
+
contentType?: string;
|
|
2983
|
+
bytes?: number;
|
|
2984
|
+
};
|
|
2985
|
+
type JobRetryPolicy = {
|
|
2986
|
+
maxAttempts: number;
|
|
2987
|
+
backoffMs: readonly number[];
|
|
2988
|
+
retryableCodes: readonly string[];
|
|
2989
|
+
};
|
|
2990
|
+
type JobFallback = {
|
|
2991
|
+
reasonCode: string;
|
|
2992
|
+
resultRef?: JobResultRef;
|
|
2993
|
+
};
|
|
2994
|
+
type JobDefinition = {
|
|
2995
|
+
id: string;
|
|
2996
|
+
version: number;
|
|
2997
|
+
requestSchema: PayloadSchema;
|
|
2998
|
+
resultKind: string;
|
|
2999
|
+
retry: JobRetryPolicy;
|
|
3000
|
+
timeoutMs: number;
|
|
3001
|
+
leaseMs: number;
|
|
3002
|
+
fallback: JobFallback;
|
|
3003
|
+
};
|
|
3004
|
+
type JobProgress = {
|
|
3005
|
+
value: number;
|
|
3006
|
+
stage: string;
|
|
3007
|
+
message?: string;
|
|
3008
|
+
};
|
|
3009
|
+
type JobFailureRecord = {
|
|
3010
|
+
attempt: number;
|
|
3011
|
+
code: string;
|
|
3012
|
+
retryability: JobRetryability;
|
|
3013
|
+
at: number;
|
|
3014
|
+
detail?: string;
|
|
3015
|
+
};
|
|
3016
|
+
type JobEvaluatorRecord = {
|
|
3017
|
+
decision: JobEvaluatorDecision;
|
|
3018
|
+
at: number;
|
|
3019
|
+
correction?: string;
|
|
3020
|
+
};
|
|
3021
|
+
type JobRecord = {
|
|
3022
|
+
jobId: string;
|
|
3023
|
+
definitionId: string;
|
|
3024
|
+
definitionVersion: number;
|
|
3025
|
+
idempotencyKey: string;
|
|
3026
|
+
state: JobState;
|
|
3027
|
+
request: unknown;
|
|
3028
|
+
resultRef: JobResultRef | null;
|
|
3029
|
+
progress: JobProgress;
|
|
3030
|
+
attempt: number;
|
|
3031
|
+
failureHistory: JobFailureRecord[];
|
|
3032
|
+
evaluatorHistory: JobEvaluatorRecord[];
|
|
3033
|
+
correlationId: string;
|
|
3034
|
+
causationId?: string;
|
|
3035
|
+
workerId: string | null;
|
|
3036
|
+
leaseUntil: number | null;
|
|
3037
|
+
createdAt: number;
|
|
3038
|
+
updatedAt: number;
|
|
3039
|
+
timeoutAt: number;
|
|
3040
|
+
nextRetryAt: number | null;
|
|
3041
|
+
supersededBy: string | null;
|
|
3042
|
+
fallbackApplied: boolean;
|
|
3043
|
+
fallback?: JobFallback;
|
|
3044
|
+
};
|
|
3045
|
+
type JobCoordinatorSnapshot = {
|
|
3046
|
+
schemaVersion: typeof JOB_ORCHESTRATION_SNAPSHOT_SCHEMA_VERSION;
|
|
3047
|
+
jobs: JobRecord[];
|
|
3048
|
+
hostAcceptedJobIds: string[];
|
|
3049
|
+
};
|
|
3050
|
+
type JobInspect = {
|
|
3051
|
+
destroyed: boolean;
|
|
3052
|
+
jobs: JobRecord[];
|
|
3053
|
+
events: JobLifecycleEventType[];
|
|
3054
|
+
};
|
|
3055
|
+
type JobMutationResult = {
|
|
3056
|
+
ok: true;
|
|
3057
|
+
job: JobRecord;
|
|
3058
|
+
} | {
|
|
3059
|
+
ok: false;
|
|
3060
|
+
errors: JobDiagnostic[];
|
|
3061
|
+
};
|
|
3062
|
+
type RestoreJobResult = {
|
|
3063
|
+
ok: true;
|
|
3064
|
+
snapshot: JobCoordinatorSnapshot;
|
|
3065
|
+
} | {
|
|
3066
|
+
ok: false;
|
|
3067
|
+
errors: JobDiagnostic[];
|
|
3068
|
+
};
|
|
3069
|
+
type JobSubmitRequest = {
|
|
3070
|
+
definitionId: string;
|
|
3071
|
+
idempotencyKey: string;
|
|
3072
|
+
request: unknown;
|
|
3073
|
+
correlationId: string;
|
|
3074
|
+
causationId?: string;
|
|
3075
|
+
supersedeJobId?: string;
|
|
3076
|
+
};
|
|
3077
|
+
type JobPersistenceAdapter = {
|
|
3078
|
+
save(job: JobRecord): void;
|
|
3079
|
+
get(jobId: string): JobRecord | undefined;
|
|
3080
|
+
getByIdempotencyKey(key: string): JobRecord | undefined;
|
|
3081
|
+
list(): JobRecord[];
|
|
3082
|
+
replaceAll(jobs: JobRecord[]): void;
|
|
3083
|
+
};
|
|
3084
|
+
type JobWorkRequest = {
|
|
3085
|
+
jobId: string;
|
|
3086
|
+
workerId: string;
|
|
3087
|
+
definitionId: string;
|
|
3088
|
+
request: unknown;
|
|
3089
|
+
attempt: number;
|
|
3090
|
+
};
|
|
3091
|
+
type JobWorkerCallbacks = {
|
|
3092
|
+
reportProgress(jobId: string, progress: JobProgress): JobMutationResult;
|
|
3093
|
+
complete(jobId: string, resultRef: JobResultRef): JobMutationResult;
|
|
3094
|
+
fail(jobId: string, failure: {
|
|
3095
|
+
code: string;
|
|
3096
|
+
retryability: JobRetryability;
|
|
3097
|
+
detail?: string;
|
|
3098
|
+
}): JobMutationResult;
|
|
3099
|
+
heartbeat(jobId: string): JobMutationResult;
|
|
3100
|
+
};
|
|
3101
|
+
type JobWorkerAdapter = {
|
|
3102
|
+
bind(callbacks: JobWorkerCallbacks): void;
|
|
3103
|
+
start(work: JobWorkRequest): void;
|
|
3104
|
+
cancel?(jobId: string): void;
|
|
3105
|
+
};
|
|
3106
|
+
type HeadlessJobWorker = JobWorkerAdapter & {
|
|
3107
|
+
complete(jobId: string, resultRef: JobResultRef): JobMutationResult;
|
|
3108
|
+
fail(jobId: string, failure: {
|
|
3109
|
+
code: string;
|
|
3110
|
+
retryability: JobRetryability;
|
|
3111
|
+
detail?: string;
|
|
3112
|
+
}): JobMutationResult;
|
|
3113
|
+
started(): string[];
|
|
3114
|
+
};
|
|
3115
|
+
type CreateJobCoordinatorOptions = {
|
|
3116
|
+
definitions: readonly JobDefinition[];
|
|
3117
|
+
persistence?: JobPersistenceAdapter;
|
|
3118
|
+
worker?: JobWorkerAdapter;
|
|
3119
|
+
router?: Pick<EventRouter, 'publish'>;
|
|
3120
|
+
now?: () => number;
|
|
3121
|
+
createId?: () => string;
|
|
3122
|
+
maxCorrectionChars?: number;
|
|
3123
|
+
maxFailureHistory?: number;
|
|
3124
|
+
};
|
|
3125
|
+
type JobCoordinator = {
|
|
3126
|
+
submit(request: JobSubmitRequest): JobMutationResult;
|
|
3127
|
+
claim(workerId: string): JobMutationResult;
|
|
3128
|
+
reportProgress(jobId: string, progress: JobProgress): JobMutationResult;
|
|
3129
|
+
heartbeat(jobId: string): JobMutationResult;
|
|
3130
|
+
complete(jobId: string, resultRef: JobResultRef): JobMutationResult;
|
|
3131
|
+
fail(jobId: string, failure: {
|
|
3132
|
+
code: string;
|
|
3133
|
+
retryability: JobRetryability;
|
|
3134
|
+
detail?: string;
|
|
3135
|
+
}): JobMutationResult;
|
|
3136
|
+
evaluate(jobId: string, decision: JobEvaluatorDecision, correction?: string): JobMutationResult;
|
|
3137
|
+
cancel(jobId: string): JobMutationResult;
|
|
3138
|
+
recoverStale(): JobRecord[];
|
|
3139
|
+
tick(): JobRecord[];
|
|
3140
|
+
/** Host policy gate. Ready jobs become applied; never called from worker complete. */
|
|
3141
|
+
accept(jobId: string): JobMutationResult;
|
|
3142
|
+
get(jobId: string): JobRecord | undefined;
|
|
3143
|
+
getByIdempotencyKey(key: string): JobRecord | undefined;
|
|
3144
|
+
inspect(): JobInspect;
|
|
3145
|
+
snapshot(): JobCoordinatorSnapshot;
|
|
3146
|
+
restore(input: unknown): RestoreJobResult;
|
|
3147
|
+
exportTrace(): {
|
|
3148
|
+
jobs: unknown[];
|
|
3149
|
+
events: JobLifecycleEventType[];
|
|
3150
|
+
};
|
|
3151
|
+
destroy(): void;
|
|
3152
|
+
};
|
|
3153
|
+
declare function jobEventContracts(): EventContract[];
|
|
3154
|
+
declare function createMemoryJobPersistence(): JobPersistenceAdapter;
|
|
3155
|
+
declare function createHeadlessJobWorker(): HeadlessJobWorker;
|
|
3156
|
+
declare function createJobCoordinator(options: CreateJobCoordinatorOptions): JobCoordinator;
|
|
3157
|
+
|
|
3158
|
+
/**
|
|
3159
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
3160
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
3161
|
+
* See packages/engine/LICENSE
|
|
3162
|
+
*
|
|
3163
|
+
* Step-by-step snapshot migrations. The original object is never mutated.
|
|
3164
|
+
* Hosts own persistence; this registry only transforms envelopes in memory.
|
|
3165
|
+
*/
|
|
3166
|
+
|
|
3167
|
+
type SnapshotMigration = {
|
|
3168
|
+
from: number;
|
|
3169
|
+
to: number;
|
|
3170
|
+
migrate: (snapshot: unknown) => unknown;
|
|
3171
|
+
};
|
|
3172
|
+
|
|
3173
|
+
/**
|
|
3174
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
3175
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
3176
|
+
* See packages/engine/LICENSE
|
|
3177
|
+
*
|
|
3178
|
+
* Optional spatial world graph: nodes, edges, discovery projections, entity
|
|
3179
|
+
* transit, and host-owned path policy. Semantic time and story rules stay
|
|
3180
|
+
* with the host. No economy, combat, quest, or narrative.
|
|
3181
|
+
*/
|
|
3182
|
+
|
|
3183
|
+
declare const WORLD_GRAPH_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
3184
|
+
declare const WORLD_NODE_KINDS: readonly ["room", "region", "landmark", "frontier"];
|
|
3185
|
+
type WorldNodeKind = (typeof WORLD_NODE_KINDS)[number];
|
|
3186
|
+
declare const WORLD_MAP_LAYERS: readonly ["local", "regional"];
|
|
3187
|
+
type WorldMapLayer = (typeof WORLD_MAP_LAYERS)[number];
|
|
3188
|
+
declare const WORLD_EDGE_VISIBILITIES: readonly ["canonical", "discoverable", "hidden"];
|
|
3189
|
+
type WorldEdgeVisibility = (typeof WORLD_EDGE_VISIBILITIES)[number];
|
|
3190
|
+
declare const WORLD_EDGE_ACCESS: readonly ["open", "locked", "disabled"];
|
|
3191
|
+
type WorldEdgeAccess = (typeof WORLD_EDGE_ACCESS)[number];
|
|
3192
|
+
declare const WORLD_ENTITY_KINDS: readonly ["character", "party"];
|
|
3193
|
+
type WorldEntityKind = (typeof WORLD_ENTITY_KINDS)[number];
|
|
3194
|
+
declare const WORLD_ENTITY_STATUSES: readonly ["available", "busy", "traveling"];
|
|
3195
|
+
type WorldEntityStatus = (typeof WORLD_ENTITY_STATUSES)[number];
|
|
3196
|
+
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"];
|
|
3197
|
+
type WorldGraphEventType = (typeof WORLD_GRAPH_EVENTS)[number];
|
|
3198
|
+
type WorldGraphDiagnostic = {
|
|
3199
|
+
code: string;
|
|
3200
|
+
detail: string;
|
|
3201
|
+
path?: string;
|
|
3202
|
+
};
|
|
3203
|
+
type WorldNode = {
|
|
3204
|
+
id: string;
|
|
3205
|
+
version: number;
|
|
3206
|
+
kind: WorldNodeKind;
|
|
3207
|
+
mapLayer: WorldMapLayer;
|
|
3208
|
+
frontier?: boolean;
|
|
3209
|
+
metadata?: Record<string, unknown>;
|
|
3210
|
+
};
|
|
3211
|
+
type WorldEdge = {
|
|
3212
|
+
id: string;
|
|
3213
|
+
version: number;
|
|
3214
|
+
from: string;
|
|
3215
|
+
to: string;
|
|
3216
|
+
directed: boolean;
|
|
3217
|
+
kind: string;
|
|
3218
|
+
visibility: WorldEdgeVisibility;
|
|
3219
|
+
access: WorldEdgeAccess;
|
|
3220
|
+
requirements?: Record<string, unknown>;
|
|
3221
|
+
cost?: Record<string, number>;
|
|
3222
|
+
metadata?: Record<string, unknown>;
|
|
3223
|
+
};
|
|
3224
|
+
type WorldTransit = {
|
|
3225
|
+
originNodeId: string;
|
|
3226
|
+
destinationNodeId: string;
|
|
3227
|
+
routeEdgeIds: readonly string[];
|
|
3228
|
+
departedAt: number;
|
|
3229
|
+
expectedArrival: number;
|
|
3230
|
+
};
|
|
3231
|
+
type WorldEntity = {
|
|
3232
|
+
id: string;
|
|
3233
|
+
kind: WorldEntityKind;
|
|
3234
|
+
status: WorldEntityStatus;
|
|
3235
|
+
locationNodeId: string | null;
|
|
3236
|
+
transit: WorldTransit | null;
|
|
3237
|
+
metadata?: Record<string, unknown>;
|
|
3238
|
+
};
|
|
3239
|
+
type WorldObserverDiscovery = {
|
|
3240
|
+
observerId: string;
|
|
3241
|
+
nodeIds: readonly string[];
|
|
3242
|
+
edgeIds: readonly string[];
|
|
3243
|
+
};
|
|
3244
|
+
type WorldGraphSnapshot = {
|
|
3245
|
+
schemaVersion: typeof WORLD_GRAPH_SNAPSHOT_SCHEMA_VERSION;
|
|
3246
|
+
graphId: string;
|
|
3247
|
+
nodes: WorldNode[];
|
|
3248
|
+
edges: WorldEdge[];
|
|
3249
|
+
entities: WorldEntity[];
|
|
3250
|
+
discovery: WorldObserverDiscovery[];
|
|
3251
|
+
};
|
|
3252
|
+
type WorldGraphProjection = {
|
|
3253
|
+
kind: 'canonical' | 'known' | 'local' | 'regional';
|
|
3254
|
+
observerId?: string;
|
|
3255
|
+
focusNodeId?: string;
|
|
3256
|
+
nodes: WorldNode[];
|
|
3257
|
+
edges: WorldEdge[];
|
|
3258
|
+
frontiers: WorldNode[];
|
|
3259
|
+
entities: WorldEntity[];
|
|
3260
|
+
};
|
|
3261
|
+
type WorldPathStep = {
|
|
3262
|
+
edgeId: string;
|
|
3263
|
+
from: string;
|
|
3264
|
+
to: string;
|
|
3265
|
+
cost: number;
|
|
3266
|
+
};
|
|
3267
|
+
type WorldPath = {
|
|
3268
|
+
from: string;
|
|
3269
|
+
to: string;
|
|
3270
|
+
nodeIds: string[];
|
|
3271
|
+
steps: WorldPathStep[];
|
|
3272
|
+
totalCost: number;
|
|
3273
|
+
};
|
|
3274
|
+
type WorldTraversalContext = {
|
|
3275
|
+
semanticTime: number;
|
|
3276
|
+
observerId?: string;
|
|
3277
|
+
hostState?: unknown;
|
|
3278
|
+
};
|
|
3279
|
+
type WorldTraversalPolicy = {
|
|
3280
|
+
canTraverse(edge: WorldEdge, from: string, to: string, ctx: WorldTraversalContext): boolean;
|
|
3281
|
+
cost(edge: WorldEdge, from: string, to: string, ctx: WorldTraversalContext): number;
|
|
3282
|
+
};
|
|
3283
|
+
type WorldQueryBounds = {
|
|
3284
|
+
maxVisits?: number;
|
|
3285
|
+
};
|
|
3286
|
+
type WorldGraphInspect = {
|
|
3287
|
+
destroyed: boolean;
|
|
3288
|
+
graphId: string;
|
|
3289
|
+
nodeCount: number;
|
|
3290
|
+
edgeCount: number;
|
|
3291
|
+
entityCount: number;
|
|
3292
|
+
observerCount: number;
|
|
3293
|
+
events: WorldGraphEventType[];
|
|
3294
|
+
};
|
|
3295
|
+
type WorldMutationResult = {
|
|
3296
|
+
ok: true;
|
|
3297
|
+
} | {
|
|
3298
|
+
ok: false;
|
|
3299
|
+
errors: WorldGraphDiagnostic[];
|
|
3300
|
+
};
|
|
3301
|
+
type RestoreWorldGraphResult = {
|
|
3302
|
+
ok: true;
|
|
3303
|
+
snapshot: WorldGraphSnapshot;
|
|
3304
|
+
} | {
|
|
3305
|
+
ok: false;
|
|
3306
|
+
errors: WorldGraphDiagnostic[];
|
|
3307
|
+
};
|
|
3308
|
+
type WorldPathResult = {
|
|
3309
|
+
ok: true;
|
|
3310
|
+
path: WorldPath;
|
|
3311
|
+
} | {
|
|
3312
|
+
ok: false;
|
|
3313
|
+
errors: WorldGraphDiagnostic[];
|
|
3314
|
+
};
|
|
3315
|
+
type WorldReachabilityResult = {
|
|
3316
|
+
nodeIds: string[];
|
|
3317
|
+
};
|
|
3318
|
+
type WorldGraphPatch = {
|
|
3319
|
+
nodes?: readonly WorldNode[];
|
|
3320
|
+
edges?: readonly WorldEdge[];
|
|
3321
|
+
};
|
|
3322
|
+
type CreateWorldGraphOptions = {
|
|
3323
|
+
graphId?: string;
|
|
3324
|
+
migrations?: readonly SnapshotMigration[];
|
|
3325
|
+
router?: Pick<EventRouter, 'publish'>;
|
|
3326
|
+
source?: string;
|
|
3327
|
+
maxPathVisits?: number;
|
|
3328
|
+
};
|
|
3329
|
+
type WorldGraph = {
|
|
3330
|
+
addNode(node: WorldNode): WorldMutationResult;
|
|
3331
|
+
addEdge(edge: WorldEdge): WorldMutationResult;
|
|
3332
|
+
applyPatch(patch: WorldGraphPatch): WorldMutationResult;
|
|
3333
|
+
removeNode(nodeId: string): WorldMutationResult;
|
|
3334
|
+
removeEdge(edgeId: string): WorldMutationResult;
|
|
3335
|
+
setEdgeAccess(edgeId: string, access: WorldEdgeAccess): WorldMutationResult;
|
|
3336
|
+
discover(observerId: string, known: {
|
|
3337
|
+
nodeIds?: readonly string[];
|
|
3338
|
+
edgeIds?: readonly string[];
|
|
3339
|
+
}): WorldMutationResult;
|
|
3340
|
+
upsertEntity(entity: WorldEntity): WorldMutationResult;
|
|
3341
|
+
startTransit(entityId: string, transit: WorldTransit, status?: Exclude<WorldEntityStatus, 'available'>): WorldMutationResult;
|
|
3342
|
+
completeTransit(entityId: string, semanticTime: number): WorldMutationResult;
|
|
3343
|
+
setEntityStatus(entityId: string, status: WorldEntityStatus): WorldMutationResult;
|
|
3344
|
+
getNode(nodeId: string): WorldNode | undefined;
|
|
3345
|
+
getEdge(edgeId: string): WorldEdge | undefined;
|
|
3346
|
+
getEntity(entityId: string): WorldEntity | undefined;
|
|
3347
|
+
projectCanonical(): WorldGraphProjection;
|
|
3348
|
+
projectKnown(observerId: string): WorldGraphProjection;
|
|
3349
|
+
projectLocal(observerId: string, focusNodeId: string, hops?: number): WorldGraphProjection;
|
|
3350
|
+
projectRegional(observerId: string): WorldGraphProjection;
|
|
3351
|
+
findPath(from: string, to: string, policy: WorldTraversalPolicy, ctx: WorldTraversalContext, bounds?: WorldQueryBounds): WorldPathResult;
|
|
3352
|
+
reachable(from: string, policy: WorldTraversalPolicy, ctx: WorldTraversalContext, bounds?: WorldQueryBounds): WorldReachabilityResult;
|
|
3353
|
+
inspect(): WorldGraphInspect;
|
|
3354
|
+
snapshot(): WorldGraphSnapshot;
|
|
3355
|
+
restore(input: unknown): RestoreWorldGraphResult;
|
|
3356
|
+
events(): readonly EventInput[];
|
|
3357
|
+
destroy(): void;
|
|
3358
|
+
};
|
|
3359
|
+
declare function worldGraphEventContracts(): EventContract[];
|
|
3360
|
+
declare function createWorldGraph(options?: CreateWorldGraphOptions): WorldGraph;
|
|
3361
|
+
|
|
3362
|
+
/**
|
|
3363
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
3364
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
3365
|
+
* See packages/engine/LICENSE
|
|
3366
|
+
*
|
|
3367
|
+
* Transactional world-patch validation and atomic application. A generated
|
|
3368
|
+
* result becomes one world revision or none — never a half-installed world.
|
|
3369
|
+
* Cyberart is not the host's database of record.
|
|
3370
|
+
*/
|
|
3371
|
+
|
|
3372
|
+
declare const WORLD_PATCH_SCHEMA_VERSION: 1;
|
|
3373
|
+
declare const WORLD_PATCH_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
3374
|
+
declare const WORLD_PATCH_OPS: readonly ["add", "replace", "revise", "remove", "tombstone", "link", "unlink"];
|
|
3375
|
+
type WorldPatchOp = (typeof WORLD_PATCH_OPS)[number];
|
|
3376
|
+
declare const WORLD_PATCH_ACCEPTED_EVENT: "world.patch.state.accepted";
|
|
3377
|
+
declare const WORLD_PATCH_EVENTS: readonly ["world.patch.state.accepted", "world.patch.state.rejected", "world.patch.state.superseded", "world.patch.diagnostic.lifecycle"];
|
|
3378
|
+
type WorldPatchEventType = (typeof WORLD_PATCH_EVENTS)[number];
|
|
3379
|
+
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"];
|
|
3380
|
+
type WorldPatchErrorCode = (typeof WORLD_PATCH_ERROR_CODES)[number];
|
|
3381
|
+
type WorldPatchDiagnostic = {
|
|
3382
|
+
code: WorldPatchErrorCode | string;
|
|
3383
|
+
detail: string;
|
|
3384
|
+
path?: string;
|
|
3385
|
+
expectedRevision?: number;
|
|
3386
|
+
actualRevision?: number;
|
|
3387
|
+
};
|
|
3388
|
+
type WorldPatchProvenance = {
|
|
3389
|
+
producer: string;
|
|
3390
|
+
jobId?: string;
|
|
3391
|
+
contentRevisions?: string[];
|
|
3392
|
+
};
|
|
3393
|
+
type WorldPatchRefs = {
|
|
3394
|
+
contentId?: string;
|
|
3395
|
+
contentRevision?: string;
|
|
3396
|
+
binding?: string;
|
|
3397
|
+
asset?: string;
|
|
3398
|
+
identity?: string;
|
|
3399
|
+
};
|
|
3400
|
+
type WorldPatchOperation = {
|
|
3401
|
+
op: WorldPatchOp;
|
|
3402
|
+
kind: string;
|
|
3403
|
+
id: string;
|
|
3404
|
+
order?: number;
|
|
3405
|
+
value?: unknown;
|
|
3406
|
+
from?: string;
|
|
3407
|
+
to?: string;
|
|
3408
|
+
refs?: WorldPatchRefs;
|
|
3409
|
+
};
|
|
3410
|
+
type WorldPatchPrecondition = {
|
|
3411
|
+
type: 'base-revision';
|
|
3412
|
+
revision: number;
|
|
3413
|
+
} | {
|
|
3414
|
+
type: 'entity-revision';
|
|
3415
|
+
kind: string;
|
|
3416
|
+
id: string;
|
|
3417
|
+
revision: number;
|
|
3418
|
+
} | {
|
|
3419
|
+
type: 'entity-hash';
|
|
3420
|
+
kind: string;
|
|
3421
|
+
id: string;
|
|
3422
|
+
hash: string;
|
|
3423
|
+
} | {
|
|
3424
|
+
type: 'identity-required';
|
|
3425
|
+
kind: string;
|
|
3426
|
+
id: string;
|
|
3427
|
+
} | {
|
|
3428
|
+
type: 'identity-absent';
|
|
3429
|
+
kind: string;
|
|
3430
|
+
id: string;
|
|
3431
|
+
} | {
|
|
3432
|
+
type: 'capability';
|
|
3433
|
+
name: string;
|
|
3434
|
+
} | {
|
|
3435
|
+
type: 'schema';
|
|
3436
|
+
schemaVersion: number;
|
|
3437
|
+
};
|
|
3438
|
+
type WorldPatch = {
|
|
3439
|
+
patchId: string;
|
|
3440
|
+
schemaVersion: typeof WORLD_PATCH_SCHEMA_VERSION;
|
|
3441
|
+
baseRevision: number;
|
|
3442
|
+
idempotencyKey: string;
|
|
3443
|
+
preconditions?: WorldPatchPrecondition[];
|
|
3444
|
+
operations: WorldPatchOperation[];
|
|
3445
|
+
provenance: WorldPatchProvenance;
|
|
3446
|
+
supersedes?: string;
|
|
3447
|
+
};
|
|
3448
|
+
type WorldEntityRecord = {
|
|
3449
|
+
kind: string;
|
|
3450
|
+
id: string;
|
|
3451
|
+
revision: number;
|
|
3452
|
+
hash: string;
|
|
3453
|
+
value: unknown;
|
|
3454
|
+
tombstoned: boolean;
|
|
3455
|
+
refs?: WorldPatchRefs;
|
|
3456
|
+
};
|
|
3457
|
+
type WorldLinkRecord = {
|
|
3458
|
+
id: string;
|
|
3459
|
+
kind: string;
|
|
3460
|
+
from: string;
|
|
3461
|
+
to: string;
|
|
3462
|
+
value?: unknown;
|
|
3463
|
+
};
|
|
3464
|
+
type WorldAcceptedPatch = {
|
|
3465
|
+
patchId: string;
|
|
3466
|
+
idempotencyKey: string;
|
|
3467
|
+
revision: number;
|
|
3468
|
+
provenance: WorldPatchProvenance;
|
|
3469
|
+
supersededBy?: string;
|
|
3470
|
+
};
|
|
3471
|
+
type WorldRevisionState = {
|
|
3472
|
+
revision: number;
|
|
3473
|
+
entities: WorldEntityRecord[];
|
|
3474
|
+
links: WorldLinkRecord[];
|
|
3475
|
+
accepted: WorldAcceptedPatch[];
|
|
3476
|
+
};
|
|
3477
|
+
type WorldIdentityChange = {
|
|
3478
|
+
op: WorldPatchOp;
|
|
3479
|
+
kind: string;
|
|
3480
|
+
id: string;
|
|
3481
|
+
};
|
|
3482
|
+
type WorldPatchAuditRecord = {
|
|
3483
|
+
outcome: 'accepted' | 'rejected' | 'superseded';
|
|
3484
|
+
patchId: string;
|
|
3485
|
+
idempotencyKey: string;
|
|
3486
|
+
at: number;
|
|
3487
|
+
oldRevision: number;
|
|
3488
|
+
newRevision: number;
|
|
3489
|
+
reasonCodes: string[];
|
|
3490
|
+
changedIdentities: WorldIdentityChange[];
|
|
3491
|
+
provenance: WorldPatchProvenance | Record<string, unknown>;
|
|
3492
|
+
patch: unknown;
|
|
3493
|
+
};
|
|
3494
|
+
type WorldPatchSnapshot = {
|
|
3495
|
+
schemaVersion: typeof WORLD_PATCH_SNAPSHOT_SCHEMA_VERSION;
|
|
3496
|
+
world: WorldRevisionState;
|
|
3497
|
+
audit: WorldPatchAuditRecord[];
|
|
3498
|
+
graph?: WorldGraphSnapshot;
|
|
3499
|
+
};
|
|
3500
|
+
type WorldPatchInspect = {
|
|
3501
|
+
destroyed: boolean;
|
|
3502
|
+
revision: number;
|
|
3503
|
+
entities: WorldEntityRecord[];
|
|
3504
|
+
links: WorldLinkRecord[];
|
|
3505
|
+
acceptedPatchIds: string[];
|
|
3506
|
+
events: WorldPatchEventType[];
|
|
3507
|
+
lastRejection: WorldPatchDiagnostic[] | null;
|
|
3508
|
+
};
|
|
3509
|
+
type WorldPatchDryRunResult = {
|
|
3510
|
+
ok: true;
|
|
3511
|
+
previewRevision: number;
|
|
3512
|
+
changedIdentities: WorldIdentityChange[];
|
|
3513
|
+
diagnostics: WorldPatchDiagnostic[];
|
|
3514
|
+
} | {
|
|
3515
|
+
ok: false;
|
|
3516
|
+
errors: WorldPatchDiagnostic[];
|
|
3517
|
+
};
|
|
3518
|
+
type WorldPatchCommitResult = {
|
|
3519
|
+
ok: true;
|
|
3520
|
+
patchId: string;
|
|
3521
|
+
oldRevision: number;
|
|
3522
|
+
newRevision: number;
|
|
3523
|
+
changedIdentities: WorldIdentityChange[];
|
|
3524
|
+
idempotent?: boolean;
|
|
3525
|
+
inspect: WorldPatchInspect;
|
|
3526
|
+
} | {
|
|
3527
|
+
ok: false;
|
|
3528
|
+
errors: WorldPatchDiagnostic[];
|
|
3529
|
+
inspect: WorldPatchInspect;
|
|
3530
|
+
};
|
|
3531
|
+
type RestoreWorldPatchResult = {
|
|
3532
|
+
ok: true;
|
|
3533
|
+
snapshot: WorldPatchSnapshot;
|
|
3534
|
+
} | {
|
|
3535
|
+
ok: false;
|
|
3536
|
+
errors: WorldPatchDiagnostic[];
|
|
3537
|
+
};
|
|
3538
|
+
type WorldPersistenceTransaction = {
|
|
3539
|
+
applyWorldRevision(next: WorldRevisionState): void;
|
|
3540
|
+
commit(): void;
|
|
3541
|
+
rollback(): void;
|
|
3542
|
+
};
|
|
3543
|
+
type WorldPatchAcceptedPayload = {
|
|
3544
|
+
patchId: string;
|
|
3545
|
+
oldRevision: number;
|
|
3546
|
+
newRevision: number;
|
|
3547
|
+
changedIdentities: WorldIdentityChange[];
|
|
3548
|
+
producer: string;
|
|
3549
|
+
jobId?: string;
|
|
3550
|
+
contentRevisions?: string[];
|
|
3551
|
+
};
|
|
3552
|
+
type WorldPersistenceAdapter = {
|
|
3553
|
+
begin(): WorldPersistenceTransaction;
|
|
3554
|
+
current(): WorldRevisionState;
|
|
3555
|
+
publish?(payload: WorldPatchAcceptedPayload): void;
|
|
3556
|
+
};
|
|
3557
|
+
type WorldPatchLimits = {
|
|
3558
|
+
maxOperations?: number;
|
|
3559
|
+
maxDiagnostics?: number;
|
|
3560
|
+
maxEntities?: number;
|
|
3561
|
+
maxBytes?: number;
|
|
3562
|
+
};
|
|
3563
|
+
type WorldPatchContentAvailability = {
|
|
3564
|
+
hasRevision?(contentId: string, revision: string): boolean;
|
|
3565
|
+
available?: ReadonlyArray<{
|
|
3566
|
+
contentId?: string;
|
|
3567
|
+
revision: string;
|
|
3568
|
+
}>;
|
|
3569
|
+
};
|
|
3570
|
+
type WorldPatchBindingAvailability = {
|
|
3571
|
+
listedIds?: readonly string[];
|
|
3572
|
+
};
|
|
3573
|
+
type WorldPatchAssetAvailability = {
|
|
3574
|
+
availableIds?: readonly string[];
|
|
3575
|
+
};
|
|
3576
|
+
type WorldPatchGraphPolicy = {
|
|
3577
|
+
allowCycles?: boolean;
|
|
3578
|
+
detectCycle?(preview: WorldRevisionState): boolean;
|
|
3579
|
+
};
|
|
3580
|
+
type WorldPatchDomainValidator = (ctx: {
|
|
3581
|
+
patch: WorldPatch;
|
|
3582
|
+
current: WorldRevisionState;
|
|
3583
|
+
preview: WorldRevisionState;
|
|
3584
|
+
}) => WorldPatchDiagnostic[];
|
|
3585
|
+
type CreateWorldPatchApplierOptions = {
|
|
3586
|
+
persistence?: WorldPersistenceAdapter;
|
|
3587
|
+
graph?: WorldGraph;
|
|
3588
|
+
content?: WorldPatchContentAvailability;
|
|
3589
|
+
bindings?: WorldPatchBindingAvailability;
|
|
3590
|
+
assets?: WorldPatchAssetAvailability;
|
|
3591
|
+
now?: () => number;
|
|
3592
|
+
limits?: WorldPatchLimits;
|
|
3593
|
+
redact?: readonly string[];
|
|
3594
|
+
router?: Pick<EventRouter, 'publish'>;
|
|
3595
|
+
onEvent?: (event: EventInput) => void;
|
|
3596
|
+
domainValidators?: readonly WorldPatchDomainValidator[];
|
|
3597
|
+
capabilities?: readonly string[];
|
|
3598
|
+
graphPolicy?: WorldPatchGraphPolicy;
|
|
3599
|
+
source?: string;
|
|
3600
|
+
};
|
|
3601
|
+
type WorldPatchApplier = {
|
|
3602
|
+
dryRun(patch: unknown): WorldPatchDryRunResult;
|
|
3603
|
+
commit(patch: unknown): WorldPatchCommitResult;
|
|
3604
|
+
inspect(): WorldPatchInspect;
|
|
3605
|
+
snapshot(): WorldPatchSnapshot;
|
|
3606
|
+
restore(input: unknown): RestoreWorldPatchResult;
|
|
3607
|
+
audit(options?: {
|
|
3608
|
+
redact?: boolean;
|
|
3609
|
+
}): WorldPatchAuditRecord[];
|
|
3610
|
+
events(): readonly EventInput[];
|
|
3611
|
+
destroy(): void;
|
|
3612
|
+
};
|
|
3613
|
+
declare function worldPatchEventContracts(): EventContract[];
|
|
3614
|
+
declare function createMemoryWorldPersistence(): WorldPersistenceAdapter;
|
|
3615
|
+
declare function createWorldPatchApplier(options?: CreateWorldPatchApplierOptions): WorldPatchApplier;
|
|
3616
|
+
|
|
3617
|
+
/**
|
|
3618
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
3619
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
3620
|
+
* See packages/engine/LICENSE
|
|
3621
|
+
*
|
|
3622
|
+
* Atomic external content-revision activation. Adapters discover and load
|
|
3623
|
+
* revision catalogs; the activator stages every declared asset, then commits
|
|
3624
|
+
* one complete bundle (or keeps the last known good). Consumers never see a
|
|
3625
|
+
* mixed old/new scene.
|
|
3626
|
+
*/
|
|
3627
|
+
|
|
3628
|
+
declare const CONTENT_REVISION_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
3629
|
+
declare const CONTENT_REVISION_MANIFEST_VERSION: 1;
|
|
3630
|
+
declare const CONTENT_REVISION_ACTIVATED_EVENT: "content.revision.state.activated";
|
|
3631
|
+
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"];
|
|
3632
|
+
type ContentRevisionEventType = (typeof CONTENT_REVISION_EVENTS)[number];
|
|
3633
|
+
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"];
|
|
3634
|
+
type ContentRevisionErrorCode = (typeof CONTENT_REVISION_ERROR_CODES)[number];
|
|
3635
|
+
type ContentRevisionDiagnostic = {
|
|
3636
|
+
code: ContentRevisionErrorCode | string;
|
|
3637
|
+
detail: string;
|
|
3638
|
+
path?: string;
|
|
3639
|
+
};
|
|
3640
|
+
type ContentRevisionAssetDecl = {
|
|
3641
|
+
id: string;
|
|
3642
|
+
kind: AssetKind;
|
|
3643
|
+
url: string;
|
|
3644
|
+
hash: string;
|
|
3645
|
+
alg: 'sha256';
|
|
3646
|
+
optional?: boolean;
|
|
3647
|
+
fallback?: {
|
|
3648
|
+
id: string;
|
|
3649
|
+
kind: AssetKind;
|
|
3650
|
+
url: string;
|
|
3651
|
+
hash: string;
|
|
3652
|
+
alg: 'sha256';
|
|
3653
|
+
};
|
|
3654
|
+
};
|
|
3655
|
+
type ContentRevisionCatalog = {
|
|
3656
|
+
contentId: string;
|
|
3657
|
+
revision: string;
|
|
3658
|
+
manifestVersion: typeof CONTENT_REVISION_MANIFEST_VERSION;
|
|
3659
|
+
publisher: string;
|
|
3660
|
+
source: string;
|
|
3661
|
+
adapterId: string;
|
|
3662
|
+
assets: ContentRevisionAssetDecl[];
|
|
3663
|
+
requestedGrants?: RemoteCartGrant[];
|
|
3664
|
+
capabilities?: CapabilityManifest;
|
|
3665
|
+
signature?: {
|
|
3666
|
+
id: string;
|
|
3667
|
+
alg: string;
|
|
3668
|
+
};
|
|
3669
|
+
};
|
|
3670
|
+
type ContentRevisionDescriptor = {
|
|
3671
|
+
contentId: string;
|
|
3672
|
+
revision: string;
|
|
3673
|
+
adapterId: string;
|
|
3674
|
+
publisher: string;
|
|
3675
|
+
source: string;
|
|
3676
|
+
};
|
|
3677
|
+
type ContentRevisionResource = {
|
|
3678
|
+
id: string;
|
|
3679
|
+
kind: AssetKind;
|
|
3680
|
+
ref: string;
|
|
3681
|
+
hash: string;
|
|
3682
|
+
url: string;
|
|
3683
|
+
optional: boolean;
|
|
3684
|
+
usedFallback: boolean;
|
|
3685
|
+
};
|
|
3686
|
+
type ContentRevisionBundle = {
|
|
3687
|
+
bundleId: string;
|
|
3688
|
+
contentId: string;
|
|
3689
|
+
revision: string;
|
|
3690
|
+
manifestVersion: typeof CONTENT_REVISION_MANIFEST_VERSION;
|
|
3691
|
+
publisher: string;
|
|
3692
|
+
source: string;
|
|
3693
|
+
adapterId: string;
|
|
3694
|
+
signature?: {
|
|
3695
|
+
id: string;
|
|
3696
|
+
alg: string;
|
|
3697
|
+
};
|
|
3698
|
+
resources: Record<string, ContentRevisionResource>;
|
|
3699
|
+
};
|
|
3700
|
+
type ContentRevisionStagingView = {
|
|
3701
|
+
contentId: string;
|
|
3702
|
+
revision: string;
|
|
3703
|
+
adapterId: string;
|
|
3704
|
+
bundleId: string;
|
|
3705
|
+
};
|
|
3706
|
+
type ContentRevisionInspect = {
|
|
3707
|
+
destroyed: boolean;
|
|
3708
|
+
pinned: boolean;
|
|
3709
|
+
active: ContentRevisionBundle | null;
|
|
3710
|
+
lastKnownGood: ContentRevisionBundle | null;
|
|
3711
|
+
staging: ContentRevisionStagingView | null;
|
|
3712
|
+
events: ContentRevisionEventType[];
|
|
3713
|
+
lastRejection: ContentRevisionDiagnostic[] | null;
|
|
3714
|
+
};
|
|
3715
|
+
type ContentRevisionSnapshot = {
|
|
3716
|
+
schemaVersion: typeof CONTENT_REVISION_SNAPSHOT_SCHEMA_VERSION;
|
|
3717
|
+
pinned: boolean;
|
|
3718
|
+
active: ContentRevisionBundle | null;
|
|
3719
|
+
lastKnownGood: ContentRevisionBundle | null;
|
|
3720
|
+
previous: ContentRevisionBundle | null;
|
|
3721
|
+
};
|
|
3722
|
+
type ContentRevisionMutationResult = {
|
|
3723
|
+
ok: true;
|
|
3724
|
+
bundle: ContentRevisionBundle | null;
|
|
3725
|
+
idempotent?: boolean;
|
|
3726
|
+
} | {
|
|
3727
|
+
ok: false;
|
|
3728
|
+
errors: ContentRevisionDiagnostic[];
|
|
3729
|
+
};
|
|
3730
|
+
type RestoreContentRevisionResult = {
|
|
3731
|
+
ok: true;
|
|
3732
|
+
snapshot: ContentRevisionSnapshot;
|
|
3733
|
+
} | {
|
|
3734
|
+
ok: false;
|
|
3735
|
+
errors: ContentRevisionDiagnostic[];
|
|
3736
|
+
};
|
|
3737
|
+
type ActivateContentRevisionRequest = {
|
|
3738
|
+
contentId: string;
|
|
3739
|
+
revision?: string;
|
|
3740
|
+
adapterId?: string;
|
|
3741
|
+
};
|
|
3742
|
+
type ContentRevisionFetchBytes = (url: string, signal?: AbortSignal) => Promise<Uint8Array | undefined>;
|
|
3743
|
+
type ContentRegistryAdapter = {
|
|
3744
|
+
readonly id: string;
|
|
3745
|
+
hasRevision(contentId: string, revision: string): boolean;
|
|
3746
|
+
discover(contentId: string): Promise<ContentRevisionDescriptor | undefined>;
|
|
3747
|
+
loadRevision(contentId: string, revision: string, signal?: AbortSignal): Promise<{
|
|
3748
|
+
ok: true;
|
|
3749
|
+
catalog: ContentRevisionCatalog;
|
|
3750
|
+
} | {
|
|
3751
|
+
ok: false;
|
|
3752
|
+
errors: ContentRevisionDiagnostic[];
|
|
3753
|
+
}>;
|
|
3754
|
+
fetchBytes: ContentRevisionFetchBytes;
|
|
3755
|
+
};
|
|
3756
|
+
type CreateStaticContentAdapterOptions = {
|
|
3757
|
+
id?: string;
|
|
3758
|
+
revisions: readonly ContentRevisionCatalog[];
|
|
3759
|
+
bytesByUrl: Readonly<Record<string, Uint8Array>>;
|
|
3760
|
+
fetchBytes?: ContentRevisionFetchBytes;
|
|
3761
|
+
};
|
|
3762
|
+
type CreateRemoteContentAdapterOptions = {
|
|
3763
|
+
id?: string;
|
|
3764
|
+
fetch: (url: string, signal?: AbortSignal) => Promise<unknown>;
|
|
3765
|
+
keys: Readonly<Record<string, string>>;
|
|
3766
|
+
bytesByUrl?: Readonly<Record<string, Uint8Array>>;
|
|
3767
|
+
fetchBytes?: ContentRevisionFetchBytes;
|
|
3768
|
+
catalogUrl?: (contentId: string, revision?: string) => string;
|
|
3769
|
+
known?: ReadonlyArray<{
|
|
3770
|
+
contentId: string;
|
|
3771
|
+
revision: string;
|
|
3772
|
+
}>;
|
|
3773
|
+
};
|
|
3774
|
+
type ContentRevisionHealthCheck = (bundle: ContentRevisionBundle) => boolean | Promise<boolean>;
|
|
3775
|
+
type CreateContentRevisionActivatorOptions = {
|
|
3776
|
+
adapters: readonly ContentRegistryAdapter[];
|
|
3777
|
+
pin?: boolean;
|
|
3778
|
+
grants?: HostGrantSet;
|
|
3779
|
+
hostCapabilities?: HostCapabilities;
|
|
3780
|
+
healthCheck?: ContentRevisionHealthCheck;
|
|
3781
|
+
router?: Pick<EventRouter, 'publish'>;
|
|
3782
|
+
onEvent?: (event: EventInput) => void;
|
|
3783
|
+
};
|
|
3784
|
+
type ContentRevisionActivator = {
|
|
3785
|
+
pin(frozen?: boolean): void;
|
|
3786
|
+
unpin(): void;
|
|
3787
|
+
isPinned(): boolean;
|
|
3788
|
+
discover(contentId: string, adapterId?: string): Promise<ContentRevisionDescriptor | undefined>;
|
|
3789
|
+
activate(request: ActivateContentRevisionRequest): Promise<ContentRevisionMutationResult>;
|
|
3790
|
+
rollback(): ContentRevisionMutationResult;
|
|
3791
|
+
inspect(): ContentRevisionInspect;
|
|
3792
|
+
activeBundle(): ContentRevisionBundle | null;
|
|
3793
|
+
snapshot(): ContentRevisionSnapshot;
|
|
3794
|
+
restore(input: unknown): RestoreContentRevisionResult;
|
|
3795
|
+
provenance(): SnapshotProvenance | undefined;
|
|
3796
|
+
destroy(): void;
|
|
3797
|
+
};
|
|
3798
|
+
declare function contentRevisionEventContracts(): EventContract[];
|
|
3799
|
+
declare function createStaticContentAdapter(options: CreateStaticContentAdapterOptions): ContentRegistryAdapter;
|
|
3800
|
+
declare function createRemoteContentAdapter(options: CreateRemoteContentAdapterOptions): ContentRegistryAdapter;
|
|
3801
|
+
declare function createContentRevisionActivator(options: CreateContentRevisionActivatorOptions): ContentRevisionActivator;
|
|
3802
|
+
|
|
3803
|
+
/**
|
|
3804
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
3805
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
3806
|
+
* See packages/engine/LICENSE
|
|
3807
|
+
*
|
|
3808
|
+
* Cart-agnostic update/render frame benchmark for CI and agent workflows.
|
|
3809
|
+
* Prefer this over ad-hoc vitest probes when evaluating hash / trait cost.
|
|
3810
|
+
*/
|
|
3811
|
+
|
|
3812
|
+
type FrameBenchmarkOptions = {
|
|
3813
|
+
/** Measured frames after warmup. Default 30. */
|
|
3814
|
+
frames?: number;
|
|
3815
|
+
/** Discarded frames before measurement. Default 5. */
|
|
3816
|
+
warmupFrames?: number;
|
|
3817
|
+
/** Simulated frame advance in ms. Default 1000/60. */
|
|
3818
|
+
frameStepMs?: number;
|
|
3819
|
+
width?: number;
|
|
3820
|
+
height?: number;
|
|
3821
|
+
tokenId?: string;
|
|
3822
|
+
/**
|
|
3823
|
+
* Mutate state after `getDefaultState` (e.g. skip Tone init in jsdom by
|
|
3824
|
+
* setting `audioContextStarted = true`).
|
|
3825
|
+
*/
|
|
3826
|
+
prepareState?: (state: unknown, featureState: unknown) => void;
|
|
3827
|
+
/** Optional stub drawing context; defaults to a no-op `putImageData`. */
|
|
3828
|
+
drawingContext?: CanvasRenderingContext2D;
|
|
3829
|
+
};
|
|
3830
|
+
type FrameBenchmarkResult = {
|
|
3831
|
+
frames: number;
|
|
3832
|
+
updateAvgMs: number;
|
|
3833
|
+
renderAvgMs: number;
|
|
3834
|
+
totalAvgMs: number;
|
|
3835
|
+
updateMaxMs: number;
|
|
3836
|
+
renderMaxMs: number;
|
|
3837
|
+
estFps: number;
|
|
3838
|
+
updatePct: number;
|
|
3839
|
+
renderPct: number;
|
|
3840
|
+
};
|
|
3841
|
+
/**
|
|
3842
|
+
* Run a cart's update/render loop headlessly and report average / max phase
|
|
3843
|
+
* timings. Does not start audio or mount a live AnimationManager — suitable
|
|
3844
|
+
* for jsdom vitest and agent hash probes.
|
|
3845
|
+
*/
|
|
3846
|
+
declare function benchmarkCartFrames<T, TFeatureState = undefined>(cart: AnimationCart<T, TFeatureState>, hash: string, rawParams: number[], options?: FrameBenchmarkOptions): FrameBenchmarkResult;
|
|
3847
|
+
/** Round timing fields for stable console / snapshot logging. */
|
|
3848
|
+
declare function formatFrameBenchmarkResult(result: FrameBenchmarkResult, digits?: number): Record<string, number>;
|
|
3849
|
+
|
|
3850
|
+
/**
|
|
3851
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
3852
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
3853
|
+
* See packages/engine/LICENSE
|
|
3854
|
+
*
|
|
3855
|
+
* Opt-in DOM/browser host harness. Mounts a caller-supplied host into a
|
|
3856
|
+
* viewport, optionally wires a runtime group and compositor, and dispatches
|
|
3857
|
+
* pointer/keyboard through layout coordinates. Does not import Node built-ins
|
|
3858
|
+
* and does not encode host-product event types or fixtures.
|
|
3859
|
+
*/
|
|
3860
|
+
|
|
3861
|
+
type BrowserInputModality = 'pointer' | 'keyboard' | 'touch';
|
|
3862
|
+
type BrowserHarnessAction = {
|
|
3863
|
+
type: 'viewport';
|
|
3864
|
+
width: number;
|
|
3865
|
+
height: number;
|
|
3866
|
+
dpr: number;
|
|
3867
|
+
} | {
|
|
3868
|
+
type: 'click';
|
|
3869
|
+
x: number;
|
|
3870
|
+
y: number;
|
|
3871
|
+
selector?: string;
|
|
3872
|
+
} | {
|
|
3873
|
+
type: 'key';
|
|
3874
|
+
key: string;
|
|
3875
|
+
} | {
|
|
3876
|
+
type: 'step';
|
|
3877
|
+
frames: number;
|
|
3878
|
+
} | {
|
|
3879
|
+
type: 'advance';
|
|
3880
|
+
ms: number;
|
|
3881
|
+
} | {
|
|
3882
|
+
type: 'reducedMotion';
|
|
3883
|
+
value: boolean;
|
|
3884
|
+
} | {
|
|
3885
|
+
type: 'inputModality';
|
|
3886
|
+
value: BrowserInputModality;
|
|
3887
|
+
};
|
|
3888
|
+
type BrowserHarnessScreenshot = {
|
|
3889
|
+
imageData: ImageData | null;
|
|
3890
|
+
pngDataUrl: string | null;
|
|
3891
|
+
html: string;
|
|
3892
|
+
declaredOrder: string[];
|
|
3893
|
+
};
|
|
3894
|
+
type BrowserA11ySnapshot = {
|
|
3895
|
+
focus: {
|
|
3896
|
+
tag: string;
|
|
3897
|
+
id: string;
|
|
3898
|
+
role: string | null;
|
|
3899
|
+
name: string;
|
|
3900
|
+
};
|
|
3901
|
+
live: string;
|
|
3902
|
+
html: string;
|
|
3903
|
+
publishedRegions: Array<{
|
|
3904
|
+
id: string;
|
|
3905
|
+
geometryKinds: string[];
|
|
3906
|
+
name: string | null;
|
|
3907
|
+
role: string | null;
|
|
3908
|
+
}>;
|
|
3909
|
+
};
|
|
3910
|
+
type BrowserReproductionMetadata = {
|
|
3911
|
+
seed: string;
|
|
3912
|
+
viewport: {
|
|
3913
|
+
width: number;
|
|
3914
|
+
height: number;
|
|
3915
|
+
dpr: number;
|
|
3916
|
+
};
|
|
3917
|
+
reducedMotion: boolean;
|
|
3918
|
+
inputModality: BrowserInputModality;
|
|
3919
|
+
actions: BrowserHarnessAction[];
|
|
3920
|
+
};
|
|
3921
|
+
type BrowserHarnessInspect = {
|
|
3922
|
+
host: unknown;
|
|
3923
|
+
layout: PresentationLayout;
|
|
3924
|
+
events: EventEnvelope[];
|
|
3925
|
+
participantEvents: Record<string, HostEvent[]>;
|
|
3926
|
+
state: Record<string, unknown>;
|
|
3927
|
+
focus: BrowserA11ySnapshot['focus'];
|
|
3928
|
+
publishedRegions: BrowserA11ySnapshot['publishedRegions'];
|
|
3929
|
+
scrollTop: number;
|
|
3930
|
+
clock: {
|
|
3931
|
+
framesElapsed: number;
|
|
3932
|
+
};
|
|
3933
|
+
};
|
|
3934
|
+
type BrowserHarness = {
|
|
3935
|
+
readonly root: HTMLElement;
|
|
3936
|
+
readonly group: RuntimeGroup | undefined;
|
|
3937
|
+
readonly compositor: Compositor | undefined;
|
|
3938
|
+
readonly layout: PresentationLayout;
|
|
3939
|
+
readonly events: readonly EventEnvelope[];
|
|
3940
|
+
goto(url?: string): void;
|
|
3941
|
+
setViewport(width: number, height: number, dpr?: number): void;
|
|
3942
|
+
setReducedMotion(value: boolean): void;
|
|
3943
|
+
setInputModality(value: BrowserInputModality): void;
|
|
3944
|
+
click(selectorOrX: string | number, y?: number): void;
|
|
3945
|
+
key(key: string): void;
|
|
3946
|
+
focus(selector: string): void;
|
|
3947
|
+
step(frames?: number): Promise<void>;
|
|
3948
|
+
advance(ms: number): Promise<void>;
|
|
3949
|
+
screenshot(): BrowserHarnessScreenshot;
|
|
3950
|
+
accessibilitySnapshot(): BrowserA11ySnapshot;
|
|
3951
|
+
inspect(): Promise<BrowserHarnessInspect>;
|
|
3952
|
+
reproduction(): BrowserReproductionMetadata;
|
|
3953
|
+
captureComposedFrame(): ComposedFrame;
|
|
3954
|
+
destroy(): void;
|
|
3955
|
+
};
|
|
3956
|
+
|
|
3957
|
+
/**
|
|
3958
|
+
* Copyright (c) 2026 Aaron Boyarsky
|
|
3959
|
+
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
3960
|
+
* See packages/engine/LICENSE
|
|
3961
|
+
*
|
|
3962
|
+
* End-to-end production composition scenario harness. Composes the real
|
|
3963
|
+
* browser host, runtime group, compositor, visual/semantic layers, bindings,
|
|
3964
|
+
* sequences, headless audio, snapshots, and replay inspector. Does not
|
|
3965
|
+
* introduce a second runtime. Authored scenarios are JSON-serializable.
|
|
3966
|
+
*/
|
|
3967
|
+
|
|
3968
|
+
declare const PRODUCTION_SCENARIO_SCHEMA_VERSION: 1;
|
|
3969
|
+
declare const PRODUCTION_SCENARIO_SNAPSHOT_SCHEMA_VERSION: 1;
|
|
3970
|
+
declare const PRODUCTION_SCENARIO_BOUNDARIES: readonly ["input", "reducer", "routing", "binding", "cue", "pixels", "caption", "audio", "save-replay"];
|
|
3971
|
+
type ProductionScenarioBoundary = (typeof PRODUCTION_SCENARIO_BOUNDARIES)[number];
|
|
3972
|
+
declare const PRODUCTION_SCENARIO_ERROR_CODES: readonly ["invalid-scenario", "invalid-schema", "unknown-field", "missing-field", "callbacks-forbidden", "missing-participant", "missing-layer", "destroyed", "assertion-failed"];
|
|
3973
|
+
type ProductionScenarioErrorCode = (typeof PRODUCTION_SCENARIO_ERROR_CODES)[number];
|
|
3974
|
+
declare const PRODUCTION_SCENARIO_VIEWPORT_PRESETS: readonly ["desktop", "mobile"];
|
|
3975
|
+
type ProductionScenarioViewportPreset = (typeof PRODUCTION_SCENARIO_VIEWPORT_PRESETS)[number];
|
|
3976
|
+
declare const DEFAULT_PRODUCTION_SCENARIO_VIEWPORTS: {
|
|
3977
|
+
readonly desktop: {
|
|
3978
|
+
readonly width: 64;
|
|
3979
|
+
readonly height: 48;
|
|
3980
|
+
readonly deviceScaleFactor: 1;
|
|
3981
|
+
};
|
|
3982
|
+
readonly mobile: {
|
|
3983
|
+
readonly width: 48;
|
|
3984
|
+
readonly height: 64;
|
|
3985
|
+
readonly deviceScaleFactor: 2;
|
|
3986
|
+
};
|
|
3987
|
+
};
|
|
3988
|
+
type ProductionScenarioDiagnostic = {
|
|
3989
|
+
code: ProductionScenarioErrorCode | string;
|
|
3990
|
+
detail: string;
|
|
3991
|
+
path?: string;
|
|
3992
|
+
boundary?: ProductionScenarioBoundary;
|
|
3993
|
+
};
|
|
3994
|
+
type ProductionScenarioRequired = {
|
|
3995
|
+
participants: readonly string[];
|
|
3996
|
+
layers: readonly string[];
|
|
3997
|
+
};
|
|
3998
|
+
type ProductionScenarioMatrix = {
|
|
3999
|
+
viewport?: ProductionScenarioViewportPreset;
|
|
4000
|
+
width?: number;
|
|
4001
|
+
height?: number;
|
|
4002
|
+
dpr?: number;
|
|
4003
|
+
reducedMotion?: boolean;
|
|
4004
|
+
mute?: boolean;
|
|
4005
|
+
failedAssetIds?: readonly string[];
|
|
4006
|
+
fallback?: boolean;
|
|
4007
|
+
inputModality?: BrowserInputModality;
|
|
4008
|
+
};
|
|
4009
|
+
type ProductionScenarioStep = {
|
|
4010
|
+
type: 'click';
|
|
4011
|
+
selector?: string;
|
|
4012
|
+
x?: number;
|
|
4013
|
+
y?: number;
|
|
4014
|
+
} | {
|
|
4015
|
+
type: 'key';
|
|
4016
|
+
key: string;
|
|
4017
|
+
} | {
|
|
4018
|
+
type: 'focus';
|
|
4019
|
+
selector: string;
|
|
4020
|
+
} | {
|
|
4021
|
+
type: 'step';
|
|
4022
|
+
frames: number;
|
|
4023
|
+
} | {
|
|
4024
|
+
type: 'viewport';
|
|
4025
|
+
kind?: ProductionScenarioViewportPreset;
|
|
4026
|
+
width?: number;
|
|
4027
|
+
height?: number;
|
|
4028
|
+
dpr?: number;
|
|
4029
|
+
} | {
|
|
4030
|
+
type: 'reducedMotion';
|
|
4031
|
+
value: boolean;
|
|
4032
|
+
} | {
|
|
4033
|
+
type: 'mute';
|
|
4034
|
+
value: boolean;
|
|
4035
|
+
} | {
|
|
4036
|
+
type: 'failAsset';
|
|
4037
|
+
assetId: string;
|
|
4038
|
+
} | {
|
|
4039
|
+
type: 'save';
|
|
4040
|
+
} | {
|
|
4041
|
+
type: 'reload';
|
|
4042
|
+
} | {
|
|
4043
|
+
type: 'replay';
|
|
4044
|
+
};
|
|
4045
|
+
type ProductionScenarioDefinition = {
|
|
4046
|
+
id: string;
|
|
4047
|
+
schemaVersion: typeof PRODUCTION_SCENARIO_SCHEMA_VERSION;
|
|
4048
|
+
seed: string;
|
|
4049
|
+
required: ProductionScenarioRequired;
|
|
4050
|
+
matrix?: ProductionScenarioMatrix;
|
|
4051
|
+
steps?: readonly ProductionScenarioStep[];
|
|
4052
|
+
};
|
|
4053
|
+
type DefineProductionScenarioResult = {
|
|
4054
|
+
ok: true;
|
|
4055
|
+
scenario: ProductionScenarioDefinition;
|
|
4056
|
+
} | {
|
|
4057
|
+
ok: false;
|
|
4058
|
+
errors: ProductionScenarioDiagnostic[];
|
|
4059
|
+
};
|
|
4060
|
+
type ProductionScenarioReduceResult = {
|
|
4061
|
+
accepted: boolean;
|
|
4062
|
+
state: JsonObject;
|
|
4063
|
+
reason?: string;
|
|
4064
|
+
playSequence?: string;
|
|
4065
|
+
};
|
|
4066
|
+
type ProductionScenarioHost = {
|
|
4067
|
+
initialState: JsonObject;
|
|
4068
|
+
reduce(state: JsonObject, intent: EventInput): ProductionScenarioReduceResult;
|
|
4069
|
+
project?(state: JsonObject): JsonObject;
|
|
4070
|
+
};
|
|
4071
|
+
type ProductionScenarioLocalization = {
|
|
4072
|
+
boundary: ProductionScenarioBoundary;
|
|
4073
|
+
code: ProductionScenarioErrorCode;
|
|
4074
|
+
detail: string;
|
|
4075
|
+
};
|
|
4076
|
+
type ProductionScenarioObservation = {
|
|
4077
|
+
inputDispatched: boolean;
|
|
4078
|
+
inputTarget?: string;
|
|
4079
|
+
reducerAccepted?: boolean;
|
|
4080
|
+
reducerRejected?: boolean;
|
|
4081
|
+
reducerReason?: string;
|
|
4082
|
+
routedTypes: string[];
|
|
4083
|
+
rejected: boolean;
|
|
4084
|
+
selectedBindingIds: string[];
|
|
4085
|
+
sequenceId?: string | null;
|
|
4086
|
+
sequencePhase?: string | null;
|
|
4087
|
+
captions: string[];
|
|
4088
|
+
declaredOrder: string[];
|
|
4089
|
+
requiredParticipantsPresent: boolean;
|
|
4090
|
+
requiredLayersPresent: boolean;
|
|
4091
|
+
missingParticipants: string[];
|
|
4092
|
+
missingLayers: string[];
|
|
4093
|
+
audioInvoked: boolean;
|
|
4094
|
+
audioFailed: boolean;
|
|
4095
|
+
muted: boolean;
|
|
4096
|
+
replayMatch?: boolean;
|
|
4097
|
+
snapshotOk?: boolean;
|
|
4098
|
+
};
|
|
4099
|
+
type ProductionScenarioExpectation = {
|
|
4100
|
+
inputDispatched?: boolean;
|
|
4101
|
+
reducerAccepted?: boolean;
|
|
4102
|
+
reducerRejected?: boolean;
|
|
4103
|
+
routedTypes?: readonly string[];
|
|
4104
|
+
selectedBindingIds?: readonly string[];
|
|
4105
|
+
sequenceId?: string;
|
|
4106
|
+
captions?: readonly string[];
|
|
4107
|
+
requiredParticipantsPresent?: boolean;
|
|
4108
|
+
requiredLayersPresent?: boolean;
|
|
4109
|
+
audioInvoked?: boolean;
|
|
4110
|
+
audioFailed?: boolean;
|
|
4111
|
+
replayMatch?: boolean;
|
|
4112
|
+
snapshotOk?: boolean;
|
|
4113
|
+
};
|
|
4114
|
+
type ProductionScenarioEvidenceBundle = {
|
|
4115
|
+
schemaVersion: typeof PRODUCTION_SCENARIO_SNAPSHOT_SCHEMA_VERSION;
|
|
4116
|
+
scenarioId: string;
|
|
4117
|
+
seed: string;
|
|
4118
|
+
matrix: Required<Pick<ProductionScenarioMatrix, 'viewport' | 'width' | 'height' | 'dpr'>> & ProductionScenarioMatrix;
|
|
4119
|
+
hashes: {
|
|
4120
|
+
pixels: string;
|
|
4121
|
+
semantic: string;
|
|
4122
|
+
a11y: string;
|
|
4123
|
+
trace: string;
|
|
4124
|
+
snapshot: string;
|
|
4125
|
+
assets: string;
|
|
4126
|
+
};
|
|
4127
|
+
revisions: {
|
|
4128
|
+
world: string | number | null;
|
|
4129
|
+
bindings: string | number | null;
|
|
4130
|
+
snapshot: number;
|
|
4131
|
+
};
|
|
4132
|
+
traces: {
|
|
4133
|
+
envelopes: EventEnvelope[];
|
|
4134
|
+
inspector: InspectorRecord[];
|
|
4135
|
+
audio: AudioCueEvent[];
|
|
4136
|
+
actions: ProductionScenarioStep[];
|
|
4137
|
+
};
|
|
4138
|
+
screenshot: {
|
|
4139
|
+
pngDataUrl: string | null;
|
|
4140
|
+
declaredOrder: string[];
|
|
4141
|
+
width: number;
|
|
4142
|
+
height: number;
|
|
4143
|
+
};
|
|
4144
|
+
semantic: SemanticPublishedRegion[];
|
|
4145
|
+
a11y: BrowserA11ySnapshot;
|
|
4146
|
+
firstBrokenBoundary: ProductionScenarioBoundary | null;
|
|
4147
|
+
localization: ProductionScenarioLocalization | null;
|
|
4148
|
+
participants: string[];
|
|
4149
|
+
layers: string[];
|
|
4150
|
+
observation: ProductionScenarioObservation;
|
|
4151
|
+
selectionTrace?: SelectionTraceExport | null;
|
|
4152
|
+
};
|
|
4153
|
+
type CreateProductionScenarioRunnerOptions = {
|
|
4154
|
+
scenario: ProductionScenarioDefinition | unknown;
|
|
4155
|
+
participants: RuntimeGroupParticipantConfig[];
|
|
4156
|
+
compositorLayers: CompositorLayerConfig[];
|
|
4157
|
+
visualLayers?: readonly VisualLayerDeclaration[];
|
|
4158
|
+
visualSources?: Readonly<Record<string, ImageData>>;
|
|
4159
|
+
semanticRegions?: readonly SemanticRegionDeclaration[];
|
|
4160
|
+
sequences?: readonly PresentationSequenceDefinition[];
|
|
4161
|
+
bindings?: PresentationBindingManifest | unknown;
|
|
4162
|
+
geometry?: GeometryDocument;
|
|
4163
|
+
host: ProductionScenarioHost;
|
|
4164
|
+
sequenceBindings?: Readonly<Record<string, PresentationSequenceBindings>>;
|
|
4165
|
+
contentWidth?: number;
|
|
4166
|
+
contentHeight?: number;
|
|
4167
|
+
origin?: number;
|
|
4168
|
+
createId?: () => string;
|
|
4169
|
+
mapClick?: (hotspotId: string) => EventInput;
|
|
4170
|
+
mapKey?: (key: string) => EventInput | undefined;
|
|
4171
|
+
router?: Pick<EventRouter, 'publish'>;
|
|
4172
|
+
};
|
|
4173
|
+
type ProductionScenarioRunner = {
|
|
4174
|
+
readonly scenario: ProductionScenarioDefinition;
|
|
4175
|
+
readonly harness: BrowserHarness;
|
|
4176
|
+
readonly audio: HeadlessAudioAdapter;
|
|
4177
|
+
readonly inspector: ReplayInspector;
|
|
4178
|
+
goto(): void;
|
|
4179
|
+
click(selectorOrX: string | number, y?: number): void;
|
|
4180
|
+
key(key: string): void;
|
|
4181
|
+
focus(selector: string): void;
|
|
4182
|
+
setViewport(width: number, height: number, dpr?: number): void;
|
|
4183
|
+
setReducedMotion(value: boolean): void;
|
|
4184
|
+
mute(value?: boolean): void;
|
|
4185
|
+
failAsset(assetId: string): void;
|
|
4186
|
+
step(frames?: number): Promise<void>;
|
|
4187
|
+
applyHostIntent(intent: EventInput): ProductionScenarioReduceResult;
|
|
4188
|
+
playSequence(sequenceId: string, invocationId?: string): void;
|
|
4189
|
+
publish(event: EventInput): EventEnvelope | undefined;
|
|
4190
|
+
save(): SnapshotEnvelope;
|
|
4191
|
+
reload(snapshot?: SnapshotEnvelope): void;
|
|
4192
|
+
replay(): Promise<ReplayCompareResult>;
|
|
4193
|
+
run(steps?: readonly ProductionScenarioStep[]): Promise<ProductionScenarioEvidenceBundle>;
|
|
4194
|
+
captureEvidence(expected?: ProductionScenarioExpectation): ProductionScenarioEvidenceBundle;
|
|
4195
|
+
inspect(): {
|
|
4196
|
+
host: JsonObject;
|
|
4197
|
+
lastDecision: ProductionScenarioReduceResult | null;
|
|
4198
|
+
bindings: ReturnType<PresentationBindingRuntime['inspect']> | null;
|
|
4199
|
+
sequences: ReturnType<PresentationSequencePlayer['inspect']> | null;
|
|
4200
|
+
visual: ReturnType<VisualLayerController['inspect']> | null;
|
|
4201
|
+
semantic: ReturnType<SemanticLayerController['inspect']> | null;
|
|
4202
|
+
audio: ReturnType<HeadlessAudioAdapter['snapshot']>;
|
|
4203
|
+
participants: string[];
|
|
4204
|
+
layers: string[];
|
|
4205
|
+
composition: ProductionScenarioLocalization | null;
|
|
4206
|
+
};
|
|
4207
|
+
destroy(): void;
|
|
4208
|
+
};
|
|
4209
|
+
declare function productionScenarioEventContracts(): EventContract[];
|
|
4210
|
+
declare function defineProductionScenario(input: unknown): DefineProductionScenarioResult;
|
|
4211
|
+
declare function fnv1aHex(data: string | Uint8Array): string;
|
|
4212
|
+
declare function localizeProductionScenarioFailure(observed: ProductionScenarioObservation, expected?: ProductionScenarioExpectation): ProductionScenarioLocalization | null;
|
|
4213
|
+
declare function createProductionScenarioRunner(options: CreateProductionScenarioRunnerOptions): ProductionScenarioRunner;
|
|
4214
|
+
|
|
1692
4215
|
/**
|
|
1693
4216
|
* Copyright (c) 2026 Aaron Boyarsky
|
|
1694
4217
|
* SPDX-License-Identifier: LicenseRef-CyberArt-Engine
|
|
@@ -1709,4 +4232,4 @@ type WriteComposedFrameResult = ComposedFrame & {
|
|
|
1709
4232
|
*/
|
|
1710
4233
|
declare function writeComposedFrame(compositor: Compositor, path?: string): Promise<WriteComposedFrameResult>;
|
|
1711
4234
|
|
|
1712
|
-
export { type BoundReplaySession, type CausationTreeNode, type CreateHeadlessHarnessOptions, type CreateHeadlessMultiCartHarnessOptions, type CreateReplayInspectorOptions, DEFAULT_HEADLESS_HEIGHT, DEFAULT_HEADLESS_WIDTH, type GlyphAtlas, HEADLESS_PNG_DATA_URL, type HeadlessAudioAdapter, type HeadlessCanvas2DSettings, type HeadlessFrameError, type HeadlessHarness, type HeadlessImageFixture, type HeadlessInspect, type HeadlessMultiCartHarness, HeadlessUnsupportedOperationError, type InspectorRecord, type InstallHeadlessCanvasOptions, type ReplayCompareResult, type ReplayInspector, type ReplayInspectorExport, type ReplayInspectorReport, type ReplayParticipantSummary, type ReplayTapeAction, type ReplayTraceFilter, UPDATE_GOLDEN_ENV, type VisualArtifactPaths, type VisualArtifacts, type VisualCompareOptions, type VisualCompareResult, type VisualLayerCapture, type VisualLayerController, type VisualLayerInspect, type WriteComposedFrameResult, assertPixelsEqual, assertPngDataUrlsEqual, attachHeadlessCanvas2D, captureVisualLayers, compareImageData, compareReplayTraces, createDefaultGlyphAtlas, createHeadlessAudioAdapter, createHeadlessHarness, createHeadlessMultiCartHarness, createImageFixture, createReplayInspector, createVisualLayerController, decodePng, encodePng, encodePngDataUrl, getHeadlessSurface, imageDataFromPngDataUrl, installHeadlessCanvas, makeImageData, replayExportedTrace, setDefaultGlyphAtlas, shouldUpdateGolden, writeComposedFrame, writeVisualArtifacts };
|
|
4235
|
+
export { type BoundReplaySession, CONTENT_REVISION_ACTIVATED_EVENT, CONTENT_REVISION_SNAPSHOT_SCHEMA_VERSION, type CausationTreeNode, type ContentRevisionActivator, type ContentRevisionBundle, type ContentRevisionInspect, type ContentRevisionSnapshot, type CreateHeadlessHarnessOptions, type CreateHeadlessMultiCartHarnessOptions, type CreateReplayInspectorOptions, type CreateSelectionTraceOptions, DEFAULT_HEADLESS_HEIGHT, DEFAULT_HEADLESS_WIDTH, DEFAULT_MAX_SELECTION_RECORDS, DEFAULT_PRODUCTION_SCENARIO_VIEWPORTS, type FrameBenchmarkOptions, type FrameBenchmarkResult, type GlyphAtlas, HEADLESS_PNG_DATA_URL, type HeadlessAudioAdapter, type HeadlessCanvas2DSettings, type HeadlessFrameError, type HeadlessHarness, type HeadlessImageFixture, type HeadlessInspect, type HeadlessJobWorker, type HeadlessMultiCartHarness, HeadlessUnsupportedOperationError, type HostGrantSet, type InspectorRecord, type InstallHeadlessCanvasOptions, type JobCoordinator, type JobCoordinatorSnapshot, type JobInspect, PRESENTATION_BINDING_APPLIED_EVENT, PRESENTATION_BINDING_SNAPSHOT_SCHEMA_VERSION, PRODUCTION_SCENARIO_BOUNDARIES, PRODUCTION_SCENARIO_SCHEMA_VERSION, PRODUCTION_SCENARIO_SNAPSHOT_SCHEMA_VERSION, type PortalInspect, type PortalLifecycle, type PortalLifecycleSnapshot, type PresentationBindingInspect, type PresentationBindingManifest, type PresentationBindingRuntime, type PresentationBindingSnapshot, type PresentationSequenceDefinition, type PresentationSequenceInspect, type PresentationSequencePlayer, type PresentationSequenceSnapshot, type ProductionScenarioDefinition, type ProductionScenarioEvidenceBundle, type ProductionScenarioExpectation, type ProductionScenarioHost, type ProductionScenarioLocalization, type ProductionScenarioObservation, type ProductionScenarioRunner, type RemoteCartInspect, type RemoteCartSandbox, type ReplayCompareResult, type ReplayInspector, type ReplayInspectorExport, type ReplayInspectorReport, type ReplayParticipantSummary, type ReplayTapeAction, type ReplayTraceFilter, SELECTION_DECISION_KINDS, SELECTION_REASON_CODES, SELECTION_TRACE_SCHEMA_VERSION, SELECTION_TRACE_SENSITIVE_KEYS, 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 SemanticLayerController, type SemanticPublishedRegion, type SemanticRegionInspect, UPDATE_GOLDEN_ENV, type VisualArtifactPaths, type VisualArtifacts, type VisualCompareOptions, type VisualCompareResult, type VisualLayerCapture, type VisualLayerController, type VisualLayerInspect, WORLD_PATCH_ACCEPTED_EVENT, WORLD_PATCH_SNAPSHOT_SCHEMA_VERSION, type WorldGraph, type WorldGraphInspect, type WorldGraphProjection, type WorldGraphSnapshot, type WorldPatchApplier, type WorldPatchInspect, type WorldPatchSnapshot, type WorldPersistenceAdapter, type WriteComposedFrameResult, assertPixelsEqual, assertPngDataUrlsEqual, attachHeadlessCanvas2D, attachSelectionTrace, benchmarkCartFrames, cabinetPortal, captureVisualLayers, compareImageData, compareReplayTraces, contentRevisionEventContracts, createContentRevisionActivator, createDefaultGlyphAtlas, createHeadlessAudioAdapter, createHeadlessHarness, createHeadlessJobWorker, createHeadlessMultiCartHarness, createHostGrantSet, createImageFixture, createJobCoordinator, createMemoryJobPersistence, createMemoryWorldPersistence, createPortalLifecycle, createPresentationBindingRuntime, createPresentationSequencePlayer, createProductionScenarioRunner, createRemoteCartSandbox, createRemoteContentAdapter, createReplayInspector, createSelectionTrace, createSemanticLayerController, createStaticContentAdapter, createVisualLayerController, createWorldGraph, createWorldPatchApplier, decodePng, definePresentationBindings, definePresentationSequence, defineProductionScenario, encodePng, encodePngDataUrl, evaluatePresentationBindings, fnv1aHex, formatFrameBenchmarkResult, getHeadlessSurface, imageDataFromPngDataUrl, installHeadlessCanvas, isSelectionDecisionKind, isSelectionReasonCode, jobEventContracts, localizeProductionScenarioFailure, makeImageData, paintingPortal, presentationBindingEventContracts, presentationSequenceEventContracts, productionScenarioEventContracts, recordSelectionDecision, replayExportedTrace, setDefaultGlyphAtlas, shouldUpdateGolden, worldGraphEventContracts, worldPatchEventContracts, writeComposedFrame, writeVisualArtifacts };
|