yaml-flow 8.2.4 → 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 (77) 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/browser-api/card-store-browser-api.js +1 -1
  9. package/cli/{execution-interface-ftO1W7Po.d.ts → execution-interface-CrG5gzAx.d.ts} +116 -2
  10. package/cli/node/batch-runner-cli.d.ts +3 -0
  11. package/cli/node/batch-runner-cli.js +2 -1
  12. package/cli/node/board-live-cards-cli.js +7 -7
  13. package/cli/node/card-store-cli.js +5 -5
  14. package/cli/node/chat-store-cli.d.ts +23 -0
  15. package/cli/node/chat-store-cli.js +8 -0
  16. package/cli/node/execution-adapter.d.ts +4 -2
  17. package/cli/node/execution-adapter.js +2 -2
  18. package/cli/node/fs-board-adapter.d.ts +7 -6
  19. package/cli/node/fs-board-adapter.js +8 -8
  20. package/cli/node/source-cli-task-executor.js +4 -4
  21. package/cli/node/step-machine-cli.js +3 -3
  22. package/cli/{types--rXGWbSR.d.ts → types-PUfPBxc_.d.ts} +4 -109
  23. package/examples/board/demo-shell-with-server.html +3 -3
  24. package/examples/board/doc.html +465 -0
  25. package/examples/board/server/board-server.js +20 -81
  26. package/examples/board/server/board-worker/source_def_flows.json +2 -2
  27. package/examples/board/server/chat-flow/copilot-chat/assistant.js +44 -185
  28. package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper.bat +157 -0
  29. package/examples/board/server/chat-flow/copilot-chat/copilot_wrapper_helper.ps1 +190 -0
  30. package/examples/board/server/chat-flow/flow-steps.json +122 -56
  31. package/examples/board/test/server-http-test.js +252 -220
  32. package/examples/board-local/demo-shell-localstorage.html +3 -3
  33. package/lib/{artifacts-store-lib-public-C5UL5tyG.d.cts → artifacts-store-lib-public-Cz8-kdXG.d.cts} +1 -1
  34. package/lib/{artifacts-store-lib-public-GD4H-fFp.d.ts → artifacts-store-lib-public-ksGIExhc.d.ts} +1 -1
  35. package/lib/artifacts-store-public.d.cts +2 -2
  36. package/lib/artifacts-store-public.d.ts +2 -2
  37. package/lib/board-live-cards-node.cjs +8 -8
  38. package/lib/board-live-cards-node.d.cts +26 -6
  39. package/lib/board-live-cards-node.d.ts +26 -6
  40. package/lib/board-live-cards-node.js +8 -8
  41. package/lib/{board-live-cards-public-BLXbcBNk.d.cts → board-live-cards-public-BwZYGAsF.d.cts} +1 -1
  42. package/lib/{board-live-cards-public-BZaNb2mi.d.ts → board-live-cards-public-DWpZVDXN.d.ts} +1 -1
  43. package/lib/board-live-cards-public.cjs +2 -2
  44. package/lib/board-live-cards-public.d.cts +1 -1
  45. package/lib/board-live-cards-public.d.ts +1 -1
  46. package/lib/board-live-cards-public.js +2 -2
  47. package/lib/board-live-cards-server-runtime.cjs +3 -3
  48. package/lib/board-live-cards-server-runtime.d.cts +3 -2
  49. package/lib/board-live-cards-server-runtime.d.ts +3 -2
  50. package/lib/board-live-cards-server-runtime.js +3 -3
  51. package/lib/board-worker-adapter.cjs +2 -2
  52. package/lib/board-worker-adapter.js +2 -2
  53. package/lib/card-store-public.d.cts +1 -1
  54. package/lib/card-store-public.d.ts +1 -1
  55. package/lib/chat-storage-lib-BK5Njslc.d.ts +53 -0
  56. package/lib/chat-storage-lib-C5bQ7bGe.d.cts +53 -0
  57. package/lib/chat-store-public.cjs +2 -0
  58. package/lib/chat-store-public.d.cts +128 -0
  59. package/lib/chat-store-public.d.ts +128 -0
  60. package/lib/chat-store-public.js +2 -0
  61. package/lib/execution-refs.d.cts +10 -1
  62. package/lib/execution-refs.d.ts +10 -1
  63. package/lib/server-runtime/index.cjs +3 -3
  64. package/lib/server-runtime/index.d.cts +4 -3
  65. package/lib/server-runtime/index.d.ts +4 -3
  66. package/lib/server-runtime/index.js +3 -3
  67. package/lib/{types-Bztd1KoK.d.cts → types-D9B0Vrwg.d.cts} +4 -53
  68. package/lib/{types-D-xVWPdY.d.ts → types-DNYhCFNJ.d.ts} +4 -53
  69. package/package.json +8 -2
  70. package/examples/board/.board-ws/cards/store/_index.json +0 -17
  71. package/examples/board/.board-ws/cards/store/card-market-prices.json +0 -80
  72. package/examples/board/.board-ws/cards/store/card-portfolio-value.json +0 -90
  73. package/examples/board/.board-ws/cards/store/card-portfolio.json +0 -78
  74. package/examples/board/server/chat-flow/chat-clear-processing.js +0 -41
  75. package/examples/board/server/chat-flow/chat-open-turn.js +0 -144
  76. package/examples/board/server/chat-flow/chat-write-assistant.js +0 -44
  77. package/examples/board/server/chat-flow/echo-probe/assistant.js +0 -28
@@ -318,4 +318,4 @@ interface BoardStatusObject {
318
318
  }
319
319
  declare const EMPTY_CONFIG: GraphConfig;
320
320
 
321
- export { BOARD_GRAPH_KEY as B, type CardAdminStore as C, EMPTY_CONFIG as E, type JournalStorageAdapter as J, type LiveCard as L, type OutputStoreEvent as O, SNAPSHOT_SCHEMA_VERSION_V1 as S, type BoardStatusObject as a, createCardStore as c };
321
+ export { type BoardStatusObject as B, type CardAdminStore as C, EMPTY_CONFIG as E, type JournalStorageAdapter as J, type LiveCard as L, type OutputStoreEvent as O, SNAPSHOT_SCHEMA_VERSION_V1 as S, BOARD_GRAPH_KEY as a, createCardStore as c };
@@ -1,6 +1,6 @@
1
- import { B as BoardPlatformAdapter, N as NotificationTransport, C as ChatStorage } from '../types--rXGWbSR.js';
2
- import { E as ExecutionRef } from '../execution-interface-ftO1W7Po.js';
3
- import '../board-live-cards-lib-Iq_XAC09.js';
1
+ import { B as BoardPlatformAdapter, N as NotificationTransport, C as ChatStorage } from '../types-PUfPBxc_.js';
2
+ import { E as ExecutionRef } from '../execution-interface-CrG5gzAx.js';
3
+ import '../board-live-cards-lib-tjYsPt5U.js';
4
4
 
5
5
  declare function createLocalStorageChatStorage(namespace: string): ChatStorage;
6
6
  interface InMemoryBus {
@@ -1,4 +1,4 @@
1
- import { L as LiveCard } from '../board-live-cards-lib-Iq_XAC09.js';
1
+ import { L as LiveCard } from '../board-live-cards-lib-tjYsPt5U.js';
2
2
 
3
3
  /**
4
4
  * card-store-browser-api.ts
@@ -1,2 +1,2 @@
1
- import {createRequire}from'module';import'ajv-formats';var C=createRequire(import.meta.url);C("./jsonata-sync.cjs");var v=createRequire(import.meta.url);v("./jsonata-sync.cjs");function y(n,o){function e(){return n.readIndex()??{}}function r(t,s,i){let a=String(s||"").split(".").filter(Boolean);if(a.length===0)return i&&typeof i=="object"&&!Array.isArray(i)?i:{value:i};let u={...t},c=u;for(let d=0;d<a.length-1;d++){let l=a[d],f=c[l],m=f&&typeof f=="object"&&!Array.isArray(f)?{...f}:{};c[l]=m,c=m;}return c[a[a.length-1]]=i,u}return {readCard(t){let s=e()[t];return !s||!n.cardExists(s.key)?null:n.readCard(s.key)},readCardKey(t){return e()[t]?.key??null},readAllCards(){let t=[];for(let[s,i]of Object.entries(e())){if(!n.cardExists(i.key))continue;let a=n.readCard(i.key);a?t.push(a):o?.(`[card-store] could not read card "${s}" at key "${i.key}"`);}return t},readChecksumIndex(){let t={};for(let[s,i]of Object.entries(e()))t[s]=i.checksum;return t},changedSince(t){let s=e(),i=[];for(let[a,u]of Object.entries(s))t[a]!==u.checksum&&i.push(a);for(let a of Object.keys(t))s[a]||i.push(a);return i},validateUpsert(t,s){let i=e(),a=i[t],u=Object.entries(i).find(([,c])=>c.key===s);return a&&a.key!==s?{ok:false,error:`Card id "${t}" is already mapped to key "${a.key}", cannot remap to "${s}"`}:u&&u[0]!==t?{ok:false,error:`Key "${s}" is already mapped to card id "${u[0]}", cannot remap to "${t}"`}:{ok:true}},writeCard(t,s,i){let a=e(),u=i??a[t]?.key??n.defaultCardKey(t),c=n.writeCard(u,s);a[t]={key:u,checksum:c,updatedAt:new Date().toISOString()},n.writeIndex(a);},patchCard(t,s,i){let a=e(),u=a[t];if(!u||!n.cardExists(u.key))throw new Error(`card "${t}" not found`);let c=n.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${t}" is not patchable`);let d=r(c,s,i),l=n.writeCard(u.key,d);a[t]={key:u.key,checksum:l,updatedAt:new Date().toISOString()},n.writeIndex(a);},removeCard(t){let s=e();s[t]&&(delete s[t],n.writeIndex(s));},readIndex(){return e()}}}function p(n){if(n==null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(p).join(",")}]`;let o=n;return `{${Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${p(o[r])}`).join(",")}}`}function g(n,o){let e=o>>>0;for(let r=0;r<n.length;r++)e^=n.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e}function E(n){let o=p(n),e=g(o,2166136261),r=g(o,3735928559),t=g(o,19088743),s=g(o,4277009102);return [e,r,t,s].map(i=>i.toString(16).padStart(8,"0")).join("")}function A(n){function o(e){return `${n}:kv:${e}`}return {read(e){let r=globalThis.localStorage.getItem(o(e));if(r===null)return null;try{return JSON.parse(r)}catch{return null}},write(e,r){globalThis.localStorage.setItem(o(e),JSON.stringify(r));},delete(e){globalThis.localStorage.removeItem(o(e));},listKeys(e){let r=o(e??""),t=[];for(let s=0;s<globalThis.localStorage.length;s++){let i=globalThis.localStorage.key(s);i!==null&&i.startsWith(r)&&t.push(i.slice(o("").length));}return t}}}function h(n,o){let e={...n};for(let[r,t]of Object.entries(o))t!==null&&typeof t=="object"&&!Array.isArray(t)&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])?e[r]=h(e[r],t):e[r]=t;return e}function k(n,o,e){if(o.length===0)return n;let[r,...t]=o;if(t.length===0)return {...n,[r]:e};let s=n[r]!==null&&typeof n[r]=="object"&&!Array.isArray(n[r])?n[r]:{};return {...n,[r]:k(s,t,e)}}function _(n){let o=A(n);return {read:e=>o.read(e),get(e,r){let t=o.read(e);if(t===null)return null;let s=t;for(let i of r.split(".").filter(Boolean)){if(s===null||typeof s!="object"||Array.isArray(s))return null;s=s[i]??null;}return s??null},write:(e,r)=>o.write(e,r),delete:e=>o.delete(e),listKeys:e=>o.listKeys(e),shallowMerge(e,r){let t=o.read(e)??{};o.write(e,{...t,...r});},deepMerge(e,r){let t=o.read(e)??{};o.write(e,h(t,r));},patch(e,r,t){let s=o.read(e)??{},i=r.split(".").filter(Boolean);o.write(e,k(s,i,t));}}}function S(n){let o=_(n);return {readIndex(){return o.read("_index")},writeIndex(e){o.write("_index",e);},readCard(e){return o.read(e)},writeCard(e,r){return o.write(e,r),E(r)},cardExists(e){return o.read(e)!==null},defaultCardKey(e){return e}}}function he(n){let o=S(n),e=y(o);return {getCard(r){return e.readCard(r)},getAllCards(){return e.readAllCards()},upsertCard(r){let t=o.defaultCardKey(r.id);e.writeCard(r.id,r,t);},removeCard(r){e.removeCard(r);}}}export{he as createBrowserCardStoreApi};//# sourceMappingURL=card-store-browser-api.js.map
1
+ import {createRequire}from'module';import'ajv-formats';var x=createRequire(import.meta.url);x("./jsonata-sync.cjs");var v=createRequire(import.meta.url);v("./jsonata-sync.cjs");function y(n,o){function e(){return n.readIndex()??{}}function r(t,s,i){let a=String(s||"").split(".").filter(Boolean);if(a.length===0)return i&&typeof i=="object"&&!Array.isArray(i)?i:{value:i};let u={...t},c=u;for(let d=0;d<a.length-1;d++){let l=a[d],f=c[l],m=f&&typeof f=="object"&&!Array.isArray(f)?{...f}:{};c[l]=m,c=m;}return c[a[a.length-1]]=i,u}return {readCard(t){let s=e()[t];return !s||!n.cardExists(s.key)?null:n.readCard(s.key)},readCardKey(t){return e()[t]?.key??null},readAllCards(){let t=[];for(let[s,i]of Object.entries(e())){if(!n.cardExists(i.key))continue;let a=n.readCard(i.key);a?t.push(a):o?.(`[card-store] could not read card "${s}" at key "${i.key}"`);}return t},readChecksumIndex(){let t={};for(let[s,i]of Object.entries(e()))t[s]=i.checksum;return t},changedSince(t){let s=e(),i=[];for(let[a,u]of Object.entries(s))t[a]!==u.checksum&&i.push(a);for(let a of Object.keys(t))s[a]||i.push(a);return i},validateUpsert(t,s){let i=e(),a=i[t],u=Object.entries(i).find(([,c])=>c.key===s);return a&&a.key!==s?{ok:false,error:`Card id "${t}" is already mapped to key "${a.key}", cannot remap to "${s}"`}:u&&u[0]!==t?{ok:false,error:`Key "${s}" is already mapped to card id "${u[0]}", cannot remap to "${t}"`}:{ok:true}},writeCard(t,s,i){let a=e(),u=i??a[t]?.key??n.defaultCardKey(t),c=n.writeCard(u,s);a[t]={key:u,checksum:c,updatedAt:new Date().toISOString()},n.writeIndex(a);},patchCard(t,s,i){let a=e(),u=a[t];if(!u||!n.cardExists(u.key))throw new Error(`card "${t}" not found`);let c=n.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${t}" is not patchable`);let d=r(c,s,i),l=n.writeCard(u.key,d);a[t]={key:u.key,checksum:l,updatedAt:new Date().toISOString()},n.writeIndex(a);},removeCard(t){let s=e();s[t]&&(delete s[t],n.writeIndex(s));},readIndex(){return e()}}}function g(n){if(n==null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(g).join(",")}]`;let o=n;return `{${Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${g(o[r])}`).join(",")}}`}function p(n,o){let e=o>>>0;for(let r=0;r<n.length;r++)e^=n.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e}function E(n){let o=g(n),e=p(o,2166136261),r=p(o,3735928559),t=p(o,19088743),s=p(o,4277009102);return [e,r,t,s].map(i=>i.toString(16).padStart(8,"0")).join("")}function T(n){function o(e){return `${n}:kv:${e}`}return {read(e){let r=globalThis.localStorage.getItem(o(e));if(r===null)return null;try{return JSON.parse(r)}catch{return null}},write(e,r){globalThis.localStorage.setItem(o(e),JSON.stringify(r));},delete(e){globalThis.localStorage.removeItem(o(e));},listKeys(e){let r=o(e??""),t=[];for(let s=0;s<globalThis.localStorage.length;s++){let i=globalThis.localStorage.key(s);i!==null&&i.startsWith(r)&&t.push(i.slice(o("").length));}return t}}}function h(n,o){let e={...n};for(let[r,t]of Object.entries(o))t!==null&&typeof t=="object"&&!Array.isArray(t)&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])?e[r]=h(e[r],t):e[r]=t;return e}function k(n,o,e){if(o.length===0)return n;let[r,...t]=o;if(t.length===0)return {...n,[r]:e};let s=n[r]!==null&&typeof n[r]=="object"&&!Array.isArray(n[r])?n[r]:{};return {...n,[r]:k(s,t,e)}}function _(n){let o=T(n);return {read:e=>o.read(e),get(e,r){let t=o.read(e);if(t===null)return null;let s=t;for(let i of r.split(".").filter(Boolean)){if(s===null||typeof s!="object"||Array.isArray(s))return null;s=s[i]??null;}return s??null},write:(e,r)=>o.write(e,r),delete:e=>o.delete(e),listKeys:e=>o.listKeys(e),shallowMerge(e,r){let t=o.read(e)??{};o.write(e,{...t,...r});},deepMerge(e,r){let t=o.read(e)??{};o.write(e,h(t,r));},patch(e,r,t){let s=o.read(e)??{},i=r.split(".").filter(Boolean);o.write(e,k(s,i,t));}}}function S(n){let o=_(n);return {readIndex(){return o.read("_index")},writeIndex(e){o.write("_index",e);},readCard(e){return o.read(e)},writeCard(e,r){return o.write(e,r),E(r)},cardExists(e){return o.read(e)!==null},defaultCardKey(e){return e}}}function he(n){let o=S(n),e=y(o);return {getCard(r){return e.readCard(r)},getAllCards(){return e.readAllCards()},upsertCard(r){let t=o.defaultCardKey(r.id);e.writeCard(r.id,r,t);},removeCard(r){e.removeCard(r);}}}export{he as createBrowserCardStoreApi};//# sourceMappingURL=card-store-browser-api.js.map
2
2
  //# sourceMappingURL=card-store-browser-api.js.map
@@ -1,3 +1,108 @@
1
+ /**
2
+ * storage-interface.ts
3
+ *
4
+ * Three minimal storage primitives that together cover all persistence needs
5
+ * of the board-live-cards system. Any backend (Node fs, CosmosDB, Azure Blob,
6
+ * browser localStorage, in-memory test double) implements these three interfaces.
7
+ *
8
+ * The pure-logic stores in board-live-cards-all-stores.ts depend only on these
9
+ * interfaces — never on Node built-ins.
10
+ *
11
+ * Blob — raw string content at a logical, backend-neutral key
12
+ * Journal — append-only log with cursor-based reads
13
+ * KV — key-value store with list/delete
14
+ *
15
+ * Mapping to existing storage adapters:
16
+ *
17
+ * CardStorageAdapter
18
+ * inventory (cardId → { blobRef, checksum, fileMetadata? }) → KV
19
+ * card JSON files → Blob
20
+ * source output files → Blob
21
+ *
22
+ * JournalStorageAdapter → Journal (board-journal.jsonl)
23
+ *
24
+ * ExecutionRequestStore → KV (keyed by journalId, via createFsKvStorage)
25
+ *
26
+ * StateSnapshotStorageAdapter
27
+ * board-graph.json (packed single JSON, written atomically) → Blob
28
+ * per-card sidecars (cards/<id>/runtime, fetched-sources-manifest) → KV
29
+ */
30
+ interface BlobStat {
31
+ key: string;
32
+ size: number;
33
+ updatedAt?: string;
34
+ contentType?: string;
35
+ }
36
+ interface BlobStorage {
37
+ /** Returns raw content string, or null if the blob does not exist. */
38
+ read(key: string): string | null;
39
+ /** Write content at key. Implementations should be atomic (write-rename). */
40
+ write(key: string, content: string): void;
41
+ /** Returns true if a blob exists at key. */
42
+ exists(key: string): boolean;
43
+ /** Delete the blob at key. No-op if it does not exist. */
44
+ remove(key: string): void;
45
+ /** Optional binary read for file-like artifacts. */
46
+ readBytes?(key: string): Uint8Array | null;
47
+ /** Optional binary write for file-like artifacts. */
48
+ writeBytes?(key: string, content: Uint8Array): void;
49
+ /** List all keys that start with the given prefix. */
50
+ listKeys(prefix?: string): string[];
51
+ /** Optional metadata lookup. */
52
+ stat?(key: string): BlobStat | null;
53
+ }
54
+ interface KindValueRef {
55
+ readonly kind: string;
56
+ readonly value: string;
57
+ }
58
+ /** Serialize a KindValueRef to the wire format: b64:<base64url(json)> */
59
+ declare function serializeRef(ref: KindValueRef): string;
60
+ /** Parse a wire-format ref string (b64:<base64url(json)>) into a KindValueRef. */
61
+ declare function parseRef(s: string): KindValueRef;
62
+ interface JournalEntry {
63
+ id: string;
64
+ payload: unknown;
65
+ }
66
+ interface JournalReadResult {
67
+ entries: JournalEntry[];
68
+ /** The id of the last entry returned, suitable for use as the next cursor. */
69
+ newCursor: string | null;
70
+ }
71
+ interface JournalStorage {
72
+ /** Append an entry. The storage layer assigns the id. */
73
+ append(payload: unknown): JournalEntry;
74
+ /** Read ALL entries (for index rebuilds, full replay). */
75
+ readAll(): JournalEntry[];
76
+ /**
77
+ * Read entries appended after the given cursor id.
78
+ * If cursor is null/empty, returns all entries from the beginning.
79
+ */
80
+ readAfter(cursor: string | null): JournalReadResult;
81
+ /** Truncate all entries. Optional — not all backends support it. */
82
+ clear?(): void;
83
+ }
84
+ interface KVStorage {
85
+ /** Returns the stored value, or null if the key does not exist. */
86
+ read(key: string): unknown | null;
87
+ /** Write value at key. Overwrites any existing value. */
88
+ write(key: string, value: unknown): void;
89
+ /** Delete the key. No-op if it does not exist. */
90
+ delete(key: string): void;
91
+ /**
92
+ * List all keys, optionally filtered to those starting with prefix.
93
+ * Order is implementation-defined.
94
+ */
95
+ listKeys(prefix?: string): string[];
96
+ }
97
+ interface AtomicRelayLock {
98
+ /**
99
+ * Attempt to acquire the lock without blocking.
100
+ * Returns a `release` function if successful, or `null` if the lock is
101
+ * already held by another actor (relay: that actor will complete the work).
102
+ */
103
+ tryAcquire(): (() => void) | null;
104
+ }
105
+
1
106
  /**
2
107
  * execution-interface.ts
3
108
  *
@@ -77,6 +182,13 @@
77
182
  * whatToRun: 'b64:<base64url({"kind":"fs-path","value":"/path/to/my-executor.js"})>',
78
183
  * };
79
184
  *
185
+ * // Packaged yaml-flow CLI entrypoint resolved by the Node adapter:
186
+ * const yamlFlowCli: ExecutionRef = {
187
+ * meta: 'chat-handler',
188
+ * howToRun: 'local-node',
189
+ * whatToRun: 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>',
190
+ * };
191
+ *
80
192
  * // Azure Function task executor with custom arg mapping:
81
193
  * const azureFn: ExecutionRef = {
82
194
  * meta: 'task-executor',
@@ -204,7 +316,9 @@ interface ExecutionRef {
204
316
  * Address of the artifact to run. Two valid forms:
205
317
  * - string: must be KindValueRef wire form `b64:<base64url(json)>` (programmatically generated via serializeRef)
206
318
  * - object: `{ kind: string; value: string }` plain object (human-authored flow files — normalized by the handler factory)
207
- * @example 'b64:<base64url({"kind":"fs-path","value":"/dist/cli/source-cli-task-executor.js"})>'
319
+ * Prefer `kind: 'yaml-flow-cli'` when targeting a packaged public yaml-flow CLI entrypoint.
320
+ * Use `kind: 'fs-path'` for external scripts or non-packaged local executables.
321
+ * @example 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>'
208
322
  * @example { kind: 'http-url', value: '/api/workiq/ask' }
209
323
  * @example { kind: 'fs-path', value: './my-handler.js' }
210
324
  */
@@ -283,4 +397,4 @@ declare function serializeExecutionRef(ref: ExecutionRef): string;
283
397
  */
284
398
  declare function parseExecutionRef(s: string): ExecutionRef;
285
399
 
286
- export { type ArgsMassaging as A, type ExecutionRef as E, type ExecutionResult as a, executionRefFromScriptPath as e, parseExecutionRef as p, serializeExecutionRef as s };
400
+ export { type ArgsMassaging as A, type BlobStorage as B, type ExecutionRef as E, type JournalStorage as J, type KindValueRef as K, type ExecutionResult as a, type KVStorage as b, type AtomicRelayLock as c, parseRef as d, executionRefFromScriptPath as e, serializeRef as f, parseExecutionRef as p, serializeExecutionRef as s };
@@ -1 +1,4 @@
1
1
  #!/usr/bin/env node
2
+ declare function cli(args: any): Promise<void>;
3
+
4
+ export { cli };
@@ -1,3 +1,4 @@
1
1
  #!/usr/bin/env node
2
- import*as h from'fs';import*as s from'path';import {fileURLToPath}from'url';import {spawnSync}from'child_process';var u=s.dirname(fileURLToPath(import.meta.url)),m=s.join(u,"..","..","..","src","cli","node","batch-runner-cli.ts"),S=s.join(u,"..","..","..","node_modules","tsx","dist","cli.mjs");if(h.existsSync(m)){let e=spawnSync(process.execPath,[S,m,...process.argv.slice(2)],{stdio:"inherit",shell:false,windowsHide:true});e.error&&(console.error(`[batch-runner-cli] Failed to launch dev fallback: ${e.error.message}`),process.exit(1)),process.exit(e.status??0);}var v=s.join(u,"..","..","lib","index.js"),E=s.join(u,"..","..","lib","step-machine-public","index.js"),A=s.join(u,"..","..","lib","batch","index.js"),O=s.join(u,"execution-adapter.js"),{loadStepFlow:J,createStepMachine:M,MemoryStore:N}=await import(p(v).href),{buildStepHandlersForFlow:P}=await import(p(E).href),{batch:R}=await import(p(A).href),{invokeRefSync:$}=await import(p(O).href);function p(e){let r=s.resolve(e).replace(/\\/g,"/");return new URL(`file:///${r.startsWith("/")?r.slice(1):r}`)}async function F(){let e=process.argv.slice(2),r=k(e);(r.help||e.length===0)&&(U(),process.exit(e.length===0?1:0));let{flowArg:i,itemsArg:o,concurrency:t}=r;if(!i)throw new Error("[batch-runner-cli] Flow path is required.");if(!o)throw new Error("[batch-runner-cli] --items <json-file-or-inline> is required.");let c=d(i),a=s.dirname(c),w=I(o),f=await J(c),l=await R(w,{concurrency:t,processor:async(n,W)=>{let b=P(f,{invoke:(y,g)=>$(T(y),g,{cliDir:a,cwd:a})});return M(f,b,{store:new N}).run(n)},onProgress:n=>{process.stderr.write(`\r[batch] ${n.completed+n.failed}/${n.total} (${n.percent}%) \u2014 ${n.active} active`);}});process.stderr.write("\r"+" ".repeat(80)+"\r"),console.log(JSON.stringify({completed:l.completed,failed:l.failed,total:l.total,durationMs:l.durationMs,items:l.items.map(n=>({index:n.index,status:n.status,durationMs:n.durationMs,...n.status==="completed"?{intent:n.result?.intent,data:n.result?.data}:{error:n.error?.message}}))},null,2)),l.failed>0&&process.exit(1);}function k(e){let r={},i=[],o=false;for(let t=0;t<e.length;t++){let c=e[t];if(c==="-h"||c==="--help"){o=true;continue}if(c==="--items"){let a=e[t+1];if(!a||a.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --items.");r["--items"]=a,t++;continue}if(c==="--concurrency"){let a=e[t+1];if(!a||a.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --concurrency.");r["--concurrency"]=a,t++;continue}if(c.startsWith("--"))throw new Error(`[batch-runner-cli] Unknown flag: ${c}`);i.push(c);}return {help:o,flowArg:i[0],itemsArg:r["--items"],concurrency:r["--concurrency"]?parseInt(r["--concurrency"],10):5}}function d(e){return s.isAbsolute(e)?e:s.resolve(process.cwd(),e)}function I(e){let r=d(e),i;h.existsSync(r)?i=h.readFileSync(r,"utf-8"):i=e;let o;try{o=JSON.parse(i);}catch(t){let c=t instanceof Error?t.message:String(t);throw new Error(`[batch-runner-cli] Failed to parse items JSON: ${c}`)}if(!Array.isArray(o))throw new Error("[batch-runner-cli] Items must be a JSON array of objects.");for(let t=0;t<o.length;t++)if(!o[t]||typeof o[t]!="object"||Array.isArray(o[t]))throw new Error(`[batch-runner-cli] Item at index ${t} is not a JSON object.`);return o}function T(e){if(!e||typeof e!="object"||typeof e.whatToRun!="string"||!e.whatToRun.startsWith("b64:"))return e;try{let r=e.whatToRun.slice(4),i=r+"=".repeat((4-r.length%4)%4),o=Buffer.from(i.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf8"),t=JSON.parse(o);return !t||typeof t!="object"||typeof t.value!="string"?e:{...e,whatToRun:t}}catch{return e}}function U(){console.error("Usage: batch-runner-cli <step-flow.yaml> --items <items.json> [--concurrency <n>]"),console.error(""),console.error("Run a step-machine flow for each item in a JSON array, with concurrency control."),console.error(""),console.error("Options:"),console.error(" --items <path|json> JSON file or inline JSON array of input objects"),console.error(" --concurrency <n> Max concurrent flows (default: 5)"),console.error(" -h, --help Show this help"),console.error(""),console.error("Example:"),console.error(" batch-runner-cli flow.yaml --items items.json --concurrency 3"),console.error(` batch-runner-cli flow.yaml --items '[{"a":1,"b":2},{"a":3,"b":4}]'`);}F().catch(e=>{let r=e instanceof Error?e.stack??e.message:String(e);console.error(r),process.exit(1);});//# sourceMappingURL=batch-runner-cli.js.map
2
+ import*as f from'fs';import*as s from'path';import {fileURLToPath}from'url';import*as y from'os';import'net';import'child_process';import'crypto';function m(...e){return s.resolve(...e)}s.join(y.tmpdir(),".board-live-cards-git-bash-cache.json");var p=s.dirname(fileURLToPath(import.meta.url)),E=s.join(p,"..","..","lib","index.js"),A=s.join(p,"..","..","lib","step-machine-public","index.js"),P=s.join(p,"..","..","lib","batch","index.js"),R=s.join(p,"execution-adapter.js"),{loadStepFlow:$,createStepMachine:C,MemoryStore:O}=await import(g(E).href),{buildStepHandlersForFlow:B}=await import(g(A).href),{batch:J}=await import(g(P).href),{invokeRefSync:M}=await import(g(R).href);function g(e){let n=s.resolve(e).replace(/\\/g,"/");return new URL(`file:///${n.startsWith("/")?n.slice(1):n}`)}async function I(e){let n=F(e);(n.help||e.length===0)&&(U(),process.exit(e.length===0?1:0));let{flowArg:a,itemsArg:r,concurrency:t}=n;if(!a)throw new Error("[batch-runner-cli] Flow path is required.");if(!r)throw new Error("[batch-runner-cli] --items <json-file-or-inline> is required.");let i=w(a),c=s.dirname(i),v=L(r),h=await $(i),l=await J(v,{concurrency:t,processor:async(o,_)=>{let b=B(h,{invoke:(x,S)=>M(T(x),S,{cliDir:c,cwd:c})});return C(h,b,{store:new O}).run(o)},onProgress:o=>{process.stderr.write(`\r[batch] ${o.completed+o.failed}/${o.total} (${o.percent}%) \u2014 ${o.active} active`);}});process.stderr.write("\r"+" ".repeat(80)+"\r"),console.log(JSON.stringify({completed:l.completed,failed:l.failed,total:l.total,durationMs:l.durationMs,items:l.items.map(o=>({index:o.index,status:o.status,durationMs:o.durationMs,...o.status==="completed"?{intent:o.result?.intent,data:o.result?.data}:{error:o.error?.message}}))},null,2)),l.failed>0&&process.exit(1);}function F(e){let n={},a=[],r=false;for(let t=0;t<e.length;t++){let i=e[t];if(i==="-h"||i==="--help"){r=true;continue}if(i==="--items"){let c=e[t+1];if(!c||c.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --items.");n["--items"]=c,t++;continue}if(i==="--concurrency"){let c=e[t+1];if(!c||c.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --concurrency.");n["--concurrency"]=c,t++;continue}if(i.startsWith("--"))throw new Error(`[batch-runner-cli] Unknown flag: ${i}`);a.push(i);}return {help:r,flowArg:a[0],itemsArg:n["--items"],concurrency:n["--concurrency"]?parseInt(n["--concurrency"],10):5}}function w(e){return s.isAbsolute(e)?e:s.resolve(process.cwd(),e)}function L(e){let n=w(e),a;f.existsSync(n)?a=f.readFileSync(n,"utf-8"):a=e;let r;try{r=JSON.parse(a);}catch(t){let i=t instanceof Error?t.message:String(t);throw new Error(`[batch-runner-cli] Failed to parse items JSON: ${i}`)}if(!Array.isArray(r))throw new Error("[batch-runner-cli] Items must be a JSON array of objects.");for(let t=0;t<r.length;t++)if(!r[t]||typeof r[t]!="object"||Array.isArray(r[t]))throw new Error(`[batch-runner-cli] Item at index ${t} is not a JSON object.`);return r}function T(e){if(!e||typeof e!="object"||typeof e.whatToRun!="string"||!e.whatToRun.startsWith("b64:"))return e;try{let n=e.whatToRun.slice(4),a=n+"=".repeat((4-n.length%4)%4),r=Buffer.from(a.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf8"),t=JSON.parse(r);return !t||typeof t!="object"||typeof t.value!="string"?e:{...e,whatToRun:t}}catch{return e}}function U(){console.error("Usage: batch-runner-cli <step-flow.yaml> --items <items.json> [--concurrency <n>]"),console.error(""),console.error("Run a step-machine flow for each item in a JSON array, with concurrency control."),console.error(""),console.error("Options:"),console.error(" --items <path|json> JSON file or inline JSON array of input objects"),console.error(" --concurrency <n> Max concurrent flows (default: 5)"),console.error(" -h, --help Show this help"),console.error(""),console.error("Example:"),console.error(" batch-runner-cli flow.yaml --items items.json --concurrency 3"),console.error(` batch-runner-cli flow.yaml --items '[{"a":1,"b":2},{"a":3,"b":4}]'`);}var N=process.argv[1]&&m(process.argv[1])===m(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/,"$1"));N&&I(process.argv.slice(2)).catch(e=>{let n=e instanceof Error?e.stack??e.message:String(e);console.error(n),process.exit(1);});
3
+ export{I as cli};//# sourceMappingURL=batch-runner-cli.js.map
3
4
  //# sourceMappingURL=batch-runner-cli.js.map