@statelyai/sdk 0.29.0 → 0.29.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 CHANGED
@@ -303,7 +303,10 @@ relay. An explicit `url` wins over `STATELY_INSPECT_URL`, which wins over the
303
303
  hosted default. See `@statelyai/sdk/protocol` for the versioned message and
304
304
  `?r=` query contract. SDK producer registration also reports its SDK version
305
305
  and coarse browser, Node, or unknown runtime; it never adds inspection payloads
306
- to registration metadata.
306
+ to registration metadata. Protocol mismatches and registration errors reject
307
+ `ready` and close the connection without retrying. Browser transports use
308
+ application close code `4002`, with a fixed reason that stays within the
309
+ WebSocket UTF-8 length limit.
307
310
 
308
311
  ### CLI and sync
309
312
 
package/dist/embed.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { i as ProfileManifest } from "./index-DNDfA-YC.mjs";
2
- import { i as StatelyGraph } from "./graph-5X1Ilppq.mjs";
1
+ import { i as ProfileManifest } from "./index-D4pdeDpT.mjs";
2
+ import { i as StatelyGraph } from "./graph-C8E1Exad.mjs";
3
3
  import { n as EmbedPanelPosition, t as EmbedPanelConfig } from "./embedPanel-Bpbq4sfJ.mjs";
4
4
  import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExtensionsManifest, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, MachineVersionAutoSaveOptions, ProjectEmbedMachine, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceProject, UploadResult } from "./protocol.mjs";
5
5
  import { AssetUploadAdapter } from "./assetStorage.mjs";
package/dist/embed.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-BJPr6idb.mjs";
1
+ import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-DC3yW9Dk.mjs";
2
2
  import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
3
3
 
4
4
  //#region src/embed.ts
@@ -80,6 +80,7 @@ function extractInitOptions(options) {
80
80
  mode: options.mode,
81
81
  theme: options.theme,
82
82
  readOnly: options.readOnly,
83
+ readOnlyReason: options.readOnlyReason,
83
84
  depth: options.depth,
84
85
  capabilities: options.capabilities,
85
86
  examples: options.examples,
@@ -1,4 +1,4 @@
1
- import { t as CodeExpression } from "./index-DNDfA-YC.mjs";
1
+ import { t as CodeExpression } from "./index-D4pdeDpT.mjs";
2
2
  import * as _statelyai_graph0 from "@statelyai/graph";
3
3
  import { Graph } from "@statelyai/graph";
4
4
 
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-5X1Ilppq.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-C8E1Exad.mjs";
2
2
  export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
@@ -3011,4 +3011,4 @@ declare function contextSchemaToTSType(context: Record<string, JSONSchema7> | nu
3011
3011
  declare function eventsSchemaToTSType(events: Record<string, JSONSchema7> | null | undefined): string | null; //#endregion
3012
3012
  //#region src/jsonSchemaToZod.d.ts
3013
3013
  //#endregion
3014
- export { ZodOptional as A, ImplementationSourceType as C, ZodNullable as D, ZodLiteral as E, output as F, $loose as I, $strip as L, ZodString as M, ZodUnion as N, ZodNumber as O, ZodUnknown as P, GraphPatch as S, ZodEnum as T, raw as _, RawCode as a, CanvasColor as b, XStateV4TSOptions as c, getXStateFSMCompatibilityIssues as d, graphToMachineConfig as f, jsonSchemaToTSType as g, graphToXStateV4TS as h, ProfileManifest as i, ZodRecord as j, ZodObject as k, contextSchemaToTSType as l, graphToXStateTS as m, CodeGenGraph as n, XStateFSMOptions as o, graphToXStateFSM as p, MachineConfigOptions as r, XStateTSOptions as s, CodeExpression as t, eventsSchemaToTSType as u, serializeJS as v, ZodArray as w, EditorStateType as x, ActionLocation as y };
3014
+ export { ZodObject as A, ImplementationSourceType as C, ZodLiteral as D, ZodEnum as E, ZodUnknown as F, output as I, $loose as L, ZodRecord as M, ZodString as N, ZodNullable as O, ZodUnion as P, $strip as R, GraphPatch as S, ZodBoolean as T, raw as _, RawCode as a, CanvasColor as b, XStateV4TSOptions as c, getXStateFSMCompatibilityIssues as d, graphToMachineConfig as f, jsonSchemaToTSType as g, graphToXStateV4TS as h, ProfileManifest as i, ZodOptional as j, ZodNumber as k, contextSchemaToTSType as l, graphToXStateTS as m, CodeGenGraph as n, XStateFSMOptions as o, graphToXStateFSM as p, MachineConfigOptions as r, XStateTSOptions as s, CodeExpression as t, eventsSchemaToTSType as u, serializeJS as v, ZodArray as w, EditorStateType as x, ActionLocation as y };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
2
- import { S as GraphPatch, _ as raw, a as RawCode, c as XStateV4TSOptions, d as getXStateFSMCompatibilityIssues, f as graphToMachineConfig, g as jsonSchemaToTSType, h as graphToXStateV4TS, l as contextSchemaToTSType, m as graphToXStateTS, n as CodeGenGraph, o as XStateFSMOptions, p as graphToXStateFSM, r as MachineConfigOptions, s as XStateTSOptions, u as eventsSchemaToTSType, v as serializeJS, y as ActionLocation } from "./index-DNDfA-YC.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-5X1Ilppq.mjs";
2
+ import { S as GraphPatch, _ as raw, a as RawCode, c as XStateV4TSOptions, d as getXStateFSMCompatibilityIssues, f as graphToMachineConfig, g as jsonSchemaToTSType, h as graphToXStateV4TS, l as contextSchemaToTSType, m as graphToXStateTS, n as CodeGenGraph, o as XStateFSMOptions, p as graphToXStateFSM, r as MachineConfigOptions, s as XStateTSOptions, u as eventsSchemaToTSType, v as serializeJS, y as ActionLocation } from "./index-D4pdeDpT.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-C8E1Exad.mjs";
4
4
  import { n as EmbedPanelPosition, t as EmbedPanelConfig } from "./embedPanel-Bpbq4sfJ.mjs";
5
5
  import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExample, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitOptions, InspectionAction, InspectionSentEvent, InspectionTakenTransition, MachineVersionAutoSaveOptions, ProjectEmbedMachine, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceProject, UploadResult, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine } from "./protocol.mjs";
6
6
  import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
@@ -8,7 +8,7 @@ import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizati
8
8
  import { c as fetchEditorSyncAccess, d as EditorHostExportFormat, f as EditorHostInboundMessage, h as EditorHostValidationIssue, i as EditorSyncBackend, l as EDITOR_PROTOCOL_VERSION, m as EditorHostOutboundMessage, n as EditorHostSessionOptions, o as RemoteEditorSyncBackendOptions, p as EditorHostInitOptions, r as EditorSourceHost, s as createRemoteEditorSyncBackend, t as EditorHostSession, u as EditorHostDiagnostic } from "./editorHostSession-vSt07IJV.mjs";
9
9
  import { AssetConfig, EmbedEntity, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, EmbedProfileDefinition, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
10
10
  import { _ as createWebSocketTransport, a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, g as createPostMessageTransport, h as TransportFailure, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-D61HS-t7.mjs";
11
- import { A as Machine, C as StudioMachineRecord, D as VerifyApiKeyResponse, E as UpdateProjectInput, F as ProjectVisibility, I as VerifyResult, L as XStateVersion, M as Project, N as ProjectMachineSummary, O as createStatelyClient, P as ProjectSummary, R as ResourceErrorCode, S as StudioClientOptions, T as UpdateMachineInput, _ as ProjectMachine, a as CreateMachineTemplate, b as StudioApiErrorOptions, c as EnsureProjectInput, d as ExtractedMachine, f as GetMachineOptions, g as ProjectData, h as LegacyUpdateMachineInput, i as CreateMachineInput, j as MachineVersion, k as ExtractedMachines, l as ExtractMachinesInput, m as LegacyProjectVisibility, n as CreateMachineFromDefinitionInput, o as CreateProjectInput, r as CreateMachineFromTemplateInput, s as DEFAULT_STATELY_BASE_URL, t as ConnectedRepo, u as ExtractMachinesResponse, v as RepoType, w as StudioRequestOptions, x as StudioClient, y as StudioApiError } from "./studio-QQRLjF5V.mjs";
11
+ import { A as Machine, C as StudioMachineRecord, D as VerifyApiKeyResponse, E as UpdateProjectInput, F as ProjectVisibility, I as VerifyResult, L as XStateVersion, M as Project, N as ProjectMachineSummary, O as createStatelyClient, P as ProjectSummary, R as ResourceErrorCode, S as StudioClientOptions, T as UpdateMachineInput, _ as ProjectMachine, a as CreateMachineTemplate, b as StudioApiErrorOptions, c as EnsureProjectInput, d as ExtractedMachine, f as GetMachineOptions, g as ProjectData, h as LegacyUpdateMachineInput, i as CreateMachineInput, j as MachineVersion, k as ExtractedMachines, l as ExtractMachinesInput, m as LegacyProjectVisibility, n as CreateMachineFromDefinitionInput, o as CreateProjectInput, r as CreateMachineFromTemplateInput, s as DEFAULT_STATELY_BASE_URL, t as ConnectedRepo, u as ExtractMachinesResponse, v as RepoType, w as StudioRequestOptions, x as StudioClient, y as StudioApiError } from "./studio-D-yqFd0u.mjs";
12
12
  import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
13
13
  import { PlanSyncOptions, PullSyncResult, PushLocalMachineLinksResult, PushSyncOptions, PushSyncProjectOptions, PushSyncResult, ResolvedSyncInput, SyncInputFormat, SyncPlan, SyncPlanSummary } from "./sync.mjs";
14
14
  import { CreateInspectionRelayOptions, InspectionRelay, InspectionRelayEffect, InspectionRelayPeer, InspectionRelayRole, InspectionRelaySnapshot, createInspectionRelay } from "./relay.mjs";
package/dist/index.mjs CHANGED
@@ -1,13 +1,13 @@
1
1
  import "./openapi-BTDjYWXd.mjs";
2
2
  import { EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine } from "./protocol.mjs";
3
- import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-BJPr6idb.mjs";
3
+ import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-DC3yW9Dk.mjs";
4
4
  import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
5
5
  import { createStatelyEmbed } from "./embed.mjs";
6
6
  import { i as fetchEditorSyncAccess, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-DNpXPNAc.mjs";
7
- import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-DpCW5V4a.mjs";
8
- import { _ as jsonSchemaToTSType, a as RawCode, b as serializeJS, d as getXStateFSMCompatibilityIssues, g as graphToXStateV4TS, h as graphToXStateTS, m as graphToXStateFSM, n as getStatelyPragma, p as graphToMachineConfig, r as upsertStatelyPragma, s as contextSchemaToTSType, t as findStatelyPragmaAttachments, u as eventsSchemaToTSType, y as raw } from "./statelyPragma-Cg1KzBZr.mjs";
7
+ import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-rSI54Ese.mjs";
8
+ import { _ as jsonSchemaToTSType, a as RawCode, b as serializeJS, d as getXStateFSMCompatibilityIssues, g as graphToXStateV4TS, h as graphToXStateTS, m as graphToXStateFSM, n as getStatelyPragma, p as graphToMachineConfig, r as upsertStatelyPragma, s as contextSchemaToTSType, t as findStatelyPragmaAttachments, u as eventsSchemaToTSType, y as raw } from "./statelyPragma-p1vu8PmH.mjs";
9
9
  import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
10
- import { n as createStatelyInspector, t as createInspector } from "./inspect-DYFQzEsh.mjs";
10
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-dmCvrIl1.mjs";
11
11
  import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
12
12
  import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
13
13
  import { StatelyApiError, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
@@ -1,5 +1,5 @@
1
1
  import { INSPECTION_PROTOCOL_VERSION, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
2
- import { a as createEventRegistry, i as createWebSocketTransport, n as inspectionRuntime, o as createPendingExportManager, t as SDK_VERSION } from "./version-BJPr6idb.mjs";
2
+ import { a as createEventRegistry, i as createWebSocketTransport, n as inspectionRuntime, o as createPendingExportManager, t as SDK_VERSION } from "./version-DC3yW9Dk.mjs";
3
3
 
4
4
  //#region src/openBrowser.ts
5
5
  async function openBrowser(url) {
package/dist/inspect.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import "./version-BJPr6idb.mjs";
2
- import { n as createStatelyInspector, t as createInspector } from "./inspect-DYFQzEsh.mjs";
1
+ import "./version-DC3yW9Dk.mjs";
2
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-dmCvrIl1.mjs";
3
3
 
4
4
  export { createInspector, createStatelyInspector };
@@ -1,2 +1,2 @@
1
- import { C as ImplementationSourceType, S as GraphPatch, b as CanvasColor, x as EditorStateType, y as ActionLocation } from "./index-DNDfA-YC.mjs";
1
+ import { C as ImplementationSourceType, S as GraphPatch, b as CanvasColor, x as EditorStateType, y as ActionLocation } from "./index-D4pdeDpT.mjs";
2
2
  export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
@@ -1,5 +1,5 @@
1
- import { i as ProfileManifest } from "./index-DNDfA-YC.mjs";
2
- import { i as StatelyGraph } from "./graph-5X1Ilppq.mjs";
1
+ import { i as ProfileManifest } from "./index-D4pdeDpT.mjs";
2
+ import { i as StatelyGraph } from "./graph-C8E1Exad.mjs";
3
3
  import { n as EmbedPanelPosition, t as EmbedPanelConfig } from "./embedPanel-Bpbq4sfJ.mjs";
4
4
  import { c as EditorSyncSourceLocation, f as MachineSourceLocations$1, l as EditorSyncSourceRange, t as EditorCapabilities$1, u as EditorSyncStateSourceLocation } from "./editor-sync-types-DB1N6QUK.mjs";
5
5
 
@@ -369,6 +369,7 @@ interface ProjectInitOptions {
369
369
  mode?: EmbedMode;
370
370
  theme?: 'light' | 'dark';
371
371
  readOnly?: boolean;
372
+ readOnlyReason?: ReadOnlyReason;
372
373
  depth?: number;
373
374
  capabilities?: EditorCapabilities;
374
375
  examples?: readonly EmbedExample[];
@@ -451,6 +452,7 @@ interface ProjectInitMessage {
451
452
  mode?: EmbedMode;
452
453
  theme?: 'light' | 'dark';
453
454
  readOnly?: boolean;
455
+ readOnlyReason?: ReadOnlyReason;
454
456
  depth?: number;
455
457
  capabilities?: EditorCapabilities;
456
458
  examples?: readonly EmbedExample[];
@@ -1,6 +1,5 @@
1
1
  import { a as discriminatedUnion, c as object, d as union, f as unknown, i as custom, l as record, n as array, o as literal, r as boolean, s as number, t as _enum, u as string } from "./openapi-BTDjYWXd.mjs";
2
2
  import ts from "typescript";
3
- import "xstate";
4
3
  import "xstate/graph";
5
4
 
6
5
  //#region ../../node_modules/.pnpm/js-yaml@4.2.0/node_modules/js-yaml/dist/js-yaml.mjs
@@ -5325,16 +5324,53 @@ function hasV6Syntax(source) {
5325
5324
  if (!binding) return false;
5326
5325
  return containsFunction(binding, new Set([...seenBindings, node.text]));
5327
5326
  }
5328
- if (ts.isObjectLiteralExpression(node)) return node.properties.some((property) => {
5329
- if (ts.isPropertyAssignment(property)) return containsFunction(property.initializer, seenBindings);
5330
- if (ts.isShorthandPropertyAssignment(property)) return containsFunction(property.name, seenBindings);
5331
- if (ts.isSpreadAssignment(property)) return containsFunction(property.expression, seenBindings);
5332
- return false;
5333
- });
5334
5327
  if (ts.isArrayLiteralExpression(node)) return node.elements.some((element) => ts.isExpression(element) && containsFunction(element, seenBindings));
5335
5328
  if (ts.isCallExpression(node)) return ts.isIdentifier(node.expression) && containsFunction(node.expression, seenBindings) || node.arguments.some((argument) => ts.isExpression(argument) && containsFunction(argument, seenBindings));
5336
5329
  return false;
5337
5330
  }
5331
+ function containsEnqueueAction(expression, seen = /* @__PURE__ */ new Set()) {
5332
+ if (seen.has(expression)) return false;
5333
+ seen.add(expression);
5334
+ const node = ts.isFunctionDeclaration(expression) ? expression : unwrapExpression(expression);
5335
+ if (ts.isIdentifier(node)) {
5336
+ const binding = bindings.get(node.text);
5337
+ return binding ? containsEnqueueAction(binding, seen) : false;
5338
+ }
5339
+ if (ts.isArrayLiteralExpression(node)) return node.elements.some((element) => ts.isSpreadElement(element) ? containsEnqueueAction(element.expression, seen) : ts.isExpression(element) && containsEnqueueAction(element, seen));
5340
+ if (!isFunctionBinding(node)) return false;
5341
+ const enqueue = node.parameters[1]?.name;
5342
+ if (!enqueue || !ts.isIdentifier(enqueue) || !node.body) return false;
5343
+ const enqueueName = enqueue.text;
5344
+ let callsEnqueue = false;
5345
+ function visit(node) {
5346
+ if (ts.isArrowFunction(node) || ts.isFunctionExpression(node) || ts.isFunctionDeclaration(node)) return;
5347
+ if (ts.isCallExpression(node)) {
5348
+ const callee = node.expression;
5349
+ const receiver = ts.isPropertyAccessExpression(callee) ? callee.expression : callee;
5350
+ if (ts.isIdentifier(receiver) && receiver.text === enqueueName) callsEnqueue = true;
5351
+ }
5352
+ ts.forEachChild(node, visit);
5353
+ }
5354
+ visit(node.body);
5355
+ return callsEnqueue;
5356
+ }
5357
+ function containsFunctionTransitionMap(expression, seen = /* @__PURE__ */ new Set()) {
5358
+ if (seen.has(expression) || ts.isFunctionDeclaration(expression)) return false;
5359
+ seen.add(expression);
5360
+ const node = unwrapExpression(expression);
5361
+ if (ts.isIdentifier(node)) {
5362
+ const binding = bindings.get(node.text);
5363
+ return binding ? containsFunctionTransitionMap(binding, seen) : false;
5364
+ }
5365
+ if (!ts.isObjectLiteralExpression(node)) return false;
5366
+ return node.properties.some((property) => {
5367
+ if (ts.isMethodDeclaration(property)) return true;
5368
+ if (ts.isPropertyAssignment(property)) return containsFunction(property.initializer);
5369
+ if (ts.isShorthandPropertyAssignment(property)) return containsFunction(property.name);
5370
+ if (ts.isSpreadAssignment(property)) return containsFunctionTransitionMap(property.expression, seen);
5371
+ return false;
5372
+ });
5373
+ }
5338
5374
  function visitSyntax(node) {
5339
5375
  if (found) return;
5340
5376
  if (ts.isIdentifier(node)) {
@@ -5351,7 +5387,24 @@ function hasV6Syntax(source) {
5351
5387
  found = true;
5352
5388
  return;
5353
5389
  }
5354
- if ((key === "on" || key === "after" || key === "always" || key === "choice" || key === "onDone" || key === "onError" || key === "onSnapshot" || key === "onTimeout" || key === "entry" || key === "exit" || key === "actions" && !ts.isObjectLiteralExpression(node.initializer)) && containsFunction(node.initializer)) {
5390
+ if ([
5391
+ "entry",
5392
+ "exit",
5393
+ "actions"
5394
+ ].includes(key) && containsEnqueueAction(node.initializer)) {
5395
+ found = true;
5396
+ return;
5397
+ }
5398
+ if ((key === "on" || key === "after") && containsFunctionTransitionMap(node.initializer)) {
5399
+ found = true;
5400
+ return;
5401
+ }
5402
+ if ([
5403
+ "always",
5404
+ "onDone",
5405
+ "onError",
5406
+ "onSnapshot"
5407
+ ].includes(key) && containsFunction(node.initializer)) {
5355
5408
  found = true;
5356
5409
  return;
5357
5410
  }
@@ -7525,6 +7578,7 @@ const validationIssueCodeSchema = _enum([
7525
7578
  "missing_delay_implementation",
7526
7579
  "invalid_final_transition",
7527
7580
  "invalid_history_transition",
7581
+ "invalid_choice_event",
7528
7582
  "parallel_region_transition",
7529
7583
  "duplicate_source_name",
7530
7584
  "undefined_action",
@@ -1,4 +1,4 @@
1
- import { A as ZodOptional, D as ZodNullable, E as ZodLiteral, F as output, I as $loose, L as $strip, M as ZodString, N as ZodUnion, O as ZodNumber, P as ZodUnknown, T as ZodEnum, j as ZodRecord, k as ZodObject, w as ZodArray } from "./index-DNDfA-YC.mjs";
1
+ import { A as ZodObject, D as ZodLiteral, E as ZodEnum, F as ZodUnknown, I as output, L as $loose, M as ZodRecord, N as ZodString, O as ZodNullable, P as ZodUnion, R as $strip, T as ZodBoolean, j as ZodOptional, k as ZodNumber, w as ZodArray } from "./index-D4pdeDpT.mjs";
2
2
  import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-BPyCCHYo.mjs";
3
3
 
4
4
  //#region ../api-contract/dist/errors.d.mts
@@ -44,6 +44,17 @@ declare const verifyResultSchema: ZodObject<{
44
44
  }>;
45
45
  }, $strip>;
46
46
  type VerifyResult = output<typeof verifyResultSchema>;
47
+ /**
48
+ * Entitlements for the authenticated caller.
49
+ *
50
+ * Internal contract: this is not published as an `/api/v1` operation. Editor
51
+ * feature gating resolves it server-side through the resource provider and
52
+ * hands the mapped result to the client (see
53
+ * `packages/editor/src/entitlements`).
54
+ *
55
+ * `entitlements` is an open set of provider-defined strings; unknown values are
56
+ * ignored rather than rejected.
57
+ */
47
58
  declare const projectSummarySchema: ZodObject<{
48
59
  projectId: ZodString;
49
60
  projectVersionId: ZodString;
@@ -58,6 +69,16 @@ declare const projectSummarySchema: ZodObject<{
58
69
  updatedAt: ZodString;
59
70
  }, $strip>;
60
71
  type ProjectSummary = output<typeof projectSummarySchema>;
72
+ /**
73
+ * `name` and `updatedAt` are optional: some upstream project envelopes only
74
+ * return machine ids. Providers that can supply them cheaply should.
75
+ */
76
+ declare const projectMachineSummarySchema: ZodObject<{
77
+ machineId: ZodString;
78
+ name: ZodOptional<ZodString>;
79
+ updatedAt: ZodOptional<ZodString>;
80
+ }, $strip>;
81
+ type ProjectMachineSummary = output<typeof projectMachineSummarySchema>;
61
82
  declare const projectSchema: ZodObject<{
62
83
  projectId: ZodString;
63
84
  projectVersionId: ZodString;
@@ -73,18 +94,19 @@ declare const projectSchema: ZodObject<{
73
94
  rootMachineId: ZodNullable<ZodString>;
74
95
  machines: ZodArray<ZodObject<{
75
96
  machineId: ZodString;
97
+ name: ZodOptional<ZodString>;
98
+ updatedAt: ZodOptional<ZodString>;
76
99
  }, $strip>>;
100
+ permissions: ZodObject<{
101
+ canEdit: ZodBoolean;
102
+ }, $strip>;
103
+ allowedVisibility: ZodOptional<ZodArray<ZodEnum<{
104
+ public: "public";
105
+ unlisted: "unlisted";
106
+ private: "private";
107
+ }>>>;
77
108
  }, $strip>;
78
109
  type Project = output<typeof projectSchema>;
79
- /**
80
- * `name` is optional: the Registry project envelope only returns machine ids.
81
- * Providers that can supply names cheaply should.
82
- */
83
- declare const projectMachineSummarySchema: ZodObject<{
84
- machineId: ZodString;
85
- name: ZodOptional<ZodString>;
86
- }, $strip>;
87
- type ProjectMachineSummary = output<typeof projectMachineSummarySchema>;
88
110
  declare const machineSchema: ZodObject<{
89
111
  machineId: ZodString;
90
112
  name: ZodString;
@@ -159,6 +181,7 @@ declare const machineVersionSchema: ZodObject<{
159
181
  updatedAt: ZodString;
160
182
  }, $strip>;
161
183
  type MachineVersion = output<typeof machineVersionSchema>;
184
+ /** Version-history row without the definition payload. */
162
185
  declare const extractedMachinesSchema: ZodObject<{
163
186
  machines: ZodArray<ZodObject<{
164
187
  config: ZodRecord<ZodString, ZodUnknown>;
@@ -127,6 +127,24 @@ const verifyResultSchema = object({
127
127
  valid: literal(true),
128
128
  tokenScope: _enum(["user", "project"])
129
129
  });
130
+ /**
131
+ * Entitlements for the authenticated caller.
132
+ *
133
+ * Internal contract: this is not published as an `/api/v1` operation. Editor
134
+ * feature gating resolves it server-side through the resource provider and
135
+ * hands the mapped result to the client (see
136
+ * `packages/editor/src/entitlements`).
137
+ *
138
+ * `entitlements` is an open set of provider-defined strings; unknown values are
139
+ * ignored rather than rejected.
140
+ */
141
+ const entitlementsResultSchema = object({
142
+ subscription: object({
143
+ tier: string(),
144
+ status: string()
145
+ }).nullable(),
146
+ entitlements: array(string())
147
+ });
130
148
  const projectSummarySchema = object({
131
149
  projectId: string(),
132
150
  projectVersionId: string(),
@@ -136,17 +154,20 @@ const projectSummarySchema = object({
136
154
  createdAt: string(),
137
155
  updatedAt: string()
138
156
  });
139
- const projectSchema = projectSummarySchema.extend({
140
- rootMachineId: string().nullable(),
141
- machines: array(object({ machineId: string() }))
142
- });
143
157
  /**
144
- * `name` is optional: the Registry project envelope only returns machine ids.
145
- * Providers that can supply names cheaply should.
158
+ * `name` and `updatedAt` are optional: some upstream project envelopes only
159
+ * return machine ids. Providers that can supply them cheaply should.
146
160
  */
147
161
  const projectMachineSummarySchema = object({
148
162
  machineId: string(),
149
- name: string().optional()
163
+ name: string().optional(),
164
+ updatedAt: string().optional()
165
+ });
166
+ const projectSchema = projectSummarySchema.extend({
167
+ rootMachineId: string().nullable(),
168
+ machines: array(projectMachineSummarySchema),
169
+ permissions: object({ canEdit: boolean() }),
170
+ allowedVisibility: array(projectVisibilitySchema).optional()
150
171
  });
151
172
  const machineSchema = object({
152
173
  machineId: string(),
@@ -167,6 +188,67 @@ const machineVersionSchema = object({
167
188
  createdAt: string(),
168
189
  updatedAt: string()
169
190
  });
191
+ /** Version-history row without the definition payload. */
192
+ const machineVersionSummarySchema = object({
193
+ machineVersionId: string(),
194
+ machineId: string(),
195
+ versionNumber: number(),
196
+ name: string().nullable(),
197
+ status: string(),
198
+ parentVersionId: string().nullable(),
199
+ createdAt: string(),
200
+ updatedAt: string()
201
+ });
202
+ /** Result of converting a machine's stored definition to XGraph in place. */
203
+ const machinesConvertResultSchema = object({
204
+ machine: machineSchema,
205
+ created: boolean(),
206
+ version: object({
207
+ machineVersionId: string(),
208
+ versionNumber: number(),
209
+ name: string().nullable()
210
+ })
211
+ });
212
+ /**
213
+ * A project the caller may fork a machine into, with the version ids a fork
214
+ * can target. `projectVersionIds` is ordered as the provider reports it.
215
+ */
216
+ const projectDestinationProjectSchema = object({
217
+ projectId: string(),
218
+ name: string(),
219
+ visibility: projectVisibilitySchema,
220
+ projectVersionIds: array(string())
221
+ });
222
+ /**
223
+ * Fork destinations grouped by owner. The caller's personal projects are one
224
+ * owner alongside each team; `ownerId` is opaque and provider-defined.
225
+ */
226
+ const projectDestinationSchema = object({
227
+ ownerId: string(),
228
+ name: string(),
229
+ projects: array(projectDestinationProjectSchema)
230
+ });
231
+ /** Result of forking a machine into a new or existing project version. */
232
+ const machinesForkResultSchema = object({
233
+ machine: machineSchema,
234
+ projectVersionId: string(),
235
+ projectId: string()
236
+ });
237
+ /**
238
+ * The version holding a machine's pre-conversion (legacy editor) definition.
239
+ * `versionId` is `null` when the machine has no such version, which is the
240
+ * signal that the legacy editor cannot be re-entered for it.
241
+ */
242
+ const machineLegacyVersionSchema = object({ versionId: string().nullable() });
243
+ /** Result of restoring a machine's legacy-editor definition. */
244
+ const machinesRestoreLegacyResultSchema = object({
245
+ machine: machineSchema,
246
+ version: object({
247
+ machineVersionId: string(),
248
+ versionNumber: number(),
249
+ name: string().nullable()
250
+ })
251
+ });
170
252
  const extractedMachinesSchema = object({ machines: array(object({
171
253
  config: record(string(), unknown()),
172
254
  machineIndex: number().int().nonnegative().optional()
@@ -190,6 +272,40 @@ const machinesUpdateRequestSchema = object({
190
272
  name: string().min(1).optional(),
191
273
  definition: unknown().optional()
192
274
  }).refine((value) => value.name !== void 0 || value.definition !== void 0, { message: "At least one of `name` or `definition` is required." });
275
+ /**
276
+ * `status` is canonical lowercase; providers map it to their own casing.
277
+ * Omitting `definition` snapshots the machine's current definition.
278
+ */
279
+ const machineVersionsCreateRequestSchema = object({
280
+ name: string().min(1).optional(),
281
+ definition: unknown().optional(),
282
+ status: _enum(["committed", "auto"]).optional(),
283
+ parentVersionId: string().min(1).optional()
284
+ });
285
+ const machinesConvertRequestSchema = object({
286
+ definition: xgraphSchema,
287
+ expectedUpdatedAt: string().min(1),
288
+ keepOriginalVersion: boolean().optional()
289
+ });
290
+ /**
291
+ * Fork a machine into exactly one target: an existing project version, or a
292
+ * new project to create for it. Both, or neither, is a client bug.
293
+ */
294
+ const machinesForkRequestSchema = object({
295
+ targetProjectVersionId: string().min(1).optional(),
296
+ targetProject: object({
297
+ name: string().min(1),
298
+ visibility: projectVisibilitySchema,
299
+ teamId: string().min(1).optional()
300
+ }).optional(),
301
+ machineName: string().min(1).optional(),
302
+ xstateVersion: xstateVersionSchema.optional()
303
+ }).refine((value) => value.targetProjectVersionId === void 0 !== (value.targetProject === void 0), { message: "Exactly one of `targetProjectVersionId` or `targetProject` is required." });
304
+ const machinesRestoreLegacyRequestSchema = object({
305
+ versionId: string().min(1).optional(),
306
+ expectedUpdatedAt: string().min(1),
307
+ reason: string().optional()
308
+ });
193
309
  const codeExtractMachinesRequestSchema = object({
194
310
  code: string().min(1),
195
311
  xstateVersion: xstateVersionSchema.optional()
@@ -201,10 +317,17 @@ const projectsCreateResponseSchema = projectSchema;
201
317
  const projectsUpdateResponseSchema = projectSchema;
202
318
  const projectsDeleteResponseSchema = object({ projectId: string() });
203
319
  const projectsListMachinesResponseSchema = array(projectMachineSummarySchema);
320
+ const projectsDestinationsResponseSchema = array(projectDestinationSchema);
204
321
  const machinesCreateResponseSchema = machineSchema;
205
322
  const machinesGetResponseSchema = machineSchema;
206
323
  const machinesUpdateResponseSchema = machineSchema;
207
324
  const machinesGetVersionResponseSchema = machineVersionSchema;
325
+ const machineVersionsListResponseSchema = array(machineVersionSummarySchema);
326
+ const machineVersionsCreateResponseSchema = machineVersionSchema;
327
+ const machinesConvertDefinitionResponseSchema = machinesConvertResultSchema;
328
+ const machinesForkResponseSchema = machinesForkResultSchema;
329
+ const machinesGetLegacyVersionResponseSchema = machineLegacyVersionSchema;
330
+ const machinesRestoreLegacyResponseSchema = machinesRestoreLegacyResultSchema;
208
331
  const codeExtractMachinesResponseSchema = extractedMachinesSchema;
209
332
  /**
210
333
  * Request/response schema pairs keyed by resource capability name. Kept here
@@ -225,6 +348,7 @@ const resourceOperationSchemas = {
225
348
  },
226
349
  "projects.delete": { response: projectsDeleteResponseSchema },
227
350
  "projects.listMachines": { response: projectsListMachinesResponseSchema },
351
+ "projects.destinations": { response: projectsDestinationsResponseSchema },
228
352
  "machines.create": {
229
353
  request: machinesCreateRequestSchema,
230
354
  response: machinesCreateResponseSchema
@@ -234,6 +358,24 @@ const resourceOperationSchemas = {
234
358
  "machines.update": {
235
359
  request: machinesUpdateRequestSchema,
236
360
  response: machinesUpdateResponseSchema
361
+ },
362
+ "machines.versions.list": { response: machineVersionsListResponseSchema },
363
+ "machines.versions.create": {
364
+ request: machineVersionsCreateRequestSchema,
365
+ response: machineVersionsCreateResponseSchema
366
+ },
367
+ "machines.convertDefinition": {
368
+ request: machinesConvertRequestSchema,
369
+ response: machinesConvertDefinitionResponseSchema
370
+ },
371
+ "machines.fork": {
372
+ request: machinesForkRequestSchema,
373
+ response: machinesForkResponseSchema
374
+ },
375
+ "machines.getLegacyVersion": { response: machinesGetLegacyVersionResponseSchema },
376
+ "machines.restoreLegacy": {
377
+ request: machinesRestoreLegacyRequestSchema,
378
+ response: machinesRestoreLegacyResponseSchema
237
379
  }
238
380
  };
239
381
  /** Provider-independent operations implemented by this repository. */
package/dist/studio.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { A as Machine, C as StudioMachineRecord, D as VerifyApiKeyResponse, E as UpdateProjectInput, F as ProjectVisibility, I as VerifyResult, L as XStateVersion, M as Project, N as ProjectMachineSummary, O as createStatelyClient, P as ProjectSummary, R as ResourceErrorCode, S as StudioClientOptions, T as UpdateMachineInput, _ as ProjectMachine, a as CreateMachineTemplate, b as StudioApiErrorOptions, c as EnsureProjectInput, d as ExtractedMachine, f as GetMachineOptions, g as ProjectData, h as LegacyUpdateMachineInput, i as CreateMachineInput, j as MachineVersion, k as ExtractedMachines, l as ExtractMachinesInput, m as LegacyProjectVisibility, n as CreateMachineFromDefinitionInput, o as CreateProjectInput, p as LegacyExtractMachinesOptions, r as CreateMachineFromTemplateInput, s as DEFAULT_STATELY_BASE_URL, t as ConnectedRepo, u as ExtractMachinesResponse, v as RepoType, w as StudioRequestOptions, x as StudioClient, y as StudioApiError } from "./studio-QQRLjF5V.mjs";
1
+ import { A as Machine, C as StudioMachineRecord, D as VerifyApiKeyResponse, E as UpdateProjectInput, F as ProjectVisibility, I as VerifyResult, L as XStateVersion, M as Project, N as ProjectMachineSummary, O as createStatelyClient, P as ProjectSummary, R as ResourceErrorCode, S as StudioClientOptions, T as UpdateMachineInput, _ as ProjectMachine, a as CreateMachineTemplate, b as StudioApiErrorOptions, c as EnsureProjectInput, d as ExtractedMachine, f as GetMachineOptions, g as ProjectData, h as LegacyUpdateMachineInput, i as CreateMachineInput, j as MachineVersion, k as ExtractedMachines, l as ExtractMachinesInput, m as LegacyProjectVisibility, n as CreateMachineFromDefinitionInput, o as CreateProjectInput, p as LegacyExtractMachinesOptions, r as CreateMachineFromTemplateInput, s as DEFAULT_STATELY_BASE_URL, t as ConnectedRepo, u as ExtractMachinesResponse, v as RepoType, w as StudioRequestOptions, x as StudioClient, y as StudioApiError } from "./studio-D-yqFd0u.mjs";
2
2
  export { ConnectedRepo, CreateMachineFromDefinitionInput, CreateMachineFromTemplateInput, CreateMachineInput, CreateMachineTemplate, CreateProjectInput, DEFAULT_STATELY_BASE_URL, EnsureProjectInput, ExtractMachinesInput, ExtractMachinesResponse, ExtractedMachine, ExtractedMachines, GetMachineOptions, LegacyExtractMachinesOptions, LegacyProjectVisibility, LegacyUpdateMachineInput, Machine, MachineVersion, Project, ProjectData, ProjectMachine, ProjectMachineSummary, ProjectSummary, ProjectVisibility, RepoType, ResourceErrorCode, StudioApiError, StudioApiErrorOptions, StudioClient, StudioClientOptions, StudioMachineRecord, StudioRequestOptions, UpdateMachineInput, UpdateProjectInput, VerifyApiKeyResponse, VerifyResult, XStateVersion, createStatelyClient };
package/dist/studio.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./openapi-BTDjYWXd.mjs";
2
- import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-DpCW5V4a.mjs";
2
+ import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-rSI54Ese.mjs";
3
3
 
4
4
  export { DEFAULT_STATELY_BASE_URL, StudioApiError, createStatelyClient };
package/dist/sync.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { b as DigraphConfig, i as StatelyGraph } from "./graph-5X1Ilppq.mjs";
2
- import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-QQRLjF5V.mjs";
1
+ import { b as DigraphConfig, i as StatelyGraph } from "./graph-C8E1Exad.mjs";
2
+ import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-D-yqFd0u.mjs";
3
3
  import { GraphDiff } from "@statelyai/graph";
4
4
 
5
5
  //#region src/sync.d.ts
package/dist/sync.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./openapi-BTDjYWXd.mjs";
2
- import { r as createStatelyClient } from "./studio-DpCW5V4a.mjs";
3
- import { b as serializeJS, c as detectXStateSourceProfile, f as graphChangeToPatchesResult, h as graphToXStateTS, i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, l as diffGraphsSemantically, n as getStatelyPragma, o as alignCompareGraphIds, p as graphToMachineConfig, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, v as normalizeMachineProfile, x as xstateSourceToConfig } from "./statelyPragma-Cg1KzBZr.mjs";
2
+ import { r as createStatelyClient } from "./studio-rSI54Ese.mjs";
3
+ import { b as serializeJS, c as detectXStateSourceProfile, f as graphChangeToPatchesResult, h as graphToXStateTS, i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, l as diffGraphsSemantically, n as getStatelyPragma, o as alignCompareGraphIds, p as graphToMachineConfig, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, v as normalizeMachineProfile, x as xstateSourceToConfig } from "./statelyPragma-p1vu8PmH.mjs";
4
4
  import { fromStudioMachine, toStudioMachine } from "./graph.mjs";
5
5
  import * as ts$1 from "typescript";
6
6
  import ts from "typescript";
@@ -580,9 +580,10 @@ function resolveIdentifierObject(expression, bindings) {
580
580
  }
581
581
  function resolveObjectLiteralProperty(objectLiteral, propertyName, bindings) {
582
582
  for (const property of objectLiteral.properties) {
583
- if (!ts$1.isPropertyAssignment(property)) continue;
583
+ if (!ts$1.isPropertyAssignment(property) && !ts$1.isShorthandPropertyAssignment(property)) continue;
584
584
  if (getPropertyNameText$2(property.name) !== propertyName) continue;
585
- const inlineObject = unwrapObjectLiteralExpression$1(property.initializer);
585
+ const initializer = ts$1.isShorthandPropertyAssignment(property) ? property.name : property.initializer;
586
+ const inlineObject = unwrapObjectLiteralExpression$1(initializer);
586
587
  if (inlineObject) return {
587
588
  object: inlineObject,
588
589
  kind: "inline",
@@ -591,15 +592,15 @@ function resolveObjectLiteralProperty(objectLiteral, propertyName, bindings) {
591
592
  uri: getSourceFileUri(property.getSourceFile()),
592
593
  bindings
593
594
  };
594
- if (ts$1.isIdentifier(property.initializer)) {
595
- const binding = bindings.get(property.initializer.text);
595
+ if (ts$1.isIdentifier(initializer)) {
596
+ const binding = bindings.get(initializer.text);
596
597
  if (binding?.kind !== "objectReference") return null;
597
598
  return {
598
599
  object: binding.node,
599
600
  kind: binding.kind,
600
- symbol: property.initializer.text,
601
+ symbol: initializer.text,
601
602
  keyRange: toSourceRange$1(property.getSourceFile(), property.name),
602
- referenceRange: toSourceRange$1(property.getSourceFile(), property.initializer),
603
+ referenceRange: toSourceRange$1(property.getSourceFile(), initializer),
603
604
  sourceFile: binding.sourceFile,
604
605
  uri: binding.uri,
605
606
  bindings: binding.bindings
@@ -809,7 +810,7 @@ function parseSourceToMachine(text, document, options = {}) {
809
810
  const statesText = readHydratedStatesObject(sourceLocations.statesObject.uri, sourceLocations.statesObject.range, sourceLocations.states, options.resolver);
810
811
  return statesText ? [{
811
812
  range: sourceLocations.statesObject.referenceRange,
812
- newText: statesText
813
+ newText: areSourceRangesEqual(sourceLocations.statesObject.referenceRange, sourceLocations.statesObject.keyRange) ? `states: ${statesText}` : statesText
813
814
  }] : [];
814
815
  })() : [];
815
816
  const importReplacements = collectHydratedImportReplacements(text, document, new Set([...sourceLocations.states.filter((location) => location.path.length === 1 && location.referenceRange).map((location) => location.symbol).filter((symbol) => typeof symbol === "string"), ...sourceLocations.statesObject?.symbol ? [sourceLocations.statesObject.symbol] : []]));
@@ -138,6 +138,7 @@ function toInitMessage(options) {
138
138
  mode: options.mode,
139
139
  theme: options.theme,
140
140
  readOnly: options.readOnly,
141
+ readOnlyReason: options.readOnlyReason,
141
142
  depth: options.depth,
142
143
  capabilities: options.capabilities,
143
144
  examples: options.examples,
@@ -303,7 +304,7 @@ function createWebSocketTransport(options) {
303
304
  code: "unsupported_protocol",
304
305
  message: `Relay selected protocol ${data.protocolVersion}; expected ${INSPECTION_PROTOCOL_VERSION}`
305
306
  });
306
- ws?.close(1002, "Unsupported inspection protocol");
307
+ ws?.close(4002, "Unsupported inspection protocol");
307
308
  return;
308
309
  }
309
310
  reconnectAttempts = 0;
@@ -316,7 +317,7 @@ function createWebSocketTransport(options) {
316
317
  code: data.code,
317
318
  message: data.message
318
319
  });
319
- ws?.close(1002, data.message.slice(0, 123));
320
+ ws?.close(4002, "Inspection registration rejected");
320
321
  }
321
322
  messageHandlers.forEach((fn) => fn(data));
322
323
  };
@@ -364,7 +365,7 @@ function createWebSocketTransport(options) {
364
365
 
365
366
  //#endregion
366
367
  //#region src/version.ts
367
- const SDK_VERSION = "0.29.0";
368
+ const SDK_VERSION = "0.29.1";
368
369
  function inspectionRuntime() {
369
370
  if (typeof window !== "undefined") return "browser";
370
371
  if (typeof process !== "undefined" && process.versions?.node) return "node";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statelyai/sdk",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "stately-sdk": "./dist/bin.mjs"
@@ -93,8 +93,8 @@
93
93
  "jsdom": "^27.4.0",
94
94
  "tsdown": "0.21.0-beta.2",
95
95
  "vitest": "^3.2.4",
96
- "@statelyai/api-contract": "0.4.0",
97
- "@statelyai/graph-tools": "0.7.0"
96
+ "@statelyai/graph-tools": "0.7.2",
97
+ "@statelyai/api-contract": "0.4.3"
98
98
  },
99
99
  "engines": {
100
100
  "node": ">=22.4"