yaml-flow 8.5.3 → 8.6.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 (166) hide show
  1. package/browser/asset-integrity.json +3 -3
  2. package/examples/board/demo-shell-with-server.html +2 -2
  3. package/examples/board/doc.html +2 -2
  4. package/examples/board/server/board-server.js +266 -5
  5. package/examples/board/server/board-worker/task-executor.js +166 -51
  6. package/examples/board/server/chat-flow/copilot-chat/assistant.js +25 -12
  7. package/examples/board/server/chat-flow/copilot-chat/probe.js +7 -0
  8. package/examples/board/server/chat-flow/copilot-chat/shared.js +97 -0
  9. package/examples/board/server/chat-flow/flow-steps.json +109 -51
  10. package/examples/board/server-config.json +1 -0
  11. package/examples/board/test/server-http-test.js +870 -67
  12. package/examples/board-local/demo-shell-localstorage.html +3 -3
  13. package/lib/{artifacts-store-lib-D-k-E8Vy.d.ts → artifacts-store-lib-C1rtrkxm.d.ts} +1 -1
  14. package/lib/{artifacts-store-lib-CVgtQrNZ.d.cts → artifacts-store-lib-CLOtsiav.d.cts} +1 -1
  15. package/lib/artifacts-store-public.cjs +1 -1
  16. package/lib/artifacts-store-public.d.cts +3 -3
  17. package/lib/artifacts-store-public.d.ts +3 -3
  18. package/lib/artifacts-store-public.js +1 -1
  19. package/lib/batch/index.cjs +1 -1
  20. package/lib/batch/index.js +1 -1
  21. package/lib/board-live-cards-mcp.cjs +1 -1
  22. package/lib/board-live-cards-mcp.d.cts +35 -15
  23. package/lib/board-live-cards-mcp.d.ts +35 -15
  24. package/lib/board-live-cards-mcp.js +1 -1
  25. package/lib/board-live-cards-node.cjs +8 -16
  26. package/lib/board-live-cards-node.d.cts +32 -12
  27. package/lib/board-live-cards-node.d.ts +32 -12
  28. package/lib/board-live-cards-node.js +8 -16
  29. package/lib/{board-live-cards-public-BGS22cMb.d.ts → board-live-cards-public-CBVjm327.d.ts} +59 -24
  30. package/lib/{board-live-cards-public-B13InXhC.d.cts → board-live-cards-public-CPJy-aGW.d.cts} +59 -24
  31. package/lib/board-live-cards-public.cjs +1 -2
  32. package/lib/board-live-cards-public.d.cts +2 -2
  33. package/lib/board-live-cards-public.d.ts +2 -2
  34. package/lib/board-live-cards-public.js +1 -2
  35. package/lib/board-live-cards-server-runtime.cjs +1 -7
  36. package/lib/board-live-cards-server-runtime.d.cts +5 -5
  37. package/lib/board-live-cards-server-runtime.d.ts +5 -5
  38. package/lib/board-live-cards-server-runtime.js +1 -7
  39. package/lib/board-livegraph-runtime/index.cjs +1 -2
  40. package/lib/board-livegraph-runtime/index.js +1 -2
  41. package/lib/board-worker-adapter.cjs +21 -7
  42. package/lib/board-worker-adapter.d.cts +17 -2
  43. package/lib/board-worker-adapter.d.ts +17 -2
  44. package/lib/board-worker-adapter.js +21 -7
  45. package/lib/card-compute/index.cjs +1 -9
  46. package/lib/card-compute/index.js +1 -9
  47. package/lib/card-store-public.cjs +1 -1
  48. package/lib/card-store-public.d.cts +2 -2
  49. package/lib/card-store-public.d.ts +2 -2
  50. package/lib/card-store-public.js +1 -1
  51. package/lib/card-validation.cjs +1 -9
  52. package/lib/card-validation.js +1 -9
  53. package/lib/{chat-storage-lib-CJn7a6OH.d.ts → chat-storage-lib-Bce-xx6l.d.ts} +1 -1
  54. package/lib/{chat-storage-lib-0imhRX3l.d.cts → chat-storage-lib-CKylihjm.d.cts} +1 -1
  55. package/lib/chat-store-public.cjs +1 -1
  56. package/lib/chat-store-public.d.cts +3 -3
  57. package/lib/chat-store-public.d.ts +3 -3
  58. package/lib/chat-store-public.js +1 -1
  59. package/lib/chunk-2MZUYY65.cjs +2 -0
  60. package/lib/chunk-5DB54ZX2.cjs +2 -0
  61. package/lib/chunk-5EA2ESS4.cjs +16 -0
  62. package/lib/chunk-6APH25VI.js +2 -0
  63. package/lib/chunk-76ON3V7R.js +2 -0
  64. package/lib/chunk-7BKNHFNH.js +2 -0
  65. package/lib/chunk-CWREBRXS.js +3 -0
  66. package/lib/chunk-DAXACY63.js +2 -0
  67. package/lib/chunk-FW4363Y4.js +2 -0
  68. package/lib/chunk-FZ2SBU5M.js +3 -0
  69. package/lib/chunk-G4XXRHL2.cjs +3 -0
  70. package/lib/chunk-GNFE24S7.cjs +2 -0
  71. package/lib/chunk-GYQXDNNI.cjs +2 -0
  72. package/lib/chunk-H5KD3JPY.cjs +2 -0
  73. package/lib/chunk-HLJH7LGW.js +16 -0
  74. package/lib/chunk-I4WH5U5D.cjs +2 -0
  75. package/lib/chunk-IXZG74EW.cjs +2 -0
  76. package/lib/chunk-JAL25FGA.cjs +2 -0
  77. package/lib/chunk-JM5EKT57.js +2 -0
  78. package/lib/chunk-JMDHDY6M.js +2 -0
  79. package/lib/chunk-KBELAKIY.js +2 -0
  80. package/lib/chunk-KHJABJ45.cjs +3 -0
  81. package/lib/chunk-KLRUISRY.cjs +2 -0
  82. package/lib/chunk-KNFFDVLD.cjs +2 -0
  83. package/lib/chunk-LBMEVV4U.js +2 -0
  84. package/lib/chunk-LDAP75GN.js +2 -0
  85. package/lib/chunk-LODXIALE.cjs +2 -0
  86. package/lib/chunk-LVNQCE5X.cjs +3 -0
  87. package/lib/chunk-M7EQRS6W.js +3 -0
  88. package/lib/chunk-MNEOJWPS.js +10 -0
  89. package/lib/chunk-NJJ7WEDT.cjs +2 -0
  90. package/lib/chunk-NMZ6XNLB.cjs +3 -0
  91. package/lib/chunk-OPNGCSXJ.js +2 -0
  92. package/lib/chunk-P64UKI3L.cjs +8 -0
  93. package/lib/chunk-P7ZCDICS.cjs +2 -0
  94. package/lib/chunk-Q6H7NINN.cjs +5 -0
  95. package/lib/chunk-Q6VSL327.js +8 -0
  96. package/lib/chunk-QWBNDVUA.js +5 -0
  97. package/lib/chunk-S6DRP2HX.cjs +2 -0
  98. package/lib/chunk-UJ7ZTV4J.cjs +10 -0
  99. package/lib/chunk-UVE65IPR.cjs +3 -0
  100. package/lib/chunk-VCCTAUIG.js +2 -0
  101. package/lib/chunk-VGT3TRQG.js +3 -0
  102. package/lib/chunk-VLBB3D6B.js +3 -0
  103. package/lib/chunk-WDPOGXTY.js +2 -0
  104. package/lib/chunk-X3LC4LII.js +2 -0
  105. package/lib/chunk-YGKDQLYP.js +2 -0
  106. package/lib/chunk-YMEIPKLW.cjs +2 -0
  107. package/lib/config/index.cjs +1 -1
  108. package/lib/config/index.js +1 -1
  109. package/lib/continuous-event-graph/index.cjs +1 -2
  110. package/lib/continuous-event-graph/index.js +1 -2
  111. package/lib/event-graph/index.cjs +1 -22
  112. package/lib/event-graph/index.js +1 -22
  113. package/lib/execution-refs.cjs +1 -2
  114. package/lib/execution-refs.d.cts +3 -2
  115. package/lib/execution-refs.d.ts +3 -2
  116. package/lib/execution-refs.js +1 -2
  117. package/lib/index.cjs +2 -24
  118. package/lib/index.d.cts +1 -1
  119. package/lib/index.d.ts +1 -1
  120. package/lib/index.js +2 -24
  121. package/lib/server-runtime/index.cjs +1 -7
  122. package/lib/server-runtime/index.d.cts +6 -6
  123. package/lib/server-runtime/index.d.ts +6 -6
  124. package/lib/server-runtime/index.js +1 -7
  125. package/lib/step-machine/index.cjs +1 -11
  126. package/lib/step-machine/index.js +1 -11
  127. package/lib/step-machine-public/index.cjs +1 -4
  128. package/lib/step-machine-public/index.d.cts +1 -1
  129. package/lib/step-machine-public/index.d.ts +1 -1
  130. package/lib/step-machine-public/index.js +1 -4
  131. package/lib/{storage-interface-B2WD9D5n.d.cts → storage-interface-Ct-C4tlz.d.cts} +28 -1
  132. package/lib/{storage-interface-B2WD9D5n.d.ts → storage-interface-Ct-C4tlz.d.ts} +28 -1
  133. package/lib/stores/index.cjs +1 -2
  134. package/lib/stores/index.d.cts +1 -1
  135. package/lib/stores/index.d.ts +1 -1
  136. package/lib/stores/index.js +1 -2
  137. package/lib/stores/kv.cjs +1 -2
  138. package/lib/stores/kv.d.cts +1 -1
  139. package/lib/stores/kv.d.ts +1 -1
  140. package/lib/stores/kv.js +1 -2
  141. package/lib/stores/memory.cjs +1 -1
  142. package/lib/stores/memory.js +1 -1
  143. package/lib/{types-30R357js.d.ts → types-BuK2UMxk.d.ts} +4 -4
  144. package/lib/{types-CIgsh56O.d.cts → types-DRl0Hy_p.d.cts} +4 -4
  145. package/package.json +2 -16
  146. package/cli/board-live-cards-lib-COi4bSpk.d.ts +0 -322
  147. package/cli/browser-api/board-live-cards-browser-adapter.d.ts +0 -36
  148. package/cli/browser-api/board-live-cards-browser-adapter.js +0 -4
  149. package/cli/browser-api/card-store-browser-api.d.ts +0 -25
  150. package/cli/browser-api/card-store-browser-api.js +0 -2
  151. package/cli/browser-api/jsonata-sync.cjs +0 -7623
  152. package/cli/bundled/artifacts-store-cli.mjs +0 -12
  153. package/cli/bundled/batch-runner-cli.mjs +0 -3
  154. package/cli/bundled/board-live-cards-cli.mjs +0 -29
  155. package/cli/bundled/card-store-cli.mjs +0 -154
  156. package/cli/bundled/chat-store-cli.mjs +0 -16
  157. package/cli/bundled/jsonata-sync.cjs +0 -7623
  158. package/cli/bundled/step-machine-cli.mjs +0 -150
  159. package/cli/execution-interface-BCIhu1gO.d.ts +0 -442
  160. package/cli/types-H3EMBPY2.d.ts +0 -398
  161. package/examples/board/server/README-mcp-api.md +0 -690
  162. package/examples/board/test/server-http-mcp-test.js +0 -1280
  163. package/lib/board-livegraph-runtime/jsonata-sync.cjs +0 -7623
  164. package/lib/card-compute/jsonata-sync.cjs +0 -7623
  165. package/lib/continuous-event-graph/jsonata-sync.cjs +0 -7623
  166. package/lib/server-runtime/jsonata-sync.cjs +0 -7623
@@ -1,442 +0,0 @@
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
- * Optional: resolve a key to a transport-neutral KindValueRef (e.g. for
55
- * handing the underlying location to a spawned child process or remote worker).
56
- * FS: { kind: 'fs-path', value: <absolute path under rootDir> }
57
- * Other backends: backend-specific ref
58
- */
59
- keyRef?(key: string): KindValueRef;
60
- }
61
- interface KindValueRef {
62
- readonly kind: string;
63
- readonly value: string;
64
- }
65
- /** Serialize a KindValueRef to the wire format: b64:<base64url(json)> */
66
- declare function serializeRef(ref: KindValueRef): string;
67
- /** Parse a wire-format ref string (b64:<base64url(json)>) into a KindValueRef. */
68
- declare function parseRef(s: string): KindValueRef;
69
- interface JournalEntry {
70
- id: string;
71
- payload: unknown;
72
- }
73
- interface JournalReadResult {
74
- entries: JournalEntry[];
75
- /** The id of the last entry returned, suitable for use as the next cursor. */
76
- newCursor: string | null;
77
- }
78
- interface JournalStorage {
79
- /** Append an entry. The storage layer assigns the id. */
80
- append(payload: unknown): JournalEntry;
81
- /** Read ALL entries (for index rebuilds, full replay). */
82
- readAll(): JournalEntry[];
83
- /**
84
- * Read entries appended after the given cursor id.
85
- * If cursor is null/empty, returns all entries from the beginning.
86
- */
87
- readAfter(cursor: string | null): JournalReadResult;
88
- /** Truncate all entries. Optional — not all backends support it. */
89
- clear?(): void;
90
- }
91
- interface KVStorage {
92
- /** Returns the stored value, or null if the key does not exist. */
93
- read(key: string): unknown | null;
94
- /** Write value at key. Overwrites any existing value. */
95
- write(key: string, value: unknown): void;
96
- /** Delete the key. No-op if it does not exist. */
97
- delete(key: string): void;
98
- /**
99
- * List all keys, optionally filtered to those starting with prefix.
100
- * Order is implementation-defined.
101
- */
102
- listKeys(prefix?: string): string[];
103
- }
104
- interface ScratchStorage extends BlobStorage {
105
- /**
106
- * Allocate a new unique key. Does NOT create any underlying object — caller
107
- * must write to it (e.g. via a spawned child) before it has content.
108
- * prefix and suffix are sanitized; both are optional.
109
- */
110
- getUniqueKey(prefix?: string, suffix?: string): string;
111
- /**
112
- * Allocate a new unique key AND write data at it atomically. Returns the
113
- * new key. Counts as a write for sweep-trigger purposes.
114
- */
115
- create(data: string, prefix?: string, suffix?: string): string;
116
- /** Resolve a key to a transport-neutral ref (e.g. for child-process handoff). */
117
- keyRef(key: string): KindValueRef;
118
- /** Backend-agnostic config bag (used for retention policy and similar knobs). */
119
- config: {
120
- get(k: string): unknown;
121
- set(k: string, v: unknown): void;
122
- };
123
- }
124
- interface ArchiveFactory {
125
- /** Open (or create) a named append-only stream rooted inside the archive. */
126
- stream(name: string): JournalStorage;
127
- /** Open (or create) a named blob namespace rooted inside the archive. */
128
- blob(name: string): BlobStorage;
129
- /** List all stream names present in the archive. */
130
- listStreams(prefix?: string): string[];
131
- /** List all blob namespace names present in the archive. */
132
- listBlobs(prefix?: string): string[];
133
- /** Backend-agnostic config bag (retention knobs and similar). */
134
- config: {
135
- get(k: string): unknown;
136
- set(k: string, v: unknown): void;
137
- };
138
- }
139
- interface AtomicRelayLock {
140
- /**
141
- * Attempt to acquire the lock without blocking.
142
- * Returns a `release` function if successful, or `null` if the lock is
143
- * already held by another actor (relay: that actor will complete the work).
144
- */
145
- tryAcquire(): (() => void) | null;
146
- }
147
-
148
- /**
149
- * execution-interface.ts
150
- *
151
- * Pure module — no Node/platform imports. Safe for any runtime.
152
- *
153
- * Defines the portable descriptor types for invoking any executable target,
154
- * regardless of transport (local process, HTTP endpoint, cloud function, etc.).
155
- *
156
- * Parallel to storage-interface.ts (which describes WHERE data lives), this
157
- * module describes HOW to invoke a piece of logic.
158
- *
159
- * ────────────────────────────────────────────────────────────────────────────
160
- * CORE CONCEPTS
161
- * ────────────────────────────────────────────────────────────────────────────
162
- *
163
- * ExecutionRef — self-contained, serializable JSON descriptor for one invocation target.
164
- * • howToRun — transport / runtime kind (discriminator)
165
- * • whatToRun — address of the artifact (KindValueRef wire form: b64:<base64url(json)>)
166
- * • argsMassaging — optional JSONata expressions that map logical args → physical call shape
167
- * • meta — optional human-readable label (e.g. 'task-executor', 'chat-handler')
168
- *
169
- * ExecutionResult — standardized envelope returned by any invocation.
170
- * • status: 'success' | 'fail' | 'error'
171
- * • data — KindValueRef wire form pointing to output blob (on success)
172
- * • error — human-readable message (on fail/error)
173
- *
174
- * ────────────────────────────────────────────────────────────────────────────
175
- * howToRun VALUES
176
- * ────────────────────────────────────────────────────────────────────────────
177
- *
178
- * 'local-node' node <whatToRun> [argv...]
179
- * 'local-python' python <whatToRun> [argv...]
180
- * 'local-process' execute <whatToRun> directly (shebang / pre-resolved binary)
181
- * 'http:post' HTTP POST to <whatToRun>
182
- * 'http:get' HTTP GET to <whatToRun>
183
- * 'built-in' resolved by the adapter to a well-known internal implementation
184
- *
185
- * ────────────────────────────────────────────────────────────────────────────
186
- * argsMassaging
187
- * ────────────────────────────────────────────────────────────────────────────
188
- *
189
- * Each field is a JSONata expression evaluated against the caller's logical args object.
190
- * If argsMassaging is omitted, the adapter uses its default mapping for the howToRun kind.
191
- *
192
- * Local transports (local-node, local-python, local-process):
193
- * cmdTemplate — array of JSONata exprs, each producing one argv string
194
- * stdinTemplate — JSONata expr producing the stdin payload object
195
- *
196
- * HTTP transports (http:post, http:get, azure-function, firebase, etc.):
197
- * urlTemplate — JSONata expr producing the final URL string
198
- * headerTemplate — JSONata expr producing the request headers object
199
- * bodyTemplate — JSONata expr producing the request body object
200
- *
201
- * ────────────────────────────────────────────────────────────────────────────
202
- * SERIALIZATION
203
- * ────────────────────────────────────────────────────────────────────────────
204
- *
205
- * ExecutionRef is a plain JSON object — store it as-is on disk, in Cosmos, or any DB.
206
- * No special encoding needed. parseExecutionRef / serializeExecutionRef are thin
207
- * JSON wrappers provided for symmetry with storage-interface.
208
- *
209
- * ────────────────────────────────────────────────────────────────────────────
210
- * USAGE EXAMPLES
211
- * ────────────────────────────────────────────────────────────────────────────
212
- *
213
- * // Built-in source-cli task executor (resolved by adapter from cliDir):
214
- * const builtIn: ExecutionRef = {
215
- * meta: 'task-executor',
216
- * howToRun: 'built-in',
217
- * whatToRun: 'b64:<base64url({"kind":"built-in","value":"source-cli-task-executor"})>',
218
- * };
219
- *
220
- * // External local-node task executor with default protocol args:
221
- * const local: ExecutionRef = {
222
- * meta: 'task-executor',
223
- * howToRun: 'local-node',
224
- * whatToRun: 'b64:<base64url({"kind":"fs-path","value":"/path/to/my-executor.js"})>',
225
- * };
226
- *
227
- * // Packaged yaml-flow CLI entrypoint resolved by the Node adapter:
228
- * const yamlFlowCli: ExecutionRef = {
229
- * meta: 'chat-handler',
230
- * howToRun: 'local-node',
231
- * whatToRun: 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>',
232
- * };
233
- *
234
- * // Azure Function task executor with custom arg mapping:
235
- * const azureFn: ExecutionRef = {
236
- * meta: 'task-executor',
237
- * howToRun: 'http:post',
238
- * whatToRun: 'b64:<base64url({"kind":"http-url","value":"https://myfn.azurewebsites.net/api/task-executor"})>',
239
- * argsMassaging: {
240
- * urlTemplate: "whatToRun & '?op=' & subcommand",
241
- * headerTemplate: "{ 'Authorization': 'Bearer ' & token }",
242
- * bodyTemplate: "{ 'inRef': inRef, 'outRef': outRef }",
243
- * },
244
- * };
245
- *
246
- * // Chat handler over HTTP with a different logical args shape:
247
- * const chatHandler: ExecutionRef = {
248
- * meta: 'chat-handler',
249
- * howToRun: 'http:post',
250
- * whatToRun: 'b64:<base64url({"kind":"http-url","value":"https://myfn.azurewebsites.net/api/chat"})>',
251
- * argsMassaging: {
252
- * bodyTemplate: "{ 'message': message, 'context': context, 'sessionId': sessionId }",
253
- * },
254
- * };
255
- */
256
- /**
257
- * Optional JSONata-based transforms applied to the raw invoke result.
258
- * Context for all expressions: `{ output: { result, data, error? } }`.
259
- * All fields are optional.
260
- */
261
- interface OutputTransforms {
262
- /**
263
- * JSONata expression that produces the transition name string.
264
- * @example "output.code = 200 ? 'success' : 'failure'"
265
- */
266
- resultExpr?: string;
267
- /**
268
- * JSONata expression that produces the data object.
269
- * @example "{ 'value': output.body.value }"
270
- */
271
- dataTemplate?: string;
272
- /**
273
- * JSONata expression that produces the error string, or $undefined() to clear it.
274
- * @example "output.code != 200 ? output.error_message : $undefined()"
275
- */
276
- errorExpr?: string;
277
- }
278
- /**
279
- * Optional JSONata-based mapping from logical args → physical invocation shape.
280
- *
281
- * Each field is a JSONata expression string evaluated against the caller's
282
- * logical args object (e.g. `{ inRef, outRef, errRef }` for a task-executor).
283
- *
284
- * If argsMassaging is omitted entirely, the execution adapter uses its default
285
- * mapping for the given howToRun kind.
286
- */
287
- interface ArgsMassaging {
288
- /**
289
- * Array of JSONata expressions — each evaluates to one argv string.
290
- * The resolved strings are appended after the base command.
291
- *
292
- * @example
293
- * cmdTemplate: [
294
- * "'run-source-fetch'",
295
- * "'--in-ref'", "inRef",
296
- * "'--out-ref'", "outRef",
297
- * "'--err-ref'", "errRef",
298
- * ]
299
- */
300
- cmdTemplate?: string[];
301
- /**
302
- * JSONata expression that produces the stdin payload object.
303
- * Evaluated against the logical args.
304
- * If omitted, `JSON.stringify(args)` is sent on stdin.
305
- *
306
- * @example
307
- * stdinTemplate: "{ 'X': x, 'multiplier': 2 }"
308
- */
309
- stdinTemplate?: string;
310
- /**
311
- * JSONata expression that produces the final URL string.
312
- * The input context includes 'whatToRun' (the base URL from the ref)
313
- * plus all logical args.
314
- *
315
- * @example
316
- * urlTemplate: "whatToRun & '?op=' & subcommand"
317
- */
318
- urlTemplate?: string;
319
- /**
320
- * JSONata expression that produces the request headers object.
321
- * Merged on top of the default headers (`Content-Type: application/json`).
322
- *
323
- * @example
324
- * headerTemplate: "{ 'Authorization': 'Bearer ' & token }"
325
- */
326
- headerTemplate?: string;
327
- /**
328
- * JSONata expression that produces the request body object.
329
- * Evaluated against the logical args object.
330
- *
331
- * @example
332
- * bodyTemplate: "{ 'inRef': inRef, 'outRef': outRef }"
333
- */
334
- bodyTemplate?: string;
335
- }
336
- type KnownExecutionTransport = 'local-node' | 'local-python' | 'local-process' | 'http:post' | 'http:get' | 'built-in' | 'in-browser';
337
- type ExecutionTransportKind = KnownExecutionTransport | (string & {});
338
- /**
339
- * Self-contained, serializable descriptor for invoking a target.
340
- *
341
- * Stores everything needed to make the physical call — transport kind,
342
- * artifact address, and optional arg-mapping expressions.
343
- * Serialize as plain JSON; no special wire encoding required.
344
- */
345
- interface ExecutionRef {
346
- /**
347
- * Optional human-readable label identifying the role of this invocation.
348
- * Not used for dispatch — purely for logging and diagnostics.
349
- * @example 'task-executor', 'chat-handler', 'board-live-cards'
350
- */
351
- meta?: string;
352
- /**
353
- * Transport and runtime kind — determines how whatToRun is invoked.
354
- * @see module JSDoc for the full list of supported values.
355
- */
356
- howToRun: ExecutionTransportKind;
357
- /**
358
- * Address of the artifact to run. Two valid forms:
359
- * - string: must be KindValueRef wire form `b64:<base64url(json)>` (programmatically generated via serializeRef)
360
- * - object: `{ kind: string; value: string }` plain object (human-authored flow files — normalized by the handler factory)
361
- * Prefer `kind: 'yaml-flow-cli'` when targeting a packaged public yaml-flow CLI entrypoint.
362
- * Use `kind: 'fs-path'` for external scripts or non-packaged local executables.
363
- * @example 'b64:<base64url({"kind":"yaml-flow-cli","value":"chat-store-cli.js"})>'
364
- * @example { kind: 'http-url', value: '/api/workiq/ask' }
365
- * @example { kind: 'fs-path', value: './my-handler.js' }
366
- */
367
- whatToRun: string | {
368
- kind: string;
369
- value: string;
370
- };
371
- /**
372
- * Optional JSONata-based mapping from logical args → physical call shape.
373
- * When omitted, the adapter applies its default protocol for the howToRun kind.
374
- */
375
- argsMassaging?: ArgsMassaging;
376
- /**
377
- * Optional JSONata-based transforms applied to the raw invoke result
378
- * before it reaches the step-machine engine.
379
- *
380
- * Context for all expressions: `{ output: { result, data, error? } }`
381
- * where `output` is the raw { result, data, error? } returned by invokeRefSync.
382
- *
383
- * All fields are optional — only defined ones override the raw value.
384
- *
385
- * @example
386
- * outputTransforms:
387
- * resultExpr: "output.code = 200 ? 'success' : 'failure'"
388
- * dataTemplate: "{ 'value': output.body.value }"
389
- * errorExpr: "output.code != 200 ? output.error_message : $undefined()"
390
- */
391
- outputTransforms?: OutputTransforms;
392
- /**
393
- * Opaque executor-specific configuration.
394
- * For local transports, base64-encoded and passed as --extra <base64-json> in the argv.
395
- * For HTTP transports, available in argsMassaging templates as the `extra` binding.
396
- * Stored with the ref so it travels as a single unit with the invocation descriptor.
397
- */
398
- extra?: Record<string, unknown>;
399
- }
400
- /**
401
- * Standardized result envelope returned by any execution.
402
- *
403
- * Replaces the implicit "file-exists = success, absent = failure" protocol
404
- * with an explicit status field. The data ref points to the output blob.
405
- */
406
- interface ExecutionResult {
407
- /** Outcome of the execution. */
408
- status: 'success' | 'fail' | 'error';
409
- /**
410
- * KindValueRef wire form pointing to the output blob.
411
- * Present only when status === 'success'.
412
- */
413
- data?: string;
414
- /**
415
- * Human-readable error or failure message.
416
- * Present when status === 'fail' or 'error'.
417
- */
418
- error?: string;
419
- }
420
- /**
421
- * Create an ExecutionRef from a script path string (e.g. from a --task-executor CLI arg).
422
- * File extension determines howToRun:
423
- * .js / .mjs → 'local-node'
424
- * .py → 'local-python'
425
- * other → 'local-process'
426
- *
427
- * @param scriptPath Absolute or relative path to the script / binary.
428
- * @param extra Optional opaque executor config stored on the ref.
429
- */
430
- declare function executionRefFromScriptPath(scriptPath: string, extra?: Record<string, unknown>): ExecutionRef;
431
- /**
432
- * Serialize an ExecutionRef to a JSON string for storage.
433
- * Plain JSON.stringify — no special encoding.
434
- */
435
- declare function serializeExecutionRef(ref: ExecutionRef): string;
436
- /**
437
- * Parse a JSON string back into an ExecutionRef.
438
- * Throws if the string is not valid JSON or is missing required fields.
439
- */
440
- declare function parseExecutionRef(s: string): ExecutionRef;
441
-
442
- export { type ArgsMassaging as A, type BlobStorage as B, type ExecutionRef as E, type JournalStorage as J, type KindValueRef as K, type ScratchStorage as S, type ExecutionResult as a, type KVStorage as b, type ArchiveFactory as c, type AtomicRelayLock as d, executionRefFromScriptPath as e, parseRef as f, serializeRef as g, parseExecutionRef as p, serializeExecutionRef as s };