@q9labsai/chalk-client 4.1.8 → 4.1.10
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.
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
requireParsedAccessGrant,
|
|
9
9
|
validEpisodeDiagnosticCredential
|
|
10
10
|
} from "./chunk-JPNE4K2L.js";
|
|
11
|
+
import {
|
|
12
|
+
createTraceContext,
|
|
13
|
+
parseTraceparent
|
|
14
|
+
} from "./chunk-QVHR3RMB.js";
|
|
11
15
|
import {
|
|
12
16
|
createBrowserSyncLifecycle,
|
|
13
17
|
createBrowserWebSocketFactory,
|
|
14
18
|
createV1SyncClient
|
|
15
19
|
} from "./chunk-5VXGLI3T.js";
|
|
16
|
-
import {
|
|
17
|
-
createTraceContext,
|
|
18
|
-
parseTraceparent
|
|
19
|
-
} from "./chunk-QVHR3RMB.js";
|
|
20
20
|
|
|
21
21
|
// src/access/manager.ts
|
|
22
22
|
import { Clock, Context, Data, Effect, Layer, SynchronizedRef } from "effect";
|
|
@@ -887,6 +887,7 @@ var ChalkWhiteboardV1Client = class {
|
|
|
887
887
|
#listeners = /* @__PURE__ */ new Set();
|
|
888
888
|
#operations = /* @__PURE__ */ new Map();
|
|
889
889
|
#reservedOperationIds = /* @__PURE__ */ new Set();
|
|
890
|
+
#awaitingOperationIds = /* @__PURE__ */ new Set();
|
|
890
891
|
#pendingStoreWrites = /* @__PURE__ */ new Set();
|
|
891
892
|
#operationRetryTimers = /* @__PURE__ */ new Map();
|
|
892
893
|
#snapshots = /* @__PURE__ */ new Map();
|
|
@@ -910,6 +911,7 @@ var ChalkWhiteboardV1Client = class {
|
|
|
910
911
|
#initialSnapshot = null;
|
|
911
912
|
#startPromise = null;
|
|
912
913
|
#stopPromise = null;
|
|
914
|
+
#waitingForOperations = false;
|
|
913
915
|
#reconnectTimer;
|
|
914
916
|
#heartbeatTimer;
|
|
915
917
|
#missedHeartbeats = 0;
|
|
@@ -962,6 +964,8 @@ var ChalkWhiteboardV1Client = class {
|
|
|
962
964
|
this.#clearHeartbeat();
|
|
963
965
|
this.#clearOperationRetryTimers();
|
|
964
966
|
this.#clearUpdateAssemblies();
|
|
967
|
+
this.#awaitingOperationIds.clear();
|
|
968
|
+
this.#waitingForOperations = false;
|
|
965
969
|
this.#socket?.close(1e3, "whiteboard subscription stopped");
|
|
966
970
|
this.#socket = null;
|
|
967
971
|
this.#phase = "stopped";
|
|
@@ -978,7 +982,12 @@ var ChalkWhiteboardV1Client = class {
|
|
|
978
982
|
}
|
|
979
983
|
subscribe(listener) {
|
|
980
984
|
this.#listeners.add(listener);
|
|
981
|
-
if (this.#phase
|
|
985
|
+
if (this.#phase !== "live") return () => this.#listeners.delete(listener);
|
|
986
|
+
if (this.#latestSnapshot && this.#latestSnapshot.sceneId === this.#sceneId && this.#latestSnapshot.revision === this.#revision) {
|
|
987
|
+
listener(this.#latestSnapshot);
|
|
988
|
+
return () => this.#listeners.delete(listener);
|
|
989
|
+
}
|
|
990
|
+
if (this.#snapshots.size === 0 && !this.#waitingForOperations) void this.#requestSnapshot().catch(() => void 0);
|
|
982
991
|
return () => this.#listeners.delete(listener);
|
|
983
992
|
}
|
|
984
993
|
submitUpdate(input) {
|
|
@@ -1226,12 +1235,21 @@ var ChalkWhiteboardV1Client = class {
|
|
|
1226
1235
|
this.#presenting = "presenting" in frame ? frame.presenting : false;
|
|
1227
1236
|
this.#publishSummary("loading", null);
|
|
1228
1237
|
this.#missedHeartbeats = 0;
|
|
1229
|
-
|
|
1238
|
+
const pendingOperations = [...this.#operations.values()].sort((left, right) => compareChalkWhiteboardV1PendingOperations(left.pending, right.pending));
|
|
1239
|
+
this.#awaitingOperationIds.clear();
|
|
1240
|
+
this.#waitingForOperations = true;
|
|
1241
|
+
for (const entry of pendingOperations) this.#awaitingOperationIds.add(entry.pending.operationId);
|
|
1242
|
+
for (const entry of pendingOperations) {
|
|
1230
1243
|
this.#sendOperation(entry.pending.frame);
|
|
1231
1244
|
}
|
|
1232
|
-
|
|
1245
|
+
this.#requestSnapshotAfterOperations();
|
|
1233
1246
|
this.#startHeartbeat();
|
|
1234
1247
|
}
|
|
1248
|
+
#requestSnapshotAfterOperations() {
|
|
1249
|
+
if (this.#phase !== "live" || !this.#waitingForOperations || this.#awaitingOperationIds.size > 0) return;
|
|
1250
|
+
this.#waitingForOperations = false;
|
|
1251
|
+
void this.#requestSnapshot().catch(() => void 0);
|
|
1252
|
+
}
|
|
1235
1253
|
#requestSnapshot() {
|
|
1236
1254
|
const requestId = this.#nextId();
|
|
1237
1255
|
const frame = { type: "request_snapshot", request_id: requestId };
|
|
@@ -1330,6 +1348,7 @@ var ChalkWhiteboardV1Client = class {
|
|
|
1330
1348
|
this.#clearOperationRetryTimer(frame.operation_id);
|
|
1331
1349
|
this.#sceneId = frame.scene_id;
|
|
1332
1350
|
this.#revision = frame.revision;
|
|
1351
|
+
this.#awaitingOperationIds.delete(frame.operation_id);
|
|
1333
1352
|
this.#publishSummary("ready", null);
|
|
1334
1353
|
entry.deferred && resolveDeferred(entry.deferred, {
|
|
1335
1354
|
operationId: frame.operation_id,
|
|
@@ -1337,6 +1356,7 @@ var ChalkWhiteboardV1Client = class {
|
|
|
1337
1356
|
revision: frame.revision
|
|
1338
1357
|
});
|
|
1339
1358
|
void this.#store.remove(frame.operation_id).catch(() => void 0);
|
|
1359
|
+
this.#requestSnapshotAfterOperations();
|
|
1340
1360
|
}
|
|
1341
1361
|
#operationError(frame) {
|
|
1342
1362
|
this.#requireLive();
|
|
@@ -1348,9 +1368,11 @@ var ChalkWhiteboardV1Client = class {
|
|
|
1348
1368
|
}
|
|
1349
1369
|
this.#operations.delete(frame.correlation_id);
|
|
1350
1370
|
this.#clearOperationRetryTimer(frame.correlation_id);
|
|
1371
|
+
this.#awaitingOperationIds.delete(frame.correlation_id);
|
|
1351
1372
|
entry.deferred && rejectDeferred(entry.deferred, error(failure(operationName(entry.pending.frame), mapErrorCode(frame.code), frame.recoverable, frame.message)));
|
|
1352
1373
|
this.#publishSummary("ready", failure(operationName(entry.pending.frame), mapErrorCode(frame.code), frame.recoverable, frame.message));
|
|
1353
1374
|
void this.#store.remove(frame.correlation_id).catch(() => void 0);
|
|
1375
|
+
this.#requestSnapshotAfterOperations();
|
|
1354
1376
|
return;
|
|
1355
1377
|
}
|
|
1356
1378
|
const snapshot = this.#snapshots.get(frame.correlation_id);
|
|
@@ -1400,6 +1422,7 @@ var ChalkWhiteboardV1Client = class {
|
|
|
1400
1422
|
this.#clearHeartbeat();
|
|
1401
1423
|
this.#clearUpdateAssemblies();
|
|
1402
1424
|
this.#phase = "connecting";
|
|
1425
|
+
this.#waitingForOperations = false;
|
|
1403
1426
|
this.#participantId = null;
|
|
1404
1427
|
this.#capabilities = [];
|
|
1405
1428
|
this.#canDraw = false;
|
|
@@ -4775,7 +4798,7 @@ var makeSpaceClientCoreLayer = (options, platform = {}) => {
|
|
|
4775
4798
|
now: baseDependencies.clock.now,
|
|
4776
4799
|
setTimeout: baseDependencies.clock.setTimeout,
|
|
4777
4800
|
clearTimeout: baseDependencies.clock.clearTimeout,
|
|
4778
|
-
release: { id: "chalk-client@4.1.
|
|
4801
|
+
release: { id: "chalk-client@4.1.10" }
|
|
4779
4802
|
});
|
|
4780
4803
|
const diagnosticSyncClients = /* @__PURE__ */ new Set();
|
|
4781
4804
|
const dependencies = {
|
package/dist/effect.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
makeSpaceClientCoreLayer,
|
|
18
18
|
makeSpaceClientCoreLayerFromServices,
|
|
19
19
|
makeSpaceStoreLayer
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3ZHIJB3F.js";
|
|
21
21
|
import "./chunk-C4BIONCP.js";
|
|
22
22
|
import {
|
|
23
23
|
AIProviderConfigSchema,
|
|
@@ -988,7 +988,6 @@ import {
|
|
|
988
988
|
WhiteboardUploadNotReadyErrorWireSchema,
|
|
989
989
|
createChalkEffectClient
|
|
990
990
|
} from "./chunk-JPNE4K2L.js";
|
|
991
|
-
import "./chunk-5VXGLI3T.js";
|
|
992
991
|
import {
|
|
993
992
|
TelemetryDeliveryService,
|
|
994
993
|
TelemetryEventSourceService,
|
|
@@ -1003,6 +1002,7 @@ import {
|
|
|
1003
1002
|
makeTelemetryExporterLayer,
|
|
1004
1003
|
makeTelemetryStorageLayer
|
|
1005
1004
|
} from "./chunk-QVHR3RMB.js";
|
|
1005
|
+
import "./chunk-5VXGLI3T.js";
|
|
1006
1006
|
import "./chunk-PBSYXPNJ.js";
|
|
1007
1007
|
|
|
1008
1008
|
// src/space-client/effect.ts
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
createSpaceClient,
|
|
13
13
|
decodeWhiteboardV1ServerFrame,
|
|
14
14
|
encodeWhiteboardV1ClientFrame
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-3ZHIJB3F.js";
|
|
16
16
|
import {
|
|
17
17
|
CloudflareRTKClient,
|
|
18
18
|
CloudflareRTKError,
|
|
@@ -36,6 +36,27 @@ import {
|
|
|
36
36
|
ArrivalUnavailableError,
|
|
37
37
|
SpacePublicInviteUnavailableError
|
|
38
38
|
} from "./chunk-JPNE4K2L.js";
|
|
39
|
+
import {
|
|
40
|
+
CHALK_JOURNEY_ID_HEADER,
|
|
41
|
+
TELEMETRY_EVENT_VERSION,
|
|
42
|
+
TRACEPARENT_HEADER,
|
|
43
|
+
TRACESTATE_HEADER,
|
|
44
|
+
TelemetryClient,
|
|
45
|
+
TelemetryJourney,
|
|
46
|
+
createBrowserRuntimeTelemetryStorage,
|
|
47
|
+
createBrowserTelemetryStorage,
|
|
48
|
+
createJourneyIntakeExporter,
|
|
49
|
+
createKeyValueTelemetryStorage,
|
|
50
|
+
createMemoryTelemetryStorage,
|
|
51
|
+
createTelemetryClient,
|
|
52
|
+
createTraceContext,
|
|
53
|
+
journeyHeaders,
|
|
54
|
+
parseTraceparent,
|
|
55
|
+
rtcSummaryAttributes,
|
|
56
|
+
summarizeRtcStats,
|
|
57
|
+
toJourneyIntakeEvent,
|
|
58
|
+
traceContextFromJourney
|
|
59
|
+
} from "./chunk-QVHR3RMB.js";
|
|
39
60
|
import {
|
|
40
61
|
AsyncStorageV1PendingTargetStore,
|
|
41
62
|
InMemoryV1PendingTargetStore,
|
|
@@ -64,27 +85,6 @@ import {
|
|
|
64
85
|
reactionFromFrame,
|
|
65
86
|
restoreV1Snapshot
|
|
66
87
|
} from "./chunk-5VXGLI3T.js";
|
|
67
|
-
import {
|
|
68
|
-
CHALK_JOURNEY_ID_HEADER,
|
|
69
|
-
TELEMETRY_EVENT_VERSION,
|
|
70
|
-
TRACEPARENT_HEADER,
|
|
71
|
-
TRACESTATE_HEADER,
|
|
72
|
-
TelemetryClient,
|
|
73
|
-
TelemetryJourney,
|
|
74
|
-
createBrowserRuntimeTelemetryStorage,
|
|
75
|
-
createBrowserTelemetryStorage,
|
|
76
|
-
createJourneyIntakeExporter,
|
|
77
|
-
createKeyValueTelemetryStorage,
|
|
78
|
-
createMemoryTelemetryStorage,
|
|
79
|
-
createTelemetryClient,
|
|
80
|
-
createTraceContext,
|
|
81
|
-
journeyHeaders,
|
|
82
|
-
parseTraceparent,
|
|
83
|
-
rtcSummaryAttributes,
|
|
84
|
-
summarizeRtcStats,
|
|
85
|
-
toJourneyIntakeEvent,
|
|
86
|
-
traceContextFromJourney
|
|
87
|
-
} from "./chunk-QVHR3RMB.js";
|
|
88
88
|
import {
|
|
89
89
|
syncTelemetryCorrelation,
|
|
90
90
|
withSyncTelemetryCorrelation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-client.d.ts","sourceRoot":"","sources":["../../src/whiteboard/v1-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAE5B,KAAK,sBAAsB,EAK3B,KAAK,0BAA0B,EAC/B,KAAK,4BAA4B,EAClC,MAAM,SAAS,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