yaml-flow 8.2.5 → 8.3.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.
Files changed (73) hide show
  1. package/browser/asset-integrity.json +3 -3
  2. package/browser/board-livecards-client.js +1 -1
  3. package/browser/board-livecards-localstorage.js +4 -4
  4. package/browser/live-cards.js +19 -19
  5. package/cli/{board-live-cards-lib-Iq_XAC09.d.ts → board-live-cards-lib-tjYsPt5U.d.ts} +1 -1
  6. package/cli/browser-api/board-live-cards-browser-adapter.d.ts +3 -3
  7. package/cli/browser-api/card-store-browser-api.d.ts +1 -1
  8. package/cli/{execution-interface-ftO1W7Po.d.ts → execution-interface-CrG5gzAx.d.ts} +116 -2
  9. package/cli/node/batch-runner-cli.d.ts +3 -0
  10. package/cli/node/batch-runner-cli.js +2 -1
  11. package/cli/node/board-live-cards-cli.js +9 -9
  12. package/cli/node/chat-store-cli.d.ts +23 -0
  13. package/cli/node/chat-store-cli.js +8 -0
  14. package/cli/node/execution-adapter.d.ts +4 -2
  15. package/cli/node/execution-adapter.js +2 -2
  16. package/cli/node/fs-board-adapter.d.ts +7 -6
  17. package/cli/node/fs-board-adapter.js +8 -8
  18. package/cli/node/source-cli-task-executor.js +4 -4
  19. package/cli/node/step-machine-cli.js +3 -3
  20. package/cli/{types--rXGWbSR.d.ts → types-PUfPBxc_.d.ts} +4 -109
  21. package/examples/board/demo-shell-with-server.html +3 -196
  22. package/examples/board/doc.html +465 -0
  23. package/examples/board/server/board-server.js +20 -81
  24. package/examples/board/server/board-worker/source_def_flows.json +2 -2
  25. package/examples/board/server/chat-flow/copilot-chat/assistant.js +44 -185
  26. package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper.bat +157 -0
  27. package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper_helper.ps1 +190 -0
  28. package/examples/board/server/chat-flow/flow-steps.json +122 -56
  29. package/examples/board/test/server-http-test.js +252 -220
  30. package/examples/board-local/demo-shell-localstorage.html +3 -3
  31. package/lib/{artifacts-store-lib-public-C5UL5tyG.d.cts → artifacts-store-lib-public-Cz8-kdXG.d.cts} +1 -1
  32. package/lib/{artifacts-store-lib-public-GD4H-fFp.d.ts → artifacts-store-lib-public-ksGIExhc.d.ts} +1 -1
  33. package/lib/artifacts-store-public.d.cts +2 -2
  34. package/lib/artifacts-store-public.d.ts +2 -2
  35. package/lib/board-live-cards-node.cjs +8 -8
  36. package/lib/board-live-cards-node.d.cts +26 -6
  37. package/lib/board-live-cards-node.d.ts +26 -6
  38. package/lib/board-live-cards-node.js +8 -8
  39. package/lib/{board-live-cards-public-BLXbcBNk.d.cts → board-live-cards-public-BwZYGAsF.d.cts} +1 -1
  40. package/lib/{board-live-cards-public-BZaNb2mi.d.ts → board-live-cards-public-DWpZVDXN.d.ts} +1 -1
  41. package/lib/board-live-cards-public.d.cts +1 -1
  42. package/lib/board-live-cards-public.d.ts +1 -1
  43. package/lib/board-live-cards-server-runtime.cjs +3 -3
  44. package/lib/board-live-cards-server-runtime.d.cts +3 -2
  45. package/lib/board-live-cards-server-runtime.d.ts +3 -2
  46. package/lib/board-live-cards-server-runtime.js +3 -3
  47. package/lib/board-worker-adapter.cjs +2 -2
  48. package/lib/board-worker-adapter.js +2 -2
  49. package/lib/card-store-public.d.cts +1 -1
  50. package/lib/card-store-public.d.ts +1 -1
  51. package/lib/chat-storage-lib-BK5Njslc.d.ts +53 -0
  52. package/lib/chat-storage-lib-C5bQ7bGe.d.cts +53 -0
  53. package/lib/chat-store-public.cjs +2 -0
  54. package/lib/chat-store-public.d.cts +128 -0
  55. package/lib/chat-store-public.d.ts +128 -0
  56. package/lib/chat-store-public.js +2 -0
  57. package/lib/execution-refs.d.cts +10 -1
  58. package/lib/execution-refs.d.ts +10 -1
  59. package/lib/server-runtime/index.cjs +3 -3
  60. package/lib/server-runtime/index.d.cts +4 -3
  61. package/lib/server-runtime/index.d.ts +4 -3
  62. package/lib/server-runtime/index.js +3 -3
  63. package/lib/{types-Bztd1KoK.d.cts → types-D9B0Vrwg.d.cts} +4 -53
  64. package/lib/{types-D-xVWPdY.d.ts → types-DNYhCFNJ.d.ts} +4 -53
  65. package/package.json +8 -2
  66. package/examples/board/.board-ws/cards/store/_index.json +0 -17
  67. package/examples/board/.board-ws/cards/store/card-market-prices.json +0 -80
  68. package/examples/board/.board-ws/cards/store/card-portfolio-value.json +0 -90
  69. package/examples/board/.board-ws/cards/store/card-portfolio.json +0 -78
  70. package/examples/board/server/chat-flow/chat-clear-processing.js +0 -41
  71. package/examples/board/server/chat-flow/chat-open-turn.js +0 -144
  72. package/examples/board/server/chat-flow/chat-write-assistant.js +0 -44
  73. package/examples/board/server/chat-flow/echo-probe/assistant.js +0 -28
@@ -1,28 +1,75 @@
1
1
  {
2
2
  "id": "chat-flow-steps",
3
3
  "settings": {
4
- "start_step": "open_turn",
4
+ "start_step": "read_chats",
5
5
  "max_total_steps": 10,
6
6
  "timeout_ms": 300000
7
7
  },
8
8
  "steps": {
9
- "open_turn": {
10
- "description": "Resolve the current user turn from the HTTP chat API and parse any chat envelope options",
11
- "produces_data": ["boardId", "cardId", "boardSetupRoot", "boardRuntimeDir", "runtimeStatusDir", "cardsDir", "projectRoot", "chatFlowRoot", "userText", "serverUrl", "apiBasePath", "lastChatEntryId", "probe", "chatHandlerMode", "chatCopilotTimeoutMs", "chatTimeMs"],
9
+ "read_chats": {
10
+ "description": "Read chats from runtime storage via chat-store-cli and pass them through the flow",
11
+ "expects_data": ["boardSetupRoot", "boardRuntimeDir", "cardId"],
12
+ "produces_data": ["chatMessages"],
12
13
  "input_validations": [
13
- "$type(cardId) = \"string\" and $length(cardId) > 0",
14
- "$type(serverUrl) = \"string\" and $length(serverUrl) > 0",
15
- "$type(apiBasePath) = \"string\" and $length(apiBasePath) > 0",
16
- "$type(lastChatEntryId) = \"string\" and $length(lastChatEntryId) > 0"
14
+ "$type(boardSetupRoot) = \"string\" and $length(boardSetupRoot) > 0",
15
+ "$type(cardId) = \"string\" and $length(cardId) > 0"
17
16
  ],
18
17
  "handler": {
19
18
  "type": "ref",
20
19
  "howToRun": "local-node",
21
20
  "whatToRun": {
22
- "kind": "fs-path",
23
- "value": "./server/chat-flow/chat-open-turn.js"
21
+ "kind": "yaml-flow-cli",
22
+ "value": "chat-store-cli.js"
24
23
  },
25
- "meta": "chat-handler"
24
+ "meta": "chat-handler",
25
+ "argsMassaging": {
26
+ "stdinTemplate": "{ 'command': 'read-all', 'boardDir': boardSetupRoot & '/' & boardRuntimeDir, 'cardId': cardId }"
27
+ },
28
+ "outputTransforms": {
29
+ "dataTemplate": "{ 'chatMessages': output.data.records }"
30
+ }
31
+ },
32
+ "transitions": {
33
+ "success": "open_turn",
34
+ "failure": "cleanup_failure",
35
+ "error": "cleanup_failure"
36
+ }
37
+ },
38
+ "open_turn": {
39
+ "description": "Resolve the current user turn from flow-provided chat messages and parse any chat envelope options",
40
+ "produces_data": ["boardId", "cardId", "boardSetupRoot", "boardRuntimeDir", "runtimeStatusDir", "cardsDir", "projectRoot", "chatFlowRoot", "chatMessages", "userText", "lastChatEntryId", "probe", "chatHandlerMode", "chatCopilotTimeoutMs"],
41
+ "input_validations": [
42
+ "$type(cardId) = \"string\" and $length(cardId) > 0",
43
+ "$type(chatMessages) = \"array\"",
44
+ "$type(lastChatEntryId) = \"string\" and $length(lastChatEntryId) > 0",
45
+ "$count($filter(chatMessages, function($message) { $message.id = lastChatEntryId and $message.role = \"user\" and $type($message.text) = \"string\" and $length($trim($message.text)) > 0 })) > 0"
46
+ ],
47
+ "handler": {
48
+ "type": "compute-jsonata",
49
+ "expr": [
50
+ "data.boardId = $type(expects_data.boardId) = \"string\" ? expects_data.boardId : \"\"",
51
+ "data.cardId = $type(expects_data.cardId) = \"string\" ? expects_data.cardId : \"\"",
52
+ "data.boardSetupRoot = $type(expects_data.boardSetupRoot) = \"string\" ? expects_data.boardSetupRoot : \"\"",
53
+ "data.boardRuntimeDir = ($type(expects_data.boardRuntimeDir) = \"string\" and $length(expects_data.boardRuntimeDir) > 0) ? expects_data.boardRuntimeDir : \"runtime\"",
54
+ "data.runtimeStatusDir = ($type(expects_data.runtimeStatusDir) = \"string\" and $length(expects_data.runtimeStatusDir) > 0) ? expects_data.runtimeStatusDir : \"runtime-out\"",
55
+ "data.cardsDir = ($type(expects_data.cardsDir) = \"string\" and $length(expects_data.cardsDir) > 0) ? expects_data.cardsDir : \"cards\"",
56
+ "data.projectRoot = $type(expects_data.projectRoot) = \"string\" ? expects_data.projectRoot : \"\"",
57
+ "data.chatFlowRoot = $type(expects_data.chatFlowRoot) = \"string\" ? expects_data.chatFlowRoot : \"\"",
58
+ "data.chatMessages = expects_data.chatMessages",
59
+ "data.lastChatEntryId = expects_data.lastChatEntryId",
60
+ "data._rawMessageText = $trim($string($filter(expects_data.chatMessages, function($message) { $message.id = expects_data.lastChatEntryId and $message.role = \"user\" })[0].text))",
61
+ "data._marker = \"__probe__echo__probe__\"",
62
+ "data._markerLen = $length(data._marker)",
63
+ "data._isEchoProbe = $length(data._rawMessageText) >= (data._markerLen * 2) and $substring(data._rawMessageText, 0, data._markerLen) = data._marker and $substring(data._rawMessageText, $length(data._rawMessageText) - data._markerLen) = data._marker",
64
+ "data._hasLegacyEnvelope = $length(data._rawMessageText) >= 2 and $substring(data._rawMessageText, 0, 1) = \"{\" and $substring(data._rawMessageText, $length(data._rawMessageText) - 1) = \"}\" and $count($match(data._rawMessageText, /^\\s*\\{\\s*\"(prompt|text|userText|query|probe|chatHandlerMode|chatTimeoutMs|chatCopilotTimeoutMs)\"/)) > 0",
65
+ "data._legacyEnvelope = data._hasLegacyEnvelope ? $eval(data._rawMessageText) : null",
66
+ "data._legacyPrompt = ($type(data._legacyEnvelope.prompt) = \"string\" and $length($trim(data._legacyEnvelope.prompt)) > 0) ? data._legacyEnvelope.prompt : (($type(data._legacyEnvelope.text) = \"string\" and $length($trim(data._legacyEnvelope.text)) > 0) ? data._legacyEnvelope.text : (($type(data._legacyEnvelope.userText) = \"string\" and $length($trim(data._legacyEnvelope.userText)) > 0) ? data._legacyEnvelope.userText : (($type(data._legacyEnvelope.query) = \"string\" and $length($trim(data._legacyEnvelope.query)) > 0) ? data._legacyEnvelope.query : null)))",
67
+ "data.userText = data._isEchoProbe ? $trim($substring(data._rawMessageText, data._markerLen, $length(data._rawMessageText) - (data._markerLen * 2))) : (($type(data._legacyPrompt) = \"string\" and $length($trim(data._legacyPrompt)) > 0) ? $trim(data._legacyPrompt) : data._rawMessageText)",
68
+ "data.probe = data._isEchoProbe ? true : (data._legacyEnvelope.probe = true or data._legacyEnvelope.probe = 1 or ($type(data._legacyEnvelope.probe) = \"string\" and $count($filter([\"1\", \"true\", \"yes\", \"on\"], function($value) { $value = $lowercase($trim(data._legacyEnvelope.probe)) })) > 0))",
69
+ "data.chatHandlerMode = data._isEchoProbe ? \"echo-probe\" : (($type(data._legacyEnvelope.chatHandlerMode) = \"string\" and $length($trim(data._legacyEnvelope.chatHandlerMode)) > 0) ? $lowercase($trim(data._legacyEnvelope.chatHandlerMode)) : (data.probe ? \"probe\" : \"copilot\"))",
70
+ "data.chatCopilotTimeoutMs = ($parsePositiveInt := function($value) { ($type($value) = \"number\" and $value > 0) ? $floor($value) : (($type($value) = \"string\" and $count($match($trim($value), /^[0-9]+$/)) > 0 and $number($trim($value)) > 0) ? $floor($number($trim($value))) : null) }; $legacyTimeout := $parsePositiveInt(data._legacyEnvelope.chatTimeoutMs); $legacyCopilotTimeout := $parsePositiveInt(data._legacyEnvelope.chatCopilotTimeoutMs); $fallbackTimeout := $parsePositiveInt(expects_data.chatCopilotTimeoutMs); $legacyTimeout ? $legacyTimeout : ($legacyCopilotTimeout ? $legacyCopilotTimeout : ($fallbackTimeout ? $fallbackTimeout : 300000)))",
71
+ "result = \"success\""
72
+ ]
26
73
  },
27
74
  "transitions": {
28
75
  "success": "select_assistant",
@@ -37,7 +84,7 @@
37
84
  "handler": {
38
85
  "type": "compute-jsonata",
39
86
  "expr": [
40
- "data.selectedAssistant = (expects_data.probe = true or expects_data.probe = \"true\" or expects_data.probe = 1 or $lowercase($string(expects_data.chatHandlerMode)) = \"probe\") ? \"probe\" : \"copilot\"",
87
+ "data.selectedAssistant = (expects_data.probe = true or expects_data.probe = \"true\" or expects_data.probe = 1 or $lowercase($string(expects_data.chatHandlerMode)) = \"probe\" or $lowercase($string(expects_data.chatHandlerMode)) = \"echo-probe\") ? \"probe\" : \"copilot\"",
41
88
  "result = data.selectedAssistant"
42
89
  ]
43
90
  },
@@ -48,21 +95,19 @@
48
95
  "error": "cleanup_failure"
49
96
  }
50
97
  },
51
- "copilot_assistant": {
52
- "description": "Run the Copilot-backed assistant logic to generate the reply from the HTTP chat history",
53
- "expects_data": ["userText", "boardId", "cardId", "boardSetupRoot", "boardRuntimeDir", "runtimeStatusDir", "cardsDir", "projectRoot", "chatFlowRoot", "serverUrl", "apiBasePath", "lastChatEntryId", "chatCopilotTimeoutMs"],
54
- "produces_data": ["replyText"],
55
- "input_validations": [
56
- "$type(userText) = \"string\""
57
- ],
98
+ "probe_in_progress": {
99
+ "description": "Append a probe-only in-progress system message before generating the deterministic echo reply",
58
100
  "handler": {
59
101
  "type": "ref",
60
102
  "howToRun": "local-node",
61
103
  "whatToRun": {
62
- "kind": "fs-path",
63
- "value": "./server/chat-flow/copilot-chat/assistant.js"
104
+ "kind": "yaml-flow-cli",
105
+ "value": "chat-store-cli.js"
64
106
  },
65
- "meta": "chat-handler"
107
+ "meta": "chat-handler",
108
+ "argsMassaging": {
109
+ "stdinTemplate": "{ 'boardDir': boardSetupRoot & '/' & boardRuntimeDir, 'cardId': cardId, 'commands': [{ 'command': 'append', 'role': 'system', 'text': 'in-progress', 'files': [] }] }"
110
+ }
66
111
  },
67
112
  "transitions": {
68
113
  "success": "write_reply",
@@ -70,19 +115,24 @@
70
115
  "error": "cleanup_failure"
71
116
  }
72
117
  },
73
- "probe_assistant": {
74
- "description": "Run the deterministic echo assistant for probe and test flows",
75
- "expects_data": ["userText", "chatTimeMs"],
118
+ "copilot_assistant": {
119
+ "description": "Run the Copilot-backed assistant logic to generate the reply from the resolved chat history",
120
+ "expects_data": ["userText", "chatMessages", "boardId", "cardId", "boardSetupRoot", "boardRuntimeDir", "runtimeStatusDir", "cardsDir", "projectRoot", "chatFlowRoot", "chatCopilotTimeoutMs"],
76
121
  "produces_data": ["replyText"],
77
122
  "input_validations": [
78
- "$type(userText) = \"string\""
123
+ "$type(userText) = \"string\"",
124
+ "$type(chatMessages) = \"array\""
79
125
  ],
80
126
  "handler": {
81
127
  "type": "ref",
82
- "howToRun": "local-node",
128
+ "howToRun": "local-process",
83
129
  "whatToRun": {
84
- "kind": "fs-path",
85
- "value": "./server/chat-flow/echo-probe/assistant.js"
130
+ "kind": "process-name",
131
+ "value": "node"
132
+ },
133
+ "argsMassaging": {
134
+ "cmdTemplate": ["chatFlowRoot & '/copilot-chat/assistant.js'"],
135
+ "stdinTemplate": "{ 'cardId': cardId, 'boardSetupRoot': boardSetupRoot, 'boardRuntimeDir': boardRuntimeDir, 'runtimeStatusDir': runtimeStatusDir, 'cardsDir': cardsDir, 'chatMessages': chatMessages, 'userText': userText, 'chatCopilotTimeoutMs': chatCopilotTimeoutMs }"
86
136
  },
87
137
  "meta": "chat-handler"
88
138
  },
@@ -92,58 +142,74 @@
92
142
  "error": "cleanup_failure"
93
143
  }
94
144
  },
95
- "write_reply": {
96
- "description": "Append the assistant reply via the HTTP chat API and clear processing",
97
- "expects_data": ["serverUrl", "apiBasePath", "cardId", "replyText"],
98
- "produces_data": ["replyText", "replyId"],
145
+ "probe_assistant": {
146
+ "description": "Compute the deterministic echo assistant reply for echo-probe and test flows",
147
+ "expects_data": ["userText"],
148
+ "produces_data": ["replyText"],
99
149
  "input_validations": [
100
- "$type(serverUrl) = \"string\" and $length(serverUrl) > 0",
101
- "$type(apiBasePath) = \"string\" and $length(apiBasePath) > 0",
102
- "$type(cardId) = \"string\" and $length(cardId) > 0",
103
- "$type(replyText) = \"string\""
150
+ "$type(userText) = \"string\""
104
151
  ],
105
152
  "handler": {
106
- "type": "ref",
107
- "howToRun": "local-node",
108
- "whatToRun": {
109
- "kind": "fs-path",
110
- "value": "./server/chat-flow/chat-write-assistant.js"
111
- },
112
- "meta": "chat-handler"
153
+ "type": "compute-jsonata",
154
+ "expr": [
155
+ "data.replyText = \"Echo: \" & expects_data.userText",
156
+ "result = $contains($lowercase(expects_data.userText), \"simulate-failure\") ? \"failure\" : \"success\""
157
+ ]
113
158
  },
114
159
  "transitions": {
115
- "success": "cleanup_success",
160
+ "success": "probe_in_progress",
116
161
  "failure": "cleanup_failure",
117
162
  "error": "cleanup_failure"
118
163
  }
119
164
  },
120
- "cleanup_success": {
121
- "description": "Delete the processing marker after a successful assistant turn",
165
+ "write_reply": {
166
+ "description": "Append the assistant reply and clear processing via one chat-store-cli command envelope",
167
+ "expects_data": ["boardSetupRoot", "boardRuntimeDir", "cardId", "replyText"],
168
+ "produces_data": ["replyId"],
169
+ "input_validations": [
170
+ "$type(boardSetupRoot) = \"string\" and $length(boardSetupRoot) > 0",
171
+ "$type(cardId) = \"string\" and $length(cardId) > 0",
172
+ "$type(replyText) = \"string\""
173
+ ],
122
174
  "handler": {
123
175
  "type": "ref",
124
176
  "howToRun": "local-node",
125
177
  "whatToRun": {
126
- "kind": "fs-path",
127
- "value": "./server/chat-flow/chat-clear-processing.js"
178
+ "kind": "yaml-flow-cli",
179
+ "value": "chat-store-cli.js"
128
180
  },
129
- "meta": "chat-handler"
181
+ "meta": "chat-handler",
182
+ "argsMassaging": {
183
+ "stdinTemplate": "{ 'boardDir': boardSetupRoot & '/' & boardRuntimeDir, 'cardId': cardId, 'commands': [{ 'command': 'append', 'role': 'assistant', 'text': replyText, 'files': [] }, { 'command': 'set-processing', 'active': false }] }"
184
+ },
185
+ "outputTransforms": {
186
+ "dataTemplate": "{ 'replyId': output.data.results[0].data.id }"
187
+ }
130
188
  },
131
189
  "transitions": {
132
190
  "success": "completed",
133
- "failure": "failed",
134
- "error": "failed"
191
+ "failure": "cleanup_failure",
192
+ "error": "cleanup_failure"
135
193
  }
136
194
  },
137
195
  "cleanup_failure": {
138
- "description": "Best-effort processing marker cleanup after a failed assistant turn",
196
+ "description": "Write a failure system message and clear processing via one chat-store-cli command envelope",
197
+ "expects_data": ["boardSetupRoot", "boardRuntimeDir", "cardId"],
198
+ "input_validations": [
199
+ "$type(boardSetupRoot) = \"string\" and $length(boardSetupRoot) > 0",
200
+ "$type(cardId) = \"string\" and $length(cardId) > 0"
201
+ ],
139
202
  "handler": {
140
203
  "type": "ref",
141
204
  "howToRun": "local-node",
142
205
  "whatToRun": {
143
- "kind": "fs-path",
144
- "value": "./server/chat-flow/chat-clear-processing.js"
206
+ "kind": "yaml-flow-cli",
207
+ "value": "chat-store-cli.js"
145
208
  },
146
- "meta": "chat-handler"
209
+ "meta": "chat-handler",
210
+ "argsMassaging": {
211
+ "stdinTemplate": "{ 'boardDir': boardSetupRoot & '/' & boardRuntimeDir, 'cardId': cardId, 'commands': [{ 'command': 'append', 'role': 'system', 'text': 'AI response failed - the assistant could not generate a reply. Check server configuration and logs.', 'files': [] }, { 'command': 'set-processing', 'active': false }] }"
212
+ }
147
213
  },
148
214
  "transitions": {
149
215
  "success": "failed",