@statelyai/sdk 0.26.3 → 0.27.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.
Files changed (33) hide show
  1. package/README.md +30 -2
  2. package/dist/auth.d.mts +1 -1
  3. package/dist/{editorHostSession-DFjM-RoT.d.mts → editorHostSession-CWAuoMtC.d.mts} +9 -3
  4. package/dist/{editorHostSession-CwGeXJ6g.mjs → editorHostSession-shrjfosC.mjs} +6 -3
  5. package/dist/editorHostSession.d.mts +1 -1
  6. package/dist/editorHostSession.mjs +1 -1
  7. package/dist/embed.d.mts +6 -3
  8. package/dist/embed.mjs +23 -1
  9. package/dist/embedPanel-Bpbq4sfJ.d.mts +13 -0
  10. package/dist/{graph-DoUReqxz.d.mts → graph-BwHnhzpC.d.mts} +48 -6
  11. package/dist/graph.d.mts +1 -1
  12. package/dist/graph.mjs +36 -4
  13. package/dist/{index-DKRB-u93.d.mts → index-D2I1qPsf.d.mts} +19 -3
  14. package/dist/index.d.mts +8 -7
  15. package/dist/index.mjs +6 -6
  16. package/dist/{inspect-CiPPDR7Q.mjs → inspect-CebH2l6F.mjs} +3 -5
  17. package/dist/{inspect-Br_vS_lK.d.mts → inspect-D61HS-t7.d.mts} +2 -5
  18. package/dist/inspect.d.mts +1 -1
  19. package/dist/inspect.mjs +2 -2
  20. package/dist/patchTypes.d.mts +1 -1
  21. package/dist/protocol.d.mts +46 -15
  22. package/dist/{statelyPragma-B-axv279.mjs → statelyPragma-ByF0-L-N.mjs} +1198 -31
  23. package/dist/{studio-B6P177N3.d.mts → studio-B9-1Ynrx.d.mts} +4 -2
  24. package/dist/{studio-iNSHtNmP.mjs → studio-CNkxMZyz.mjs} +4 -1
  25. package/dist/studio.d.mts +1 -1
  26. package/dist/studio.mjs +1 -1
  27. package/dist/sync.d.mts +12 -4
  28. package/dist/sync.mjs +2920 -262
  29. package/dist/{version-At1lONTa.mjs → version-usAEzut8.mjs} +19 -7
  30. package/package.json +3 -3
  31. package/schemas/xstate.schema.json +41 -5
  32. /package/dist/{auth-B0ZTKri2.d.mts → auth-BPyCCHYo.d.mts} +0 -0
  33. /package/dist/{editor-sync-types-C-zWaaVk.d.mts → editor-sync-types-CTKArS8n.d.mts} +0 -0
@@ -22,6 +22,21 @@ function assertEmbedDocuments(documents) {
22
22
  }
23
23
  if (totalLength > EMBED_DOCUMENT_LIMITS.maxTotalLength) throw new TypeError("Embed documents exceed the 2 MiB character limit.");
24
24
  }
25
+ function assertEmbedPanels(panels) {
26
+ if (panels === void 0) return;
27
+ if (!Array.isArray(panels)) throw new TypeError("Embed panels must be an array.");
28
+ const seen = /* @__PURE__ */ new Set();
29
+ for (const panel of panels) {
30
+ if (!panel || typeof panel !== "object" || typeof panel.id !== "string") throw new TypeError("Every embed panel must be an object with an id.");
31
+ if (seen.has(panel.id)) throw new TypeError(`Duplicate embed panel id: ${panel.id}`);
32
+ seen.add(panel.id);
33
+ if (panel.position !== void 0 && ![
34
+ "left",
35
+ "right",
36
+ "bottom"
37
+ ].includes(panel.position)) throw new TypeError(`Invalid embed panel position: ${panel.position}`);
38
+ }
39
+ }
25
40
  const jsonResultFormats = new Set([
26
41
  "digraph",
27
42
  "xstate-json",
@@ -114,6 +129,7 @@ function createPendingExportManager(sendRetrieve) {
114
129
  function toInitMessage(options) {
115
130
  assertEmbedDocuments(options.documents);
116
131
  assertEmbedExamples(options.examples);
132
+ assertEmbedPanels(options.panels);
117
133
  if ("machines" in options) return {
118
134
  type: "@statelyai.project.init",
119
135
  machines: options.machines,
@@ -125,9 +141,7 @@ function toInitMessage(options) {
125
141
  depth: options.depth,
126
142
  capabilities: options.capabilities,
127
143
  examples: options.examples,
128
- leftPanels: options.panels?.leftPanels,
129
- rightPanels: options.panels?.rightPanels,
130
- activePanels: options.panels?.activePanels,
144
+ panels: options.panels,
131
145
  commentsByMachineId: options.commentsByMachineId,
132
146
  projectWorkspace: options.projectWorkspace,
133
147
  projectWorkspaceOpen: options.projectWorkspaceOpen,
@@ -148,9 +162,7 @@ function toInitMessage(options) {
148
162
  depth: options.depth,
149
163
  capabilities: options.capabilities,
150
164
  examples: options.examples,
151
- leftPanels: options.panels?.leftPanels,
152
- rightPanels: options.panels?.rightPanels,
153
- activePanels: options.panels?.activePanels,
165
+ panels: options.panels,
154
166
  comments: options.comments,
155
167
  sourceLocations: options.sourceLocations,
156
168
  settings: options.settings,
@@ -352,7 +364,7 @@ function createWebSocketTransport(options) {
352
364
 
353
365
  //#endregion
354
366
  //#region src/version.ts
355
- const SDK_VERSION = "0.26.3";
367
+ const SDK_VERSION = "0.27.1";
356
368
  function inspectionRuntime() {
357
369
  if (typeof window !== "undefined") return "browser";
358
370
  if (typeof process !== "undefined" && process.versions?.node) return "node";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statelyai/sdk",
3
- "version": "0.26.3",
3
+ "version": "0.27.1",
4
4
  "license": "MIT",
5
5
  "bin": {
6
6
  "stately-sdk": "./dist/bin.mjs"
@@ -93,8 +93,8 @@
93
93
  "jsdom": "^27.4.0",
94
94
  "tsdown": "0.21.0-beta.2",
95
95
  "vitest": "^3.2.4",
96
- "@statelyai/api-contract": "0.3.12",
97
- "@statelyai/graph-tools": "0.4.1"
96
+ "@statelyai/api-contract": "0.3.15",
97
+ "@statelyai/graph-tools": "0.6.0"
98
98
  },
99
99
  "engines": {
100
100
  "node": ">=22.4"
@@ -49,6 +49,8 @@
49
49
  "type": "array",
50
50
  "items": { "type": "string", "minLength": 1 }
51
51
  },
52
+ "matches": { "$ref": "#/$defs/jsonObject" },
53
+ "context": { "$ref": "#/$defs/jsonValue" },
52
54
  "guard": { "$ref": "#/$defs/guardObject" },
53
55
  "actions": {
54
56
  "type": "array",
@@ -56,13 +58,35 @@
56
58
  },
57
59
  "reenter": { "type": "boolean" },
58
60
  "meta": { "$ref": "#/$defs/jsonObject" },
59
- "description": { "type": "string" }
61
+ "description": { "type": "string" },
62
+ "input": { "$ref": "#/$defs/jsonValue" }
60
63
  }
61
64
  },
62
65
  "transitionArray": {
63
66
  "type": "array",
64
67
  "items": { "$ref": "#/$defs/transitionObject" }
65
68
  },
69
+ "choiceObject": {
70
+ "type": "object",
71
+ "additionalProperties": false,
72
+ "required": ["target"],
73
+ "properties": {
74
+ "target": {
75
+ "type": "array",
76
+ "items": { "type": "string", "minLength": 1 }
77
+ },
78
+ "when": { "$ref": "#/$defs/guardObject" },
79
+ "context": { "$ref": "#/$defs/jsonValue" },
80
+ "input": { "$ref": "#/$defs/jsonValue" },
81
+ "description": { "type": "string" },
82
+ "reenter": { "type": "boolean" },
83
+ "meta": { "$ref": "#/$defs/jsonObject" }
84
+ }
85
+ },
86
+ "choiceArray": {
87
+ "type": "array",
88
+ "items": { "$ref": "#/$defs/choiceObject" }
89
+ },
66
90
  "transitionsByEvent": {
67
91
  "type": "object",
68
92
  "additionalProperties": { "$ref": "#/$defs/transitionArray" }
@@ -73,12 +97,14 @@
73
97
  "required": ["src"],
74
98
  "properties": {
75
99
  "id": { "type": "string" },
76
- "systemId": { "type": "string" },
100
+ "registryKey": { "type": "string" },
77
101
  "src": { "type": "string", "minLength": 1 },
78
102
  "input": { "$ref": "#/$defs/jsonValue" },
79
103
  "onDone": { "$ref": "#/$defs/transitionArray" },
80
104
  "onError": { "$ref": "#/$defs/transitionArray" },
81
- "onSnapshot": { "$ref": "#/$defs/transitionArray" }
105
+ "onSnapshot": { "$ref": "#/$defs/transitionArray" },
106
+ "timeout": { "$ref": "#/$defs/jsonValue" },
107
+ "onTimeout": { "$ref": "#/$defs/transitionArray" }
82
108
  }
83
109
  },
84
110
  "stateNodeConfig": {
@@ -87,7 +113,7 @@
87
113
  "properties": {
88
114
  "id": { "type": "string" },
89
115
  "type": {
90
- "enum": ["atomic", "compound", "parallel", "final", "history"]
116
+ "enum": ["atomic", "compound", "parallel", "final", "history", "choice"]
91
117
  },
92
118
  "history": {
93
119
  "anyOf": [
@@ -113,10 +139,15 @@
113
139
  "items": { "$ref": "#/$defs/actionObject" }
114
140
  },
115
141
  "onDone": { "$ref": "#/$defs/transitionArray" },
142
+ "onError": { "$ref": "#/$defs/transitionArray" },
143
+ "onTimeout": { "$ref": "#/$defs/transitionArray" },
116
144
  "after": { "$ref": "#/$defs/transitionsByEvent" },
117
145
  "always": { "$ref": "#/$defs/transitionArray" },
146
+ "choice": { "$ref": "#/$defs/choiceArray" },
118
147
  "meta": { "$ref": "#/$defs/jsonObject" },
119
148
  "output": { "$ref": "#/$defs/jsonValue" },
149
+ "timeout": { "$ref": "#/$defs/jsonValue" },
150
+ "route": { "$ref": "#/$defs/jsonValue" },
120
151
  "order": { "type": "number" },
121
152
  "tags": {
122
153
  "type": "array",
@@ -133,7 +164,7 @@
133
164
  "properties": {
134
165
  "id": { "type": "string" },
135
166
  "type": {
136
- "enum": ["atomic", "compound", "parallel", "final", "history"]
167
+ "enum": ["atomic", "compound", "parallel", "final", "history", "choice"]
137
168
  },
138
169
  "history": {
139
170
  "anyOf": [
@@ -159,10 +190,15 @@
159
190
  "items": { "$ref": "#/$defs/actionObject" }
160
191
  },
161
192
  "onDone": { "$ref": "#/$defs/transitionArray" },
193
+ "onError": { "$ref": "#/$defs/transitionArray" },
194
+ "onTimeout": { "$ref": "#/$defs/transitionArray" },
162
195
  "after": { "$ref": "#/$defs/transitionsByEvent" },
163
196
  "always": { "$ref": "#/$defs/transitionArray" },
197
+ "choice": { "$ref": "#/$defs/choiceArray" },
164
198
  "meta": { "$ref": "#/$defs/jsonObject" },
165
199
  "output": { "$ref": "#/$defs/jsonValue" },
200
+ "timeout": { "$ref": "#/$defs/jsonValue" },
201
+ "route": { "$ref": "#/$defs/jsonValue" },
166
202
  "order": { "type": "number" },
167
203
  "tags": {
168
204
  "type": "array",