@statelyai/sdk 0.31.2 → 0.33.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 +28 -6
- package/dist/assetStorage.d.mts +1 -1
- package/dist/{editorHostSession-UdKBWr0I.d.mts → editorHostSession-C6yxOmSO.d.mts} +1 -1
- package/dist/editorHostSession.d.mts +1 -1
- package/dist/embed.d.mts +1 -1
- package/dist/embed.mjs +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{inspect-Dcjy_T2E.mjs → inspect-C-eEfU3T.mjs} +143 -49
- package/dist/{inspect-DVRwYKva.d.mts → inspect-CunxIl8H.d.mts} +18 -5
- package/dist/inspect.d.mts +3 -3
- package/dist/inspect.mjs +2 -2
- package/dist/{protocol-DC7XJtw_.d.mts → protocol-CQL9Ubt9.d.mts} +7 -1
- package/dist/protocol.d.mts +2 -2
- package/dist/relay.d.mts +1 -1
- package/dist/{version-CsJTVKWN.mjs → version-BblbkW8-.mjs} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -247,6 +247,15 @@ const inspector = createInspector({
|
|
|
247
247
|
});
|
|
248
248
|
```
|
|
249
249
|
|
|
250
|
+
Declare source or config before its first actor exists to pre-render the graph
|
|
251
|
+
and warm source conversion. The declaration is a hint; an actor's payload wins
|
|
252
|
+
when it differs. `inspector.machine()` replaces a declaration after init.
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
const inspector = createInspector({ machines: { root: machineSource } });
|
|
256
|
+
inspector.machine('root', updatedMachineSource);
|
|
257
|
+
```
|
|
258
|
+
|
|
250
259
|
Actor IDs are preserved exactly. Unnamed invocations can carry a separate
|
|
251
260
|
`displayName`, derived from the parent machine's resolved invocation declaration
|
|
252
261
|
(for example, `fetchPolicies · account.loading`). Explicit invocation IDs take
|
|
@@ -258,22 +267,35 @@ Error, or Stopped); “Awaiting snapshot” means no snapshot has arrived.
|
|
|
258
267
|
|
|
259
268
|
For persisted actors, `resolveSessionId` can keep one producer-local identity
|
|
260
269
|
across sequential restore/resume incarnations. Generate a new id for a new
|
|
261
|
-
logical invocation, persist it beside the actor snapshot, and reuse it
|
|
262
|
-
|
|
263
|
-
|
|
270
|
+
logical invocation, persist it beside the actor snapshot, and reuse it after
|
|
271
|
+
the previous incarnation has stopped. The same inspector may observe the
|
|
272
|
+
replacement runtime actor:
|
|
264
273
|
|
|
265
274
|
```ts
|
|
266
275
|
const inspector = createInspector({
|
|
267
276
|
roomId: persistedInspectionRoomId,
|
|
268
277
|
producerId: persistedInspectionProducerId,
|
|
269
|
-
resolveSessionId: (actor, defaultSessionId) =>
|
|
270
|
-
|
|
278
|
+
resolveSessionId: (actor, defaultSessionId, parentSessionId) =>
|
|
279
|
+
parentSessionId
|
|
280
|
+
? `${parentSessionId}/${actor.id}`
|
|
281
|
+
: persistedInspectionId,
|
|
271
282
|
});
|
|
272
283
|
```
|
|
273
284
|
|
|
274
285
|
A resume must reuse the same room id, producer id, and resolved session id. Keep
|
|
275
286
|
the room id private because it is the room's bearer capability. A new logical
|
|
276
|
-
invocation keeps the producer id but receives a new resolved session id.
|
|
287
|
+
invocation keeps the producer id but receives a new resolved session id. Active
|
|
288
|
+
owners reject collisions unless `sessionIdReuse: "always"` explicitly permits
|
|
289
|
+
replacement; late observations from a displaced actor are ignored.
|
|
290
|
+
|
|
291
|
+
The resolver's third argument is the parent's resolved id, so recreated child
|
|
292
|
+
actors can use stable paths instead of accumulating runtime session ids. IDs
|
|
293
|
+
must still be unique within one live actor tree.
|
|
294
|
+
|
|
295
|
+
To present a stopped request-scoped runtime as waiting for its next resume, map
|
|
296
|
+
its serialized status to a non-terminal value such as `suspended` in
|
|
297
|
+
`serializeSnapshot`. The raw terminal status still permits the next runtime
|
|
298
|
+
actor to rebind automatically.
|
|
277
299
|
|
|
278
300
|
Stopped actors remain in `inspector.actors` and in reconnect checkpoints, so
|
|
279
301
|
completed request-scoped runs stay available for inspection.
|
package/dist/assetStorage.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $t as EmbedPanelConfig, X as ProjectEmbedMachine, st as ProjectWorkspaceConfig } from "./protocol-CQL9Ubt9.mjs";
|
|
2
2
|
import { a as EditorSyncParseRequest, d as EditorSyncTextReplacement, f as MachineSourceLocations, i as EditorSyncApplyResponse, n as EditorSyncAccess, o as EditorSyncParseResponse, r as EditorSyncApplyRequest, s as EditorSyncSourceDocument, t as EditorCapabilities } from "./editor-sync-types-CPpzTSnT.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/editorHostProtocol.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, c as EditorSyncError, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-
|
|
1
|
+
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, c as EditorSyncError, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-C6yxOmSO.mjs";
|
|
2
2
|
export { EDITOR_PROTOCOL_VERSION, EditorHostDiagnostic, EditorHostExportFormat, EditorHostInboundMessage, EditorHostInitOptions, EditorHostOutboundMessage, EditorHostSession, EditorHostSessionOptions, EditorHostValidationIssue, EditorHostWorkspaceMachine, EditorHostWorkspaceSession, EditorHostWorkspaceSessionOptions, EditorSourceHost, EditorSyncBackend, EditorSyncError, RemoteEditorSyncBackendOptions, createRemoteEditorSyncBackend, fetchEditorSyncAccess };
|
package/dist/embed.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as ProfileManifest } from "./index-DlOZxzrW.mjs";
|
|
2
2
|
import { i as StatelyGraph } from "./graph-CR_g-mOq.mjs";
|
|
3
|
-
import { $t as
|
|
3
|
+
import { $t as EmbedPanelConfig, D as ExportCallOptions, F as InitOptions, G as MachineSourceLocations, Ht as UploadResult, K as MachineVersionAutoSaveOptions, O as ExportFormat, Q as ProjectInitOptions, S as EmbedExtensionsManifest, U as MachineInitOptions, X as ProjectEmbedMachine, _ as EmbedDocumentLanguage, b as EmbedEventName, ct as ProjectWorkspaceMachine, d as CommentsConfig, dt as ProjectWorkspaceProject, en as EmbedPanelPosition, g as EmbedDocument, it as ProjectWorkspaceActionIcon, k as ExportFormatMap, lt as ProjectWorkspaceMachineOrigin, m as EditorCapabilities, ot as ProjectWorkspaceCapabilities, r as CapabilityDeniedEvent, rt as ProjectWorkspaceAction, st as ProjectWorkspaceConfig, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-CQL9Ubt9.mjs";
|
|
4
4
|
import { AssetUploadAdapter } from "./assetStorage.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/embed.d.ts
|
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-BblbkW8-.mjs";
|
|
2
2
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/embed.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StatelyApiClientOptions, StatelyApiError, StatelyApiUrlOptions, createStatelyApiClient, createStatelyApiUrl } from "./api.mjs";
|
|
2
2
|
import { S as GraphPatch, _ as raw, a as RawCode, c as XStateV4TSOptions, d as getXStateFSMCompatibilityIssues, f as graphToMachineConfig, g as jsonSchemaToTSType, h as graphToXStateV4TS, l as contextSchemaToTSType, m as graphToXStateTS, n as CodeGenGraph, o as XStateFSMOptions, p as graphToXStateFSM, r as MachineConfigOptions, s as XStateTSOptions, u as eventsSchemaToTSType, v as serializeJS, y as ActionLocation } from "./index-DlOZxzrW.mjs";
|
|
3
3
|
import { C as EventTypeData, S as DigraphNodeConfig, _ as studioMachineConverter, a as StatelyGraphData, b as DigraphConfig, c as StatelyInvoke, d as StudioAction, f as StudioEdge, g as fromStudioMachine, h as StudioNode, i as StatelyGraph, l as StatelyNodeData, m as StudioMachine, o as StatelyGuard, r as StatelyEdgeData, t as StatelyAction, v as toStudioMachine, w as StateNodeJSONData, x as DigraphEdgeConfig, y as DigraphAction } from "./graph-CR_g-mOq.mjs";
|
|
4
|
-
import { $t as
|
|
4
|
+
import { $t as EmbedPanelConfig, B as InspectionSentEvent, D as ExportCallOptions, F as InitOptions, Ht as UploadResult, Jt as createInspectionActorId, K as MachineVersionAutoSaveOptions, L as InspectionAction, M as INSPECTION_PROTOCOL_VERSION, N as INSPECTION_ROOM_QUERY_PARAM, O as ExportFormat, Qt as isEmbedExampleMachine, V as InspectionTakenTransition, X as ProjectEmbedMachine, Xt as getInspectionRoomId, Yt as createInspectionRoomUrls, Zt as isEmbedExample, _ as EmbedDocumentLanguage, b as EmbedEventName, ct as ProjectWorkspaceMachine, d as CommentsConfig, dt as ProjectWorkspaceProject, en as EmbedPanelPosition, f as EMBED_DOCUMENT_LANGUAGES, g as EmbedDocument, it as ProjectWorkspaceActionIcon, k as ExportFormatMap, lt as ProjectWorkspaceMachineOrigin, m as EditorCapabilities, n as CapabilityDeniedCapability, ot as ProjectWorkspaceCapabilities, p as EMBED_DOCUMENT_LIMITS, qt as assertEmbedExamples, r as CapabilityDeniedEvent, rt as ProjectWorkspaceAction, st as ProjectWorkspaceConfig, v as EmbedEventHandler, w as EmbedMode, x as EmbedExample, y as EmbedEventMap } from "./protocol-CQL9Ubt9.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-Dg7prjeL.mjs";
|
|
7
|
-
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-
|
|
7
|
+
import { _ as EditorHostOutboundMessage, a as EditorHostWorkspaceSessionOptions, d as fetchEditorSyncAccess, f as EDITOR_PROTOCOL_VERSION, g as EditorHostInitOptions, h as EditorHostInboundMessage, i as EditorHostWorkspaceSession, l as RemoteEditorSyncBackendOptions, m as EditorHostExportFormat, n as EditorHostSessionOptions, o as EditorSourceHost, p as EditorHostDiagnostic, r as EditorHostWorkspaceMachine, s as EditorSyncBackend, t as EditorHostSession, u as createRemoteEditorSyncBackend, v as EditorHostValidationIssue } from "./editorHostSession-C6yxOmSO.mjs";
|
|
8
8
|
import { AssetConfig, EmbedEntity, EmbedFormatContext, EmbedFormatDefinition, EmbedGraph, EmbedProfileDefinition, StatelyEmbed, StatelyEmbedOptions, createStatelyEmbed } from "./embed.mjs";
|
|
9
|
-
import { _ as createWebSocketTransport, a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, g as createPostMessageTransport, h as TransportFailure, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-
|
|
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-CunxIl8H.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-DV5IIGhV.mjs";
|
|
11
11
|
import { OAuthAuthorizationServerMetadata, OAuthClientRegistrationResponse, OAuthProtectedResourceMetadata, OAuthTokenResponse, PkcePair, buildAuthorizeUrl, createPkcePair, discoverAuthorizationServer, discoverProtectedResource, exchangeCodeForToken, refreshToken, registerOAuthClient } from "./oauth.mjs";
|
|
12
12
|
import { PlanSyncOptions, PullSyncResult, PushLocalMachineLinksResult, PushSyncOptions, PushSyncProjectOptions, PushSyncResult, ResolvedSyncInput, SyncInputFormat, SyncPlan, SyncPlanSummary } from "./sync.mjs";
|
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-BblbkW8-.mjs";
|
|
4
4
|
import { t as EDITOR_PROTOCOL_VERSION } from "./editorHostProtocol-Bko7wge8.mjs";
|
|
5
5
|
import { createStatelyEmbed } from "./embed.mjs";
|
|
6
6
|
import { a as fetchEditorSyncAccess, i as createRemoteEditorSyncBackend, n as EditorHostWorkspaceSession, t as EditorHostSession } from "./editorHostSession-DfmHzpls.mjs";
|
|
7
7
|
import { n as StudioApiError, r as createStatelyClient, t as DEFAULT_STATELY_BASE_URL } from "./studio-rSI54Ese.mjs";
|
|
8
8
|
import { _ as graphToXStateV4TS, b as raw, f as getXStateFSMCompatibilityIssues, g as graphToXStateTS, h as graphToXStateFSM, l as eventsSchemaToTSType, m as graphToMachineConfig, n as RawCode, o as contextSchemaToTSType, v as jsonSchemaToTSType, x as serializeJS } from "./dist-wbhkeGh6.mjs";
|
|
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-C-eEfU3T.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-BblbkW8-.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/openBrowser.ts
|
|
5
5
|
async function openBrowser(url) {
|
|
@@ -78,7 +78,8 @@ function generateRoomId() {
|
|
|
78
78
|
function createInspector(options = {}) {
|
|
79
79
|
const environmentUrl = typeof process !== "undefined" ? process.env?.STATELY_INSPECT_URL : void 0;
|
|
80
80
|
const url = options.url ?? environmentUrl ?? "wss://sky.stately.ai";
|
|
81
|
-
const { inspectorBaseUrl, name, serializeSnapshot = defaultSerializeSnapshot, selectedSessionId: configuredSelectedSessionId, selectedActorId, panels, theme, readOnly, depth, capabilities, transport: injectedTransport } = options;
|
|
81
|
+
const { inspectorBaseUrl, name, machines: configuredMachines, serializeSnapshot = defaultSerializeSnapshot, selectedSessionId: configuredSelectedSessionId, selectedActorId, panels, theme, readOnly, depth, capabilities, sessionIdReuse = "stopped", transport: injectedTransport } = options;
|
|
82
|
+
const declaredMachines = { ...configuredMachines };
|
|
82
83
|
const launch = options.launch ?? (options.autoOpen === true ? "browser" : "none");
|
|
83
84
|
const extractMachine = options.extractMachine ?? options.extractMachineConfig ?? defaultExtractMachineConfig;
|
|
84
85
|
const roomId = options.roomId ?? options.sessionId ?? getInspectionRoomId(url) ?? generateRoomId();
|
|
@@ -241,26 +242,60 @@ function createInspector(options = {}) {
|
|
|
241
242
|
const actors = /* @__PURE__ */ new Map();
|
|
242
243
|
const resolvedSessionIds = /* @__PURE__ */ new WeakMap();
|
|
243
244
|
const actorsByResolvedSessionId = /* @__PURE__ */ new Map();
|
|
245
|
+
const runtimeRoots = /* @__PURE__ */ new WeakMap();
|
|
246
|
+
const terminatedActors = /* @__PURE__ */ new WeakSet();
|
|
247
|
+
const reboundActors = /* @__PURE__ */ new WeakSet();
|
|
244
248
|
const manualSessionIds = /* @__PURE__ */ new Map();
|
|
245
249
|
/** Tracks which actors we've already emitted local actor events for. */
|
|
246
250
|
const locallyRegistered = /* @__PURE__ */ new Set();
|
|
247
251
|
/** v5 emits transition facets separately; accumulate them until snapshot. */
|
|
248
252
|
const pendingTransitions = /* @__PURE__ */ new Map();
|
|
249
|
-
function
|
|
253
|
+
function runtimeRootOf(actorRef, parentRef) {
|
|
254
|
+
const known = runtimeRoots.get(actorRef);
|
|
255
|
+
if (known) return known;
|
|
256
|
+
let rootRef = parentRef ?? actorRef;
|
|
257
|
+
while (rootRef._parent) rootRef = rootRef._parent;
|
|
258
|
+
runtimeRoots.set(actorRef, rootRef);
|
|
259
|
+
return rootRef;
|
|
260
|
+
}
|
|
261
|
+
function sessionIdOf(actorRef, parentRef = actorRef._parent, runtimeRoot) {
|
|
250
262
|
const existing = resolvedSessionIds.get(actorRef);
|
|
251
263
|
if (existing) return existing;
|
|
252
|
-
const
|
|
264
|
+
const parentSessionId = parentRef ? sessionIdOf(parentRef, parentRef._parent, runtimeRoot) : null;
|
|
265
|
+
const resolved = options.resolveSessionId?.(actorRef, actorRef.sessionId, parentSessionId) ?? actorRef.sessionId;
|
|
253
266
|
if (typeof resolved !== "string" || resolved.length === 0) throw new Error("createInspector(): resolveSessionId must return a non-empty string.");
|
|
267
|
+
assertSessionIdAvailable(actorRef, resolved, runtimeRoot ?? runtimeRootOf(actorRef, parentRef));
|
|
268
|
+
return claimSessionId(actorRef, resolved);
|
|
269
|
+
}
|
|
270
|
+
function assertSessionIdAvailable(actorRef, resolved, nextRoot) {
|
|
254
271
|
const claimedBy = actorsByResolvedSessionId.get(resolved);
|
|
255
|
-
|
|
272
|
+
const claimedEntry = actors.get(resolved);
|
|
273
|
+
if (claimedBy !== void 0 && claimedBy !== actorRef) {
|
|
274
|
+
if (runtimeRootOf(claimedBy) === nextRoot || !terminatedActors.has(claimedBy) && sessionIdReuse !== "always") throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
275
|
+
}
|
|
276
|
+
if (claimedBy === void 0 && claimedEntry) throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
277
|
+
}
|
|
278
|
+
function claimSessionId(actorRef, resolved) {
|
|
279
|
+
const claimedBy = actorsByResolvedSessionId.get(resolved);
|
|
280
|
+
if (claimedBy !== void 0 && claimedBy !== actorRef) {
|
|
281
|
+
actorsByResolvedSessionId.set(resolved, actorRef);
|
|
282
|
+
resolvedSessionIds.set(actorRef, resolved);
|
|
283
|
+
reboundActors.add(actorRef);
|
|
284
|
+
pendingTransitions.delete(resolved);
|
|
285
|
+
return resolved;
|
|
286
|
+
}
|
|
256
287
|
resolvedSessionIds.set(actorRef, resolved);
|
|
257
288
|
actorsByResolvedSessionId.set(resolved, actorRef);
|
|
258
289
|
return resolved;
|
|
259
290
|
}
|
|
291
|
+
function isCurrentOwner(actorRef) {
|
|
292
|
+
const sessionId = resolvedSessionIds.get(actorRef);
|
|
293
|
+
return sessionId === void 0 || actorsByResolvedSessionId.get(sessionId) === actorRef;
|
|
294
|
+
}
|
|
260
295
|
function rootSessionIdOf(runtimeRootId, actorRef) {
|
|
261
296
|
let rootRef = actorRef;
|
|
262
297
|
while (rootRef._parent) rootRef = rootRef._parent;
|
|
263
|
-
return rootRef.sessionId === runtimeRootId ? sessionIdOf(rootRef) : runtimeRootId;
|
|
298
|
+
return rootRef.sessionId === runtimeRootId ? sessionIdOf(rootRef, void 0, rootRef) : runtimeRootId;
|
|
264
299
|
}
|
|
265
300
|
function emitRegisterOnce(entry) {
|
|
266
301
|
if (locallyRegistered.has(entry.sessionId)) return;
|
|
@@ -268,23 +303,26 @@ function createInspector(options = {}) {
|
|
|
268
303
|
emitLocal("actor", entry);
|
|
269
304
|
emitLocal("register", entry);
|
|
270
305
|
}
|
|
271
|
-
function
|
|
306
|
+
function readSnapshot(actorRef) {
|
|
272
307
|
try {
|
|
273
|
-
return
|
|
308
|
+
return actorRef.getSnapshot();
|
|
274
309
|
} catch {
|
|
275
|
-
return
|
|
310
|
+
return;
|
|
276
311
|
}
|
|
277
312
|
}
|
|
278
|
-
function
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
313
|
+
function trackTermination(actorRef, snapshot) {
|
|
314
|
+
if (isStoppedSnapshot(snapshot)) terminatedActors.add(actorRef);
|
|
315
|
+
}
|
|
316
|
+
function serializedStoppedValue(serialized, snapshot) {
|
|
317
|
+
if (serialized !== null && typeof serialized === "object" && Object.hasOwn(serialized, "status")) return isStoppedSnapshot(serialized);
|
|
318
|
+
return isStoppedSnapshot(snapshot);
|
|
284
319
|
}
|
|
285
320
|
function toEntry(actorRef, rootActorId, details) {
|
|
286
|
-
const sessionId = sessionIdOf(actorRef);
|
|
287
321
|
const parentRef = details?.parentRef ?? actorRef._parent;
|
|
322
|
+
const sessionId = sessionIdOf(actorRef, parentRef);
|
|
323
|
+
const snapshot = details?.snapshot ?? readSnapshot(actorRef);
|
|
324
|
+
const serialized = snapshot === void 0 ? null : serializeSnapshot(snapshot);
|
|
325
|
+
if (snapshot !== void 0) trackTermination(actorRef, snapshot);
|
|
288
326
|
return {
|
|
289
327
|
sessionId,
|
|
290
328
|
actorId: details?.id ?? actorRef.id ?? sessionId,
|
|
@@ -292,8 +330,8 @@ function createInspector(options = {}) {
|
|
|
292
330
|
parentSessionId: parentRef ? sessionIdOf(parentRef) : null,
|
|
293
331
|
rootSessionId: rootActorId,
|
|
294
332
|
systemId: actorRef.systemId,
|
|
295
|
-
snapshot:
|
|
296
|
-
stopped:
|
|
333
|
+
snapshot: serialized,
|
|
334
|
+
stopped: snapshot === void 0 ? false : serializedStoppedValue(serialized, snapshot),
|
|
297
335
|
machineConfig: extractMachine(actorRef, details?.source ?? actorRef.src)
|
|
298
336
|
};
|
|
299
337
|
}
|
|
@@ -308,26 +346,73 @@ function createInspector(options = {}) {
|
|
|
308
346
|
...entry.stopped && { stopped: true }
|
|
309
347
|
};
|
|
310
348
|
}
|
|
311
|
-
function resolveActorTreeSessionIds(
|
|
312
|
-
|
|
313
|
-
const
|
|
314
|
-
|
|
349
|
+
function resolveActorTreeSessionIds(rootRef) {
|
|
350
|
+
const pending = /* @__PURE__ */ new Map();
|
|
351
|
+
const owners = /* @__PURE__ */ new Map();
|
|
352
|
+
function visit(actorRef, parentRef) {
|
|
353
|
+
const existing = resolvedSessionIds.get(actorRef);
|
|
354
|
+
const parentSessionId = parentRef ? resolvedSessionIds.get(parentRef) ?? pending.get(parentRef)?.resolved : null;
|
|
355
|
+
const resolved = existing ?? options.resolveSessionId?.(actorRef, actorRef.sessionId, parentSessionId ?? null) ?? actorRef.sessionId;
|
|
356
|
+
if (typeof resolved !== "string" || resolved.length === 0) throw new Error("createInspector(): resolveSessionId must return a non-empty string.");
|
|
357
|
+
const localOwner = owners.get(resolved);
|
|
358
|
+
if (localOwner && localOwner !== actorRef) throw new Error(`createInspector(): resolveSessionId returned duplicate id "${resolved}".`);
|
|
359
|
+
owners.set(resolved, actorRef);
|
|
360
|
+
if (!existing) pending.set(actorRef, {
|
|
361
|
+
resolved,
|
|
362
|
+
parentRef
|
|
363
|
+
});
|
|
364
|
+
assertSessionIdAvailable(actorRef, resolved, rootRef);
|
|
365
|
+
const children = actorRef.getSnapshot()?.children ?? {};
|
|
366
|
+
for (const child of Object.values(children)) if (child) visit(child, actorRef);
|
|
367
|
+
}
|
|
368
|
+
visit(rootRef);
|
|
369
|
+
for (const [actorRef, { resolved }] of pending) {
|
|
370
|
+
runtimeRoots.set(actorRef, rootRef);
|
|
371
|
+
claimSessionId(actorRef, resolved);
|
|
372
|
+
}
|
|
315
373
|
}
|
|
316
374
|
/**
|
|
317
375
|
* Walk the actor tree and populate the local `actors` map. Idempotent —
|
|
318
376
|
* existing entries stay in place but have their snapshot refreshed.
|
|
319
377
|
*/
|
|
320
|
-
function
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
378
|
+
function publishActorRegistered(entry, replaces = false) {
|
|
379
|
+
if (!initSent) return;
|
|
380
|
+
send({
|
|
381
|
+
type: "@statelyai.system.actorRegistered",
|
|
382
|
+
sessionId: entry.sessionId,
|
|
383
|
+
actorId: entry.actorId,
|
|
384
|
+
...replaces && { replaces: true },
|
|
385
|
+
...entry.displayName && { displayName: entry.displayName },
|
|
386
|
+
parentSessionId: entry.parentSessionId,
|
|
387
|
+
machine: entry.machineConfig,
|
|
388
|
+
snapshot: entry.snapshot ?? void 0
|
|
389
|
+
});
|
|
390
|
+
if ((configuredSelectedSessionId ?? selectedActorId) === entry.sessionId) send({
|
|
391
|
+
type: "@statelyai.system.selectActor",
|
|
392
|
+
sessionId: entry.sessionId
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
function backfillActorTree(actorRef, rootActorId, publish = false) {
|
|
396
|
+
const sessionId = sessionIdOf(actorRef);
|
|
397
|
+
const existing = actors.get(sessionId);
|
|
398
|
+
const replaces = reboundActors.delete(actorRef);
|
|
399
|
+
const entry = !existing || replaces ? toEntry(actorRef, rootActorId) : existing;
|
|
400
|
+
if (existing && !replaces) {
|
|
324
401
|
const snapshot = actorRef.getSnapshot();
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
402
|
+
const serialized = serializeSnapshot(snapshot);
|
|
403
|
+
trackTermination(actorRef, snapshot);
|
|
404
|
+
existing.snapshot = serialized;
|
|
405
|
+
existing.stopped ||= serializedStoppedValue(serialized, snapshot);
|
|
406
|
+
} else {
|
|
407
|
+
actors.set(entry.sessionId, entry);
|
|
408
|
+
if (replaces) {
|
|
409
|
+
emitLocal("actor", entry);
|
|
410
|
+
emitLocal("register", entry);
|
|
411
|
+
} else emitRegisterOnce(entry);
|
|
412
|
+
if (publish) publishActorRegistered(entry, replaces);
|
|
413
|
+
}
|
|
329
414
|
const children = actorRef.getSnapshot()?.children ?? {};
|
|
330
|
-
for (const child of Object.values(children)) if (child) backfillActorTree(child, rootActorId);
|
|
415
|
+
for (const child of Object.values(children)) if (child) backfillActorTree(child, rootActorId, publish);
|
|
331
416
|
}
|
|
332
417
|
const inspectedRoots = /* @__PURE__ */ new Map();
|
|
333
418
|
const observedRootIds = /* @__PURE__ */ new Set();
|
|
@@ -340,6 +425,7 @@ function createInspector(options = {}) {
|
|
|
340
425
|
protocolVersion: INSPECTION_PROTOCOL_VERSION,
|
|
341
426
|
mode: "inspecting",
|
|
342
427
|
actors: allEntries.map(toSystemEntry),
|
|
428
|
+
...configuredMachines !== void 0 || Object.keys(declaredMachines).length > 0 ? { machines: { ...declaredMachines } } : {},
|
|
343
429
|
...selectedSessionId && { selectedSessionId },
|
|
344
430
|
...theme && { theme },
|
|
345
431
|
...readOnly !== void 0 && { readOnly },
|
|
@@ -356,19 +442,16 @@ function createInspector(options = {}) {
|
|
|
356
442
|
initSent = true;
|
|
357
443
|
}
|
|
358
444
|
function handleActor(actorRef, rootActorId, details) {
|
|
359
|
-
|
|
445
|
+
const sessionId = sessionIdOf(actorRef, details?.parentRef);
|
|
446
|
+
const replaces = reboundActors.delete(actorRef);
|
|
447
|
+
if (actors.has(sessionId) && !replaces) return;
|
|
360
448
|
const entry = toEntry(actorRef, rootActorId, details);
|
|
361
449
|
actors.set(entry.sessionId, entry);
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
...entry.displayName && { displayName: entry.displayName },
|
|
368
|
-
parentSessionId: entry.parentSessionId,
|
|
369
|
-
machine: entry.machineConfig,
|
|
370
|
-
snapshot: entry.snapshot ?? void 0
|
|
371
|
-
});
|
|
450
|
+
if (replaces) {
|
|
451
|
+
emitLocal("actor", entry);
|
|
452
|
+
emitLocal("register", entry);
|
|
453
|
+
} else emitRegisterOnce(entry);
|
|
454
|
+
publishActorRegistered(entry, replaces);
|
|
372
455
|
}
|
|
373
456
|
function normalizeAction(action) {
|
|
374
457
|
return {
|
|
@@ -436,6 +519,7 @@ function createInspector(options = {}) {
|
|
|
436
519
|
const entry = actors.get(sessionId);
|
|
437
520
|
if (!entry) return;
|
|
438
521
|
const serialized = serializeSnapshot(snapshot);
|
|
522
|
+
trackTermination(actorRef, snapshot);
|
|
439
523
|
const inspectedSnapshot = {
|
|
440
524
|
sessionId: entry.sessionId,
|
|
441
525
|
sourceSessionId: transition.sourceSessionId,
|
|
@@ -448,7 +532,7 @@ function createInspector(options = {}) {
|
|
|
448
532
|
};
|
|
449
533
|
const wasStopped = entry.stopped;
|
|
450
534
|
entry.snapshot = serialized;
|
|
451
|
-
const stopped =
|
|
535
|
+
const stopped = serializedStoppedValue(serialized, snapshot);
|
|
452
536
|
entry.stopped ||= stopped;
|
|
453
537
|
pendingTransitions.delete(entry.sessionId);
|
|
454
538
|
if (initSent) send({
|
|
@@ -480,6 +564,7 @@ function createInspector(options = {}) {
|
|
|
480
564
|
materializePendingInit();
|
|
481
565
|
const event = inspectionEvent;
|
|
482
566
|
const rootActorId = rootSessionIdOf(event.rootId, event.actorRef);
|
|
567
|
+
if (!isCurrentOwner(event.actorRef)) return;
|
|
483
568
|
const isNewRoot = !observedRootIds.has(rootActorId);
|
|
484
569
|
observedRootIds.add(rootActorId);
|
|
485
570
|
switch (event.type) {
|
|
@@ -522,26 +607,30 @@ function createInspector(options = {}) {
|
|
|
522
607
|
break;
|
|
523
608
|
default: break;
|
|
524
609
|
}
|
|
525
|
-
if (isNewRoot) sendInit();
|
|
610
|
+
if (isNewRoot && !initSent) sendInit();
|
|
526
611
|
}
|
|
527
612
|
function attachActor(actor) {
|
|
528
613
|
const root = actor;
|
|
614
|
+
resolveActorTreeSessionIds(root);
|
|
529
615
|
const rootActorId = sessionIdOf(root);
|
|
530
616
|
const existing = inspectedRoots.get(rootActorId);
|
|
531
|
-
if (existing) return existing.subscription;
|
|
617
|
+
if (existing?.actor === root) return existing.subscription;
|
|
618
|
+
if (existing) {
|
|
619
|
+
existing.subscription.unsubscribe();
|
|
620
|
+
inspectedRoots.delete(rootActorId);
|
|
621
|
+
}
|
|
532
622
|
materializePendingInit();
|
|
533
|
-
resolveActorTreeSessionIds(root);
|
|
534
623
|
observedRootIds.add(rootActorId);
|
|
535
624
|
const subscription = root.system.inspect(handleInspectionEvent);
|
|
536
625
|
inspectedRoots.set(rootActorId, {
|
|
537
626
|
actor: root,
|
|
538
627
|
subscription
|
|
539
628
|
});
|
|
540
|
-
backfillActorTree(root, rootActorId);
|
|
541
|
-
sendInit();
|
|
629
|
+
backfillActorTree(root, rootActorId, true);
|
|
630
|
+
if (!initSent) sendInit();
|
|
542
631
|
return { unsubscribe() {
|
|
543
632
|
subscription.unsubscribe();
|
|
544
|
-
inspectedRoots.delete(rootActorId);
|
|
633
|
+
if (inspectedRoots.get(rootActorId)?.subscription === subscription) inspectedRoots.delete(rootActorId);
|
|
545
634
|
} };
|
|
546
635
|
}
|
|
547
636
|
function getManualSessionId(actorId) {
|
|
@@ -630,6 +719,10 @@ function createInspector(options = {}) {
|
|
|
630
719
|
emitLocal("stop", stopped);
|
|
631
720
|
emitLocal("stopped", stopped);
|
|
632
721
|
}
|
|
722
|
+
function manualMachine(id, payload) {
|
|
723
|
+
declaredMachines[id] = payload;
|
|
724
|
+
sendInit();
|
|
725
|
+
}
|
|
633
726
|
initialized = true;
|
|
634
727
|
if (pendingTransportReady) {
|
|
635
728
|
pendingTransportReady = false;
|
|
@@ -661,6 +754,7 @@ function createInspector(options = {}) {
|
|
|
661
754
|
return exportManager.start(format, callOptions, "Inspector is destroyed", () => destroyed);
|
|
662
755
|
},
|
|
663
756
|
actor: manualRegister,
|
|
757
|
+
machine: manualMachine,
|
|
664
758
|
snapshot: manualSnapshot,
|
|
665
759
|
event: manualEvent,
|
|
666
760
|
stop: manualStop,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as InspectionSentEvent, D as ExportCallOptions, L as InspectionAction, O as ExportFormat,
|
|
1
|
+
import { $t as EmbedPanelConfig, B as InspectionSentEvent, D as ExportCallOptions, L as InspectionAction, O as ExportFormat, R as InspectionClientMetadata, V as InspectionTakenTransition, W as MachinePayload, ft as ProtocolMessage, k as ExportFormatMap, m as EditorCapabilities, y as EmbedEventMap } from "./protocol-CQL9Ubt9.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/transport.d.ts
|
|
4
4
|
interface TransportFailure {
|
|
@@ -170,10 +170,14 @@ interface CreateInspectorOptions {
|
|
|
170
170
|
sessionId?: string;
|
|
171
171
|
/** Display name for this system in the visualizer. */
|
|
172
172
|
name?: string;
|
|
173
|
+
/** Machine definitions available before their first actor exists. */
|
|
174
|
+
machines?: Record<string, MachinePayload>;
|
|
173
175
|
/**
|
|
174
176
|
* Serialize a snapshot for the wire. Defaults to `{value, status}` —
|
|
175
177
|
* dropping context entirely because xstate contexts routinely contain
|
|
176
|
-
* spawned actor refs which are not JSON-safe.
|
|
178
|
+
* spawned actor refs which are not JSON-safe. An explicit serialized status
|
|
179
|
+
* controls terminal presentation; for example, map a runtime `stopped`
|
|
180
|
+
* status to `suspended` when a logical actor is expected to resume.
|
|
177
181
|
*/
|
|
178
182
|
serializeSnapshot?: (snapshot: MinimalSnapshot) => unknown;
|
|
179
183
|
/**
|
|
@@ -191,10 +195,17 @@ interface CreateInspectorOptions {
|
|
|
191
195
|
/**
|
|
192
196
|
* Resolve the producer-local identity used for an actor on the inspection
|
|
193
197
|
* wire. Defaults to XState's runtime `actor.sessionId`. The resolver runs
|
|
194
|
-
* once per runtime actor and
|
|
195
|
-
*
|
|
198
|
+
* once per runtime actor and receives its parent's resolved id as the third
|
|
199
|
+
* argument. It must return a non-empty id. Reusing an id follows
|
|
200
|
+
* {@link CreateInspectorOptions.sessionIdReuse}.
|
|
196
201
|
*/
|
|
197
|
-
resolveSessionId?: (actor: any, defaultSessionId: string) => string;
|
|
202
|
+
resolveSessionId?: (actor: any, defaultSessionId: string, parentSessionId: string | null) => string;
|
|
203
|
+
/**
|
|
204
|
+
* Controls when a resolved session id may move to another runtime actor.
|
|
205
|
+
* Stopped actors are replaced by default. Use `always` for hosts that can
|
|
206
|
+
* guarantee the previous runtime actor will no longer produce relevant events.
|
|
207
|
+
*/
|
|
208
|
+
sessionIdReuse?: 'stopped' | 'always';
|
|
198
209
|
/** Selected actor session id to focus on first. */
|
|
199
210
|
selectedSessionId?: string;
|
|
200
211
|
/** @deprecated Use {@link selectedSessionId}. */
|
|
@@ -245,6 +256,8 @@ interface Inspector {
|
|
|
245
256
|
* xstate-discovered ones; in manual mode it's the only way to add actors.
|
|
246
257
|
*/
|
|
247
258
|
actor(id: string, options?: ManualActorOptions): void;
|
|
259
|
+
/** Declare or replace a machine definition and refresh the system checkpoint. */
|
|
260
|
+
machine(id: string, payload: MachinePayload): void;
|
|
248
261
|
/**
|
|
249
262
|
* Push a snapshot update for an actor, optionally with the event known to
|
|
250
263
|
* have caused it. The actor is auto-registered if needed.
|
package/dist/inspect.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as InspectionSentEvent, D as ExportCallOptions, L as InspectionAction, O as ExportFormat, V as InspectionTakenTransition, b as EmbedEventName, k as ExportFormatMap, m as EditorCapabilities, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-
|
|
2
|
-
import { a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-
|
|
3
|
-
export { AdoptedActor, CreateInspectorOptions, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InspectedEvent, InspectedSnapshot, InspectedTransition, InspectionAction, InspectionSentEvent, InspectionTakenTransition, Inspector, InspectorConnection, InspectorDiscoveryEntry, InspectorEvents, InspectorInspectionEvent, ManualActorOptions, Transport, createInspector, createStatelyInspector };
|
|
1
|
+
import { B as InspectionSentEvent, D as ExportCallOptions, L as InspectionAction, O as ExportFormat, V as InspectionTakenTransition, W as MachinePayload, b as EmbedEventName, k as ExportFormatMap, m as EditorCapabilities, v as EmbedEventHandler, w as EmbedMode, y as EmbedEventMap } from "./protocol-CQL9Ubt9.mjs";
|
|
2
|
+
import { a as InspectedTransition, c as InspectorDiscoveryEntry, d as ManualActorOptions, f as createInspector, i as InspectedSnapshot, l as InspectorEvents, m as Transport, n as CreateInspectorOptions, o as Inspector, p as createStatelyInspector, r as InspectedEvent, s as InspectorConnection, t as AdoptedActor, u as InspectorInspectionEvent } from "./inspect-CunxIl8H.mjs";
|
|
3
|
+
export { AdoptedActor, CreateInspectorOptions, EditorCapabilities, EmbedEventHandler, EmbedEventMap, EmbedEventName, EmbedMode, ExportCallOptions, ExportFormat, ExportFormatMap, InspectedEvent, InspectedSnapshot, InspectedTransition, InspectionAction, InspectionSentEvent, InspectionTakenTransition, Inspector, InspectorConnection, InspectorDiscoveryEntry, InspectorEvents, InspectorInspectionEvent, MachinePayload, ManualActorOptions, Transport, createInspector, createStatelyInspector };
|
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-BblbkW8-.mjs";
|
|
2
|
+
import { n as createStatelyInspector, t as createInspector } from "./inspect-C-eEfU3T.mjs";
|
|
3
3
|
|
|
4
4
|
export { createInspector, createStatelyInspector };
|
|
@@ -575,6 +575,8 @@ interface ActorSystemEntry {
|
|
|
575
575
|
/** Whether this actor stopped before this checkpoint was sent. */
|
|
576
576
|
stopped?: boolean;
|
|
577
577
|
}
|
|
578
|
+
/** Source text or machine config used to render a declared machine. */
|
|
579
|
+
type MachinePayload = unknown;
|
|
578
580
|
/** JSON-safe record of an action executed during an inspected transition. */
|
|
579
581
|
interface InspectionAction {
|
|
580
582
|
type: string;
|
|
@@ -600,6 +602,8 @@ interface SystemInitMessage {
|
|
|
600
602
|
protocolVersion: number;
|
|
601
603
|
/** All known actors at the moment the system is first streamed. */
|
|
602
604
|
actors: ActorSystemEntry[];
|
|
605
|
+
/** Machine definitions available before their first actor exists. */
|
|
606
|
+
machines?: Record<string, MachinePayload>;
|
|
603
607
|
/** Actor session id the viz should focus first. Defaults to the root. */
|
|
604
608
|
selectedSessionId?: string;
|
|
605
609
|
documents?: EmbedDocument[];
|
|
@@ -627,6 +631,8 @@ interface SystemActorRegisteredMessage {
|
|
|
627
631
|
type: '@statelyai.system.actorRegistered';
|
|
628
632
|
sessionId: string;
|
|
629
633
|
actorId: string;
|
|
634
|
+
/** This runtime actor replaces the previous owner of `sessionId`. */
|
|
635
|
+
replaces?: boolean;
|
|
630
636
|
/** Optional readable label; never replaces the runtime actor ID. */
|
|
631
637
|
displayName?: string;
|
|
632
638
|
parentSessionId: string | null;
|
|
@@ -856,4 +862,4 @@ declare const PREFIX = "@statelyai.";
|
|
|
856
862
|
/** Current WebSocket inspection protocol version. */
|
|
857
863
|
declare const INSPECTION_PROTOCOL_VERSION = 2;
|
|
858
864
|
//#endregion
|
|
859
|
-
export {
|
|
865
|
+
export { ProjectMachineSelectedMessage as $, EmbedPanelConfig as $t, ExtensionCallMessage as A, SystemActorRegisteredMessage as At, InspectionSentEvent as B, UploadRequestMessage as Bt, EmbedFormatManifest as C, SetModeMessage as Ct, ExportCallOptions as D, SourceRange as Dt, ErrorMessage as E, SourceLocation as Et, InitOptions as F, ToastDismissMessage as Ft, MachineSourceLocations as G, ViewModeChangedMessage as Gt, LoadedMessage as H, UploadResult as Ht, InspectSnapshotMessage as I, ToastMessage as It, PREFIX as J, createInspectionActorId as Jt, MachineVersionAutoSaveOptions as K, VizMessage as Kt, InspectionAction as L, UpdateMessage as Lt, INSPECTION_PROTOCOL_VERSION as M, SystemActorStoppedMessage as Mt, INSPECTION_ROOM_QUERY_PARAM as N, SystemInitMessage as Nt, ExportFormat as O, StateSourceLocation as Ot, InitMessage as P, SystemSelectActorMessage as Pt, ProjectInitOptions as Q, isEmbedExampleMachine as Qt, InspectionClientMetadata as R, UploadCapabilitiesMessage as Rt, EmbedExtensionsManifest as S, SetApiKeyMessage as St, ErrorCode as T, SetThemeMessage as Tt, MachineInitOptions as U, ValidationIssue as Ut, InspectionTakenTransition as V, UploadResponseMessage as Vt, MachinePayload as W, VersionSaveRequestedMessage as Wt, ProjectEmbedMachine as X, getInspectionRoomId as Xt, PanelChangedMessage as Y, createInspectionRoomUrls as Yt, ProjectInitMessage as Z, isEmbedExample as Zt, EmbedDocumentLanguage as _, RetrieveMessage as _t, ChangeMessage as a, ProjectWorkspaceActionMessage as at, EmbedEventName as b, SavedMessage as bt, ClipboardReadResponseMessage as c, ProjectWorkspaceMachine as ct, CommentsConfig as d, ProjectWorkspaceProject as dt, EmbedPanelPosition as en, ProjectSelectMachineMessage as et, EMBED_DOCUMENT_LANGUAGES as f, ProtocolMessage as ft, EmbedDocument as g, RegisteredMessage as gt, EditorHandshakeMessage as h, RegisterMessage as ht, CapabilityDeniedMessage as i, ProjectWorkspaceActionIcon as it, ExtensionResultMessage as j, SystemActorSnapshotMessage as jt, ExportFormatMap as k, SystemActorEventMessage as kt, ClipboardWriteMessage as l, ProjectWorkspaceMachineOrigin as lt, EditorCapabilities as m, ReadyMessage as mt, CapabilityDeniedCapability as n, ProjectUpdateMessage as nt, ClientMessage as o, ProjectWorkspaceCapabilities as ot, EMBED_DOCUMENT_LIMITS as p, ReadOnlyReason as pt, ModeChangedMessage as q, assertEmbedExamples as qt, CapabilityDeniedEvent as r, ProjectWorkspaceAction as rt, ClipboardReadMessage as s, ProjectWorkspaceConfig as st, ActorSystemEntry as t, ProjectSetWorkspaceOpenMessage as tt, ClipboardWriteResponseMessage as u, ProjectWorkspaceOpenChangedMessage as ut, EmbedEventHandler as v, RetrievedMessage as vt, EmbedMode as w, SetSettingsMessage as wt, EmbedExample as x, SessionMessage as xt, EmbedEventMap as y, SaveMessage as yt, InspectionRoomUrls as z, UploadFileInfo as zt };
|
package/dist/protocol.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
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, EmbedExample, EmbedExtensionsManifest, EmbedFormatManifest, EmbedMode, EmbedPanelConfig, EmbedPanelPosition, ErrorCode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, ExtensionCallMessage, ExtensionResultMessage, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, LoadedMessage, MachineInitOptions, MachineSourceLocations, MachineVersionAutoSaveOptions, ModeChangedMessage, PREFIX, PanelChangedMessage, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectSetWorkspaceOpenMessage, ProjectUpdateMessage, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceActionMessage, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceOpenChangedMessage, ProjectWorkspaceProject, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SavedMessage, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastDismissMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VersionSaveRequestedMessage, ViewModeChangedMessage, VizMessage, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine };
|
|
1
|
+
import { $ as ProjectMachineSelectedMessage, $t as EmbedPanelConfig, A as ExtensionCallMessage, At as SystemActorRegisteredMessage, B as InspectionSentEvent, Bt as UploadRequestMessage, C as EmbedFormatManifest, Ct as SetModeMessage, D as ExportCallOptions, Dt as SourceRange, E as ErrorMessage, Et as SourceLocation, F as InitOptions, Ft as ToastDismissMessage, G as MachineSourceLocations, Gt as ViewModeChangedMessage, H as LoadedMessage, Ht as UploadResult, I as InspectSnapshotMessage, It as ToastMessage, J as PREFIX, Jt as createInspectionActorId, K as MachineVersionAutoSaveOptions, Kt as VizMessage, L as InspectionAction, Lt as UpdateMessage, M as INSPECTION_PROTOCOL_VERSION, Mt as SystemActorStoppedMessage, N as INSPECTION_ROOM_QUERY_PARAM, Nt as SystemInitMessage, O as ExportFormat, Ot as StateSourceLocation, P as InitMessage, Pt as SystemSelectActorMessage, Q as ProjectInitOptions, Qt as isEmbedExampleMachine, R as InspectionClientMetadata, Rt as UploadCapabilitiesMessage, S as EmbedExtensionsManifest, St as SetApiKeyMessage, T as ErrorCode, Tt as SetThemeMessage, U as MachineInitOptions, Ut as ValidationIssue, V as InspectionTakenTransition, Vt as UploadResponseMessage, W as MachinePayload, Wt as VersionSaveRequestedMessage, X as ProjectEmbedMachine, Xt as getInspectionRoomId, Y as PanelChangedMessage, Yt as createInspectionRoomUrls, Z as ProjectInitMessage, Zt as isEmbedExample, _ as EmbedDocumentLanguage, _t as RetrieveMessage, a as ChangeMessage, at as ProjectWorkspaceActionMessage, b as EmbedEventName, bt as SavedMessage, c as ClipboardReadResponseMessage, ct as ProjectWorkspaceMachine, d as CommentsConfig, dt as ProjectWorkspaceProject, en as EmbedPanelPosition, et as ProjectSelectMachineMessage, f as EMBED_DOCUMENT_LANGUAGES, ft as ProtocolMessage, g as EmbedDocument, gt as RegisteredMessage, h as EditorHandshakeMessage, ht as RegisterMessage, i as CapabilityDeniedMessage, it as ProjectWorkspaceActionIcon, j as ExtensionResultMessage, jt as SystemActorSnapshotMessage, k as ExportFormatMap, kt as SystemActorEventMessage, l as ClipboardWriteMessage, lt as ProjectWorkspaceMachineOrigin, m as EditorCapabilities, mt as ReadyMessage, n as CapabilityDeniedCapability, nt as ProjectUpdateMessage, o as ClientMessage, ot as ProjectWorkspaceCapabilities, p as EMBED_DOCUMENT_LIMITS, pt as ReadOnlyReason, q as ModeChangedMessage, qt as assertEmbedExamples, r as CapabilityDeniedEvent, rt as ProjectWorkspaceAction, s as ClipboardReadMessage, st as ProjectWorkspaceConfig, t as ActorSystemEntry, tt as ProjectSetWorkspaceOpenMessage, u as ClipboardWriteResponseMessage, ut as ProjectWorkspaceOpenChangedMessage, v as EmbedEventHandler, vt as RetrievedMessage, w as EmbedMode, wt as SetSettingsMessage, x as EmbedExample, xt as SessionMessage, y as EmbedEventMap, yt as SaveMessage, z as InspectionRoomUrls, zt as UploadFileInfo } from "./protocol-CQL9Ubt9.mjs";
|
|
2
|
+
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, EmbedExample, EmbedExtensionsManifest, EmbedFormatManifest, EmbedMode, EmbedPanelConfig, EmbedPanelPosition, ErrorCode, ErrorMessage, ExportCallOptions, ExportFormat, ExportFormatMap, ExtensionCallMessage, ExtensionResultMessage, INSPECTION_PROTOCOL_VERSION, INSPECTION_ROOM_QUERY_PARAM, InitMessage, InitOptions, InspectSnapshotMessage, InspectionAction, InspectionClientMetadata, InspectionRoomUrls, InspectionSentEvent, InspectionTakenTransition, LoadedMessage, MachineInitOptions, MachinePayload, MachineSourceLocations, MachineVersionAutoSaveOptions, ModeChangedMessage, PREFIX, PanelChangedMessage, ProjectEmbedMachine, ProjectInitMessage, ProjectInitOptions, ProjectMachineSelectedMessage, ProjectSelectMachineMessage, ProjectSetWorkspaceOpenMessage, ProjectUpdateMessage, ProjectWorkspaceAction, ProjectWorkspaceActionIcon, ProjectWorkspaceActionMessage, ProjectWorkspaceCapabilities, ProjectWorkspaceConfig, ProjectWorkspaceMachine, ProjectWorkspaceMachineOrigin, ProjectWorkspaceOpenChangedMessage, ProjectWorkspaceProject, ProtocolMessage, ReadOnlyReason, ReadyMessage, RegisterMessage, RegisteredMessage, RetrieveMessage, RetrievedMessage, SaveMessage, SavedMessage, SessionMessage, SetApiKeyMessage, SetModeMessage, SetSettingsMessage, SetThemeMessage, SourceLocation, SourceRange, StateSourceLocation, SystemActorEventMessage, SystemActorRegisteredMessage, SystemActorSnapshotMessage, SystemActorStoppedMessage, SystemInitMessage, SystemSelectActorMessage, ToastDismissMessage, ToastMessage, UpdateMessage, UploadCapabilitiesMessage, UploadFileInfo, UploadRequestMessage, UploadResponseMessage, UploadResult, ValidationIssue, VersionSaveRequestedMessage, ViewModeChangedMessage, VizMessage, assertEmbedExamples, createInspectionActorId, createInspectionRoomUrls, getInspectionRoomId, isEmbedExample, isEmbedExampleMachine };
|
package/dist/relay.d.mts
CHANGED
|
@@ -366,7 +366,7 @@ function createWebSocketTransport(options) {
|
|
|
366
366
|
|
|
367
367
|
//#endregion
|
|
368
368
|
//#region src/version.ts
|
|
369
|
-
const SDK_VERSION = "0.
|
|
369
|
+
const SDK_VERSION = "0.33.0";
|
|
370
370
|
function inspectionRuntime() {
|
|
371
371
|
if (typeof window !== "undefined") return "browser";
|
|
372
372
|
if (typeof process !== "undefined" && process.versions?.node) return "node";
|