@q9labsai/chalk-client 5.1.0 → 5.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/dist/chat-files/types.d.ts +3 -0
  3. package/dist/{chunk-RJRSLXVT.js → chunk-BCO3AZUB.js} +647 -221
  4. package/dist/{chunk-K7PNW3KI.js → chunk-D2GXPX2P.js} +143 -13
  5. package/dist/{chunk-KHHULLBZ.js → chunk-DHGAKJXP.js} +1 -1
  6. package/dist/{chunk-3ZN7IXOZ.js → chunk-HO4745TX.js} +250 -2
  7. package/dist/client.d.ts +201 -0
  8. package/dist/connection/dependencies.d.ts +3 -0
  9. package/dist/connection/diagnostics.d.ts +3 -2
  10. package/dist/connection/lifecycle.d.ts +1 -0
  11. package/dist/connection/types.d.ts +2 -0
  12. package/dist/effect.js +62 -4
  13. package/dist/generated/http-api.d.ts +197 -0
  14. package/dist/generated/schemas.d.ts +366 -0
  15. package/dist/generated/sync.d.ts +74 -3
  16. package/dist/generated/whiteboard-v1.d.ts +71 -9
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +18 -14
  19. package/dist/public-invites/index.js +2 -2
  20. package/dist/space-client/reload-rejoin.d.ts +1 -1
  21. package/dist/space-client/types.d.ts +8 -1
  22. package/dist/sync/connect-diagnostics.d.ts +10 -0
  23. package/dist/sync/index.js +1 -1
  24. package/dist/sync/types.d.ts +1 -0
  25. package/dist/sync/v1-client.d.ts +2 -0
  26. package/dist/sync/v1-types.d.ts +4 -0
  27. package/dist/whiteboard/index.d.ts +2 -5
  28. package/dist/whiteboard/types.d.ts +26 -3
  29. package/dist/whiteboard/v1-client.d.ts +3 -1
  30. package/dist/whiteboard/v1-codec.d.ts +5 -1
  31. package/dist/whiteboard/v1-multipart.d.ts +1 -1
  32. package/dist/whiteboard/view-bounds.d.ts +5 -0
  33. package/dist/whiteboard/view-versions.d.ts +9 -0
  34. package/package.json +1 -1
@@ -9,6 +9,7 @@ export type SyncSocket = {
9
9
  }) => void) | null;
10
10
  onclose: ((event: {
11
11
  readonly code: number;
12
+ readonly reason?: string;
12
13
  }) => void) | null;
13
14
  onerror: (() => void) | null;
14
15
  send(data: string): void;
@@ -13,6 +13,8 @@ export declare class V1SyncClient implements V1CollaborationClient {
13
13
  restartTransport(): void;
14
14
  start(): Promise<void>;
15
15
  stop(): void;
16
+ /** Announces completed startup; transport recovery resends until acknowledged. */
17
+ confirmEntered(): Promise<void>;
16
18
  getSnapshot(): V1EpisodeSnapshot;
17
19
  subscribe(listener: (snapshot: V1EpisodeSnapshot) => void): () => void;
18
20
  onMediaPause(listener: (pause: V1MediaPause) => void): () => void;
@@ -75,6 +75,8 @@ export type V1EpisodeSnapshot = {
75
75
  readonly health?: import("./v1-health").SyncHealth;
76
76
  /** Cumulative count retained across successful retries; contains no URL or credentials. */
77
77
  readonly dialTimeoutCount?: number;
78
+ readonly connectAttempt?: import("./connect-diagnostics").SyncConnectDiagnostic;
79
+ readonly connectFailure?: import("./connect-diagnostics").SyncConnectDiagnostic;
78
80
  };
79
81
  readonly participantId: string | null;
80
82
  readonly participantGeneration: number | null;
@@ -201,6 +203,8 @@ export type V1SyncClientOptions = {
201
203
  readonly retryDelayMs?: number;
202
204
  readonly collaboration?: V1CollaborationExtensionRequest | false;
203
205
  readonly maxPendingCollaborationRequests?: number;
206
+ /** Asks Sync to hold the entry until `confirmEntered()`; set it only when the caller will call that method. */
207
+ readonly entryConfirmation?: boolean;
204
208
  };
205
209
  export type V1Socket = SyncSocket;
206
210
  /** Explicit host pause; control revisions do not identify a self-media operation. */
@@ -1,11 +1,8 @@
1
- /** Bounds for camera rectangles shared with other participants. */
2
- export declare const ChalkWhiteboardViewBounds: {
3
- maxCoordinate: 1000000;
4
- maxExtent: 2000000;
5
- };
1
+ export { ChalkWhiteboardViewBounds } from "./view-bounds";
6
2
  export { createChalkWhiteboardV1FileDownloadTransport, type ChalkWhiteboardV1FileDownloadTransportOptions } from "./file-download-transport";
7
3
  export * from "./types";
8
4
  export { ChalkWhiteboardV1Client } from "./v1-client";
9
5
  export { decodeWhiteboardV1ServerFrame, encodeWhiteboardV1ClientFrame } from "./v1-codec";
10
6
  export { createChalkWhiteboardV1Client, type CreateChalkWhiteboardV1ClientOptions } from "./v1-create";
11
7
  export { InMemoryChalkWhiteboardV1PendingOperationStore } from "./v1-persistence";
8
+ export { ChalkWhiteboardViewVersions } from "./view-versions";
@@ -53,7 +53,15 @@ export type ChalkWhiteboardView = {
53
53
  readonly width: number;
54
54
  readonly height: number;
55
55
  readonly bring: boolean;
56
+ /** Real move by default; false marks a passive refresh or heartbeat. */
57
+ readonly lead?: boolean;
56
58
  } & ({
59
+ readonly ownerId: string;
60
+ readonly ownerSequence: number;
61
+ } | {
62
+ readonly ownerId?: never;
63
+ readonly ownerSequence?: never;
64
+ }) & ({
57
65
  readonly originParticipantId: string;
58
66
  readonly originSequence: number;
59
67
  readonly originEpoch?: string;
@@ -67,7 +75,14 @@ export type ChalkWhiteboardV1Commit = {
67
75
  readonly sceneId: string;
68
76
  readonly revision: string;
69
77
  };
70
- export type ChalkWhiteboardV1Operation = "start_scene_subscription" | "submit_update" | "request_snapshot" | "clear" | "set_draw_permission" | "set_presentation" | "get_file_download";
78
+ export type ChalkWhiteboardV1Operation = "start_scene_subscription" | "submit_update" | "request_snapshot" | "clear" | "set_draw_permission" | "set_draw_policy" | "set_presentation" | "get_file_download";
79
+ /** Who can draw in the call. Hosts, the people whose role can manage the board, can always draw under `hosts` and `picked`. */
80
+ export type ChalkWhiteboardDrawPolicy = WhiteboardV1DrawPolicy;
81
+ /** A host's choice for one person. Under `everyone` it overrides the role default; under `picked` `true` means picked; under `hosts` it is kept but ignored. */
82
+ export type ChalkWhiteboardDrawPermission = {
83
+ readonly participantId: string;
84
+ readonly canDraw: boolean;
85
+ };
71
86
  export type ChalkWhiteboardV1ErrorCode = "unavailable" | "permission_denied" | "invalid_payload" | "stale_scene" | "cursor_reset_required" | "storage_unavailable" | "file_transfer_failed";
72
87
  export type ChalkWhiteboardV1Failure = {
73
88
  readonly operation: ChalkWhiteboardV1Operation;
@@ -100,17 +115,20 @@ export type ChalkWhiteboardV1Transport = {
100
115
  /** Whether the active subscription negotiated view_v1; remains stable during recovery. */
101
116
  readonly supportsViews?: boolean;
102
117
  /** Accepts views while subscribed; keeps the latest bring through recovery. False means views are unavailable. */
118
+ readonly forgetParticipant?: (participantId: string) => void;
103
119
  readonly sendView?: (view: ChalkWhiteboardView) => boolean;
104
120
  readonly requestSnapshot: () => Promise<void>;
105
121
  readonly clear: () => Promise<ChalkWhiteboardV1Commit>;
106
122
  readonly setDrawPermission: (participantId: string, canDraw: boolean) => Promise<void>;
123
+ /** Sets the call-wide drawing policy. Requires manageWhiteboard and a Sync server with draw_policy_v1. */
124
+ readonly setDrawPolicy?: (policy: ChalkWhiteboardDrawPolicy) => Promise<void>;
107
125
  readonly setPresentation?: (presenting: boolean) => Promise<void>;
108
126
  readonly files: ChalkWhiteboardV1FileTransport;
109
127
  };
110
128
  export type ChalkWhiteboardV1PendingOperation = {
111
129
  readonly operationId: string;
112
130
  readonly frame: Extract<WhiteboardV1ClientFrame, {
113
- readonly type: "submit_update" | "clear" | "set_draw_permission" | "set_presentation";
131
+ readonly type: "submit_update" | "clear" | "set_draw_permission" | "set_draw_policy" | "set_presentation";
114
132
  }>;
115
133
  readonly createdAt: number;
116
134
  readonly bytes: number;
@@ -154,12 +172,17 @@ export type ChalkWhiteboardSummary = {
154
172
  readonly sceneId: string | null;
155
173
  readonly revision: string | null;
156
174
  readonly capabilities: readonly ChalkWhiteboardV1Capability[];
175
+ /** This person's drawing permission, computed by Sync from the policy, their role and the host's choice for them. */
157
176
  readonly canDraw: boolean;
158
177
  readonly canClear: boolean;
178
+ /** The call-wide policy, or null when the Sync server predates draw_policy_v1. */
179
+ readonly drawPolicy: ChalkWhiteboardDrawPolicy | null;
180
+ /** The host's per-person choices for people in the call. Empty unless this person is a host. */
181
+ readonly drawPermissions: readonly ChalkWhiteboardDrawPermission[];
159
182
  readonly presenting: boolean;
160
183
  readonly error: ChalkWhiteboardV1Failure | null;
161
184
  };
162
- import type { WhiteboardV1ClientFrame } from "../generated/whiteboard-v1";
185
+ import type { WhiteboardV1ClientFrame, WhiteboardV1DrawPolicy } from "../generated/whiteboard-v1";
163
186
  import type { ChalkWhiteboardV1Capability } from "../collaboration/types";
164
187
  import type { SyncClock, SyncIdGenerator, SyncLifecycle, SyncWebSocketFactory } from "../sync/types";
165
188
  export type { ChalkWhiteboardV1Capability } from "../collaboration/types";
@@ -1,4 +1,4 @@
1
- import { type ChalkWhiteboardV1ClientOptions, type ChalkWhiteboardV1Commit, type ChalkWhiteboardV1Event, type ChalkWhiteboardSummary, type ChalkWhiteboardV1Transport, type ChalkWhiteboardV1UpdateInput, type ChalkWhiteboardView } from "./types";
1
+ import { type ChalkWhiteboardV1ClientOptions, type ChalkWhiteboardV1Commit, type ChalkWhiteboardDrawPolicy, type ChalkWhiteboardV1Event, type ChalkWhiteboardSummary, type ChalkWhiteboardV1Transport, type ChalkWhiteboardV1UpdateInput, type ChalkWhiteboardView } from "./types";
2
2
  export declare class ChalkWhiteboardV1Client implements ChalkWhiteboardV1Transport {
3
3
  #private;
4
4
  readonly files: import("./types").ChalkWhiteboardV1FileTransport;
@@ -13,9 +13,11 @@ export declare class ChalkWhiteboardV1Client implements ChalkWhiteboardV1Transpo
13
13
  readonly y: number;
14
14
  }): void;
15
15
  get supportsViews(): boolean;
16
+ forgetParticipant(participantId: string): void;
16
17
  sendView(view: ChalkWhiteboardView): boolean;
17
18
  requestSnapshot(): Promise<void>;
18
19
  clear(): Promise<ChalkWhiteboardV1Commit>;
19
20
  setDrawPermission(participantId: string, canDraw: boolean): Promise<void>;
21
+ setDrawPolicy(policy: ChalkWhiteboardDrawPolicy): Promise<void>;
20
22
  setPresentation(presenting: boolean): Promise<void>;
21
23
  }
@@ -1,3 +1,7 @@
1
1
  import { type WhiteboardV1ServerFrame } from "../generated/whiteboard-v1";
2
2
  export declare function encodeWhiteboardV1ClientFrame(frame: unknown): string;
3
- export declare function decodeWhiteboardV1ServerFrame(wire: string): WhiteboardV1ServerFrame;
3
+ /** Negotiated control frames belong to the connection, not the public 5.1 frame union. */
4
+ export declare function decodeWhiteboardV1ServerFrame(wire: string): Exclude<WhiteboardV1ServerFrame, {
5
+ readonly type: "view_ack" | "draw_access";
6
+ }>;
7
+ export declare function decodeWhiteboardV1WireFrame(wire: string): WhiteboardV1ServerFrame;
@@ -1,6 +1,6 @@
1
1
  import { type WhiteboardV1ClientFrame, type WhiteboardV1ServerFrame } from "../generated/whiteboard-v1";
2
2
  export type WhiteboardV1LogicalOperationFrame = Extract<WhiteboardV1ClientFrame, {
3
- readonly type: "submit_update" | "clear" | "set_draw_permission" | "set_presentation";
3
+ readonly type: "submit_update" | "clear" | "set_draw_permission" | "set_draw_policy" | "set_presentation";
4
4
  }>;
5
5
  type UpdatePartFrame = Extract<WhiteboardV1ServerFrame, {
6
6
  readonly type: "update_part";
@@ -0,0 +1,5 @@
1
+ /** Bounds for shared camera rectangles. */
2
+ export declare const ChalkWhiteboardViewBounds: {
3
+ maxCoordinate: 1000000;
4
+ maxExtent: 2000000;
5
+ };
@@ -0,0 +1,9 @@
1
+ import type { ChalkWhiteboardView } from "./types";
2
+ /** Owner sequences are compared only within a connection's authoritative snapshot. */
3
+ export declare class ChalkWhiteboardViewVersions {
4
+ #private;
5
+ isNew(view: ChalkWhiteboardView, participantId?: string): boolean;
6
+ remember(view: ChalkWhiteboardView, participantId?: string): void;
7
+ forgetParticipant(participantId: string): void;
8
+ clear(): void;
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q9labsai/chalk-client",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",