@statelyai/sdk 0.26.1 → 0.26.3
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 +3 -0
- package/dist/{editorHostSession-BwS-EiBJ.mjs → editorHostSession-CwGeXJ6g.mjs} +47 -15
- package/dist/{editorHostSession-DTXKcLhR.d.mts → editorHostSession-DFjM-RoT.d.mts} +16 -1
- package/dist/editorHostSession.d.mts +2 -2
- package/dist/editorHostSession.mjs +1 -1
- package/dist/embed.mjs +2 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +4 -4
- package/dist/{inspect-nZNCuv4E.mjs → inspect-CiPPDR7Q.mjs} +1 -1
- package/dist/inspect.mjs +2 -2
- package/dist/protocol.d.mts +3 -0
- package/dist/{statelyPragma-CWxhEIcZ.mjs → statelyPragma-B-axv279.mjs} +1 -0
- package/dist/sync.mjs +1 -1
- package/dist/{version-BDSD4qfI.mjs → version-At1lONTa.mjs} +16 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -113,6 +113,9 @@ Sync HTTP contract.
|
|
|
113
113
|
Remote authentication failures are surfaced as `EditorSyncError` with HTTP
|
|
114
114
|
status and protocol error code metadata so hosts can refresh credentials and
|
|
115
115
|
retry once without depending on response-message text.
|
|
116
|
+
Source write and refresh failures include an `EditorHostDiagnostic` with a
|
|
117
|
+
unique diagnostic ID, phase, and structured details so host logs can be shared
|
|
118
|
+
without exposing source text by default.
|
|
116
119
|
Hosts keep ownership of files, credentials, UI, and transport adapters.
|
|
117
120
|
|
|
118
121
|
<!-- supported editor export formats from packages/editor/src/formatConfig.ts -->
|
|
@@ -106,6 +106,16 @@ const editorSyncAccessResponseSchema = object({ access: editorSyncAccessSchema }
|
|
|
106
106
|
|
|
107
107
|
//#endregion
|
|
108
108
|
//#region src/editorHostSession.ts
|
|
109
|
+
let diagnosticSequence = 0;
|
|
110
|
+
function createDiagnostic(code, phase, details) {
|
|
111
|
+
return {
|
|
112
|
+
id: `stately-${Date.now().toString(36)}-${(++diagnosticSequence).toString(36)}`,
|
|
113
|
+
code,
|
|
114
|
+
phase,
|
|
115
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
116
|
+
...details ? { details } : {}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
109
119
|
var EditorSyncError = class extends Error {
|
|
110
120
|
status;
|
|
111
121
|
code;
|
|
@@ -255,14 +265,12 @@ var EditorHostSession = class {
|
|
|
255
265
|
await this.save(message);
|
|
256
266
|
} catch (error) {
|
|
257
267
|
const text = formatError(error, "Failed to apply Viz changes.");
|
|
258
|
-
this.
|
|
259
|
-
type: "@statelyai.toast",
|
|
260
|
-
message: text,
|
|
261
|
-
toastType: "error"
|
|
262
|
-
});
|
|
263
|
-
this.options.showError?.(text);
|
|
268
|
+
this.reportSourceSyncError(text, "save", { errorName: error instanceof Error ? error.name : void 0 }, message.requestId);
|
|
264
269
|
}
|
|
265
270
|
break;
|
|
271
|
+
case "@statelyai.refresh":
|
|
272
|
+
await this.handleSavedDocument(this.options.source.rootUri);
|
|
273
|
+
break;
|
|
266
274
|
case "@statelyai.retrieved":
|
|
267
275
|
this.resolveRetrieved(message.requestId, message.data);
|
|
268
276
|
break;
|
|
@@ -275,7 +283,7 @@ var EditorHostSession = class {
|
|
|
275
283
|
break;
|
|
276
284
|
}
|
|
277
285
|
}
|
|
278
|
-
this.options.showError?.(message.message);
|
|
286
|
+
this.options.showError?.(message.diagnostic ? `${message.message} (diagnostic ${message.diagnostic.id})` : message.message);
|
|
279
287
|
break;
|
|
280
288
|
case "@statelyai.clipboardRead": {
|
|
281
289
|
let text = "";
|
|
@@ -367,6 +375,7 @@ var EditorHostSession = class {
|
|
|
367
375
|
this.lastPersistedGraph = message.graph;
|
|
368
376
|
this.options.send({
|
|
369
377
|
type: "@statelyai.saved",
|
|
378
|
+
...message.requestId ? { requestId: message.requestId } : {},
|
|
370
379
|
graph: message.graph
|
|
371
380
|
});
|
|
372
381
|
return;
|
|
@@ -387,13 +396,12 @@ var EditorHostSession = class {
|
|
|
387
396
|
preserveStatelyMetadata: this.options.source.getPreserveStatelyMetadata?.(this.options.source.rootUri) ?? true
|
|
388
397
|
});
|
|
389
398
|
if (response.replacements.length === 0) {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
});
|
|
396
|
-
this.options.showError?.(text);
|
|
399
|
+
this.reportSourceSyncError("Could not write visual changes to the source file. Your visual edits are still unsaved.", "save", {
|
|
400
|
+
reason: "no_replacements",
|
|
401
|
+
patchCount: message.patches?.length ?? 0,
|
|
402
|
+
profile: this.currentSourceLocations?.profileRef ?? this.currentSourceLocations?.profile,
|
|
403
|
+
sourceFile: this.options.source.rootFileName.split(/[\\/]/).pop()
|
|
404
|
+
}, message.requestId);
|
|
397
405
|
return;
|
|
398
406
|
}
|
|
399
407
|
this.selfEditCount++;
|
|
@@ -407,6 +415,7 @@ var EditorHostSession = class {
|
|
|
407
415
|
this.lastPersistedGraph = message.graph;
|
|
408
416
|
this.options.send({
|
|
409
417
|
type: "@statelyai.saved",
|
|
418
|
+
...message.requestId ? { requestId: message.requestId } : {},
|
|
410
419
|
graph: message.graph
|
|
411
420
|
});
|
|
412
421
|
}
|
|
@@ -432,9 +441,32 @@ var EditorHostSession = class {
|
|
|
432
441
|
sourceLocations: update.sourceLocations
|
|
433
442
|
});
|
|
434
443
|
} catch (error) {
|
|
435
|
-
this.
|
|
444
|
+
this.reportSourceSyncError(formatError(error, "Failed to read the saved document."), "update", {
|
|
445
|
+
errorName: error instanceof Error ? error.name : void 0,
|
|
446
|
+
sourceFile: this.options.source.rootFileName.split(/[\\/]/).pop()
|
|
447
|
+
});
|
|
436
448
|
}
|
|
437
449
|
}
|
|
450
|
+
reportSourceSyncError(message, phase, details, requestId) {
|
|
451
|
+
const diagnostic = createDiagnostic(phase === "save" ? "source_sync_failed" : "source_update_failed", phase, {
|
|
452
|
+
protocolVersion: EDITOR_PROTOCOL_VERSION,
|
|
453
|
+
client: this.options.client,
|
|
454
|
+
...details
|
|
455
|
+
});
|
|
456
|
+
this.options.send({
|
|
457
|
+
type: "@statelyai.error",
|
|
458
|
+
code: diagnostic.code,
|
|
459
|
+
message,
|
|
460
|
+
diagnostic,
|
|
461
|
+
...requestId ? { requestId } : {}
|
|
462
|
+
});
|
|
463
|
+
this.options.send({
|
|
464
|
+
type: "@statelyai.toast",
|
|
465
|
+
message: phase === "save" ? "Visual changes were not written to the source file." : "The source file could not be applied to the visual editor.",
|
|
466
|
+
toastType: "error"
|
|
467
|
+
});
|
|
468
|
+
this.options.showError?.(`${message} (diagnostic ${diagnostic.id})`);
|
|
469
|
+
}
|
|
438
470
|
updateWatchedSourceUris(sourceLocations) {
|
|
439
471
|
this.watchedSourceUris.clear();
|
|
440
472
|
for (const uri of stateSourceLocationUris(sourceLocations)) if (uri !== this.options.source.rootUri) this.watchedSourceUris.add(uri);
|
|
@@ -2,6 +2,13 @@ import { a as EditorSyncParseRequest, d as EditorSyncTextReplacement, f as Machi
|
|
|
2
2
|
|
|
3
3
|
//#region src/editorHostProtocol.d.ts
|
|
4
4
|
declare const EDITOR_PROTOCOL_VERSION = 1;
|
|
5
|
+
type EditorHostDiagnostic = {
|
|
6
|
+
id: string;
|
|
7
|
+
code: string;
|
|
8
|
+
phase: 'initialize' | 'save' | 'update' | 'export';
|
|
9
|
+
timestamp: string;
|
|
10
|
+
details?: Record<string, unknown>;
|
|
11
|
+
};
|
|
5
12
|
type EditorHostExportFormat = 'xstate-v6' | 'xstate' | 'async' | 'xstate-json' | 'xgraph' | 'digraph' | 'd2' | 'mermaid' | 'redux' | 'zustand' | 'asl-json' | 'asl-yaml' | 'scxml';
|
|
6
13
|
interface EditorHostValidationIssue {
|
|
7
14
|
nodeIds: string[];
|
|
@@ -25,11 +32,14 @@ type EditorHostInboundMessage = {
|
|
|
25
32
|
sourceLocations?: MachineSourceLocations;
|
|
26
33
|
} | {
|
|
27
34
|
type: '@statelyai.save';
|
|
35
|
+
requestId?: string;
|
|
28
36
|
graph: unknown;
|
|
29
37
|
machineConfig: unknown;
|
|
30
38
|
patches?: unknown[];
|
|
31
39
|
validations?: EditorHostValidationIssue[];
|
|
32
40
|
sourceLocations?: MachineSourceLocations;
|
|
41
|
+
} | {
|
|
42
|
+
type: '@statelyai.refresh';
|
|
33
43
|
} | {
|
|
34
44
|
type: '@statelyai.retrieved';
|
|
35
45
|
requestId: string;
|
|
@@ -39,6 +49,7 @@ type EditorHostInboundMessage = {
|
|
|
39
49
|
code: string;
|
|
40
50
|
message: string;
|
|
41
51
|
requestId?: string;
|
|
52
|
+
diagnostic?: EditorHostDiagnostic;
|
|
42
53
|
} | {
|
|
43
54
|
type: '@statelyai.clipboardRead';
|
|
44
55
|
requestId: string;
|
|
@@ -92,6 +103,7 @@ type EditorHostOutboundMessage = {
|
|
|
92
103
|
sourceLocations?: MachineSourceLocations;
|
|
93
104
|
} | {
|
|
94
105
|
type: '@statelyai.saved';
|
|
106
|
+
requestId?: string;
|
|
95
107
|
graph: unknown;
|
|
96
108
|
} | {
|
|
97
109
|
type: '@statelyai.retrieve';
|
|
@@ -105,6 +117,8 @@ type EditorHostOutboundMessage = {
|
|
|
105
117
|
type: '@statelyai.error';
|
|
106
118
|
code: string;
|
|
107
119
|
message: string;
|
|
120
|
+
requestId?: string;
|
|
121
|
+
diagnostic?: EditorHostDiagnostic;
|
|
108
122
|
} | {
|
|
109
123
|
type: '@statelyai.clipboardReadResponse';
|
|
110
124
|
requestId: string;
|
|
@@ -185,10 +199,11 @@ declare class EditorHostSession {
|
|
|
185
199
|
private initialize;
|
|
186
200
|
private save;
|
|
187
201
|
private handleSavedDocument;
|
|
202
|
+
private reportSourceSyncError;
|
|
188
203
|
private updateWatchedSourceUris;
|
|
189
204
|
private getSerializedPayload;
|
|
190
205
|
private requestSerialized;
|
|
191
206
|
private resolveRetrieved;
|
|
192
207
|
}
|
|
193
208
|
//#endregion
|
|
194
|
-
export { EditorSyncError as a, fetchEditorSyncAccess as c,
|
|
209
|
+
export { EditorSyncError as a, fetchEditorSyncAccess as c, EditorHostExportFormat as d, EditorHostInboundMessage as f, EditorHostValidationIssue as h, EditorSyncBackend as i, EDITOR_PROTOCOL_VERSION as l, EditorHostOutboundMessage as m, EditorHostSessionOptions as n, RemoteEditorSyncBackendOptions as o, EditorHostInitOptions as p, EditorSourceHost as r, createRemoteEditorSyncBackend as s, EditorHostSession as t, EditorHostDiagnostic as u };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as EditorSyncError, c as fetchEditorSyncAccess, d as
|
|
2
|
-
export { EDITOR_PROTOCOL_VERSION, EditorHostExportFormat, EditorHostInboundMessage, EditorHostInitOptions, EditorHostOutboundMessage, EditorHostSession, EditorHostSessionOptions, EditorHostValidationIssue, EditorSourceHost, EditorSyncBackend, EditorSyncError, RemoteEditorSyncBackendOptions, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
|
1
|
+
import { a as EditorSyncError, c as fetchEditorSyncAccess, d as EditorHostExportFormat, f as EditorHostInboundMessage, h as EditorHostValidationIssue, i as EditorSyncBackend, l as EDITOR_PROTOCOL_VERSION, m as EditorHostOutboundMessage, n as EditorHostSessionOptions, o as RemoteEditorSyncBackendOptions, p as EditorHostInitOptions, r as EditorSourceHost, s as createRemoteEditorSyncBackend, t as EditorHostSession, u as EditorHostDiagnostic } from "./editorHostSession-DFjM-RoT.mjs";
|
|
2
|
+
export { EDITOR_PROTOCOL_VERSION, EditorHostDiagnostic, EditorHostExportFormat, EditorHostInboundMessage, EditorHostInitOptions, EditorHostOutboundMessage, EditorHostSession, EditorHostSessionOptions, EditorHostValidationIssue, EditorSourceHost, EditorSyncBackend, EditorSyncError, RemoteEditorSyncBackendOptions, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
|
-
import { i as fetchEditorSyncAccess, n as EditorSyncError, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-
|
|
3
|
+
import { i as fetchEditorSyncAccess, n as EditorSyncError, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-CwGeXJ6g.mjs";
|
|
4
4
|
|
|
5
5
|
export { EDITOR_PROTOCOL_VERSION, EditorHostSession, EditorSyncError, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
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-At1lONTa.mjs";
|
|
2
2
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/embed.ts
|
|
@@ -283,6 +283,7 @@ function createStatelyEmbed(options) {
|
|
|
283
283
|
const save = data;
|
|
284
284
|
options.onSave?.(save.graph, save.machineConfig);
|
|
285
285
|
events.emit("save", {
|
|
286
|
+
requestId: save.requestId,
|
|
286
287
|
graph: save.graph,
|
|
287
288
|
machineConfig: save.machineConfig,
|
|
288
289
|
machineId: save.machineId,
|
package/dist/index.d.mts
CHANGED
|
@@ -4,7 +4,7 @@ import { C as EventTypeData, S as DigraphNodeConfig, _ as studioMachineConverter
|
|
|
4
4
|
import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExample, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitOptions, InspectionAction, InspectionSentEvent, InspectionTakenTransition, MachineVersionAutoSaveOptions, ProjectEmbedMachine, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceProject, UploadResult, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine } from "./protocol.mjs";
|
|
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
|
-
import { c as fetchEditorSyncAccess, d as
|
|
7
|
+
import { c as fetchEditorSyncAccess, d as EditorHostExportFormat, f as EditorHostInboundMessage, h as EditorHostValidationIssue, i as EditorSyncBackend, l as EDITOR_PROTOCOL_VERSION, m as EditorHostOutboundMessage, n as EditorHostSessionOptions, o as RemoteEditorSyncBackendOptions, p as EditorHostInitOptions, r as EditorSourceHost, s as createRemoteEditorSyncBackend, t as EditorHostSession, u as EditorHostDiagnostic } from "./editorHostSession-DFjM-RoT.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
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";
|
|
@@ -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 EmbedExample, 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, 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, graphToMachineConfig, graphToXStateTS, 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 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 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, 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, graphToMachineConfig, graphToXStateTS, isEmbedExample, isEmbedExampleMachine, 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, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine } from "./protocol.mjs";
|
|
3
|
-
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-
|
|
3
|
+
import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-At1lONTa.mjs";
|
|
4
4
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
5
5
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
6
|
-
import { i as fetchEditorSyncAccess, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-
|
|
6
|
+
import { i as fetchEditorSyncAccess, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-CwGeXJ6g.mjs";
|
|
7
7
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-iNSHtNmP.mjs";
|
|
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-
|
|
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-CiPPDR7Q.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-At1lONTa.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openBrowser.ts
|
|
5
5
|
async function openBrowser(url) {
|
package/dist/inspect.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./version-
|
|
2
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
1
|
+
import "./version-At1lONTa.mjs";
|
|
2
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-CiPPDR7Q.mjs";
|
|
3
3
|
|
|
4
4
|
export { createInspector, createStatelyInspector };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -231,6 +231,7 @@ interface EmbedEventMap {
|
|
|
231
231
|
sourceLocations?: MachineSourceLocations;
|
|
232
232
|
};
|
|
233
233
|
save: {
|
|
234
|
+
requestId?: string;
|
|
234
235
|
graph: StatelyGraph;
|
|
235
236
|
machineConfig: unknown;
|
|
236
237
|
machineId?: string;
|
|
@@ -407,6 +408,7 @@ interface SetApiKeyMessage {
|
|
|
407
408
|
}
|
|
408
409
|
interface SavedMessage {
|
|
409
410
|
type: '@statelyai.saved';
|
|
411
|
+
requestId?: string;
|
|
410
412
|
graph: unknown;
|
|
411
413
|
}
|
|
412
414
|
interface ClipboardReadResponseMessage {
|
|
@@ -630,6 +632,7 @@ interface ChangeMessage {
|
|
|
630
632
|
}
|
|
631
633
|
interface SaveMessage {
|
|
632
634
|
type: '@statelyai.save';
|
|
635
|
+
requestId?: string;
|
|
633
636
|
graph: StatelyGraph;
|
|
634
637
|
machineConfig: unknown;
|
|
635
638
|
machineId?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a as discriminatedUnion, c as object, d as union, f as unknown, i as custom, l as record, n as array, o as literal, r as boolean, s as number, t as _enum, u as string } from "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import ts from "typescript";
|
|
3
|
+
import "xstate";
|
|
3
4
|
import "xstate/graph";
|
|
4
5
|
|
|
5
6
|
//#region ../../node_modules/.pnpm/js-yaml@4.2.0/node_modules/js-yaml/dist/js-yaml.mjs
|
package/dist/sync.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./openapi-BTDjYWXd.mjs";
|
|
2
2
|
import { r as createStatelyClient } from "./studio-iNSHtNmP.mjs";
|
|
3
|
-
import { f as normalizeMachineProfile, h as xstateSourceToConfig, i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, m as serializeJS, n as getStatelyPragma, r as upsertStatelyPragma, s as detectXStateSourceProfile, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-
|
|
3
|
+
import { f as normalizeMachineProfile, h as xstateSourceToConfig, i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, m as serializeJS, n as getStatelyPragma, r as upsertStatelyPragma, s as detectXStateSourceProfile, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-B-axv279.mjs";
|
|
4
4
|
import { fromStudioMachine, toStudioMachine } from "./graph.mjs";
|
|
5
5
|
import * as ts$1 from "typescript";
|
|
6
6
|
import ts from "typescript";
|
|
@@ -242,8 +242,22 @@ function createWebSocketTransport(options) {
|
|
|
242
242
|
reconnectAttempts++;
|
|
243
243
|
reconnectTimer = setTimeout(connect, delay);
|
|
244
244
|
}
|
|
245
|
+
function disposeSocket(socket) {
|
|
246
|
+
socket.onmessage = null;
|
|
247
|
+
socket.onclose = null;
|
|
248
|
+
socket.onerror = null;
|
|
249
|
+
if (socket.readyState === WebSocket.CONNECTING) socket.onopen = () => socket.close();
|
|
250
|
+
else {
|
|
251
|
+
socket.onopen = null;
|
|
252
|
+
socket.close();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
245
255
|
function connect() {
|
|
246
256
|
if (destroyed || terminalFailure) return;
|
|
257
|
+
if (ws) {
|
|
258
|
+
disposeSocket(ws);
|
|
259
|
+
ws = null;
|
|
260
|
+
}
|
|
247
261
|
try {
|
|
248
262
|
ws = new WebSocket(url);
|
|
249
263
|
} catch {
|
|
@@ -315,7 +329,7 @@ function createWebSocketTransport(options) {
|
|
|
315
329
|
if (destroyed) return;
|
|
316
330
|
destroyed = true;
|
|
317
331
|
if (reconnectTimer) clearTimeout(reconnectTimer);
|
|
318
|
-
ws
|
|
332
|
+
if (ws) disposeSocket(ws);
|
|
319
333
|
ws = null;
|
|
320
334
|
messageHandlers.clear();
|
|
321
335
|
readyHandlers.clear();
|
|
@@ -338,7 +352,7 @@ function createWebSocketTransport(options) {
|
|
|
338
352
|
|
|
339
353
|
//#endregion
|
|
340
354
|
//#region src/version.ts
|
|
341
|
-
const SDK_VERSION = "0.26.
|
|
355
|
+
const SDK_VERSION = "0.26.3";
|
|
342
356
|
function inspectionRuntime() {
|
|
343
357
|
if (typeof window !== "undefined") return "browser";
|
|
344
358
|
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.26.
|
|
3
|
+
"version": "0.26.3",
|
|
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.4.
|
|
96
|
+
"@statelyai/api-contract": "0.3.12",
|
|
97
|
+
"@statelyai/graph-tools": "0.4.1"
|
|
98
98
|
},
|
|
99
99
|
"engines": {
|
|
100
100
|
"node": ">=22.4"
|