@statelyai/sdk 0.14.0 → 0.14.2

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/embed.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { i as StatelyGraph } from "./graph-3oSqiY4N.mjs";
1
2
  import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
2
3
  import { AssetUploadAdapter } from "./assetStorage.mjs";
3
4
 
@@ -49,9 +50,9 @@ interface StatelyEmbedOptions extends Partial<MachineInitOptions> {
49
50
  /** Asset upload configuration. If omitted, files are stored as base64 data URLs. */
50
51
  assets?: AssetConfig;
51
52
  onReady?: () => void;
52
- onLoaded?: (graph: unknown) => void;
53
- onChange?: (graph: unknown, machineConfig: unknown) => void;
54
- onSave?: (graph: unknown, machineConfig: unknown) => void;
53
+ onLoaded?: (graph: StatelyGraph) => void;
54
+ onChange?: (graph: StatelyGraph, machineConfig: unknown) => void;
55
+ onSave?: (graph: StatelyGraph, machineConfig: unknown) => void;
55
56
  onError?: (error: {
56
57
  code: string;
57
58
  message: string;
@@ -1,4 +1,4 @@
1
- import { r as CodeExpression } from "./index-DVjNSTuQ.mjs";
1
+ import { r as CodeExpression } from "./index-CcgKzQ-C.mjs";
2
2
  import * as _statelyai_graph0 from "@statelyai/graph";
3
3
  import { Graph } from "@statelyai/graph";
4
4
 
@@ -18,6 +18,7 @@ interface DigraphNodeInvokeData {
18
18
  }
19
19
  interface DigraphEdgeData {
20
20
  eventTypeData: EventTypeData;
21
+ matches?: Record<string, unknown>;
21
22
  guard?: ExtractorGuard;
22
23
  transitions?: DigraphEdgeTransition[];
23
24
  actions: DigraphAction[];
@@ -203,6 +204,7 @@ interface DigraphData {
203
204
  }
204
205
  interface DigraphConfig {
205
206
  id: string;
207
+ profile?: 'xstate-v5' | 'xstate-v6-alpha';
206
208
  rootNode: DigraphNodeConfig;
207
209
  edges: DigraphEdgeConfig[];
208
210
  context: Record<string, JsonItem> | JsonExpressionString;
@@ -324,6 +326,7 @@ interface StatelyNodeData {
324
326
  }
325
327
  interface StatelyEdgeData {
326
328
  eventType: string;
329
+ matches?: Record<string, unknown>;
327
330
  transitionType?: 'normal' | 'targetless' | 'reenter';
328
331
  guard?: StatelyGuard | null;
329
332
  actions?: StatelyAction[];
@@ -332,6 +335,7 @@ interface StatelyEdgeData {
332
335
  meta?: Record<string, unknown> | null;
333
336
  }
334
337
  interface StatelyGraphData {
338
+ profile?: 'xstate-v5' | 'xstate-v6-alpha';
335
339
  schemas?: {
336
340
  context?: Record<string, SimpleJsonSchema> | null;
337
341
  events?: Record<string, SimpleJsonSchemaObject> | null;
package/dist/graph.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-R0sbxnZ7.mjs";
1
+ import { _ as studioMachineConverter, a as StatelyGraphData, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, n as StatelyActorImplementation, o as StatelyGuard, p as StudioEventTypeData, r as StatelyEdgeData, s as StatelyImplementation, t as StatelyAction, u as StatelyTagImplementation, v as toStudioMachine } from "./graph-3oSqiY4N.mjs";
2
2
  export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
package/dist/graph.mjs CHANGED
@@ -286,6 +286,7 @@ function toStudioMachine(graph) {
286
286
  } } : {},
287
287
  data: {
288
288
  eventTypeData: toStudioEventTypeData(eventType),
289
+ ...edge.data.matches ? { matches: edge.data.matches } : {},
289
290
  actions: (edge.data.actions ?? []).map(toStudioAction),
290
291
  ...edge.data.guard ? { guard: {
291
292
  kind: edge.data.guard.code ? "inline" : "named",
@@ -305,6 +306,7 @@ function toStudioMachine(graph) {
305
306
  edges: studioEdges,
306
307
  context: {},
307
308
  ...graph.data?.schemas ? { schemas: normalizeSchemas(graph.data.schemas) } : {},
309
+ ...graph.data?.profile ? { profile: graph.data.profile } : {},
308
310
  ...graph.data?.implementations ? { implementations: {
309
311
  actions: Object.fromEntries(graph.data.implementations.actions.map((action) => [action.name, toActionSource(action)])),
310
312
  guards: Object.fromEntries(graph.data.implementations.guards.map((guard) => [guard.name, toGuardSource(guard)])),
@@ -332,6 +334,7 @@ function fromStudioMachine(studioMachine) {
332
334
  } : {},
333
335
  data: {
334
336
  eventType: fromStudioEventTypeData(edge.data.eventTypeData),
337
+ ...edge.data.matches ? { matches: edge.data.matches } : {},
335
338
  transitionType: edge.target ? "normal" : "targetless",
336
339
  ...edge.data.guard ? { guard: {
337
340
  type: edge.data.guard.type,
@@ -352,6 +355,7 @@ function fromStudioMachine(studioMachine) {
352
355
  })),
353
356
  edges: edges.map(({ type: _type, ...edge }) => edge),
354
357
  data: {
358
+ ...studioMachine.profile ? { profile: studioMachine.profile } : {},
355
359
  ...studioMachine.schemas ? { schemas: studioMachine.schemas } : {},
356
360
  ...studioMachine.implementations ? { implementations: {
357
361
  actions: Object.entries(studioMachine.implementations.actions).filter(([key]) => !key.startsWith("inline:")).map(([, source]) => fromActionSource(source)),
@@ -2129,6 +2129,13 @@ interface ZodReadonly<T extends SomeType = $ZodType> extends _ZodType<$ZodReadon
2129
2129
  }
2130
2130
  declare const ZodReadonly: $constructor<ZodReadonly>;
2131
2131
  //#endregion
2132
+ //#region ../../node_modules/.pnpm/xstate@6.0.0-alpha.24/node_modules/xstate/dist/declarations/src/index.d.ts
2133
+ declare global {
2134
+ interface SymbolConstructor {
2135
+ readonly observable: symbol;
2136
+ }
2137
+ }
2138
+ //#endregion
2132
2139
  //#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
2133
2140
  // ==================================================================================================
2134
2141
  // JSON Schema Draft 07
@@ -2270,6 +2277,10 @@ interface JSONSchema7 {
2270
2277
  //#endregion
2271
2278
  //#region ../graph-tools/dist/index.d.mts
2272
2279
  //#endregion
2280
+ //#region src/machineProfile.d.ts
2281
+ declare const MACHINE_PROFILES: readonly ["xstate-v5", "xstate-v6-alpha"];
2282
+ type MachineProfile = (typeof MACHINE_PROFILES)[number];
2283
+ //#endregion
2273
2284
  //#region src/codegenTypes.d.ts
2274
2285
  interface CodeGenAction {
2275
2286
  /** Graph-native block id, referenced by `@statelyai.action.*` transitions. */
@@ -2303,8 +2314,12 @@ interface CodeImport {
2303
2314
  }
2304
2315
  interface CodeGenInvoke {
2305
2316
  src: string;
2317
+ /** Exact authored actor-logic expression for inline/direct actor sources. */
2318
+ srcExpression?: CodeExpression;
2306
2319
  id: string;
2307
2320
  invocationId?: string;
2321
+ registryKey?: string;
2322
+ timeout?: number | string | CodeExpression;
2308
2323
  input?: Record<string, unknown> | CodeExpression;
2309
2324
  output?: Record<string, unknown> | CodeExpression;
2310
2325
  }
@@ -2313,6 +2328,9 @@ interface CodeGenNodeData {
2313
2328
  key: string;
2314
2329
  type?: 'normal' | 'parallel' | 'final' | 'history' | 'choice' | null;
2315
2330
  initialId?: string | null;
2331
+ initialInput?: Record<string, unknown> | CodeExpression;
2332
+ timeout?: number | string | CodeExpression;
2333
+ route?: Record<string, unknown> | CodeExpression;
2316
2334
  history?: 'shallow' | 'deep' | boolean;
2317
2335
  output?: Record<string, unknown> | CodeExpression;
2318
2336
  entry?: CodeGenAction[];
@@ -2329,14 +2347,18 @@ interface CodeGenNodeData {
2329
2347
  }
2330
2348
  interface CodeGenEdgeData {
2331
2349
  eventType: string;
2350
+ matches?: Record<string, unknown>;
2332
2351
  transitionType?: 'normal' | 'targetless' | 'reenter';
2333
2352
  guard?: CodeGenGuard | null;
2334
2353
  context?: Record<string, unknown> | CodeExpression;
2354
+ input?: Record<string, unknown> | CodeExpression;
2335
2355
  actions?: CodeGenAction[];
2336
2356
  description?: string | null;
2337
2357
  color?: string;
2338
2358
  meta?: Record<string, unknown> | null;
2339
2359
  temp?: unknown;
2360
+ /** Derived visualization edge for a destination state's `route` config. */
2361
+ route?: boolean;
2340
2362
  }
2341
2363
  interface CodeGenImplementation {
2342
2364
  id: string;
@@ -2362,6 +2384,7 @@ interface CodeGenActorImplementation {
2362
2384
  } | null;
2363
2385
  }
2364
2386
  interface CodeGenGraphData {
2387
+ profile?: MachineProfile;
2365
2388
  context?: Record<string, unknown> | CodeExpression | null;
2366
2389
  schemas?: {
2367
2390
  context?: Record<string, JSONSchema7> | null;
@@ -2422,6 +2445,12 @@ declare class RawCode {
2422
2445
  }
2423
2446
  declare function raw(code: string): RawCode;
2424
2447
  declare function serializeJS(value: unknown, indent?: number, step?: number): string; //#endregion
2448
+ //#region src/v6Simulation.d.ts
2449
+ /**
2450
+ * Adapts Viz's serializable choice projection to XState v6's executable
2451
+ * `choice` function. Other v6 config stays untouched.
2452
+ */
2453
+ //#endregion
2425
2454
  //#region src/graphToXStateTS.d.ts
2426
2455
  interface XStateTSOptions extends MachineConfigOptions {
2427
2456
  exportStyle?: 'named' | 'default' | 'none';
@@ -2510,6 +2539,9 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2510
2539
  }>>>;
2511
2540
  description: ZodOptional<ZodString>;
2512
2541
  initialId: ZodOptional<ZodNullable<ZodString>>;
2542
+ initialInput: ZodOptional<ZodUnknown>;
2543
+ timeout: ZodOptional<ZodUnknown>;
2544
+ route: ZodOptional<ZodUnknown>;
2513
2545
  }, $strip>;
2514
2546
  }, $strip>, ZodObject<{
2515
2547
  op: ZodLiteral<"deleteNode">;
@@ -2522,6 +2554,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2522
2554
  sourceId: ZodString;
2523
2555
  targetId: ZodString;
2524
2556
  eventType: ZodString;
2557
+ matches: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2525
2558
  transitionType: ZodOptional<ZodEnum<{
2526
2559
  normal: "normal";
2527
2560
  targetless: "targetless";
@@ -2535,12 +2568,14 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2535
2568
  sourceId: ZodOptional<ZodString>;
2536
2569
  targetId: ZodOptional<ZodString>;
2537
2570
  eventType: ZodOptional<ZodString>;
2571
+ matches: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2538
2572
  transitionType: ZodOptional<ZodEnum<{
2539
2573
  normal: "normal";
2540
2574
  targetless: "targetless";
2541
2575
  reenter: "reenter";
2542
2576
  }>>;
2543
2577
  description: ZodOptional<ZodNullable<ZodString>>;
2578
+ input: ZodOptional<ZodUnknown>;
2544
2579
  }, $strip>;
2545
2580
  }, $strip>, ZodObject<{
2546
2581
  op: ZodLiteral<"deleteEdge">;
@@ -2586,6 +2621,9 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2586
2621
  }>>>;
2587
2622
  stateDescription: ZodOptional<ZodString>;
2588
2623
  initialId: ZodOptional<ZodNullable<ZodString>>;
2624
+ initialInput: ZodOptional<ZodUnknown>;
2625
+ timeout: ZodOptional<ZodUnknown>;
2626
+ route: ZodOptional<ZodUnknown>;
2589
2627
  color: ZodOptional<ZodNullable<ZodEnum<{
2590
2628
  green: "green";
2591
2629
  red: "red";
@@ -2612,6 +2650,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2612
2650
  sourceId: ZodString;
2613
2651
  targetId: ZodString;
2614
2652
  eventType: ZodString;
2653
+ matches: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2615
2654
  transitionType: ZodOptional<ZodEnum<{
2616
2655
  normal: "normal";
2617
2656
  targetless: "targetless";
@@ -2633,6 +2672,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2633
2672
  teal: "teal";
2634
2673
  }>>>;
2635
2674
  transitionDescription: ZodOptional<ZodNullable<ZodString>>;
2675
+ input: ZodOptional<ZodUnknown>;
2636
2676
  }, $strip>, ZodObject<{
2637
2677
  op: ZodLiteral<"updateTransition">;
2638
2678
  description: ZodOptional<ZodString>;
@@ -2640,12 +2680,14 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2640
2680
  sourceId: ZodOptional<ZodString>;
2641
2681
  targetId: ZodOptional<ZodString>;
2642
2682
  eventType: ZodOptional<ZodString>;
2683
+ matches: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2643
2684
  transitionType: ZodOptional<ZodEnum<{
2644
2685
  normal: "normal";
2645
2686
  targetless: "targetless";
2646
2687
  reenter: "reenter";
2647
2688
  }>>;
2648
2689
  transitionDescription: ZodOptional<ZodNullable<ZodString>>;
2690
+ input: ZodOptional<ZodUnknown>;
2649
2691
  color: ZodOptional<ZodNullable<ZodEnum<{
2650
2692
  green: "green";
2651
2693
  red: "red";
@@ -2720,9 +2762,12 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2720
2762
  id: ZodOptional<ZodString>;
2721
2763
  invocationId: ZodOptional<ZodString>;
2722
2764
  src: ZodString;
2765
+ srcExpression: ZodOptional<ZodUnknown>;
2723
2766
  code: ZodOptional<ZodString>;
2724
- input: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2725
- output: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2767
+ registryKey: ZodOptional<ZodString>;
2768
+ timeout: ZodOptional<ZodUnknown>;
2769
+ input: ZodOptional<ZodUnknown>;
2770
+ output: ZodOptional<ZodUnknown>;
2726
2771
  }, $strip>;
2727
2772
  }, $strip>, ZodObject<{
2728
2773
  op: ZodLiteral<"updateInvoke">;
@@ -2732,9 +2777,12 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
2732
2777
  data: ZodObject<{
2733
2778
  invocationId: ZodOptional<ZodString>;
2734
2779
  src: ZodOptional<ZodString>;
2780
+ srcExpression: ZodOptional<ZodUnknown>;
2735
2781
  code: ZodOptional<ZodString>;
2736
- input: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2737
- output: ZodOptional<ZodRecord<ZodString, ZodUnknown>>;
2782
+ registryKey: ZodOptional<ZodString>;
2783
+ timeout: ZodOptional<ZodUnknown>;
2784
+ input: ZodOptional<ZodUnknown>;
2785
+ output: ZodOptional<ZodUnknown>;
2738
2786
  }, $strip>;
2739
2787
  }, $strip>, ZodObject<{
2740
2788
  op: ZodLiteral<"deleteInvoke">;
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
2
+ import { _ as serializeJS, c as MachineConfigOptions, d as contextSchemaToTSType, f as eventsSchemaToTSType, g as raw, h as jsonSchemaToTSType, i as CodeGenGraph, l as RawCode, m as graphToXStateTS, o as GraphPatch, p as graphToMachineConfig, t as ActionLocation, u as XStateTSOptions } from "./index-CcgKzQ-C.mjs";
3
+ import { C as EventTypeData, S as DigraphNodeConfig, _ as studioMachineConverter, a as StatelyGraphData, b as DigraphConfig, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, o as StatelyGuard, r as StatelyEdgeData, t as StatelyAction, v as toStudioMachine, w as StateNodeJSONData, x as DigraphEdgeConfig, y as DigraphAction } from "./graph-3oSqiY4N.mjs";
2
4
  import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, InitOptions, InspectionAction, InspectionSentEvent, InspectionTakenTransition, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
3
5
  import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
4
- import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-DmPZiERd.mjs";
6
+ import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-D9-iLi-S.mjs";
5
7
  import { AssetConfig, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
6
- import { _ as serializeJS, c as MachineConfigOptions, d as contextSchemaToTSType, f as eventsSchemaToTSType, g as raw, h as jsonSchemaToTSType, i as CodeGenGraph, l as RawCode, m as graphToXStateTS, o as GraphPatch, p as graphToMachineConfig, t as ActionLocation, u as XStateTSOptions } from "./index-DVjNSTuQ.mjs";
7
- import { C as EventTypeData, S as DigraphNodeConfig, _ as studioMachineConverter, a as StatelyGraphData, b as DigraphConfig, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, o as StatelyGuard, r as StatelyEdgeData, t as StatelyAction, v as toStudioMachine, w as StateNodeJSONData, x as DigraphEdgeConfig, y as DigraphAction } from "./graph-R0sbxnZ7.mjs";
8
8
  import { _ as createPostMessageTransport, a as InspectedTransition, c as InspectorInspectionEvent, d as createStatelyInspector, f as MultiplexedChannelOptions, g as createMultiplexedWebSocketConnection, h as Transport, i as InspectedSnapshot, l as ManualActorOptions, m as MultiplexedWebSocketConnectionOptions, n as CreateInspectorOptions, o as Inspector, p as MultiplexedWebSocketConnection, r as InspectedEvent, s as InspectorEvents, t as AdoptedActor, u as createInspector, v as createWebSocketTransport } from "./inspect-DQ_7I7eH.mjs";
9
9
  import { ConnectedRepo, CreateMachineFromDefinitionInput, CreateMachineFromTemplateInput, CreateMachineInput, CreateMachineTemplate, CreateProjectInput, EnsureProjectInput, ExtractMachinesResponse, ExtractedMachine, GetMachineOptions, ProjectData, ProjectMachine, ProjectVisibility, RepoType, StudioApiError, StudioClient, StudioClientOptions, StudioMachineRecord, UpdateMachineInput, VerifyApiKeyResponse, XStateVersion, createStatelyClient } from "./studio.mjs";
10
10
  import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
package/dist/index.mjs CHANGED
@@ -2,12 +2,12 @@ import { n as createPostMessageTransport, r as createWebSocketTransport, t as cr
2
2
  import { INSPECTION_PROTOCOL_VERSION } from "./protocol.mjs";
3
3
  import { createStatelyEmbed } from "./embed.mjs";
4
4
  import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
5
- import { n as createStatelyInspector, t as createInspector } from "./inspect-BcKTFJI1.mjs";
5
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-DWDTNMEc.mjs";
6
6
  import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
7
7
  import { StudioApiError, createStatelyClient } from "./studio.mjs";
8
8
  import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
9
9
  import { StatelyApiError, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
10
- import { a as eventsSchemaToTSType, c as jsonSchemaToTSType, f as findStatelyPragmaAttachments, l as raw, m as upsertStatelyPragma, n as RawCode, o as graphToMachineConfig, p as getStatelyPragma, r as contextSchemaToTSType, s as graphToXStateTS, u as serializeJS } from "./dist-C8jVuuHf.mjs";
10
+ import { a as eventsSchemaToTSType, c as jsonSchemaToTSType, f as findStatelyPragmaAttachments, l as raw, m as upsertStatelyPragma, n as RawCode, o as graphToMachineConfig, p as getStatelyPragma, r as contextSchemaToTSType, s as graphToXStateTS, u as serializeJS } from "./dist-CO36Ks-i.mjs";
11
11
  import { fromStudioMachine, studioMachineConverter, toStudioMachine } from "./graph.mjs";
12
12
  import { createInspectionRelay } from "./relay.mjs";
13
13
 
@@ -61,6 +61,7 @@ function createInspector(options = {}) {
61
61
  let initSent = false;
62
62
  let initialized = false;
63
63
  let pendingTransportReady = false;
64
+ let transportWasReady = false;
64
65
  let didAutoOpen = false;
65
66
  const pendingMessages = [];
66
67
  const events = createEventRegistry();
@@ -81,9 +82,16 @@ function createInspector(options = {}) {
81
82
  transport.send(msg);
82
83
  }
83
84
  function handleTransportReady() {
84
- pendingMessages.length = 0;
85
- initSent = false;
86
- sendInit();
85
+ if (!transportWasReady) {
86
+ transportWasReady = true;
87
+ if (!initSent) sendInit();
88
+ const queued = pendingMessages.splice(0);
89
+ for (const message of queued) transport.send(message);
90
+ } else {
91
+ pendingMessages.length = 0;
92
+ initSent = false;
93
+ sendInit();
94
+ }
87
95
  if (autoOpen && !didAutoOpen && ownsTransport) {
88
96
  didAutoOpen = true;
89
97
  const launchUrl = createInspectorLaunchUrl(url, sessionId);
@@ -372,7 +380,7 @@ function createInspector(options = {}) {
372
380
  break;
373
381
  default: break;
374
382
  }
375
- if (isNewRoot && initSent) sendInit();
383
+ if (isNewRoot) sendInit();
376
384
  }
377
385
  function attachActor(actor) {
378
386
  const root = actor;
@@ -386,7 +394,7 @@ function createInspector(options = {}) {
386
394
  subscription
387
395
  });
388
396
  backfillActorTree(root, rootActorId);
389
- if (initSent) sendInit();
397
+ sendInit();
390
398
  return { unsubscribe() {
391
399
  subscription.unsubscribe();
392
400
  inspectedRoots.delete(rootActorId);
@@ -405,7 +413,8 @@ function createInspector(options = {}) {
405
413
  machineConfig: opts?.machine ?? null
406
414
  };
407
415
  actors.set(id, entry);
408
- if (initSent) send({
416
+ if (!initSent) sendInit();
417
+ else send({
409
418
  type: "@statelyai.system.actorRegistered",
410
419
  actorId: id,
411
420
  parentActorId: entry.parentActorId,
package/dist/inspect.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as createStatelyInspector, t as createInspector } from "./inspect-BcKTFJI1.mjs";
1
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-DWDTNMEc.mjs";
2
2
 
3
3
  export { createInspector, createStatelyInspector };
@@ -1,2 +1,2 @@
1
- import { a as EditorStateType, n as CanvasColor, o as GraphPatch, s as ImplementationSourceType, t as ActionLocation } from "./index-DVjNSTuQ.mjs";
1
+ import { a as EditorStateType, n as CanvasColor, o as GraphPatch, s as ImplementationSourceType, t as ActionLocation } from "./index-CcgKzQ-C.mjs";
2
2
  export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
@@ -1,3 +1,5 @@
1
+ import { i as StatelyGraph } from "./graph-3oSqiY4N.mjs";
2
+
1
3
  //#region src/protocol.d.ts
2
4
  type EmbedMode = "editing" | "viewing" | "simulating" | "inspecting";
3
5
  interface CommentsConfig {
@@ -139,19 +141,19 @@ interface EmbedEventMap {
139
141
  version: string;
140
142
  };
141
143
  loaded: {
142
- graph: unknown;
144
+ graph: StatelyGraph;
143
145
  machineId?: string;
144
146
  sourceLocations?: MachineSourceLocations;
145
147
  };
146
148
  change: {
147
- graph: unknown;
149
+ graph: StatelyGraph;
148
150
  machineConfig: unknown;
149
151
  machineId?: string;
150
152
  patches?: unknown[];
151
153
  sourceLocations?: MachineSourceLocations;
152
154
  };
153
155
  save: {
154
- graph: unknown;
156
+ graph: StatelyGraph;
155
157
  machineConfig: unknown;
156
158
  machineId?: string;
157
159
  patches?: unknown[];
@@ -427,13 +429,13 @@ interface ReadyMessage {
427
429
  }
428
430
  interface LoadedMessage {
429
431
  type: "@statelyai.loaded";
430
- graph: unknown;
432
+ graph: StatelyGraph;
431
433
  machineId?: string;
432
434
  sourceLocations?: MachineSourceLocations;
433
435
  }
434
436
  interface ChangeMessage {
435
437
  type: "@statelyai.change";
436
- graph: unknown;
438
+ graph: StatelyGraph;
437
439
  machineConfig: unknown;
438
440
  machineId?: string;
439
441
  patches?: unknown[];
@@ -441,7 +443,7 @@ interface ChangeMessage {
441
443
  }
442
444
  interface SaveMessage {
443
445
  type: "@statelyai.save";
444
- graph: unknown;
446
+ graph: StatelyGraph;
445
447
  machineConfig: unknown;
446
448
  machineId?: string;
447
449
  patches?: unknown[];
package/dist/studio.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-DmPZiERd.mjs";
1
+ import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-D9-iLi-S.mjs";
2
2
 
3
3
  //#region src/studio.d.ts
4
4
  interface StudioClientOptions {
package/dist/sync.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { b as DigraphConfig, i as StatelyGraph } from "./graph-R0sbxnZ7.mjs";
1
+ import { b as DigraphConfig, i as StatelyGraph } from "./graph-3oSqiY4N.mjs";
2
2
  import { CreateProjectInput, ProjectData, StudioClient, StudioMachineRecord, XStateVersion } from "./studio.mjs";
3
3
  import { GraphDiff } from "@statelyai/graph";
4
4