yaml-flow 8.7.1 → 8.8.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 (182) hide show
  1. package/browser/adapters/firebase-storage.js +2 -2
  2. package/browser/adapters/firestore-storage.js +2 -2
  3. package/browser/adapters/localstorage-storage.js +3 -3
  4. package/browser/asset-integrity.json +9 -13
  5. package/browser/server-runtime-controlface.js +5 -5
  6. package/examples/ARCHITECTURE.md +0 -27
  7. package/examples/board/server/board-server.js +150 -100
  8. package/examples/board/server/board-worker/source_def_flows.json +0 -8
  9. package/examples/board/server/board-worker/task-executor.js +1 -3
  10. package/examples/board/test/server-http-test.js +108 -73
  11. package/examples/board-firestore/server/worker.js +8 -0
  12. package/examples/portfolio-tracker/portfolio-tracker.js +11 -1
  13. package/examples/portfolio-tracker/test/portfolio-t4.js +12 -2
  14. package/lib/{artifacts-store-lib-D9nMkVcE.d.cts → artifacts-store-lib-C6qBpMfU.d.cts} +1 -1
  15. package/lib/{artifacts-store-lib-DSSMqVL2.d.ts → artifacts-store-lib-D4qf7Q-7.d.ts} +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/board-live-cards-mcp.cjs +1 -1
  19. package/lib/board-live-cards-mcp.d.cts +6 -7
  20. package/lib/board-live-cards-mcp.d.ts +6 -7
  21. package/lib/board-live-cards-mcp.js +1 -1
  22. package/lib/board-live-cards-node.cjs +8 -8
  23. package/lib/board-live-cards-node.d.cts +15 -14
  24. package/lib/board-live-cards-node.d.ts +15 -14
  25. package/lib/board-live-cards-node.js +8 -8
  26. package/lib/{board-live-cards-public-LlVUQPL2.d.cts → board-live-cards-public-BT5HrgqZ.d.cts} +82 -59
  27. package/lib/{board-live-cards-public-JNRKfBZy.d.ts → board-live-cards-public-DSRamFm8.d.ts} +82 -59
  28. package/lib/{board-live-cards-public-async-Di9QB141.d.cts → board-live-cards-public-async-CYjr4mgX.d.cts} +18 -8
  29. package/lib/{board-live-cards-public-async-fwd1QI82.d.ts → board-live-cards-public-async-DlyC3PgC.d.ts} +18 -8
  30. package/lib/board-live-cards-public.cjs +1 -1
  31. package/lib/board-live-cards-public.d.cts +2 -2
  32. package/lib/board-live-cards-public.d.ts +2 -2
  33. package/lib/board-live-cards-public.js +1 -1
  34. package/lib/board-live-cards-server-runtime.cjs +1 -1
  35. package/lib/board-live-cards-server-runtime.d.cts +6 -8
  36. package/lib/board-live-cards-server-runtime.d.ts +6 -8
  37. package/lib/board-live-cards-server-runtime.js +1 -1
  38. package/lib/{board-platform-adapter-async-BfHmHdx2.d.cts → board-platform-adapter-async-BZIftm36.d.cts} +18 -14
  39. package/lib/{board-platform-adapter-async-DYahVzIK.d.ts → board-platform-adapter-async-JP9V-U5E.d.ts} +18 -14
  40. package/lib/board-worker-adapter.cjs +1 -24
  41. package/lib/board-worker-adapter.d.cts +68 -3
  42. package/lib/board-worker-adapter.d.ts +68 -3
  43. package/lib/board-worker-adapter.js +1 -24
  44. package/lib/card-store-public.d.cts +2 -2
  45. package/lib/card-store-public.d.ts +2 -2
  46. package/lib/chat-store-public.cjs +1 -1
  47. package/lib/chat-store-public.d.cts +20 -20
  48. package/lib/chat-store-public.d.ts +20 -20
  49. package/lib/chat-store-public.js +1 -1
  50. package/lib/chunk-2GSI6C45.js +7 -0
  51. package/lib/chunk-35N7ONTH.js +2 -0
  52. package/lib/chunk-37HDEW26.cjs +2 -0
  53. package/lib/{chunk-PMUSJQSR.cjs → chunk-3CZCGNY4.cjs} +2 -2
  54. package/lib/{chunk-BQS3EIEK.js → chunk-44L64VQ2.js} +3 -3
  55. package/lib/chunk-6OPXQPSC.js +2 -0
  56. package/lib/chunk-7BTZCOT5.js +2 -0
  57. package/lib/{chunk-U2N6MCD5.cjs → chunk-7JVHYHT2.cjs} +2 -2
  58. package/lib/chunk-7QZ267XP.cjs +2 -0
  59. package/lib/{chunk-XQRNDX4Q.js → chunk-ANKA7HEJ.js} +2 -2
  60. package/lib/{chunk-KAWQPLIE.cjs → chunk-BQUQTOPB.cjs} +2 -2
  61. package/lib/chunk-CMFD27ZC.cjs +3 -0
  62. package/lib/chunk-DOFNXJ4C.js +3 -0
  63. package/lib/chunk-ETW3BXHD.cjs +2 -0
  64. package/lib/{chunk-SGV7PU4H.js → chunk-FOFGEABN.js} +2 -2
  65. package/lib/chunk-GPCMBPLK.cjs +2 -0
  66. package/lib/chunk-GU3T75C4.js +3 -0
  67. package/lib/chunk-H3EHFCDZ.js +3 -0
  68. package/lib/chunk-H4TYOSMD.cjs +45 -0
  69. package/lib/chunk-HFW7E2Z7.cjs +4 -0
  70. package/lib/chunk-IQIZA7TN.cjs +7 -0
  71. package/lib/chunk-J4MHQ7JF.js +45 -0
  72. package/lib/chunk-MCPADH33.cjs +2 -0
  73. package/lib/chunk-NBJTYAYN.cjs +2 -0
  74. package/lib/chunk-NDAKMJQK.cjs +3 -0
  75. package/lib/chunk-NNSBBO5R.js +2 -0
  76. package/lib/chunk-NU5NO5NM.js +2 -0
  77. package/lib/chunk-O4RKTQBP.cjs +3 -0
  78. package/lib/chunk-O5UYCGIN.js +2 -0
  79. package/lib/chunk-Q3OTUDIE.js +2 -0
  80. package/lib/chunk-R44X3RQB.cjs +2 -0
  81. package/lib/chunk-RKKSVOP2.js +2 -0
  82. package/lib/chunk-UB54HZA4.cjs +2 -0
  83. package/lib/{chunk-CIAJNUR4.js → chunk-VGDLSS2H.js} +2 -2
  84. package/lib/{chunk-SFVO2LB2.cjs → chunk-VQCIOKJV.cjs} +3 -3
  85. package/lib/chunk-VS3BXEYK.js +4 -0
  86. package/lib/chunk-Y4WK7HE4.js +2 -0
  87. package/lib/chunk-ZK3E7L4Y.cjs +2 -0
  88. package/lib/cloud-storage.cjs +1 -1
  89. package/lib/cloud-storage.d.cts +6 -6
  90. package/lib/cloud-storage.d.ts +6 -6
  91. package/lib/cloud-storage.js +1 -1
  92. package/lib/execution-refs.cjs +1 -1
  93. package/lib/execution-refs.js +1 -1
  94. package/lib/firebase-storage/index.cjs +2 -2
  95. package/lib/firebase-storage/index.d.cts +2 -2
  96. package/lib/firebase-storage/index.d.ts +2 -2
  97. package/lib/firebase-storage/index.js +2 -2
  98. package/lib/firestore-storage/index.cjs +2 -2
  99. package/lib/firestore-storage/index.d.cts +12 -10
  100. package/lib/firestore-storage/index.d.ts +12 -10
  101. package/lib/firestore-storage/index.js +2 -2
  102. package/lib/index.d.cts +1 -1
  103. package/lib/index.d.ts +1 -1
  104. package/lib/localstorage-storage/index.cjs +1 -1
  105. package/lib/localstorage-storage/index.d.cts +10 -6
  106. package/lib/localstorage-storage/index.d.ts +10 -6
  107. package/lib/localstorage-storage/index.js +1 -1
  108. package/lib/{mcp-tool-registries-W3TRj6O5.d.cts → mcp-tool-registries-CRtea2x4.d.cts} +3 -0
  109. package/lib/{mcp-tool-registries-BBObLYga.d.ts → mcp-tool-registries-D3rWSppt.d.ts} +3 -0
  110. package/lib/server-jobs-queue-runner/index.cjs +1 -1
  111. package/lib/server-jobs-queue-runner/index.d.cts +12 -9
  112. package/lib/server-jobs-queue-runner/index.d.ts +12 -9
  113. package/lib/server-jobs-queue-runner/index.js +1 -1
  114. package/lib/server-runtime/index.cjs +1 -1
  115. package/lib/server-runtime/index.d.cts +7 -9
  116. package/lib/server-runtime/index.d.ts +7 -9
  117. package/lib/server-runtime/index.js +1 -1
  118. package/lib/server-runtime-agentface/index.d.cts +7 -9
  119. package/lib/server-runtime-agentface/index.d.ts +7 -9
  120. package/lib/server-runtime-controlface/index.cjs +1 -1
  121. package/lib/server-runtime-controlface/index.d.cts +8 -9
  122. package/lib/server-runtime-controlface/index.d.ts +8 -9
  123. package/lib/server-runtime-controlface/index.js +1 -1
  124. package/lib/server-runtime-core/index.cjs +1 -1
  125. package/lib/server-runtime-core/index.d.cts +59 -21
  126. package/lib/server-runtime-core/index.d.ts +59 -21
  127. package/lib/server-runtime-core/index.js +1 -1
  128. package/lib/server-runtime-watchers/index.cjs +1 -1
  129. package/lib/server-runtime-watchers/index.d.cts +9 -65
  130. package/lib/server-runtime-watchers/index.d.ts +9 -65
  131. package/lib/server-runtime-watchers/index.js +1 -1
  132. package/lib/server-runtime-webhooks/index.d.cts +7 -9
  133. package/lib/server-runtime-webhooks/index.d.ts +7 -9
  134. package/lib/sse-hub-CYXisfXJ.d.cts +63 -0
  135. package/lib/sse-hub-Dodwtc3_.d.ts +63 -0
  136. package/lib/step-machine-public/index.cjs +1 -1
  137. package/lib/step-machine-public/index.d.cts +1 -1
  138. package/lib/step-machine-public/index.d.ts +1 -1
  139. package/lib/step-machine-public/index.js +1 -1
  140. package/lib/{storage-async-interface-BRR4eBjx.d.cts → storage-async-interface-CG0bMqvE.d.ts} +20 -1
  141. package/lib/{storage-async-interface-DhlOVPSp.d.ts → storage-async-interface-CyO-zwVQ.d.cts} +20 -1
  142. package/lib/{storage-interface-BFiD3kyB.d.ts → storage-interface-D-iEiTJA.d.cts} +45 -1
  143. package/lib/{storage-interface-BFiD3kyB.d.cts → storage-interface-D-iEiTJA.d.ts} +45 -1
  144. package/lib/stores/index.d.cts +1 -1
  145. package/lib/stores/index.d.ts +1 -1
  146. package/lib/stores/kv.d.cts +1 -1
  147. package/lib/stores/kv.d.ts +1 -1
  148. package/lib/{types-SO5OZm4s.d.ts → types-BtH3scgE.d.ts} +64 -29
  149. package/lib/{types-Ba8H5_Wo.d.cts → types-Ch0u3FKP.d.cts} +64 -29
  150. package/package.json +4 -5
  151. package/browser/board-livecards-client.js +0 -2
  152. package/examples/board/demo-shell-with-server.html +0 -272
  153. package/examples/board/doc.html +0 -465
  154. package/examples/board/server-config.json +0 -24
  155. package/lib/chat-storage-lib-B9Q34Dyv.d.cts +0 -54
  156. package/lib/chat-storage-lib-DB9iSai2.d.ts +0 -54
  157. package/lib/chunk-5XHOHTLZ.cjs +0 -2
  158. package/lib/chunk-6APH25VI.js +0 -2
  159. package/lib/chunk-76C7N4YT.js +0 -3
  160. package/lib/chunk-76ON3V7R.js +0 -2
  161. package/lib/chunk-7ICPAABP.cjs +0 -7
  162. package/lib/chunk-ASR44K7H.cjs +0 -3
  163. package/lib/chunk-CPAXTVBQ.cjs +0 -2
  164. package/lib/chunk-EGRHWZRV.js +0 -2
  165. package/lib/chunk-EZENHAVZ.cjs +0 -2
  166. package/lib/chunk-GL2OHR2E.cjs +0 -2
  167. package/lib/chunk-GYQXDNNI.cjs +0 -2
  168. package/lib/chunk-IPLSRN6P.cjs +0 -4
  169. package/lib/chunk-J6EGN6S4.cjs +0 -3
  170. package/lib/chunk-JH37NJGP.js +0 -3
  171. package/lib/chunk-JJL5VOQZ.cjs +0 -3
  172. package/lib/chunk-NJJ7WEDT.cjs +0 -2
  173. package/lib/chunk-NKIQRCOM.cjs +0 -2
  174. package/lib/chunk-PBOQ4HYB.cjs +0 -2
  175. package/lib/chunk-PRKRXAVN.js +0 -3
  176. package/lib/chunk-QJVR3FWQ.js +0 -2
  177. package/lib/chunk-S44QZUDX.js +0 -2
  178. package/lib/chunk-TSN3RTXT.js +0 -4
  179. package/lib/chunk-VXJHBWK3.js +0 -2
  180. package/lib/chunk-WHDEBJLT.js +0 -7
  181. package/lib/chunk-YGALANRO.js +0 -2
  182. package/lib/chunk-ZCNN6XPV.js +0 -2
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkPMUSJQSR_cjs=require('../chunk-PMUSJQSR.cjs'),chunkQ6H7NINN_cjs=require('../chunk-Q6H7NINN.cjs'),chunkH5KD3JPY_cjs=require('../chunk-H5KD3JPY.cjs'),chunkKHJABJ45_cjs=require('../chunk-KHJABJ45.cjs'),chunkSFVO2LB2_cjs=require('../chunk-SFVO2LB2.cjs');require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-GNFE24S7.cjs');var module$1=require('module'),url=require('url'),path=require('path'),fs=require('fs');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var C=path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))),K=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));function L(){let r=path.resolve(C,"./jsonata-sync.cjs");return fs.existsSync(r)?r:path.resolve(C,"../card-compute/jsonata-sync.cjs")}var h=K(L());function T(r,e){if(!r||typeof r!="object")throw new Error(`[step-machine-public] Step "${e}" returned a non-object result.`);let t=r,n=t.result??t.status;if(typeof n=="string"&&n.trim().length>0){let o=t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?{...t.data}:{},a=typeof t.error=="string"?t.error:void 0;return a&&!("error"in o)&&(o.error=a),{result:n,data:o,...a?{error:a}:{}}}return {result:"success",data:{...t}}}function $(r,e){if(!e||e.length===0)return r;let t={};for(let n of e)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t}function x(r,e){return async(t,n)=>{let o=await r(t,n),a=T(o,n?.stepName??"unknown");return {result:a.result,data:$(a.data,e),...a.error?{error:a.error}:{}}}}function M(r,e,t){if(!e||e.length===0)return null;for(let n of e)try{if(!h(n).evaluate(r))return {result:"failure",data:{error:`[${t}] input validation failed: ${n}`}}}catch(o){let a=o instanceof Error?o.message:String(o);return {result:"failure",data:{error:`[${t}] input validation error on "${n}": ${a}`}}}return null}function F(r,e,t){return !e||e.length===0?r:async(n,o)=>{let a=M(n,e,t);return a||r(n,o)}}function A(r){return !!r&&typeof r=="object"&&r.type==="compute-jsonata"&&Array.isArray(r.expr)&&r.expr.length>0}function O(r){if(!r||typeof r!="object")return false;let e=r;if(e.type!=="ref"||typeof e.howToRun!="string")return false;if(typeof e.whatToRun=="string")return true;if(e.whatToRun&&typeof e.whatToRun=="object"){let t=e.whatToRun;return typeof t.kind=="string"&&typeof t.value=="string"}return false}function U(r){if(typeof r=="string"){let e=r.indexOf("=");if(e<1)throw new Error(`[step-machine-public] Invalid compute expression (missing "="): "${r}"`);return {bindTo:r.slice(0,e).trim(),expr:r.slice(e+1).trim()}}if(r&&typeof r=="object"&&typeof r.bindTo=="string"&&typeof r.expr=="string")return r;throw new Error(`[step-machine-public] Invalid compute step: ${JSON.stringify(r)}`)}function G(r,e,t){let n=e.split("."),o=r;for(let a=0;a<n.length-1;a++){let s=n[a];(o[s]==null||typeof o[s]!="object")&&(o[s]={}),o=o[s];}o[n[n.length-1]]=t;}function I(r,e,t){let n=r.expr.map(U);return async o=>{let a=o&&typeof o=="object"&&!Array.isArray(o)?{...o}:{},s={},l={expects_data:a,data:s,...t?{config:t}:{}},p,i;for(let u of n)try{let c=h(u.expr).evaluate(l);if(u.bindTo==="result")p=c!=null?String(c):"success";else if(u.bindTo==="error")i=c!=null?String(c):void 0;else if(u.bindTo.startsWith("data."))G(s,u.bindTo.slice(5),c);else return {result:"failure",data:{},error:`[${e}] invalid bindTo "${u.bindTo}": must be "result", "error", or start with "data."`}}catch(c){let d=c instanceof Error?c.message:String(c);return {result:"failure",data:{},error:`[${e}] compute "${u.bindTo}" failed: ${d}`}}return p===void 0?{result:"failure",data:{},error:`[${e}] compute-jsonata: no "result" binding declared \u2014 add '- result = "success"' to expr`}:i?{result:p,data:s,error:i}:{result:p,data:s}}}function E(r,e,t,n){let{type:o,...a}=r,s={...a,whatToRun:typeof a.whatToRun=="object"?chunkSFVO2LB2_cjs.a(a.whatToRun):a.whatToRun};return async l=>{let p=l&&typeof l=="object"&&!Array.isArray(l)?{...l}:{};n&&(p.config=n);try{let i=await t(s,p);if(!r.outputTransforms)return i;if(i&&i.result!=="success"){let u=i.data&&typeof i.data.error=="string"?String(i.data.error):void 0;return u&&!i.error?{...i,error:u}:i}try{return chunkPMUSJQSR_cjs.b(r.outputTransforms,i,e)}catch(u){let c=u instanceof Error?u.message:String(u);return {result:"failure",data:{},error:c}}}catch(i){let u=i instanceof Error?i.message:String(i);return {result:"failure",data:{error:`[step-machine-public] step "${e}" invoke threw: ${u}`}}}}}function z(){return async r=>({result:"success",data:r&&typeof r=="object"&&!Array.isArray(r)?r:{}})}function Q(r,e,t){return async(n,o)=>{let a=n?.[e.items];if(!Array.isArray(a))return {result:"failure",data:{},error:`[${t}] forEach: "${e.items}" is not an array (got ${typeof a})`};let s=a,l=e.collectAs??`${e.items}_results`;if(s.length===0)return {result:"success",data:{[l]:[]}};let{[e.items]:p,...i}=n,u=Math.max(1,e.concurrency??1),c=new Array(s.length),d=0,w=0,S=0;return await new Promise(g=>{function f(){for(;d<u&&w<s.length;){let y=w++;d++;let _={...i,[e.as]:s[y]};r(_,o).then(m=>{c[y]=m;}).catch(m=>{let P=m instanceof Error?m.message:String(m);c[y]={result:"failure",data:{},error:P};}).finally(()=>{d--,c[y]?.result==="failure"&&S++,w>=s.length&&d===0?g():f();});}d===0&&w>=s.length&&g();}f();}),S>0?{result:"failure",data:{errors:c.filter(f=>f.result==="failure").map(f=>f.error)},error:`[${t}] forEach: ${S}/${s.length} items failed`}:{result:"success",data:{[l]:c.map(g=>g.data)}}}}function J(r,e,t){let n=Array.isArray(e?.produces_data)?e?.produces_data:void 0,o=Array.isArray(e?.input_validations)?e?.input_validations:void 0,a=e?.config??void 0,s=e?.handler,l;return A(s)?l=I(s,r,a):O(s)?l=E(s,r,t.invoke,a):l=z(),e?.forEach&&(l=Q(l,e.forEach,r)),F(x(l,n),o,r)}function H(r,e){let t={};for(let[n,o]of Object.entries(r.steps??{}))t[n]=J(n,o,e);return t}function X(r){let e=r.storeFactory||(()=>new chunkH5KD3JPY_cjs.a);return {async run(t,n){try{let o=H(t,{invoke:r.invokeRef}),s=await chunkQ6H7NINN_cjs.g(t,o,{store:e()}).run(n);return s.status!=="completed"?{dispatched:!1,error:s.error?.message||s.status}:{dispatched:!0}}catch(o){return {dispatched:false,error:o instanceof Error?o.message:String(o)}}}}}Object.defineProperty(exports,"createStepMachine",{enumerable:true,get:function(){return chunkQ6H7NINN_cjs.g}});Object.defineProperty(exports,"loadStepFlow",{enumerable:true,get:function(){return chunkQ6H7NINN_cjs.j}});Object.defineProperty(exports,"MemoryStore",{enumerable:true,get:function(){return chunkH5KD3JPY_cjs.a}});Object.defineProperty(exports,"KVStorageStore",{enumerable:true,get:function(){return chunkKHJABJ45_cjs.a}});exports.buildStepHandlersForFlow=H;exports.createComputeJsonataHandler=I;exports.createPassthroughHandler=z;exports.createRefStepHandler=E;exports.createStepMachineChatFlowRunner=X;exports.filterProducedData=$;exports.isComputeJsonataSpec=A;exports.isRefSpec=O;exports.jsonata=h;exports.normalizeHandlerResult=T;exports.resolveStepHandler=J;exports.runInputValidations=M;exports.wrapWithInputValidations=F;exports.wrapWithOutputFiltering=x;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunk3CZCGNY4_cjs=require('../chunk-3CZCGNY4.cjs'),chunkQ6H7NINN_cjs=require('../chunk-Q6H7NINN.cjs'),chunkH5KD3JPY_cjs=require('../chunk-H5KD3JPY.cjs'),chunkKHJABJ45_cjs=require('../chunk-KHJABJ45.cjs'),chunkVQCIOKJV_cjs=require('../chunk-VQCIOKJV.cjs');require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-GNFE24S7.cjs');var module$1=require('module'),url=require('url'),path=require('path'),fs=require('fs');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var C=path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)))),K=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));function L(){let r=path.resolve(C,"./jsonata-sync.cjs");return fs.existsSync(r)?r:path.resolve(C,"../card-compute/jsonata-sync.cjs")}var h=K(L());function T(r,e){if(!r||typeof r!="object")throw new Error(`[step-machine-public] Step "${e}" returned a non-object result.`);let t=r,n=t.result??t.status;if(typeof n=="string"&&n.trim().length>0){let o=t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?{...t.data}:{},a=typeof t.error=="string"?t.error:void 0;return a&&!("error"in o)&&(o.error=a),{result:n,data:o,...a?{error:a}:{}}}return {result:"success",data:{...t}}}function $(r,e){if(!e||e.length===0)return r;let t={};for(let n of e)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t}function x(r,e){return async(t,n)=>{let o=await r(t,n),a=T(o,n?.stepName??"unknown");return {result:a.result,data:$(a.data,e),...a.error?{error:a.error}:{}}}}function M(r,e,t){if(!e||e.length===0)return null;for(let n of e)try{if(!h(n).evaluate(r))return {result:"failure",data:{error:`[${t}] input validation failed: ${n}`}}}catch(o){let a=o instanceof Error?o.message:String(o);return {result:"failure",data:{error:`[${t}] input validation error on "${n}": ${a}`}}}return null}function F(r,e,t){return !e||e.length===0?r:async(n,o)=>{let a=M(n,e,t);return a||r(n,o)}}function A(r){return !!r&&typeof r=="object"&&r.type==="compute-jsonata"&&Array.isArray(r.expr)&&r.expr.length>0}function O(r){if(!r||typeof r!="object")return false;let e=r;if(e.type!=="ref"||typeof e.howToRun!="string")return false;if(typeof e.whatToRun=="string")return true;if(e.whatToRun&&typeof e.whatToRun=="object"){let t=e.whatToRun;return typeof t.kind=="string"&&typeof t.value=="string"}return false}function U(r){if(typeof r=="string"){let e=r.indexOf("=");if(e<1)throw new Error(`[step-machine-public] Invalid compute expression (missing "="): "${r}"`);return {bindTo:r.slice(0,e).trim(),expr:r.slice(e+1).trim()}}if(r&&typeof r=="object"&&typeof r.bindTo=="string"&&typeof r.expr=="string")return r;throw new Error(`[step-machine-public] Invalid compute step: ${JSON.stringify(r)}`)}function G(r,e,t){let n=e.split("."),o=r;for(let a=0;a<n.length-1;a++){let s=n[a];(o[s]==null||typeof o[s]!="object")&&(o[s]={}),o=o[s];}o[n[n.length-1]]=t;}function I(r,e,t){let n=r.expr.map(U);return async o=>{let a=o&&typeof o=="object"&&!Array.isArray(o)?{...o}:{},s={},l={expects_data:a,data:s,...t?{config:t}:{}},p,i;for(let u of n)try{let c=h(u.expr).evaluate(l);if(u.bindTo==="result")p=c!=null?String(c):"success";else if(u.bindTo==="error")i=c!=null?String(c):void 0;else if(u.bindTo.startsWith("data."))G(s,u.bindTo.slice(5),c);else return {result:"failure",data:{},error:`[${e}] invalid bindTo "${u.bindTo}": must be "result", "error", or start with "data."`}}catch(c){let d=c instanceof Error?c.message:String(c);return {result:"failure",data:{},error:`[${e}] compute "${u.bindTo}" failed: ${d}`}}return p===void 0?{result:"failure",data:{},error:`[${e}] compute-jsonata: no "result" binding declared \u2014 add '- result = "success"' to expr`}:i?{result:p,data:s,error:i}:{result:p,data:s}}}function E(r,e,t,n){let{type:o,...a}=r,s={...a,whatToRun:typeof a.whatToRun=="object"?chunkVQCIOKJV_cjs.a(a.whatToRun):a.whatToRun};return async l=>{let p=l&&typeof l=="object"&&!Array.isArray(l)?{...l}:{};n&&(p.config=n);try{let i=await t(s,p);if(!r.outputTransforms)return i;if(i&&i.result!=="success"){let u=i.data&&typeof i.data.error=="string"?String(i.data.error):void 0;return u&&!i.error?{...i,error:u}:i}try{return chunk3CZCGNY4_cjs.b(r.outputTransforms,i,e)}catch(u){let c=u instanceof Error?u.message:String(u);return {result:"failure",data:{},error:c}}}catch(i){let u=i instanceof Error?i.message:String(i);return {result:"failure",data:{error:`[step-machine-public] step "${e}" invoke threw: ${u}`}}}}}function z(){return async r=>({result:"success",data:r&&typeof r=="object"&&!Array.isArray(r)?r:{}})}function Q(r,e,t){return async(n,o)=>{let a=n?.[e.items];if(!Array.isArray(a))return {result:"failure",data:{},error:`[${t}] forEach: "${e.items}" is not an array (got ${typeof a})`};let s=a,l=e.collectAs??`${e.items}_results`;if(s.length===0)return {result:"success",data:{[l]:[]}};let{[e.items]:p,...i}=n,u=Math.max(1,e.concurrency??1),c=new Array(s.length),d=0,w=0,S=0;return await new Promise(g=>{function f(){for(;d<u&&w<s.length;){let y=w++;d++;let _={...i,[e.as]:s[y]};r(_,o).then(m=>{c[y]=m;}).catch(m=>{let P=m instanceof Error?m.message:String(m);c[y]={result:"failure",data:{},error:P};}).finally(()=>{d--,c[y]?.result==="failure"&&S++,w>=s.length&&d===0?g():f();});}d===0&&w>=s.length&&g();}f();}),S>0?{result:"failure",data:{errors:c.filter(f=>f.result==="failure").map(f=>f.error)},error:`[${t}] forEach: ${S}/${s.length} items failed`}:{result:"success",data:{[l]:c.map(g=>g.data)}}}}function J(r,e,t){let n=Array.isArray(e?.produces_data)?e?.produces_data:void 0,o=Array.isArray(e?.input_validations)?e?.input_validations:void 0,a=e?.config??void 0,s=e?.handler,l;return A(s)?l=I(s,r,a):O(s)?l=E(s,r,t.invoke,a):l=z(),e?.forEach&&(l=Q(l,e.forEach,r)),F(x(l,n),o,r)}function H(r,e){let t={};for(let[n,o]of Object.entries(r.steps??{}))t[n]=J(n,o,e);return t}function X(r){let e=r.storeFactory||(()=>new chunkH5KD3JPY_cjs.a);return {async run(t,n){try{let o=H(t,{invoke:r.invokeRef}),s=await chunkQ6H7NINN_cjs.g(t,o,{store:e()}).run(n);return s.status!=="completed"?{dispatched:!1,error:s.error?.message||s.status}:{dispatched:!0}}catch(o){return {dispatched:false,error:o instanceof Error?o.message:String(o)}}}}}Object.defineProperty(exports,"createStepMachine",{enumerable:true,get:function(){return chunkQ6H7NINN_cjs.g}});Object.defineProperty(exports,"loadStepFlow",{enumerable:true,get:function(){return chunkQ6H7NINN_cjs.j}});Object.defineProperty(exports,"MemoryStore",{enumerable:true,get:function(){return chunkH5KD3JPY_cjs.a}});Object.defineProperty(exports,"KVStorageStore",{enumerable:true,get:function(){return chunkKHJABJ45_cjs.a}});exports.buildStepHandlersForFlow=H;exports.createComputeJsonataHandler=I;exports.createPassthroughHandler=z;exports.createRefStepHandler=E;exports.createStepMachineChatFlowRunner=X;exports.filterProducedData=$;exports.isComputeJsonataSpec=A;exports.isRefSpec=O;exports.jsonata=h;exports.normalizeHandlerResult=T;exports.resolveStepHandler=J;exports.runInputValidations=M;exports.wrapWithInputValidations=F;exports.wrapWithOutputFiltering=x;//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -3,7 +3,7 @@ import { l as StepMachineStore } from '../types-DjlwALZC.cjs';
3
3
  export { MemoryStore } from '../stores/memory.cjs';
4
4
  export { KVStorageStore } from '../stores/kv.cjs';
5
5
  import { ExecutionRef } from '../execution-refs.cjs';
6
- import '../storage-interface-BFiD3kyB.cjs';
6
+ import '../storage-interface-D-iEiTJA.cjs';
7
7
 
8
8
  /**
9
9
  * The single normalized shape the engine consumes.
@@ -3,7 +3,7 @@ import { l as StepMachineStore } from '../types-DjlwALZC.js';
3
3
  export { MemoryStore } from '../stores/memory.js';
4
4
  export { KVStorageStore } from '../stores/kv.js';
5
5
  import { ExecutionRef } from '../execution-refs.js';
6
- import '../storage-interface-BFiD3kyB.js';
6
+ import '../storage-interface-D-iEiTJA.js';
7
7
 
8
8
  /**
9
9
  * The single normalized shape the engine consumes.
@@ -1,2 +1,2 @@
1
- import {b}from'../chunk-CIAJNUR4.js';import {g}from'../chunk-QWBNDVUA.js';export{g as createStepMachine,j as loadStepFlow}from'../chunk-QWBNDVUA.js';import {a as a$1}from'../chunk-JM5EKT57.js';export{a as MemoryStore}from'../chunk-JM5EKT57.js';export{a as KVStorageStore}from'../chunk-FZ2SBU5M.js';import {a}from'../chunk-BQS3EIEK.js';import'../chunk-MNEOJWPS.js';import'../chunk-FW4363Y4.js';import {createRequire}from'module';import {fileURLToPath}from'url';import {dirname,resolve}from'path';import {existsSync}from'fs';var C=dirname(fileURLToPath(import.meta.url)),K=createRequire(import.meta.url);function L(){let r=resolve(C,"./jsonata-sync.cjs");return existsSync(r)?r:resolve(C,"../card-compute/jsonata-sync.cjs")}var h=K(L());function T(r,e){if(!r||typeof r!="object")throw new Error(`[step-machine-public] Step "${e}" returned a non-object result.`);let t=r,n=t.result??t.status;if(typeof n=="string"&&n.trim().length>0){let o=t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?{...t.data}:{},a=typeof t.error=="string"?t.error:void 0;return a&&!("error"in o)&&(o.error=a),{result:n,data:o,...a?{error:a}:{}}}return {result:"success",data:{...t}}}function $(r,e){if(!e||e.length===0)return r;let t={};for(let n of e)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t}function x(r,e){return async(t,n)=>{let o=await r(t,n),a=T(o,n?.stepName??"unknown");return {result:a.result,data:$(a.data,e),...a.error?{error:a.error}:{}}}}function M(r,e,t){if(!e||e.length===0)return null;for(let n of e)try{if(!h(n).evaluate(r))return {result:"failure",data:{error:`[${t}] input validation failed: ${n}`}}}catch(o){let a=o instanceof Error?o.message:String(o);return {result:"failure",data:{error:`[${t}] input validation error on "${n}": ${a}`}}}return null}function F(r,e,t){return !e||e.length===0?r:async(n,o)=>{let a=M(n,e,t);return a||r(n,o)}}function A(r){return !!r&&typeof r=="object"&&r.type==="compute-jsonata"&&Array.isArray(r.expr)&&r.expr.length>0}function O(r){if(!r||typeof r!="object")return false;let e=r;if(e.type!=="ref"||typeof e.howToRun!="string")return false;if(typeof e.whatToRun=="string")return true;if(e.whatToRun&&typeof e.whatToRun=="object"){let t=e.whatToRun;return typeof t.kind=="string"&&typeof t.value=="string"}return false}function U(r){if(typeof r=="string"){let e=r.indexOf("=");if(e<1)throw new Error(`[step-machine-public] Invalid compute expression (missing "="): "${r}"`);return {bindTo:r.slice(0,e).trim(),expr:r.slice(e+1).trim()}}if(r&&typeof r=="object"&&typeof r.bindTo=="string"&&typeof r.expr=="string")return r;throw new Error(`[step-machine-public] Invalid compute step: ${JSON.stringify(r)}`)}function G(r,e,t){let n=e.split("."),o=r;for(let a=0;a<n.length-1;a++){let s=n[a];(o[s]==null||typeof o[s]!="object")&&(o[s]={}),o=o[s];}o[n[n.length-1]]=t;}function I(r,e,t){let n=r.expr.map(U);return async o=>{let a=o&&typeof o=="object"&&!Array.isArray(o)?{...o}:{},s={},l={expects_data:a,data:s,...t?{config:t}:{}},p,i;for(let u of n)try{let c=h(u.expr).evaluate(l);if(u.bindTo==="result")p=c!=null?String(c):"success";else if(u.bindTo==="error")i=c!=null?String(c):void 0;else if(u.bindTo.startsWith("data."))G(s,u.bindTo.slice(5),c);else return {result:"failure",data:{},error:`[${e}] invalid bindTo "${u.bindTo}": must be "result", "error", or start with "data."`}}catch(c){let d=c instanceof Error?c.message:String(c);return {result:"failure",data:{},error:`[${e}] compute "${u.bindTo}" failed: ${d}`}}return p===void 0?{result:"failure",data:{},error:`[${e}] compute-jsonata: no "result" binding declared \u2014 add '- result = "success"' to expr`}:i?{result:p,data:s,error:i}:{result:p,data:s}}}function E(r,e,t,n){let{type:o,...a$1}=r,s={...a$1,whatToRun:typeof a$1.whatToRun=="object"?a(a$1.whatToRun):a$1.whatToRun};return async l=>{let p=l&&typeof l=="object"&&!Array.isArray(l)?{...l}:{};n&&(p.config=n);try{let i=await t(s,p);if(!r.outputTransforms)return i;if(i&&i.result!=="success"){let u=i.data&&typeof i.data.error=="string"?String(i.data.error):void 0;return u&&!i.error?{...i,error:u}:i}try{return b(r.outputTransforms,i,e)}catch(u){let c=u instanceof Error?u.message:String(u);return {result:"failure",data:{},error:c}}}catch(i){let u=i instanceof Error?i.message:String(i);return {result:"failure",data:{error:`[step-machine-public] step "${e}" invoke threw: ${u}`}}}}}function z(){return async r=>({result:"success",data:r&&typeof r=="object"&&!Array.isArray(r)?r:{}})}function Q(r,e,t){return async(n,o)=>{let a=n?.[e.items];if(!Array.isArray(a))return {result:"failure",data:{},error:`[${t}] forEach: "${e.items}" is not an array (got ${typeof a})`};let s=a,l=e.collectAs??`${e.items}_results`;if(s.length===0)return {result:"success",data:{[l]:[]}};let{[e.items]:p,...i}=n,u=Math.max(1,e.concurrency??1),c=new Array(s.length),d=0,w=0,S=0;return await new Promise(g=>{function f(){for(;d<u&&w<s.length;){let y=w++;d++;let _={...i,[e.as]:s[y]};r(_,o).then(m=>{c[y]=m;}).catch(m=>{let P=m instanceof Error?m.message:String(m);c[y]={result:"failure",data:{},error:P};}).finally(()=>{d--,c[y]?.result==="failure"&&S++,w>=s.length&&d===0?g():f();});}d===0&&w>=s.length&&g();}f();}),S>0?{result:"failure",data:{errors:c.filter(f=>f.result==="failure").map(f=>f.error)},error:`[${t}] forEach: ${S}/${s.length} items failed`}:{result:"success",data:{[l]:c.map(g=>g.data)}}}}function J(r,e,t){let n=Array.isArray(e?.produces_data)?e?.produces_data:void 0,o=Array.isArray(e?.input_validations)?e?.input_validations:void 0,a=e?.config??void 0,s=e?.handler,l;return A(s)?l=I(s,r,a):O(s)?l=E(s,r,t.invoke,a):l=z(),e?.forEach&&(l=Q(l,e.forEach,r)),F(x(l,n),o,r)}function H(r,e){let t={};for(let[n,o]of Object.entries(r.steps??{}))t[n]=J(n,o,e);return t}function X(r){let e=r.storeFactory||(()=>new a$1);return {async run(t,n){try{let o=H(t,{invoke:r.invokeRef}),s=await g(t,o,{store:e()}).run(n);return s.status!=="completed"?{dispatched:!1,error:s.error?.message||s.status}:{dispatched:!0}}catch(o){return {dispatched:false,error:o instanceof Error?o.message:String(o)}}}}}export{H as buildStepHandlersForFlow,I as createComputeJsonataHandler,z as createPassthroughHandler,E as createRefStepHandler,X as createStepMachineChatFlowRunner,$ as filterProducedData,A as isComputeJsonataSpec,O as isRefSpec,h as jsonata,T as normalizeHandlerResult,J as resolveStepHandler,M as runInputValidations,F as wrapWithInputValidations,x as wrapWithOutputFiltering};//# sourceMappingURL=index.js.map
1
+ import {b}from'../chunk-VGDLSS2H.js';import {g}from'../chunk-QWBNDVUA.js';export{g as createStepMachine,j as loadStepFlow}from'../chunk-QWBNDVUA.js';import {a as a$1}from'../chunk-JM5EKT57.js';export{a as MemoryStore}from'../chunk-JM5EKT57.js';export{a as KVStorageStore}from'../chunk-FZ2SBU5M.js';import {a}from'../chunk-44L64VQ2.js';import'../chunk-MNEOJWPS.js';import'../chunk-FW4363Y4.js';import {createRequire}from'module';import {fileURLToPath}from'url';import {dirname,resolve}from'path';import {existsSync}from'fs';var C=dirname(fileURLToPath(import.meta.url)),K=createRequire(import.meta.url);function L(){let r=resolve(C,"./jsonata-sync.cjs");return existsSync(r)?r:resolve(C,"../card-compute/jsonata-sync.cjs")}var h=K(L());function T(r,e){if(!r||typeof r!="object")throw new Error(`[step-machine-public] Step "${e}" returned a non-object result.`);let t=r,n=t.result??t.status;if(typeof n=="string"&&n.trim().length>0){let o=t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?{...t.data}:{},a=typeof t.error=="string"?t.error:void 0;return a&&!("error"in o)&&(o.error=a),{result:n,data:o,...a?{error:a}:{}}}return {result:"success",data:{...t}}}function $(r,e){if(!e||e.length===0)return r;let t={};for(let n of e)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t}function x(r,e){return async(t,n)=>{let o=await r(t,n),a=T(o,n?.stepName??"unknown");return {result:a.result,data:$(a.data,e),...a.error?{error:a.error}:{}}}}function M(r,e,t){if(!e||e.length===0)return null;for(let n of e)try{if(!h(n).evaluate(r))return {result:"failure",data:{error:`[${t}] input validation failed: ${n}`}}}catch(o){let a=o instanceof Error?o.message:String(o);return {result:"failure",data:{error:`[${t}] input validation error on "${n}": ${a}`}}}return null}function F(r,e,t){return !e||e.length===0?r:async(n,o)=>{let a=M(n,e,t);return a||r(n,o)}}function A(r){return !!r&&typeof r=="object"&&r.type==="compute-jsonata"&&Array.isArray(r.expr)&&r.expr.length>0}function O(r){if(!r||typeof r!="object")return false;let e=r;if(e.type!=="ref"||typeof e.howToRun!="string")return false;if(typeof e.whatToRun=="string")return true;if(e.whatToRun&&typeof e.whatToRun=="object"){let t=e.whatToRun;return typeof t.kind=="string"&&typeof t.value=="string"}return false}function U(r){if(typeof r=="string"){let e=r.indexOf("=");if(e<1)throw new Error(`[step-machine-public] Invalid compute expression (missing "="): "${r}"`);return {bindTo:r.slice(0,e).trim(),expr:r.slice(e+1).trim()}}if(r&&typeof r=="object"&&typeof r.bindTo=="string"&&typeof r.expr=="string")return r;throw new Error(`[step-machine-public] Invalid compute step: ${JSON.stringify(r)}`)}function G(r,e,t){let n=e.split("."),o=r;for(let a=0;a<n.length-1;a++){let s=n[a];(o[s]==null||typeof o[s]!="object")&&(o[s]={}),o=o[s];}o[n[n.length-1]]=t;}function I(r,e,t){let n=r.expr.map(U);return async o=>{let a=o&&typeof o=="object"&&!Array.isArray(o)?{...o}:{},s={},l={expects_data:a,data:s,...t?{config:t}:{}},p,i;for(let u of n)try{let c=h(u.expr).evaluate(l);if(u.bindTo==="result")p=c!=null?String(c):"success";else if(u.bindTo==="error")i=c!=null?String(c):void 0;else if(u.bindTo.startsWith("data."))G(s,u.bindTo.slice(5),c);else return {result:"failure",data:{},error:`[${e}] invalid bindTo "${u.bindTo}": must be "result", "error", or start with "data."`}}catch(c){let d=c instanceof Error?c.message:String(c);return {result:"failure",data:{},error:`[${e}] compute "${u.bindTo}" failed: ${d}`}}return p===void 0?{result:"failure",data:{},error:`[${e}] compute-jsonata: no "result" binding declared \u2014 add '- result = "success"' to expr`}:i?{result:p,data:s,error:i}:{result:p,data:s}}}function E(r,e,t,n){let{type:o,...a$1}=r,s={...a$1,whatToRun:typeof a$1.whatToRun=="object"?a(a$1.whatToRun):a$1.whatToRun};return async l=>{let p=l&&typeof l=="object"&&!Array.isArray(l)?{...l}:{};n&&(p.config=n);try{let i=await t(s,p);if(!r.outputTransforms)return i;if(i&&i.result!=="success"){let u=i.data&&typeof i.data.error=="string"?String(i.data.error):void 0;return u&&!i.error?{...i,error:u}:i}try{return b(r.outputTransforms,i,e)}catch(u){let c=u instanceof Error?u.message:String(u);return {result:"failure",data:{},error:c}}}catch(i){let u=i instanceof Error?i.message:String(i);return {result:"failure",data:{error:`[step-machine-public] step "${e}" invoke threw: ${u}`}}}}}function z(){return async r=>({result:"success",data:r&&typeof r=="object"&&!Array.isArray(r)?r:{}})}function Q(r,e,t){return async(n,o)=>{let a=n?.[e.items];if(!Array.isArray(a))return {result:"failure",data:{},error:`[${t}] forEach: "${e.items}" is not an array (got ${typeof a})`};let s=a,l=e.collectAs??`${e.items}_results`;if(s.length===0)return {result:"success",data:{[l]:[]}};let{[e.items]:p,...i}=n,u=Math.max(1,e.concurrency??1),c=new Array(s.length),d=0,w=0,S=0;return await new Promise(g=>{function f(){for(;d<u&&w<s.length;){let y=w++;d++;let _={...i,[e.as]:s[y]};r(_,o).then(m=>{c[y]=m;}).catch(m=>{let P=m instanceof Error?m.message:String(m);c[y]={result:"failure",data:{},error:P};}).finally(()=>{d--,c[y]?.result==="failure"&&S++,w>=s.length&&d===0?g():f();});}d===0&&w>=s.length&&g();}f();}),S>0?{result:"failure",data:{errors:c.filter(f=>f.result==="failure").map(f=>f.error)},error:`[${t}] forEach: ${S}/${s.length} items failed`}:{result:"success",data:{[l]:c.map(g=>g.data)}}}}function J(r,e,t){let n=Array.isArray(e?.produces_data)?e?.produces_data:void 0,o=Array.isArray(e?.input_validations)?e?.input_validations:void 0,a=e?.config??void 0,s=e?.handler,l;return A(s)?l=I(s,r,a):O(s)?l=E(s,r,t.invoke,a):l=z(),e?.forEach&&(l=Q(l,e.forEach,r)),F(x(l,n),o,r)}function H(r,e){let t={};for(let[n,o]of Object.entries(r.steps??{}))t[n]=J(n,o,e);return t}function X(r){let e=r.storeFactory||(()=>new a$1);return {async run(t,n){try{let o=H(t,{invoke:r.invokeRef}),s=await g(t,o,{store:e()}).run(n);return s.status!=="completed"?{dispatched:!1,error:s.error?.message||s.status}:{dispatched:!0}}catch(o){return {dispatched:false,error:o instanceof Error?o.message:String(o)}}}}}export{H as buildStepHandlersForFlow,I as createComputeJsonataHandler,z as createPassthroughHandler,E as createRefStepHandler,X as createStepMachineChatFlowRunner,$ as filterProducedData,A as isComputeJsonataSpec,O as isRefSpec,h as jsonata,T as normalizeHandlerResult,J as resolveStepHandler,M as runInputValidations,F as wrapWithInputValidations,x as wrapWithOutputFiltering};//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { b as BlobStat, a as KindValueRef, c as JournalEntry, d as JournalReadResult, Q as QueueMessage, e as QueueLeasedMessage, f as QueueDeadLetterMessage } from './storage-interface-BFiD3kyB.cjs';
1
+ import { b as BlobStat, a as KindValueRef, Q as QueueMessage, c as QueueLeasedMessage, d as QueueDeadLetterMessage, J as JournalEntry, e as JournalReadResult } from './storage-interface-D-iEiTJA.js';
2
2
 
3
3
  interface AsyncBlobStorage {
4
4
  read(key: string): Promise<string | null>;
@@ -10,6 +10,13 @@ interface AsyncBlobStorage {
10
10
  listKeys(prefix?: string): Promise<string[]>;
11
11
  stat?(key: string): Promise<BlobStat | null>;
12
12
  keyRef?(key: string): Promise<KindValueRef> | KindValueRef;
13
+ /**
14
+ * Atomically move content from `from` to `to`, replacing any existing value at `to`.
15
+ * Returns true on success, false if `from` does not exist.
16
+ * If the underlying adapter does not support a first-class rename operation,
17
+ * implement a simple fallback: read `from`, write `to`, then delete `from`.
18
+ */
19
+ renameKey(from: string, to: string): Promise<boolean>;
13
20
  }
14
21
  interface AsyncJournalStorage {
15
22
  append(payload: unknown): Promise<JournalEntry>;
@@ -19,6 +26,8 @@ interface AsyncJournalStorage {
19
26
  }
20
27
  interface AsyncQueueStorage {
21
28
  enqueue<T>(body: T): Promise<QueueMessage<T>>;
29
+ /** See QueueStorage.enqueueMany. */
30
+ enqueueMany<T>(bodies: T[]): Promise<QueueMessage<T>[]>;
22
31
  /** See QueueStorage.enqueueIfAbsent. Optional on adapters that cannot cheaply dedup. */
23
32
  enqueueIfAbsent?<T>(body: T, dedupKey: string): Promise<QueueMessage<T> | null>;
24
33
  lease<T>(opts?: {
@@ -32,6 +41,16 @@ interface AsyncQueueStorage {
32
41
  }): Promise<boolean>;
33
42
  peekActive<T>(prefix?: string): Promise<QueueMessage<T>[]>;
34
43
  peekDeadLetter<T>(prefix?: string): Promise<QueueDeadLetterMessage<T>[]>;
44
+ /** See QueueStorage.stage. */
45
+ stage<T>(body: T, opts?: {
46
+ dedupKey?: string;
47
+ }): Promise<QueueMessage<T> | null>;
48
+ /** See QueueStorage.commitStaged. */
49
+ commitStaged(messageId: string): Promise<boolean>;
50
+ /** See QueueStorage.discardStaged. */
51
+ discardStaged(messageId: string, reason?: string): Promise<boolean>;
52
+ /** See QueueStorage.peekStaged. */
53
+ peekStaged<T>(prefix?: string): Promise<QueueMessage<T>[]>;
35
54
  }
36
55
  interface AsyncKVStorage {
37
56
  read(key: string): Promise<unknown | null>;
@@ -1,4 +1,4 @@
1
- import { b as BlobStat, a as KindValueRef, c as JournalEntry, d as JournalReadResult, Q as QueueMessage, e as QueueLeasedMessage, f as QueueDeadLetterMessage } from './storage-interface-BFiD3kyB.js';
1
+ import { b as BlobStat, a as KindValueRef, Q as QueueMessage, c as QueueLeasedMessage, d as QueueDeadLetterMessage, J as JournalEntry, e as JournalReadResult } from './storage-interface-D-iEiTJA.cjs';
2
2
 
3
3
  interface AsyncBlobStorage {
4
4
  read(key: string): Promise<string | null>;
@@ -10,6 +10,13 @@ interface AsyncBlobStorage {
10
10
  listKeys(prefix?: string): Promise<string[]>;
11
11
  stat?(key: string): Promise<BlobStat | null>;
12
12
  keyRef?(key: string): Promise<KindValueRef> | KindValueRef;
13
+ /**
14
+ * Atomically move content from `from` to `to`, replacing any existing value at `to`.
15
+ * Returns true on success, false if `from` does not exist.
16
+ * If the underlying adapter does not support a first-class rename operation,
17
+ * implement a simple fallback: read `from`, write `to`, then delete `from`.
18
+ */
19
+ renameKey(from: string, to: string): Promise<boolean>;
13
20
  }
14
21
  interface AsyncJournalStorage {
15
22
  append(payload: unknown): Promise<JournalEntry>;
@@ -19,6 +26,8 @@ interface AsyncJournalStorage {
19
26
  }
20
27
  interface AsyncQueueStorage {
21
28
  enqueue<T>(body: T): Promise<QueueMessage<T>>;
29
+ /** See QueueStorage.enqueueMany. */
30
+ enqueueMany<T>(bodies: T[]): Promise<QueueMessage<T>[]>;
22
31
  /** See QueueStorage.enqueueIfAbsent. Optional on adapters that cannot cheaply dedup. */
23
32
  enqueueIfAbsent?<T>(body: T, dedupKey: string): Promise<QueueMessage<T> | null>;
24
33
  lease<T>(opts?: {
@@ -32,6 +41,16 @@ interface AsyncQueueStorage {
32
41
  }): Promise<boolean>;
33
42
  peekActive<T>(prefix?: string): Promise<QueueMessage<T>[]>;
34
43
  peekDeadLetter<T>(prefix?: string): Promise<QueueDeadLetterMessage<T>[]>;
44
+ /** See QueueStorage.stage. */
45
+ stage<T>(body: T, opts?: {
46
+ dedupKey?: string;
47
+ }): Promise<QueueMessage<T> | null>;
48
+ /** See QueueStorage.commitStaged. */
49
+ commitStaged(messageId: string): Promise<boolean>;
50
+ /** See QueueStorage.discardStaged. */
51
+ discardStaged(messageId: string, reason?: string): Promise<boolean>;
52
+ /** See QueueStorage.peekStaged. */
53
+ peekStaged<T>(prefix?: string): Promise<QueueMessage<T>[]>;
35
54
  }
36
55
  interface AsyncKVStorage {
37
56
  read(key: string): Promise<unknown | null>;
@@ -57,6 +57,13 @@ interface BlobStorage {
57
57
  * Other backends: backend-specific ref
58
58
  */
59
59
  keyRef?(key: string): KindValueRef;
60
+ /**
61
+ * Atomically move content from `from` to `to`, replacing any existing value at `to`.
62
+ * Returns true on success, false if `from` does not exist.
63
+ * If the underlying adapter does not support a first-class rename operation,
64
+ * implement a simple fallback: read `from`, write `to`, then delete `from`.
65
+ */
66
+ renameKey(from: string, to: string): boolean;
60
67
  }
61
68
  interface KindValueRef {
62
69
  readonly kind: string;
@@ -103,6 +110,11 @@ interface QueueDeadLetterMessage<T = unknown> extends QueueMessage<T> {
103
110
  }
104
111
  interface QueueStorage {
105
112
  enqueue<T>(body: T): QueueMessage<T>;
113
+ /**
114
+ * Enqueue multiple messages. Adapters may implement this as a native batch
115
+ * write or as a simple loop over `enqueue`.
116
+ */
117
+ enqueueMany<T>(bodies: T[]): QueueMessage<T>[];
106
118
  /**
107
119
  * Enqueue only if no active or leased message with the same dedupKey exists.
108
120
  * Returns the new message, or null if a pending message with that key is
@@ -124,6 +136,38 @@ interface QueueStorage {
124
136
  }): boolean;
125
137
  peekActive<T>(prefix?: string): QueueMessage<T>[];
126
138
  peekDeadLetter<T>(prefix?: string): QueueDeadLetterMessage<T>[];
139
+ /**
140
+ * Stage a message in a pending, uncommitted state. Staged messages are
141
+ * invisible to `lease` and `peekActive`, do not consume a lease, and have no
142
+ * automatic transition out of the staged state — they remain until
143
+ * `commitStaged` or `discardStaged` is called for them.
144
+ *
145
+ * If `opts.dedupKey` is supplied, the same dedup contract used by
146
+ * `enqueueIfAbsent` applies: the key is reserved while the message is staged,
147
+ * active, or leased, and a concurrent `enqueueIfAbsent`/`stage` with the same
148
+ * key returns null.
149
+ *
150
+ * Backends that cannot keep an "invisible" message in their native queue
151
+ * (e.g. Azure Storage Queue, SQS) should store staged records in a sibling
152
+ * key-value table and only `enqueue` into the underlying queue on commit.
153
+ */
154
+ stage<T>(body: T, opts?: {
155
+ dedupKey?: string;
156
+ }): QueueMessage<T> | null;
157
+ /**
158
+ * Promote a staged message to active so it can be leased.
159
+ * Sets `enqueuedAt` to the commit time and `attempt` to 0.
160
+ * Returns false if no staged message with that id exists.
161
+ */
162
+ commitStaged(messageId: string): boolean;
163
+ /**
164
+ * Move a staged message directly to the dead-letter store with the given
165
+ * reason. The message never becomes leasable.
166
+ * Returns false if no staged message with that id exists.
167
+ */
168
+ discardStaged(messageId: string, reason?: string): boolean;
169
+ /** Inspect staged messages. Order is implementation-defined. */
170
+ peekStaged<T>(prefix?: string): QueueMessage<T>[];
127
171
  }
128
172
  interface KVStorage {
129
173
  /** Returns the stored value, or null if the key does not exist. */
@@ -182,4 +226,4 @@ interface AtomicRelayLock {
182
226
  tryAcquire(): (() => void) | null;
183
227
  }
184
228
 
185
- export { type ArchiveFactory as A, type BlobStorage as B, type JournalStorage as J, type KVStorage as K, type QueueMessage as Q, type ScratchStorage as S, type KindValueRef as a, type BlobStat as b, type JournalEntry as c, type JournalReadResult as d, type QueueLeasedMessage as e, type QueueDeadLetterMessage as f, type QueueStorage as g, type AtomicRelayLock as h, parseRef as p, serializeRef as s };
229
+ export { type ArchiveFactory as A, type BlobStorage as B, type JournalEntry as J, type KVStorage as K, type QueueMessage as Q, type ScratchStorage as S, type KindValueRef as a, type BlobStat as b, type QueueLeasedMessage as c, type QueueDeadLetterMessage as d, type JournalReadResult as e, type QueueStorage as f, type JournalStorage as g, type AtomicRelayLock as h, parseRef as p, serializeRef as s };
@@ -57,6 +57,13 @@ interface BlobStorage {
57
57
  * Other backends: backend-specific ref
58
58
  */
59
59
  keyRef?(key: string): KindValueRef;
60
+ /**
61
+ * Atomically move content from `from` to `to`, replacing any existing value at `to`.
62
+ * Returns true on success, false if `from` does not exist.
63
+ * If the underlying adapter does not support a first-class rename operation,
64
+ * implement a simple fallback: read `from`, write `to`, then delete `from`.
65
+ */
66
+ renameKey(from: string, to: string): boolean;
60
67
  }
61
68
  interface KindValueRef {
62
69
  readonly kind: string;
@@ -103,6 +110,11 @@ interface QueueDeadLetterMessage<T = unknown> extends QueueMessage<T> {
103
110
  }
104
111
  interface QueueStorage {
105
112
  enqueue<T>(body: T): QueueMessage<T>;
113
+ /**
114
+ * Enqueue multiple messages. Adapters may implement this as a native batch
115
+ * write or as a simple loop over `enqueue`.
116
+ */
117
+ enqueueMany<T>(bodies: T[]): QueueMessage<T>[];
106
118
  /**
107
119
  * Enqueue only if no active or leased message with the same dedupKey exists.
108
120
  * Returns the new message, or null if a pending message with that key is
@@ -124,6 +136,38 @@ interface QueueStorage {
124
136
  }): boolean;
125
137
  peekActive<T>(prefix?: string): QueueMessage<T>[];
126
138
  peekDeadLetter<T>(prefix?: string): QueueDeadLetterMessage<T>[];
139
+ /**
140
+ * Stage a message in a pending, uncommitted state. Staged messages are
141
+ * invisible to `lease` and `peekActive`, do not consume a lease, and have no
142
+ * automatic transition out of the staged state — they remain until
143
+ * `commitStaged` or `discardStaged` is called for them.
144
+ *
145
+ * If `opts.dedupKey` is supplied, the same dedup contract used by
146
+ * `enqueueIfAbsent` applies: the key is reserved while the message is staged,
147
+ * active, or leased, and a concurrent `enqueueIfAbsent`/`stage` with the same
148
+ * key returns null.
149
+ *
150
+ * Backends that cannot keep an "invisible" message in their native queue
151
+ * (e.g. Azure Storage Queue, SQS) should store staged records in a sibling
152
+ * key-value table and only `enqueue` into the underlying queue on commit.
153
+ */
154
+ stage<T>(body: T, opts?: {
155
+ dedupKey?: string;
156
+ }): QueueMessage<T> | null;
157
+ /**
158
+ * Promote a staged message to active so it can be leased.
159
+ * Sets `enqueuedAt` to the commit time and `attempt` to 0.
160
+ * Returns false if no staged message with that id exists.
161
+ */
162
+ commitStaged(messageId: string): boolean;
163
+ /**
164
+ * Move a staged message directly to the dead-letter store with the given
165
+ * reason. The message never becomes leasable.
166
+ * Returns false if no staged message with that id exists.
167
+ */
168
+ discardStaged(messageId: string, reason?: string): boolean;
169
+ /** Inspect staged messages. Order is implementation-defined. */
170
+ peekStaged<T>(prefix?: string): QueueMessage<T>[];
127
171
  }
128
172
  interface KVStorage {
129
173
  /** Returns the stored value, or null if the key does not exist. */
@@ -182,4 +226,4 @@ interface AtomicRelayLock {
182
226
  tryAcquire(): (() => void) | null;
183
227
  }
184
228
 
185
- export { type ArchiveFactory as A, type BlobStorage as B, type JournalStorage as J, type KVStorage as K, type QueueMessage as Q, type ScratchStorage as S, type KindValueRef as a, type BlobStat as b, type JournalEntry as c, type JournalReadResult as d, type QueueLeasedMessage as e, type QueueDeadLetterMessage as f, type QueueStorage as g, type AtomicRelayLock as h, parseRef as p, serializeRef as s };
229
+ export { type ArchiveFactory as A, type BlobStorage as B, type JournalEntry as J, type KVStorage as K, type QueueMessage as Q, type ScratchStorage as S, type KindValueRef as a, type BlobStat as b, type QueueLeasedMessage as c, type QueueDeadLetterMessage as d, type JournalReadResult as e, type QueueStorage as f, type JournalStorage as g, type AtomicRelayLock as h, parseRef as p, serializeRef as s };
@@ -1,4 +1,4 @@
1
1
  export { MemoryStore } from './memory.cjs';
2
2
  export { KVStorageStore } from './kv.cjs';
3
3
  import '../types-DjlwALZC.cjs';
4
- import '../storage-interface-BFiD3kyB.cjs';
4
+ import '../storage-interface-D-iEiTJA.cjs';
@@ -1,4 +1,4 @@
1
1
  export { MemoryStore } from './memory.js';
2
2
  export { KVStorageStore } from './kv.js';
3
3
  import '../types-DjlwALZC.js';
4
- import '../storage-interface-BFiD3kyB.js';
4
+ import '../storage-interface-D-iEiTJA.js';
@@ -1,5 +1,5 @@
1
1
  import { l as StepMachineStore, k as StepMachineState } from '../types-DjlwALZC.cjs';
2
- import { K as KVStorage } from '../storage-interface-BFiD3kyB.cjs';
2
+ import { K as KVStorage } from '../storage-interface-D-iEiTJA.cjs';
3
3
 
4
4
  /**
5
5
  * yaml-flow - KVStorageStore
@@ -1,5 +1,5 @@
1
1
  import { l as StepMachineStore, k as StepMachineState } from '../types-DjlwALZC.js';
2
- import { K as KVStorage } from '../storage-interface-BFiD3kyB.js';
2
+ import { K as KVStorage } from '../storage-interface-D-iEiTJA.js';
3
3
 
4
4
  /**
5
5
  * yaml-flow - KVStorageStore
@@ -1,10 +1,55 @@
1
- import { a as ArtifactsStore } from './artifacts-store-lib-DSSMqVL2.js';
2
- import { e as BoardPlatformAdapter, g as BoardLiveCardsNonCorePublic, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult, f as BoardWorkerRequest } from './board-live-cards-public-JNRKfBZy.js';
3
- import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-DYahVzIK.js';
4
- import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-fwd1QI82.js';
1
+ import { e as BoardPlatformAdapter, l as BoardLiveCardsNonCorePublic, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult } from './board-live-cards-public-DSRamFm8.js';
5
2
  import { ExecutionRef } from './execution-refs.js';
6
- import { a as KindValueRef } from './storage-interface-BFiD3kyB.js';
7
- import { C as ChatStorage } from './chat-storage-lib-DB9iSai2.js';
3
+ import { f as QueueStorage, a as KindValueRef } from './storage-interface-D-iEiTJA.js';
4
+ import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-JP9V-U5E.js';
5
+ import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-DlyC3PgC.js';
6
+
7
+ interface BoardWorkerRequest {
8
+ boardId?: string;
9
+ ref: ExecutionRef;
10
+ args: Record<string, unknown>;
11
+ }
12
+ interface BoardWorkerQueuedRequest {
13
+ messageId: string;
14
+ enqueuedAt: string;
15
+ attempt: number;
16
+ request: BoardWorkerRequest;
17
+ }
18
+ interface BoardWorkerLeasedRequest extends BoardWorkerQueuedRequest {
19
+ leaseToken: string;
20
+ leaseExpiresAt: string;
21
+ }
22
+ interface BoardWorkerDeadLetterRequest extends BoardWorkerQueuedRequest {
23
+ reason?: string;
24
+ }
25
+ interface BoardWorkerStore {
26
+ enqueueRequest(request: BoardWorkerRequest): string;
27
+ enqueueRequestIfAbsent?(request: BoardWorkerRequest, dedupKey: string): string | null;
28
+ leaseRequests(opts?: {
29
+ max?: number;
30
+ visibilityMs?: number;
31
+ }): BoardWorkerLeasedRequest[];
32
+ ackRequest(messageId: string, leaseToken: string): boolean;
33
+ nackRequest(messageId: string, leaseToken: string, opts?: {
34
+ dead?: boolean;
35
+ reason?: string;
36
+ }): boolean;
37
+ peekActive(): BoardWorkerQueuedRequest[];
38
+ peekDeadLetter(): BoardWorkerDeadLetterRequest[];
39
+ }
40
+ declare function createBoardWorkerStore(queue: QueueStorage): BoardWorkerStore;
41
+
42
+ /**
43
+ * server-runtime/types.ts
44
+ *
45
+ * Platform-free adapter interfaces for the board server runtime.
46
+ *
47
+ * The runtime (index.ts) imports ONLY this file and board-live-cards-public
48
+ * for its dependencies — no node:fs, node:net, node:child_process, etc.
49
+ *
50
+ * Hosts (demo-server, Azure Function, Firebase Function) provide implementations
51
+ * of these interfaces when constructing the runtime.
52
+ */
8
53
 
9
54
  type BoardRuntimeNonCorePublic = Pick<BoardLiveCardsNonCorePublic, 'describeTaskExecutorCapabilities' | 'validateCardPreflight' | 'evalCardCompute' | 'probeSourcePreflight' | 'runSourcePreflight' | 'simulateCardCycle'>;
10
55
  type Awaitable<T> = T | Promise<T>;
@@ -83,26 +128,20 @@ interface BoardContextConfig {
83
128
  boardAdapter: BoardRuntimePlatformAdapter;
84
129
  nonCore?: BoardRuntimeNonCorePublic;
85
130
  nonCoreAdapter?: BoardNonCorePlatformAdapter;
86
- /** Optional separate adapter for file/chat blob storage (defaults to boardAdapter) */
87
- artifactsAdapter?: BoardRuntimePlatformAdapter;
88
- /** Optional explicit blob root ref for persisted card/file attachments. */
89
- artifactsStoreRef?: string;
90
- /**
91
- * Optional caller-supplied file artifacts store. When provided, this is used
92
- * verbatim and the runtime does NOT consult artifactsAdapter.blobStorage('files').
93
- * Use this to give the embedder full control over the on-disk layout (e.g.
94
- * via createFsBoardFileArtifactsStore(baseDir, { filesSubdir: '' })).
95
- */
96
- filesArtifactsStore?: ArtifactsStore;
131
+ boardRuntimeStoreRef: string;
132
+ /** Explicit ref for externally backed runtime storage (journal + internal queue lanes). */
133
+ queueStoreRef: string;
134
+ /** Explicit blob root ref for persisted card/file attachments. */
135
+ artifactsStoreRef: string;
136
+ /** Explicit ref for fetched source payloads. */
137
+ fetchedSourcesStoreRef: string;
97
138
  baseRef: KindValueRef;
98
139
  cardStoreRef: string;
99
140
  outputsStoreRef: string;
100
- /** Optional ref pointing persisted card chat storage at a different backend. */
101
- chatStoreRef?: string;
102
- /** Optional ref pointing scratch storage at a different backend than the board runtime. */
103
- scratchStoreRef?: string;
104
- /** Optional ref pointing archive storage at a different backend than the board runtime. */
105
- archiveStoreRef?: string;
141
+ /** Explicit ref pointing persisted card chat storage at a different backend. */
142
+ chatStoreRef: string;
143
+ /** Explicit ref pointing scratch storage at a different backend than the board runtime. */
144
+ scratchStoreRef: string;
106
145
  /** Notification endpoint ref — e.g. ::named-pipe::<path> or ::firestore-watch::<path> */
107
146
  notifyRef?: KindValueRef;
108
147
  taskExecutorRef?: ExecutionRef;
@@ -119,8 +158,6 @@ interface SingleBoardRuntimeOptions {
119
158
  boards: BoardContextConfig[];
120
159
  invocationAdapter: InvocationAdapter;
121
160
  chatFlowRunner?: ChatHandlerFlowRunner;
122
- /** Chat storage backend. Defaults to an in-memory store when omitted. */
123
- chatStorage?: ChatStorage;
124
161
  notificationTransport?: NotificationTransport;
125
162
  logger?: RuntimeLogger;
126
163
  serverUrl?: string;
@@ -158,10 +195,8 @@ interface SingleBoardRuntime {
158
195
  readonly queueLaneTuning: HostedBoardQueueLaneTuning;
159
196
  handleRuntimeApi(req: RuntimeRequest, res: RuntimeResponse, parsedUrl: URL): Promise<boolean>;
160
197
  buildPublishedRuntimePayload(): Awaitable<unknown>;
161
- processAccumulatedEvents(): Awaitable<CommandResult>;
162
- processAccumulatedLane(): Awaitable<CommandResult>;
163
198
  handleChatAgentRequest(request: BoardWorkerRequest): Awaitable<void>;
164
- clearChatRecords(cardId: string): void;
199
+ clearChatRecords(cardId: string): Awaitable<void>;
165
200
  /** Report that a source fetch completed. Token is the source callback token; ref is the blob ref (b64:<base64url(json)>). */
166
201
  reportSourceFetched(token: string, ref: string): Awaitable<CommandResult>;
167
202
  /** Report that a source fetch failed. Token is the source callback token. */
@@ -211,4 +246,4 @@ interface RuntimeResponse {
211
246
  end(data?: string | Buffer): void;
212
247
  }
213
248
 
214
- export type { Awaitable as A, BoardContextConfig as B, ChatHandlerFlowRunner as C, DescribeEnvelope as D, HostedBoardQueueLaneTuning as H, InvocationAdapter as I, MultiBoardRuntimeOptions as M, NotificationTransport as N, QueueLaneRuntimeTuning as Q, RuntimeLogger as R, SingleBoardRuntimeOptions as S, MultiBoardRuntime as a, SingleBoardRuntime as b, BoardRuntimeNonCorePublic as c, BoardRuntimePlatformAdapter as d, BoardRuntimePublic as e, RuntimeRequest as f, RuntimeResponse as g };
249
+ export { type Awaitable as A, type BoardContextConfig as B, type ChatHandlerFlowRunner as C, type DescribeEnvelope as D, type HostedBoardQueueLaneTuning as H, type InvocationAdapter as I, type MultiBoardRuntimeOptions as M, type NotificationTransport as N, type QueueLaneRuntimeTuning as Q, type RuntimeLogger as R, type SingleBoardRuntimeOptions as S, type MultiBoardRuntime as a, type SingleBoardRuntime as b, type BoardRuntimeNonCorePublic as c, type BoardRuntimePlatformAdapter as d, type BoardRuntimePublic as e, type BoardWorkerRequest as f, type RuntimeRequest as g, type RuntimeResponse as h, type BoardWorkerStore as i, type BoardWorkerDeadLetterRequest as j, type BoardWorkerLeasedRequest as k, type BoardWorkerQueuedRequest as l, createBoardWorkerStore as m };
@@ -1,10 +1,55 @@
1
- import { a as ArtifactsStore } from './artifacts-store-lib-D9nMkVcE.cjs';
2
- import { e as BoardPlatformAdapter, g as BoardLiveCardsNonCorePublic, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult, f as BoardWorkerRequest } from './board-live-cards-public-LlVUQPL2.cjs';
3
- import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-BfHmHdx2.cjs';
4
- import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-Di9QB141.cjs';
1
+ import { e as BoardPlatformAdapter, l as BoardLiveCardsNonCorePublic, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult } from './board-live-cards-public-BT5HrgqZ.cjs';
5
2
  import { ExecutionRef } from './execution-refs.cjs';
6
- import { a as KindValueRef } from './storage-interface-BFiD3kyB.cjs';
7
- import { C as ChatStorage } from './chat-storage-lib-B9Q34Dyv.cjs';
3
+ import { f as QueueStorage, a as KindValueRef } from './storage-interface-D-iEiTJA.cjs';
4
+ import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-BZIftm36.cjs';
5
+ import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-CYjr4mgX.cjs';
6
+
7
+ interface BoardWorkerRequest {
8
+ boardId?: string;
9
+ ref: ExecutionRef;
10
+ args: Record<string, unknown>;
11
+ }
12
+ interface BoardWorkerQueuedRequest {
13
+ messageId: string;
14
+ enqueuedAt: string;
15
+ attempt: number;
16
+ request: BoardWorkerRequest;
17
+ }
18
+ interface BoardWorkerLeasedRequest extends BoardWorkerQueuedRequest {
19
+ leaseToken: string;
20
+ leaseExpiresAt: string;
21
+ }
22
+ interface BoardWorkerDeadLetterRequest extends BoardWorkerQueuedRequest {
23
+ reason?: string;
24
+ }
25
+ interface BoardWorkerStore {
26
+ enqueueRequest(request: BoardWorkerRequest): string;
27
+ enqueueRequestIfAbsent?(request: BoardWorkerRequest, dedupKey: string): string | null;
28
+ leaseRequests(opts?: {
29
+ max?: number;
30
+ visibilityMs?: number;
31
+ }): BoardWorkerLeasedRequest[];
32
+ ackRequest(messageId: string, leaseToken: string): boolean;
33
+ nackRequest(messageId: string, leaseToken: string, opts?: {
34
+ dead?: boolean;
35
+ reason?: string;
36
+ }): boolean;
37
+ peekActive(): BoardWorkerQueuedRequest[];
38
+ peekDeadLetter(): BoardWorkerDeadLetterRequest[];
39
+ }
40
+ declare function createBoardWorkerStore(queue: QueueStorage): BoardWorkerStore;
41
+
42
+ /**
43
+ * server-runtime/types.ts
44
+ *
45
+ * Platform-free adapter interfaces for the board server runtime.
46
+ *
47
+ * The runtime (index.ts) imports ONLY this file and board-live-cards-public
48
+ * for its dependencies — no node:fs, node:net, node:child_process, etc.
49
+ *
50
+ * Hosts (demo-server, Azure Function, Firebase Function) provide implementations
51
+ * of these interfaces when constructing the runtime.
52
+ */
8
53
 
9
54
  type BoardRuntimeNonCorePublic = Pick<BoardLiveCardsNonCorePublic, 'describeTaskExecutorCapabilities' | 'validateCardPreflight' | 'evalCardCompute' | 'probeSourcePreflight' | 'runSourcePreflight' | 'simulateCardCycle'>;
10
55
  type Awaitable<T> = T | Promise<T>;
@@ -83,26 +128,20 @@ interface BoardContextConfig {
83
128
  boardAdapter: BoardRuntimePlatformAdapter;
84
129
  nonCore?: BoardRuntimeNonCorePublic;
85
130
  nonCoreAdapter?: BoardNonCorePlatformAdapter;
86
- /** Optional separate adapter for file/chat blob storage (defaults to boardAdapter) */
87
- artifactsAdapter?: BoardRuntimePlatformAdapter;
88
- /** Optional explicit blob root ref for persisted card/file attachments. */
89
- artifactsStoreRef?: string;
90
- /**
91
- * Optional caller-supplied file artifacts store. When provided, this is used
92
- * verbatim and the runtime does NOT consult artifactsAdapter.blobStorage('files').
93
- * Use this to give the embedder full control over the on-disk layout (e.g.
94
- * via createFsBoardFileArtifactsStore(baseDir, { filesSubdir: '' })).
95
- */
96
- filesArtifactsStore?: ArtifactsStore;
131
+ boardRuntimeStoreRef: string;
132
+ /** Explicit ref for externally backed runtime storage (journal + internal queue lanes). */
133
+ queueStoreRef: string;
134
+ /** Explicit blob root ref for persisted card/file attachments. */
135
+ artifactsStoreRef: string;
136
+ /** Explicit ref for fetched source payloads. */
137
+ fetchedSourcesStoreRef: string;
97
138
  baseRef: KindValueRef;
98
139
  cardStoreRef: string;
99
140
  outputsStoreRef: string;
100
- /** Optional ref pointing persisted card chat storage at a different backend. */
101
- chatStoreRef?: string;
102
- /** Optional ref pointing scratch storage at a different backend than the board runtime. */
103
- scratchStoreRef?: string;
104
- /** Optional ref pointing archive storage at a different backend than the board runtime. */
105
- archiveStoreRef?: string;
141
+ /** Explicit ref pointing persisted card chat storage at a different backend. */
142
+ chatStoreRef: string;
143
+ /** Explicit ref pointing scratch storage at a different backend than the board runtime. */
144
+ scratchStoreRef: string;
106
145
  /** Notification endpoint ref — e.g. ::named-pipe::<path> or ::firestore-watch::<path> */
107
146
  notifyRef?: KindValueRef;
108
147
  taskExecutorRef?: ExecutionRef;
@@ -119,8 +158,6 @@ interface SingleBoardRuntimeOptions {
119
158
  boards: BoardContextConfig[];
120
159
  invocationAdapter: InvocationAdapter;
121
160
  chatFlowRunner?: ChatHandlerFlowRunner;
122
- /** Chat storage backend. Defaults to an in-memory store when omitted. */
123
- chatStorage?: ChatStorage;
124
161
  notificationTransport?: NotificationTransport;
125
162
  logger?: RuntimeLogger;
126
163
  serverUrl?: string;
@@ -158,10 +195,8 @@ interface SingleBoardRuntime {
158
195
  readonly queueLaneTuning: HostedBoardQueueLaneTuning;
159
196
  handleRuntimeApi(req: RuntimeRequest, res: RuntimeResponse, parsedUrl: URL): Promise<boolean>;
160
197
  buildPublishedRuntimePayload(): Awaitable<unknown>;
161
- processAccumulatedEvents(): Awaitable<CommandResult>;
162
- processAccumulatedLane(): Awaitable<CommandResult>;
163
198
  handleChatAgentRequest(request: BoardWorkerRequest): Awaitable<void>;
164
- clearChatRecords(cardId: string): void;
199
+ clearChatRecords(cardId: string): Awaitable<void>;
165
200
  /** Report that a source fetch completed. Token is the source callback token; ref is the blob ref (b64:<base64url(json)>). */
166
201
  reportSourceFetched(token: string, ref: string): Awaitable<CommandResult>;
167
202
  /** Report that a source fetch failed. Token is the source callback token. */
@@ -211,4 +246,4 @@ interface RuntimeResponse {
211
246
  end(data?: string | Buffer): void;
212
247
  }
213
248
 
214
- export type { Awaitable as A, BoardContextConfig as B, ChatHandlerFlowRunner as C, DescribeEnvelope as D, HostedBoardQueueLaneTuning as H, InvocationAdapter as I, MultiBoardRuntimeOptions as M, NotificationTransport as N, QueueLaneRuntimeTuning as Q, RuntimeLogger as R, SingleBoardRuntimeOptions as S, MultiBoardRuntime as a, SingleBoardRuntime as b, BoardRuntimeNonCorePublic as c, BoardRuntimePlatformAdapter as d, BoardRuntimePublic as e, RuntimeRequest as f, RuntimeResponse as g };
249
+ export { type Awaitable as A, type BoardContextConfig as B, type ChatHandlerFlowRunner as C, type DescribeEnvelope as D, type HostedBoardQueueLaneTuning as H, type InvocationAdapter as I, type MultiBoardRuntimeOptions as M, type NotificationTransport as N, type QueueLaneRuntimeTuning as Q, type RuntimeLogger as R, type SingleBoardRuntimeOptions as S, type MultiBoardRuntime as a, type SingleBoardRuntime as b, type BoardRuntimeNonCorePublic as c, type BoardRuntimePlatformAdapter as d, type BoardRuntimePublic as e, type BoardWorkerRequest as f, type RuntimeRequest as g, type RuntimeResponse as h, type BoardWorkerStore as i, type BoardWorkerDeadLetterRequest as j, type BoardWorkerLeasedRequest as k, type BoardWorkerQueuedRequest as l, createBoardWorkerStore as m };