yaml-flow 8.1.1 → 8.2.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 (108) 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 -6
  4. package/cli/{board-live-cards-lib-tjYsPt5U.d.ts → board-live-cards-lib-Iq_XAC09.d.ts} +1 -1
  5. package/cli/browser-api/board-live-cards-browser-adapter.d.ts +4 -3
  6. package/cli/browser-api/board-live-cards-browser-adapter.js +2 -2
  7. package/cli/browser-api/card-store-browser-api.d.ts +1 -1
  8. package/cli/node/artifacts-store-cli.js +8 -8
  9. package/cli/node/board-live-cards-cli.js +8 -8
  10. package/cli/node/card-store-cli.js +4 -4
  11. package/cli/node/fs-board-adapter.d.ts +6 -33
  12. package/cli/node/fs-board-adapter.js +10 -8
  13. package/cli/node/step-machine-cli.js +3 -3
  14. package/cli/{types-D2XnLbBj.d.ts → types--rXGWbSR.d.ts} +77 -5
  15. package/examples/board/.board-ws/cards/store/_index.json +17 -0
  16. package/examples/board/.board-ws/cards/store/card-market-prices.json +80 -0
  17. package/examples/board/.board-ws/cards/store/card-portfolio-value.json +90 -0
  18. package/examples/board/.board-ws/cards/store/card-portfolio.json +78 -0
  19. package/examples/board/cards/cardT-market-prices.json +6 -4
  20. package/examples/board/cards/cardT-portfolio-value.json +10 -38
  21. package/examples/board/cards/cardT-portfolio.json +9 -4
  22. package/examples/board/demo-shell-with-server.html +3 -3
  23. package/examples/board/server/board-server.js +593 -0
  24. package/examples/board/server/board-worker/source-def-flows/mock-handler/mock-db.js +13 -0
  25. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/.retain/compliance.db +0 -0
  26. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/.retain/optimus.db +0 -0
  27. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/query.cjs +51 -0
  28. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/seed-cpm.cjs +197 -0
  29. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/seed-cpmV2.cjs +128 -0
  30. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/seed-optimus.cjs +352 -0
  31. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/sqlite-config.json +3 -0
  32. package/examples/board/server/board-worker/source-def-flows/sqlite-handler/sqlite-handler.js +84 -0
  33. package/examples/board/{source-def-flows/url.flow.json → server/board-worker/source-def-flows/sqlite.flow.json} +7 -7
  34. package/examples/board/{source-def-handlers → server/board-worker/source-def-flows/url-handler}/http-source-handler.js +29 -21
  35. package/examples/board/server/board-worker/source-def-flows/url.flow.json +73 -0
  36. package/examples/board/{source_def_flows.json → server/board-worker/source_def_flows.json} +61 -115
  37. package/examples/board/server/board-worker/task-executor.js +475 -0
  38. package/examples/board/server/chat-flow/chat-clear-processing.js +41 -0
  39. package/examples/board/server/chat-flow/chat-open-turn.js +144 -0
  40. package/examples/board/server/chat-flow/chat-write-assistant.js +44 -0
  41. package/examples/board/server/chat-flow/copilot-chat/assistant.js +253 -0
  42. package/examples/board/server/chat-flow/echo-probe/assistant.js +28 -0
  43. package/examples/board/server/chat-flow/flow-steps.json +167 -0
  44. package/examples/board/server-config.json +22 -0
  45. package/examples/board/test/server-http-test.js +707 -0
  46. package/examples/board/test/{portfolio-tracker-sse-worker.js → sse-worker.js} +9 -8
  47. package/examples/board-local/demo-shell-localstorage.html +3 -3
  48. package/lib/{artifacts-store-lib-public-DBICnGL6.d.cts → artifacts-store-lib-public-C5UL5tyG.d.cts} +3 -31
  49. package/lib/{artifacts-store-lib-public-BWC3YuLa.d.ts → artifacts-store-lib-public-GD4H-fFp.d.ts} +3 -31
  50. package/lib/artifacts-store-public.d.cts +3 -3
  51. package/lib/artifacts-store-public.d.ts +3 -3
  52. package/lib/board-live-cards-node.cjs +10 -8
  53. package/lib/board-live-cards-node.d.cts +9 -8
  54. package/lib/board-live-cards-node.d.ts +9 -8
  55. package/lib/board-live-cards-node.js +10 -8
  56. package/lib/{board-live-cards-public-BF9FP0mL.d.cts → board-live-cards-public-BLXbcBNk.d.cts} +2 -2
  57. package/lib/{board-live-cards-public-dJAl5IL-.d.ts → board-live-cards-public-BZaNb2mi.d.ts} +2 -2
  58. package/lib/board-live-cards-public.cjs +2 -2
  59. package/lib/board-live-cards-public.d.cts +2 -2
  60. package/lib/board-live-cards-public.d.ts +2 -2
  61. package/lib/board-live-cards-public.js +2 -2
  62. package/lib/board-live-cards-server-runtime.cjs +4 -6
  63. package/lib/board-live-cards-server-runtime.d.cts +3 -3
  64. package/lib/board-live-cards-server-runtime.d.ts +3 -3
  65. package/lib/board-live-cards-server-runtime.js +4 -6
  66. package/lib/board-livegraph-runtime/index.cjs +2 -2
  67. package/lib/board-livegraph-runtime/index.js +2 -2
  68. package/lib/card-store-public.d.cts +2 -2
  69. package/lib/card-store-public.d.ts +2 -2
  70. package/lib/execution-refs.cjs +1 -1
  71. package/lib/execution-refs.js +1 -1
  72. package/lib/index.cjs +1 -1
  73. package/lib/index.d.cts +1 -1
  74. package/lib/index.d.ts +1 -1
  75. package/lib/index.js +1 -1
  76. package/lib/server-runtime/index.cjs +4 -6
  77. package/lib/server-runtime/index.d.cts +4 -4
  78. package/lib/server-runtime/index.d.ts +4 -4
  79. package/lib/server-runtime/index.js +4 -6
  80. package/lib/step-machine-public/index.cjs +3 -3
  81. package/lib/step-machine-public/index.d.cts +27 -10
  82. package/lib/step-machine-public/index.d.ts +27 -10
  83. package/lib/step-machine-public/index.js +3 -3
  84. package/lib/{storage-interface-BhAON-gW.d.ts → storage-interface-B6ecOulj.d.cts} +25 -3
  85. package/lib/{storage-interface-BhAON-gW.d.cts → storage-interface-B6ecOulj.d.ts} +25 -3
  86. package/lib/stores/index.d.cts +1 -1
  87. package/lib/stores/index.d.ts +1 -1
  88. package/lib/stores/kv.d.cts +1 -1
  89. package/lib/stores/kv.d.ts +1 -1
  90. package/lib/{types-CXBzvC0s.d.cts → types-Bztd1KoK.d.cts} +75 -3
  91. package/lib/{types-D48hpnTR.d.ts → types-D-xVWPdY.d.ts} +75 -3
  92. package/package.json +1 -1
  93. package/examples/board/demo-chat-handler.js +0 -169
  94. package/examples/board/demo-server-config.json +0 -10
  95. package/examples/board/demo-server.js +0 -580
  96. package/examples/board/demo-task-executor.js +0 -721
  97. package/examples/board/gandalf-cards/card-source-kinds.json +0 -36
  98. package/examples/board/gandalf-cards/cards/_index.json +0 -7
  99. package/examples/board/gandalf-cards/cards/card-source-kinds.json +0 -64
  100. package/examples/board/scripts/copilot_wrapper.bat +0 -157
  101. package/examples/board/scripts/copilot_wrapper_helper.ps1 +0 -190
  102. package/examples/board/scripts/workiq_wrapper.mjs +0 -66
  103. package/examples/board/source-def-flows/copilot.flow.json +0 -33
  104. package/examples/board/source-def-flows/url-list.flow.json +0 -33
  105. package/examples/board/source-def-flows/workiq.flow.json +0 -34
  106. package/examples/board/source-def-handlers/copilot-source-handler.js +0 -141
  107. package/examples/board/test/demo-http-test.js +0 -317
  108. /package/examples/board/{source-def-flows → server/board-worker/source-def-flows}/mock.flow.json +0 -0
@@ -1,169 +0,0 @@
1
- /**
2
- * demo-chat-handler.js - Chat handler for example-board.
3
- *
4
- * Invoked by reusable-server-runtime after a user message is persisted:
5
- * node demo-chat-handler.js --boardId <id> --cardId <id> --extraEncJson <base64json>
6
- *
7
- * extraEncJson decodes to:
8
- * boardSetupRoot — absolute path to board root (parent of runtime/, surface/, runtime-out/)
9
- * boardRuntimeDir — relative subdir: 'runtime'
10
- * runtimeStatusDir— relative subdir: 'runtime-out'
11
- * cardsDir — relative subdir: 'surface/tmp-cards'
12
- * chatDir — absolute path to the card's chats directory
13
- * chatProcessingMarkerKey — relative marker key in chats artifacts store (e.g. 'card-portfolio/.processing')
14
- * lastChatFile — filename of the just-written user message, e.g. '001_user.txt'
15
- * serverUrl — base URL of hosting server (e.g. http://127.0.0.1:7799), optional
16
- *
17
- * Invokes copilot_wrapper.bat with a prompt built from conversation history.
18
- * Session dir is per-card: os.tmpdir()/demo-chat-handler-sessions/<boardId>_<cardId>
19
- */
20
-
21
- import * as fs from 'node:fs';
22
- import * as path from 'node:path';
23
- import * as os from 'node:os';
24
- import { spawnSync } from 'node:child_process';
25
- import { fileURLToPath } from 'node:url';
26
-
27
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
28
-
29
- // ---------------------------------------------------------------------------
30
- // Args
31
- // ---------------------------------------------------------------------------
32
- const args = process.argv.slice(2);
33
- function getArg(name) {
34
- const idx = args.indexOf(name);
35
- return idx !== -1 && args[idx + 1] !== undefined ? args[idx + 1] : null;
36
- }
37
-
38
- const boardId = getArg('--boardId') || '';
39
- const cardId = getArg('--cardId') || '';
40
- const extraStr = getArg('--extraEncJson') || '';
41
-
42
- let extra = {};
43
- try { extra = JSON.parse(Buffer.from(extraStr, 'base64').toString('utf-8')); }
44
- catch { console.error('[demo-chat-handler] bad --extraEncJson'); process.exit(0); }
45
-
46
- const { boardSetupRoot, boardRuntimeDir, runtimeStatusDir, cardsDir, chatDir, chatProcessingMarkerKey, lastChatFile, serverUrl } = extra;
47
- if (!boardSetupRoot || !chatDir || !lastChatFile) {
48
- console.error('[demo-chat-handler] missing boardSetupRoot/chatDir/lastChatFile');
49
- process.exit(0);
50
- }
51
-
52
- // Resolve absolute paths from the structured extra fields
53
- const boardRuntimeDirAbs = path.join(boardSetupRoot, boardRuntimeDir || 'runtime');
54
- const runtimeStatusDirAbs = path.join(boardSetupRoot, runtimeStatusDir || 'runtime-out');
55
- const cardsDirAbs = path.join(boardSetupRoot, cardsDir || path.join('surface', 'tmp-cards'));
56
- const chatDirAbs = chatDir;
57
-
58
- // ---------------------------------------------------------------------------
59
- // Read conversation history
60
- // ---------------------------------------------------------------------------
61
- function readHistory(dir) {
62
- try {
63
- return fs.readdirSync(dir)
64
- .filter(f => /^\d+[-_](user|assistant)\.txt$/i.test(f))
65
- .sort()
66
- .map(f => {
67
- const role = /user/i.test(f) ? 'User' : 'Assistant';
68
- let text = '';
69
- try { text = fs.readFileSync(path.join(dir, f), 'utf-8').trim(); } catch {}
70
- return role + ': ' + text;
71
- });
72
- } catch { return []; }
73
- }
74
-
75
- // ---------------------------------------------------------------------------
76
- // Build prompt
77
- // ---------------------------------------------------------------------------
78
- function buildPrompt(cId, bId, history, responseFileRel) {
79
- const cardSetupDirRel = path.join(cardsDir, cId).replace(/\\/g, '/');
80
- const runtimeDirRel = boardRuntimeDir || 'runtime';
81
- const statusDirRel = runtimeStatusDir || 'runtime-out';
82
- const chatDirRel = path.relative(boardSetupRoot, chatDir).replace(/\\/g, '/');
83
- const lastQueryFileRel = path.join(chatDirRel, lastChatFile).replace(/\\/g, '/');
84
-
85
- const contextBlock = [
86
- 'We are currently doing a three way orchestration.',
87
- 'You are the responder who has context of the cards in ' + cardSetupDirRel + ',',
88
- 'card runtime statuses in ' + runtimeDirRel + ',',
89
- 'and computed outputs in ' + statusDirRel + '.',
90
- 'I am just a mediator passing on the query.',
91
- 'The user sees the data available in cards which is rendered, and the status from ' + statusDirRel + '.',
92
- 'Everything else is internal detail not to be exposed to the user.',
93
- 'The conversation history can be found in ' + chatDirRel + ' and the last query is in ' + lastQueryFileRel + '.',
94
- 'Write your response to the user in ' + responseFileRel + ' (relative to your working directory).',
95
- 'Give me only a bare minimum log line on what you did — the response in ' + responseFileRel + ' is what the user will see.',
96
- ].join(' ');
97
-
98
- return [
99
- contextBlock,
100
- '',
101
- ...history,
102
- 'Assistant:',
103
- ].join('\n');
104
- }
105
-
106
- // ---------------------------------------------------------------------------
107
- // Invoke copilot_wrapper.bat
108
- // ---------------------------------------------------------------------------
109
- function runWrapper(prompt, sessionDir, workingDir) {
110
- const wrapperPath = path.join(__dirname, 'scripts', 'copilot_wrapper.bat');
111
- const tmpBase = os.tmpdir();
112
- const ts = Date.now();
113
- const outFile = path.join(tmpBase, 'dch-out-' + cardId + '-' + ts + '.txt');
114
- const promptFile = path.join(tmpBase, 'dch-prompt-' + cardId + '-' + ts + '.txt');
115
-
116
- fs.mkdirSync(sessionDir, { recursive: true });
117
- fs.writeFileSync(promptFile, prompt, 'utf-8');
118
-
119
- try {
120
- spawnSync('cmd.exe', [
121
- '/c', wrapperPath,
122
- outFile,
123
- sessionDir,
124
- workingDir,
125
- '@' + promptFile,
126
- 'raw',
127
- 'demo-chat',
128
- ], { stdio: 'inherit', timeout: 120000 });
129
-
130
- return fs.existsSync(outFile) ? fs.readFileSync(outFile, 'utf-8').trim() : '';
131
- } finally {
132
- try { fs.unlinkSync(promptFile); } catch {}
133
- try { fs.unlinkSync(outFile); } catch {}
134
- }
135
- }
136
-
137
- // ---------------------------------------------------------------------------
138
- // Main
139
- // ---------------------------------------------------------------------------
140
- const serialMatch = String(lastChatFile).match(/^(\d+)/);
141
- const nextSerial = serialMatch ? parseInt(serialMatch[1], 10) + 1 : 1;
142
- const nextName = String(nextSerial).padStart(3, '0') + '-assistant.txt';
143
- const responseFileRel = path.relative(boardSetupRoot, path.join(chatDir, nextName)).replace(/\\/g, '/');
144
-
145
- const history = readHistory(chatDirAbs);
146
- const sessionDir = path.join(os.tmpdir(), 'demo-chat-handler-sessions', boardId + '_' + cardId);
147
- const workingDir = boardSetupRoot;
148
- const prompt = buildPrompt(cardId, boardId, history, responseFileRel);
149
-
150
- try {
151
- runWrapper(prompt, sessionDir, workingDir);
152
- console.log('[demo-chat-handler] cardId="' + cardId + '" copilot invoked, response expected at ' + responseFileRel);
153
- } catch (err) {
154
- console.error('[demo-chat-handler] wrapper failed: ' + (err?.message ?? err));
155
- } finally {
156
- cleanupProcessingMarker();
157
- }
158
- function cleanupProcessingMarker() {
159
- // Prefer artifacts-style marker key from extra payload so runtime/handler contract
160
- // does not rely on passing an absolute file path argument.
161
- if (chatProcessingMarkerKey) {
162
- try {
163
- const markerPath = path.join(cardsDirAbs, chatProcessingMarkerKey);
164
- fs.unlinkSync(markerPath);
165
- return;
166
- } catch {}
167
- }
168
- try { fs.unlinkSync(path.join(chatDirAbs, '.processing')); } catch {}
169
- }
@@ -1,10 +0,0 @@
1
- {
2
- "port": 7799,
3
- "cardsDir": "./cards",
4
- "taskExecutorPath": "./demo-task-executor.js",
5
- "chatHandlerPath": "./demo-chat-handler.js",
6
- "chatSessionsDir": "",
7
- "gandalfCardsDir": "./gandalf-cards",
8
- "gandalfTaskExecutorPath": "./demo-task-executor.js",
9
- "gandalfChatHandlerPath": "./demo-chat-handler.js"
10
- }