@statelyai/sdk 0.25.0 → 0.26.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.
- package/README.md +8 -0
- package/dist/embed.d.mts +5 -4
- package/dist/embed.mjs +20 -3
- package/dist/{graph-BGUND7ZF.d.mts → graph-DoUReqxz.d.mts} +1 -1
- package/dist/graph.d.mts +1 -1
- package/dist/{index-DuvCSThi.d.mts → index-DKRB-u93.d.mts} +11 -7
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -2
- package/dist/{inspect-QlXh72hZ.mjs → inspect-DNM-Qs93.mjs} +34 -6
- package/dist/inspect.mjs +2 -2
- package/dist/patchTypes.d.mts +1 -1
- package/dist/protocol.d.mts +59 -5
- package/dist/{studio-erXbdakn.d.mts → studio-B6P177N3.d.mts} +1 -1
- package/dist/studio.d.mts +1 -1
- package/dist/sync.d.mts +2 -2
- package/dist/{version-BfcJU2pO.mjs → version-u0s4xat2.mjs} +5 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -59,6 +59,13 @@ RPC methods and payloads are validated before host code runs, and malformed
|
|
|
59
59
|
graphs returned by custom importers are rejected.
|
|
60
60
|
Use `defaultProfile` and `defaultFormat` to choose the initial custom pair.
|
|
61
61
|
|
|
62
|
+
<!-- Embed version configuration and events from src/embed.ts and src/protocol.ts -->
|
|
63
|
+
|
|
64
|
+
Automatic version capture is opt-in. Pass `versionAutoSave: { intervalMs }` to
|
|
65
|
+
the embed and handle `versionSaveRequested` to persist immutable snapshots in
|
|
66
|
+
the host, or omit it to keep versioning manual. Hosts with server-side
|
|
67
|
+
auto-versioning should choose one capture path per save.
|
|
68
|
+
|
|
62
69
|
Restrict an embed by passing a resolved access policy:
|
|
63
70
|
|
|
64
71
|
<!-- restricted MachineInitOptions from src/protocol.ts -->
|
|
@@ -115,6 +122,7 @@ Key capabilities:
|
|
|
115
122
|
- **Comments** via Liveblocks integration (optional)
|
|
116
123
|
- **Asset uploads** with built-in S3 and Supabase adapters, or bring your own upload handler
|
|
117
124
|
- **Runtime settings** - toggle color mode, grid, snap lines, and view mode on the fly
|
|
125
|
+
- **Automatic versions** - optionally request host-owned immutable snapshots at a configured interval
|
|
118
126
|
|
|
119
127
|
### Resource API client
|
|
120
128
|
|
package/dist/embed.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as ProfileManifest } from "./index-
|
|
2
|
-
import { i as StatelyGraph } from "./graph-
|
|
3
|
-
import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExtensionsManifest, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceProject, UploadResult } from "./protocol.mjs";
|
|
1
|
+
import { i as ProfileManifest } from "./index-DKRB-u93.mjs";
|
|
2
|
+
import { i as StatelyGraph } from "./graph-DoUReqxz.mjs";
|
|
3
|
+
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";
|
|
4
4
|
import { AssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/embed.d.ts
|
|
@@ -104,6 +104,7 @@ interface StatelyEmbedOptions extends Partial<MachineInitOptions> {
|
|
|
104
104
|
onLoaded?: (graph: StatelyGraph) => void;
|
|
105
105
|
onChange?: (graph: StatelyGraph, machineConfig: unknown) => void;
|
|
106
106
|
onSave?: (graph: StatelyGraph, machineConfig: unknown) => void;
|
|
107
|
+
onVersionSaveRequested?: (event: EmbedEventMap['versionSaveRequested']) => void;
|
|
107
108
|
onViewModeChanged?: (viewMode: 'graph' | 'list') => void;
|
|
108
109
|
onError?: (error: {
|
|
109
110
|
code: string;
|
|
@@ -150,4 +151,4 @@ interface StatelyEmbed {
|
|
|
150
151
|
}
|
|
151
152
|
declare function createStatelyEmbed(options: StatelyEmbedOptions): StatelyEmbed;
|
|
152
153
|
//#endregion
|
|
153
|
-
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, EmbedProfileDefinition, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type ProjectEmbedMachine, type ProjectWorkspaceAction, type ProjectWorkspaceActionIcon, type ProjectWorkspaceCapabilities, type ProjectWorkspaceConfig, type ProjectWorkspaceMachine, type ProjectWorkspaceProject, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
|
|
154
|
+
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, EmbedProfileDefinition, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type MachineVersionAutoSaveOptions, type ProjectEmbedMachine, type ProjectWorkspaceAction, type ProjectWorkspaceActionIcon, type ProjectWorkspaceCapabilities, type ProjectWorkspaceConfig, type ProjectWorkspaceMachine, type ProjectWorkspaceMachineOrigin, type ProjectWorkspaceProject, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
|
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-
|
|
1
|
+
import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-u0s4xat2.mjs";
|
|
2
2
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/embed.ts
|
|
@@ -87,7 +87,8 @@ function extractInitOptions(options) {
|
|
|
87
87
|
projectWorkspace: options.projectWorkspace,
|
|
88
88
|
projectWorkspaceOpen: options.projectWorkspaceOpen,
|
|
89
89
|
settings: options.settings,
|
|
90
|
-
unsavedIndicator: options.unsavedIndicator
|
|
90
|
+
unsavedIndicator: options.unsavedIndicator,
|
|
91
|
+
versionAutoSave: options.versionAutoSave
|
|
91
92
|
};
|
|
92
93
|
if (options.machine !== void 0) return {
|
|
93
94
|
machine: options.machine,
|
|
@@ -104,7 +105,8 @@ function extractInitOptions(options) {
|
|
|
104
105
|
comments: options.comments,
|
|
105
106
|
sourceLocations: options.sourceLocations,
|
|
106
107
|
settings: options.settings,
|
|
107
|
-
unsavedIndicator: options.unsavedIndicator
|
|
108
|
+
unsavedIndicator: options.unsavedIndicator,
|
|
109
|
+
versionAutoSave: options.versionAutoSave
|
|
108
110
|
};
|
|
109
111
|
return null;
|
|
110
112
|
}
|
|
@@ -288,6 +290,21 @@ function createStatelyEmbed(options) {
|
|
|
288
290
|
});
|
|
289
291
|
break;
|
|
290
292
|
}
|
|
293
|
+
case "@statelyai.versionSaveRequested": {
|
|
294
|
+
const version = data;
|
|
295
|
+
const event = {
|
|
296
|
+
graph: version.graph,
|
|
297
|
+
machineConfig: version.machineConfig,
|
|
298
|
+
machineId: version.machineId,
|
|
299
|
+
patches: version.patches,
|
|
300
|
+
createdBy: version.createdBy,
|
|
301
|
+
captureType: version.captureType,
|
|
302
|
+
sourceLocations: version.sourceLocations
|
|
303
|
+
};
|
|
304
|
+
options.onVersionSaveRequested?.(event);
|
|
305
|
+
events.emit("versionSaveRequested", event);
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
291
308
|
case "@statelyai.project.machineSelected":
|
|
292
309
|
events.emit("machineSelected", { machineId: String(data.machineId) });
|
|
293
310
|
break;
|
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-
|
|
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-DoUReqxz.mjs";
|
|
2
2
|
export { StatelyAction, StatelyActorImplementation, StatelyEdgeData, StatelyGraph, StatelyGraphData, StatelyGuard, StatelyImplementation, StatelyInvoke, StatelyNodeData, StatelyTagImplementation, StudioAction, StudioEdge, StudioEventTypeData, StudioMachine, StudioNode, fromStudioMachine, studioMachineConverter, toStudioMachine };
|
|
@@ -2199,6 +2199,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
2199
2199
|
description: ZodOptional<ZodString>;
|
|
2200
2200
|
initialId: ZodOptional<ZodNullable<ZodString>>;
|
|
2201
2201
|
initialInput: ZodOptional<ZodUnknown>;
|
|
2202
|
+
output: ZodOptional<ZodUnknown>;
|
|
2202
2203
|
timeout: ZodOptional<ZodUnknown>;
|
|
2203
2204
|
route: ZodOptional<ZodUnknown>;
|
|
2204
2205
|
}, $strip>;
|
|
@@ -2278,9 +2279,10 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
2278
2279
|
final: "final";
|
|
2279
2280
|
choice: "choice";
|
|
2280
2281
|
}>>>;
|
|
2281
|
-
stateDescription: ZodOptional<ZodString
|
|
2282
|
+
stateDescription: ZodOptional<ZodNullable<ZodString>>;
|
|
2282
2283
|
initialId: ZodOptional<ZodNullable<ZodString>>;
|
|
2283
2284
|
initialInput: ZodOptional<ZodUnknown>;
|
|
2285
|
+
output: ZodOptional<ZodUnknown>;
|
|
2284
2286
|
timeout: ZodOptional<ZodUnknown>;
|
|
2285
2287
|
route: ZodOptional<ZodUnknown>;
|
|
2286
2288
|
color: ZodOptional<ZodNullable<ZodEnum<{
|
|
@@ -2339,7 +2341,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
2339
2341
|
sourceId: ZodOptional<ZodString>;
|
|
2340
2342
|
targetId: ZodOptional<ZodString>;
|
|
2341
2343
|
eventType: ZodOptional<ZodString>;
|
|
2342
|
-
matches: ZodOptional<ZodRecord<ZodString, ZodUnknown
|
|
2344
|
+
matches: ZodOptional<ZodNullable<ZodRecord<ZodString, ZodUnknown>>>;
|
|
2343
2345
|
transitionType: ZodOptional<ZodEnum<{
|
|
2344
2346
|
normal: "normal";
|
|
2345
2347
|
targetless: "targetless";
|
|
@@ -2434,11 +2436,11 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
2434
2436
|
nodeId: ZodString;
|
|
2435
2437
|
invokeId: ZodString;
|
|
2436
2438
|
data: ZodObject<{
|
|
2437
|
-
invocationId: ZodOptional<ZodString
|
|
2439
|
+
invocationId: ZodOptional<ZodNullable<ZodString>>;
|
|
2438
2440
|
src: ZodOptional<ZodString>;
|
|
2439
2441
|
srcExpression: ZodOptional<ZodUnknown>;
|
|
2440
|
-
code: ZodOptional<ZodString
|
|
2441
|
-
registryKey: ZodOptional<ZodString
|
|
2442
|
+
code: ZodOptional<ZodNullable<ZodString>>;
|
|
2443
|
+
registryKey: ZodOptional<ZodNullable<ZodString>>;
|
|
2442
2444
|
timeout: ZodOptional<ZodUnknown>;
|
|
2443
2445
|
input: ZodOptional<ZodUnknown>;
|
|
2444
2446
|
output: ZodOptional<ZodUnknown>;
|
|
@@ -2474,7 +2476,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
2474
2476
|
implementationId: ZodString;
|
|
2475
2477
|
data: ZodObject<{
|
|
2476
2478
|
name: ZodOptional<ZodString>;
|
|
2477
|
-
code: ZodOptional<ZodString
|
|
2479
|
+
code: ZodOptional<ZodNullable<ZodString>>;
|
|
2478
2480
|
}, $strip>;
|
|
2479
2481
|
}, $strip>, ZodObject<{
|
|
2480
2482
|
op: ZodLiteral<"deleteImplementation">;
|
|
@@ -2533,7 +2535,7 @@ declare const graphPatchSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
2533
2535
|
}, $strip>, ZodObject<{
|
|
2534
2536
|
op: ZodLiteral<"setContext">;
|
|
2535
2537
|
description: ZodOptional<ZodString>;
|
|
2536
|
-
context: ZodRecord<ZodString, ZodUnknown
|
|
2538
|
+
context: ZodNullable<ZodRecord<ZodString, ZodUnknown>>;
|
|
2537
2539
|
}, $strip>, ZodObject<{
|
|
2538
2540
|
op: ZodLiteral<"updateSchemas">;
|
|
2539
2541
|
description: ZodOptional<ZodString>;
|
|
@@ -2945,6 +2947,8 @@ interface XStateTSOptions extends MachineConfigOptions {
|
|
|
2945
2947
|
xstateV6SchemaFormat?: 'types' | 'zod';
|
|
2946
2948
|
}
|
|
2947
2949
|
declare function graphToXStateTS(graph: CodeGenGraph, options?: XStateTSOptions): string; //#endregion
|
|
2950
|
+
//#region src/emittedNodeIds.d.ts
|
|
2951
|
+
//#endregion
|
|
2948
2952
|
//#region src/jsonSchemaToTSType.d.ts
|
|
2949
2953
|
declare function jsonSchemaToTSType(schema: JSONSchema7 | undefined | null): string;
|
|
2950
2954
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
2
|
-
import { _ as GraphPatch, a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, f as raw, l as graphToMachineConfig, m as ActionLocation, n as CodeGenGraph, o as XStateTSOptions, p as serializeJS, r as MachineConfigOptions, s as contextSchemaToTSType, u as graphToXStateTS } from "./index-
|
|
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-
|
|
4
|
-
import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitOptions, InspectionAction, InspectionSentEvent, InspectionTakenTransition, ProjectEmbedMachine, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceProject, UploadResult, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
2
|
+
import { _ as GraphPatch, a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, f as raw, l as graphToMachineConfig, m as ActionLocation, n as CodeGenGraph, o as XStateTSOptions, p as serializeJS, r as MachineConfigOptions, s as contextSchemaToTSType, u as graphToXStateTS } from "./index-DKRB-u93.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-DoUReqxz.mjs";
|
|
4
|
+
import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, 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, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
5
5
|
import { AssetUploadAdapter, AssetUploadContext, AssetUploadRequest, CreateS3AssetUploadAdapterOptions, CreateSupabaseAssetUploadAdapterOptions, S3UploadTarget, SupabaseStorageClient, createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
6
6
|
import { i as getCredentialToken, n as StatelyCredential, r as createAuthorizationHeader, t as StatelyAuthMode } from "./auth-B0ZTKri2.mjs";
|
|
7
7
|
import { c as fetchEditorSyncAccess, d as EditorHostInboundMessage, f as EditorHostInitOptions, i as EditorSyncBackend, l as EDITOR_PROTOCOL_VERSION, m as EditorHostValidationIssue, n as EditorHostSessionOptions, o as RemoteEditorSyncBackendOptions, p as EditorHostOutboundMessage, r as EditorSourceHost, s as createRemoteEditorSyncBackend, t as EditorHostSession, u as EditorHostExportFormat } from "./editorHostSession-DTXKcLhR.mjs";
|
|
8
8
|
import { AssetConfig, EmbedEntity, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, EmbedProfileDefinition, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
|
|
9
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-Br_vS_lK.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-
|
|
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-B6P177N3.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 EditorHostExportFormat, type EditorHostInboundMessage, type EditorHostInitOptions, type EditorHostOutboundMessage, EditorHostSession, type EditorHostSessionOptions, type EditorHostValidationIssue, type EditorSourceHost, type EditorSyncBackend, type EmbedDocument, type EmbedDocumentLanguage, type EmbedEntity, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedFormatContext, type EmbedFormatDefinition, type EmbedGraph, type EmbedMode, 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 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 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 XStateTSOptions, type XStateVersion, 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, graphToMachineConfig, graphToXStateTS, 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 EditorHostExportFormat, type EditorHostInboundMessage, type EditorHostInitOptions, type EditorHostOutboundMessage, EditorHostSession, type EditorHostSessionOptions, type EditorHostValidationIssue, type EditorSourceHost, type EditorSyncBackend, type EmbedDocument, type EmbedDocumentLanguage, type EmbedEntity, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedFormatContext, type EmbedFormatDefinition, type EmbedGraph, type EmbedMode, 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 XStateTSOptions, type XStateVersion, 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, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
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, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
3
|
-
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-
|
|
3
|
+
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-u0s4xat2.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-BwS-EiBJ.mjs";
|
|
7
7
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-iNSHtNmP.mjs";
|
|
8
8
|
import { a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, l as graphToMachineConfig, m as serializeJS, n as getStatelyPragma, o as contextSchemaToTSType, p as raw, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-B-axv279.mjs";
|
|
9
9
|
import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
10
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
10
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-DNM-Qs93.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-
|
|
2
|
+
import { a as createEventRegistry, i as createWebSocketTransport, n as inspectionRuntime, o as createPendingExportManager, t as SDK_VERSION } from "./version-u0s4xat2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openBrowser.ts
|
|
5
5
|
async function openBrowser(url) {
|
|
@@ -95,7 +95,10 @@ function createInspector(options = {}) {
|
|
|
95
95
|
rejectReady = reject;
|
|
96
96
|
});
|
|
97
97
|
ready.catch(() => {});
|
|
98
|
+
const INIT_PLACEHOLDER = { __pendingInit: true };
|
|
99
|
+
const isInitPlaceholder = (message) => message === INIT_PLACEHOLDER;
|
|
98
100
|
const pendingMessages = [];
|
|
101
|
+
let initQueueIndex = null;
|
|
99
102
|
const events = createEventRegistry();
|
|
100
103
|
const localListeners = {};
|
|
101
104
|
const transport = injectedTransport ?? createWebSocketTransport({
|
|
@@ -110,8 +113,18 @@ function createInspector(options = {}) {
|
|
|
110
113
|
});
|
|
111
114
|
const ownsTransport = !injectedTransport;
|
|
112
115
|
const exportManager = createPendingExportManager((message) => send(message));
|
|
116
|
+
/**
|
|
117
|
+
* Build the queued init payload now, so it captures the actor tree as it was
|
|
118
|
+
* before whatever is being queued next.
|
|
119
|
+
*/
|
|
120
|
+
function materializePendingInit() {
|
|
121
|
+
if (initQueueIndex === null) return;
|
|
122
|
+
if (pendingMessages[initQueueIndex] !== INIT_PLACEHOLDER) return;
|
|
123
|
+
pendingMessages[initQueueIndex] = buildInitMessage();
|
|
124
|
+
}
|
|
113
125
|
function send(msg) {
|
|
114
126
|
if (!transport.ready) {
|
|
127
|
+
materializePendingInit();
|
|
115
128
|
pendingMessages.push(msg);
|
|
116
129
|
return;
|
|
117
130
|
}
|
|
@@ -123,11 +136,14 @@ function createInspector(options = {}) {
|
|
|
123
136
|
transportWasReady = true;
|
|
124
137
|
if (!initSent) sendInit();
|
|
125
138
|
const queued = pendingMessages.splice(0);
|
|
126
|
-
|
|
139
|
+
initQueueIndex = null;
|
|
140
|
+
for (const message of queued) if (isInitPlaceholder(message)) transport.send(buildInitMessage());
|
|
141
|
+
else transport.send(message);
|
|
127
142
|
readySettled = true;
|
|
128
143
|
resolveReady();
|
|
129
144
|
} else {
|
|
130
145
|
pendingMessages.length = 0;
|
|
146
|
+
initQueueIndex = null;
|
|
131
147
|
initSent = false;
|
|
132
148
|
sendInit();
|
|
133
149
|
}
|
|
@@ -292,11 +308,11 @@ function createInspector(options = {}) {
|
|
|
292
308
|
}
|
|
293
309
|
const inspectedRoots = /* @__PURE__ */ new Map();
|
|
294
310
|
const observedRootIds = /* @__PURE__ */ new Set();
|
|
295
|
-
function
|
|
311
|
+
function buildInitMessage() {
|
|
296
312
|
for (const [rootActorId, { actor }] of inspectedRoots) backfillActorTree(actor, rootActorId);
|
|
297
313
|
const allEntries = Array.from(actors.values());
|
|
298
314
|
const selectedSessionId = configuredSelectedSessionId ?? selectedActorId ?? observedRootIds.values().next().value ?? allEntries[0]?.sessionId;
|
|
299
|
-
|
|
315
|
+
return {
|
|
300
316
|
type: "@statelyai.system.init",
|
|
301
317
|
protocolVersion: INSPECTION_PROTOCOL_VERSION,
|
|
302
318
|
mode: "inspecting",
|
|
@@ -309,7 +325,13 @@ function createInspector(options = {}) {
|
|
|
309
325
|
...panels?.leftPanels && { leftPanels: panels.leftPanels },
|
|
310
326
|
...panels?.rightPanels && { rightPanels: panels.rightPanels },
|
|
311
327
|
...panels?.activePanels && { activePanels: panels.activePanels }
|
|
312
|
-
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function sendInit() {
|
|
331
|
+
if (!transport.ready) {
|
|
332
|
+
if (initQueueIndex === null) initQueueIndex = pendingMessages.push(INIT_PLACEHOLDER) - 1;
|
|
333
|
+
else if (pendingMessages[initQueueIndex] !== INIT_PLACEHOLDER) pendingMessages[initQueueIndex] = buildInitMessage();
|
|
334
|
+
} else transport.send(buildInitMessage());
|
|
313
335
|
initSent = true;
|
|
314
336
|
}
|
|
315
337
|
function handleActor(actorRef, rootActorId, details) {
|
|
@@ -433,6 +455,7 @@ function createInspector(options = {}) {
|
|
|
433
455
|
}
|
|
434
456
|
function handleInspectionEvent(inspectionEvent) {
|
|
435
457
|
if (destroyed) return;
|
|
458
|
+
materializePendingInit();
|
|
436
459
|
const event = inspectionEvent;
|
|
437
460
|
const rootActorId = rootSessionIdOf(event.rootId, event.actorRef);
|
|
438
461
|
const isNewRoot = !observedRootIds.has(rootActorId);
|
|
@@ -484,6 +507,7 @@ function createInspector(options = {}) {
|
|
|
484
507
|
const rootActorId = sessionIdOf(root);
|
|
485
508
|
const existing = inspectedRoots.get(rootActorId);
|
|
486
509
|
if (existing) return existing.subscription;
|
|
510
|
+
materializePendingInit();
|
|
487
511
|
resolveActorTreeSessionIds(root);
|
|
488
512
|
observedRootIds.add(rootActorId);
|
|
489
513
|
const subscription = root.system.inspect(handleInspectionEvent);
|
|
@@ -521,7 +545,7 @@ function createInspector(options = {}) {
|
|
|
521
545
|
machineConfig: opts?.machine ?? null
|
|
522
546
|
};
|
|
523
547
|
actors.set(sessionId, entry);
|
|
524
|
-
if (!initSent) sendInit();
|
|
548
|
+
if (!initSent || !transport.ready) sendInit();
|
|
525
549
|
else send({
|
|
526
550
|
type: "@statelyai.system.actorRegistered",
|
|
527
551
|
sessionId,
|
|
@@ -535,6 +559,7 @@ function createInspector(options = {}) {
|
|
|
535
559
|
function manualSnapshot(actorId, snapshot, event) {
|
|
536
560
|
const sessionId = getManualSessionId(actorId);
|
|
537
561
|
if (!actors.has(sessionId)) manualRegister(actorId);
|
|
562
|
+
materializePendingInit();
|
|
538
563
|
const entry = actors.get(sessionId);
|
|
539
564
|
const previousSnapshot = entry.snapshot;
|
|
540
565
|
const inspectedSnapshot = {
|
|
@@ -566,12 +591,14 @@ function createInspector(options = {}) {
|
|
|
566
591
|
const eventObj = typeof event === "string" ? { type: event } : { ...event };
|
|
567
592
|
const sessionId = getManualSessionId(actorId);
|
|
568
593
|
if (!actors.has(sessionId)) manualRegister(actorId);
|
|
594
|
+
materializePendingInit();
|
|
569
595
|
handleEvent(sessionId, eventObj, eventOpts?.source ? getManualSessionId(eventOpts.source) : null);
|
|
570
596
|
}
|
|
571
597
|
function manualStop(actorId) {
|
|
572
598
|
const sessionId = getManualSessionId(actorId);
|
|
573
599
|
const entry = actors.get(sessionId);
|
|
574
600
|
if (!entry || entry.stopped) return;
|
|
601
|
+
materializePendingInit();
|
|
575
602
|
entry.stopped = true;
|
|
576
603
|
if (initSent) send({
|
|
577
604
|
type: "@statelyai.system.actorStopped",
|
|
@@ -634,6 +661,7 @@ function createInspector(options = {}) {
|
|
|
634
661
|
observedRootIds.clear();
|
|
635
662
|
pendingTransitions.clear();
|
|
636
663
|
pendingMessages.length = 0;
|
|
664
|
+
initQueueIndex = null;
|
|
637
665
|
for (const set of Object.values(localListeners)) set?.clear();
|
|
638
666
|
}
|
|
639
667
|
};
|
package/dist/inspect.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./version-
|
|
2
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
1
|
+
import "./version-u0s4xat2.mjs";
|
|
2
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-DNM-Qs93.mjs";
|
|
3
3
|
|
|
4
4
|
export { createInspector, createStatelyInspector };
|
package/dist/patchTypes.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as GraphPatch, g as EditorStateType, h as CanvasColor, m as ActionLocation, v as ImplementationSourceType } from "./index-
|
|
1
|
+
import { _ as GraphPatch, g as EditorStateType, h as CanvasColor, m as ActionLocation, v as ImplementationSourceType } from "./index-DKRB-u93.mjs";
|
|
2
2
|
export { type ActionLocation, type CanvasColor, type EditorStateType, type GraphPatch, type ImplementationSourceType };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as ProfileManifest } from "./index-
|
|
2
|
-
import { i as StatelyGraph } from "./graph-
|
|
1
|
+
import { i as ProfileManifest } from "./index-DKRB-u93.mjs";
|
|
2
|
+
import { i as StatelyGraph } from "./graph-DoUReqxz.mjs";
|
|
3
3
|
import { c as EditorSyncSourceLocation, f as MachineSourceLocations$1, l as EditorSyncSourceRange, t as EditorCapabilities$1, u as EditorSyncStateSourceLocation } from "./editor-sync-types-C-zWaaVk.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/protocol.d.ts
|
|
@@ -37,6 +37,9 @@ interface ProjectEmbedMachine {
|
|
|
37
37
|
name?: string;
|
|
38
38
|
/** Optional host project scope for machine-to-machine references. */
|
|
39
39
|
projectId?: string;
|
|
40
|
+
createdAt?: number;
|
|
41
|
+
updatedAt?: number;
|
|
42
|
+
origin?: ProjectWorkspaceMachineOrigin;
|
|
40
43
|
machine: unknown;
|
|
41
44
|
}
|
|
42
45
|
type ProjectWorkspaceActionIcon = 'arrow-left' | 'copy' | 'fork' | 'history';
|
|
@@ -46,9 +49,33 @@ interface ProjectWorkspaceAction {
|
|
|
46
49
|
icon?: ProjectWorkspaceActionIcon;
|
|
47
50
|
disabled?: boolean;
|
|
48
51
|
}
|
|
52
|
+
interface ProjectWorkspaceMachineOrigin {
|
|
53
|
+
parentMachineId: string;
|
|
54
|
+
type: 'version' | 'fork';
|
|
55
|
+
createdBy?: {
|
|
56
|
+
type: string;
|
|
57
|
+
id?: string;
|
|
58
|
+
name?: string;
|
|
59
|
+
};
|
|
60
|
+
captureType?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Opt-in host-facing automatic version capture policy. */
|
|
63
|
+
interface MachineVersionAutoSaveOptions {
|
|
64
|
+
/** Minimum time between automatic versions, in milliseconds. */
|
|
65
|
+
intervalMs: number;
|
|
66
|
+
createdBy?: {
|
|
67
|
+
type: string;
|
|
68
|
+
id?: string;
|
|
69
|
+
name?: string;
|
|
70
|
+
};
|
|
71
|
+
captureType?: string;
|
|
72
|
+
}
|
|
49
73
|
interface ProjectWorkspaceMachine {
|
|
50
74
|
id: string;
|
|
51
75
|
name?: string;
|
|
76
|
+
createdAt?: number;
|
|
77
|
+
updatedAt?: number;
|
|
78
|
+
origin?: ProjectWorkspaceMachineOrigin;
|
|
52
79
|
}
|
|
53
80
|
interface ProjectWorkspaceProject {
|
|
54
81
|
id: string;
|
|
@@ -60,6 +87,8 @@ interface ProjectWorkspaceProject {
|
|
|
60
87
|
interface ProjectWorkspaceCapabilities {
|
|
61
88
|
renameProject?: ProjectWorkspaceAction;
|
|
62
89
|
createMachine?: ProjectWorkspaceAction;
|
|
90
|
+
createMachineVersion?: ProjectWorkspaceAction;
|
|
91
|
+
restoreMachineVersion?: ProjectWorkspaceAction;
|
|
63
92
|
renameMachine?: ProjectWorkspaceAction;
|
|
64
93
|
copyMachine?: ProjectWorkspaceAction;
|
|
65
94
|
deleteMachine?: ProjectWorkspaceAction;
|
|
@@ -81,7 +110,7 @@ interface ProjectWorkspaceConfigBase {
|
|
|
81
110
|
}
|
|
82
111
|
/** Serializable workspace tree rendered by project-mode embeds. */
|
|
83
112
|
type ProjectWorkspaceConfig = (ProjectWorkspaceConfigBase & {
|
|
84
|
-
/** Single-project mode: hides project CRUD
|
|
113
|
+
/** Single-project mode: hides project CRUD for this project. */project: ProjectWorkspaceProject;
|
|
85
114
|
projects?: never;
|
|
86
115
|
}) | (ProjectWorkspaceConfigBase & {
|
|
87
116
|
/** Multi-project mode: renders a collapsible project tree. */projects: ProjectWorkspaceProject[];
|
|
@@ -209,6 +238,15 @@ interface EmbedEventMap {
|
|
|
209
238
|
validations?: ValidationIssue[];
|
|
210
239
|
sourceLocations?: MachineSourceLocations;
|
|
211
240
|
};
|
|
241
|
+
versionSaveRequested: {
|
|
242
|
+
graph: StatelyGraph;
|
|
243
|
+
machineConfig: unknown;
|
|
244
|
+
machineId?: string;
|
|
245
|
+
patches?: unknown[];
|
|
246
|
+
createdBy: NonNullable<MachineVersionAutoSaveOptions['createdBy']>;
|
|
247
|
+
captureType: string;
|
|
248
|
+
sourceLocations?: MachineSourceLocations;
|
|
249
|
+
};
|
|
212
250
|
error: {
|
|
213
251
|
code: string;
|
|
214
252
|
message: string;
|
|
@@ -291,6 +329,8 @@ interface MachineInitOptions {
|
|
|
291
329
|
enabled?: boolean;
|
|
292
330
|
mode?: 'structural' | 'all';
|
|
293
331
|
};
|
|
332
|
+
/** Omit to disable automatic version requests. */
|
|
333
|
+
versionAutoSave?: MachineVersionAutoSaveOptions;
|
|
294
334
|
}
|
|
295
335
|
interface ProjectInitOptions {
|
|
296
336
|
machines: ProjectEmbedMachine[];
|
|
@@ -315,6 +355,8 @@ interface ProjectInitOptions {
|
|
|
315
355
|
enabled?: boolean;
|
|
316
356
|
mode?: 'structural' | 'all';
|
|
317
357
|
};
|
|
358
|
+
/** Omit to disable automatic version requests. */
|
|
359
|
+
versionAutoSave?: MachineVersionAutoSaveOptions;
|
|
318
360
|
}
|
|
319
361
|
type InitOptions = MachineInitOptions | ProjectInitOptions;
|
|
320
362
|
interface InitMessage {
|
|
@@ -340,6 +382,7 @@ interface InitMessage {
|
|
|
340
382
|
enabled?: boolean;
|
|
341
383
|
mode?: 'structural' | 'all';
|
|
342
384
|
};
|
|
385
|
+
versionAutoSave?: MachineVersionAutoSaveOptions;
|
|
343
386
|
}
|
|
344
387
|
interface SetApiKeyMessage {
|
|
345
388
|
type: '@statelyai.setApiKey';
|
|
@@ -389,6 +432,7 @@ interface ProjectInitMessage {
|
|
|
389
432
|
enabled?: boolean;
|
|
390
433
|
mode?: 'structural' | 'all';
|
|
391
434
|
};
|
|
435
|
+
versionAutoSave?: MachineVersionAutoSaveOptions;
|
|
392
436
|
sessionId?: string;
|
|
393
437
|
}
|
|
394
438
|
interface ProjectUpdateMessage {
|
|
@@ -575,6 +619,16 @@ interface SaveMessage {
|
|
|
575
619
|
validations?: ValidationIssue[];
|
|
576
620
|
sourceLocations?: MachineSourceLocations;
|
|
577
621
|
}
|
|
622
|
+
interface VersionSaveRequestedMessage {
|
|
623
|
+
type: '@statelyai.versionSaveRequested';
|
|
624
|
+
graph: StatelyGraph;
|
|
625
|
+
machineConfig: unknown;
|
|
626
|
+
machineId?: string;
|
|
627
|
+
patches?: unknown[];
|
|
628
|
+
createdBy: NonNullable<MachineVersionAutoSaveOptions['createdBy']>;
|
|
629
|
+
captureType: string;
|
|
630
|
+
sourceLocations?: MachineSourceLocations;
|
|
631
|
+
}
|
|
578
632
|
interface ProjectMachineSelectedMessage {
|
|
579
633
|
type: '@statelyai.project.machineSelected';
|
|
580
634
|
machineId: string;
|
|
@@ -665,7 +719,7 @@ interface ExtensionResultMessage {
|
|
|
665
719
|
/** All messages a client (embed/inspector) can send to the viz. */
|
|
666
720
|
type ClientMessage = InitMessage | SetApiKeyMessage | EditorHandshakeMessage | SavedMessage | ClipboardReadResponseMessage | ClipboardWriteResponseMessage | ProjectInitMessage | ProjectUpdateMessage | ProjectSelectMachineMessage | ProjectSetWorkspaceOpenMessage | UpdateMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | InspectSnapshotMessage | SystemInitMessage | SystemSelectActorMessage | SystemActorRegisteredMessage | SystemActorEventMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ExtensionResultMessage | ErrorMessage;
|
|
667
721
|
/** All messages the viz can send back to a client. */
|
|
668
|
-
type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | ProjectMachineSelectedMessage | ProjectWorkspaceActionMessage | ProjectWorkspaceOpenChangedMessage | ViewModeChangedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | ClipboardReadMessage | ClipboardWriteMessage | UploadRequestMessage | ExtensionCallMessage;
|
|
722
|
+
type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | VersionSaveRequestedMessage | ProjectMachineSelectedMessage | ProjectWorkspaceActionMessage | ProjectWorkspaceOpenChangedMessage | ViewModeChangedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | ClipboardReadMessage | ClipboardWriteMessage | UploadRequestMessage | ExtensionCallMessage;
|
|
669
723
|
interface InspectionClientMetadata {
|
|
670
724
|
name?: string;
|
|
671
725
|
machineId?: string;
|
|
@@ -694,4 +748,4 @@ declare const PREFIX = "@statelyai.";
|
|
|
694
748
|
/** Current WebSocket inspection protocol version. */
|
|
695
749
|
declare const INSPECTION_PROTOCOL_VERSION = 2;
|
|
696
750
|
//#endregion
|
|
697
|
-
export { ActorSystemEntry, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, ClipboardReadMessage, ClipboardReadResponseMessage, ClipboardWriteMessage, ClipboardWriteResponseMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EditorHandshakeMessage, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExtensionsManifest, EmbedFormatManifest, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, ExtensionCallMessage, ExtensionResultMessage, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, LoadedMessage, MachineInitOptions, MachineSourceLocations, PREFIX, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectSetWorkspaceOpenMessage, ProjectUpdateMessage, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceActionMessage, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceOpenChangedMessage, ProjectWorkspaceProject, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SavedMessage, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, ViewModeChangedMessage, VizMessage, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
|
751
|
+
export { ActorSystemEntry, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, ClipboardReadMessage, ClipboardReadResponseMessage, ClipboardWriteMessage, ClipboardWriteResponseMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EditorHandshakeMessage, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExtensionsManifest, EmbedFormatManifest, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, ExtensionCallMessage, ExtensionResultMessage, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, LoadedMessage, MachineInitOptions, MachineSourceLocations, MachineVersionAutoSaveOptions, PREFIX, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectSetWorkspaceOpenMessage, ProjectUpdateMessage, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceActionMessage, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceOpenChangedMessage, ProjectWorkspaceProject, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SavedMessage, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VersionSaveRequestedMessage, ViewModeChangedMessage, VizMessage, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as output, C as ZodNumber, D as ZodString, E as ZodRecord, O as ZodUnion, S as ZodNullable, T as ZodOptional, b as ZodEnum, j as $strip, k as ZodUnknown, w as ZodObject, x as ZodLiteral, y as ZodArray } from "./index-
|
|
1
|
+
import { A as output, C as ZodNumber, D as ZodString, E as ZodRecord, O as ZodUnion, S as ZodNullable, T as ZodOptional, b as ZodEnum, j as $strip, k as ZodUnknown, w as ZodObject, x as ZodLiteral, y as ZodArray } from "./index-DKRB-u93.mjs";
|
|
2
2
|
import { n as StatelyCredential, t as StatelyAuthMode } from "./auth-B0ZTKri2.mjs";
|
|
3
3
|
|
|
4
4
|
//#region ../api-contract/dist/errors.d.mts
|
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-
|
|
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-B6P177N3.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/sync.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as DigraphConfig, i as StatelyGraph } from "./graph-
|
|
2
|
-
import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-
|
|
1
|
+
import { b as DigraphConfig, i as StatelyGraph } from "./graph-DoUReqxz.mjs";
|
|
2
|
+
import { C as StudioMachineRecord, L as XStateVersion, g as ProjectData, o as CreateProjectInput, x as StudioClient } from "./studio-B6P177N3.mjs";
|
|
3
3
|
import { GraphDiff } from "@statelyai/graph";
|
|
4
4
|
|
|
5
5
|
//#region src/sync.d.ts
|
|
@@ -130,7 +130,8 @@ function toInitMessage(options) {
|
|
|
130
130
|
projectWorkspace: options.projectWorkspace,
|
|
131
131
|
projectWorkspaceOpen: options.projectWorkspaceOpen,
|
|
132
132
|
settings: options.settings,
|
|
133
|
-
unsavedIndicator: options.unsavedIndicator
|
|
133
|
+
unsavedIndicator: options.unsavedIndicator,
|
|
134
|
+
versionAutoSave: options.versionAutoSave
|
|
134
135
|
};
|
|
135
136
|
return {
|
|
136
137
|
type: "@statelyai.init",
|
|
@@ -150,7 +151,8 @@ function toInitMessage(options) {
|
|
|
150
151
|
comments: options.comments,
|
|
151
152
|
sourceLocations: options.sourceLocations,
|
|
152
153
|
settings: options.settings,
|
|
153
|
-
unsavedIndicator: options.unsavedIndicator
|
|
154
|
+
unsavedIndicator: options.unsavedIndicator,
|
|
155
|
+
versionAutoSave: options.versionAutoSave
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
158
|
|
|
@@ -333,7 +335,7 @@ function createWebSocketTransport(options) {
|
|
|
333
335
|
|
|
334
336
|
//#endregion
|
|
335
337
|
//#region src/version.ts
|
|
336
|
-
const SDK_VERSION = "0.
|
|
338
|
+
const SDK_VERSION = "0.26.0";
|
|
337
339
|
function inspectionRuntime() {
|
|
338
340
|
if (typeof window !== "undefined") return "browser";
|
|
339
341
|
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.
|
|
3
|
+
"version": "0.26.0",
|
|
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.3.
|
|
97
|
-
"@statelyai/graph-tools": "0.
|
|
96
|
+
"@statelyai/api-contract": "0.3.11",
|
|
97
|
+
"@statelyai/graph-tools": "0.4.0"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=22.4"
|