@cyberart-io/engine 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -329,11 +329,16 @@ type AnimationTiming = {
329
329
  deltaSinceLastUpdate: number;
330
330
  deltaSinceLastRender: number;
331
331
  };
332
+ type CartKind = 'render' | 'calculation';
332
333
  type AnimationCart<T = unknown, TFeatureState = undefined> = {
333
334
  getDefaultFeatureState?: (R: Random, dimensionContext: DimensionContext, rawParams: number[], keyboardManager: KeyboardManager, customState?: Partial<T>, pointerManager?: PointerManager, gameManager?: unknown, hostChannel?: HostChannel) => TFeatureState;
334
335
  getDefaultState: (R: Random, dimensionContext: DimensionContext, rawParams: number[], keyboardManager: KeyboardManager, customState?: Partial<T>, pointerManager?: PointerManager, gameManager?: unknown, featureState?: Readonly<TFeatureState>, hostChannel?: HostChannel) => T;
335
336
  update: (R: Random, framesElapsed: number, rawParams: number[], dimensionContext: DimensionContext, state: T, keyboardManager: KeyboardManager, pointerManager?: PointerManager, gameManager?: unknown, timing?: AnimationTiming, featureState?: Readonly<TFeatureState>, hostChannel?: HostChannel) => T;
336
- render: (R: Random, framesElapsed: number, rawParams: number[], dimensionContext: DimensionContext, state: T, drawingContext: CanvasRenderingContext2D, imageData: ImageData, pointerManager?: PointerManager, gameManager?: unknown, timing?: AnimationTiming, featureState?: Readonly<TFeatureState>, hostChannel?: HostChannel) => void;
337
+ /**
338
+ * Draw into the 2D context. Optional on calculation carts (`kind:
339
+ * 'calculation'`); the runtime does not call it and does not create a canvas.
340
+ */
341
+ render?: (R: Random, framesElapsed: number, rawParams: number[], dimensionContext: DimensionContext, state: T, drawingContext: CanvasRenderingContext2D, imageData: ImageData, pointerManager?: PointerManager, gameManager?: unknown, timing?: AnimationTiming, featureState?: Readonly<TFeatureState>, hostChannel?: HostChannel) => void;
337
342
  adjust?: Record<string, {
338
343
  type: 'switch';
339
344
  immediate?: boolean;
@@ -406,6 +411,153 @@ declare class IncompatibleCartStateError extends Error {
406
411
  constructor(message: string);
407
412
  }
408
413
 
414
+ /**
415
+ * Copyright (c) 2026 Aaron Boyarsky
416
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
417
+ * See packages/engine/LICENSE
418
+ *
419
+ * Versioned snapshot envelope. Schema 1 is the previous engine-owned
420
+ * `CartStateBundle` (`CART_STATE_BUNDLE_VERSION = 1`). Schema 2 wraps that
421
+ * blob in `engineState` and separates host-owned payload. Hosts persist
422
+ * the JSON; this module is not a database.
423
+ */
424
+
425
+ /**
426
+ * Current envelope schema. Independent of `CART_STATE_BUNDLE_VERSION` (still
427
+ * 1 inside `engineState`) and of the npm package version.
428
+ */
429
+ declare const SNAPSHOT_SCHEMA_VERSION: 2;
430
+ /** Previous supported schema: a raw `CartStateBundle`. */
431
+ declare const LEGACY_SNAPSHOT_SCHEMA_VERSION: 1;
432
+ /**
433
+ * Snapshot runtime id stamped on new envelopes. Documented independently of
434
+ * `packages/engine/package.json` so a schema bump does not require an npm
435
+ * release, and vice versa. Currently `'0.0.5'` to match the published package.
436
+ */
437
+ declare const ENGINE_SNAPSHOT_RUNTIME = "0.0.5";
438
+ /** Carts without an authored version stamp this exact string. */
439
+ declare const UNVERSIONED_CART_VERSION = "0";
440
+ type SnapshotDiagnostic = {
441
+ code: string;
442
+ detail: string;
443
+ path?: string;
444
+ };
445
+ type SnapshotCartRef = {
446
+ id: string;
447
+ version: string;
448
+ generative?: boolean;
449
+ };
450
+ type SnapshotModuleRef = {
451
+ id: string;
452
+ version: string;
453
+ };
454
+ type SnapshotClock = {
455
+ framesElapsed: number;
456
+ elapsedSinceStart?: number;
457
+ now?: number;
458
+ frameRate?: number;
459
+ };
460
+ type SnapshotAssetRef = {
461
+ id: string;
462
+ version?: string;
463
+ ref?: string;
464
+ };
465
+ type SnapshotIntegrity = {
466
+ alg: string;
467
+ hash: string;
468
+ };
469
+ type SnapshotProvenance = {
470
+ source?: string;
471
+ integrity?: SnapshotIntegrity;
472
+ };
473
+ type SnapshotEnvelope = {
474
+ schemaVersion: typeof SNAPSHOT_SCHEMA_VERSION;
475
+ runtimeVersion: string;
476
+ cart: SnapshotCartRef;
477
+ seed: string;
478
+ clock: SnapshotClock;
479
+ engineState: CartStateBundle;
480
+ createdAt: string;
481
+ modules?: SnapshotModuleRef[];
482
+ rng?: RandomState;
483
+ hostState?: unknown;
484
+ hostStateRef?: string;
485
+ assets?: SnapshotAssetRef[];
486
+ provenance?: SnapshotProvenance;
487
+ };
488
+ type LegacySnapshot = {
489
+ schemaVersion: number;
490
+ engineState: CartStateBundle;
491
+ seed: string;
492
+ clock: SnapshotClock;
493
+ cart?: SnapshotCartRef;
494
+ };
495
+ type VersionedSnapshot = SnapshotEnvelope | LegacySnapshot;
496
+ type SnapshotEnvelopeInput = {
497
+ schemaVersion?: number;
498
+ runtimeVersion?: string;
499
+ cart: SnapshotCartRef;
500
+ seed: string;
501
+ clock: SnapshotClock;
502
+ engineState: CartStateBundle;
503
+ createdAt?: string;
504
+ modules?: SnapshotModuleRef[];
505
+ rng?: RandomState;
506
+ hostState?: unknown;
507
+ hostStateRef?: string;
508
+ assets?: SnapshotAssetRef[];
509
+ provenance?: SnapshotProvenance;
510
+ };
511
+ type ExportSnapshotOptions = {
512
+ cartVersion?: string;
513
+ modules?: SnapshotModuleRef[];
514
+ hostState?: unknown;
515
+ hostStateRef?: string;
516
+ assets?: SnapshotAssetRef[];
517
+ createdAt?: string;
518
+ provenance?: SnapshotProvenance;
519
+ runtimeVersion?: string;
520
+ };
521
+ type DefineSnapshotResult = {
522
+ ok: true;
523
+ snapshot: SnapshotEnvelope;
524
+ } | {
525
+ ok: false;
526
+ errors: SnapshotDiagnostic[];
527
+ };
528
+ type ParseSnapshotResult = {
529
+ ok: true;
530
+ snapshot: VersionedSnapshot;
531
+ } | {
532
+ ok: false;
533
+ errors: SnapshotDiagnostic[];
534
+ };
535
+ type ValidateSnapshotResult = {
536
+ ok: true;
537
+ snapshot: SnapshotEnvelope;
538
+ } | {
539
+ ok: false;
540
+ errors: SnapshotDiagnostic[];
541
+ };
542
+ declare function cloneSnapshotJson<T>(value: T): T;
543
+ /**
544
+ * True when `value` is the previous engine-owned blob, not an envelope.
545
+ * Envelopes are discriminated by `schemaVersion`.
546
+ */
547
+ declare function isLegacyCartStateBundle(value: unknown): value is CartStateBundle;
548
+ declare function isSnapshotEnvelope(value: unknown): value is SnapshotEnvelope;
549
+ declare function isVersionedSnapshot(value: unknown): value is VersionedSnapshot;
550
+ declare function detectSnapshotSchemaVersion(value: unknown): number | undefined;
551
+ declare function defineSnapshot(input: SnapshotEnvelopeInput): DefineSnapshotResult;
552
+ declare function snapshotFromCartBundle(bundle: CartStateBundle, extras?: ExportSnapshotOptions & {
553
+ rng?: RandomState;
554
+ clock?: SnapshotClock;
555
+ }): DefineSnapshotResult;
556
+ declare function parseSnapshot(input: SnapshotEnvelope | CartStateBundle | LegacySnapshot | string | unknown): ParseSnapshotResult;
557
+ declare function validateSnapshot(value: unknown): ValidateSnapshotResult;
558
+ declare function snapshotErrorsToMessage(errors: SnapshotDiagnostic[]): string;
559
+ declare function engineStateFromEnvelope(snapshot: SnapshotEnvelope): CartStateBundle;
560
+
409
561
  /**
410
562
  * Copyright (c) 2026 Aaron Boyarsky
411
563
  * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
@@ -617,6 +769,86 @@ declare function createFixtureAssetResolver(catalog: FixtureAssetCatalog): Asset
617
769
  declare function createHostedAssetResolver(options: HostedAssetResolverOptions): AssetResolver;
618
770
  declare function createAssetPreloader(options: CreateAssetPreloaderOptions): AssetPreloader;
619
771
 
772
+ declare const DEFAULT_DUCK_GAIN = 0.25;
773
+ type AudioUnlockState = 'locked' | 'unlocking' | 'unlocked' | 'failed';
774
+ type AudioUnlockStatus = {
775
+ state: AudioUnlockState;
776
+ error?: string;
777
+ };
778
+ type AudioAssetStatus = 'ready' | 'failed';
779
+ type AudioChannelInspect = {
780
+ id: string;
781
+ participantId?: string;
782
+ gain: number;
783
+ muted: boolean;
784
+ duckGain: number;
785
+ priority: number;
786
+ effectiveGain: number;
787
+ };
788
+ type AudioBrokerInspect = {
789
+ status: AudioUnlockStatus;
790
+ reducedSensory: boolean;
791
+ muted: boolean;
792
+ authorized: string[];
793
+ channels: AudioChannelInspect[];
794
+ assets: Record<string, AudioAssetStatus>;
795
+ };
796
+ type AudioBrokerNotice = {
797
+ type: 'asset';
798
+ id: string;
799
+ status: AudioAssetStatus;
800
+ } | {
801
+ type: 'teardown';
802
+ participantId: string;
803
+ } | {
804
+ type: 'mute';
805
+ } | {
806
+ type: 'destroy';
807
+ };
808
+ type AudioBrokerListener = (notice: AudioBrokerNotice) => void;
809
+ type ActiveAudioCue = {
810
+ idempotencyKey: string;
811
+ channelId: string;
812
+ participantId?: string;
813
+ priority: number;
814
+ };
815
+ type CreateAudioBrokerOptions = {
816
+ /**
817
+ * Called once on the first `unlock()`. Inject in tests. Default dynamically
818
+ * loads the Tone adapter (never a static `import 'tone'`).
819
+ */
820
+ toneStart?: () => Promise<void>;
821
+ /** Host reduced-sensory flag. Skips playback; cue events still record. */
822
+ reducedSensory?: boolean;
823
+ };
824
+ type AudioBroker = {
825
+ unlock(): Promise<AudioUnlockStatus>;
826
+ status(): AudioUnlockStatus;
827
+ authorize(participantId: string): void;
828
+ revoke(participantId: string): void;
829
+ isAuthorized(participantId: string | undefined): boolean;
830
+ setChannelGain(channelId: string, gain: number, participantId?: string): void;
831
+ setPriority(channelId: string, priority: number, participantId?: string): void;
832
+ mute(): void;
833
+ unmute(): void;
834
+ muteChannel(channelId: string, participantId?: string): void;
835
+ unmuteChannel(channelId: string): void;
836
+ duck(channelId: string, gain?: number): void;
837
+ unduck(channelId: string): void;
838
+ effectiveGain(channelId: string): number;
839
+ handleHostEvent(event: HostEvent): void;
840
+ assetStatus(id: string): AudioAssetStatus | undefined;
841
+ noteCueStarted(cue: ActiveAudioCue): void;
842
+ noteCueEnded(idempotencyKey: string): void;
843
+ teardown(participantId: string): void;
844
+ onNotice(listener: AudioBrokerListener): () => void;
845
+ inspect(): AudioBrokerInspect;
846
+ destroy(): void;
847
+ readonly reducedSensory: boolean;
848
+ readonly muted: boolean;
849
+ };
850
+ declare function createAudioBroker(options?: CreateAudioBrokerOptions): AudioBroker;
851
+
620
852
  /**
621
853
  * Copyright (c) 2026 Aaron Boyarsky
622
854
  * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
@@ -661,6 +893,22 @@ type CreateRuntimeOptions = {
661
893
  * scripted `{ type: 'asset' }` actions own delivery timing.
662
894
  */
663
895
  assets?: AssetRuntimeOptions;
896
+ /**
897
+ * Shared page-level unlock broker. Optional. Carts that only set
898
+ * `metadata.audio: 'tone'` keep the existing `start()` / `unlockAudio()`
899
+ * path when this is omitted.
900
+ */
901
+ audioBroker?: AudioBroker;
902
+ /**
903
+ * Runtime-group participant id to authorize on this runtime. Teardown of
904
+ * this id does not close Tone for remaining carts.
905
+ */
906
+ audioParticipantId?: string;
907
+ /**
908
+ * `'calculation'` skips canvas construction and paint. `getDefaultState`,
909
+ * `update`, and host-channel events still run. Default `'render'`.
910
+ */
911
+ kind?: CartKind;
664
912
  };
665
913
  type MountOptions<T = unknown> = {
666
914
  /** Boot overrides passed as `customState` into `getDefaultState`. Not a live-state replay. */
@@ -691,7 +939,12 @@ type CartHandle = {
691
939
  getCartState(): unknown;
692
940
  exportState(): Promise<CartStateBundle>;
693
941
  exportStateJSON(): Promise<string>;
694
- importState(bundle: CartStateBundle | string, extras?: {
942
+ importState(bundle: CartStateBundle | SnapshotEnvelope | string, extras?: {
943
+ framebuffer?: ImageData | null;
944
+ }): Promise<void>;
945
+ exportSnapshot(options?: ExportSnapshotOptions): Promise<SnapshotEnvelope>;
946
+ exportSnapshotJSON(options?: ExportSnapshotOptions): Promise<string>;
947
+ importSnapshot(input: SnapshotEnvelope | CartStateBundle | string, extras?: {
695
948
  framebuffer?: ImageData | null;
696
949
  }): Promise<void>;
697
950
  peekExportedFramebuffer(): ImageData | null;
@@ -732,6 +985,10 @@ type CyberArtRuntime = {
732
985
  * Survives cart remount; `destroy()` disposes it.
733
986
  */
734
987
  readonly assets: AssetPreloader | undefined;
988
+ /** Shared broker when `createRuntime({ audioBroker })` was set. */
989
+ readonly audioBroker: AudioBroker | undefined;
990
+ /** `'render'` (default) or `'calculation'` (no canvas / paint). */
991
+ readonly kind: CartKind;
735
992
  onError?: (error: unknown, info: FrameErrorInfo) => void;
736
993
  };
737
994
  declare function createRuntime(options: CreateRuntimeOptions): CyberArtRuntime;
@@ -749,7 +1006,7 @@ type ImportCartStateExtras = {
749
1006
  };
750
1007
  type CartStatePersister = {
751
1008
  exportState: () => Promise<CartStateBundle>;
752
- importState: (bundle: CartStateBundle | string, extras?: ImportCartStateExtras) => Promise<void>;
1009
+ importState: (bundle: CartStateBundle | SnapshotEnvelope | string, extras?: ImportCartStateExtras) => Promise<void>;
753
1010
  peekExportedFramebuffer?: () => ImageData | null;
754
1011
  /** Live token hash; used to look up a generative cart's per-hash save. */
755
1012
  peekSeed?: () => string | undefined;
@@ -783,6 +1040,53 @@ type CartStateHotkeyOptions = {
783
1040
  */
784
1041
  declare function registerCartStateHotkeys(keyboardManager: KeyboardManager, hostChannel: HostChannel, options?: CartStateHotkeyOptions): void;
785
1042
 
1043
+ /**
1044
+ * Copyright (c) 2026 Aaron Boyarsky
1045
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
1046
+ * See packages/engine/LICENSE
1047
+ *
1048
+ * Step-by-step snapshot migrations. The original object is never mutated.
1049
+ * Hosts own persistence; this registry only transforms envelopes in memory.
1050
+ */
1051
+
1052
+ type SnapshotMigration = {
1053
+ from: number;
1054
+ to: number;
1055
+ migrate: (snapshot: unknown) => unknown;
1056
+ };
1057
+ type SnapshotMigrationRegistry = {
1058
+ migrations: readonly SnapshotMigration[];
1059
+ get(from: number): SnapshotMigration | undefined;
1060
+ };
1061
+ type ApplySnapshotMigrationsResult = {
1062
+ ok: true;
1063
+ snapshot: SnapshotEnvelope;
1064
+ } | {
1065
+ ok: false;
1066
+ errors: SnapshotDiagnostic[];
1067
+ };
1068
+ type ResolveImportableCartStateResult = {
1069
+ ok: true;
1070
+ bundle: CartStateBundle;
1071
+ snapshot?: SnapshotEnvelope;
1072
+ } | {
1073
+ ok: false;
1074
+ errors: SnapshotDiagnostic[];
1075
+ };
1076
+ declare function createEngineSnapshotMigrations(): SnapshotMigration[];
1077
+ declare function createSnapshotMigrationRegistry(options?: {
1078
+ migrations?: SnapshotMigration[];
1079
+ }): SnapshotMigrationRegistry;
1080
+ declare function defaultSnapshotMigrationRegistry(): SnapshotMigrationRegistry;
1081
+ declare function applySnapshotMigrations(snapshot: unknown, registry?: SnapshotMigrationRegistry): ApplySnapshotMigrationsResult;
1082
+ /**
1083
+ * Detect envelope vs legacy cart bundle. Envelopes migrate first; raw
1084
+ * `CartStateBundle` objects pass through so existing exportState/importState
1085
+ * callers keep working.
1086
+ */
1087
+ declare function resolveImportableCartState(input: unknown, registry?: SnapshotMigrationRegistry): ResolveImportableCartStateResult;
1088
+ declare function restoreSnapshotFromUnknown(input: unknown, registry?: SnapshotMigrationRegistry): ApplySnapshotMigrationsResult;
1089
+
786
1090
  /**
787
1091
  * Copyright (c) 2026 Aaron Boyarsky
788
1092
  * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
@@ -1153,6 +1457,100 @@ declare function isCueLifecycleType(value: unknown): value is CueLifecycleType;
1153
1457
  declare function applyCueEasing(t: number, easing: CueEasing): number;
1154
1458
  declare function createPresentationTimeline(options?: CreatePresentationTimelineOptions): PresentationTimeline;
1155
1459
 
1460
+ /**
1461
+ * Copyright (c) 2026 Aaron Boyarsky
1462
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
1463
+ * See packages/engine/LICENSE
1464
+ *
1465
+ * Deterministic audio-cue timeline. Scheduling is frame-stepped via
1466
+ * `createPresentationTimeline`; PCM output is not part of the event trace.
1467
+ */
1468
+
1469
+ declare const AUDIO_CUE_SCHEDULED_EVENT: "audio.cue.scheduled";
1470
+ declare const AUDIO_CUE_STARTED_EVENT: "audio.cue.started";
1471
+ declare const AUDIO_CUE_SKIPPED_EVENT: "audio.cue.skipped";
1472
+ declare const AUDIO_CUE_FAILED_EVENT: "audio.cue.failed";
1473
+ declare const AUDIO_CUE_EVENTS: readonly ["audio.cue.scheduled", "audio.cue.started", "audio.cue.skipped", "audio.cue.failed"];
1474
+ type AudioCueEventType = (typeof AUDIO_CUE_EVENTS)[number];
1475
+ type AudioCueSkipReason = 'reduced-sensory' | 'muted' | 'unauthorized';
1476
+ type AudioCueFailReason = 'asset-failed' | 'torn-down' | 'invalid';
1477
+ type AudioCueReason = AudioCueSkipReason | AudioCueFailReason;
1478
+ type AudioCueSpec = CueSpec & {
1479
+ assetId: string;
1480
+ channelId?: string;
1481
+ participantId?: string;
1482
+ priority?: number;
1483
+ gain?: number;
1484
+ };
1485
+ type AudioCueView = CueView & {
1486
+ assetId: string;
1487
+ channelId: string;
1488
+ participantId?: string;
1489
+ priority: number;
1490
+ audioPhase: 'scheduled' | 'started' | 'skipped' | 'failed' | 'completed';
1491
+ };
1492
+ type AudioCueEvent = {
1493
+ type: AudioCueEventType;
1494
+ atFrame: number;
1495
+ name: string;
1496
+ idempotencyKey: string;
1497
+ assetId: string;
1498
+ channelId: string;
1499
+ participantId?: string;
1500
+ reason?: AudioCueReason;
1501
+ progress: number;
1502
+ };
1503
+ type AudioCueTimelineSnapshot = {
1504
+ frame: number;
1505
+ reducedSensory: boolean;
1506
+ cues: AudioCueView[];
1507
+ events: AudioCueEvent[];
1508
+ };
1509
+ type PlayAudioCueResult = {
1510
+ ok: true;
1511
+ cue: AudioCueView;
1512
+ } | {
1513
+ ok: false;
1514
+ reason: 'duplicate' | 'invalid';
1515
+ detail: string;
1516
+ };
1517
+ type CreateAudioCueTimelineOptions = {
1518
+ broker?: AudioBroker;
1519
+ reducedSensory?: boolean;
1520
+ originFrame?: number;
1521
+ };
1522
+ type AudioCueTimeline = {
1523
+ play(spec: AudioCueSpec): PlayAudioCueResult;
1524
+ step(frames?: number): AudioCueEvent[];
1525
+ cancel(idempotencyKey: string): boolean;
1526
+ reset(): void;
1527
+ snapshot(): AudioCueTimelineSnapshot;
1528
+ get(idempotencyKey: string): AudioCueView | undefined;
1529
+ dispose(): void;
1530
+ readonly frame: number;
1531
+ readonly reducedSensory: boolean;
1532
+ };
1533
+ type HeadlessAudioAdapter = {
1534
+ readonly broker: AudioBroker;
1535
+ readonly timeline: AudioCueTimeline;
1536
+ unlock(): Promise<AudioUnlockStatus>;
1537
+ play(spec: AudioCueSpec): PlayAudioCueResult;
1538
+ step(frames?: number): AudioCueEvent[];
1539
+ handleHostEvent(event: HostEvent): void;
1540
+ snapshot(): AudioCueTimelineSnapshot & {
1541
+ unlock: AudioUnlockStatus;
1542
+ muted: boolean;
1543
+ };
1544
+ destroy(): void;
1545
+ };
1546
+ declare function isAudioCueEventType(value: unknown): value is AudioCueEventType;
1547
+ declare function createAudioCueTimeline(options?: CreateAudioCueTimelineOptions): AudioCueTimeline;
1548
+ declare function scheduleAudioCue(timeline: AudioCueTimeline, spec: AudioCueSpec): PlayAudioCueResult;
1549
+ declare function createHeadlessAudioAdapter(options?: {
1550
+ reducedSensory?: boolean;
1551
+ originFrame?: number;
1552
+ }): HeadlessAudioAdapter;
1553
+
1156
1554
  /**
1157
1555
  * Copyright (c) 2026 Aaron Boyarsky
1158
1556
  * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
@@ -1175,6 +1573,8 @@ declare const CAPABILITY_BLEND_MODES: readonly ["source-over", "screen"];
1175
1573
  type CapabilityBlendMode = (typeof CAPABILITY_BLEND_MODES)[number];
1176
1574
  declare const CAPABILITY_CLEAR_POLICIES: readonly ["transparent", "opaque"];
1177
1575
  type CapabilityClearPolicy = (typeof CAPABILITY_CLEAR_POLICIES)[number];
1576
+ declare const CAPABILITY_CART_KINDS: readonly ["render", "calculation"];
1577
+ type CapabilityCartKind = (typeof CAPABILITY_CART_KINDS)[number];
1178
1578
  type CapabilityDiagnostic = {
1179
1579
  code: string;
1180
1580
  detail: string;
@@ -1207,6 +1607,14 @@ type CapabilityLayerRequirements = {
1207
1607
  compositor?: boolean;
1208
1608
  blend?: CapabilityBlendMode[];
1209
1609
  };
1610
+ /** Optional executable-module refs. Omitted on existing manifests. */
1611
+ type CapabilityModuleRef = {
1612
+ id: string;
1613
+ version: string;
1614
+ };
1615
+ type CapabilityModuleRequirements = {
1616
+ refs?: CapabilityModuleRef[];
1617
+ };
1210
1618
  type CapabilityManifest = {
1211
1619
  version: typeof CAPABILITY_MANIFEST_VERSION;
1212
1620
  id: string;
@@ -1220,6 +1628,9 @@ type CapabilityManifest = {
1220
1628
  integrations: CapabilityIntegration[];
1221
1629
  surface?: CapabilitySurfaceRequirements;
1222
1630
  layers?: CapabilityLayerRequirements;
1631
+ modules?: CapabilityModuleRequirements;
1632
+ /** Omitted means `'render'`. `'calculation'` carts have no surface. */
1633
+ kind?: CapabilityCartKind;
1223
1634
  };
1224
1635
  type CapabilityManifestInput = {
1225
1636
  version?: number;
@@ -1234,6 +1645,8 @@ type CapabilityManifestInput = {
1234
1645
  integrations: CapabilityIntegration[];
1235
1646
  surface?: CapabilitySurfaceRequirements;
1236
1647
  layers?: CapabilityLayerRequirements;
1648
+ modules?: CapabilityModuleRequirements;
1649
+ kind?: CapabilityCartKind;
1237
1650
  };
1238
1651
  type HostCapabilities = {
1239
1652
  contractVersion: number;
@@ -1246,6 +1659,9 @@ type HostCapabilities = {
1246
1659
  clearPolicy?: CapabilityClearPolicy | CapabilityClearPolicy[];
1247
1660
  };
1248
1661
  layers?: CapabilityLayerRequirements;
1662
+ modules?: CapabilityModuleRequirements;
1663
+ /** Cart kinds this host can run. Omitted: kind is not checked. */
1664
+ kinds?: CapabilityCartKind[];
1249
1665
  };
1250
1666
  type DefineCapabilityManifestResult = {
1251
1667
  ok: true;
@@ -1453,7 +1869,7 @@ declare function parseGeometry(json: string): GeometryDocument;
1453
1869
 
1454
1870
  declare const DEFAULT_GROUP_WIDTH = 320;
1455
1871
  declare const DEFAULT_GROUP_HEIGHT = 180;
1456
- type RuntimeGroupKind = 'render' | 'calculation';
1872
+ type RuntimeGroupKind = CartKind;
1457
1873
  /**
1458
1874
  * Optional capability-shaped attach hints. Explicit participant `emit` /
1459
1875
  * `subscribe` / `authoritative` win. Do not import the capability manifest
@@ -1471,7 +1887,7 @@ type RuntimeGroupFrameError = {
1471
1887
  type RuntimeGroupParticipantConfig<T = unknown> = {
1472
1888
  id: string;
1473
1889
  cart: AnimationCart<T>;
1474
- /** Rendered surface vs calculation cart (still a real `AnimationCart`). */
1890
+ /** Rendered surface vs calculation cart (update + events, no canvas / paint). */
1475
1891
  kind?: RuntimeGroupKind;
1476
1892
  seed?: CreateRuntimeOptions['seed'];
1477
1893
  container?: HTMLElement;
@@ -1498,6 +1914,8 @@ type CreateRuntimeGroupOptions = {
1498
1914
  router?: EventRouterOptions;
1499
1915
  /** Bound on the accepted-event trace (oldest dropped). Default 1024. */
1500
1916
  maxTrace?: number;
1917
+ /** Shared page-level audio unlock broker. Optional. */
1918
+ audioBroker?: AudioBroker;
1501
1919
  };
1502
1920
  type RuntimeGroupParticipantInspect = {
1503
1921
  state: unknown;
@@ -1533,6 +1951,7 @@ type RuntimeGroup = {
1533
1951
  readonly router: EventRouter;
1534
1952
  readonly origin: number;
1535
1953
  readonly paused: boolean;
1954
+ readonly audioBroker: AudioBroker | undefined;
1536
1955
  participant(id: string): RuntimeGroupParticipantHandle;
1537
1956
  step(frames?: number): Promise<void>;
1538
1957
  pause(): void;
@@ -1679,6 +2098,20 @@ type CompositorBlendMode = (typeof COMPOSITOR_BLEND_MODES)[number];
1679
2098
  declare const COMPOSITOR_CLEAR_POLICIES: readonly ["transparent", "opaque"];
1680
2099
  type CompositorClearPolicy = (typeof COMPOSITOR_CLEAR_POLICIES)[number];
1681
2100
  type CompositorPointerEvents = 'auto' | 'none';
2101
+ declare const COMPOSITOR_SOURCE_KINDS: readonly ["participant", "image", "canvas"];
2102
+ type CompositorSourceKind = (typeof COMPOSITOR_SOURCE_KINDS)[number];
2103
+ type CompositorParticipantSource = {
2104
+ kind: 'participant';
2105
+ };
2106
+ type CompositorImageSource = {
2107
+ kind: 'image';
2108
+ image: ImageData;
2109
+ };
2110
+ type CompositorCanvasSource = {
2111
+ kind: 'canvas';
2112
+ canvas: HTMLCanvasElement;
2113
+ };
2114
+ type CompositorLayerSource = CompositorParticipantSource | CompositorImageSource | CompositorCanvasSource;
1682
2115
  type CompositorClip = {
1683
2116
  x: number;
1684
2117
  y: number;
@@ -1694,6 +2127,11 @@ type CompositorLayerConfig = {
1694
2127
  clip?: CompositorClip;
1695
2128
  pointerEvents?: CompositorPointerEvents;
1696
2129
  clearPolicy?: CompositorClearPolicy;
2130
+ /**
2131
+ * Pixel source. Default `participant` reads the runtime-group canvas.
2132
+ * `image` / `canvas` swap atomically via `setLayer` / `addLayer`.
2133
+ */
2134
+ source?: CompositorLayerSource;
1697
2135
  };
1698
2136
  type CompositorLayerInspect = {
1699
2137
  id: string;
@@ -1704,6 +2142,7 @@ type CompositorLayerInspect = {
1704
2142
  clip: CompositorClip | null;
1705
2143
  pointerEvents: CompositorPointerEvents;
1706
2144
  clearPolicy: CompositorClearPolicy;
2145
+ sourceKind: CompositorSourceKind;
1707
2146
  };
1708
2147
  type CompositorHostOptions = {
1709
2148
  /** Back-layer pixels. Scaled nearest-neighbor to the compositor viewport. */
@@ -1762,6 +2201,7 @@ type Compositor = {
1762
2201
  */
1763
2202
  resize(width: number, height: number, dpr?: number): void;
1764
2203
  setLayer(id: string, patch: Partial<Omit<CompositorLayerConfig, 'id'>>): void;
2204
+ addLayer(config: CompositorLayerConfig): void;
1765
2205
  layer(id: string): CompositorLayerInspect;
1766
2206
  layers(): CompositorLayerInspect[];
1767
2207
  pointerTarget(x: number, y: number): string | undefined;
@@ -1771,6 +2211,253 @@ type Compositor = {
1771
2211
  };
1772
2212
  declare function createCompositor(options: CreateCompositorOptions): Compositor;
1773
2213
 
2214
+ declare const VISUAL_LAYER_SNAPSHOT_SCHEMA_VERSION: 1;
2215
+ declare const VISUAL_LAYER_KINDS: readonly ["layer", "mask", "sprite"];
2216
+ type VisualLayerKind = (typeof VISUAL_LAYER_KINDS)[number];
2217
+ declare const VISUAL_LAYER_TRANSITIONS: readonly ["show", "hide", "replace", "crossfade"];
2218
+ type VisualLayerTransitionKind = (typeof VISUAL_LAYER_TRANSITIONS)[number];
2219
+ declare const VISUAL_LAYER_INCOMING_SUFFIX: ":incoming";
2220
+ declare const VISUAL_LAYER_REVEALED_EVENT: "visual.layer.revealed";
2221
+ declare const VISUAL_LAYER_HIDDEN_EVENT: "visual.layer.hidden";
2222
+ declare const VISUAL_LAYER_TRANSITION_STARTED_EVENT: "visual.layer.transition-started";
2223
+ declare const VISUAL_LAYER_TRANSITION_COMPLETED_EVENT: "visual.layer.transition-completed";
2224
+ declare const VISUAL_LAYER_FAILED_EVENT: "visual.layer.failed";
2225
+ declare const VISUAL_LAYER_EVENTS: readonly ["visual.layer.revealed", "visual.layer.hidden", "visual.layer.transition-started", "visual.layer.transition-completed", "visual.layer.failed"];
2226
+ type VisualLayerEventType = (typeof VISUAL_LAYER_EVENTS)[number];
2227
+ declare const HOST_STATE_ACCEPTED_EVENT: "host.state.accepted";
2228
+ declare const VISUAL_LAYER_FAILURE_CODES: readonly ["asset-failed", "missing-source", "unknown-layer", "unknown-version", "invalid-snapshot"];
2229
+ type VisualLayerFailureCode = (typeof VISUAL_LAYER_FAILURE_CODES)[number];
2230
+ type VisualLayerAssetStatus = 'pending' | 'ready' | 'failed';
2231
+ type VisualLayerFallbackPolicy = 'keep-prior' | 'hide' | {
2232
+ version: string;
2233
+ };
2234
+ type VisualLayerVersionDeclaration = {
2235
+ id: string;
2236
+ assetId: string;
2237
+ provenance?: AssetProvenance;
2238
+ };
2239
+ type VisualLayerDeclaration = {
2240
+ id: string;
2241
+ kind: VisualLayerKind;
2242
+ versions: readonly VisualLayerVersionDeclaration[];
2243
+ initialVersion?: string;
2244
+ compositorLayerId?: string;
2245
+ incomingLayerId?: string;
2246
+ order?: number;
2247
+ blend?: CompositorBlendMode;
2248
+ clip?: CompositorClip;
2249
+ pointerEvents?: CompositorPointerEvents;
2250
+ clearPolicy?: CompositorClearPolicy;
2251
+ fallback?: VisualLayerFallbackPolicy;
2252
+ };
2253
+ type VisualLayerAcceptedBinding = {
2254
+ layerId: string;
2255
+ toVersion: string;
2256
+ kind?: VisualLayerTransitionKind;
2257
+ durationFrames?: number;
2258
+ delayFrames?: number;
2259
+ easing?: CueEasing;
2260
+ idempotencyKey?: string;
2261
+ };
2262
+ type VisualLayerCueSpec = CueSpec & {
2263
+ layerId: string;
2264
+ kind: VisualLayerTransitionKind;
2265
+ toVersion?: string;
2266
+ fromVersion?: string;
2267
+ };
2268
+ type VisualLayerTransitionInspect = {
2269
+ kind: VisualLayerTransitionKind;
2270
+ progress: number;
2271
+ fromVersion: string | null;
2272
+ toVersion: string | null;
2273
+ cueKey: string;
2274
+ startFrame: number;
2275
+ durationFrames: number;
2276
+ delayFrames: number;
2277
+ easing: CueEasing;
2278
+ };
2279
+ type VisualLayerInspect = {
2280
+ id: string;
2281
+ kind: VisualLayerKind;
2282
+ visible: boolean;
2283
+ activeVersion: string | null;
2284
+ pendingVersion: string | null;
2285
+ committedVersion: string | null;
2286
+ opacity: number;
2287
+ order: number;
2288
+ provenance: AssetProvenance | null;
2289
+ overrideVersion: string | null;
2290
+ transition: VisualLayerTransitionInspect | null;
2291
+ };
2292
+ type VisualLayerEvent = {
2293
+ type: VisualLayerEventType;
2294
+ atFrame: number;
2295
+ layerId: string;
2296
+ version?: string;
2297
+ kind?: VisualLayerTransitionKind;
2298
+ progress: number;
2299
+ code?: VisualLayerFailureCode;
2300
+ };
2301
+ type VisualLayerDiagnostic = {
2302
+ code: VisualLayerFailureCode;
2303
+ layerId: string;
2304
+ version?: string;
2305
+ assetId?: string;
2306
+ message: string;
2307
+ atFrame: number;
2308
+ failure?: AssetFailure;
2309
+ };
2310
+ type VisualLayerSnapshotRow = {
2311
+ id: string;
2312
+ kind: VisualLayerKind;
2313
+ visible: boolean;
2314
+ committedVersion: string | null;
2315
+ pendingVersion: string | null;
2316
+ activeVersion: string | null;
2317
+ opacity: number;
2318
+ order: number;
2319
+ overrideVersion: string | null;
2320
+ provenance: AssetProvenance | null;
2321
+ fallback: VisualLayerFallbackPolicy;
2322
+ transition: VisualLayerTransitionInspect | null;
2323
+ };
2324
+ type VisualLayerControllerSnapshot = {
2325
+ schemaVersion: typeof VISUAL_LAYER_SNAPSHOT_SCHEMA_VERSION;
2326
+ frame: number;
2327
+ sceneId: string | null;
2328
+ reducedMotion: boolean;
2329
+ layers: VisualLayerSnapshotRow[];
2330
+ assets: Record<string, VisualLayerAssetStatus>;
2331
+ events: VisualLayerEvent[];
2332
+ diagnostics: VisualLayerDiagnostic[];
2333
+ };
2334
+ type PlayVisualLayerResult = PlayCueResult;
2335
+ type RestoreVisualLayerResult = {
2336
+ ok: true;
2337
+ snapshot: VisualLayerControllerSnapshot;
2338
+ } | {
2339
+ ok: false;
2340
+ errors: VisualLayerDiagnostic[];
2341
+ };
2342
+ type CreateVisualLayerControllerOptions = {
2343
+ compositor: Compositor;
2344
+ layers: readonly VisualLayerDeclaration[];
2345
+ preloader?: AssetPreloader;
2346
+ originFrame?: number;
2347
+ reducedMotion?: boolean;
2348
+ sceneId?: string;
2349
+ fallback?: VisualLayerFallbackPolicy;
2350
+ onAccepted?: readonly VisualLayerAcceptedBinding[];
2351
+ dispatch?: (event: HostEvent) => void;
2352
+ };
2353
+ type VisualLayerController = {
2354
+ registerSource(assetId: string, source: ImageData | HTMLCanvasElement): void;
2355
+ handleHostEvent(event: HostEvent): void;
2356
+ override(layerId: string, version: string | null): void;
2357
+ play(spec: VisualLayerCueSpec): PlayVisualLayerResult;
2358
+ step(frames?: number): VisualLayerEvent[];
2359
+ snapshot(): VisualLayerControllerSnapshot;
2360
+ restore(input: unknown): RestoreVisualLayerResult;
2361
+ inspect(): VisualLayerInspect[];
2362
+ captureComposedFrame(): ComposedFrame;
2363
+ destroy(): void;
2364
+ readonly frame: number;
2365
+ readonly sceneId: string | null;
2366
+ readonly compositor: Compositor;
2367
+ };
2368
+ type VisualLayerCapture = {
2369
+ frame: ComposedFrame;
2370
+ layers: VisualLayerInspect[];
2371
+ };
2372
+ declare function isVisualLayerKind(value: unknown): value is VisualLayerKind;
2373
+ declare function isVisualLayerTransitionKind(value: unknown): value is VisualLayerTransitionKind;
2374
+ declare function isVisualLayerEventType(value: unknown): value is VisualLayerEventType;
2375
+ declare function visualIncomingLayerId(layerId: string): string;
2376
+ declare function captureVisualLayers(controller: VisualLayerController): VisualLayerCapture;
2377
+ declare function createVisualLayerController(options: CreateVisualLayerControllerOptions): VisualLayerController;
2378
+
2379
+ /**
2380
+ * Copyright (c) 2026 Aaron Boyarsky
2381
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2382
+ * See packages/engine/LICENSE
2383
+ *
2384
+ * Trusted, versioned executable-module host. Factories are registered by
2385
+ * exact id+version; the host allowlists which refs may load. Untrusted
2386
+ * source strings are not compiled. Per-module failures do not stop siblings.
2387
+ */
2388
+ declare const EXECUTABLE_MODULE_ERROR_CODES: readonly ["invalid-ref", "unknown-module", "version-mismatch", "not-allowlisted", "load-failed", "invoke-failed", "timeout", "rate-limited", "destroyed"];
2389
+ type ExecutableModuleErrorCode = (typeof EXECUTABLE_MODULE_ERROR_CODES)[number];
2390
+ type ExecutableModuleRef = {
2391
+ id: string;
2392
+ version: string;
2393
+ };
2394
+ type ExecutableModuleError = {
2395
+ code: ExecutableModuleErrorCode;
2396
+ detail: string;
2397
+ ref?: ExecutableModuleRef;
2398
+ };
2399
+ type ExecutableModuleDiagnostic = ExecutableModuleError;
2400
+ type ExecutableModuleCapabilities = {
2401
+ readonly [key: string]: unknown;
2402
+ };
2403
+ type ExecutableModuleInvokeContext = {
2404
+ signal: AbortSignal;
2405
+ turn: number;
2406
+ };
2407
+ type ExecutableModuleInstance = {
2408
+ invoke(input: unknown, context: ExecutableModuleInvokeContext): unknown | Promise<unknown>;
2409
+ destroy?: () => void;
2410
+ };
2411
+ type ExecutableModuleFactory = (capabilities: ExecutableModuleCapabilities) => ExecutableModuleInstance;
2412
+ type ExecutableModuleRegistration = {
2413
+ id: string;
2414
+ version: string;
2415
+ create: ExecutableModuleFactory;
2416
+ capabilities?: ExecutableModuleCapabilities;
2417
+ };
2418
+ type ExecutableModuleLimits = {
2419
+ /** Cooperative timeout; the invoke AbortSignal aborts after this many ms. */
2420
+ maxInvokeMs?: number;
2421
+ maxInvokesPerTurn?: number;
2422
+ };
2423
+ type CreateExecutableModuleHostOptions = {
2424
+ allowlist: readonly ExecutableModuleRef[];
2425
+ modules: readonly ExecutableModuleRegistration[];
2426
+ limits?: ExecutableModuleLimits;
2427
+ /** Default capability bag. Frozen per module; class instances stay shared handles. */
2428
+ capabilities?: ExecutableModuleCapabilities;
2429
+ };
2430
+ type ExecutableModuleInvokeResult = {
2431
+ ok: true;
2432
+ value: unknown;
2433
+ } | {
2434
+ ok: false;
2435
+ error: ExecutableModuleError;
2436
+ };
2437
+ type ExecutableModuleLoadResult = {
2438
+ ok: true;
2439
+ ref: ExecutableModuleRef;
2440
+ } | {
2441
+ ok: false;
2442
+ error: ExecutableModuleError;
2443
+ };
2444
+ type ExecutableModuleHostInspect = {
2445
+ allowlist: ExecutableModuleRef[];
2446
+ registered: ExecutableModuleRef[];
2447
+ loaded: ExecutableModuleRef[];
2448
+ turn: number;
2449
+ invokesThisTurn: number;
2450
+ diagnostics: ExecutableModuleDiagnostic[];
2451
+ };
2452
+ type ExecutableModuleHost = {
2453
+ load(ref: ExecutableModuleRef): ExecutableModuleLoadResult;
2454
+ invoke(ref: ExecutableModuleRef, input?: unknown): Promise<ExecutableModuleInvokeResult>;
2455
+ beginTurn(): void;
2456
+ inspect(): ExecutableModuleHostInspect;
2457
+ destroy(): void;
2458
+ };
2459
+ declare function createExecutableModuleHost(options: CreateExecutableModuleHostOptions): ExecutableModuleHost;
2460
+
1774
2461
  /**
1775
2462
  * Copyright (c) 2026 Aaron Boyarsky
1776
2463
  * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
@@ -1947,4 +2634,194 @@ type PlaywrightCompatibleAdapter = {
1947
2634
  };
1948
2635
  declare function createPlaywrightCompatibleAdapter(harness: BrowserHarness): PlaywrightCompatibleAdapter;
1949
2636
 
1950
- export { ANCHOR_ORIGINS, ASSET_FAILED_EVENT, ASSET_FAILURE_CODES, ASSET_KINDS, ASSET_READY_EVENT, type AnchorOrigin, type AnimationCart, type AnimationTiming, type AppliedAction, type AssetCorsMode, type AssetDeclaration, type AssetFailure, type AssetFailureCode, type AssetItemStatus, type AssetKind, type AssetPreloadSnapshot, type AssetPreloader, type AssetProvenance, type AssetResolveRequest, type AssetResolver, type AssetRuntimeOptions, type AttachOptions, type AttachPresentationAdapterOptions, type AudioLibraryId, type AudioLibrarySpec, type BoundReplaySession, type BrowserA11ySnapshot, type BrowserCompositorConfig, type BrowserHarness, type BrowserHarnessAction, type BrowserHarnessInspect, type BrowserHarnessMountContext, type BrowserHarnessRuntimeContext, type BrowserHarnessScreenshot, type BrowserHostSession, type BrowserInputModality, type BrowserReproductionMetadata, type BrowserViewport, CAPABILITY_ASSET_KINDS, CAPABILITY_BLEND_MODES, CAPABILITY_CLEAR_POLICIES, CAPABILITY_INTEGRATIONS, CAPABILITY_MANAGERS, CAPABILITY_MANIFEST_VERSION, CAPABILITY_PHASES, COMPOSITOR_BLEND_MODES, COMPOSITOR_CLEAR_POLICIES, COORDINATE_SPACES, CUE_CANCELLED_EVENT, CUE_COMPLETED_EVENT, CUE_LIFECYCLE_EVENTS, CUE_REPLACED_EVENT, CUE_STARTED_EVENT, CYBERART_CANVAS_ATTR, type CapabilityAssetDeclarationSummary, type CapabilityAssetKind, type CapabilityAssetSummary, type CapabilityBlendMode, type CapabilityClearPolicy, type CapabilityDiagnostic, type CapabilityIntegration, type CapabilityLayerRequirements, type CapabilityManager, type CapabilityManifest, type CapabilityManifestInput, type CapabilityPermissions, type CapabilityPhase, type CapabilityRuntime, type CapabilitySurfaceRequirements, type CartHandle, type CartSnapshot, type CartStateBundle, type CartStateHotkeyOptions, type CartStateMessageHandler, type CartStatePersister, type CausationTreeNode, type Clock, type ClockSnapshot, type ComposedFrame, type Compositor, type CompositorBlendMode, type CompositorClearPolicy, type CompositorClip, type CompositorHostOptions, type CompositorInspect, type CompositorLayerConfig, type CompositorLayerInspect, type CompositorPointerEvents, type ContractDiagnostic, type ContractFieldType, type ContractRegistry, type CoordinateSpace, type CreateAssetPreloaderOptions, type CreateBrowserHarnessOptions, type CreateCompositorOptions, type CreatePresentationLayoutInput, type CreatePresentationTimelineOptions, type CreateReplayInspectorOptions, type CreateRuntimeGroupOptions, type CreateRuntimeOptions, type CueDuplicatePolicy, type CueEasing, type CueLifecycleEvent, type CueLifecycleType, type CuePhase, type CueReducedMotionPolicy, type CueRepeatPolicy, type CueSpec, type CueTimelineSnapshot, type CueView, type CyberArtRuntime, DEFAULT_BROWSER_VIEWPORT, DEFAULT_GROUP_HEIGHT, DEFAULT_GROUP_WIDTH, DEFAULT_MAX_HOPS, DEFAULT_MAX_INSPECTOR_RECORDS, type DebugDrawCall, type DefineCapabilityManifestResult, type DefineContractResult, type DeterministicRuntimeOptions, type DimensionContext, EVENT_ENVELOPE_VERSION, type EventContract, type EventContractManifest, type EventEnvelope, type EventInput, type EventKind, type EventRouter, type EventRouterOptions, type FixtureAssetCatalog, type FixtureAssetRecord, type FrameErrorInfo, GEOMETRY_CONTRACT_VERSION, type GeometryAnchor, type GeometryDebugContext, type GeometryDiagnostic, type GeometryDocument, type GeometryHitbox, type GeometryPadding, type GeometrySafeArea, type GeometryValidation, type HostCapabilities, HostChannel, type HostEvent, type HostEventListener, type HostedAssetResolverOptions, INVALID_PRESENTATION_MODEL_MESSAGE, type ImportCartStateExtras, IncompatibleCartStateError, type InferredPayload, type InspectorRecord, KeyboardManager, type LandmarkRegisterResult, type LandmarkRegistry, type MountOptions, type MountPresentationAdapterOptions, type NormalizeContext, type NormalizeResult, type NormalizedPoint, type NormalizedPolygon, type NormalizedRect, PRESENTATION_ADAPTER_VERSION, PRESENTATION_MODEL_EVENT, PRESENTATION_PHASES, PRESENTATION_SUBSCRIBE_PATTERNS, PRESENTATION_UNSUPPORTED_EVENT, type PayloadFieldSpec, type PayloadSchema, type PayloadValidation, type PixelPoint, type PixelRect, type PlayCueResult, type PlaywrightCompatibleAdapter, type PlaywrightCompatibleViewport, type PointerClick, PointerManager, type PointerSpace, type PresentationAdapter, type PresentationAdapterTarget, type PresentationCartState, type PresentationFitMode, type PresentationLayout, type PresentationModel, type PresentationPhase, type PresentationRegion, type PresentationTimeline, type PresentationView, type PublishExtras, REDACTED_VALUE, REJECTED_EVENT_TYPE, REPLAY_INSPECTOR_SCHEMA_VERSION, ROUND_TRIP_TOLERANCE, ROUND_TRIP_TOLERANCE_CANVAS_PX, Random, type RandomState, type RejectionPayload, type RejectionReason, type ReplayCompareResult, type ReplayInspector, type ReplayInspectorExport, type ReplayInspectorReport, type ReplayMetadata, type ReplayParticipantSummary, type ReplayTapeAction, type ReplayTraceFilter, type ResolvedAsset, type RouterDecision, type RouterDecisionOutcome, type RouterDecisionReason, type RouterParticipantInspect, type RuntimeGroup, type RuntimeGroupCapability, type RuntimeGroupDiagnostics, type RuntimeGroupFrameError, type RuntimeGroupInspect, type RuntimeGroupKind, type RuntimeGroupParticipantConfig, type RuntimeGroupParticipantHandle, type RuntimeGroupParticipantInspect, SILENT_ASSET_FALLBACK_REF, type SchemaCompatibility, type ScriptedAction, type TokenData, type ValidateCapabilityManifestResult, type ValidateResult, type VirtualClock, applyCueEasing, assetStatusEvent, assetToNormalized, attachCartStatePersistence, attachPresentationAdapter, canonicalizeSeed, canvasToCss, canvasToNormalized, toJSON as capabilityManifestToJSON, comparePayloadSchemas, compareReplayTraces, createAssetFailure, createAssetPreloader, createBrowserHarness, createCompositor, createContractRegistry, createEventRouter, createFixtureAssetResolver, createHostedAssetResolver, createLandmarkRegistry, createPlaywrightCompatibleAdapter, createPresentationLayout, createPresentationModelEvent, createPresentationTimeline, createReferencePresentationCart, createReplayInspector, createRuntime, createRuntimeGroup, createVirtualClock, createWallClock, cssToCanvas, cssToNormalized, defineCapabilityManifest, defineDiagnostic, defineIntent, defineStateEvent, deriveAttachOptions, describeReplayMismatch, drawGeometryDebug, familyPatternForType, inferEventKind, isAssetFailure, isAssetFailureCode, isAssetKind, isCueLifecycleType, isPresentationModel, isPresentationPhase, kindSegmentInType, matchEventPattern, mountPresentationAdapter, normalizeEvent, normalizedToAsset, normalizedToCanvas, normalizedToCss, parseCapabilityManifest, parseGeometry, pointFromOrigin, pointerToRegion, rectToCanvas, rectToCss, regionToViewport, registerCartStateHotkeys, replayExportedTrace, resolveRuntimeSeed, rewriteHostedAssetRef, serializeGeometry, validateCapabilityManifest, validateGeometry, verifyAttachOptions };
2637
+ /**
2638
+ * Copyright (c) 2026 Aaron Boyarsky
2639
+ * SPDX-License-Identifier: LicenseRef-CyberArt-Engine
2640
+ * See packages/engine/LICENSE
2641
+ *
2642
+ * Host-owned MIDI controller I/O. Carts and hosts construct MidiManager;
2643
+ * the runtime does not pass it into getDefaultState. Live Web MIDI is
2644
+ * optional — inject and send work in headless/jsdom through a test port.
2645
+ */
2646
+ /** Note Off command nibble (status = this | channel). */
2647
+ declare const MIDI_NOTE_OFF = 128;
2648
+ /** Note On command nibble (status = this | channel). */
2649
+ declare const MIDI_NOTE_ON = 144;
2650
+ /** Control Change command nibble (status = this | channel). */
2651
+ declare const MIDI_CONTROL_CHANGE = 176;
2652
+ /** Pitch Bend command nibble (status = this | channel). */
2653
+ declare const MIDI_PITCH_BEND = 224;
2654
+ declare const MIDI_CHANNEL_MIN = 0;
2655
+ declare const MIDI_CHANNEL_MAX = 15;
2656
+ declare const MIDI_DATA_MAX = 127;
2657
+ declare const MIDI_PITCH_CENTER = 8192;
2658
+ declare const MIDI_PITCH_MAX = 16383;
2659
+ /** Channel index 0–15 (MIDI channels 1–16). */
2660
+ type MidiChannel = number;
2661
+ /** Channel-voice status byte: command in the high nibble, channel 0–15 in the low. */
2662
+ type MidiStatusByte = number;
2663
+ type MidiNoteMessage = {
2664
+ kind: 'noteon' | 'noteoff';
2665
+ channel: number;
2666
+ note: number;
2667
+ velocity: number;
2668
+ status: MidiStatusByte;
2669
+ data: Uint8Array;
2670
+ };
2671
+ type MidiCcMessage = {
2672
+ kind: 'cc';
2673
+ channel: number;
2674
+ controller: number;
2675
+ value: number;
2676
+ status: MidiStatusByte;
2677
+ data: Uint8Array;
2678
+ };
2679
+ type MidiPitchMessage = {
2680
+ kind: 'pitch';
2681
+ channel: number;
2682
+ /** 14-bit pitch bend, 0–16383. Center is 8192. */
2683
+ value: number;
2684
+ status: MidiStatusByte;
2685
+ data: Uint8Array;
2686
+ };
2687
+ type MidiRawMessage = {
2688
+ kind: 'raw';
2689
+ channel?: number;
2690
+ status: MidiStatusByte;
2691
+ data: Uint8Array;
2692
+ };
2693
+ type MidiMessage = MidiNoteMessage | MidiCcMessage | MidiPitchMessage | MidiRawMessage;
2694
+ type MidiVoiceInput = {
2695
+ kind: 'noteon' | 'noteoff';
2696
+ channel: number;
2697
+ note: number;
2698
+ velocity?: number;
2699
+ } | {
2700
+ kind: 'cc';
2701
+ channel: number;
2702
+ controller: number;
2703
+ value: number;
2704
+ } | {
2705
+ kind: 'pitch';
2706
+ channel: number;
2707
+ value: number;
2708
+ };
2709
+ type MidiInjectInput = MidiVoiceInput | MidiMessage | Uint8Array | readonly number[];
2710
+ type MidiSubscribeKind = 'note' | 'cc' | 'pitch' | 'raw' | '*';
2711
+ type MidiSubscribeListener = (message: MidiMessage) => void;
2712
+ type MidiOutputPort = {
2713
+ send(data: number[], timestamp?: number): void;
2714
+ };
2715
+ type MidiInputLike = {
2716
+ addEventListener(type: string, listener: (event: Event | {
2717
+ data?: Uint8Array | null;
2718
+ }) => void): void;
2719
+ removeEventListener(type: string, listener: (event: Event | {
2720
+ data?: Uint8Array | null;
2721
+ }) => void): void;
2722
+ };
2723
+ type MidiAccessLike = {
2724
+ readonly inputs: {
2725
+ forEach(callback: (input: MidiInputLike) => void): void;
2726
+ };
2727
+ readonly outputs: {
2728
+ forEach(callback: (output: MidiOutputPort) => void): void;
2729
+ };
2730
+ readonly sysexEnabled: boolean;
2731
+ addEventListener?(type: string, listener: EventListener): void;
2732
+ removeEventListener?(type: string, listener: EventListener): void;
2733
+ };
2734
+ type MidiRequestAccess = (options?: {
2735
+ sysex?: boolean;
2736
+ }) => Promise<MidiAccessLike>;
2737
+ type MidiAccessFailureReason = 'unavailable' | 'denied' | 'destroyed';
2738
+ type MidiAccessResult = {
2739
+ ok: true;
2740
+ inputs: number;
2741
+ outputs: number;
2742
+ sysexEnabled: boolean;
2743
+ } | {
2744
+ ok: false;
2745
+ reason: MidiAccessFailureReason;
2746
+ detail?: string;
2747
+ };
2748
+ type MidiSendFailureReason = 'no-port' | 'invalid' | 'destroyed';
2749
+ type MidiSendResult = {
2750
+ ok: true;
2751
+ data: Uint8Array;
2752
+ } | {
2753
+ ok: false;
2754
+ reason: MidiSendFailureReason;
2755
+ detail?: string;
2756
+ };
2757
+ type MidiManagerOptions = {
2758
+ /** Fake or real output. Tests pass a recording port. */
2759
+ output?: MidiOutputPort;
2760
+ /**
2761
+ * Override Web MIDI request. Tests inject a fake or a rejecting
2762
+ * function. When omitted, uses `navigator.requestMIDIAccess`.
2763
+ */
2764
+ requestMIDIAccess?: MidiRequestAccess;
2765
+ };
2766
+ declare function isMidiChannel(value: unknown): value is number;
2767
+ declare function isMidiData(value: unknown): value is number;
2768
+ declare function midiStatus(command: number, channel: number): MidiStatusByte;
2769
+ declare function midiChannelFromStatus(status: MidiStatusByte): number;
2770
+ declare function encodeMidiMessage(input: MidiVoiceInput): Uint8Array | undefined;
2771
+ declare function parseMidiBytes(data: Uint8Array | readonly number[]): MidiMessage | undefined;
2772
+ /**
2773
+ * Live MIDI in and out for a host or cart. Missing Web MIDI or a denied
2774
+ * permission is a structured result — constructing this never throws.
2775
+ */
2776
+ declare class MidiManager {
2777
+ private output;
2778
+ private readonly outputOwned;
2779
+ private adoptedHardwareOutput;
2780
+ private readonly requestMIDIAccess;
2781
+ private listeners;
2782
+ private readonly attachedInputs;
2783
+ private access;
2784
+ private inputCount;
2785
+ private outputCount;
2786
+ private destroyed;
2787
+ constructor(options?: MidiManagerOptions);
2788
+ /**
2789
+ * Subscribe to parsed inbound messages. `note` matches note-on and
2790
+ * note-off. Returns an unsubscribe function.
2791
+ */
2792
+ subscribe(kind: MidiSubscribeKind, listener: MidiSubscribeListener): () => void;
2793
+ /**
2794
+ * Deliver a message without Web MIDI hardware. Deterministic hosts and
2795
+ * tests call this instead of waiting on a controller.
2796
+ */
2797
+ inject(input: MidiInjectInput): void;
2798
+ sendNoteOn(channel: number, note: number, velocity?: number): MidiSendResult;
2799
+ sendNoteOff(channel: number, note: number, velocity?: number): MidiSendResult;
2800
+ sendCc(channel: number, controller: number, value: number): MidiSendResult;
2801
+ sendPitch(channel: number, value: number): MidiSendResult;
2802
+ /** Send raw bytes through the output port. */
2803
+ send(data: Uint8Array | readonly number[]): MidiSendResult;
2804
+ /**
2805
+ * Wrap `navigator.requestMIDIAccess` when present. Missing API or a
2806
+ * denied permission returns `{ ok: false }` — it does not throw.
2807
+ */
2808
+ requestAccess(options?: {
2809
+ sysex?: boolean;
2810
+ }): Promise<MidiAccessResult>;
2811
+ /**
2812
+ * Remove hardware listeners and subscribers. Idempotent. Further inject
2813
+ * is a no-op; send / requestAccess return `{ reason: 'destroyed' }`.
2814
+ */
2815
+ destroy(): void;
2816
+ private sendEncoded;
2817
+ private write;
2818
+ private dispatch;
2819
+ private deliverBytes;
2820
+ private onHardwareMessage;
2821
+ private onAccessStateChange;
2822
+ private attachAccess;
2823
+ private syncPorts;
2824
+ private detachHardware;
2825
+ }
2826
+
2827
+ export { ANCHOR_ORIGINS, ASSET_FAILED_EVENT, ASSET_FAILURE_CODES, ASSET_KINDS, ASSET_READY_EVENT, AUDIO_CUE_EVENTS, AUDIO_CUE_FAILED_EVENT, AUDIO_CUE_SCHEDULED_EVENT, AUDIO_CUE_SKIPPED_EVENT, AUDIO_CUE_STARTED_EVENT, type ActiveAudioCue, type AnchorOrigin, type AnimationCart, type AnimationTiming, type AppliedAction, type ApplySnapshotMigrationsResult, type AssetCorsMode, type AssetDeclaration, type AssetFailure, type AssetFailureCode, type AssetItemStatus, type AssetKind, type AssetPreloadSnapshot, type AssetPreloader, type AssetProvenance, type AssetResolveRequest, type AssetResolver, type AssetRuntimeOptions, type AttachOptions, type AttachPresentationAdapterOptions, type AudioAssetStatus, type AudioBroker, type AudioBrokerInspect, type AudioBrokerListener, type AudioBrokerNotice, type AudioChannelInspect, type AudioCueEvent, type AudioCueEventType, type AudioCueFailReason, type AudioCueReason, type AudioCueSkipReason, type AudioCueSpec, type AudioCueTimeline, type AudioCueTimelineSnapshot, type AudioCueView, type AudioLibraryId, type AudioLibrarySpec, type AudioUnlockState, type AudioUnlockStatus, type BoundReplaySession, type BrowserA11ySnapshot, type BrowserCompositorConfig, type BrowserHarness, type BrowserHarnessAction, type BrowserHarnessInspect, type BrowserHarnessMountContext, type BrowserHarnessRuntimeContext, type BrowserHarnessScreenshot, type BrowserHostSession, type BrowserInputModality, type BrowserReproductionMetadata, type BrowserViewport, CAPABILITY_ASSET_KINDS, CAPABILITY_BLEND_MODES, CAPABILITY_CART_KINDS, CAPABILITY_CLEAR_POLICIES, CAPABILITY_INTEGRATIONS, CAPABILITY_MANAGERS, CAPABILITY_MANIFEST_VERSION, CAPABILITY_PHASES, COMPOSITOR_BLEND_MODES, COMPOSITOR_CLEAR_POLICIES, COMPOSITOR_SOURCE_KINDS, COORDINATE_SPACES, CUE_CANCELLED_EVENT, CUE_COMPLETED_EVENT, CUE_LIFECYCLE_EVENTS, CUE_REPLACED_EVENT, CUE_STARTED_EVENT, CYBERART_CANVAS_ATTR, type CapabilityAssetDeclarationSummary, type CapabilityAssetKind, type CapabilityAssetSummary, type CapabilityBlendMode, type CapabilityCartKind, type CapabilityClearPolicy, type CapabilityDiagnostic, type CapabilityIntegration, type CapabilityLayerRequirements, type CapabilityManager, type CapabilityManifest, type CapabilityManifestInput, type CapabilityModuleRef, type CapabilityModuleRequirements, type CapabilityPermissions, type CapabilityPhase, type CapabilityRuntime, type CapabilitySurfaceRequirements, type CartHandle, type CartKind, type CartSnapshot, type CartStateBundle, type CartStateHotkeyOptions, type CartStateMessageHandler, type CartStatePersister, type CausationTreeNode, type Clock, type ClockSnapshot, type ComposedFrame, type Compositor, type CompositorBlendMode, type CompositorCanvasSource, type CompositorClearPolicy, type CompositorClip, type CompositorHostOptions, type CompositorImageSource, type CompositorInspect, type CompositorLayerConfig, type CompositorLayerInspect, type CompositorLayerSource, type CompositorParticipantSource, type CompositorPointerEvents, type CompositorSourceKind, type ContractDiagnostic, type ContractFieldType, type ContractRegistry, type CoordinateSpace, type CreateAssetPreloaderOptions, type CreateAudioBrokerOptions, type CreateAudioCueTimelineOptions, type CreateBrowserHarnessOptions, type CreateCompositorOptions, type CreateExecutableModuleHostOptions, type CreatePresentationLayoutInput, type CreatePresentationTimelineOptions, type CreateReplayInspectorOptions, type CreateRuntimeGroupOptions, type CreateRuntimeOptions, type CreateVisualLayerControllerOptions, type CueDuplicatePolicy, type CueEasing, type CueLifecycleEvent, type CueLifecycleType, type CuePhase, type CueReducedMotionPolicy, type CueRepeatPolicy, type CueSpec, type CueTimelineSnapshot, type CueView, type CyberArtRuntime, DEFAULT_BROWSER_VIEWPORT, DEFAULT_DUCK_GAIN, DEFAULT_GROUP_HEIGHT, DEFAULT_GROUP_WIDTH, DEFAULT_MAX_HOPS, DEFAULT_MAX_INSPECTOR_RECORDS, type DebugDrawCall, type DefineCapabilityManifestResult, type DefineContractResult, type DefineSnapshotResult, type DeterministicRuntimeOptions, type DimensionContext, ENGINE_SNAPSHOT_RUNTIME, EVENT_ENVELOPE_VERSION, EXECUTABLE_MODULE_ERROR_CODES, type EventContract, type EventContractManifest, type EventEnvelope, type EventInput, type EventKind, type EventRouter, type EventRouterOptions, type ExecutableModuleCapabilities, type ExecutableModuleDiagnostic, type ExecutableModuleError, type ExecutableModuleErrorCode, type ExecutableModuleFactory, type ExecutableModuleHost, type ExecutableModuleHostInspect, type ExecutableModuleInstance, type ExecutableModuleInvokeContext, type ExecutableModuleInvokeResult, type ExecutableModuleLimits, type ExecutableModuleLoadResult, type ExecutableModuleRef, type ExecutableModuleRegistration, type ExportSnapshotOptions, type FixtureAssetCatalog, type FixtureAssetRecord, type FrameErrorInfo, GEOMETRY_CONTRACT_VERSION, type GeometryAnchor, type GeometryDebugContext, type GeometryDiagnostic, type GeometryDocument, type GeometryHitbox, type GeometryPadding, type GeometrySafeArea, type GeometryValidation, HOST_STATE_ACCEPTED_EVENT, type HeadlessAudioAdapter, type HostCapabilities, HostChannel, type HostEvent, type HostEventListener, type HostedAssetResolverOptions, INVALID_PRESENTATION_MODEL_MESSAGE, type ImportCartStateExtras, IncompatibleCartStateError, type InferredPayload, type InspectorRecord, KeyboardManager, LEGACY_SNAPSHOT_SCHEMA_VERSION, type LandmarkRegisterResult, type LandmarkRegistry, type LegacySnapshot, MIDI_CHANNEL_MAX, MIDI_CHANNEL_MIN, MIDI_CONTROL_CHANGE, MIDI_DATA_MAX, MIDI_NOTE_OFF, MIDI_NOTE_ON, MIDI_PITCH_BEND, MIDI_PITCH_CENTER, MIDI_PITCH_MAX, type MidiAccessFailureReason, type MidiAccessLike, type MidiAccessResult, type MidiCcMessage, type MidiChannel, type MidiInjectInput, type MidiInputLike, MidiManager, type MidiManagerOptions, type MidiMessage, type MidiNoteMessage, type MidiOutputPort, type MidiPitchMessage, type MidiRawMessage, type MidiRequestAccess, type MidiSendFailureReason, type MidiSendResult, type MidiStatusByte, type MidiSubscribeKind, type MidiSubscribeListener, type MidiVoiceInput, type MountOptions, type MountPresentationAdapterOptions, type NormalizeContext, type NormalizeResult, type NormalizedPoint, type NormalizedPolygon, type NormalizedRect, PRESENTATION_ADAPTER_VERSION, PRESENTATION_MODEL_EVENT, PRESENTATION_PHASES, PRESENTATION_SUBSCRIBE_PATTERNS, PRESENTATION_UNSUPPORTED_EVENT, type ParseSnapshotResult, type PayloadFieldSpec, type PayloadSchema, type PayloadValidation, type PixelPoint, type PixelRect, type PlayAudioCueResult, type PlayCueResult, type PlayVisualLayerResult, type PlaywrightCompatibleAdapter, type PlaywrightCompatibleViewport, type PointerClick, PointerManager, type PointerSpace, type PresentationAdapter, type PresentationAdapterTarget, type PresentationCartState, type PresentationFitMode, type PresentationLayout, type PresentationModel, type PresentationPhase, type PresentationRegion, type PresentationTimeline, type PresentationView, type PublishExtras, REDACTED_VALUE, REJECTED_EVENT_TYPE, REPLAY_INSPECTOR_SCHEMA_VERSION, ROUND_TRIP_TOLERANCE, ROUND_TRIP_TOLERANCE_CANVAS_PX, Random, type RandomState, type RejectionPayload, type RejectionReason, type ReplayCompareResult, type ReplayInspector, type ReplayInspectorExport, type ReplayInspectorReport, type ReplayMetadata, type ReplayParticipantSummary, type ReplayTapeAction, type ReplayTraceFilter, type ResolveImportableCartStateResult, type ResolvedAsset, type RestoreVisualLayerResult, type RouterDecision, type RouterDecisionOutcome, type RouterDecisionReason, type RouterParticipantInspect, type RuntimeGroup, type RuntimeGroupCapability, type RuntimeGroupDiagnostics, type RuntimeGroupFrameError, type RuntimeGroupInspect, type RuntimeGroupKind, type RuntimeGroupParticipantConfig, type RuntimeGroupParticipantHandle, type RuntimeGroupParticipantInspect, SILENT_ASSET_FALLBACK_REF, SNAPSHOT_SCHEMA_VERSION, type SchemaCompatibility, type ScriptedAction, type SnapshotAssetRef, type SnapshotCartRef, type SnapshotClock, type SnapshotDiagnostic, type SnapshotEnvelope, type SnapshotEnvelopeInput, type SnapshotIntegrity, type SnapshotMigration, type SnapshotMigrationRegistry, type SnapshotModuleRef, type SnapshotProvenance, type TokenData, UNVERSIONED_CART_VERSION, VISUAL_LAYER_EVENTS, VISUAL_LAYER_FAILED_EVENT, VISUAL_LAYER_FAILURE_CODES, VISUAL_LAYER_HIDDEN_EVENT, VISUAL_LAYER_INCOMING_SUFFIX, VISUAL_LAYER_KINDS, VISUAL_LAYER_REVEALED_EVENT, VISUAL_LAYER_SNAPSHOT_SCHEMA_VERSION, VISUAL_LAYER_TRANSITIONS, VISUAL_LAYER_TRANSITION_COMPLETED_EVENT, VISUAL_LAYER_TRANSITION_STARTED_EVENT, type ValidateCapabilityManifestResult, type ValidateResult, type ValidateSnapshotResult, type VersionedSnapshot, type VirtualClock, type VisualLayerAcceptedBinding, type VisualLayerAssetStatus, type VisualLayerCapture, type VisualLayerController, type VisualLayerControllerSnapshot, type VisualLayerCueSpec, type VisualLayerDeclaration, type VisualLayerDiagnostic, type VisualLayerEvent, type VisualLayerEventType, type VisualLayerFailureCode, type VisualLayerFallbackPolicy, type VisualLayerInspect, type VisualLayerKind, type VisualLayerSnapshotRow, type VisualLayerTransitionInspect, type VisualLayerTransitionKind, type VisualLayerVersionDeclaration, applyCueEasing, applySnapshotMigrations, assetStatusEvent, assetToNormalized, attachCartStatePersistence, attachPresentationAdapter, canonicalizeSeed, canvasToCss, canvasToNormalized, toJSON as capabilityManifestToJSON, captureVisualLayers, cloneSnapshotJson, comparePayloadSchemas, compareReplayTraces, createAssetFailure, createAssetPreloader, createAudioBroker, createAudioCueTimeline, createBrowserHarness, createCompositor, createContractRegistry, createEngineSnapshotMigrations, createEventRouter, createExecutableModuleHost, createFixtureAssetResolver, createHeadlessAudioAdapter, createHostedAssetResolver, createLandmarkRegistry, createPlaywrightCompatibleAdapter, createPresentationLayout, createPresentationModelEvent, createPresentationTimeline, createReferencePresentationCart, createReplayInspector, createRuntime, createRuntimeGroup, createSnapshotMigrationRegistry, createVirtualClock, createVisualLayerController, createWallClock, cssToCanvas, cssToNormalized, defaultSnapshotMigrationRegistry, defineCapabilityManifest, defineDiagnostic, defineIntent, defineSnapshot, defineStateEvent, deriveAttachOptions, describeReplayMismatch, detectSnapshotSchemaVersion, drawGeometryDebug, encodeMidiMessage, engineStateFromEnvelope, familyPatternForType, inferEventKind, isAssetFailure, isAssetFailureCode, isAssetKind, isAudioCueEventType, isCueLifecycleType, isLegacyCartStateBundle, isMidiChannel, isMidiData, isPresentationModel, isPresentationPhase, isSnapshotEnvelope, isVersionedSnapshot, isVisualLayerEventType, isVisualLayerKind, isVisualLayerTransitionKind, kindSegmentInType, matchEventPattern, midiChannelFromStatus, midiStatus, mountPresentationAdapter, normalizeEvent, normalizedToAsset, normalizedToCanvas, normalizedToCss, parseCapabilityManifest, parseGeometry, parseMidiBytes, parseSnapshot, pointFromOrigin, pointerToRegion, rectToCanvas, rectToCss, regionToViewport, registerCartStateHotkeys, replayExportedTrace, resolveImportableCartState, resolveRuntimeSeed, restoreSnapshotFromUnknown, rewriteHostedAssetRef, scheduleAudioCue, serializeGeometry, snapshotErrorsToMessage, snapshotFromCartBundle, validateCapabilityManifest, validateGeometry, validateSnapshot, verifyAttachOptions, visualIncomingLayerId };