@statelyai/sdk 0.18.0 → 0.20.1
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/README.md +33 -2
- package/dist/auth.d.mts +1 -1
- package/dist/editor-sync-types-C-zWaaVk.d.mts +95 -0
- package/dist/editorHostProtocol-D_h4y3rX.mjs +5 -0
- package/dist/editorHostSession-CCTwvUOB.mjs +479 -0
- package/dist/editorHostSession-lL7wPLnL.d.mts +184 -0
- package/dist/editorHostSession.d.mts +2 -0
- package/dist/editorHostSession.mjs +4 -0
- package/dist/embed.d.mts +1 -1
- package/dist/embed.mjs +31 -3
- package/dist/{graph-DuOeLGvh.d.mts → graph-yDK-MM3G.d.mts} +6 -4
- package/dist/graph.d.mts +1 -1
- package/dist/{index-ag6K2iAS.d.mts → index-BAkQThnl.d.mts} +9 -9
- package/dist/index.d.mts +7 -6
- package/dist/index.mjs +7 -5
- package/dist/{inspect-BZFzyeew.d.mts → inspect-CGJR4iZK.d.mts} +13 -3
- package/dist/{inspect-llcqYpZ1.mjs → inspect-DWu20a8g.mjs} +58 -31
- package/dist/inspect.d.mts +1 -1
- package/dist/inspect.mjs +2 -2
- package/dist/patchTypes.d.mts +1 -1
- package/dist/protocol.d.mts +44 -50
- package/dist/protocol.mjs +2 -2
- package/dist/{studio-txdyJHD7.mjs → schemas-b9wG-zYl.mjs} +15 -396
- package/dist/{statelyPragma-Bm9O4XV6.mjs → statelyPragma-CIzsR_Sx.mjs} +977 -934
- package/dist/studio-DHGspwII.mjs +397 -0
- package/dist/{studio-Bk_u41gu.d.mts → studio-YSppd-am.d.mts} +2 -2
- package/dist/studio.d.mts +1 -1
- package/dist/studio.mjs +1 -1
- package/dist/sync.d.mts +2 -2
- package/dist/sync.mjs +12 -5
- package/dist/{transport-CyCrdKyz.mjs → version-YJizbJxR.mjs} +14 -4
- package/package.json +7 -3
- /package/dist/{auth-2Thaw42j.d.mts → auth-B0ZTKri2.d.mts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INSPECTION_PROTOCOL_VERSION, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
2
|
-
import { i as
|
|
2
|
+
import { a as createEventRegistry, i as createWebSocketTransport, n as inspectionRuntime, o as createPendingExportManager, t as SDK_VERSION } from "./version-YJizbJxR.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openBrowser.ts
|
|
5
5
|
async function openBrowser(url) {
|
|
@@ -26,15 +26,6 @@ async function openBrowser(url) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/version.ts
|
|
31
|
-
const SDK_VERSION = "0.18.0";
|
|
32
|
-
function inspectionRuntime() {
|
|
33
|
-
if (typeof window !== "undefined") return "browser";
|
|
34
|
-
if (typeof process !== "undefined" && process.versions?.node) return "node";
|
|
35
|
-
return "unknown";
|
|
36
|
-
}
|
|
37
|
-
|
|
38
29
|
//#endregion
|
|
39
30
|
//#region src/inspect.ts
|
|
40
31
|
const defaultSerializeSnapshot = (snapshot) => ({
|
|
@@ -174,11 +165,29 @@ function createInspector(options = {}) {
|
|
|
174
165
|
for (const handler of set) handler(data);
|
|
175
166
|
}
|
|
176
167
|
const actors = /* @__PURE__ */ new Map();
|
|
168
|
+
const resolvedSessionIds = /* @__PURE__ */ new WeakMap();
|
|
169
|
+
const actorsByResolvedSessionId = /* @__PURE__ */ new Map();
|
|
177
170
|
const manualSessionIds = /* @__PURE__ */ new Map();
|
|
178
171
|
/** Tracks which actors we've already emitted local actor events for. */
|
|
179
172
|
const locallyRegistered = /* @__PURE__ */ new Set();
|
|
180
173
|
/** v5 emits transition facets separately; accumulate them until snapshot. */
|
|
181
174
|
const pendingTransitions = /* @__PURE__ */ new Map();
|
|
175
|
+
function sessionIdOf(actorRef) {
|
|
176
|
+
const existing = resolvedSessionIds.get(actorRef);
|
|
177
|
+
if (existing) return existing;
|
|
178
|
+
const resolved = options.resolveSessionId?.(actorRef, actorRef.sessionId) ?? actorRef.sessionId;
|
|
179
|
+
if (typeof resolved !== "string" || resolved.length === 0) throw new Error("createInspector(): resolveSessionId must return a non-empty string.");
|
|
180
|
+
const claimedBy = actorsByResolvedSessionId.get(resolved);
|
|
181
|
+
if (claimedBy !== void 0 && claimedBy !== actorRef || claimedBy === void 0 && actors.has(resolved)) throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
182
|
+
resolvedSessionIds.set(actorRef, resolved);
|
|
183
|
+
actorsByResolvedSessionId.set(resolved, actorRef);
|
|
184
|
+
return resolved;
|
|
185
|
+
}
|
|
186
|
+
function rootSessionIdOf(runtimeRootId, actorRef) {
|
|
187
|
+
let rootRef = actorRef;
|
|
188
|
+
while (rootRef._parent) rootRef = rootRef._parent;
|
|
189
|
+
return rootRef.sessionId === runtimeRootId ? sessionIdOf(rootRef) : runtimeRootId;
|
|
190
|
+
}
|
|
182
191
|
function emitRegisterOnce(entry) {
|
|
183
192
|
if (locallyRegistered.has(entry.sessionId)) return;
|
|
184
193
|
locallyRegistered.add(entry.sessionId);
|
|
@@ -200,10 +209,12 @@ function createInspector(options = {}) {
|
|
|
200
209
|
}
|
|
201
210
|
}
|
|
202
211
|
function toEntry(actorRef, rootActorId, details) {
|
|
212
|
+
const sessionId = sessionIdOf(actorRef);
|
|
213
|
+
const parentRef = details?.parentRef ?? actorRef._parent;
|
|
203
214
|
return {
|
|
204
|
-
sessionId
|
|
205
|
-
actorId: details?.id ?? actorRef.id ??
|
|
206
|
-
parentSessionId:
|
|
215
|
+
sessionId,
|
|
216
|
+
actorId: details?.id ?? actorRef.id ?? sessionId,
|
|
217
|
+
parentSessionId: parentRef ? sessionIdOf(parentRef) : null,
|
|
207
218
|
rootSessionId: rootActorId,
|
|
208
219
|
systemId: actorRef.systemId,
|
|
209
220
|
snapshot: details?.snapshot ? serializeSnapshot(details.snapshot) : snapshotValue(actorRef),
|
|
@@ -221,12 +232,17 @@ function createInspector(options = {}) {
|
|
|
221
232
|
...entry.stopped && { stopped: true }
|
|
222
233
|
};
|
|
223
234
|
}
|
|
235
|
+
function resolveActorTreeSessionIds(actorRef) {
|
|
236
|
+
sessionIdOf(actorRef);
|
|
237
|
+
const children = actorRef.getSnapshot()?.children ?? {};
|
|
238
|
+
for (const child of Object.values(children)) if (child) resolveActorTreeSessionIds(child);
|
|
239
|
+
}
|
|
224
240
|
/**
|
|
225
241
|
* Walk the actor tree and populate the local `actors` map. Idempotent —
|
|
226
242
|
* existing entries stay in place but have their snapshot refreshed.
|
|
227
243
|
*/
|
|
228
244
|
function backfillActorTree(actorRef, rootActorId) {
|
|
229
|
-
const existing = actors.get(actorRef
|
|
245
|
+
const existing = actors.get(sessionIdOf(actorRef));
|
|
230
246
|
const entry = existing ?? toEntry(actorRef, rootActorId);
|
|
231
247
|
if (existing) {
|
|
232
248
|
const snapshot = actorRef.getSnapshot();
|
|
@@ -260,7 +276,7 @@ function createInspector(options = {}) {
|
|
|
260
276
|
initSent = true;
|
|
261
277
|
}
|
|
262
278
|
function handleActor(actorRef, rootActorId, details) {
|
|
263
|
-
if (actors.has(actorRef
|
|
279
|
+
if (actors.has(sessionIdOf(actorRef))) return;
|
|
264
280
|
const entry = toEntry(actorRef, rootActorId, details);
|
|
265
281
|
actors.set(entry.sessionId, entry);
|
|
266
282
|
emitRegisterOnce(entry);
|
|
@@ -293,7 +309,7 @@ function createInspector(options = {}) {
|
|
|
293
309
|
}
|
|
294
310
|
function normalizeSentEvent(sentEvent) {
|
|
295
311
|
return {
|
|
296
|
-
...sentEvent.targetRef?.sessionId && { targetSessionId: sentEvent.targetRef
|
|
312
|
+
...sentEvent.targetRef?.sessionId && { targetSessionId: sessionIdOf(sentEvent.targetRef) },
|
|
297
313
|
targetId: sentEvent.targetId,
|
|
298
314
|
event: sentEvent.event,
|
|
299
315
|
...sentEvent.delay !== void 0 && { delay: sentEvent.delay },
|
|
@@ -301,10 +317,11 @@ function createInspector(options = {}) {
|
|
|
301
317
|
};
|
|
302
318
|
}
|
|
303
319
|
function createPendingTransition(actorRef, event = null, sourceRef) {
|
|
320
|
+
const sessionId = sessionIdOf(actorRef);
|
|
304
321
|
return {
|
|
305
|
-
previousSnapshot: actors.get(
|
|
322
|
+
previousSnapshot: actors.get(sessionId)?.snapshot ?? null,
|
|
306
323
|
event,
|
|
307
|
-
sourceSessionId: sourceRef
|
|
324
|
+
sourceSessionId: sourceRef ? sessionIdOf(sourceRef) : null,
|
|
308
325
|
actions: [],
|
|
309
326
|
transitions: [],
|
|
310
327
|
sent: []
|
|
@@ -325,15 +342,17 @@ function createInspector(options = {}) {
|
|
|
325
342
|
emitLocal("event", inspectedEvent);
|
|
326
343
|
}
|
|
327
344
|
function getPendingTransition(actorRef, event) {
|
|
328
|
-
const
|
|
345
|
+
const sessionId = sessionIdOf(actorRef);
|
|
346
|
+
const existing = pendingTransitions.get(sessionId);
|
|
329
347
|
if (existing) return existing;
|
|
330
348
|
const pending = createPendingTransition(actorRef, event);
|
|
331
|
-
pendingTransitions.set(
|
|
349
|
+
pendingTransitions.set(sessionId, pending);
|
|
332
350
|
return pending;
|
|
333
351
|
}
|
|
334
352
|
function handleTransition(actorRef, snapshot, triggeringEvent, rootActorId, transition) {
|
|
335
|
-
|
|
336
|
-
|
|
353
|
+
const sessionId = sessionIdOf(actorRef);
|
|
354
|
+
if (!actors.has(sessionId)) handleActor(actorRef, rootActorId);
|
|
355
|
+
const entry = actors.get(sessionId);
|
|
337
356
|
if (!entry) return;
|
|
338
357
|
const serialized = serializeSnapshot(snapshot);
|
|
339
358
|
const inspectedSnapshot = {
|
|
@@ -378,7 +397,7 @@ function createInspector(options = {}) {
|
|
|
378
397
|
function handleInspectionEvent(inspectionEvent) {
|
|
379
398
|
if (destroyed) return;
|
|
380
399
|
const event = inspectionEvent;
|
|
381
|
-
const rootActorId = event.rootId;
|
|
400
|
+
const rootActorId = rootSessionIdOf(event.rootId, event.actorRef);
|
|
382
401
|
const isNewRoot = !observedRootIds.has(rootActorId);
|
|
383
402
|
observedRootIds.add(rootActorId);
|
|
384
403
|
switch (event.type) {
|
|
@@ -390,11 +409,13 @@ function createInspector(options = {}) {
|
|
|
390
409
|
snapshot: event.snapshot
|
|
391
410
|
});
|
|
392
411
|
break;
|
|
393
|
-
case "@xstate.event":
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
412
|
+
case "@xstate.event": {
|
|
413
|
+
const sessionId = sessionIdOf(event.actorRef);
|
|
414
|
+
if (!actors.has(sessionId)) handleActor(event.actorRef, rootActorId);
|
|
415
|
+
handleEvent(sessionId, event.event, event.sourceRef ? sessionIdOf(event.sourceRef) : null);
|
|
416
|
+
pendingTransitions.set(sessionId, createPendingTransition(event.actorRef, event.event, event.sourceRef));
|
|
397
417
|
break;
|
|
418
|
+
}
|
|
398
419
|
case "@xstate.action":
|
|
399
420
|
getPendingTransition(event.actorRef).actions.push(normalizeAction(event.action));
|
|
400
421
|
break;
|
|
@@ -409,9 +430,9 @@ function createInspector(options = {}) {
|
|
|
409
430
|
case "@xstate.transition":
|
|
410
431
|
if (!event.actions || !event.microsteps || !event.sent) break;
|
|
411
432
|
handleTransition(event.actorRef, event.snapshot, event.event, rootActorId, {
|
|
412
|
-
previousSnapshot: actors.get(event.actorRef
|
|
433
|
+
previousSnapshot: actors.get(sessionIdOf(event.actorRef))?.snapshot ?? null,
|
|
413
434
|
event: event.event,
|
|
414
|
-
sourceSessionId: event.sourceRef
|
|
435
|
+
sourceSessionId: event.sourceRef ? sessionIdOf(event.sourceRef) : null,
|
|
415
436
|
actions: event.actions.map(normalizeAction),
|
|
416
437
|
transitions: event.microsteps.map(normalizeTakenTransition),
|
|
417
438
|
sent: event.sent.map(normalizeSentEvent)
|
|
@@ -423,9 +444,10 @@ function createInspector(options = {}) {
|
|
|
423
444
|
}
|
|
424
445
|
function attachActor(actor) {
|
|
425
446
|
const root = actor;
|
|
426
|
-
const rootActorId = root
|
|
447
|
+
const rootActorId = sessionIdOf(root);
|
|
427
448
|
const existing = inspectedRoots.get(rootActorId);
|
|
428
449
|
if (existing) return existing.subscription;
|
|
450
|
+
resolveActorTreeSessionIds(root);
|
|
429
451
|
observedRootIds.add(rootActorId);
|
|
430
452
|
const subscription = root.system.inspect(handleInspectionEvent);
|
|
431
453
|
inspectedRoots.set(rootActorId, {
|
|
@@ -443,8 +465,12 @@ function createInspector(options = {}) {
|
|
|
443
465
|
return manualSessionIds.get(actorId) ?? `${producerId}:${actorId}`;
|
|
444
466
|
}
|
|
445
467
|
function manualRegister(id, opts) {
|
|
468
|
+
const existingManualSessionId = manualSessionIds.get(id);
|
|
446
469
|
const sessionId = getManualSessionId(id);
|
|
447
|
-
if (actors.has(sessionId))
|
|
470
|
+
if (actors.has(sessionId)) {
|
|
471
|
+
if (existingManualSessionId === sessionId) return;
|
|
472
|
+
throw new Error(`createInspector(): manual actor session id "${sessionId}" conflicts with a resolved actor session id.`);
|
|
473
|
+
}
|
|
448
474
|
manualSessionIds.set(id, sessionId);
|
|
449
475
|
const parentSessionId = opts?.parent ? getManualSessionId(opts.parent) : null;
|
|
450
476
|
const entry = {
|
|
@@ -565,6 +591,7 @@ function createInspector(options = {}) {
|
|
|
565
591
|
exportManager.clear("Inspector destroyed");
|
|
566
592
|
events.clear();
|
|
567
593
|
actors.clear();
|
|
594
|
+
actorsByResolvedSessionId.clear();
|
|
568
595
|
inspectedRoots.clear();
|
|
569
596
|
observedRootIds.clear();
|
|
570
597
|
pendingTransitions.clear();
|
package/dist/inspect.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InspectionAction, InspectionSentEvent, InspectionTakenTransition } from "./protocol.mjs";
|
|
2
|
-
import { a as InspectedTransition, c as InspectorInspectionEvent, d as createStatelyInspector, f as Transport, i as InspectedSnapshot, l as ManualActorOptions, n as CreateInspectorOptions, o as Inspector, r as InspectedEvent, s as InspectorEvents, t as AdoptedActor, u as createInspector } from "./inspect-
|
|
2
|
+
import { a as InspectedTransition, c as InspectorInspectionEvent, d as createStatelyInspector, f as Transport, i as InspectedSnapshot, l as ManualActorOptions, n as CreateInspectorOptions, o as Inspector, r as InspectedEvent, s as InspectorEvents, t as AdoptedActor, u as createInspector } from "./inspect-CGJR4iZK.mjs";
|
|
3
3
|
export { AdoptedActor, CreateInspectorOptions, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InspectedEvent, InspectedSnapshot, InspectedTransition, InspectionAction, InspectionSentEvent, InspectionTakenTransition, Inspector, InspectorEvents, InspectorInspectionEvent, ManualActorOptions, Transport, createInspector, createStatelyInspector };
|
package/dist/inspect.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
1
|
+
import "./version-YJizbJxR.mjs";
|
|
2
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-DWu20a8g.mjs";
|
|
3
3
|
|
|
4
4
|
export { createInspector, createStatelyInspector };
|
package/dist/patchTypes.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as EditorStateType, n as CanvasColor, o as GraphPatch, s as ImplementationSourceType, t as ActionLocation } from "./index-
|
|
1
|
+
import { a as EditorStateType, n as CanvasColor, o as GraphPatch, s as ImplementationSourceType, t as ActionLocation } from "./index-BAkQThnl.mjs";
|
|
2
2
|
export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { i as StatelyGraph } from "./graph-
|
|
1
|
+
import { i as StatelyGraph } from "./graph-yDK-MM3G.mjs";
|
|
2
|
+
import { c as EditorSyncSourceLocation, f as MachineSourceLocations$1, l as EditorSyncSourceRange, t as EditorCapabilities$1, u as EditorSyncStateSourceLocation } from "./editor-sync-types-C-zWaaVk.mjs";
|
|
2
3
|
|
|
3
4
|
//#region src/protocol.d.ts
|
|
4
5
|
/** Query parameter carrying the unguessable inspection room capability. */
|
|
5
6
|
declare const INSPECTION_ROOM_QUERY_PARAM = "r";
|
|
6
7
|
/**
|
|
7
8
|
* Create the room-global identity for one producer-local actor session.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
9
|
+
* Runtime and producer-resolved session ids may use different uniqueness
|
|
10
|
+
* domains; the producer id supplies a stable room namespace.
|
|
10
11
|
*/
|
|
11
12
|
declare function createInspectionActorId(producerId: string, sessionId: string): string;
|
|
12
13
|
interface InspectionRoomUrls {
|
|
@@ -56,17 +57,7 @@ interface ValidationIssue {
|
|
|
56
57
|
level: 'info' | 'warning' | 'error';
|
|
57
58
|
message: string;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
edit?: boolean;
|
|
61
|
-
export?: boolean;
|
|
62
|
-
ai?: boolean;
|
|
63
|
-
simulate?: boolean;
|
|
64
|
-
inspect?: boolean;
|
|
65
|
-
navigateHierarchy?: boolean;
|
|
66
|
-
maxDepth?: number;
|
|
67
|
-
panels?: string[];
|
|
68
|
-
commands?: string[];
|
|
69
|
-
}
|
|
60
|
+
type EditorCapabilities = EditorCapabilities$1;
|
|
70
61
|
type ReadOnlyReason = 'free-plan' | 'access-unverified';
|
|
71
62
|
type CapabilityDeniedCapability = 'edit' | 'export' | 'ai' | 'simulate' | 'inspect' | 'navigateHierarchy' | 'panel' | 'mode';
|
|
72
63
|
interface CapabilityDeniedEvent {
|
|
@@ -76,39 +67,10 @@ interface CapabilityDeniedEvent {
|
|
|
76
67
|
message: string;
|
|
77
68
|
dedupeKey: string;
|
|
78
69
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
endChar: number;
|
|
84
|
-
}
|
|
85
|
-
interface SourceLocation {
|
|
86
|
-
uri: string;
|
|
87
|
-
range: SourceRange;
|
|
88
|
-
}
|
|
89
|
-
interface StateSourceLocation extends SourceLocation {
|
|
90
|
-
path: string[];
|
|
91
|
-
kind: 'inline' | 'objectReference' | 'createStateConfig';
|
|
92
|
-
symbol?: string;
|
|
93
|
-
keyRange?: SourceRange;
|
|
94
|
-
referenceRange?: SourceRange;
|
|
95
|
-
keySource?: {
|
|
96
|
-
kind: 'const' | 'enumMember' | 'computedLiteral';
|
|
97
|
-
symbol?: string;
|
|
98
|
-
valueRange?: SourceRange;
|
|
99
|
-
machineLocal?: boolean;
|
|
100
|
-
};
|
|
101
|
-
keyReplacementText?: string;
|
|
102
|
-
}
|
|
103
|
-
interface MachineSourceLocations {
|
|
104
|
-
version: 1;
|
|
105
|
-
root?: SourceLocation;
|
|
106
|
-
statesObject?: StateSourceLocation;
|
|
107
|
-
states: StateSourceLocation[];
|
|
108
|
-
staticValues?: Array<SourceLocation & {
|
|
109
|
-
value: string;
|
|
110
|
-
}>;
|
|
111
|
-
}
|
|
70
|
+
type SourceRange = EditorSyncSourceRange;
|
|
71
|
+
type SourceLocation = EditorSyncSourceLocation;
|
|
72
|
+
type StateSourceLocation = EditorSyncStateSourceLocation;
|
|
73
|
+
type MachineSourceLocations = MachineSourceLocations$1;
|
|
112
74
|
interface ExportFormatMap {
|
|
113
75
|
xstate: {
|
|
114
76
|
options: {
|
|
@@ -297,6 +259,29 @@ interface SetApiKeyMessage {
|
|
|
297
259
|
type: '@statelyai.setApiKey';
|
|
298
260
|
apiKey: string;
|
|
299
261
|
}
|
|
262
|
+
interface SavedMessage {
|
|
263
|
+
type: '@statelyai.saved';
|
|
264
|
+
graph: unknown;
|
|
265
|
+
}
|
|
266
|
+
interface ClipboardReadResponseMessage {
|
|
267
|
+
type: '@statelyai.clipboardReadResponse';
|
|
268
|
+
requestId: string;
|
|
269
|
+
text: string;
|
|
270
|
+
}
|
|
271
|
+
interface ClipboardWriteResponseMessage {
|
|
272
|
+
type: '@statelyai.clipboardWriteResponse';
|
|
273
|
+
requestId: string;
|
|
274
|
+
ok: boolean;
|
|
275
|
+
}
|
|
276
|
+
interface ClipboardReadMessage {
|
|
277
|
+
type: '@statelyai.clipboardRead';
|
|
278
|
+
requestId: string;
|
|
279
|
+
}
|
|
280
|
+
interface ClipboardWriteMessage {
|
|
281
|
+
type: '@statelyai.clipboardWrite';
|
|
282
|
+
requestId: string;
|
|
283
|
+
text: string;
|
|
284
|
+
}
|
|
300
285
|
interface ProjectInitMessage {
|
|
301
286
|
type: '@statelyai.project.init';
|
|
302
287
|
machines: ProjectEmbedMachine[];
|
|
@@ -463,6 +448,15 @@ interface SystemActorStoppedMessage {
|
|
|
463
448
|
interface ReadyMessage {
|
|
464
449
|
type: '@statelyai.ready';
|
|
465
450
|
version: string;
|
|
451
|
+
protocolVersion?: number;
|
|
452
|
+
}
|
|
453
|
+
interface EditorHandshakeMessage {
|
|
454
|
+
type: '@statelyai.handshake';
|
|
455
|
+
protocolVersion: number;
|
|
456
|
+
client?: {
|
|
457
|
+
name: string;
|
|
458
|
+
version: string;
|
|
459
|
+
};
|
|
466
460
|
}
|
|
467
461
|
interface LoadedMessage {
|
|
468
462
|
type: '@statelyai.loaded';
|
|
@@ -546,9 +540,9 @@ interface UploadResponseMessage {
|
|
|
546
540
|
result: UploadResult;
|
|
547
541
|
}
|
|
548
542
|
/** All messages a client (embed/inspector) can send to the viz. */
|
|
549
|
-
type ClientMessage = InitMessage | SetApiKeyMessage | ProjectInitMessage | ProjectUpdateMessage | ProjectSelectMachineMessage | UpdateMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | InspectSnapshotMessage | SystemInitMessage | SystemSelectActorMessage | SystemActorRegisteredMessage | SystemActorEventMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ErrorMessage;
|
|
543
|
+
type ClientMessage = InitMessage | SetApiKeyMessage | EditorHandshakeMessage | SavedMessage | ClipboardReadResponseMessage | ClipboardWriteResponseMessage | ProjectInitMessage | ProjectUpdateMessage | ProjectSelectMachineMessage | UpdateMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | InspectSnapshotMessage | SystemInitMessage | SystemSelectActorMessage | SystemActorRegisteredMessage | SystemActorEventMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ErrorMessage;
|
|
550
544
|
/** All messages the viz can send back to a client. */
|
|
551
|
-
type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | ProjectMachineSelectedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | UploadRequestMessage;
|
|
545
|
+
type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | ProjectMachineSelectedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | ClipboardReadMessage | ClipboardWriteMessage | UploadRequestMessage;
|
|
552
546
|
interface InspectionClientMetadata {
|
|
553
547
|
name?: string;
|
|
554
548
|
machineId?: string;
|
|
@@ -577,4 +571,4 @@ declare const PREFIX = "@statelyai.";
|
|
|
577
571
|
/** Current WebSocket inspection protocol version. */
|
|
578
572
|
declare const INSPECTION_PROTOCOL_VERSION = 2;
|
|
579
573
|
//#endregion
|
|
580
|
-
export { ActorSystemEntry, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, LoadedMessage, MachineInitOptions, MachineSourceLocations, PREFIX, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectUpdateMessage, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VizMessage, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
|
574
|
+
export { ActorSystemEntry, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, ClipboardReadMessage, ClipboardReadResponseMessage, ClipboardWriteMessage, ClipboardWriteResponseMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EditorHandshakeMessage, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, LoadedMessage, MachineInitOptions, MachineSourceLocations, PREFIX, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectUpdateMessage, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SavedMessage, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VizMessage, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
package/dist/protocol.mjs
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
const INSPECTION_ROOM_QUERY_PARAM = "r";
|
|
4
4
|
/**
|
|
5
5
|
* Create the room-global identity for one producer-local actor session.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Runtime and producer-resolved session ids may use different uniqueness
|
|
7
|
+
* domains; the producer id supplies a stable room namespace.
|
|
8
8
|
*/
|
|
9
9
|
function createInspectionActorId(producerId, sessionId) {
|
|
10
10
|
return `${encodeURIComponent(producerId)}:${encodeURIComponent(sessionId)}`;
|