@noya-app/noya-multiplayer-react 0.1.88 → 0.2.0

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.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _noya_app_state_manager from '@noya-app/state-manager';
2
- import { AIToolDefinition, UserManager, SharedConnectionDataManager, NoyaManager, StateManagerOptions, StateManager, NoyaManagerOptions, SyncAdapter, TSchema, AccessType, PolicyAuthContext, LocalStorageSyncOptions, Static, ExtractRequestBody, PublishCallback, ResourceManager, TranscriptionManager, AssetTranscriptionResult, StreamFilter, ActivityEventsManager, MultiplayerPatchMetadata, SafeEval, CreateParams, MultiplayerStateManager, ReconnectingWebSocketState, ClientToServerMessage, ServerToClientMessage, MultiplayerStateManagerError } from '@noya-app/state-manager';
2
+ import { AIToolDefinition, UserManager, SharedConnectionDataManager, NoyaManager, StateManagerOptions, StateManager, NoyaManagerOptions, SyncAdapter, TSchema, AccessType, PolicyAuthContext, LocalStorageSyncOptions, Static, ExtractRequestBody, PublishCallback, ResourceManager, TranscriptionManager, AssetTranscriptionResult, StreamFilter, ActivityEventsManager, MultiplayerPatchMetadata, SafeEval, CreateParams, MultiplayerStateManager, ResourceUrlOptions, ConnectionEvent as ConnectionEvent$1, ClientToServerMessage, ReconnectingWebSocketState } from '@noya-app/state-manager';
3
3
  export * from '@noya-app/state-manager';
4
4
  import React, { SetStateAction, ComponentProps, Dispatch } from 'react';
5
5
  import { Asset, ResourceCreate, CreateResourceParametersWithoutAccessibleByFileId, ModifiedResource, Resource, MediaItem, ResourceMap, ResourceCreateMap, OutputTransform, Input } from '@noya-app/noya-schemas';
@@ -172,6 +172,7 @@ type GetAppDataOptions = {
172
172
  };
173
173
  declare function enforceSchema<State>(initialState: State, schema?: TSchema): State;
174
174
  declare function parseAppDataParameter(options?: GetAppDataOptions): AppData<unknown> | null;
175
+ declare function parseInspectorParameter(options?: GetAppDataOptions): boolean | null;
175
176
  declare function getAppData<State>(initialState: State | (() => State), schema?: TSchema, options?: GetAppDataOptions): AppData<State>;
176
177
  declare function getSyncAdapter<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>(params?: {
177
178
  multiplayerUrl?: string;
@@ -342,9 +343,69 @@ declare function useInputs(): ({
342
343
  } | {
343
344
  type: "null";
344
345
  _kind: "Null";
345
- } | any | any;
346
+ } | any | any | {
347
+ type?: "string" | "number" | "boolean" | "null" | undefined;
348
+ _kind: "Literal";
349
+ const: string | number | boolean | null;
350
+ } | {
351
+ default?: any;
352
+ discriminator?: string | undefined;
353
+ _kind: "Union";
354
+ anyOf: ({
355
+ default?: string | undefined;
356
+ type: "string";
357
+ _kind: "String";
358
+ } | {
359
+ default?: number | undefined;
360
+ minimum?: number | undefined;
361
+ maximum?: number | undefined;
362
+ type: "number";
363
+ _kind: "Number";
364
+ } | {
365
+ default?: boolean | undefined;
366
+ type: "boolean";
367
+ _kind: "Boolean";
368
+ } | {
369
+ type: "null";
370
+ _kind: "Null";
371
+ } | any | any | {
372
+ type?: "string" | "number" | "boolean" | "null" | undefined;
373
+ _kind: "Literal";
374
+ const: string | number | boolean | null;
375
+ } | any)[];
376
+ };
346
377
  };
347
378
  _kind: "Object";
379
+ } | {
380
+ type?: "string" | "number" | "boolean" | "null" | undefined;
381
+ _kind: "Literal";
382
+ const: string | number | boolean | null;
383
+ } | {
384
+ default?: any;
385
+ discriminator?: string | undefined;
386
+ _kind: "Union";
387
+ anyOf: ({
388
+ default?: string | undefined;
389
+ type: "string";
390
+ _kind: "String";
391
+ } | {
392
+ default?: number | undefined;
393
+ minimum?: number | undefined;
394
+ maximum?: number | undefined;
395
+ type: "number";
396
+ _kind: "Number";
397
+ } | {
398
+ default?: boolean | undefined;
399
+ type: "boolean";
400
+ _kind: "Boolean";
401
+ } | {
402
+ type: "null";
403
+ _kind: "Null";
404
+ } | any | any | {
405
+ type?: "string" | "number" | "boolean" | "null" | undefined;
406
+ _kind: "Literal";
407
+ const: string | number | boolean | null;
408
+ } | any)[];
348
409
  };
349
410
  } | {
350
411
  required?: string[] | undefined;
@@ -367,9 +428,69 @@ declare function useInputs(): ({
367
428
  } | {
368
429
  type: "null";
369
430
  _kind: "Null";
370
- } | any | any;
431
+ } | any | any | {
432
+ type?: "string" | "number" | "boolean" | "null" | undefined;
433
+ _kind: "Literal";
434
+ const: string | number | boolean | null;
435
+ } | {
436
+ default?: any;
437
+ discriminator?: string | undefined;
438
+ _kind: "Union";
439
+ anyOf: ({
440
+ default?: string | undefined;
441
+ type: "string";
442
+ _kind: "String";
443
+ } | {
444
+ default?: number | undefined;
445
+ minimum?: number | undefined;
446
+ maximum?: number | undefined;
447
+ type: "number";
448
+ _kind: "Number";
449
+ } | {
450
+ default?: boolean | undefined;
451
+ type: "boolean";
452
+ _kind: "Boolean";
453
+ } | {
454
+ type: "null";
455
+ _kind: "Null";
456
+ } | any | any | {
457
+ type?: "string" | "number" | "boolean" | "null" | undefined;
458
+ _kind: "Literal";
459
+ const: string | number | boolean | null;
460
+ } | any)[];
461
+ };
371
462
  };
372
463
  _kind: "Object";
464
+ } | {
465
+ type?: "string" | "number" | "boolean" | "null" | undefined;
466
+ _kind: "Literal";
467
+ const: string | number | boolean | null;
468
+ } | {
469
+ default?: any;
470
+ discriminator?: string | undefined;
471
+ _kind: "Union";
472
+ anyOf: ({
473
+ default?: string | undefined;
474
+ type: "string";
475
+ _kind: "String";
476
+ } | {
477
+ default?: number | undefined;
478
+ minimum?: number | undefined;
479
+ maximum?: number | undefined;
480
+ type: "number";
481
+ _kind: "Number";
482
+ } | {
483
+ default?: boolean | undefined;
484
+ type: "boolean";
485
+ _kind: "Boolean";
486
+ } | {
487
+ type: "null";
488
+ _kind: "Null";
489
+ } | any | any | {
490
+ type?: "string" | "number" | "boolean" | "null" | undefined;
491
+ _kind: "Literal";
492
+ const: string | number | boolean | null;
493
+ } | any)[];
373
494
  } | null;
374
495
  kind: "data";
375
496
  required: boolean;
@@ -515,23 +636,14 @@ declare function useObservable<T>(observable: Observable<T> | undefined): T | un
515
636
  declare function useObservable<T, A>(observable: Observable<T> | undefined, selector: (value: T) => A, options?: Pick<ObservableOptions, "isEqual">): A | undefined;
516
637
  declare function useObservable<T, P extends PathKey[] | string>(observable: Observable<T> | undefined, path: P): GetAtPath<T, P> | undefined;
517
638
 
518
- declare function useResourceUrl(idOrStableId: string | undefined): string | undefined;
639
+ declare function useResourceUrl(idOrStableId: string | undefined, options?: ResourceUrlOptions): string | undefined;
519
640
 
520
- type ConnectionEvent<State> = {
521
- type: "stateChange";
522
- state: ReconnectingWebSocketState;
523
- } | {
524
- type: "send";
525
- message: ClientToServerMessage<State>;
526
- } | {
527
- type: "receive";
528
- message: ServerToClientMessage<State>;
529
- } | {
530
- type: "error";
531
- error: MultiplayerStateManagerError;
532
- };
641
+ type ConnectionEvent<State> = ConnectionEvent$1<State>;
533
642
  type ConnectionOptions<State> = {
534
643
  debug?: boolean;
644
+ heartbeatIntervalMs?: number;
645
+ silentTimeoutMs?: number;
646
+ realtimeInputWatchdogMs?: number;
535
647
  onConnectionEvent?: (event: ConnectionEvent<State>) => void;
536
648
  };
537
649
  declare class WebSocketConnection<State> {
@@ -539,15 +651,72 @@ declare class WebSocketConnection<State> {
539
651
  private options;
540
652
  private ws;
541
653
  private closedForever;
654
+ private heartbeatIntervalHandle?;
655
+ private silentTimeoutHandle?;
656
+ private simulationClockPulseIntervalHandle?;
657
+ private simulationClockPulseSocket?;
658
+ private simulationClockDirectFailed;
659
+ private heartbeatSequence;
660
+ private pendingSimulationFrames;
661
+ private frameFlushHandle?;
662
+ private frameFlushScheduler?;
663
+ private droppedSimulationFrames;
664
+ private pendingFrameReceipts;
665
+ private deliveredSimulationFrameCursors;
666
+ private queuedRealtimeInputs;
667
+ /**
668
+ * A batch stays here until the server explicitly confirms ingestion.
669
+ * Reconnects resend these exact batches, so a frame that was already in
670
+ * flight can never create a hole in an input stream.
671
+ */
672
+ private unconfirmedRealtimeBatches;
673
+ private lastSentRealtimeSequences;
674
+ private readonly realtimeInputSessionId;
675
+ private nextRealtimeInputBatchSequence;
676
+ private realtimeInputWatchdogHandle?;
677
+ private realtimeBatchesSent;
678
+ private realtimeInputsSent;
542
679
  constructor(url: URL, options?: ConnectionOptions<State>);
543
680
  connect(): Promise<void>;
544
681
  private handleOpen;
545
682
  private handleMessage;
683
+ private emitReceivedMessage;
684
+ private scheduleSimulationFrameFlush;
685
+ private flushSimulationFrames;
686
+ private shouldSuppressNonMonotonicObject;
687
+ private cancelSimulationFrameFlush;
546
688
  private handleClose;
689
+ private startHeartbeat;
690
+ private armSilentTimeout;
691
+ private stopHeartbeat;
692
+ private applySimulationClockConfig;
693
+ private openSimulationClockPulseSocket;
694
+ private stopSimulationClockPulses;
695
+ getSimulationFrameDiagnostics(): {
696
+ pending: number;
697
+ dropped: number;
698
+ pendingReceipts: number;
699
+ queuedRealtimeInputs: number;
700
+ replayRealtimeInputs: number;
701
+ unconfirmedRealtimeBatches: number;
702
+ realtimeBatchesSent: number;
703
+ realtimeInputsSent: number;
704
+ realtimeWatchdogArmed: boolean;
705
+ simulationClockPulsesActive: boolean;
706
+ };
547
707
  send(message: ClientToServerMessage<State>): void;
708
+ private sendTransportMessage;
709
+ private getRealtimeInputSequence;
710
+ private getContiguousRealtimeInputCount;
711
+ private flushRealtimeBatch;
712
+ private flushPendingFrameReceipts;
713
+ private armRealtimeInputWatchdog;
714
+ private stopRealtimeInputWatchdog;
715
+ private replayUnconfirmedRealtimeBatches;
716
+ private confirmRealtimeInputBatches;
548
717
  close(): void;
549
718
  addListener(listener: (state: ReconnectingWebSocketState) => void): () => void;
550
719
  removeListener(listener: (state: ReconnectingWebSocketState) => void): void;
551
720
  }
552
721
 
553
- export { type AnyNoyaSingletonBindings, type AnyNoyaSingletonOptions, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type NoyaStateProviderProps, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, buildResourcePatchPayload, createDefaultAppData, createNoyaContext, createStateInspectorRoot, decodeAll, deleteNoyaSingleton, encodeAll, enforceSchema, exportAll, fetchAssetMap, getAppData, getNoyaManagerSingleton, getNoyaSingletonBindings, getSyncAdapter, importAll, initializeNoyaSingleton, parseAppDataParameter, replaceDeep, resourceToCreateParameters, resourceToMediaItem, useAIManager, useActivityEvents, useActivityEventsForManager, useAnyNoyaManager, useAnyNoyaStateContext, useAnySharedConnectionData, useAsset, useAssetManager, useAssets, useBindNoyaManager, useCallableAITools, useColorScheme, useEnqueueInput, useFileName, useFilePropertyManager, useIOManager, useInputs, useIsInitialized, useIsProcessing, useManagedHistory, useManagedState, useMultiplayerState, useNoyaActiveUsers, useNoyaAssetTranscription, useNoyaCurrentUser, useNoyaCurrentUserId, useNoyaStateInternal, useNoyaTranscriptionManager, useNoyaUser, useNoyaUserManager, useNoyaUsers, useObservable, useOptionalAnyNoyaStateContext, useOutputTransforms, usePipelineManager, usePublish, useRegisterAITool, useResourceManager, useResourceUrl, useResources, useScriptEvaluator, useSecret, useSecretManager, useSecrets, useSetFileNameState, useStateInspector, useViewType };
722
+ export { type AnyNoyaSingletonBindings, type AnyNoyaSingletonOptions, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type NoyaStateProviderProps, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, buildResourcePatchPayload, createDefaultAppData, createNoyaContext, createStateInspectorRoot, decodeAll, deleteNoyaSingleton, encodeAll, enforceSchema, exportAll, fetchAssetMap, getAppData, getNoyaManagerSingleton, getNoyaSingletonBindings, getSyncAdapter, importAll, initializeNoyaSingleton, parseAppDataParameter, parseInspectorParameter, replaceDeep, resourceToCreateParameters, resourceToMediaItem, useAIManager, useActivityEvents, useActivityEventsForManager, useAnyNoyaManager, useAnyNoyaStateContext, useAnySharedConnectionData, useAsset, useAssetManager, useAssets, useBindNoyaManager, useCallableAITools, useColorScheme, useEnqueueInput, useFileName, useFilePropertyManager, useIOManager, useInputs, useIsInitialized, useIsProcessing, useManagedHistory, useManagedState, useMultiplayerState, useNoyaActiveUsers, useNoyaAssetTranscription, useNoyaCurrentUser, useNoyaCurrentUserId, useNoyaStateInternal, useNoyaTranscriptionManager, useNoyaUser, useNoyaUserManager, useNoyaUsers, useObservable, useOptionalAnyNoyaStateContext, useOutputTransforms, usePipelineManager, usePublish, useRegisterAITool, useResourceManager, useResourceUrl, useResources, useScriptEvaluator, useSecret, useSecretManager, useSecrets, useSetFileNameState, useStateInspector, useViewType };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _noya_app_state_manager from '@noya-app/state-manager';
2
- import { AIToolDefinition, UserManager, SharedConnectionDataManager, NoyaManager, StateManagerOptions, StateManager, NoyaManagerOptions, SyncAdapter, TSchema, AccessType, PolicyAuthContext, LocalStorageSyncOptions, Static, ExtractRequestBody, PublishCallback, ResourceManager, TranscriptionManager, AssetTranscriptionResult, StreamFilter, ActivityEventsManager, MultiplayerPatchMetadata, SafeEval, CreateParams, MultiplayerStateManager, ReconnectingWebSocketState, ClientToServerMessage, ServerToClientMessage, MultiplayerStateManagerError } from '@noya-app/state-manager';
2
+ import { AIToolDefinition, UserManager, SharedConnectionDataManager, NoyaManager, StateManagerOptions, StateManager, NoyaManagerOptions, SyncAdapter, TSchema, AccessType, PolicyAuthContext, LocalStorageSyncOptions, Static, ExtractRequestBody, PublishCallback, ResourceManager, TranscriptionManager, AssetTranscriptionResult, StreamFilter, ActivityEventsManager, MultiplayerPatchMetadata, SafeEval, CreateParams, MultiplayerStateManager, ResourceUrlOptions, ConnectionEvent as ConnectionEvent$1, ClientToServerMessage, ReconnectingWebSocketState } from '@noya-app/state-manager';
3
3
  export * from '@noya-app/state-manager';
4
4
  import React, { SetStateAction, ComponentProps, Dispatch } from 'react';
5
5
  import { Asset, ResourceCreate, CreateResourceParametersWithoutAccessibleByFileId, ModifiedResource, Resource, MediaItem, ResourceMap, ResourceCreateMap, OutputTransform, Input } from '@noya-app/noya-schemas';
@@ -172,6 +172,7 @@ type GetAppDataOptions = {
172
172
  };
173
173
  declare function enforceSchema<State>(initialState: State, schema?: TSchema): State;
174
174
  declare function parseAppDataParameter(options?: GetAppDataOptions): AppData<unknown> | null;
175
+ declare function parseInspectorParameter(options?: GetAppDataOptions): boolean | null;
175
176
  declare function getAppData<State>(initialState: State | (() => State), schema?: TSchema, options?: GetAppDataOptions): AppData<State>;
176
177
  declare function getSyncAdapter<S, M extends object = object, E extends object = object, MenuT extends string = string, I extends Record<string, any> = Record<string, unknown>>(params?: {
177
178
  multiplayerUrl?: string;
@@ -342,9 +343,69 @@ declare function useInputs(): ({
342
343
  } | {
343
344
  type: "null";
344
345
  _kind: "Null";
345
- } | any | any;
346
+ } | any | any | {
347
+ type?: "string" | "number" | "boolean" | "null" | undefined;
348
+ _kind: "Literal";
349
+ const: string | number | boolean | null;
350
+ } | {
351
+ default?: any;
352
+ discriminator?: string | undefined;
353
+ _kind: "Union";
354
+ anyOf: ({
355
+ default?: string | undefined;
356
+ type: "string";
357
+ _kind: "String";
358
+ } | {
359
+ default?: number | undefined;
360
+ minimum?: number | undefined;
361
+ maximum?: number | undefined;
362
+ type: "number";
363
+ _kind: "Number";
364
+ } | {
365
+ default?: boolean | undefined;
366
+ type: "boolean";
367
+ _kind: "Boolean";
368
+ } | {
369
+ type: "null";
370
+ _kind: "Null";
371
+ } | any | any | {
372
+ type?: "string" | "number" | "boolean" | "null" | undefined;
373
+ _kind: "Literal";
374
+ const: string | number | boolean | null;
375
+ } | any)[];
376
+ };
346
377
  };
347
378
  _kind: "Object";
379
+ } | {
380
+ type?: "string" | "number" | "boolean" | "null" | undefined;
381
+ _kind: "Literal";
382
+ const: string | number | boolean | null;
383
+ } | {
384
+ default?: any;
385
+ discriminator?: string | undefined;
386
+ _kind: "Union";
387
+ anyOf: ({
388
+ default?: string | undefined;
389
+ type: "string";
390
+ _kind: "String";
391
+ } | {
392
+ default?: number | undefined;
393
+ minimum?: number | undefined;
394
+ maximum?: number | undefined;
395
+ type: "number";
396
+ _kind: "Number";
397
+ } | {
398
+ default?: boolean | undefined;
399
+ type: "boolean";
400
+ _kind: "Boolean";
401
+ } | {
402
+ type: "null";
403
+ _kind: "Null";
404
+ } | any | any | {
405
+ type?: "string" | "number" | "boolean" | "null" | undefined;
406
+ _kind: "Literal";
407
+ const: string | number | boolean | null;
408
+ } | any)[];
348
409
  };
349
410
  } | {
350
411
  required?: string[] | undefined;
@@ -367,9 +428,69 @@ declare function useInputs(): ({
367
428
  } | {
368
429
  type: "null";
369
430
  _kind: "Null";
370
- } | any | any;
431
+ } | any | any | {
432
+ type?: "string" | "number" | "boolean" | "null" | undefined;
433
+ _kind: "Literal";
434
+ const: string | number | boolean | null;
435
+ } | {
436
+ default?: any;
437
+ discriminator?: string | undefined;
438
+ _kind: "Union";
439
+ anyOf: ({
440
+ default?: string | undefined;
441
+ type: "string";
442
+ _kind: "String";
443
+ } | {
444
+ default?: number | undefined;
445
+ minimum?: number | undefined;
446
+ maximum?: number | undefined;
447
+ type: "number";
448
+ _kind: "Number";
449
+ } | {
450
+ default?: boolean | undefined;
451
+ type: "boolean";
452
+ _kind: "Boolean";
453
+ } | {
454
+ type: "null";
455
+ _kind: "Null";
456
+ } | any | any | {
457
+ type?: "string" | "number" | "boolean" | "null" | undefined;
458
+ _kind: "Literal";
459
+ const: string | number | boolean | null;
460
+ } | any)[];
461
+ };
371
462
  };
372
463
  _kind: "Object";
464
+ } | {
465
+ type?: "string" | "number" | "boolean" | "null" | undefined;
466
+ _kind: "Literal";
467
+ const: string | number | boolean | null;
468
+ } | {
469
+ default?: any;
470
+ discriminator?: string | undefined;
471
+ _kind: "Union";
472
+ anyOf: ({
473
+ default?: string | undefined;
474
+ type: "string";
475
+ _kind: "String";
476
+ } | {
477
+ default?: number | undefined;
478
+ minimum?: number | undefined;
479
+ maximum?: number | undefined;
480
+ type: "number";
481
+ _kind: "Number";
482
+ } | {
483
+ default?: boolean | undefined;
484
+ type: "boolean";
485
+ _kind: "Boolean";
486
+ } | {
487
+ type: "null";
488
+ _kind: "Null";
489
+ } | any | any | {
490
+ type?: "string" | "number" | "boolean" | "null" | undefined;
491
+ _kind: "Literal";
492
+ const: string | number | boolean | null;
493
+ } | any)[];
373
494
  } | null;
374
495
  kind: "data";
375
496
  required: boolean;
@@ -515,23 +636,14 @@ declare function useObservable<T>(observable: Observable<T> | undefined): T | un
515
636
  declare function useObservable<T, A>(observable: Observable<T> | undefined, selector: (value: T) => A, options?: Pick<ObservableOptions, "isEqual">): A | undefined;
516
637
  declare function useObservable<T, P extends PathKey[] | string>(observable: Observable<T> | undefined, path: P): GetAtPath<T, P> | undefined;
517
638
 
518
- declare function useResourceUrl(idOrStableId: string | undefined): string | undefined;
639
+ declare function useResourceUrl(idOrStableId: string | undefined, options?: ResourceUrlOptions): string | undefined;
519
640
 
520
- type ConnectionEvent<State> = {
521
- type: "stateChange";
522
- state: ReconnectingWebSocketState;
523
- } | {
524
- type: "send";
525
- message: ClientToServerMessage<State>;
526
- } | {
527
- type: "receive";
528
- message: ServerToClientMessage<State>;
529
- } | {
530
- type: "error";
531
- error: MultiplayerStateManagerError;
532
- };
641
+ type ConnectionEvent<State> = ConnectionEvent$1<State>;
533
642
  type ConnectionOptions<State> = {
534
643
  debug?: boolean;
644
+ heartbeatIntervalMs?: number;
645
+ silentTimeoutMs?: number;
646
+ realtimeInputWatchdogMs?: number;
535
647
  onConnectionEvent?: (event: ConnectionEvent<State>) => void;
536
648
  };
537
649
  declare class WebSocketConnection<State> {
@@ -539,15 +651,72 @@ declare class WebSocketConnection<State> {
539
651
  private options;
540
652
  private ws;
541
653
  private closedForever;
654
+ private heartbeatIntervalHandle?;
655
+ private silentTimeoutHandle?;
656
+ private simulationClockPulseIntervalHandle?;
657
+ private simulationClockPulseSocket?;
658
+ private simulationClockDirectFailed;
659
+ private heartbeatSequence;
660
+ private pendingSimulationFrames;
661
+ private frameFlushHandle?;
662
+ private frameFlushScheduler?;
663
+ private droppedSimulationFrames;
664
+ private pendingFrameReceipts;
665
+ private deliveredSimulationFrameCursors;
666
+ private queuedRealtimeInputs;
667
+ /**
668
+ * A batch stays here until the server explicitly confirms ingestion.
669
+ * Reconnects resend these exact batches, so a frame that was already in
670
+ * flight can never create a hole in an input stream.
671
+ */
672
+ private unconfirmedRealtimeBatches;
673
+ private lastSentRealtimeSequences;
674
+ private readonly realtimeInputSessionId;
675
+ private nextRealtimeInputBatchSequence;
676
+ private realtimeInputWatchdogHandle?;
677
+ private realtimeBatchesSent;
678
+ private realtimeInputsSent;
542
679
  constructor(url: URL, options?: ConnectionOptions<State>);
543
680
  connect(): Promise<void>;
544
681
  private handleOpen;
545
682
  private handleMessage;
683
+ private emitReceivedMessage;
684
+ private scheduleSimulationFrameFlush;
685
+ private flushSimulationFrames;
686
+ private shouldSuppressNonMonotonicObject;
687
+ private cancelSimulationFrameFlush;
546
688
  private handleClose;
689
+ private startHeartbeat;
690
+ private armSilentTimeout;
691
+ private stopHeartbeat;
692
+ private applySimulationClockConfig;
693
+ private openSimulationClockPulseSocket;
694
+ private stopSimulationClockPulses;
695
+ getSimulationFrameDiagnostics(): {
696
+ pending: number;
697
+ dropped: number;
698
+ pendingReceipts: number;
699
+ queuedRealtimeInputs: number;
700
+ replayRealtimeInputs: number;
701
+ unconfirmedRealtimeBatches: number;
702
+ realtimeBatchesSent: number;
703
+ realtimeInputsSent: number;
704
+ realtimeWatchdogArmed: boolean;
705
+ simulationClockPulsesActive: boolean;
706
+ };
547
707
  send(message: ClientToServerMessage<State>): void;
708
+ private sendTransportMessage;
709
+ private getRealtimeInputSequence;
710
+ private getContiguousRealtimeInputCount;
711
+ private flushRealtimeBatch;
712
+ private flushPendingFrameReceipts;
713
+ private armRealtimeInputWatchdog;
714
+ private stopRealtimeInputWatchdog;
715
+ private replayUnconfirmedRealtimeBatches;
716
+ private confirmRealtimeInputBatches;
548
717
  close(): void;
549
718
  addListener(listener: (state: ReconnectingWebSocketState) => void): () => void;
550
719
  removeListener(listener: (state: ReconnectingWebSocketState) => void): void;
551
720
  }
552
721
 
553
- export { type AnyNoyaSingletonBindings, type AnyNoyaSingletonOptions, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type NoyaStateProviderProps, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, buildResourcePatchPayload, createDefaultAppData, createNoyaContext, createStateInspectorRoot, decodeAll, deleteNoyaSingleton, encodeAll, enforceSchema, exportAll, fetchAssetMap, getAppData, getNoyaManagerSingleton, getNoyaSingletonBindings, getSyncAdapter, importAll, initializeNoyaSingleton, parseAppDataParameter, replaceDeep, resourceToCreateParameters, resourceToMediaItem, useAIManager, useActivityEvents, useActivityEventsForManager, useAnyNoyaManager, useAnyNoyaStateContext, useAnySharedConnectionData, useAsset, useAssetManager, useAssets, useBindNoyaManager, useCallableAITools, useColorScheme, useEnqueueInput, useFileName, useFilePropertyManager, useIOManager, useInputs, useIsInitialized, useIsProcessing, useManagedHistory, useManagedState, useMultiplayerState, useNoyaActiveUsers, useNoyaAssetTranscription, useNoyaCurrentUser, useNoyaCurrentUserId, useNoyaStateInternal, useNoyaTranscriptionManager, useNoyaUser, useNoyaUserManager, useNoyaUsers, useObservable, useOptionalAnyNoyaStateContext, useOutputTransforms, usePipelineManager, usePublish, useRegisterAITool, useResourceManager, useResourceUrl, useResources, useScriptEvaluator, useSecret, useSecretManager, useSecrets, useSetFileNameState, useStateInspector, useViewType };
722
+ export { type AnyNoyaSingletonBindings, type AnyNoyaSingletonOptions, AnyNoyaStateContext, type AnyNoyaStateContextValue, type AppData, type AppTheme, type AppViewType, type ConnectionEvent, type ConnectionOptions, FallbackUntilInitialized, type GetAppDataOptions, type NoyaStateProviderProps, type RenderUserPointer, type RenderUserPointerProps, StateInspector, type StateInspectorAnchor, type StateInspectorOptions, type UseMultiplayerStateOptions, type UseNoyaStateOptions, type UseNoyaStateResult, type UserPointerData, UserPointersOverlay, type UserPointersOverlayProps, WebSocketConnection, buildResourcePatchPayload, createDefaultAppData, createNoyaContext, createStateInspectorRoot, decodeAll, deleteNoyaSingleton, encodeAll, enforceSchema, exportAll, fetchAssetMap, getAppData, getNoyaManagerSingleton, getNoyaSingletonBindings, getSyncAdapter, importAll, initializeNoyaSingleton, parseAppDataParameter, parseInspectorParameter, replaceDeep, resourceToCreateParameters, resourceToMediaItem, useAIManager, useActivityEvents, useActivityEventsForManager, useAnyNoyaManager, useAnyNoyaStateContext, useAnySharedConnectionData, useAsset, useAssetManager, useAssets, useBindNoyaManager, useCallableAITools, useColorScheme, useEnqueueInput, useFileName, useFilePropertyManager, useIOManager, useInputs, useIsInitialized, useIsProcessing, useManagedHistory, useManagedState, useMultiplayerState, useNoyaActiveUsers, useNoyaAssetTranscription, useNoyaCurrentUser, useNoyaCurrentUserId, useNoyaStateInternal, useNoyaTranscriptionManager, useNoyaUser, useNoyaUserManager, useNoyaUsers, useObservable, useOptionalAnyNoyaStateContext, useOutputTransforms, usePipelineManager, usePublish, useRegisterAITool, useResourceManager, useResourceUrl, useResources, useScriptEvaluator, useSecret, useSecretManager, useSecrets, useSetFileNameState, useStateInspector, useViewType };