@interncom/diplomatic 0.12.4 → 0.12.6

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.
@@ -3,3 +3,5 @@
3
3
  * Does not inject seed — use {@link Enclave.spawnSyncWorker} for that.
4
4
  */
5
5
  export declare function spawnDiplomaticSyncWorker(): Worker;
6
+ /** postMessage via the load-time snapshot (not the live prototype). */
7
+ export declare function postToDiplomaticWorker(worker: Worker, data: unknown, transfer?: Transferable[]): void;
@@ -9,6 +9,7 @@ export interface IMsgParts {
9
9
  head: IMessageHead;
10
10
  body?: EncodedMessage;
11
11
  }
12
+ /** Seed/host from the local store; `connected` from the sync worker (if any). */
12
13
  export interface IDiplomaticClientState {
13
14
  hasSeed: boolean;
14
15
  hasHost: boolean;
@@ -60,10 +60,10 @@ export declare class WorkerClient implements IClient<URL> {
60
60
  * `connected` stays false until the worker reports otherwise.
61
61
  */
62
62
  private hydrateStateFromStore;
63
- /**
64
- * Request current client/xfer state from the worker (after setSeed).
65
- */
66
- private pullRemoteState;
63
+ /** Seed + host from the local store. Worker never owns these. */
64
+ private loadSession;
65
+ /** Queue depths + progress from the worker (after setSeed). */
66
+ private pullRemoteXfer;
67
67
  private requireWorker;
68
68
  /** Lightweight RPC check after setSeed. */
69
69
  ping(): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import type { Status } from "../shared/consts";
2
2
  import type { SyncProgressEvent } from "../progress";
3
- import type { IDiplomaticClientState, IDiplomaticClientXferState } from "../types";
3
+ import type { IDiplomaticClientXferState } from "../types";
4
4
  /** Host identity as plain data (URL → string for structured clone). */
5
5
  export interface SerializedHost {
6
6
  handle: string;
@@ -66,9 +66,6 @@ export type WorkerCmd = {
66
66
  } | {
67
67
  id: number;
68
68
  op: "export";
69
- } | {
70
- id: number;
71
- op: "getClientState";
72
69
  } | {
73
70
  id: number;
74
71
  op: "getXferState";
@@ -91,9 +88,11 @@ export type WorkerEvent = {
91
88
  | {
92
89
  kind: "initError";
93
90
  message: string;
94
- } | {
91
+ }
92
+ /** Socket state only. Seed/host stay on the main-thread store. */
93
+ | {
95
94
  kind: "clientState";
96
- state: IDiplomaticClientState;
95
+ connected: boolean;
97
96
  }
98
97
  /** Queues + sync phase progress (see IDiplomaticClientXferState.progress). */
99
98
  | {
@@ -114,6 +113,5 @@ export declare function isWorkerEvent(data: unknown): data is WorkerEvent;
114
113
  export declare function isWorkerCmd(data: unknown): data is WorkerCmd;
115
114
  /** Narrow helpers for typed replies (avoid casts at call sites). */
116
115
  export declare function statusFromUnknown(v: unknown): Status | undefined;
117
- export declare function clientStateFromUnknown(v: unknown): IDiplomaticClientState | undefined;
118
116
  export declare function progressFromUnknown(v: unknown): SyncProgressEvent | undefined;
119
117
  export declare function xferStateFromUnknown(v: unknown): IDiplomaticClientXferState | undefined;