@statelyai/sdk 0.32.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +24 -4
  2. package/dist/assetStorage.d.mts +1 -1
  3. package/dist/auth.d.mts +1 -1
  4. package/dist/bin.mjs +1 -0
  5. package/dist/{dist-wbhkeGh6.mjs → dist-NJFkDQjK.mjs} +170 -77
  6. package/dist/{editorHostSession-DfmHzpls.mjs → editorHostSession-Bj5YcijC.mjs} +2 -2
  7. package/dist/{editorHostSession-BqyuKldr.d.mts → editorHostSession-DwD_9cER.d.mts} +2 -2
  8. package/dist/editorHostSession.d.mts +1 -1
  9. package/dist/editorHostSession.mjs +3 -3
  10. package/dist/embed.d.mts +4 -4
  11. package/dist/embed.mjs +5 -4
  12. package/dist/{graph-CR_g-mOq.d.mts → graph-Ciocekxl.d.mts} +1 -1
  13. package/dist/graph.d.mts +1 -1
  14. package/dist/{index-DlOZxzrW.d.mts → index-DZivqh0u.d.mts} +21 -4
  15. package/dist/index.d.mts +8 -8
  16. package/dist/index.mjs +9 -9
  17. package/dist/{inspect-GI2nE3J9.mjs → inspect-0dMcaOz_.mjs} +50 -6
  18. package/dist/{inspect-C18TbR-o.d.mts → inspect-D-L0qj9L.d.mts} +21 -9
  19. package/dist/inspect.d.mts +3 -3
  20. package/dist/inspect.mjs +3 -2
  21. package/dist/node-relay.mjs +1 -1
  22. package/dist/patchTypes.d.mts +1 -1
  23. package/dist/{protocol-C-tx0WI6.d.mts → protocol-AeHm956D.d.mts} +50 -76
  24. package/dist/protocol-BsBGRISR.mjs +116 -0
  25. package/dist/protocol.d.mts +2 -2
  26. package/dist/protocol.mjs +2 -86
  27. package/dist/relay.d.mts +1 -1
  28. package/dist/relay.mjs +23 -3
  29. package/dist/{studio-rSI54Ese.mjs → studio-BZP6DaIO.mjs} +50 -15
  30. package/dist/{studio-DV5IIGhV.d.mts → studio-CKdEPGKY.d.mts} +56 -17
  31. package/dist/studio.d.mts +1 -1
  32. package/dist/studio.mjs +1 -1
  33. package/dist/sync.d.mts +2 -2
  34. package/dist/sync.mjs +5 -10
  35. package/dist/{version-1vqjW2Am.mjs → version-DxDSBJta.mjs} +17 -5
  36. package/package.json +3 -3
  37. /package/dist/{auth-Dg7prjeL.d.mts → auth-CVFc85uF.d.mts} +0 -0
  38. /package/dist/{editor-sync-types-CPpzTSnT.d.mts → editor-sync-types-D7YYz6fb.d.mts} +0 -0
  39. /package/dist/{editorHostProtocol-Bko7wge8.mjs → editorHostProtocol-B2_t3Le7.mjs} +0 -0
  40. /package/dist/{statelyPragma-D46lczJR.mjs → statelyPragma-YtVaBuIe.mjs} +0 -0
package/dist/embed.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { i as ProfileManifest } from "./index-DlOZxzrW.mjs";
2
- import { i as StatelyGraph } from "./graph-CR_g-mOq.mjs";
3
- import { $t as EmbedPanelPosition, D as ExportCallOptions, F as InitOptions, G as MachineVersionAutoSaveOptions, O as ExportFormat, Qt as EmbedPanelConfig, S as EmbedExtensionsManifest, U as MachineInitOptions, Vt as UploadResult, W as MachineSourceLocations, Y as ProjectEmbedMachine, Z as ProjectInitOptions, _ as EmbedDocumentLanguage, at as ProjectWorkspaceCapabilities, b as EmbedEventName, ct as ProjectWorkspaceMachineOrigin, d as CommentsConfig, g as EmbedDocument, k as ExportFormatMap, m as EditorCapabilities, nt as ProjectWorkspaceAction, ot as ProjectWorkspaceConfig, r as CapabilityDeniedEvent, rt as ProjectWorkspaceActionIcon, st as ProjectWorkspaceMachine, ut as ProjectWorkspaceProject, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-C-tx0WI6.mjs";
1
+ import { i as ProfileManifest } from "./index-DZivqh0u.mjs";
2
+ import { i as StatelyGraph } from "./graph-Ciocekxl.mjs";
3
+ import { D as ExportCallOptions, F as InitOptions, G as MachineInitOptions, Gt as UploadResult, J as MachineVersionAutoSaveOptions, O as ExportFormat, Q as ProjectEmbedMachine, S as EmbedExtensionsManifest, Yt as ViewerOptions, _ as EmbedDocumentLanguage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, et as ProjectInitOptions, g as EmbedDocument, k as ExportFormatMap, lt as ProjectWorkspaceConfig, m as EditorCapabilities, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, pt as ProjectWorkspaceProject, q as MachineSourceLocations, r as CapabilityDeniedEvent, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-AeHm956D.mjs";
4
4
  import { AssetUploadAdapter } from "./assetStorage.mjs";
5
5
 
6
6
  //#region src/embed.d.ts
@@ -152,4 +152,4 @@ interface StatelyEmbed {
152
152
  }
153
153
  declare function createStatelyEmbed(options: StatelyEmbedOptions): StatelyEmbed;
154
154
  //#endregion
155
- export { AssetConfig, type CapabilityDeniedEvent, type CommentsConfig, type EditorCapabilities, type EmbedDocument, type EmbedDocumentLanguage, EmbedEntity, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedExtensionsManifest, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, type EmbedMode, type EmbedPanelConfig, type EmbedPanelPosition, EmbedProfileDefinition, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type MachineVersionAutoSaveOptions, type ProjectEmbedMachine, type ProjectInitOptions, type ProjectWorkspaceAction, type ProjectWorkspaceActionIcon, type ProjectWorkspaceCapabilities, type ProjectWorkspaceConfig, type ProjectWorkspaceMachine, type ProjectWorkspaceMachineOrigin, type ProjectWorkspaceProject, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
155
+ export { AssetConfig, type CapabilityDeniedEvent, type CommentsConfig, type EditorCapabilities, type EmbedDocument, type EmbedDocumentLanguage, EmbedEntity, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedExtensionsManifest, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, type EmbedMode, type EmbedPanelConfig, type EmbedPanelPosition, EmbedProfileDefinition, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type MachineVersionAutoSaveOptions, type ProjectEmbedMachine, type ProjectInitOptions, type ProjectWorkspaceAction, type ProjectWorkspaceActionIcon, type ProjectWorkspaceCapabilities, type ProjectWorkspaceConfig, type ProjectWorkspaceMachine, type ProjectWorkspaceMachineOrigin, type ProjectWorkspaceProject, StatelyEmbed, StatelyEmbedOptions, type UploadResult, type ViewerOptions, createStatelyEmbed };
package/dist/embed.mjs CHANGED
@@ -1,5 +1,6 @@
1
- import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-1vqjW2Am.mjs";
2
- import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
1
+ import "./protocol-BsBGRISR.mjs";
2
+ import { c as createPendingExportManager, l as settingsWithViewMode, r as createPostMessageTransport, s as createEventRegistry, t as SDK_VERSION, u as toInitMessage } from "./version-DxDSBJta.mjs";
3
+ import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-B2_t3Le7.mjs";
3
4
 
4
5
  //#region src/embed.ts
5
6
  function isRecord(value) {
@@ -91,7 +92,7 @@ function extractInitOptions(options) {
91
92
  projectWorkspace: options.projectWorkspace,
92
93
  projectWorkspaceOpen: options.projectWorkspaceOpen,
93
94
  chrome: options.chrome,
94
- settings: options.settings,
95
+ settings: settingsWithViewMode(options),
95
96
  unsavedIndicator: options.unsavedIndicator,
96
97
  versionAutoSave: options.versionAutoSave
97
98
  };
@@ -110,7 +111,7 @@ function extractInitOptions(options) {
110
111
  panels: options.panels,
111
112
  comments: options.comments,
112
113
  sourceLocations: options.sourceLocations,
113
- settings: options.settings,
114
+ settings: settingsWithViewMode(options),
114
115
  unsavedIndicator: options.unsavedIndicator,
115
116
  versionAutoSave: options.versionAutoSave
116
117
  };
@@ -1,4 +1,4 @@
1
- import { t as CodeExpression } from "./index-DlOZxzrW.mjs";
1
+ import { t as CodeExpression } from "./index-DZivqh0u.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-CR_g-mOq.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-Ciocekxl.mjs";
2
2
  export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
@@ -2904,11 +2904,28 @@ declare function graphToMachineConfig(graph: CodeGenGraph, options?: MachineConf
2904
2904
  */
2905
2905
  declare class RawCode {
2906
2906
  code: string;
2907
- constructor(code: string);
2908
- }
2909
- declare function raw(code: string): RawCode;
2907
+ sourceValue?: object | undefined;
2908
+ sourceSlice?: {
2909
+ from: number;
2910
+ to: number;
2911
+ } | undefined;
2912
+ constructor(code: string, sourceValue?: object | undefined, sourceSlice?: {
2913
+ from: number;
2914
+ to: number;
2915
+ } | undefined);
2916
+ }
2917
+ declare function raw(code: string, sourceValue?: object, sourceSlice?: {
2918
+ from: number;
2919
+ to: number;
2920
+ }): RawCode;
2910
2921
  declare function serializeJS(value: unknown, indent?: number, step?: number): string; //#endregion
2911
- //#region src/profiles/xgraphMetadata.d.ts
2922
+ //#region src/textUtils.d.ts
2923
+ /**
2924
+ * Pure string utilities used by codegen.
2925
+ */
2926
+ /**
2927
+ * Removes common leading whitespace from all non-empty lines.
2928
+ */
2912
2929
  //#endregion
2913
2930
  //#region src/profiles/types.d.ts
2914
2931
  /**
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
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-DlOZxzrW.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-CR_g-mOq.mjs";
4
- import { $t as EmbedPanelPosition, B as InspectionSentEvent, D as ExportCallOptions, F as InitOptions, G as MachineVersionAutoSaveOptions, Jt as createInspectionRoomUrls, Kt as assertEmbedExamples, L as InspectionAction, M as INSPECTION_PROTOCOL_VERSION, N as INSPECTION_ROOM_QUERY_PARAM, O as ExportFormat, Qt as EmbedPanelConfig, V as InspectionTakenTransition, Vt as UploadResult, Xt as isEmbedExample, Y as ProjectEmbedMachine, Yt as getInspectionRoomId, Zt as isEmbedExampleMachine, _ as EmbedDocumentLanguage, at as ProjectWorkspaceCapabilities, b as EmbedEventName, ct as ProjectWorkspaceMachineOrigin, d as CommentsConfig, f as EMBED_DOCUMENT_LANGUAGES, g as EmbedDocument, k as ExportFormatMap, m as EditorCapabilities, n as CapabilityDeniedCapability, nt as ProjectWorkspaceAction, ot as ProjectWorkspaceConfig, p as EMBED_DOCUMENT_LIMITS, qt as createInspectionActorId, r as CapabilityDeniedEvent, rt as ProjectWorkspaceActionIcon, st as ProjectWorkspaceMachine, ut as ProjectWorkspaceProject, v as EmbedEventHandler, w as EmbedMode, x as EmbedExample, y as EmbedEventMap } from "./protocol-C-tx0WI6.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-DZivqh0u.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-Ciocekxl.mjs";
4
+ import { $t as createInspectionRoomUrls, B as InspectionSentEvent, D as ExportCallOptions, F as InitOptions, Gt as UploadResult, H as InspectorLoadedEvent, J as MachineVersionAutoSaveOptions, L as InspectionAction, M as INSPECTION_PROTOCOL_VERSION, N as INSPECTION_ROOM_QUERY_PARAM, O as ExportFormat, Q as ProjectEmbedMachine, Qt as createInspectionActorId, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, Zt as assertEmbedExamples, _ as EmbedDocumentLanguage, an as EmbedPanelConfig, at as ProjectWorkspaceAction, b as EmbedEventName, ct as ProjectWorkspaceCapabilities, d as CommentsConfig, dt as ProjectWorkspaceMachineOrigin, en as getInspectionRoomId, f as EMBED_DOCUMENT_LANGUAGES, g as EmbedDocument, in as resolveInspectorSettings, k as ExportFormatMap, lt as ProjectWorkspaceConfig, m as EditorCapabilities, n as CapabilityDeniedCapability, nn as isEmbedExampleMachine, on as EmbedPanelPosition, ot as ProjectWorkspaceActionIcon, p as EMBED_DOCUMENT_LIMITS, pt as ProjectWorkspaceProject, r as CapabilityDeniedEvent, rn as mergeInspectorSettings, tn as isEmbedExample, ut as ProjectWorkspaceMachine, v as EmbedEventHandler, w as EmbedMode, x as EmbedExample, y as EmbedEventMap } from "./protocol-AeHm956D.mjs";
5
5
  import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
6
- import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-Dg7prjeL.mjs";
7
- import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-BqyuKldr.mjs";
6
+ import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-CVFc85uF.mjs";
7
+ import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-DwD_9cER.mjs";
8
8
  import { AssetConfig, EmbedEntity, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, EmbedProfileDefinition, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
9
- 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-C18TbR-o.mjs";
10
- 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-DV5IIGhV.mjs";
9
+ 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-D-L0qj9L.mjs";
10
+ 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-CKdEPGKY.mjs";
11
11
  import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
12
12
  import { PlanSyncOptions, PullSyncResult, PushLocalMachineLinksResult, PushSyncOptions, PushSyncProjectOptions, PushSyncResult, ResolvedSyncInput, SyncInputFormat, SyncPlan, SyncPlanSummary } from "./sync.mjs";
13
13
  import { CreateInspectionRelayOptions, InspectionRelay, InspectionRelayEffect, InspectionRelayPeer, InspectionRelayRole, InspectionRelaySnapshot, createInspectionRelay } from "./relay.mjs";
@@ -33,4 +33,4 @@ declare function findStatelyPragmaAttachments(sourceText: string, fileName?: str
33
33
  declare function getStatelyPragma(sourceText: string, fileName?: string, machineIndex?: number): StatelyPragma | undefined;
34
34
  declare function upsertStatelyPragma(sourceText: string, id: string, options?: UpsertStatelyPragmaOptions): string;
35
35
  //#endregion
36
- export { type ActionLocation, type AdoptedActor, type AssetConfig, type AssetUploadAdapter, type AssetUploadContext, type AssetUploadRequest, type CapabilityDeniedCapability, type CapabilityDeniedEvent, type CodeGenGraph, type CommentsConfig, type ConnectedRepo, type CreateInspectionRelayOptions, type CreateInspectorOptions, type CreateMachineFromDefinitionInput, type CreateMachineFromTemplateInput, type CreateMachineInput, type CreateMachineTemplate, type CreateProjectInput, type CreateS3AssetUploadAdapterOptions, type CreateSupabaseAssetUploadAdapterOptions, DEFAULT_STATELY_BASE_URL, type DigraphAction, type DigraphConfig, type DigraphEdgeConfig, type DigraphNodeConfig, EDITOR_PROTOCOL_VERSION, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, type EditorCapabilities, type EditorHostDiagnostic, type EditorHostExportFormat, type EditorHostInboundMessage, type EditorHostInitOptions, type EditorHostOutboundMessage, EditorHostSession, type EditorHostSessionOptions, type EditorHostValidationIssue, type EditorHostWorkspaceMachine, EditorHostWorkspaceSession, type EditorHostWorkspaceSessionOptions, type EditorSourceHost, type EditorSyncBackend, type EmbedDocument, type EmbedDocumentLanguage, type EmbedEntity, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedExample, type EmbedFormatContext, type EmbedFormatDefinition, type EmbedGraph, type EmbedMode, type EmbedPanelConfig, type EmbedPanelPosition, type EmbedProfileDefinition, type EnsureProjectInput, type EventTypeData, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type ExtractMachinesInput, type ExtractMachinesResponse, type ExtractedMachine, type ExtractedMachines, type GetMachineOptions, type GraphPatch, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, type InitOptions, type InspectedEvent, type InspectedSnapshot, type InspectedTransition, type InspectionAction, type InspectionRelay, type InspectionRelayEffect, type InspectionRelayPeer, type InspectionRelayRole, type InspectionRelaySnapshot, type InspectionSentEvent, type InspectionTakenTransition, type Inspector, type InspectorConnection, type InspectorDiscoveryEntry, type InspectorEvents, type InspectorInspectionEvent, type LegacyProjectVisibility, type LegacyUpdateMachineInput, type Machine, type MachineConfigOptions, type MachineVersion, type MachineVersionAutoSaveOptions, type ManualActorOptions, type OAuthAuthorizationServerMetadata, type OAuthClientRegistrationResponse, type OAuthProtectedResourceMetadata, type OAuthTokenResponse, type PkcePair, type PlanSyncOptions, type Project, type ProjectData, type ProjectEmbedMachine, type ProjectMachine, type ProjectMachineSummary, type ProjectSummary, type ProjectVisibility, type ProjectWorkspaceAction, type ProjectWorkspaceActionIcon, type ProjectWorkspaceCapabilities, type ProjectWorkspaceConfig, type ProjectWorkspaceMachine, type ProjectWorkspaceMachineOrigin, type ProjectWorkspaceProject, type PullSyncResult, type PushLocalMachineLinksResult, type PushSyncOptions, type PushSyncProjectOptions, type PushSyncResult, RawCode, type RemoteEditorSyncBackendOptions, type RepoType, type ResolvedSyncInput, type ResourceErrorCode, type S3UploadTarget, type StateNodeJSONData, type StatelyAction, type StatelyApiClientOptions, StatelyApiError, type StatelyApiUrlOptions, type StatelyAuthMode, type StatelyCredential, type StatelyEdgeData, type StatelyEmbed, type StatelyEmbedOptions, type StatelyGraph, type StatelyGraphData, type StatelyGuard, type StatelyInvoke, type StatelyNodeData, type StatelyPragma, type StatelyPragmaAttachment, type StudioAction, StudioApiError, type StudioApiErrorOptions, type StudioClient, type StudioClientOptions, type StudioEdge, type StudioMachine, type StudioMachineRecord, type StudioNode, type StudioRequestOptions, type SupabaseStorageClient, type SyncInputFormat, type SyncPlan, type SyncPlanSummary, type Transport, type TransportFailure, type UpdateMachineInput, type UpdateProjectInput, type UploadResult, type UpsertStatelyPragmaOptions, type VerifyApiKeyResponse, type VerifyResult, type XStateFSMOptions, type XStateTSOptions, type XStateV4TSOptions, type XStateVersion, assertEmbedExamples, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createRemoteEditorSyncBackend, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, fetchEditorSyncAccess, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, getXStateFSMCompatibilityIssues, graphToMachineConfig, graphToXStateFSM, graphToXStateTS, graphToXStateV4TS, isEmbedExample, isEmbedExampleMachine, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
36
+ export { type ActionLocation, type AdoptedActor, type AssetConfig, type AssetUploadAdapter, type AssetUploadContext, type AssetUploadRequest, type CapabilityDeniedCapability, type CapabilityDeniedEvent, type CodeGenGraph, type CommentsConfig, type ConnectedRepo, type CreateInspectionRelayOptions, type CreateInspectorOptions, type CreateMachineFromDefinitionInput, type CreateMachineFromTemplateInput, type CreateMachineInput, type CreateMachineTemplate, type CreateProjectInput, type CreateS3AssetUploadAdapterOptions, type CreateSupabaseAssetUploadAdapterOptions, DEFAULT_STATELY_BASE_URL, type DigraphAction, type DigraphConfig, type DigraphEdgeConfig, type DigraphNodeConfig, EDITOR_PROTOCOL_VERSION, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, type EditorCapabilities, type EditorHostDiagnostic, type EditorHostExportFormat, type EditorHostInboundMessage, type EditorHostInitOptions, type EditorHostOutboundMessage, EditorHostSession, type EditorHostSessionOptions, type EditorHostValidationIssue, type EditorHostWorkspaceMachine, EditorHostWorkspaceSession, type EditorHostWorkspaceSessionOptions, type EditorSourceHost, type EditorSyncBackend, type EmbedDocument, type EmbedDocumentLanguage, type EmbedEntity, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedExample, type EmbedFormatContext, type EmbedFormatDefinition, type EmbedGraph, type EmbedMode, type EmbedPanelConfig, type EmbedPanelPosition, type EmbedProfileDefinition, type EnsureProjectInput, type EventTypeData, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type ExtractMachinesInput, type ExtractMachinesResponse, type ExtractedMachine, type ExtractedMachines, type GetMachineOptions, type GraphPatch, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, type InitOptions, type InspectedEvent, type InspectedSnapshot, type InspectedTransition, type InspectionAction, type InspectionRelay, type InspectionRelayEffect, type InspectionRelayPeer, type InspectionRelayRole, type InspectionRelaySnapshot, type InspectionSentEvent, type InspectionTakenTransition, type Inspector, type InspectorConnection, type InspectorDiscoveryEntry, type InspectorEvents, type InspectorInspectionEvent, type InspectorLoadedEvent, type InspectorSettings, type LegacyProjectVisibility, type LegacyUpdateMachineInput, type Machine, type MachineConfigOptions, type MachineVersion, type MachineVersionAutoSaveOptions, type ManualActorOptions, type OAuthAuthorizationServerMetadata, type OAuthClientRegistrationResponse, type OAuthProtectedResourceMetadata, type OAuthTokenResponse, type PkcePair, type PlanSyncOptions, type Project, type ProjectData, type ProjectEmbedMachine, type ProjectMachine, type ProjectMachineSummary, type ProjectSummary, type ProjectVisibility, type ProjectWorkspaceAction, type ProjectWorkspaceActionIcon, type ProjectWorkspaceCapabilities, type ProjectWorkspaceConfig, type ProjectWorkspaceMachine, type ProjectWorkspaceMachineOrigin, type ProjectWorkspaceProject, type PullSyncResult, type PushLocalMachineLinksResult, type PushSyncOptions, type PushSyncProjectOptions, type PushSyncResult, RawCode, type RemoteEditorSyncBackendOptions, type RepoType, type ResolvedSyncInput, type ResourceErrorCode, type S3UploadTarget, type StateNodeJSONData, type StatelyAction, type StatelyApiClientOptions, StatelyApiError, type StatelyApiUrlOptions, type StatelyAuthMode, type StatelyCredential, type StatelyEdgeData, type StatelyEmbed, type StatelyEmbedOptions, type StatelyGraph, type StatelyGraphData, type StatelyGuard, type StatelyInvoke, type StatelyNodeData, type StatelyPragma, type StatelyPragmaAttachment, type StudioAction, StudioApiError, type StudioApiErrorOptions, type StudioClient, type StudioClientOptions, type StudioEdge, type StudioMachine, type StudioMachineRecord, type StudioNode, type StudioRequestOptions, type SupabaseStorageClient, type SyncInputFormat, type SyncPlan, type SyncPlanSummary, type Transport, type TransportFailure, type UpdateMachineInput, type UpdateProjectInput, type UploadResult, type UpsertStatelyPragmaOptions, type VerifyApiKeyResponse, type VerifyResult, type ViewerOptions, type XStateFSMOptions, type XStateTSOptions, type XStateV4TSOptions, type XStateVersion, assertEmbedExamples, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createRemoteEditorSyncBackend, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, fetchEditorSyncAccess, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, getXStateFSMCompatibilityIssues, graphToMachineConfig, graphToXStateFSM, graphToXStateTS, graphToXStateV4TS, isEmbedExample, isEmbedExampleMachine, jsonSchemaToTSType, mergeInspectorSettings, raw, refreshToken, registerOAuthClient, resolveInspectorSettings, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  import "./openapi-BTDjYWXd.mjs";
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-1vqjW2Am.mjs";
4
- import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
2
+ import { c as createInspectionRoomUrls, d as isEmbedExampleMachine, f as mergeInspectorSettings, i as INSPECTION_ROOM_QUERY_PARAM, l as getInspectionRoomId, n as EMBED_DOCUMENT_LIMITS, o as assertEmbedExamples, p as resolveInspectorSettings, r as INSPECTION_PROTOCOL_VERSION, s as createInspectionActorId, t as EMBED_DOCUMENT_LANGUAGES, u as isEmbedExample } from "./protocol-BsBGRISR.mjs";
3
+ import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-DxDSBJta.mjs";
4
+ import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-B2_t3Le7.mjs";
5
5
  import { createStatelyEmbed } from "./embed.mjs";
6
- import { a as fetchEditorSyncAccess, i as createRemoteEditorSyncBackend, n as EditorHostWorkspaceSession, t as EditorHostSession } from "./editorHostSession-DfmHzpls.mjs";
7
- import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-rSI54Ese.mjs";
8
- import { _ as graphToXStateV4TS, b as raw, f as getXStateFSMCompatibilityIssues, g as graphToXStateTS, h as graphToXStateFSM, l as eventsSchemaToTSType, m as graphToMachineConfig, n as RawCode, o as contextSchemaToTSType, v as jsonSchemaToTSType, x as serializeJS } from "./dist-wbhkeGh6.mjs";
6
+ import { a as fetchEditorSyncAccess, i as createRemoteEditorSyncBackend, n as EditorHostWorkspaceSession, t as EditorHostSession } from "./editorHostSession-Bj5YcijC.mjs";
7
+ import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-BZP6DaIO.mjs";
8
+ import { S as serializeJS, _ as graphToXStateV4TS, f as getXStateFSMCompatibilityIssues, g as graphToXStateTS, h as graphToXStateFSM, l as eventsSchemaToTSType, m as graphToMachineConfig, n as RawCode, o as contextSchemaToTSType, x as raw, y as jsonSchemaToTSType } from "./dist-NJFkDQjK.mjs";
9
9
  import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
10
- import { n as createStatelyInspector, t as createInspector } from "./inspect-GI2nE3J9.mjs";
10
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-0dMcaOz_.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";
14
- import { n as getStatelyPragma, r as upsertStatelyPragma, t as findStatelyPragmaAttachments } from "./statelyPragma-D46lczJR.mjs";
14
+ import { n as getStatelyPragma, r as upsertStatelyPragma, t as findStatelyPragmaAttachments } from "./statelyPragma-YtVaBuIe.mjs";
15
15
  import { fromStudioMachine, studioMachineConverter, toStudioMachine } from "./graph.mjs";
16
16
  import { createInspectionRelay } from "./relay.mjs";
17
17
 
18
- export { DEFAULT_STATELY_BASE_URL, EDITOR_PROTOCOL_VERSION, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorHostSession, EditorHostWorkspaceSession, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, RawCode, StatelyApiError, StudioApiError, assertEmbedExamples, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createRemoteEditorSyncBackend, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, fetchEditorSyncAccess, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, getXStateFSMCompatibilityIssues, graphToMachineConfig, graphToXStateFSM, graphToXStateTS, graphToXStateV4TS, isEmbedExample, isEmbedExampleMachine, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
18
+ export { DEFAULT_STATELY_BASE_URL, EDITOR_PROTOCOL_VERSION, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorHostSession, EditorHostWorkspaceSession, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, RawCode, StatelyApiError, StudioApiError, assertEmbedExamples, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createRemoteEditorSyncBackend, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, fetchEditorSyncAccess, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, getXStateFSMCompatibilityIssues, graphToMachineConfig, graphToXStateFSM, graphToXStateTS, graphToXStateV4TS, isEmbedExample, isEmbedExampleMachine, jsonSchemaToTSType, mergeInspectorSettings, raw, refreshToken, registerOAuthClient, resolveInspectorSettings, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
@@ -1,5 +1,5 @@
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-1vqjW2Am.mjs";
1
+ import { c as createInspectionRoomUrls, f as mergeInspectorSettings, l as getInspectionRoomId, p as resolveInspectorSettings, r as INSPECTION_PROTOCOL_VERSION } from "./protocol-BsBGRISR.mjs";
2
+ import { a as assertEmbedDocuments, c as createPendingExportManager, i as createWebSocketTransport, n as inspectionRuntime, o as assertEmbedPanels, s as createEventRegistry, t as SDK_VERSION } from "./version-DxDSBJta.mjs";
3
3
 
4
4
  //#region src/openBrowser.ts
5
5
  async function openBrowser(url) {
@@ -76,9 +76,15 @@ function generateRoomId() {
76
76
  return globalThis.crypto.randomUUID();
77
77
  }
78
78
  function createInspector(options = {}) {
79
+ assertEmbedDocuments(options.documents);
80
+ assertEmbedPanels(options.panels);
81
+ let viewerSettings = resolveInspectorSettings(options);
82
+ let hasViewerSettings = options.settings !== void 0 || options.viewMode !== void 0;
83
+ let preferredSessionId = options.selectedSessionId ?? options.selectedActorId;
79
84
  const environmentUrl = typeof process !== "undefined" ? process.env?.STATELY_INSPECT_URL : void 0;
80
85
  const url = options.url ?? environmentUrl ?? "wss://sky.stately.ai";
81
- const { inspectorBaseUrl, name, serializeSnapshot = defaultSerializeSnapshot, selectedSessionId: configuredSelectedSessionId, selectedActorId, panels, theme, readOnly, depth, capabilities, sessionIdReuse = "stopped", transport: injectedTransport } = options;
86
+ const { inspectorBaseUrl, name, machines: configuredMachines, serializeSnapshot = defaultSerializeSnapshot, panels, documents, readOnly, depth, capabilities, sessionIdReuse = "stopped", transport: injectedTransport } = options;
87
+ const declaredMachines = { ...configuredMachines };
82
88
  const launch = options.launch ?? (options.autoOpen === true ? "browser" : "none");
83
89
  const extractMachine = options.extractMachine ?? options.extractMachineConfig ?? defaultExtractMachineConfig;
84
90
  const roomId = options.roomId ?? options.sessionId ?? getInspectionRoomId(url) ?? generateRoomId();
@@ -211,7 +217,16 @@ function createInspector(options = {}) {
211
217
  });
212
218
  const stopTransportMessages = transport.onMessage((msg) => {
213
219
  if (destroyed) return;
220
+ if (msg.producerId && msg.producerId !== producerId) return;
214
221
  switch (msg.type) {
222
+ case "@statelyai.system.loaded":
223
+ emitLocal("loaded", { ...msg.producerId && { producerId: msg.producerId } });
224
+ break;
225
+ case "@statelyai.capabilityDenied": {
226
+ const { type: _type, ...event } = msg;
227
+ emitLocal("capabilityDenied", event);
228
+ break;
229
+ }
215
230
  case "@statelyai.retrieved":
216
231
  exportManager.resolve(msg.requestId, msg.data);
217
232
  break;
@@ -386,7 +401,7 @@ function createInspector(options = {}) {
386
401
  machine: entry.machineConfig,
387
402
  snapshot: entry.snapshot ?? void 0
388
403
  });
389
- if ((configuredSelectedSessionId ?? selectedActorId) === entry.sessionId) send({
404
+ if (preferredSessionId === entry.sessionId) send({
390
405
  type: "@statelyai.system.selectActor",
391
406
  sessionId: entry.sessionId
392
407
  });
@@ -418,14 +433,17 @@ function createInspector(options = {}) {
418
433
  function buildInitMessage() {
419
434
  for (const [rootActorId, { actor }] of inspectedRoots) backfillActorTree(actor, rootActorId);
420
435
  const allEntries = Array.from(actors.values());
421
- const selectedSessionId = configuredSelectedSessionId ?? selectedActorId ?? observedRootIds.values().next().value ?? allEntries[0]?.sessionId;
436
+ const selectedSessionId = preferredSessionId ?? observedRootIds.values().next().value ?? allEntries[0]?.sessionId;
422
437
  return {
423
438
  type: "@statelyai.system.init",
424
439
  protocolVersion: INSPECTION_PROTOCOL_VERSION,
425
440
  mode: "inspecting",
426
441
  actors: allEntries.map(toSystemEntry),
442
+ ...configuredMachines !== void 0 || Object.keys(declaredMachines).length > 0 ? { machines: { ...declaredMachines } } : {},
427
443
  ...selectedSessionId && { selectedSessionId },
428
- ...theme && { theme },
444
+ ...!hasViewerSettings && options.theme && { theme: options.theme },
445
+ ...hasViewerSettings && { settings: viewerSettings },
446
+ ...documents && { documents },
429
447
  ...readOnly !== void 0 && { readOnly },
430
448
  ...depth !== void 0 && { depth },
431
449
  ...capabilities !== void 0 && { capabilities },
@@ -717,11 +735,24 @@ function createInspector(options = {}) {
717
735
  emitLocal("stop", stopped);
718
736
  emitLocal("stopped", stopped);
719
737
  }
738
+ function manualMachine(id, payload) {
739
+ declaredMachines[id] = payload;
740
+ sendInit();
741
+ }
720
742
  initialized = true;
721
743
  if (pendingTransportReady) {
722
744
  pendingTransportReady = false;
723
745
  handleTransportReady();
724
746
  }
747
+ function setViewerSettings(settings) {
748
+ if (destroyed) return;
749
+ viewerSettings = mergeInspectorSettings(viewerSettings, settings);
750
+ hasViewerSettings = true;
751
+ send({
752
+ type: "@statelyai.setSettings",
753
+ settings: { ...viewerSettings }
754
+ });
755
+ }
725
756
  return {
726
757
  actors,
727
758
  roomId,
@@ -744,10 +775,23 @@ function createInspector(options = {}) {
744
775
  off(event, handler) {
745
776
  localListeners[event]?.delete(handler);
746
777
  },
778
+ selectActor(sessionId) {
779
+ if (destroyed) return;
780
+ if (!sessionId.trim()) throw new TypeError("sessionId must not be empty");
781
+ preferredSessionId = sessionId;
782
+ send({
783
+ type: "@statelyai.system.selectActor",
784
+ sessionId
785
+ });
786
+ },
787
+ setSettings: setViewerSettings,
788
+ setTheme: (theme) => setViewerSettings({ appearance: { colorMode: theme } }),
789
+ setViewMode: (viewMode) => setViewerSettings({ canvas: { viewMode } }),
747
790
  export(format, callOptions) {
748
791
  return exportManager.start(format, callOptions, "Inspector is destroyed", () => destroyed);
749
792
  },
750
793
  actor: manualRegister,
794
+ machine: manualMachine,
751
795
  snapshot: manualSnapshot,
752
796
  event: manualEvent,
753
797
  stop: manualStop,
@@ -1,4 +1,4 @@
1
- import { B as InspectionSentEvent, D as ExportCallOptions, L as InspectionAction, O as ExportFormat, Qt as EmbedPanelConfig, R as InspectionClientMetadata, V as InspectionTakenTransition, dt as ProtocolMessage, k as ExportFormatMap, m as EditorCapabilities, y as EmbedEventMap } from "./protocol-C-tx0WI6.mjs";
1
+ import { B as InspectionSentEvent, D as ExportCallOptions, H as InspectorLoadedEvent, K as MachinePayload, L as InspectionAction, O as ExportFormat, R as InspectionClientMetadata, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, k as ExportFormatMap, mt as ProtocolMessage, y as EmbedEventMap } from "./protocol-AeHm956D.mjs";
2
2
 
3
3
  //#region src/transport.d.ts
4
4
  interface TransportFailure {
@@ -111,6 +111,8 @@ interface InspectorConnection {
111
111
  /** Browser-page discovery metadata consumed by the Stately DevTools extension. */
112
112
  type InspectorDiscoveryEntry = InspectorConnection;
113
113
  interface InspectorEvents {
114
+ loaded: InspectorLoadedEvent;
115
+ capabilityDenied: EmbedEventMap['capabilityDenied'];
114
116
  connected: InspectorConnection;
115
117
  actor: AdoptedActor;
116
118
  event: InspectedEvent;
@@ -140,7 +142,7 @@ interface ManualActorOptions {
140
142
  /** System-level id (optional alias). */
141
143
  systemId?: string;
142
144
  }
143
- interface CreateInspectorOptions {
145
+ interface CreateInspectorOptions extends ViewerOptions<InspectorSettings> {
144
146
  /**
145
147
  * WebSocket relay base URL. Defaults to `STATELY_INSPECT_URL`, then
146
148
  * `wss://sky.stately.ai`. Passing this option always wins.
@@ -170,6 +172,8 @@ interface CreateInspectorOptions {
170
172
  sessionId?: string;
171
173
  /** Display name for this system in the visualizer. */
172
174
  name?: string;
175
+ /** Machine definitions available before their first actor exists. */
176
+ machines?: Record<string, MachinePayload>;
173
177
  /**
174
178
  * Serialize a snapshot for the wire. Defaults to `{value, status}` —
175
179
  * dropping context entirely because xstate contexts routinely contain
@@ -204,16 +208,16 @@ interface CreateInspectorOptions {
204
208
  * guarantee the previous runtime actor will no longer produce relevant events.
205
209
  */
206
210
  sessionIdReuse?: 'stopped' | 'always';
207
- /** Selected actor session id to focus on first. */
211
+ /**
212
+ * Exact producer-local session id to focus on first (not the actor id).
213
+ * For manual actors registered with `inspector.actor(id)`, use
214
+ * `${producerId}:${id}` and configure an explicit `producerId`.
215
+ * For runtime actors, use `actor.sessionId`, or the value returned by
216
+ * `resolveSessionId` when configured. Do not add the viewer's room namespace.
217
+ */
208
218
  selectedSessionId?: string;
209
219
  /** @deprecated Use {@link selectedSessionId}. */
210
220
  selectedActorId?: string;
211
- /** Panel layout forwarded into the system init message. */
212
- panels?: EmbedPanelConfig[];
213
- theme?: 'light' | 'dark';
214
- readOnly?: boolean;
215
- depth?: number;
216
- capabilities?: EditorCapabilities;
217
221
  /**
218
222
  * Advanced: inject a pre-built transport. When provided, `url`/`name` are
219
223
  * ignored and no WebSocket or browser URL is created.
@@ -247,6 +251,12 @@ interface Inspector {
247
251
  /** Subscribe to lifecycle / error events. Returns an unsubscribe function. */
248
252
  on<E extends EventName>(event: E, handler: Handler<E>): () => void;
249
253
  off<E extends EventName>(event: E, handler: Handler<E>): void;
254
+ /** Focus an actor using its producer-local session id. */
255
+ selectActor(sessionId: string): void;
256
+ /** Update display preferences without restarting inspection. */
257
+ setSettings(settings: InspectorSettings): void;
258
+ setTheme(theme: NonNullable<ViewerOptions['theme']>): void;
259
+ setViewMode(viewMode: NonNullable<ViewerOptions['viewMode']>): void;
250
260
  /** Export the currently-viewed machine in a given format. */
251
261
  export<F extends ExportFormat>(format: F, options?: ExportCallOptions<F>): Promise<ExportFormatMap[F]['result']>;
252
262
  /**
@@ -254,6 +264,8 @@ interface Inspector {
254
264
  * xstate-discovered ones; in manual mode it's the only way to add actors.
255
265
  */
256
266
  actor(id: string, options?: ManualActorOptions): void;
267
+ /** Declare or replace a machine definition and refresh the system checkpoint. */
268
+ machine(id: string, payload: MachinePayload): void;
257
269
  /**
258
270
  * Push a snapshot update for an actor, optionally with the event known to
259
271
  * have caused it. The actor is auto-registered if needed.
@@ -1,3 +1,3 @@
1
- import { B as InspectionSentEvent, D as ExportCallOptions, L as InspectionAction, O as ExportFormat, V as InspectionTakenTransition, b as EmbedEventName, k as ExportFormatMap, m as EditorCapabilities, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-C-tx0WI6.mjs";
2
- import { a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, 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-C18TbR-o.mjs";
3
- export { AdoptedActor, CreateInspectorOptions, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InspectedEvent, InspectedSnapshot, InspectedTransition, InspectionAction, InspectionSentEvent, InspectionTakenTransition, Inspector, InspectorConnection, InspectorDiscoveryEntry, InspectorEvents, InspectorInspectionEvent, ManualActorOptions, Transport, createInspector, createStatelyInspector };
1
+ import { B as InspectionSentEvent, D as ExportCallOptions, H as InspectorLoadedEvent, K as MachinePayload, L as InspectionAction, O as ExportFormat, U as InspectorSettings, V as InspectionTakenTransition, Yt as ViewerOptions, an as EmbedPanelConfig, b as EmbedEventName, g as EmbedDocument, k as ExportFormatMap, m as EditorCapabilities, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-AeHm956D.mjs";
2
+ import { a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, 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-D-L0qj9L.mjs";
3
+ export { AdoptedActor, CreateInspectorOptions, EditorCapabilities, EmbedDocument, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, EmbedPanelConfig, ExportCallOptions, ExportFormat, ExportFormatMap, InspectedEvent, InspectedSnapshot, InspectedTransition, InspectionAction, InspectionSentEvent, InspectionTakenTransition, Inspector, InspectorConnection, InspectorDiscoveryEntry, InspectorEvents, InspectorInspectionEvent, InspectorLoadedEvent, InspectorSettings, MachinePayload, ManualActorOptions, Transport, ViewerOptions, createInspector, createStatelyInspector };
package/dist/inspect.mjs CHANGED
@@ -1,4 +1,5 @@
1
- import "./version-1vqjW2Am.mjs";
2
- import { n as createStatelyInspector, t as createInspector } from "./inspect-GI2nE3J9.mjs";
1
+ import "./protocol-BsBGRISR.mjs";
2
+ import "./version-DxDSBJta.mjs";
3
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-0dMcaOz_.mjs";
3
4
 
4
5
  export { createInspector, createStatelyInspector };
@@ -1,4 +1,4 @@
1
- import { getInspectionRoomId } from "./protocol.mjs";
1
+ import { l as getInspectionRoomId } from "./protocol-BsBGRISR.mjs";
2
2
  import { createInspectionRelay } from "./relay.mjs";
3
3
  import { createServer } from "node:http";
4
4
  import { randomUUID } from "node:crypto";
@@ -1,2 +1,2 @@
1
- import { C as ImplementationSourceType, S as GraphPatch, b as CanvasColor, x as EditorStateType, y as ActionLocation } from "./index-DlOZxzrW.mjs";
1
+ import { C as ImplementationSourceType, S as GraphPatch, b as CanvasColor, x as EditorStateType, y as ActionLocation } from "./index-DZivqh0u.mjs";
2
2
  export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };