@statelyai/sdk 0.17.0 → 0.18.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 +5 -0
- package/dist/embed.d.mts +2 -2
- package/dist/embed.mjs +3 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +5 -5
- package/dist/{inspect-CF_6aEnv.mjs → inspect-llcqYpZ1.mjs} +2 -2
- package/dist/inspect.mjs +2 -1
- package/dist/protocol.d.mts +23 -1
- package/dist/protocol.mjs +15 -1
- package/dist/{statelyPragma-Th0gdXfx.mjs → statelyPragma-Bm9O4XV6.mjs} +1 -0
- package/dist/sync.mjs +1 -1
- package/dist/{transport-B_ig9Znn.mjs → transport-CyCrdKyz.mjs} +25 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,10 @@ embed.init({
|
|
|
37
37
|
format: 'xstate',
|
|
38
38
|
mode: 'editing',
|
|
39
39
|
theme: 'dark',
|
|
40
|
+
documents: [
|
|
41
|
+
{ path: 'README.md', content: '# How this workflow works' },
|
|
42
|
+
{ path: 'src/machine.ts', content: machineSource },
|
|
43
|
+
],
|
|
40
44
|
});
|
|
41
45
|
```
|
|
42
46
|
|
|
@@ -76,6 +80,7 @@ Key capabilities:
|
|
|
76
80
|
- **Two-way sync** - push machine configs in, get changes and saves back via event callbacks
|
|
77
81
|
- **Export** to multiple formats: XState v5, XState JSON, Mermaid, Redux, Zustand, ASL, SCXML, and more
|
|
78
82
|
- **Access policies** for read-only, no-export, no-AI, shallow-viewer embeds
|
|
83
|
+
- **Reference documents** supplied as ordered, read-only Markdown, code, or text
|
|
79
84
|
- **Comments** via Liveblocks integration (optional)
|
|
80
85
|
- **Asset uploads** with built-in S3 and Supabase adapters, or bring your own upload handler
|
|
81
86
|
- **Runtime settings** - toggle color mode, grid, snap lines, autolayout, and view mode on the fly
|
package/dist/embed.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as StatelyGraph } from "./graph-DuOeLGvh.mjs";
|
|
2
|
-
import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
|
|
2
|
+
import { CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InitOptions, MachineInitOptions, MachineSourceLocations, ProjectEmbedMachine, UploadResult } from "./protocol.mjs";
|
|
3
3
|
import { AssetUploadAdapter } from "./assetStorage.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/embed.d.ts
|
|
@@ -91,4 +91,4 @@ interface StatelyEmbed {
|
|
|
91
91
|
}
|
|
92
92
|
declare function createStatelyEmbed(options: StatelyEmbedOptions): StatelyEmbed;
|
|
93
93
|
//#endregion
|
|
94
|
-
export { AssetConfig, type CapabilityDeniedEvent, type CommentsConfig, type EditorCapabilities, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type ProjectEmbedMachine, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
|
|
94
|
+
export { AssetConfig, type CapabilityDeniedEvent, type CommentsConfig, type EditorCapabilities, type EmbedDocument, type EmbedDocumentLanguage, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, type ExportCallOptions, type ExportFormat, type ExportFormatMap, type InitOptions, type MachineInitOptions, type MachineSourceLocations, type ProjectEmbedMachine, StatelyEmbed, StatelyEmbedOptions, type UploadResult, createStatelyEmbed };
|
package/dist/embed.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as toInitMessage, i as createPendingExportManager, r as createEventRegistry, t as createPostMessageTransport } from "./transport-
|
|
1
|
+
import { a as toInitMessage, i as createPendingExportManager, r as createEventRegistry, t as createPostMessageTransport } from "./transport-CyCrdKyz.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/embed.ts
|
|
4
4
|
function buildEmbedUrl(options) {
|
|
@@ -10,6 +10,7 @@ function buildEmbedUrl(options) {
|
|
|
10
10
|
function extractInitOptions(options) {
|
|
11
11
|
if (options.machines) return {
|
|
12
12
|
machines: options.machines,
|
|
13
|
+
documents: options.documents,
|
|
13
14
|
currentMachineId: options.currentMachineId,
|
|
14
15
|
mode: options.mode,
|
|
15
16
|
theme: options.theme,
|
|
@@ -22,6 +23,7 @@ function extractInitOptions(options) {
|
|
|
22
23
|
};
|
|
23
24
|
if (options.machine !== void 0) return {
|
|
24
25
|
machine: options.machine,
|
|
26
|
+
documents: options.documents,
|
|
25
27
|
format: options.format,
|
|
26
28
|
mode: options.mode,
|
|
27
29
|
theme: options.theme,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
2
2
|
import { _ as serializeJS, c as MachineConfigOptions, d as contextSchemaToTSType, f as eventsSchemaToTSType, g as raw, h as jsonSchemaToTSType, i as CodeGenGraph, l as RawCode, m as graphToXStateTS, o as GraphPatch, p as graphToMachineConfig, t as ActionLocation, u as XStateTSOptions } from "./index-ag6K2iAS.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-DuOeLGvh.mjs";
|
|
4
|
-
import { CapabilityDeniedCapability, CapabilityDeniedEvent, CommentsConfig, EditorCapabilities, 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, 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-2Thaw42j.mjs";
|
|
7
7
|
import { AssetConfig, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
|
|
@@ -32,4 +32,4 @@ declare function findStatelyPragmaAttachments(sourceText: string, fileName?: str
|
|
|
32
32
|
declare function getStatelyPragma(sourceText: string, fileName?: string, machineIndex?: number): StatelyPragma | undefined;
|
|
33
33
|
declare function upsertStatelyPragma(sourceText: string, id: string, options?: UpsertStatelyPragmaOptions): string;
|
|
34
34
|
//#endregion
|
|
35
|
-
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, type EditorCapabilities, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, 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 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 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, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
|
35
|
+
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, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, type EditorCapabilities, type EmbedDocument, type EmbedDocumentLanguage, type EmbedEventHandler, type EmbedEventMap, type EmbedEventName, type EmbedMode, 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 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 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, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
2
|
+
import { n as createWebSocketTransport, t as createPostMessageTransport } from "./transport-CyCrdKyz.mjs";
|
|
3
3
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
4
4
|
import { createS3AssetUploadAdapter, createSupabaseAssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
|
-
import { n as createStatelyInspector, t as createInspector } from "./inspect-
|
|
5
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-llcqYpZ1.mjs";
|
|
6
6
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-txdyJHD7.mjs";
|
|
7
|
-
import { a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, f as raw, l as graphToMachineConfig, n as getStatelyPragma, o as contextSchemaToTSType, p as serializeJS, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-
|
|
7
|
+
import { a as RawCode, c as eventsSchemaToTSType, d as jsonSchemaToTSType, f as raw, l as graphToMachineConfig, n as getStatelyPragma, o as contextSchemaToTSType, p as serializeJS, r as upsertStatelyPragma, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-Bm9O4XV6.mjs";
|
|
8
8
|
import { createAuthorizationHeader, getCredentialToken } from "./auth.mjs";
|
|
9
9
|
import { buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
10
10
|
import { StatelyApiError, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
11
11
|
import { fromStudioMachine, studioMachineConverter, toStudioMachine } from "./graph.mjs";
|
|
12
12
|
import { createInspectionRelay } from "./relay.mjs";
|
|
13
13
|
|
|
14
|
-
export { DEFAULT_STATELY_BASE_URL, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, RawCode, StatelyApiError, StudioApiError, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
|
14
|
+
export { DEFAULT_STATELY_BASE_URL, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, RawCode, StatelyApiError, StudioApiError, buildAuthorizeUrl, contextSchemaToTSType, createAuthorizationHeader, createInspectionActorId, createInspectionRelay, createInspectionRoomUrls, createInspector, createPkcePair, createPostMessageTransport, createS3AssetUploadAdapter, createStatelyApiClient, createStatelyApiUrl, createStatelyClient, createStatelyEmbed, createStatelyInspector, createSupabaseAssetUploadAdapter, createWebSocketTransport, discoverAuthorizationServer, discoverProtectedResource, eventsSchemaToTSType, exchangeCodeForToken, findStatelyPragmaAttachments, fromStudioMachine, getCredentialToken, getInspectionRoomId, getStatelyPragma, graphToMachineConfig, graphToXStateTS, jsonSchemaToTSType, raw, refreshToken, registerOAuthClient, serializeJS, studioMachineConverter, toStudioMachine, upsertStatelyPragma };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as createPendingExportManager, n as createWebSocketTransport, r as createEventRegistry } from "./transport-B_ig9Znn.mjs";
|
|
2
1
|
import { INSPECTION_PROTOCOL_VERSION, createInspectionRoomUrls, getInspectionRoomId } from "./protocol.mjs";
|
|
2
|
+
import { i as createPendingExportManager, n as createWebSocketTransport, r as createEventRegistry } from "./transport-CyCrdKyz.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openBrowser.ts
|
|
5
5
|
async function openBrowser(url) {
|
|
@@ -28,7 +28,7 @@ async function openBrowser(url) {
|
|
|
28
28
|
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/version.ts
|
|
31
|
-
const SDK_VERSION = "0.
|
|
31
|
+
const SDK_VERSION = "0.18.0";
|
|
32
32
|
function inspectionRuntime() {
|
|
33
33
|
if (typeof window !== "undefined") return "browser";
|
|
34
34
|
if (typeof process !== "undefined" && process.versions?.node) return "node";
|
package/dist/inspect.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./transport-CyCrdKyz.mjs";
|
|
2
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-llcqYpZ1.mjs";
|
|
2
3
|
|
|
3
4
|
export { createInspector, createStatelyInspector };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -35,6 +35,21 @@ interface ProjectEmbedMachine {
|
|
|
35
35
|
name?: string;
|
|
36
36
|
machine: unknown;
|
|
37
37
|
}
|
|
38
|
+
declare const EMBED_DOCUMENT_LANGUAGES: readonly ["markdown", "typescript", "javascript", "json", "xml", "mermaid", "text"];
|
|
39
|
+
type EmbedDocumentLanguage = (typeof EMBED_DOCUMENT_LANGUAGES)[number];
|
|
40
|
+
declare const EMBED_DOCUMENT_LIMITS: {
|
|
41
|
+
readonly maxDocuments: 100;
|
|
42
|
+
readonly maxDocumentLength: number;
|
|
43
|
+
readonly maxTotalLength: number;
|
|
44
|
+
};
|
|
45
|
+
/** Read-only text supplied by an embed host for display beside a machine. */
|
|
46
|
+
interface EmbedDocument {
|
|
47
|
+
/** Relative POSIX path used as the document's stable identity. */
|
|
48
|
+
path: string;
|
|
49
|
+
content: string;
|
|
50
|
+
/** Overrides renderer detection from the path's file extension. */
|
|
51
|
+
language?: EmbedDocumentLanguage;
|
|
52
|
+
}
|
|
38
53
|
interface ValidationIssue {
|
|
39
54
|
nodeIds: string[];
|
|
40
55
|
edgeIds: string[];
|
|
@@ -198,6 +213,8 @@ type EmbedEventName = keyof EmbedEventMap;
|
|
|
198
213
|
type EmbedEventHandler<K extends EmbedEventName> = (data: EmbedEventMap[K]) => void;
|
|
199
214
|
interface MachineInitOptions {
|
|
200
215
|
machine: unknown;
|
|
216
|
+
/** Ephemeral, read-only reference documents owned by the embed host. */
|
|
217
|
+
documents?: EmbedDocument[];
|
|
201
218
|
format?: string;
|
|
202
219
|
mode?: EmbedMode;
|
|
203
220
|
theme?: 'light' | 'dark';
|
|
@@ -232,6 +249,8 @@ interface MachineInitOptions {
|
|
|
232
249
|
}
|
|
233
250
|
interface ProjectInitOptions {
|
|
234
251
|
machines: ProjectEmbedMachine[];
|
|
252
|
+
/** Ephemeral, read-only reference documents shared across the project. */
|
|
253
|
+
documents?: EmbedDocument[];
|
|
235
254
|
currentMachineId?: string;
|
|
236
255
|
mode?: EmbedMode;
|
|
237
256
|
theme?: 'light' | 'dark';
|
|
@@ -254,6 +273,7 @@ type InitOptions = MachineInitOptions | ProjectInitOptions;
|
|
|
254
273
|
interface InitMessage {
|
|
255
274
|
type: '@statelyai.init';
|
|
256
275
|
machine: unknown;
|
|
276
|
+
documents?: EmbedDocument[];
|
|
257
277
|
format?: string;
|
|
258
278
|
mode?: EmbedMode;
|
|
259
279
|
theme?: 'light' | 'dark';
|
|
@@ -280,6 +300,7 @@ interface SetApiKeyMessage {
|
|
|
280
300
|
interface ProjectInitMessage {
|
|
281
301
|
type: '@statelyai.project.init';
|
|
282
302
|
machines: ProjectEmbedMachine[];
|
|
303
|
+
documents?: EmbedDocument[];
|
|
283
304
|
currentMachineId?: string;
|
|
284
305
|
mode?: EmbedMode;
|
|
285
306
|
theme?: 'light' | 'dark';
|
|
@@ -384,6 +405,7 @@ interface SystemInitMessage {
|
|
|
384
405
|
actors: ActorSystemEntry[];
|
|
385
406
|
/** Actor session id the viz should focus first. Defaults to the root. */
|
|
386
407
|
selectedSessionId?: string;
|
|
408
|
+
documents?: EmbedDocument[];
|
|
387
409
|
mode?: EmbedMode;
|
|
388
410
|
theme?: 'light' | 'dark';
|
|
389
411
|
readOnly?: boolean;
|
|
@@ -555,4 +577,4 @@ declare const PREFIX = "@statelyai.";
|
|
|
555
577
|
/** Current WebSocket inspection protocol version. */
|
|
556
578
|
declare const INSPECTION_PROTOCOL_VERSION = 2;
|
|
557
579
|
//#endregion
|
|
558
|
-
export { ActorSystemEntry, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, CommentsConfig, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, 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, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VizMessage, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
|
580
|
+
export { ActorSystemEntry, CapabilityDeniedCapability, CapabilityDeniedEvent, CapabilityDeniedMessage, ChangeMessage, ClientMessage, CommentsConfig, EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, EditorCapabilities, EmbedDocument, EmbedDocumentLanguage, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, 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, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VizMessage, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
package/dist/protocol.mjs
CHANGED
|
@@ -38,9 +38,23 @@ function createInspectionRoomUrls(options) {
|
|
|
38
38
|
function getInspectionRoomId(value) {
|
|
39
39
|
return new URL(value).searchParams.get(INSPECTION_ROOM_QUERY_PARAM)?.trim() || null;
|
|
40
40
|
}
|
|
41
|
+
const EMBED_DOCUMENT_LANGUAGES = [
|
|
42
|
+
"markdown",
|
|
43
|
+
"typescript",
|
|
44
|
+
"javascript",
|
|
45
|
+
"json",
|
|
46
|
+
"xml",
|
|
47
|
+
"mermaid",
|
|
48
|
+
"text"
|
|
49
|
+
];
|
|
50
|
+
const EMBED_DOCUMENT_LIMITS = {
|
|
51
|
+
maxDocuments: 100,
|
|
52
|
+
maxDocumentLength: 512 * 1024,
|
|
53
|
+
maxTotalLength: 2 * 1024 * 1024
|
|
54
|
+
};
|
|
41
55
|
const PREFIX = "@statelyai.";
|
|
42
56
|
/** Current WebSocket inspection protocol version. */
|
|
43
57
|
const INSPECTION_PROTOCOL_VERSION = 2;
|
|
44
58
|
|
|
45
59
|
//#endregion
|
|
46
|
-
export { INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, PREFIX, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
|
60
|
+
export { EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, PREFIX, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { a as array, c as literal, d as record, f as string, i as _enum, l as number, m as unknown, o as boolean, p as union, s as discriminatedUnion, u as object } from "./studio-txdyJHD7.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,5 +1,5 @@
|
|
|
1
1
|
import { r as createStatelyClient } from "./studio-txdyJHD7.mjs";
|
|
2
|
-
import { i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, m as xstateSourceToConfig, n as getStatelyPragma, p as serializeJS, r as upsertStatelyPragma, s as detectXStateSourceProfile, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-
|
|
2
|
+
import { i as INLINE_EXPRESSION_DIRECTIVE_FIELDS, m as xstateSourceToConfig, n as getStatelyPragma, p as serializeJS, r as upsertStatelyPragma, s as detectXStateSourceProfile, t as findStatelyPragmaAttachments, u as graphToXStateTS } from "./statelyPragma-Bm9O4XV6.mjs";
|
|
3
3
|
import { fromStudioMachine, toStudioMachine } from "./graph.mjs";
|
|
4
4
|
import * as ts$1 from "typescript";
|
|
5
5
|
import ts from "typescript";
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
-
import { INSPECTION_PROTOCOL_VERSION, PREFIX } from "./protocol.mjs";
|
|
1
|
+
import { EMBED_DOCUMENT_LANGUAGES, EMBED_DOCUMENT_LIMITS, INSPECTION_PROTOCOL_VERSION, PREFIX } from "./protocol.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/clientUtils.ts
|
|
4
|
+
const embedDocumentLanguages = new Set(EMBED_DOCUMENT_LANGUAGES);
|
|
5
|
+
function assertEmbedDocuments(documents) {
|
|
6
|
+
if (!documents) return;
|
|
7
|
+
if (documents.length > EMBED_DOCUMENT_LIMITS.maxDocuments) throw new TypeError(`Embed documents are limited to ${EMBED_DOCUMENT_LIMITS.maxDocuments}.`);
|
|
8
|
+
const seen = /* @__PURE__ */ new Set();
|
|
9
|
+
let totalLength = 0;
|
|
10
|
+
for (const document of documents) {
|
|
11
|
+
const path = document?.path;
|
|
12
|
+
const content = document?.content;
|
|
13
|
+
const language = document?.language;
|
|
14
|
+
const segments = typeof path === "string" ? path.split("/") : [];
|
|
15
|
+
if (typeof path !== "string" || path.length === 0 || path.startsWith("/") || path.includes("\\") || segments.some((segment) => segment.length === 0 || segment === "." || segment === "..")) throw new TypeError("Embed document paths must be non-empty relative POSIX paths.");
|
|
16
|
+
if (seen.has(path)) throw new TypeError(`Duplicate embed document path: ${path}`);
|
|
17
|
+
if (typeof content !== "string") throw new TypeError(`Embed document content must be text: ${path}`);
|
|
18
|
+
if (language !== void 0 && (typeof language !== "string" || !embedDocumentLanguages.has(language))) throw new TypeError(`Unsupported embed document language: ${language}`);
|
|
19
|
+
if (content.length > EMBED_DOCUMENT_LIMITS.maxDocumentLength) throw new TypeError(`Embed document exceeds the 512 KiB character limit: ${path}`);
|
|
20
|
+
seen.add(path);
|
|
21
|
+
totalLength += content.length;
|
|
22
|
+
}
|
|
23
|
+
if (totalLength > EMBED_DOCUMENT_LIMITS.maxTotalLength) throw new TypeError("Embed documents exceed the 2 MiB character limit.");
|
|
24
|
+
}
|
|
4
25
|
const jsonResultFormats = new Set([
|
|
5
26
|
"digraph",
|
|
6
27
|
"xstate-json",
|
|
@@ -91,9 +112,11 @@ function createPendingExportManager(sendRetrieve) {
|
|
|
91
112
|
};
|
|
92
113
|
}
|
|
93
114
|
function toInitMessage(options) {
|
|
115
|
+
assertEmbedDocuments(options.documents);
|
|
94
116
|
if ("machines" in options) return {
|
|
95
117
|
type: "@statelyai.project.init",
|
|
96
118
|
machines: options.machines,
|
|
119
|
+
documents: options.documents,
|
|
97
120
|
currentMachineId: options.currentMachineId,
|
|
98
121
|
mode: options.mode,
|
|
99
122
|
theme: options.theme,
|
|
@@ -109,6 +132,7 @@ function toInitMessage(options) {
|
|
|
109
132
|
return {
|
|
110
133
|
type: "@statelyai.init",
|
|
111
134
|
machine: options.machine,
|
|
135
|
+
documents: options.documents,
|
|
112
136
|
format: options.format,
|
|
113
137
|
mode: options.mode,
|
|
114
138
|
theme: options.theme,
|