@statelyai/sdk 0.23.0 → 0.23.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -177,15 +177,32 @@ var EditorHostSession = class {
177
177
  access;
178
178
  watchedSourceUris = /* @__PURE__ */ new Set();
179
179
  selfEditCount = 0;
180
+ saveReminderShown = false;
180
181
  watcher;
182
+ changeWatcher;
181
183
  retrieveRequestCount = 0;
182
184
  pendingRetrievals = /* @__PURE__ */ new Map();
183
185
  constructor(options) {
184
186
  this.options = options;
185
- this.watcher = options.source.watchSavedDocuments?.((uri) => this.handleSavedDocument(uri));
187
+ this.watcher = options.source.watchSavedDocuments?.((uri) => {
188
+ this.saveReminderShown = false;
189
+ return this.handleSavedDocument(uri);
190
+ });
191
+ this.changeWatcher = options.source.watchChangedDocuments?.((uri) => {
192
+ if (uri !== this.options.source.rootUri && !this.watchedSourceUris.has(uri)) return;
193
+ if (this.selfEditCount > 0) return;
194
+ if (this.saveReminderShown) return;
195
+ this.saveReminderShown = true;
196
+ this.options.send({
197
+ type: "@statelyai.toast",
198
+ message: "Save code to see changes.",
199
+ toastType: "info"
200
+ });
201
+ });
186
202
  }
187
203
  dispose() {
188
204
  this.watcher?.dispose();
205
+ this.changeWatcher?.dispose();
189
206
  for (const pending of this.pendingRetrievals.values()) pending.reject(/* @__PURE__ */ new Error("Editor session disposed before export completed."));
190
207
  this.pendingRetrievals.clear();
191
208
  }
@@ -142,6 +142,9 @@ interface EditorSourceHost {
142
142
  watchSavedDocuments?(listener: (uri: string) => void | Promise<void>): {
143
143
  dispose(): void;
144
144
  };
145
+ watchChangedDocuments?(listener: (uri: string) => void): {
146
+ dispose(): void;
147
+ };
145
148
  getPreserveStatelyMetadata?(uri: string): boolean;
146
149
  }
147
150
  interface EditorHostSessionOptions {
@@ -170,7 +173,9 @@ declare class EditorHostSession {
170
173
  private access;
171
174
  private watchedSourceUris;
172
175
  private selfEditCount;
176
+ private saveReminderShown;
173
177
  private watcher;
178
+ private changeWatcher;
174
179
  private retrieveRequestCount;
175
180
  private pendingRetrievals;
176
181
  constructor(options: EditorHostSessionOptions);
@@ -1,2 +1,2 @@
1
- import { a as EditorSyncError, 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-CMwC9KKh.mjs";
1
+ import { a as EditorSyncError, 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";
2
2
  export { EDITOR_PROTOCOL_VERSION, 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-BZE_Wm0m.mjs";
3
+ import { i as fetchEditorSyncAccess, n as EditorSyncError, r as createRemoteEditorSyncBackend, t as EditorHostSession } from "./editorHostSession-BwS-EiBJ.mjs";
4
4
 
5
5
  export { EDITOR_PROTOCOL_VERSION, EditorHostSession, EditorSyncError, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
package/dist/embed.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { i as ProfileManifest } from "./index-D_pO_Pr8.mjs";
2
2
  import { i as StatelyGraph } from "./graph-1fwR0Ynl.mjs";
3
- import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedExtensionsManifest, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
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";
4
4
  import { AssetUploadAdapter } from "./assetStorage.mjs";
5
5
 
6
6
  //#region src/embed.d.ts
@@ -89,6 +89,10 @@ interface StatelyEmbedOptions extends Partial<MachineInitOptions> {
89
89
  currentMachineId?: string;
90
90
  /** Project mode only — initial comments keyed by machine id. */
91
91
  commentsByMachineId?: Record<string, CommentsConfig>;
92
+ /** Project mode only — optional host-provided sidebar content/actions. */
93
+ projectWorkspace?: ProjectWorkspaceConfig;
94
+ /** Project mode only — whether the project workspace starts open. */
95
+ projectWorkspaceOpen?: boolean;
92
96
  /** Asset upload configuration. If omitted, files are stored as base64 data URLs. */
93
97
  assets?: AssetConfig;
94
98
  profiles?: readonly EmbedProfileDefinition[];
@@ -116,9 +120,14 @@ interface StatelyEmbed {
116
120
  /** Update the machine (shorthand for update message). */
117
121
  updateMachine(machine: unknown, format?: string, sourceLocations?: MachineSourceLocations): void;
118
122
  /** Update the project machine list without re-creating the iframe. */
119
- updateProject(machines: ProjectEmbedMachine[], currentMachineId?: string, commentsByMachineId?: Record<string, CommentsConfig>): void;
123
+ updateProject(machines: ProjectEmbedMachine[], currentMachineId?: string, commentsByMachineId?: Record<string, CommentsConfig>, projectOptions?: {
124
+ projectWorkspace?: ProjectWorkspaceConfig;
125
+ projectWorkspaceOpen?: boolean;
126
+ }): void;
120
127
  /** Select the active machine in project mode. */
121
128
  selectMachine(machineId: string): void;
129
+ /** Open or close the project sidebar in project mode. */
130
+ setProjectWorkspaceOpen(open: boolean): void;
122
131
  /** Change the embed mode. */
123
132
  setMode(mode: EmbedMode): void;
124
133
  /** Change the embed theme. */
@@ -138,4 +147,4 @@ interface StatelyEmbed {
138
147
  }
139
148
  declare function createStatelyEmbed(options: StatelyEmbedOptions): StatelyEmbed;
140
149
  //#endregion
141
- 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, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
150
+ 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 };
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-D3ug8VHa.mjs";
1
+ import { a as createEventRegistry, o as createPendingExportManager, r as createPostMessageTransport, s as toInitMessage, t as SDK_VERSION } from "./version-DX-_ZovM.mjs";
2
2
  import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
3
3
 
4
4
  //#region src/embed.ts
@@ -81,6 +81,8 @@ function extractInitOptions(options) {
81
81
  capabilities: options.capabilities,
82
82
  panels: options.panels,
83
83
  commentsByMachineId: options.commentsByMachineId,
84
+ projectWorkspace: options.projectWorkspace,
85
+ projectWorkspaceOpen: options.projectWorkspaceOpen,
84
86
  settings: options.settings,
85
87
  unsavedIndicator: options.unsavedIndicator
86
88
  };
@@ -278,6 +280,19 @@ function createStatelyEmbed(options) {
278
280
  case "@statelyai.project.machineSelected":
279
281
  events.emit("machineSelected", { machineId: String(data.machineId) });
280
282
  break;
283
+ case "@statelyai.project.workspaceAction": {
284
+ const action = data;
285
+ events.emit("projectWorkspaceAction", {
286
+ actionId: String(action.actionId),
287
+ projectId: typeof action.projectId === "string" ? action.projectId : void 0,
288
+ machineId: typeof action.machineId === "string" ? action.machineId : void 0,
289
+ ...action.data !== void 0 ? { data: action.data } : {}
290
+ });
291
+ break;
292
+ }
293
+ case "@statelyai.project.workspaceOpenChanged":
294
+ events.emit("projectWorkspaceOpenChanged", { open: Boolean(data.open) });
295
+ break;
281
296
  case "@statelyai.viewModeChanged": {
282
297
  const viewMode = data;
283
298
  options.onViewModeChanged?.(viewMode.viewMode);
@@ -410,12 +425,14 @@ function createStatelyEmbed(options) {
410
425
  sourceLocations
411
426
  });
412
427
  },
413
- updateProject(machines, currentMachineId, commentsByMachineId) {
428
+ updateProject(machines, currentMachineId, commentsByMachineId, projectOptions) {
414
429
  send({
415
430
  type: "@statelyai.project.update",
416
431
  machines,
417
432
  currentMachineId,
418
- commentsByMachineId
433
+ commentsByMachineId,
434
+ projectWorkspace: projectOptions?.projectWorkspace,
435
+ projectWorkspaceOpen: projectOptions?.projectWorkspaceOpen
419
436
  });
420
437
  },
421
438
  selectMachine(machineId) {
@@ -424,6 +441,12 @@ function createStatelyEmbed(options) {
424
441
  machineId
425
442
  });
426
443
  },
444
+ setProjectWorkspaceOpen(open) {
445
+ send({
446
+ type: "@statelyai.project.setWorkspaceOpen",
447
+ open
448
+ });
449
+ },
427
450
  setMode(mode) {
428
451
  send({
429
452
  type: "@statelyai.setMode",
package/dist/index.d.mts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
2
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-D_pO_Pr8.mjs";
3
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-1fwR0Ynl.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, ProjectEmbedMachine, UploadResult, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.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, ProjectEmbedMachine, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, 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
- 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-CMwC9KKh.mjs";
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
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-CkrbMK00.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 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 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 };
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-D3ug8VHa.mjs";
3
+ import { i as createWebSocketTransport, r as createPostMessageTransport } from "./version-DX-_ZovM.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-BZE_Wm0m.mjs";
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-0djA1cnm.mjs";
9
9
  import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
10
- import { n as createStatelyInspector, t as createInspector } from "./inspect-Bz3dcNBH.mjs";
10
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-CWFYJT9G.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-D3ug8VHa.mjs";
2
+ import { a as createEventRegistry, i as createWebSocketTransport, n as inspectionRuntime, o as createPendingExportManager, t as SDK_VERSION } from "./version-DX-_ZovM.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-D3ug8VHa.mjs";
2
- import { n as createStatelyInspector, t as createInspector } from "./inspect-Bz3dcNBH.mjs";
1
+ import "./version-DX-_ZovM.mjs";
2
+ import { n as createStatelyInspector, t as createInspector } from "./inspect-CWFYJT9G.mjs";
3
3
 
4
4
  export { createInspector, createStatelyInspector };
@@ -35,8 +35,52 @@ interface CommentsConfig {
35
35
  interface ProjectEmbedMachine {
36
36
  id: string;
37
37
  name?: string;
38
+ /** Optional host project scope for machine-to-machine references. */
39
+ projectId?: string;
38
40
  machine: unknown;
39
41
  }
42
+ type ProjectWorkspaceActionIcon = 'arrow-left' | 'copy' | 'fork' | 'history';
43
+ interface ProjectWorkspaceAction {
44
+ id: string;
45
+ label: string;
46
+ icon?: ProjectWorkspaceActionIcon;
47
+ disabled?: boolean;
48
+ }
49
+ interface ProjectWorkspaceMachine {
50
+ id: string;
51
+ name?: string;
52
+ }
53
+ interface ProjectWorkspaceProject {
54
+ id: string;
55
+ name: string;
56
+ machines: ProjectWorkspaceMachine[];
57
+ rootMachineId?: string;
58
+ }
59
+ /** Host-backed operations for the built-in workspace controls. */
60
+ interface ProjectWorkspaceCapabilities {
61
+ renameProject?: ProjectWorkspaceAction;
62
+ createMachine?: ProjectWorkspaceAction;
63
+ renameMachine?: ProjectWorkspaceAction;
64
+ copyMachine?: ProjectWorkspaceAction;
65
+ deleteMachine?: ProjectWorkspaceAction;
66
+ setRootMachine?: ProjectWorkspaceAction;
67
+ }
68
+ /** Serializable workspace tree rendered by project-mode embeds. */
69
+ interface ProjectWorkspaceConfig {
70
+ /** Visible projects; pass one entry when embedding a single project. */
71
+ projects: ProjectWorkspaceProject[];
72
+ defaultProjectId?: string;
73
+ backAction?: ProjectWorkspaceAction;
74
+ userAvatarUrl?: string;
75
+ machineSelectionDisabled?: boolean;
76
+ /** Optional host-backed operations for the built-in workspace controls. */
77
+ workspaceCapabilities?: ProjectWorkspaceCapabilities;
78
+ /** Actions rendered from the workspace options menu. */
79
+ workspaceActions?: ProjectWorkspaceAction[];
80
+ /** Optional actions keyed by project or machine id. */
81
+ projectActions?: Record<string, ProjectWorkspaceAction[]>;
82
+ machineActions?: Record<string, ProjectWorkspaceAction[]>;
83
+ }
40
84
  declare const EMBED_DOCUMENT_LANGUAGES: readonly ["markdown", "typescript", "javascript", "json", "xml", "mermaid", "text"];
41
85
  type EmbedDocumentLanguage = (typeof EMBED_DOCUMENT_LANGUAGES)[number];
42
86
  declare const EMBED_DOCUMENT_LIMITS: {
@@ -171,6 +215,15 @@ interface EmbedEventMap {
171
215
  machineSelected: {
172
216
  machineId: string;
173
217
  };
218
+ projectWorkspaceAction: {
219
+ actionId: string;
220
+ projectId?: string;
221
+ machineId?: string;
222
+ data?: unknown;
223
+ };
224
+ projectWorkspaceOpenChanged: {
225
+ open: boolean;
226
+ };
174
227
  viewModeChanged: {
175
228
  viewMode: 'graph' | 'list';
176
229
  machineId?: string;
@@ -249,6 +302,8 @@ interface ProjectInitOptions {
249
302
  activePanels?: string[];
250
303
  };
251
304
  commentsByMachineId?: Record<string, CommentsConfig>;
305
+ projectWorkspace?: ProjectWorkspaceConfig;
306
+ projectWorkspaceOpen?: boolean;
252
307
  settings?: Record<string, unknown>;
253
308
  unsavedIndicator?: {
254
309
  enabled?: boolean;
@@ -321,6 +376,8 @@ interface ProjectInitMessage {
321
376
  rightPanels?: string[];
322
377
  activePanels?: string[];
323
378
  commentsByMachineId?: Record<string, CommentsConfig>;
379
+ projectWorkspace?: ProjectWorkspaceConfig;
380
+ projectWorkspaceOpen?: boolean;
324
381
  settings?: Record<string, unknown>;
325
382
  unsavedIndicator?: {
326
383
  enabled?: boolean;
@@ -333,11 +390,17 @@ interface ProjectUpdateMessage {
333
390
  machines: ProjectEmbedMachine[];
334
391
  currentMachineId?: string;
335
392
  commentsByMachineId?: Record<string, CommentsConfig>;
393
+ projectWorkspace?: ProjectWorkspaceConfig;
394
+ projectWorkspaceOpen?: boolean;
336
395
  }
337
396
  interface ProjectSelectMachineMessage {
338
397
  type: '@statelyai.project.selectMachine';
339
398
  machineId: string;
340
399
  }
400
+ interface ProjectSetWorkspaceOpenMessage {
401
+ type: '@statelyai.project.setWorkspaceOpen';
402
+ open: boolean;
403
+ }
341
404
  interface UpdateMessage {
342
405
  type: '@statelyai.update';
343
406
  machine: unknown;
@@ -510,6 +573,17 @@ interface ProjectMachineSelectedMessage {
510
573
  type: '@statelyai.project.machineSelected';
511
574
  machineId: string;
512
575
  }
576
+ interface ProjectWorkspaceActionMessage {
577
+ type: '@statelyai.project.workspaceAction';
578
+ actionId: string;
579
+ projectId?: string;
580
+ machineId?: string;
581
+ data?: unknown;
582
+ }
583
+ interface ProjectWorkspaceOpenChangedMessage {
584
+ type: '@statelyai.project.workspaceOpenChanged';
585
+ open: boolean;
586
+ }
513
587
  interface ViewModeChangedMessage {
514
588
  type: '@statelyai.viewModeChanged';
515
589
  viewMode: 'graph' | 'list';
@@ -583,9 +657,9 @@ interface ExtensionResultMessage {
583
657
  error?: string;
584
658
  }
585
659
  /** All messages a client (embed/inspector) can send to the viz. */
586
- type ClientMessage = InitMessage | SetApiKeyMessage | EditorHandshakeMessage | SavedMessage | ClipboardReadResponseMessage | ClipboardWriteResponseMessage | ProjectInitMessage | ProjectUpdateMessage | ProjectSelectMachineMessage | UpdateMessage | SetModeMessage | SetThemeMessage | SetSettingsMessage | RetrieveMessage | ToastMessage | InspectSnapshotMessage | SystemInitMessage | SystemSelectActorMessage | SystemActorRegisteredMessage | SystemActorEventMessage | SystemActorSnapshotMessage | SystemActorStoppedMessage | UploadCapabilitiesMessage | UploadResponseMessage | ExtensionResultMessage | ErrorMessage;
660
+ 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;
587
661
  /** All messages the viz can send back to a client. */
588
- type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | ProjectMachineSelectedMessage | ViewModeChangedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | ClipboardReadMessage | ClipboardWriteMessage | UploadRequestMessage | ExtensionCallMessage;
662
+ type VizMessage = ReadyMessage | LoadedMessage | ChangeMessage | SaveMessage | ProjectMachineSelectedMessage | ProjectWorkspaceActionMessage | ProjectWorkspaceOpenChangedMessage | ViewModeChangedMessage | RetrievedMessage | ErrorMessage | CapabilityDeniedMessage | ClipboardReadMessage | ClipboardWriteMessage | UploadRequestMessage | ExtensionCallMessage;
589
663
  interface InspectionClientMetadata {
590
664
  name?: string;
591
665
  machineId?: string;
@@ -614,4 +688,4 @@ declare const PREFIX = "@statelyai.";
614
688
  /** Current WebSocket inspection protocol version. */
615
689
  declare const INSPECTION_PROTOCOL_VERSION = 2;
616
690
  //#endregion
617
- 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, ProjectUpdateMessage, 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 };
691
+ 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 };
@@ -127,6 +127,8 @@ function toInitMessage(options) {
127
127
  rightPanels: options.panels?.rightPanels,
128
128
  activePanels: options.panels?.activePanels,
129
129
  commentsByMachineId: options.commentsByMachineId,
130
+ projectWorkspace: options.projectWorkspace,
131
+ projectWorkspaceOpen: options.projectWorkspaceOpen,
130
132
  settings: options.settings,
131
133
  unsavedIndicator: options.unsavedIndicator
132
134
  };
@@ -331,7 +333,7 @@ function createWebSocketTransport(options) {
331
333
 
332
334
  //#endregion
333
335
  //#region src/version.ts
334
- const SDK_VERSION = "0.23.0";
336
+ const SDK_VERSION = "0.23.1";
335
337
  function inspectionRuntime() {
336
338
  if (typeof window !== "undefined") return "browser";
337
339
  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.23.0",
3
+ "version": "0.23.1",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "stately-sdk": "./dist/bin.mjs"