yaml-flow 8.6.1 → 8.6.3

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 (96) 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 +544 -45
  5. package/examples/board/server-config.json +2 -1
  6. package/examples/board/test/server-http-test.js +12 -4
  7. package/examples/board-local/demo-shell-localstorage.html +3 -3
  8. package/lib/{artifacts-store-lib-CLOtsiav.d.cts → artifacts-store-lib-BR-Samty.d.cts} +1 -1
  9. package/lib/{artifacts-store-lib-C1rtrkxm.d.ts → artifacts-store-lib-DT7XlWUL.d.ts} +1 -1
  10. package/lib/artifacts-store-public.d.cts +3 -3
  11. package/lib/artifacts-store-public.d.ts +3 -3
  12. package/lib/board-live-cards-mcp.cjs +1 -1
  13. package/lib/board-live-cards-mcp.d.cts +56 -23
  14. package/lib/board-live-cards-mcp.d.ts +56 -23
  15. package/lib/board-live-cards-mcp.js +1 -1
  16. package/lib/board-live-cards-node.cjs +8 -8
  17. package/lib/board-live-cards-node.d.cts +39 -21
  18. package/lib/board-live-cards-node.d.ts +39 -21
  19. package/lib/board-live-cards-node.js +8 -8
  20. package/lib/{board-live-cards-public-CBVjm327.d.ts → board-live-cards-public-BMUIPOrc.d.ts} +67 -42
  21. package/lib/board-live-cards-public-async-DKZqbJVU.d.ts +256 -0
  22. package/lib/board-live-cards-public-async-dMWNbWq6.d.cts +256 -0
  23. package/lib/{board-live-cards-public-CPJy-aGW.d.cts → board-live-cards-public-wkNmBIRC.d.cts} +67 -42
  24. package/lib/board-live-cards-public.cjs +1 -1
  25. package/lib/board-live-cards-public.d.cts +2 -2
  26. package/lib/board-live-cards-public.d.ts +2 -2
  27. package/lib/board-live-cards-public.js +1 -1
  28. package/lib/board-live-cards-server-runtime.cjs +1 -1
  29. package/lib/board-live-cards-server-runtime.d.cts +7 -6
  30. package/lib/board-live-cards-server-runtime.d.ts +7 -6
  31. package/lib/board-live-cards-server-runtime.js +1 -1
  32. package/lib/board-worker-adapter.cjs +4 -3
  33. package/lib/board-worker-adapter.d.cts +24 -14
  34. package/lib/board-worker-adapter.d.ts +24 -14
  35. package/lib/board-worker-adapter.js +4 -3
  36. package/lib/card-store-public.d.cts +2 -2
  37. package/lib/card-store-public.d.ts +2 -2
  38. package/lib/{chat-storage-lib-CKylihjm.d.cts → chat-storage-lib-BIUbE-fM.d.cts} +1 -1
  39. package/lib/{chat-storage-lib-Bce-xx6l.d.ts → chat-storage-lib-BlG-sobS.d.ts} +1 -1
  40. package/lib/chat-store-public.d.cts +3 -3
  41. package/lib/chat-store-public.d.ts +3 -3
  42. package/lib/{chunk-CWREBRXS.js → chunk-BQS3EIEK.js} +3 -3
  43. package/lib/{chunk-LDAP75GN.js → chunk-CIAJNUR4.js} +2 -2
  44. package/lib/chunk-GJJMEAVN.cjs +2 -0
  45. package/lib/chunk-GLIX37VG.cjs +8 -0
  46. package/lib/chunk-H5HBXPOI.cjs +3 -0
  47. package/lib/chunk-HEEDJEKM.js +2 -0
  48. package/lib/chunk-LRVAVWAG.js +8 -0
  49. package/lib/chunk-MLVTJASJ.js +2 -0
  50. package/lib/chunk-N6P2JW4W.js +3 -0
  51. package/lib/chunk-OEFTOO47.cjs +3 -0
  52. package/lib/chunk-PBCDDO4V.cjs +2 -0
  53. package/lib/{chunk-I4WH5U5D.cjs → chunk-PMUSJQSR.cjs} +2 -2
  54. package/lib/chunk-SCWHDI3I.js +2 -0
  55. package/lib/{chunk-UVE65IPR.cjs → chunk-SFVO2LB2.cjs} +3 -3
  56. package/lib/{chunk-5DB54ZX2.cjs → chunk-U2N6MCD5.cjs} +2 -2
  57. package/lib/chunk-VMW4Z6EF.js +3 -0
  58. package/lib/chunk-WOALA3V5.cjs +2 -0
  59. package/lib/{chunk-LBMEVV4U.js → chunk-XQRNDX4Q.js} +2 -2
  60. package/lib/cloud-storage.cjs +2 -0
  61. package/lib/cloud-storage.d.cts +177 -0
  62. package/lib/cloud-storage.d.ts +177 -0
  63. package/lib/cloud-storage.js +2 -0
  64. package/lib/execution-refs.cjs +1 -1
  65. package/lib/execution-refs.js +1 -1
  66. package/lib/index.cjs +2 -2
  67. package/lib/index.d.cts +1 -1
  68. package/lib/index.d.ts +1 -1
  69. package/lib/index.js +1 -1
  70. package/lib/{types-DRl0Hy_p.d.cts → queue-lane-registry-BPKWWgd4.d.cts} +66 -14
  71. package/lib/{types-BuK2UMxk.d.ts → queue-lane-registry-Be6c0ftj.d.ts} +66 -14
  72. package/lib/server-runtime/index.cjs +1 -1
  73. package/lib/server-runtime/index.d.cts +18 -7
  74. package/lib/server-runtime/index.d.ts +18 -7
  75. package/lib/server-runtime/index.js +1 -1
  76. package/lib/step-machine-public/index.cjs +1 -1
  77. package/lib/step-machine-public/index.d.cts +1 -1
  78. package/lib/step-machine-public/index.d.ts +1 -1
  79. package/lib/step-machine-public/index.js +1 -1
  80. package/lib/{storage-interface-Ct-C4tlz.d.cts → storage-interface-BFiD3kyB.d.cts} +11 -1
  81. package/lib/{storage-interface-Ct-C4tlz.d.ts → storage-interface-BFiD3kyB.d.ts} +11 -1
  82. package/lib/stores/index.cjs +1 -1
  83. package/lib/stores/index.d.cts +1 -1
  84. package/lib/stores/index.d.ts +1 -1
  85. package/lib/stores/index.js +1 -1
  86. package/lib/stores/kv.d.cts +1 -1
  87. package/lib/stores/kv.d.ts +1 -1
  88. package/package.json +6 -1
  89. package/lib/chunk-6APH25VI.js +0 -2
  90. package/lib/chunk-KNFFDVLD.cjs +0 -2
  91. package/lib/chunk-LVNQCE5X.cjs +0 -3
  92. package/lib/chunk-M7EQRS6W.js +0 -3
  93. package/lib/chunk-NJJ7WEDT.cjs +0 -2
  94. package/lib/chunk-P64UKI3L.cjs +0 -8
  95. package/lib/chunk-Q6VSL327.js +0 -8
  96. package/lib/chunk-VCCTAUIG.js +0 -2
@@ -1,4 +1,4 @@
1
- import './storage-interface-Ct-C4tlz.cjs';
2
- export { i as BOARD_GRAPH_KEY, B as BoardChangeNotification, j as BoardLiveCardsNonCorePublic, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, a as CommandInput, C as CommandResult, E as EMPTY_CONFIG, S as SNAPSHOT_SCHEMA_VERSION_V1, m as createBoardLiveCardsNonCorePublic, n as createBoardLiveCardsPublic } from './board-live-cards-public-CPJy-aGW.cjs';
1
+ import './storage-interface-BFiD3kyB.cjs';
2
+ export { m as BOARD_GRAPH_KEY, c as BoardChangeNotification, n as BoardLiveCardsNonCorePublic, d as BoardLiveCardsPublic, e as BoardNonCorePlatformAdapter, f as BoardPlatformAdapter, a as CommandInput, C as CommandResult, E as EMPTY_CONFIG, r as SNAPSHOT_SCHEMA_VERSION_V1, s as createBoardLiveCardsNonCorePublic, t as createBoardLiveCardsPublic } from './board-live-cards-public-wkNmBIRC.cjs';
3
3
  import './execution-refs.cjs';
4
4
  import './types-BBhqYGhE.cjs';
@@ -1,4 +1,4 @@
1
- import './storage-interface-Ct-C4tlz.js';
2
- export { i as BOARD_GRAPH_KEY, B as BoardChangeNotification, j as BoardLiveCardsNonCorePublic, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, a as CommandInput, C as CommandResult, E as EMPTY_CONFIG, S as SNAPSHOT_SCHEMA_VERSION_V1, m as createBoardLiveCardsNonCorePublic, n as createBoardLiveCardsPublic } from './board-live-cards-public-CBVjm327.js';
1
+ import './storage-interface-BFiD3kyB.js';
2
+ export { m as BOARD_GRAPH_KEY, c as BoardChangeNotification, n as BoardLiveCardsNonCorePublic, d as BoardLiveCardsPublic, e as BoardNonCorePlatformAdapter, f as BoardPlatformAdapter, a as CommandInput, C as CommandResult, E as EMPTY_CONFIG, r as SNAPSHOT_SCHEMA_VERSION_V1, s as createBoardLiveCardsNonCorePublic, t as createBoardLiveCardsPublic } from './board-live-cards-public-BMUIPOrc.js';
3
3
  import './execution-refs.js';
4
4
  import './types-BBhqYGhE.js';
@@ -1,2 +1,2 @@
1
- export{c as BOARD_GRAPH_KEY,d as EMPTY_CONFIG,b as SNAPSHOT_SCHEMA_VERSION_V1,f as createBoardLiveCardsNonCorePublic,e as createBoardLiveCardsPublic}from'./chunk-M7EQRS6W.js';import'./chunk-LBMEVV4U.js';import'./chunk-CWREBRXS.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-JMDHDY6M.js';import'./chunk-VLBB3D6B.js';import'./chunk-KBELAKIY.js';import'./chunk-MNEOJWPS.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-public.js.map
1
+ export{n as BOARD_GRAPH_KEY,u as EMPTY_CONFIG,m as SNAPSHOT_SCHEMA_VERSION_V1,z as createBoardLiveCardsNonCorePublic,y as createBoardLiveCardsPublic}from'./chunk-N6P2JW4W.js';import'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-JMDHDY6M.js';import'./chunk-VLBB3D6B.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-public.js.map
2
2
  //# sourceMappingURL=board-live-cards-public.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkP64UKI3L_cjs=require('./chunk-P64UKI3L.cjs');require('./chunk-NJJ7WEDT.cjs'),require('./chunk-LVNQCE5X.cjs'),require('./chunk-5DB54ZX2.cjs'),require('./chunk-UVE65IPR.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-KNFFDVLD.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-NMZ6XNLB.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-GYQXDNNI.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createMultiBoardServerRuntime",{enumerable:true,get:function(){return chunkP64UKI3L_cjs.b}});Object.defineProperty(exports,"createSingleBoardServerRuntime",{enumerable:true,get:function(){return chunkP64UKI3L_cjs.a}});//# sourceMappingURL=board-live-cards-server-runtime.cjs.map
1
+ 'use strict';var chunkGLIX37VG_cjs=require('./chunk-GLIX37VG.cjs');require('./chunk-WOALA3V5.cjs'),require('./chunk-H5HBXPOI.cjs'),require('./chunk-PBCDDO4V.cjs'),require('./chunk-OEFTOO47.cjs'),require('./chunk-U2N6MCD5.cjs'),require('./chunk-SFVO2LB2.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-GJJMEAVN.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-NMZ6XNLB.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-GYQXDNNI.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createHostedBoardQueueLaneRegistry",{enumerable:true,get:function(){return chunkGLIX37VG_cjs.a}});Object.defineProperty(exports,"createMultiBoardServerRuntime",{enumerable:true,get:function(){return chunkGLIX37VG_cjs.c}});Object.defineProperty(exports,"createSingleBoardServerRuntime",{enumerable:true,get:function(){return chunkGLIX37VG_cjs.b}});//# sourceMappingURL=board-live-cards-server-runtime.cjs.map
2
2
  //# sourceMappingURL=board-live-cards-server-runtime.cjs.map
@@ -1,8 +1,9 @@
1
- export { B as BoardContextConfig, C as ChatHandlerFlowRunner, D as DescribeEnvelope, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, R as RuntimeLogger, c as RuntimeRequest, d as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-DRl0Hy_p.cjs';
2
- export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-Ct-C4tlz.cjs';
3
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, a as CommandInput, C as CommandResult } from './board-live-cards-public-CPJy-aGW.cjs';
4
- export { c as ChatStorage } from './chat-storage-lib-CKylihjm.cjs';
1
+ export { A as Awaitable, c as BoardContextConfig, B as BoardRuntimePlatformAdapter, d as BoardRuntimePublic, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, e as QueueLaneRuntimeTuning, R as RuntimeLogger, f as RuntimeRequest, g as RuntimeResponse, S as SingleBoardRuntime, b as SingleBoardRuntimeOptions } from './queue-lane-registry-BPKWWgd4.cjs';
2
+ export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry, createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.cjs';
3
+ export { A as AsyncBoardLiveCardsPublic, a as AsyncBoardPlatformAdapter } from './board-live-cards-public-async-dMWNbWq6.cjs';
4
+ export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-BFiD3kyB.cjs';
5
+ export { c as BoardChangeNotification, d as BoardLiveCardsPublic, e as BoardNonCorePlatformAdapter, f as BoardPlatformAdapter, B as BoardWorkerRequest, a as CommandInput, C as CommandResult } from './board-live-cards-public-wkNmBIRC.cjs';
6
+ export { c as ChatStorage } from './chat-storage-lib-BIUbE-fM.cjs';
5
7
  export { ExecutionRef } from './execution-refs.cjs';
6
- export { createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.cjs';
7
- import './artifacts-store-lib-CLOtsiav.cjs';
8
+ import './artifacts-store-lib-BR-Samty.cjs';
8
9
  import './types-BBhqYGhE.cjs';
@@ -1,8 +1,9 @@
1
- export { B as BoardContextConfig, C as ChatHandlerFlowRunner, D as DescribeEnvelope, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, R as RuntimeLogger, c as RuntimeRequest, d as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-BuK2UMxk.js';
2
- export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-Ct-C4tlz.js';
3
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, a as CommandInput, C as CommandResult } from './board-live-cards-public-CBVjm327.js';
4
- export { c as ChatStorage } from './chat-storage-lib-Bce-xx6l.js';
1
+ export { A as Awaitable, c as BoardContextConfig, B as BoardRuntimePlatformAdapter, d as BoardRuntimePublic, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, e as QueueLaneRuntimeTuning, R as RuntimeLogger, f as RuntimeRequest, g as RuntimeResponse, S as SingleBoardRuntime, b as SingleBoardRuntimeOptions } from './queue-lane-registry-Be6c0ftj.js';
2
+ export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry, createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.js';
3
+ export { A as AsyncBoardLiveCardsPublic, a as AsyncBoardPlatformAdapter } from './board-live-cards-public-async-DKZqbJVU.js';
4
+ export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-BFiD3kyB.js';
5
+ export { c as BoardChangeNotification, d as BoardLiveCardsPublic, e as BoardNonCorePlatformAdapter, f as BoardPlatformAdapter, B as BoardWorkerRequest, a as CommandInput, C as CommandResult } from './board-live-cards-public-BMUIPOrc.js';
6
+ export { c as ChatStorage } from './chat-storage-lib-BlG-sobS.js';
5
7
  export { ExecutionRef } from './execution-refs.js';
6
- export { createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.js';
7
- import './artifacts-store-lib-C1rtrkxm.js';
8
+ import './artifacts-store-lib-DT7XlWUL.js';
8
9
  import './types-BBhqYGhE.js';
@@ -1,2 +1,2 @@
1
- export{b as createMultiBoardServerRuntime,a as createSingleBoardServerRuntime}from'./chunk-Q6VSL327.js';import'./chunk-6APH25VI.js';import'./chunk-M7EQRS6W.js';import'./chunk-LBMEVV4U.js';import'./chunk-CWREBRXS.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-VCCTAUIG.js';import'./chunk-JMDHDY6M.js';import'./chunk-VLBB3D6B.js';import'./chunk-KBELAKIY.js';import'./chunk-76ON3V7R.js';import'./chunk-MNEOJWPS.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-server-runtime.js.map
1
+ export{a as createHostedBoardQueueLaneRegistry,c as createMultiBoardServerRuntime,b as createSingleBoardServerRuntime}from'./chunk-LRVAVWAG.js';import'./chunk-MLVTJASJ.js';import'./chunk-VMW4Z6EF.js';import'./chunk-HEEDJEKM.js';import'./chunk-N6P2JW4W.js';import'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-SCWHDI3I.js';import'./chunk-JMDHDY6M.js';import'./chunk-VLBB3D6B.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-76ON3V7R.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-server-runtime.js.map
2
2
  //# sourceMappingURL=board-live-cards-server-runtime.js.map
@@ -1,6 +1,6 @@
1
- 'use strict';require('./chunk-GNFE24S7.cjs');var i=require('fs'),a=require('path'),module$1=require('module'),child_process=require('child_process');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var i__namespace=/*#__PURE__*/_interopNamespace(i);var a__namespace=/*#__PURE__*/_interopNamespace(a);var R=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-worker-adapter.cjs', document.baseURI).href)));function v(r){if(!r.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${r}`);let t=r.slice(4),o=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),e;try{e=JSON.parse(Buffer.from(o,"base64").toString("utf8"));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${r}`)}if(!e||typeof e!="object")throw new Error(`Invalid ref format (expected object payload): ${r}`);let n=e;if(typeof n.kind!="string"||typeof n.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${r}`);return {kind:n.kind,value:n.value}}function p(r){return `b64:${Buffer.from(JSON.stringify(r),"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}`}function C(){return {read(r){if(!i__namespace.existsSync(r))return null;try{return i__namespace.readFileSync(r,"utf-8")}catch{return null}},write(r,t){i__namespace.mkdirSync(a__namespace.dirname(r),{recursive:true}),i__namespace.writeFileSync(r,t,"utf-8");}}}function T(r){if(r.kind==="fs-path")return C();throw new Error(`Unsupported storage kind: "${r.kind}". Supported kinds: fs-path`)}var g=new Map;function $(r,t){let o=String(r||"").trim();if(!o)throw new Error("registerInProcessBoardWorkerCallback: key is required");g.set(o,t);}function I(r){let t=String(r||"").trim();t&&g.delete(t);}function u(r){let t=v(r);if(t.kind==="yaml-flow-cli"){let o=a__namespace.basename(t.value.trim());if(!o)throw new Error(`Invalid yaml-flow-cli ref: expected non-empty cli file name, got ${JSON.stringify(t.value)}`);let e=a__namespace.dirname(R.resolve("yaml-flow/package.json")),n=o.replace(/\.[^.]+$/,""),s=a__namespace.join(e,"cli","bundled",`${n}.mjs`);if(i__namespace.existsSync(s))return s;let l=a__namespace.join(e,"cli","node",o);if(i__namespace.existsSync(l))return l;throw new Error(`Invalid yaml-flow-cli ref: could not find ${o} under cli/bundled or cli/node in ${e}`)}return t.value}function w(r){let t=r.extra?.notifyChannel;return typeof t=="string"&&t.length>0?t:void 0}function k(r,t,o){return `${String(r||"").replace(/\/+$/,"")}/${encodeURIComponent(t)}/${o}`}function m(r,t){let o=u(t.whatToRun).trim();if(!o)throw new Error("in-process-loop callback requires a non-empty handler key");let e=g.get(o);if(!e)throw new Error(`in-process-loop callback handler not registered: ${o}`);let n=e(r);if(n&&n.status&&n.status!=="success")throw new Error(n.error||`in-process-loop callback failed with status: ${n.status}`)}function y(r){if(!r.endsWith(".ts"))return {cmd:process.execPath,args:[r]};let t=a__namespace.dirname(r),o=[];for(let n=1;n<=5;n++){let s=a__namespace.join(t,...Array(n).fill(".."),"node_modules");o.push(a__namespace.join(s,"tsx","dist","cli.mjs")),o.push(a__namespace.join(s,".bin","tsx"));}let e=o.find(n=>i__namespace.existsSync(n));return e?{cmd:process.execPath,args:[e,r]}:{cmd:"npx",args:["tsx",r]}}function E(r,t){let{token:o,via:e}=r;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let n=u(e.whatToRun),{cmd:s,args:l}=y(n),d=w(e),f=[...l,"source-data-fetched","--ref",p(t),"--token",o,...d?["--notify-channel",d]:[]],c=child_process.spawnSync(s,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportComplete: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let n=k(u(e.whatToRun),o,"success"),s=JSON.stringify({ref:p(t)});b(n,s);return}if(e.howToRun==="in-process-loop"){m({token:o,outcome:"success",ref:p(t)},e);return}throw new Error(`reportComplete: unsupported via.howToRun "${e.howToRun}"`)}function P(r,t){let{token:o,via:e}=r;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let n=u(e.whatToRun),{cmd:s,args:l}=y(n),d=w(e),f=[...l,"source-data-fetch-failure","--token",o,"--reason",t,...d?["--notify-channel",d]:[]],c=child_process.spawnSync(s,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportFailed: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let n=k(u(e.whatToRun),o,"failure"),s=JSON.stringify({reason:t});b(n,s);return}if(e.howToRun==="in-process-loop"){m({token:o,outcome:"failure",reason:t},e);return}throw new Error(`reportFailed: unsupported via.howToRun "${e.howToRun}"`)}function b(r,t){let o=`
1
+ 'use strict';require('./chunk-GNFE24S7.cjs');var l=require('fs'),a=require('path'),child_process=require('child_process'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var l__namespace=/*#__PURE__*/_interopNamespace(l);var a__namespace=/*#__PURE__*/_interopNamespace(a);var p=new Map;function C(r,e){let t=String(r||"").trim();if(!t)throw new Error("registerInProcessBoardWorkerCallback: key is required");p.set(t,e);}function v(r){let e=String(r||"").trim();e&&p.delete(e);}async function f(r,e){let t=String(e||"").trim();if(!t)throw new Error("in-process-loop callback requires a non-empty handler key");let o=p.get(t);if(!o)throw new Error(`in-process-loop callback handler not registered: ${t}`);let n=await o(r);if(n&&n.status&&n.status!=="success")throw new Error(n.error||`in-process-loop callback failed with status: ${n.status}`)}function g(r,e,t){w(m(r,e,"success"),JSON.stringify({ref:t}));}function h(r,e,t){w(m(r,e,"failure"),JSON.stringify({reason:t}));}function m(r,e,t){return `${String(r||"").replace(/\/+$/,"")}/${encodeURIComponent(e)}/${t}`}function w(r,e){let t=`
2
2
  const rawUrl = ${JSON.stringify(r)};
3
- const rawBody = ${JSON.stringify(t)};
3
+ const rawBody = ${JSON.stringify(e)};
4
4
  const u = new URL(rawUrl);
5
5
  const {request} = require(u.protocol === 'https:' ? 'https' : 'http');
6
6
  const h = { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(rawBody) };
@@ -20,5 +20,6 @@
20
20
  req.on('error', e => { process.stderr.write(e.message); process.exit(1); });
21
21
  req.write(rawBody);
22
22
  req.end();
23
- `,e=child_process.spawnSync(process.execPath,["-e",o],{encoding:"utf-8",windowsHide:true});if(e.status!==0)throw new Error(`http-post failed: ${e.stderr?.trim()}`)}exports.blobStorageForRef=T;exports.parseRef=v;exports.registerInProcessBoardWorkerCallback=$;exports.reportComplete=E;exports.reportFailed=P;exports.serializeRef=p;exports.unregisterInProcessBoardWorkerCallback=I;//# sourceMappingURL=board-worker-adapter.cjs.map
23
+ `,o=child_process.spawnSync(process.execPath,["-e",t],{encoding:"utf-8",windowsHide:true});if(o.status!==0)throw new Error(`http-post failed: ${o.stderr?.trim()}`)}var I=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-worker-adapter.cjs', document.baseURI).href)));function b(r,e,t){x(r,["source-data-fetched","--ref",t,"--token",e],"reportComplete");}function y(r,e,t){x(r,["source-data-fetch-failure","--token",e,"--reason",t],"reportFailed");}function x(r,e,t){let o=S(r.whatToRun),{cmd:n,args:s}=$(o),i=P(r),u=child_process.spawnSync(n,[...s,...e,...i?["--notify-channel",i]:[]],{encoding:"utf-8",windowsHide:true});if(u.status!==0)throw new Error(`${t}: board CLI exited ${u.status}: ${u.stderr?.trim()}`)}function S(r){let e=T(r);if(e.kind==="yaml-flow-cli"){let t=a__namespace.basename(e.value.trim());if(!t)throw new Error(`Invalid yaml-flow-cli ref: expected non-empty cli file name, got ${JSON.stringify(e.value)}`);let o=a__namespace.dirname(I.resolve("yaml-flow/package.json")),n=t.replace(/\.[^.]+$/,""),s=a__namespace.join(o,"cli","bundled",`${n}.mjs`);if(l__namespace.existsSync(s))return s;let i=a__namespace.join(o,"cli","node",t);if(l__namespace.existsSync(i))return i;throw new Error(`Invalid yaml-flow-cli ref: could not find ${t} under cli/bundled or cli/node in ${o}`)}return e.value}function P(r){let e=r.extra?.notifyChannel;return typeof e=="string"&&e.length>0?e:void 0}function $(r){if(!r.endsWith(".ts"))return {cmd:process.execPath,args:[r]};let e=a__namespace.dirname(r),t=[];for(let n=1;n<=5;n++){let s=a__namespace.join(e,...Array(n).fill(".."),"node_modules");t.push(a__namespace.join(s,"tsx","dist","cli.mjs")),t.push(a__namespace.join(s,".bin","tsx"));}let o=t.find(n=>l__namespace.existsSync(n));return o?{cmd:process.execPath,args:[o,r]}:{cmd:"npx",args:["tsx",r]}}function T(r){if(!r.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${r}`);let e=r.slice(4),t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),o;try{o=JSON.parse(Buffer.from(t,"base64").toString("utf8"));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${r}`)}if(!o||typeof o!="object")throw new Error(`Invalid ref format (expected object payload): ${r}`);let n=o;if(typeof n.kind!="string"||typeof n.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${r}`);return {kind:n.kind,value:n.value}}function d(r){if(!r.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${r}`);let e=r.slice(4),t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),o;try{o=JSON.parse(Buffer.from(t,"base64").toString("utf8"));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${r}`)}if(!o||typeof o!="object")throw new Error(`Invalid ref format (expected object payload): ${r}`);let n=o;if(typeof n.kind!="string"||typeof n.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${r}`);return {kind:n.kind,value:n.value}}function k(r){return `b64:${Buffer.from(JSON.stringify(r),"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}`}function N(){return {read(r){if(!l__namespace.default.existsSync(r))return null;try{return l__namespace.default.readFileSync(r,"utf-8")}catch{return null}},write(r,e){l__namespace.default.mkdirSync(a__namespace.default.dirname(r),{recursive:true}),l__namespace.default.writeFileSync(r,e,"utf-8");}}}function _(r){if(r.kind==="fs-path")return N();throw new Error(`Unsupported storage kind: "${r.kind}". Supported kinds: fs-path`)}function M(r,e){let{token:t,via:o}=r;if(o.howToRun==="local-node"||o.howToRun==="local-process"){b(o,t,k(e));return}if(o.howToRun==="http:post"){g(d(o.whatToRun).value,t,k(e));return}if(o.howToRun==="in-process-loop"){f({token:t,outcome:"success",ref:k(e)},d(o.whatToRun).value);return}throw new Error(`reportComplete: unsupported via.howToRun "${o.howToRun}"`)}function A(r,e){let{token:t,via:o}=r;if(o.howToRun==="local-node"||o.howToRun==="local-process"){y(o,t,e);return}if(o.howToRun==="http:post"){h(d(o.whatToRun).value,t,e);return}if(o.howToRun==="in-process-loop"){f({token:t,outcome:"failure",reason:e},d(o.whatToRun).value);return}throw new Error(`reportFailed: unsupported via.howToRun "${o.howToRun}"`)}
24
+ exports.blobStorageForRef=_;exports.parseRef=d;exports.registerInProcessBoardWorkerCallback=C;exports.reportComplete=M;exports.reportFailed=A;exports.serializeRef=k;exports.unregisterInProcessBoardWorkerCallback=v;//# sourceMappingURL=board-worker-adapter.cjs.map
24
25
  //# sourceMappingURL=board-worker-adapter.cjs.map
@@ -1,9 +1,31 @@
1
+ type BoardWorkerCallbackOutcome$1 = 'success' | 'failure';
2
+ interface InProcessBoardWorkerCallbackPayload {
3
+ token: string;
4
+ outcome: BoardWorkerCallbackOutcome$1;
5
+ ref?: string;
6
+ reason?: string;
7
+ }
8
+ type InProcessBoardWorkerCallbackResult = void | {
9
+ status?: 'success' | 'fail' | 'error';
10
+ error?: string;
11
+ };
12
+ type InProcessBoardWorkerCallbackHandler = (payload: InProcessBoardWorkerCallbackPayload) => InProcessBoardWorkerCallbackResult | Promise<InProcessBoardWorkerCallbackResult>;
13
+ declare function registerInProcessBoardWorkerCallback(key: string, handler: InProcessBoardWorkerCallbackHandler): void;
14
+ declare function unregisterInProcessBoardWorkerCallback(key: string): void;
15
+
1
16
  /**
2
17
  * board-worker-adapter.ts
3
18
  *
4
19
  * Standalone file — copy this to your board worker project (task executor, chat handler, etc.).
5
20
  * Zero dependencies on the rest of yaml-flow.
6
21
  *
22
+ * NOTE: KindValueRef / parseRef / serializeRef are intentionally duplicated here
23
+ * instead of re-exported from cli/common/storage-interface.ts. This file is a
24
+ * published worker-facing entrypoint (`yaml-flow/board-worker-adapter`) and must
25
+ * stay self-contained so executors can vendor or copy it without pulling in the
26
+ * broader runtime package surface. Keep the wire format in sync with the common
27
+ * storage-interface helpers.
28
+ *
7
29
  * Provides:
8
30
  * - KindValueRef wire format: b64:<base64url(json)>
9
31
  * - parseRef() parse a b64:<base64url(json)> string
@@ -25,12 +47,13 @@
25
47
  * in-process-loop — invoke a registered same-process callback handler
26
48
  *
27
49
  * Usage:
28
- * import { parseRef, blobStorageForRef, reportComplete, reportFailed } from './board-worker-adapter.js';
50
+ * import { parseRef, blobStorageForRef, reportComplete, reportFailed } from 'yaml-flow/board-worker-adapter';
29
51
  *
30
52
  * const { source_def, callback } = JSON.parse(blobStorageForRef(inRef).read(inRef.value));
31
53
  * // ... do work, write to outRef ...
32
54
  * reportComplete(callback, outRef);
33
55
  */
56
+
34
57
  interface KindValueRef {
35
58
  readonly kind: string;
36
59
  readonly value: string;
@@ -70,19 +93,6 @@ interface ExecutionRef {
70
93
  extra?: Record<string, unknown>;
71
94
  }
72
95
  type BoardWorkerCallbackOutcome = 'success' | 'failure';
73
- interface InProcessBoardWorkerCallbackPayload {
74
- token: string;
75
- outcome: BoardWorkerCallbackOutcome;
76
- ref?: string;
77
- reason?: string;
78
- }
79
- type InProcessBoardWorkerCallbackResult = void | {
80
- status?: 'success' | 'fail' | 'error';
81
- error?: string;
82
- };
83
- type InProcessBoardWorkerCallbackHandler = (payload: InProcessBoardWorkerCallbackPayload) => InProcessBoardWorkerCallbackResult;
84
- declare function registerInProcessBoardWorkerCallback(key: string, handler: InProcessBoardWorkerCallbackHandler): void;
85
- declare function unregisterInProcessBoardWorkerCallback(key: string): void;
86
96
  /**
87
97
  * Describes how the board wants to receive task completion callbacks.
88
98
  * Baked into the inRef payload as { source_def, callback }.
@@ -1,9 +1,31 @@
1
+ type BoardWorkerCallbackOutcome$1 = 'success' | 'failure';
2
+ interface InProcessBoardWorkerCallbackPayload {
3
+ token: string;
4
+ outcome: BoardWorkerCallbackOutcome$1;
5
+ ref?: string;
6
+ reason?: string;
7
+ }
8
+ type InProcessBoardWorkerCallbackResult = void | {
9
+ status?: 'success' | 'fail' | 'error';
10
+ error?: string;
11
+ };
12
+ type InProcessBoardWorkerCallbackHandler = (payload: InProcessBoardWorkerCallbackPayload) => InProcessBoardWorkerCallbackResult | Promise<InProcessBoardWorkerCallbackResult>;
13
+ declare function registerInProcessBoardWorkerCallback(key: string, handler: InProcessBoardWorkerCallbackHandler): void;
14
+ declare function unregisterInProcessBoardWorkerCallback(key: string): void;
15
+
1
16
  /**
2
17
  * board-worker-adapter.ts
3
18
  *
4
19
  * Standalone file — copy this to your board worker project (task executor, chat handler, etc.).
5
20
  * Zero dependencies on the rest of yaml-flow.
6
21
  *
22
+ * NOTE: KindValueRef / parseRef / serializeRef are intentionally duplicated here
23
+ * instead of re-exported from cli/common/storage-interface.ts. This file is a
24
+ * published worker-facing entrypoint (`yaml-flow/board-worker-adapter`) and must
25
+ * stay self-contained so executors can vendor or copy it without pulling in the
26
+ * broader runtime package surface. Keep the wire format in sync with the common
27
+ * storage-interface helpers.
28
+ *
7
29
  * Provides:
8
30
  * - KindValueRef wire format: b64:<base64url(json)>
9
31
  * - parseRef() parse a b64:<base64url(json)> string
@@ -25,12 +47,13 @@
25
47
  * in-process-loop — invoke a registered same-process callback handler
26
48
  *
27
49
  * Usage:
28
- * import { parseRef, blobStorageForRef, reportComplete, reportFailed } from './board-worker-adapter.js';
50
+ * import { parseRef, blobStorageForRef, reportComplete, reportFailed } from 'yaml-flow/board-worker-adapter';
29
51
  *
30
52
  * const { source_def, callback } = JSON.parse(blobStorageForRef(inRef).read(inRef.value));
31
53
  * // ... do work, write to outRef ...
32
54
  * reportComplete(callback, outRef);
33
55
  */
56
+
34
57
  interface KindValueRef {
35
58
  readonly kind: string;
36
59
  readonly value: string;
@@ -70,19 +93,6 @@ interface ExecutionRef {
70
93
  extra?: Record<string, unknown>;
71
94
  }
72
95
  type BoardWorkerCallbackOutcome = 'success' | 'failure';
73
- interface InProcessBoardWorkerCallbackPayload {
74
- token: string;
75
- outcome: BoardWorkerCallbackOutcome;
76
- ref?: string;
77
- reason?: string;
78
- }
79
- type InProcessBoardWorkerCallbackResult = void | {
80
- status?: 'success' | 'fail' | 'error';
81
- error?: string;
82
- };
83
- type InProcessBoardWorkerCallbackHandler = (payload: InProcessBoardWorkerCallbackPayload) => InProcessBoardWorkerCallbackResult;
84
- declare function registerInProcessBoardWorkerCallback(key: string, handler: InProcessBoardWorkerCallbackHandler): void;
85
- declare function unregisterInProcessBoardWorkerCallback(key: string): void;
86
96
  /**
87
97
  * Describes how the board wants to receive task completion callbacks.
88
98
  * Baked into the inRef payload as { source_def, callback }.
@@ -1,6 +1,6 @@
1
- import'./chunk-FW4363Y4.js';import*as i from'fs';import*as a from'path';import {createRequire}from'module';import {spawnSync}from'child_process';var R=createRequire(import.meta.url);function v(r){if(!r.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${r}`);let t=r.slice(4),o=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),e;try{e=JSON.parse(Buffer.from(o,"base64").toString("utf8"));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${r}`)}if(!e||typeof e!="object")throw new Error(`Invalid ref format (expected object payload): ${r}`);let n=e;if(typeof n.kind!="string"||typeof n.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${r}`);return {kind:n.kind,value:n.value}}function p(r){return `b64:${Buffer.from(JSON.stringify(r),"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}`}function C(){return {read(r){if(!i.existsSync(r))return null;try{return i.readFileSync(r,"utf-8")}catch{return null}},write(r,t){i.mkdirSync(a.dirname(r),{recursive:true}),i.writeFileSync(r,t,"utf-8");}}}function T(r){if(r.kind==="fs-path")return C();throw new Error(`Unsupported storage kind: "${r.kind}". Supported kinds: fs-path`)}var g=new Map;function $(r,t){let o=String(r||"").trim();if(!o)throw new Error("registerInProcessBoardWorkerCallback: key is required");g.set(o,t);}function I(r){let t=String(r||"").trim();t&&g.delete(t);}function u(r){let t=v(r);if(t.kind==="yaml-flow-cli"){let o=a.basename(t.value.trim());if(!o)throw new Error(`Invalid yaml-flow-cli ref: expected non-empty cli file name, got ${JSON.stringify(t.value)}`);let e=a.dirname(R.resolve("yaml-flow/package.json")),n=o.replace(/\.[^.]+$/,""),s=a.join(e,"cli","bundled",`${n}.mjs`);if(i.existsSync(s))return s;let l=a.join(e,"cli","node",o);if(i.existsSync(l))return l;throw new Error(`Invalid yaml-flow-cli ref: could not find ${o} under cli/bundled or cli/node in ${e}`)}return t.value}function w(r){let t=r.extra?.notifyChannel;return typeof t=="string"&&t.length>0?t:void 0}function k(r,t,o){return `${String(r||"").replace(/\/+$/,"")}/${encodeURIComponent(t)}/${o}`}function m(r,t){let o=u(t.whatToRun).trim();if(!o)throw new Error("in-process-loop callback requires a non-empty handler key");let e=g.get(o);if(!e)throw new Error(`in-process-loop callback handler not registered: ${o}`);let n=e(r);if(n&&n.status&&n.status!=="success")throw new Error(n.error||`in-process-loop callback failed with status: ${n.status}`)}function y(r){if(!r.endsWith(".ts"))return {cmd:process.execPath,args:[r]};let t=a.dirname(r),o=[];for(let n=1;n<=5;n++){let s=a.join(t,...Array(n).fill(".."),"node_modules");o.push(a.join(s,"tsx","dist","cli.mjs")),o.push(a.join(s,".bin","tsx"));}let e=o.find(n=>i.existsSync(n));return e?{cmd:process.execPath,args:[e,r]}:{cmd:"npx",args:["tsx",r]}}function E(r,t){let{token:o,via:e}=r;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let n=u(e.whatToRun),{cmd:s,args:l}=y(n),d=w(e),f=[...l,"source-data-fetched","--ref",p(t),"--token",o,...d?["--notify-channel",d]:[]],c=spawnSync(s,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportComplete: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let n=k(u(e.whatToRun),o,"success"),s=JSON.stringify({ref:p(t)});b(n,s);return}if(e.howToRun==="in-process-loop"){m({token:o,outcome:"success",ref:p(t)},e);return}throw new Error(`reportComplete: unsupported via.howToRun "${e.howToRun}"`)}function P(r,t){let{token:o,via:e}=r;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let n=u(e.whatToRun),{cmd:s,args:l}=y(n),d=w(e),f=[...l,"source-data-fetch-failure","--token",o,"--reason",t,...d?["--notify-channel",d]:[]],c=spawnSync(s,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportFailed: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let n=k(u(e.whatToRun),o,"failure"),s=JSON.stringify({reason:t});b(n,s);return}if(e.howToRun==="in-process-loop"){m({token:o,outcome:"failure",reason:t},e);return}throw new Error(`reportFailed: unsupported via.howToRun "${e.howToRun}"`)}function b(r,t){let o=`
1
+ import'./chunk-FW4363Y4.js';import*as l from'fs';import l__default from'fs';import*as a from'path';import a__default from'path';import {spawnSync}from'child_process';import {createRequire}from'module';var p=new Map;function C(r,e){let t=String(r||"").trim();if(!t)throw new Error("registerInProcessBoardWorkerCallback: key is required");p.set(t,e);}function v(r){let e=String(r||"").trim();e&&p.delete(e);}async function f(r,e){let t=String(e||"").trim();if(!t)throw new Error("in-process-loop callback requires a non-empty handler key");let o=p.get(t);if(!o)throw new Error(`in-process-loop callback handler not registered: ${t}`);let n=await o(r);if(n&&n.status&&n.status!=="success")throw new Error(n.error||`in-process-loop callback failed with status: ${n.status}`)}function g(r,e,t){w(m(r,e,"success"),JSON.stringify({ref:t}));}function h(r,e,t){w(m(r,e,"failure"),JSON.stringify({reason:t}));}function m(r,e,t){return `${String(r||"").replace(/\/+$/,"")}/${encodeURIComponent(e)}/${t}`}function w(r,e){let t=`
2
2
  const rawUrl = ${JSON.stringify(r)};
3
- const rawBody = ${JSON.stringify(t)};
3
+ const rawBody = ${JSON.stringify(e)};
4
4
  const u = new URL(rawUrl);
5
5
  const {request} = require(u.protocol === 'https:' ? 'https' : 'http');
6
6
  const h = { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(rawBody) };
@@ -20,5 +20,6 @@ import'./chunk-FW4363Y4.js';import*as i from'fs';import*as a from'path';import {
20
20
  req.on('error', e => { process.stderr.write(e.message); process.exit(1); });
21
21
  req.write(rawBody);
22
22
  req.end();
23
- `,e=spawnSync(process.execPath,["-e",o],{encoding:"utf-8",windowsHide:true});if(e.status!==0)throw new Error(`http-post failed: ${e.stderr?.trim()}`)}export{T as blobStorageForRef,v as parseRef,$ as registerInProcessBoardWorkerCallback,E as reportComplete,P as reportFailed,p as serializeRef,I as unregisterInProcessBoardWorkerCallback};//# sourceMappingURL=board-worker-adapter.js.map
23
+ `,o=spawnSync(process.execPath,["-e",t],{encoding:"utf-8",windowsHide:true});if(o.status!==0)throw new Error(`http-post failed: ${o.stderr?.trim()}`)}var I=createRequire(import.meta.url);function b(r,e,t){x(r,["source-data-fetched","--ref",t,"--token",e],"reportComplete");}function y(r,e,t){x(r,["source-data-fetch-failure","--token",e,"--reason",t],"reportFailed");}function x(r,e,t){let o=S(r.whatToRun),{cmd:n,args:s}=$(o),i=P(r),u=spawnSync(n,[...s,...e,...i?["--notify-channel",i]:[]],{encoding:"utf-8",windowsHide:true});if(u.status!==0)throw new Error(`${t}: board CLI exited ${u.status}: ${u.stderr?.trim()}`)}function S(r){let e=T(r);if(e.kind==="yaml-flow-cli"){let t=a.basename(e.value.trim());if(!t)throw new Error(`Invalid yaml-flow-cli ref: expected non-empty cli file name, got ${JSON.stringify(e.value)}`);let o=a.dirname(I.resolve("yaml-flow/package.json")),n=t.replace(/\.[^.]+$/,""),s=a.join(o,"cli","bundled",`${n}.mjs`);if(l.existsSync(s))return s;let i=a.join(o,"cli","node",t);if(l.existsSync(i))return i;throw new Error(`Invalid yaml-flow-cli ref: could not find ${t} under cli/bundled or cli/node in ${o}`)}return e.value}function P(r){let e=r.extra?.notifyChannel;return typeof e=="string"&&e.length>0?e:void 0}function $(r){if(!r.endsWith(".ts"))return {cmd:process.execPath,args:[r]};let e=a.dirname(r),t=[];for(let n=1;n<=5;n++){let s=a.join(e,...Array(n).fill(".."),"node_modules");t.push(a.join(s,"tsx","dist","cli.mjs")),t.push(a.join(s,".bin","tsx"));}let o=t.find(n=>l.existsSync(n));return o?{cmd:process.execPath,args:[o,r]}:{cmd:"npx",args:["tsx",r]}}function T(r){if(!r.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${r}`);let e=r.slice(4),t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),o;try{o=JSON.parse(Buffer.from(t,"base64").toString("utf8"));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${r}`)}if(!o||typeof o!="object")throw new Error(`Invalid ref format (expected object payload): ${r}`);let n=o;if(typeof n.kind!="string"||typeof n.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${r}`);return {kind:n.kind,value:n.value}}function d(r){if(!r.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${r}`);let e=r.slice(4),t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),o;try{o=JSON.parse(Buffer.from(t,"base64").toString("utf8"));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${r}`)}if(!o||typeof o!="object")throw new Error(`Invalid ref format (expected object payload): ${r}`);let n=o;if(typeof n.kind!="string"||typeof n.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${r}`);return {kind:n.kind,value:n.value}}function k(r){return `b64:${Buffer.from(JSON.stringify(r),"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}`}function N(){return {read(r){if(!l__default.existsSync(r))return null;try{return l__default.readFileSync(r,"utf-8")}catch{return null}},write(r,e){l__default.mkdirSync(a__default.dirname(r),{recursive:true}),l__default.writeFileSync(r,e,"utf-8");}}}function _(r){if(r.kind==="fs-path")return N();throw new Error(`Unsupported storage kind: "${r.kind}". Supported kinds: fs-path`)}function M(r,e){let{token:t,via:o}=r;if(o.howToRun==="local-node"||o.howToRun==="local-process"){b(o,t,k(e));return}if(o.howToRun==="http:post"){g(d(o.whatToRun).value,t,k(e));return}if(o.howToRun==="in-process-loop"){f({token:t,outcome:"success",ref:k(e)},d(o.whatToRun).value);return}throw new Error(`reportComplete: unsupported via.howToRun "${o.howToRun}"`)}function A(r,e){let{token:t,via:o}=r;if(o.howToRun==="local-node"||o.howToRun==="local-process"){y(o,t,e);return}if(o.howToRun==="http:post"){h(d(o.whatToRun).value,t,e);return}if(o.howToRun==="in-process-loop"){f({token:t,outcome:"failure",reason:e},d(o.whatToRun).value);return}throw new Error(`reportFailed: unsupported via.howToRun "${o.howToRun}"`)}
24
+ export{_ as blobStorageForRef,d as parseRef,C as registerInProcessBoardWorkerCallback,M as reportComplete,A as reportFailed,k as serializeRef,v as unregisterInProcessBoardWorkerCallback};//# sourceMappingURL=board-worker-adapter.js.map
24
25
  //# sourceMappingURL=board-worker-adapter.js.map
@@ -1,5 +1,5 @@
1
- import { a as CommandInput, C as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-CPJy-aGW.cjs';
2
- import './storage-interface-Ct-C4tlz.cjs';
1
+ import { a as CommandInput, C as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-wkNmBIRC.cjs';
2
+ import './storage-interface-BFiD3kyB.cjs';
3
3
  import './execution-refs.cjs';
4
4
  import './types-BBhqYGhE.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
- import { a as CommandInput, C as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-CBVjm327.js';
2
- import './storage-interface-Ct-C4tlz.js';
1
+ import { a as CommandInput, C as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-BMUIPOrc.js';
2
+ import './storage-interface-BFiD3kyB.js';
3
3
  import './execution-refs.js';
4
4
  import './types-BBhqYGhE.js';
5
5
 
@@ -1,4 +1,4 @@
1
- import { J as JournalStorage, K as KVStorage } from './storage-interface-Ct-C4tlz.cjs';
1
+ import { J as JournalStorage, K as KVStorage } from './storage-interface-BFiD3kyB.cjs';
2
2
 
3
3
  /**
4
4
  * chat-storage-lib.ts
@@ -1,4 +1,4 @@
1
- import { J as JournalStorage, K as KVStorage } from './storage-interface-Ct-C4tlz.js';
1
+ import { J as JournalStorage, K as KVStorage } from './storage-interface-BFiD3kyB.js';
2
2
 
3
3
  /**
4
4
  * chat-storage-lib.ts
@@ -1,6 +1,6 @@
1
- import { a as CommandInput, C as CommandResult } from './board-live-cards-public-CPJy-aGW.cjs';
2
- import { C as ChatRecord, a as ChatReadAfterResult, b as ChatConfig, c as ChatStorage } from './chat-storage-lib-CKylihjm.cjs';
3
- import './storage-interface-Ct-C4tlz.cjs';
1
+ import { a as CommandInput, C as CommandResult } from './board-live-cards-public-wkNmBIRC.cjs';
2
+ import { C as ChatRecord, a as ChatReadAfterResult, b as ChatConfig, c as ChatStorage } from './chat-storage-lib-BIUbE-fM.cjs';
3
+ import './storage-interface-BFiD3kyB.cjs';
4
4
  import './execution-refs.cjs';
5
5
  import './types-BBhqYGhE.cjs';
6
6
 
@@ -1,6 +1,6 @@
1
- import { a as CommandInput, C as CommandResult } from './board-live-cards-public-CBVjm327.js';
2
- import { C as ChatRecord, a as ChatReadAfterResult, b as ChatConfig, c as ChatStorage } from './chat-storage-lib-Bce-xx6l.js';
3
- import './storage-interface-Ct-C4tlz.js';
1
+ import { a as CommandInput, C as CommandResult } from './board-live-cards-public-BMUIPOrc.js';
2
+ import { C as ChatRecord, a as ChatReadAfterResult, b as ChatConfig, c as ChatStorage } from './chat-storage-lib-BlG-sobS.js';
3
+ import './storage-interface-BFiD3kyB.js';
4
4
  import './execution-refs.js';
5
5
  import './types-BBhqYGhE.js';
6
6
 
@@ -1,3 +1,3 @@
1
- var a="b64:";function s(e){let n=new TextEncoder().encode(e),r=globalThis.Buffer,t;if(r)t=r.from(n).toString("base64");else if(typeof btoa=="function"){let o="";for(let i of n)o+=String.fromCharCode(i);t=btoa(o);}else throw new Error("No base64 encoder available in this runtime");return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function g(e){let n=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(n,"base64").toString("utf8");if(typeof atob=="function"){let t=atob(n),o=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)o[i]=t.charCodeAt(i);return new TextDecoder().decode(o)}throw new Error("No base64 decoder available in this runtime")}function l(e){return `${a}${s(JSON.stringify(e))}`}function u(e){if(!e.startsWith(a))throw new Error(`Invalid ref format (expected ${a}<base64url(json)>): ${e}`);let n;try{n=JSON.parse(g(e.slice(a.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!n||typeof n!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=n;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return {kind:r.kind,value:r.value}}async function f(e,n,r){let t=e.tryAcquire();if(!t)return false;try{await n();}finally{t();}return r?.(),true}
2
- export{l as a,u as b,f as c};//# sourceMappingURL=chunk-CWREBRXS.js.map
3
- //# sourceMappingURL=chunk-CWREBRXS.js.map
1
+ var s="b64:";function a(e){let n=new TextEncoder().encode(e),r=globalThis.Buffer,t;if(r)t=r.from(n).toString("base64");else if(typeof btoa=="function"){let o="";for(let i of n)o+=String.fromCharCode(i);t=btoa(o);}else throw new Error("No base64 encoder available in this runtime");return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function g(e){let n=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(n,"base64").toString("utf8");if(typeof atob=="function"){let t=atob(n),o=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)o[i]=t.charCodeAt(i);return new TextDecoder().decode(o)}throw new Error("No base64 decoder available in this runtime")}function l(e){return `${s}${a(JSON.stringify(e))}`}function u(e){if(!e.startsWith(s))throw new Error(`Invalid ref format (expected ${s}<base64url(json)>): ${e}`);let n;try{n=JSON.parse(g(e.slice(s.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!n||typeof n!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=n;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return {kind:r.kind,value:r.value}}async function f(e,n,r){let t=e.tryAcquire();if(!t)return false;try{await n();}finally{t();}return r?.(),true}
2
+ export{l as a,u as b,f as c};//# sourceMappingURL=chunk-BQS3EIEK.js.map
3
+ //# sourceMappingURL=chunk-BQS3EIEK.js.map
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-CWREBRXS.js';import {createRequire}from'module';import {fileURLToPath}from'url';import {dirname,resolve}from'path';import {existsSync}from'fs';var f=dirname(fileURLToPath(import.meta.url)),E=createRequire(import.meta.url);function w(){let e=resolve(f,"./jsonata-sync.cjs");return existsSync(e)?e:resolve(f,"../../card-compute/jsonata-sync.cjs")}var p=E(w());function u(e){e.registerFunction("fsPathRef",s=>a({kind:"fs-path",value:String(s)}),"<s:s>");}function R(e,s,c){if(!e||typeof e!="object")return {};let i={};if(Array.isArray(e.cmdTemplate)){let r=[];for(let n of e.cmdTemplate)try{let a=p(n);u(a),r.push(String(a.evaluate(s)));}catch(a){let t=a instanceof Error?a.message:String(a);throw new Error(`[${c}] argsMassaging.cmdTemplate failed on "${n}": ${t}`)}i.cmdArgs=r;}if(typeof e.stdinTemplate=="string")try{let r=p(e.stdinTemplate);u(r),i.stdin=r.evaluate(s);}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.stdinTemplate failed: ${n}`)}if(typeof e.urlTemplate=="string")try{let r=p(e.urlTemplate);u(r),i.url=String(r.evaluate(s));}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.urlTemplate failed: ${n}`)}if(typeof e.headerTemplate=="string")try{let r=p(e.headerTemplate);u(r);let n=r.evaluate(s);if(typeof n!="object"||n===null)throw new Error(`headerTemplate must produce an object, got: ${JSON.stringify(n)}`);i.headers=n;}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.headerTemplate failed: ${n}`)}if(typeof e.bodyTemplate=="string")try{let r=p(e.bodyTemplate);u(r),i.body=r.evaluate(s);}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.bodyTemplate failed: ${n}`)}return i}function _(e,s,c){if(!e||typeof e!="object")return s;let i={output:s},r=s.result,n=s.data,a=s.error;if(typeof e.resultExpr=="string")try{let t=p(e.resultExpr);u(t);let o=t.evaluate(i);if(typeof o!="string"||!o.trim())throw new Error(`resultExpr did not produce a non-empty string (got ${JSON.stringify(o)})`);r=o;}catch(t){let o=t instanceof Error?t.message:String(t);throw new Error(`[${c}] outputTransforms.resultExpr failed: ${o}`)}if(typeof e.dataTemplate=="string")try{let t=p(e.dataTemplate);u(t);let o=t.evaluate(i);if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`dataTemplate did not produce an object (got ${JSON.stringify(o)})`);n=o;}catch(t){let o=t instanceof Error?t.message:String(t);throw new Error(`[${c}] outputTransforms.dataTemplate failed: ${o}`)}if(typeof e.errorExpr=="string")try{let t=p(e.errorExpr);u(t);let o=t.evaluate(i);a=o!=null?String(o):void 0;}catch(t){let o=t instanceof Error?t.message:String(t);throw new Error(`[${c}] outputTransforms.errorExpr failed: ${o}`)}return a!==void 0?{result:r,data:n,error:a}:{result:r,data:n}}export{R as a,_ as b};//# sourceMappingURL=chunk-LDAP75GN.js.map
2
- //# sourceMappingURL=chunk-LDAP75GN.js.map
1
+ import {a}from'./chunk-BQS3EIEK.js';import {createRequire}from'module';import {fileURLToPath}from'url';import {dirname,resolve}from'path';import {existsSync}from'fs';var f=dirname(fileURLToPath(import.meta.url)),E=createRequire(import.meta.url);function w(){let e=resolve(f,"./jsonata-sync.cjs");return existsSync(e)?e:resolve(f,"../../card-compute/jsonata-sync.cjs")}var p=E(w());function u(e){e.registerFunction("fsPathRef",s=>a({kind:"fs-path",value:String(s)}),"<s:s>");}function R(e,s,c){if(!e||typeof e!="object")return {};let i={};if(Array.isArray(e.cmdTemplate)){let r=[];for(let n of e.cmdTemplate)try{let a=p(n);u(a),r.push(String(a.evaluate(s)));}catch(a){let t=a instanceof Error?a.message:String(a);throw new Error(`[${c}] argsMassaging.cmdTemplate failed on "${n}": ${t}`)}i.cmdArgs=r;}if(typeof e.stdinTemplate=="string")try{let r=p(e.stdinTemplate);u(r),i.stdin=r.evaluate(s);}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.stdinTemplate failed: ${n}`)}if(typeof e.urlTemplate=="string")try{let r=p(e.urlTemplate);u(r),i.url=String(r.evaluate(s));}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.urlTemplate failed: ${n}`)}if(typeof e.headerTemplate=="string")try{let r=p(e.headerTemplate);u(r);let n=r.evaluate(s);if(typeof n!="object"||n===null)throw new Error(`headerTemplate must produce an object, got: ${JSON.stringify(n)}`);i.headers=n;}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.headerTemplate failed: ${n}`)}if(typeof e.bodyTemplate=="string")try{let r=p(e.bodyTemplate);u(r),i.body=r.evaluate(s);}catch(r){let n=r instanceof Error?r.message:String(r);throw new Error(`[${c}] argsMassaging.bodyTemplate failed: ${n}`)}return i}function _(e,s,c){if(!e||typeof e!="object")return s;let i={output:s},r=s.result,n=s.data,a=s.error;if(typeof e.resultExpr=="string")try{let t=p(e.resultExpr);u(t);let o=t.evaluate(i);if(typeof o!="string"||!o.trim())throw new Error(`resultExpr did not produce a non-empty string (got ${JSON.stringify(o)})`);r=o;}catch(t){let o=t instanceof Error?t.message:String(t);throw new Error(`[${c}] outputTransforms.resultExpr failed: ${o}`)}if(typeof e.dataTemplate=="string")try{let t=p(e.dataTemplate);u(t);let o=t.evaluate(i);if(!o||typeof o!="object"||Array.isArray(o))throw new Error(`dataTemplate did not produce an object (got ${JSON.stringify(o)})`);n=o;}catch(t){let o=t instanceof Error?t.message:String(t);throw new Error(`[${c}] outputTransforms.dataTemplate failed: ${o}`)}if(typeof e.errorExpr=="string")try{let t=p(e.errorExpr);u(t);let o=t.evaluate(i);a=o!=null?String(o):void 0;}catch(t){let o=t instanceof Error?t.message:String(t);throw new Error(`[${c}] outputTransforms.errorExpr failed: ${o}`)}return a!==void 0?{result:r,data:n,error:a}:{result:r,data:n}}export{R as a,_ as b};//# sourceMappingURL=chunk-CIAJNUR4.js.map
2
+ //# sourceMappingURL=chunk-CIAJNUR4.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkIXZG74EW_cjs=require('./chunk-IXZG74EW.cjs');function h(a,i){if(a?.status==="success")return Object.prototype.hasOwnProperty.call(a,"data")?a.data:void 0;throw a?.status==="fail"||a?.status==="error"?new Error(a.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function K(a,i){if(a?.status==="success"&&Object.prototype.hasOwnProperty.call(a,"data"))return a.data;throw a?.status==="success"?new Error(`${i} returned success without data`):a?.status==="fail"||a?.status==="error"?new Error(a.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function t(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function y(a){return Array.isArray(a)?a:[]}function V(a,i){if(typeof i!="string"||i.length===0)return;let u=a,m=i;m.startsWith("fetched_sources.")&&(u=t(a).fetched_sources,m=m.slice(16));for(let k of m.split(".")){if(u==null||typeof u!="object")return;u=u[k];}return u}function N(a,i){let u=t(a.view),m=y(u.elements);return {layout:u.layout,features:u.features,elements:m.map((k,x)=>{let v=t(k),I=t(v.data),B=typeof v.visible=="string"?!!V(i,v.visible):true,U=typeof I.bind=="string"?I.bind:void 0,M=typeof I.maxRows=="number"?I.maxRows:void 0,L=U?V(i,U):void 0,E={id:typeof v.id=="string"&&v.id?v.id:`element-${x}`,kind:v.kind,label:v.label,visible:B};return L!==void 0&&(E.resolved=Array.isArray(L)&&typeof M=="number"?L.slice(0,M):L),E})}}function W(a,i){let u=typeof a.id=="string"&&a.id?a.id:"card",m=y(a.provides),k=m.length>0?m:[{bindTo:u,ref:"card_data"}],x={};for(let v of k){let I=t(v),B=typeof I.bindTo=="string"?I.bindTo:"",U=typeof I.ref=="string"?I.ref:"";if(!B||!U)continue;let M=V(i,U);M!==void 0&&(x[B]=M);}return x}function ie(a){if(typeof a!="string"||!a.trim())return null;let i=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(a.trim());if(!i)return null;let u=Number.parseInt(i[2],10);return !Number.isInteger(u)||u<0?null:u}function ce(a){return {"card-content":a}}function F(a){let{meta:i,...u}=a;return u}function ue(a,i){return Object.prototype.hasOwnProperty.call(a,i)}function J(a){return t(a.meta).__visible_controlplane_only===true}async function T(a,i){let u=await S(a.get({params:{id:i}}),"cardStore.get"),m=Array.isArray(u?.cards)?u.cards:[];if(m.length===0)throw new Error(`Card "${i}" not found`);return m[0]}function me(a){let{board:i,nonCore:u,cardStore:m,chatStore:k,uploadCardFile:x,buildFileDownloadUrl:v,readFetchedSourceJsonByRef:I}=a;function B(r){if(Array.isArray(r.bytes))return new Uint8Array(r.bytes.map(e=>Math.max(0,Math.min(255,Number(e)||0))));if(typeof r.text=="string")return new TextEncoder().encode(r.text);if(typeof r.base64=="string"){let e=String(r.base64).replace(/-/g,"+").replace(/_/g,"/"),n=e+"=".repeat((4-e.length%4)%4),s=atob(n);return Uint8Array.from(s,o=>o.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}async function U(){let r=t(await S(u.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:r.version,commonSourceFields:t(r.commonSourceDefFields),sourceKinds:t(r.sourceKinds)}}async function M(){let r=t(await S(i.status({}),"status")),e=t(r.summary),n=y(r.cards);return {meta:t(r.meta),summary:{card_count:typeof e.card_count=="number"?e.card_count:0,completed:typeof e.completed=="number"?e.completed:0,eligible:typeof e.eligible=="number"?e.eligible:0,pending:typeof e.pending=="number"?e.pending:0,blocked:typeof e.blocked=="number"?e.blocked:0,in_progress:typeof e.in_progress=="number"?e.in_progress:0,failed:typeof e.failed=="number"?e.failed:0,unresolved:typeof e.unresolved=="number"?e.unresolved:0},cards:n.map(s=>{let o=t(s);return {"card-id":typeof o.name=="string"?o.name:null,status:o.status??null,error:o.error??null,requires:y(o.requires),requires_satisfied:y(o.requires_satisfied),requires_missing:y(o.requires_missing),provides_declared:y(o.provides_declared),provides_runtime:y(o.provides_runtime)}})}}async function L(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let n=t(await S(i.status({}),"status")),o=y(n.cards).map(t).find(p=>p.name===e);if(!o)throw new Error(`card "${e}" not found in board status`);let d=t(await T(m,e));if(J(d))throw Object.assign(new Error(`card "${e}" not found`),{statusCode:404});let f=F(d),c=y(o.requires_satisfied).filter(p=>typeof p=="string"&&!!p),g=y(o.provides_runtime).filter(p=>typeof p=="string"&&!!p),b=Object.fromEntries(await Promise.all(c.map(async p=>[p,await S(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),R=Object.fromEntries(await Promise.all(g.map(async p=>[p,await S(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),C=t(await S(i.getOutputsComputedValues({params:{key:e}}),"getOutputsComputedValues")),l=await S(i.getOutputsFetchedSources({params:{key:e}}),"getOutputsFetchedSources"),_=y(d.source_defs).map(t),w={};for(let p of _)typeof p.bindTo=="string"&&typeof p.outputFile=="string"&&(w[p.outputFile]=p.bindTo);let A={};for(let[p,j]of Object.entries(l)){let q=w[p]??p;if(!I||typeof j!="string"){A[q]=null;continue}try{A[q]=I({cardId:e,ref:j});}catch{A[q]=null;}}let P={card_data:t(d.card_data),requires:b,fetched_sources:A,computed_values:C};return {cardId:e,card_status_in_board:o,card_definition_and_static_data:f,refs_for_fetched_source_files:l,runtime_data:{requires:b,provides:R,computed_values:C,rendered_view:N(d,P)}}}async function E(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectChatMessagesOnCards requires cardId");let n=typeof r.turnId=="string"?r.turnId:"",s=r.allTurns===true,o=typeof r.tailTurnsBeforeId=="string"?r.tailTurnsBeforeId:"",d=s?void 0:r.lastUserTurns??(n?void 0:1),f=r.tail,c={...d===void 0?{}:{tailTurns:d},...n?{turnId:n}:{},...s?{allTurns:true}:{},...o?{tailTurnsBeforeId:o}:{}},g=Object.keys(c).length>0?{params:{cardId:e},body:c}:{params:{cardId:e}},b=h(k.readAll(g),"chatStore.readAll"),R=t(await T(m,e)),C=y(t(R.card_data).files).map((w,A)=>({idx:A,stored_name:t(w).stored_name})).filter(w=>typeof w.stored_name=="string"&&w.stored_name.length>0),_=(Array.isArray(b.records)?b.records:[]).map(w=>{let P=t(w.payload),p={...w},j=typeof w?.role=="string"?w.role:typeof P.role=="string"?String(P.role):"",q=typeof w?.text=="string"?w.text:typeof P.text=="string"?String(P.text):"";if(j==="system"){let $=ie(q);if($!==null&&C.some(O=>O.idx===$)){let O=`Retrieve using inspect-file-contents --card-id ${e} --file-idx ${$}`;p.retrieval_hint=O,Object.keys(P).length>0&&typeof w.role!="string"&&(p.payload={...P,retrieval_hint:O});}}return p});return {cardId:e,messages:typeof f=="number"&&f>=0?_.slice(-f):_}}async function H(r){let e=String(r.cardId||"").trim(),n=Number(r.fileIdx);if(!e)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(n)||n<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let s=t(await T(m,e)),o=y(t(s.card_data).files).map(t);if(n>=o.length)throw new Error(`attachment index ${n} is out of range for card "${e}"`);let d=o[n],f=typeof d.stored_name=="string"?d.stored_name:null;return {cardId:e,fileIdx:n,downloadUrl:v({cardId:e,fileIdx:n,storedName:f}),...typeof d.name=="string"?{name:d.name}:{},...typeof d.stored_name=="string"?{stored_name:d.stored_name}:{},...typeof d.mime_type=="string"?{mime_type:d.mime_type}:{},...typeof d.size=="number"?{size:d.size}:{},...typeof d.uploaded_at=="string"?{uploaded_at:d.uploaded_at}:{}}}async function D(r){return await u.validateCardPreflight({body:ce(r.candidateCardContent)})}function G(r){if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!r.mockFetchedSources||typeof r.mockFetchedSources!="object"||Array.isArray(r.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let e=u.evalCardCompute({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires,"mock-fetched-sources":r.mockFetchedSources}});if(e.status!=="success")return e;let n=t(K(e,"evalCardCompute")),s=t(r.candidateCardContent),o={card_data:t(s.card_data),requires:t(r.mockRequires),fetched_sources:t(r.mockFetchedSources),computed_values:t(n.computed_values)};return {status:"success",data:{cardId:typeof n.cardId=="string"?n.cardId:typeof s.id=="string"?s.id:"(unknown)",ok:n.ok===true,computed_values:t(n.computed_values),errors:y(n.errors).map(d=>{let f=t(d);return {bindTo:typeof f.bindTo=="string"?f.bindTo:"",error:typeof f.error=="string"?f.error:""}}),provides_outputs:W(s,o),rendered_view:N(s,o)}}}async function Q(r){return await u.probeSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function X(r){return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function Y(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let n=t(await T(m,e)),s=y(n.source_defs).filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)),o={};if(r.sourceIdx>=0&&r.sourceIdx<s.length){let d=s[r.sourceIdx],f=chunkIXZG74EW_cjs.a.enrichSourcesSync([d],{card_data:t(n.card_data),requires:r.mockRequires});Array.isArray(f)&&f.length>0&&(o=t(f[0]._projections));}return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":n,"mock-requires":r.mockRequires,"mock-projections":o}})}async function Z(r){let e=t(await S(u.simulateCardCycle({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires}}),"simulateCardCycle")),n=t(r.candidateCardContent),s=t(e.validation),o=y(e.source_probes),d=y(e.projection_errors),f=t(e.fetched_sources),c=y(e.compute_errors),g=t(e.computed_values),b={card_data:t(n.card_data),requires:r.mockRequires,fetched_sources:f,computed_values:g},R=[];for(let C of y(s.issues))typeof C=="string"&&C&&R.push(C);for(let C of o){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",w=typeof l.error=="string"?l.error:"";w&&R.push(`${_}: ${w}`);}for(let C of d){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",w=typeof l.key=="string"?l.key:"projection",A=typeof l.error=="string"?l.error:"projection failed";R.push(`${_}.${w}: ${A}`);}for(let C of c){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"compute",w=typeof l.error=="string"?l.error:"compute failed";R.push(`${_}: ${w}`);}return {status:"success",data:{cardId:typeof e.cardId=="string"?e.cardId:"(unknown)",ok:e.ok===true,issues:R,provides_outputs:W(n,b),rendered_view:N(n,b)}}}async function ee(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get"),s=Array.isArray(n.cards)?n.cards.map(t):[];if(s.some(J))throw Object.assign(new Error(`Card "${e}" not found`),{statusCode:404});return s.map(o=>F(o))}async function re(r){let e=String(r.cardId||"").trim(),n=String(r.role||"").trim(),s=typeof r.text=="string"?r.text:"",o=typeof r.turn=="string"?r.turn:"";if(!e)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!n)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(n==="assistant"&&o){let c=h(k.readAll({params:{cardId:e},body:{turnId:o}}),"chatStore.readAll(existing turn messages)"),g=Array.isArray(c.records)?c.records.find(b=>b.role==="assistant"&&String(b.turn||"")===o):void 0;if(g)return {status:"success",data:{cardId:e,id:String(g.id),role:n,turn:o,files:Array.isArray(g.files)?g.files:[]}}}let d=await Promise.all(y(r.files).map(async c=>{let g=t(c),b=String(g.file_name??g.fileName??g.name??"").trim(),R=String(g.content_type??g.contentType??"application/octet-stream");if(!b)throw new Error("file entry requires file_name");return (await x({cardId:e,fileName:b,contentType:R,bytes:B(g)})).file}));d.forEach((c,g)=>{let b=n==="assistant"?`AI generated: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`:`file uploaded: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`;h(k.append({params:{cardId:e},body:{role:"system",text:b,files:[],turn:o}}),"chatStore.append(system attachment message)");});let f=h(k.append({params:{cardId:e},body:{role:n,text:s,files:d,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:e,id:String(f.id),role:n,turn:o,files:d}}}async function te(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("manageUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),d=t(o),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let c=null;try{c=await T(m,e);}catch{c=null;}let g=c&&ue(t(c),"meta")?{...s,meta:t(c).meta}:s,b=await m.set({body:g});h(b,"cardStore.set");let R;try{R=await i.upsertCard({params:{cardId:e,restart:!0}}),h(R,"upsertCard");}catch(l){try{c&&await m.set({body:c});}catch{}throw l}let C=null;try{C=await i.cardRefreshedNotify({params:{cardId:e}}),h(C,"cardRefreshedNotify");}catch{C=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:R,refresh_notify:C}}}async function ne(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageRemoveCard requires cardId");let n=await i.removeCard({params:{id:e}});h(n,"removeCard");let s=await m.del({params:{id:e}});return h(s,"cardStore.del"),{status:"success",data:{board_result:n,store_result:s}}}async function ae(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("adminReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get");return Array.isArray(n.cards)?n.cards.map(s=>t(s)):[]}async function oe(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("adminUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),d=t(o),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let c=null;try{c=await T(m,e);}catch{c=null;}let g=c?t(t(c).meta):{},b={...s,meta:{...g,__visible_controlplane_only:true}},R=await m.set({body:b});h(R,"cardStore.set");let C;try{C=await i.upsertCard({params:{cardId:e,restart:!0}}),h(C,"upsertCard");}catch(_){try{c&&await m.set({body:c});}catch{}throw _}let l=null;try{l=await i.cardRefreshedNotify({params:{cardId:e}}),h(l,"cardRefreshedNotify");}catch{l=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:C,refresh_notify:l}}}function se(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("getChatProcessing requires cardId");let n=K(k.isProcessing({params:{cardId:e}}),"chatStore.isProcessing");return {cardId:e,active:!!n.active}}function de(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("setChatProcessing requires cardId");if(typeof r.active!="boolean")throw new Error("setChatProcessing requires boolean active");return h(k.setProcessing({params:{cardId:e},body:{active:r.active}}),"chatStore.setProcessing"),{cardId:e,active:r.active}}return {discoverSourceKinds:U,inspectBoardRuntimeStatus:M,inspectCardDefinitionAndRuntime:L,inspectChatMessagesOnCards:E,inspectFileContents:H,preflightValidateCandidateCardDefinition:D,preflightMaterializeCandidateCard:G,preflightProbeSingleSourceInCandidateCard:Q,preflightRunSingleSourceInCandidateCard:X,preflightRunSingleSourceInLiveCard:Y,preflightRunOneCycleWithCandidateCard:Z,manageReadCard:ee,manageAddChatEntryAndAnyAttachments:re,manageUpsertCard:te,manageRemoveCard:ne,adminReadCard:ae,adminUpsertCard:oe,getChatProcessing:se,setChatProcessing:de}}async function S(a,i){return h(await a,i)}exports.a=me;//# sourceMappingURL=chunk-GJJMEAVN.cjs.map
2
+ //# sourceMappingURL=chunk-GJJMEAVN.cjs.map