yaml-flow 8.5.3 → 8.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/browser/asset-integrity.json +3 -3
  2. package/examples/board/demo-shell-with-server.html +2 -2
  3. package/examples/board/doc.html +2 -2
  4. package/examples/board/server/board-server.js +266 -5
  5. package/examples/board/server/board-worker/task-executor.js +166 -51
  6. package/examples/board/server/chat-flow/copilot-chat/assistant.js +25 -12
  7. package/examples/board/server/chat-flow/copilot-chat/probe.js +7 -0
  8. package/examples/board/server/chat-flow/copilot-chat/shared.js +97 -0
  9. package/examples/board/server/chat-flow/flow-steps.json +109 -51
  10. package/examples/board/server-config.json +1 -0
  11. package/examples/board/test/server-http-test.js +870 -67
  12. package/examples/board-local/demo-shell-localstorage.html +3 -3
  13. package/lib/{artifacts-store-lib-D-k-E8Vy.d.ts → artifacts-store-lib-C1rtrkxm.d.ts} +1 -1
  14. package/lib/{artifacts-store-lib-CVgtQrNZ.d.cts → artifacts-store-lib-CLOtsiav.d.cts} +1 -1
  15. package/lib/artifacts-store-public.cjs +1 -1
  16. package/lib/artifacts-store-public.d.cts +3 -3
  17. package/lib/artifacts-store-public.d.ts +3 -3
  18. package/lib/artifacts-store-public.js +1 -1
  19. package/lib/batch/index.cjs +1 -1
  20. package/lib/batch/index.js +1 -1
  21. package/lib/board-live-cards-mcp.cjs +1 -1
  22. package/lib/board-live-cards-mcp.d.cts +35 -15
  23. package/lib/board-live-cards-mcp.d.ts +35 -15
  24. package/lib/board-live-cards-mcp.js +1 -1
  25. package/lib/board-live-cards-node.cjs +8 -16
  26. package/lib/board-live-cards-node.d.cts +32 -12
  27. package/lib/board-live-cards-node.d.ts +32 -12
  28. package/lib/board-live-cards-node.js +8 -16
  29. package/lib/{board-live-cards-public-BGS22cMb.d.ts → board-live-cards-public-CBVjm327.d.ts} +59 -24
  30. package/lib/{board-live-cards-public-B13InXhC.d.cts → board-live-cards-public-CPJy-aGW.d.cts} +59 -24
  31. package/lib/board-live-cards-public.cjs +1 -2
  32. package/lib/board-live-cards-public.d.cts +2 -2
  33. package/lib/board-live-cards-public.d.ts +2 -2
  34. package/lib/board-live-cards-public.js +1 -2
  35. package/lib/board-live-cards-server-runtime.cjs +1 -7
  36. package/lib/board-live-cards-server-runtime.d.cts +5 -5
  37. package/lib/board-live-cards-server-runtime.d.ts +5 -5
  38. package/lib/board-live-cards-server-runtime.js +1 -7
  39. package/lib/board-livegraph-runtime/index.cjs +1 -2
  40. package/lib/board-livegraph-runtime/index.js +1 -2
  41. package/lib/board-worker-adapter.cjs +21 -7
  42. package/lib/board-worker-adapter.d.cts +17 -2
  43. package/lib/board-worker-adapter.d.ts +17 -2
  44. package/lib/board-worker-adapter.js +21 -7
  45. package/lib/card-compute/index.cjs +1 -9
  46. package/lib/card-compute/index.js +1 -9
  47. package/lib/card-store-public.cjs +1 -1
  48. package/lib/card-store-public.d.cts +2 -2
  49. package/lib/card-store-public.d.ts +2 -2
  50. package/lib/card-store-public.js +1 -1
  51. package/lib/card-validation.cjs +1 -9
  52. package/lib/card-validation.js +1 -9
  53. package/lib/{chat-storage-lib-CJn7a6OH.d.ts → chat-storage-lib-Bce-xx6l.d.ts} +1 -1
  54. package/lib/{chat-storage-lib-0imhRX3l.d.cts → chat-storage-lib-CKylihjm.d.cts} +1 -1
  55. package/lib/chat-store-public.cjs +1 -1
  56. package/lib/chat-store-public.d.cts +3 -3
  57. package/lib/chat-store-public.d.ts +3 -3
  58. package/lib/chat-store-public.js +1 -1
  59. package/lib/chunk-2MZUYY65.cjs +2 -0
  60. package/lib/chunk-5DB54ZX2.cjs +2 -0
  61. package/lib/chunk-5EA2ESS4.cjs +16 -0
  62. package/lib/chunk-6APH25VI.js +2 -0
  63. package/lib/chunk-76ON3V7R.js +2 -0
  64. package/lib/chunk-7BKNHFNH.js +2 -0
  65. package/lib/chunk-CWREBRXS.js +3 -0
  66. package/lib/chunk-DAXACY63.js +2 -0
  67. package/lib/chunk-FW4363Y4.js +2 -0
  68. package/lib/chunk-FZ2SBU5M.js +3 -0
  69. package/lib/chunk-G4XXRHL2.cjs +3 -0
  70. package/lib/chunk-GNFE24S7.cjs +2 -0
  71. package/lib/chunk-GYQXDNNI.cjs +2 -0
  72. package/lib/chunk-H5KD3JPY.cjs +2 -0
  73. package/lib/chunk-HLJH7LGW.js +16 -0
  74. package/lib/chunk-I4WH5U5D.cjs +2 -0
  75. package/lib/chunk-IXZG74EW.cjs +2 -0
  76. package/lib/chunk-JAL25FGA.cjs +2 -0
  77. package/lib/chunk-JM5EKT57.js +2 -0
  78. package/lib/chunk-JMDHDY6M.js +2 -0
  79. package/lib/chunk-KBELAKIY.js +2 -0
  80. package/lib/chunk-KHJABJ45.cjs +3 -0
  81. package/lib/chunk-KLRUISRY.cjs +2 -0
  82. package/lib/chunk-KNFFDVLD.cjs +2 -0
  83. package/lib/chunk-LBMEVV4U.js +2 -0
  84. package/lib/chunk-LDAP75GN.js +2 -0
  85. package/lib/chunk-LODXIALE.cjs +2 -0
  86. package/lib/chunk-LVNQCE5X.cjs +3 -0
  87. package/lib/chunk-M7EQRS6W.js +3 -0
  88. package/lib/chunk-MNEOJWPS.js +10 -0
  89. package/lib/chunk-NJJ7WEDT.cjs +2 -0
  90. package/lib/chunk-NMZ6XNLB.cjs +3 -0
  91. package/lib/chunk-OPNGCSXJ.js +2 -0
  92. package/lib/chunk-P64UKI3L.cjs +8 -0
  93. package/lib/chunk-P7ZCDICS.cjs +2 -0
  94. package/lib/chunk-Q6H7NINN.cjs +5 -0
  95. package/lib/chunk-Q6VSL327.js +8 -0
  96. package/lib/chunk-QWBNDVUA.js +5 -0
  97. package/lib/chunk-S6DRP2HX.cjs +2 -0
  98. package/lib/chunk-UJ7ZTV4J.cjs +10 -0
  99. package/lib/chunk-UVE65IPR.cjs +3 -0
  100. package/lib/chunk-VCCTAUIG.js +2 -0
  101. package/lib/chunk-VGT3TRQG.js +3 -0
  102. package/lib/chunk-VLBB3D6B.js +3 -0
  103. package/lib/chunk-WDPOGXTY.js +2 -0
  104. package/lib/chunk-X3LC4LII.js +2 -0
  105. package/lib/chunk-YGKDQLYP.js +2 -0
  106. package/lib/chunk-YMEIPKLW.cjs +2 -0
  107. package/lib/config/index.cjs +1 -1
  108. package/lib/config/index.js +1 -1
  109. package/lib/continuous-event-graph/index.cjs +1 -2
  110. package/lib/continuous-event-graph/index.js +1 -2
  111. package/lib/event-graph/index.cjs +1 -22
  112. package/lib/event-graph/index.js +1 -22
  113. package/lib/execution-refs.cjs +1 -2
  114. package/lib/execution-refs.d.cts +3 -2
  115. package/lib/execution-refs.d.ts +3 -2
  116. package/lib/execution-refs.js +1 -2
  117. package/lib/index.cjs +2 -24
  118. package/lib/index.d.cts +1 -1
  119. package/lib/index.d.ts +1 -1
  120. package/lib/index.js +2 -24
  121. package/lib/server-runtime/index.cjs +1 -7
  122. package/lib/server-runtime/index.d.cts +6 -6
  123. package/lib/server-runtime/index.d.ts +6 -6
  124. package/lib/server-runtime/index.js +1 -7
  125. package/lib/step-machine/index.cjs +1 -11
  126. package/lib/step-machine/index.js +1 -11
  127. package/lib/step-machine-public/index.cjs +1 -4
  128. package/lib/step-machine-public/index.d.cts +1 -1
  129. package/lib/step-machine-public/index.d.ts +1 -1
  130. package/lib/step-machine-public/index.js +1 -4
  131. package/lib/{storage-interface-B2WD9D5n.d.cts → storage-interface-Ct-C4tlz.d.cts} +28 -1
  132. package/lib/{storage-interface-B2WD9D5n.d.ts → storage-interface-Ct-C4tlz.d.ts} +28 -1
  133. package/lib/stores/index.cjs +1 -2
  134. package/lib/stores/index.d.cts +1 -1
  135. package/lib/stores/index.d.ts +1 -1
  136. package/lib/stores/index.js +1 -2
  137. package/lib/stores/kv.cjs +1 -2
  138. package/lib/stores/kv.d.cts +1 -1
  139. package/lib/stores/kv.d.ts +1 -1
  140. package/lib/stores/kv.js +1 -2
  141. package/lib/stores/memory.cjs +1 -1
  142. package/lib/stores/memory.js +1 -1
  143. package/lib/{types-30R357js.d.ts → types-BuK2UMxk.d.ts} +4 -4
  144. package/lib/{types-CIgsh56O.d.cts → types-DRl0Hy_p.d.cts} +4 -4
  145. package/package.json +2 -16
  146. package/cli/board-live-cards-lib-COi4bSpk.d.ts +0 -322
  147. package/cli/browser-api/board-live-cards-browser-adapter.d.ts +0 -36
  148. package/cli/browser-api/board-live-cards-browser-adapter.js +0 -4
  149. package/cli/browser-api/card-store-browser-api.d.ts +0 -25
  150. package/cli/browser-api/card-store-browser-api.js +0 -2
  151. package/cli/browser-api/jsonata-sync.cjs +0 -7623
  152. package/cli/bundled/artifacts-store-cli.mjs +0 -12
  153. package/cli/bundled/batch-runner-cli.mjs +0 -3
  154. package/cli/bundled/board-live-cards-cli.mjs +0 -29
  155. package/cli/bundled/card-store-cli.mjs +0 -154
  156. package/cli/bundled/chat-store-cli.mjs +0 -16
  157. package/cli/bundled/jsonata-sync.cjs +0 -7623
  158. package/cli/bundled/step-machine-cli.mjs +0 -150
  159. package/cli/execution-interface-BCIhu1gO.d.ts +0 -442
  160. package/cli/types-H3EMBPY2.d.ts +0 -398
  161. package/examples/board/server/README-mcp-api.md +0 -690
  162. package/examples/board/test/server-http-mcp-test.js +0 -1280
  163. package/lib/board-livegraph-runtime/jsonata-sync.cjs +0 -7623
  164. package/lib/card-compute/jsonata-sync.cjs +0 -7623
  165. package/lib/continuous-event-graph/jsonata-sync.cjs +0 -7623
  166. package/lib/server-runtime/jsonata-sync.cjs +0 -7623
@@ -1,3 +1,2 @@
1
- 'use strict';var i=class{runs=new Map;data=new Map;async saveRunState(t,e){this.runs.set(t,{...e});}async loadRunState(t){let e=this.runs.get(t);return e?{...e}:null}async deleteRunState(t){this.runs.delete(t),this.data.delete(t);}async setData(t,e,s){this.data.has(t)||this.data.set(t,{});let r=this.data.get(t);r[e]=s;}async getData(t,e){return this.data.get(t)?.[e]}async getAllData(t){return {...this.data.get(t)??{}}}async clearData(t){this.data.delete(t);}async listRuns(){return Array.from(this.runs.keys())}clear(){this.runs.clear(),this.data.clear();}};function n(a){return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function c(a){return atob(a.replace(/-/g,"+").replace(/_/g,"/"))}var o=class{constructor(t){this.kv=t;}kv;stateKey(t){return `state_${n(t)}`}dataPrefix(t){return `data_${n(t)}_`}dataKey(t,e){return `${this.dataPrefix(t)}${n(e)}`}async saveRunState(t,e){this.kv.write(this.stateKey(t),e);}async loadRunState(t){let e=this.kv.read(this.stateKey(t));return e!=null&&typeof e=="object"?e:null}async deleteRunState(t){this.kv.delete(this.stateKey(t));for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async setData(t,e,s){this.kv.write(this.dataKey(t,e),s);}async getData(t,e){return this.kv.read(this.dataKey(t,e))}async getAllData(t){let e=this.dataPrefix(t),s={};for(let r of this.kv.listKeys(e))s[c(r.slice(e.length))]=this.kv.read(r);return s}async clearData(t){for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async listRuns(){return this.kv.listKeys("state_").map(t=>c(t.slice(6)))}};
2
- exports.KVStorageStore=o;exports.MemoryStore=i;//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunkKHJABJ45_cjs=require('../chunk-KHJABJ45.cjs'),chunkH5KD3JPY_cjs=require('../chunk-H5KD3JPY.cjs');require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"KVStorageStore",{enumerable:true,get:function(){return chunkKHJABJ45_cjs.a}});Object.defineProperty(exports,"MemoryStore",{enumerable:true,get:function(){return chunkH5KD3JPY_cjs.a}});//# sourceMappingURL=index.cjs.map
3
2
  //# sourceMappingURL=index.cjs.map
@@ -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-B2WD9D5n.cjs';
4
+ import '../storage-interface-Ct-C4tlz.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-B2WD9D5n.js';
4
+ import '../storage-interface-Ct-C4tlz.js';
@@ -1,3 +1,2 @@
1
- var i=class{runs=new Map;data=new Map;async saveRunState(t,e){this.runs.set(t,{...e});}async loadRunState(t){let e=this.runs.get(t);return e?{...e}:null}async deleteRunState(t){this.runs.delete(t),this.data.delete(t);}async setData(t,e,s){this.data.has(t)||this.data.set(t,{});let r=this.data.get(t);r[e]=s;}async getData(t,e){return this.data.get(t)?.[e]}async getAllData(t){return {...this.data.get(t)??{}}}async clearData(t){this.data.delete(t);}async listRuns(){return Array.from(this.runs.keys())}clear(){this.runs.clear(),this.data.clear();}};function n(a){return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function c(a){return atob(a.replace(/-/g,"+").replace(/_/g,"/"))}var o=class{constructor(t){this.kv=t;}kv;stateKey(t){return `state_${n(t)}`}dataPrefix(t){return `data_${n(t)}_`}dataKey(t,e){return `${this.dataPrefix(t)}${n(e)}`}async saveRunState(t,e){this.kv.write(this.stateKey(t),e);}async loadRunState(t){let e=this.kv.read(this.stateKey(t));return e!=null&&typeof e=="object"?e:null}async deleteRunState(t){this.kv.delete(this.stateKey(t));for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async setData(t,e,s){this.kv.write(this.dataKey(t,e),s);}async getData(t,e){return this.kv.read(this.dataKey(t,e))}async getAllData(t){let e=this.dataPrefix(t),s={};for(let r of this.kv.listKeys(e))s[c(r.slice(e.length))]=this.kv.read(r);return s}async clearData(t){for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async listRuns(){return this.kv.listKeys("state_").map(t=>c(t.slice(6)))}};
2
- export{o as KVStorageStore,i as MemoryStore};//# sourceMappingURL=index.js.map
1
+ export{a as KVStorageStore}from'../chunk-FZ2SBU5M.js';export{a as MemoryStore}from'../chunk-JM5EKT57.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
3
2
  //# sourceMappingURL=index.js.map
package/lib/stores/kv.cjs CHANGED
@@ -1,3 +1,2 @@
1
- 'use strict';function i(s){return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function a(s){return atob(s.replace(/-/g,"+").replace(/_/g,"/"))}var o=class{constructor(t){this.kv=t;}kv;stateKey(t){return `state_${i(t)}`}dataPrefix(t){return `data_${i(t)}_`}dataKey(t,e){return `${this.dataPrefix(t)}${i(e)}`}async saveRunState(t,e){this.kv.write(this.stateKey(t),e);}async loadRunState(t){let e=this.kv.read(this.stateKey(t));return e!=null&&typeof e=="object"?e:null}async deleteRunState(t){this.kv.delete(this.stateKey(t));for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async setData(t,e,r){this.kv.write(this.dataKey(t,e),r);}async getData(t,e){return this.kv.read(this.dataKey(t,e))}async getAllData(t){let e=this.dataPrefix(t),r={};for(let n of this.kv.listKeys(e))r[a(n.slice(e.length))]=this.kv.read(n);return r}async clearData(t){for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async listRuns(){return this.kv.listKeys("state_").map(t=>a(t.slice(6)))}};
2
- exports.KVStorageStore=o;//# sourceMappingURL=kv.cjs.map
1
+ 'use strict';var chunkKHJABJ45_cjs=require('../chunk-KHJABJ45.cjs');require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"KVStorageStore",{enumerable:true,get:function(){return chunkKHJABJ45_cjs.a}});//# sourceMappingURL=kv.cjs.map
3
2
  //# sourceMappingURL=kv.cjs.map
@@ -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-B2WD9D5n.cjs';
2
+ import { K as KVStorage } from '../storage-interface-Ct-C4tlz.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-B2WD9D5n.js';
2
+ import { K as KVStorage } from '../storage-interface-Ct-C4tlz.js';
3
3
 
4
4
  /**
5
5
  * yaml-flow - KVStorageStore
package/lib/stores/kv.js CHANGED
@@ -1,3 +1,2 @@
1
- function i(s){return btoa(s).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function a(s){return atob(s.replace(/-/g,"+").replace(/_/g,"/"))}var o=class{constructor(t){this.kv=t;}kv;stateKey(t){return `state_${i(t)}`}dataPrefix(t){return `data_${i(t)}_`}dataKey(t,e){return `${this.dataPrefix(t)}${i(e)}`}async saveRunState(t,e){this.kv.write(this.stateKey(t),e);}async loadRunState(t){let e=this.kv.read(this.stateKey(t));return e!=null&&typeof e=="object"?e:null}async deleteRunState(t){this.kv.delete(this.stateKey(t));for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async setData(t,e,r){this.kv.write(this.dataKey(t,e),r);}async getData(t,e){return this.kv.read(this.dataKey(t,e))}async getAllData(t){let e=this.dataPrefix(t),r={};for(let n of this.kv.listKeys(e))r[a(n.slice(e.length))]=this.kv.read(n);return r}async clearData(t){for(let e of this.kv.listKeys(this.dataPrefix(t)))this.kv.delete(e);}async listRuns(){return this.kv.listKeys("state_").map(t=>a(t.slice(6)))}};
2
- export{o as KVStorageStore};//# sourceMappingURL=kv.js.map
1
+ export{a as KVStorageStore}from'../chunk-FZ2SBU5M.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=kv.js.map
3
2
  //# sourceMappingURL=kv.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var a=class{runs=new Map;data=new Map;async saveRunState(t,e){this.runs.set(t,{...e});}async loadRunState(t){let e=this.runs.get(t);return e?{...e}:null}async deleteRunState(t){this.runs.delete(t),this.data.delete(t);}async setData(t,e,s){this.data.has(t)||this.data.set(t,{});let n=this.data.get(t);n[e]=s;}async getData(t,e){return this.data.get(t)?.[e]}async getAllData(t){return {...this.data.get(t)??{}}}async clearData(t){this.data.delete(t);}async listRuns(){return Array.from(this.runs.keys())}clear(){this.runs.clear(),this.data.clear();}};exports.MemoryStore=a;//# sourceMappingURL=memory.cjs.map
1
+ 'use strict';var chunkH5KD3JPY_cjs=require('../chunk-H5KD3JPY.cjs');require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"MemoryStore",{enumerable:true,get:function(){return chunkH5KD3JPY_cjs.a}});//# sourceMappingURL=memory.cjs.map
2
2
  //# sourceMappingURL=memory.cjs.map
@@ -1,2 +1,2 @@
1
- var a=class{runs=new Map;data=new Map;async saveRunState(t,e){this.runs.set(t,{...e});}async loadRunState(t){let e=this.runs.get(t);return e?{...e}:null}async deleteRunState(t){this.runs.delete(t),this.data.delete(t);}async setData(t,e,s){this.data.has(t)||this.data.set(t,{});let n=this.data.get(t);n[e]=s;}async getData(t,e){return this.data.get(t)?.[e]}async getAllData(t){return {...this.data.get(t)??{}}}async clearData(t){this.data.delete(t);}async listRuns(){return Array.from(this.runs.keys())}clear(){this.runs.clear(),this.data.clear();}};export{a as MemoryStore};//# sourceMappingURL=memory.js.map
1
+ export{a as MemoryStore}from'../chunk-JM5EKT57.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=memory.js.map
2
2
  //# sourceMappingURL=memory.js.map
@@ -1,8 +1,8 @@
1
- import { a as ArtifactsStore } from './artifacts-store-lib-D-k-E8Vy.js';
2
- import { e as BoardPlatformAdapter, d as BoardNonCorePlatformAdapter, C as CommandResult } from './board-live-cards-public-BGS22cMb.js';
1
+ import { a as ArtifactsStore } from './artifacts-store-lib-C1rtrkxm.js';
2
+ import { e as BoardPlatformAdapter, d as BoardNonCorePlatformAdapter, C as CommandResult } from './board-live-cards-public-CBVjm327.js';
3
3
  import { ExecutionRef } from './execution-refs.js';
4
- import { a as KindValueRef } from './storage-interface-B2WD9D5n.js';
5
- import { c as ChatStorage } from './chat-storage-lib-CJn7a6OH.js';
4
+ import { a as KindValueRef } from './storage-interface-Ct-C4tlz.js';
5
+ import { c as ChatStorage } from './chat-storage-lib-Bce-xx6l.js';
6
6
 
7
7
  interface InvocationAdapter {
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { a as ArtifactsStore } from './artifacts-store-lib-CVgtQrNZ.cjs';
2
- import { e as BoardPlatformAdapter, d as BoardNonCorePlatformAdapter, C as CommandResult } from './board-live-cards-public-B13InXhC.cjs';
1
+ import { a as ArtifactsStore } from './artifacts-store-lib-CLOtsiav.cjs';
2
+ import { e as BoardPlatformAdapter, d as BoardNonCorePlatformAdapter, C as CommandResult } from './board-live-cards-public-CPJy-aGW.cjs';
3
3
  import { ExecutionRef } from './execution-refs.cjs';
4
- import { a as KindValueRef } from './storage-interface-B2WD9D5n.cjs';
5
- import { c as ChatStorage } from './chat-storage-lib-0imhRX3l.cjs';
4
+ import { a as KindValueRef } from './storage-interface-Ct-C4tlz.cjs';
5
+ import { c as ChatStorage } from './chat-storage-lib-CKylihjm.cjs';
6
6
 
7
7
  interface InvocationAdapter {
8
8
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml-flow",
3
- "version": "8.5.3",
3
+ "version": "8.6.1",
4
4
  "description": "Unified workflow engine: step-machine (sequential) + event-graph (stateless DAG) with pluggable storage",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -8,14 +8,6 @@
8
8
  "main": "./lib/board-live-cards-public.cjs",
9
9
  "module": "./lib/board-live-cards-public.js",
10
10
  "types": "./lib/board-live-cards-public.d.ts",
11
- "bin": {
12
- "board-live-cards-cli": "./cli/bundled/board-live-cards-cli.mjs",
13
- "card-store": "./cli/bundled/card-store-cli.mjs",
14
- "artifacts-store": "./cli/bundled/artifacts-store-cli.mjs",
15
- "chat-store": "./cli/bundled/chat-store-cli.mjs",
16
- "step-machine-cli": "./cli/bundled/step-machine-cli.mjs",
17
- "batch-runner-cli": "./cli/bundled/batch-runner-cli.mjs"
18
- },
19
11
  "exports": {
20
12
  ".": {
21
13
  "types": "./lib/board-live-cards-public.d.ts",
@@ -72,7 +64,6 @@
72
64
  "import": "./lib/board-live-cards-server-runtime.js",
73
65
  "require": "./lib/board-live-cards-server-runtime.cjs"
74
66
  },
75
- "./cli-bundled/*": "./cli/bundled/*",
76
67
  "./package.json": "./package.json"
77
68
  },
78
69
  "browser": {
@@ -80,8 +71,6 @@
80
71
  },
81
72
  "files": [
82
73
  "lib",
83
- "cli",
84
- "!cli/node/**",
85
74
  "examples",
86
75
  "schema",
87
76
  "browser",
@@ -89,7 +78,6 @@
89
78
  "!browser/board-livegraph-engine.js",
90
79
  "!browser/board-livecards-localstorage.js",
91
80
  "!lib/**/*.map",
92
- "!cli/**/*.map",
93
81
  "!browser/**/*.map",
94
82
  "!examples/**/.demo-setup/**",
95
83
  "!examples/**/.server-meta/**",
@@ -99,12 +87,11 @@
99
87
  "!examples/**/cards/**/files/**"
100
88
  ],
101
89
  "scripts": {
102
- "build": "npm run -s build:lib && npm run -s build:cli && npm run -s build:cli-bundled && npm run -s build:public-examples && npm run -s build:wrapper-scripts",
90
+ "build": "npm run -s build:lib && npm run -s build:cli && npm run -s build:cli-bundled && npm run -s build:public-examples",
103
91
  "build:lib": "tsup --config tsup.config.ts",
104
92
  "build:cli": "tsup --config tsup.cli.config.ts",
105
93
  "build:cli-bundled": "node scripts/build-cli-bundled.mjs",
106
94
  "build:public-examples": "node scripts/generate-public-examples.mjs",
107
- "build:wrapper-scripts": "node wrapper-scripts/cli/build.mjs",
108
95
  "build:browser": "tsup --config tsup.browser.config.ts && node scripts/generate-browser-integrity.mjs",
109
96
  "check:bundle-budget": "node scripts/check-bundle-budgets.mjs",
110
97
  "check:browser-bundle": "node scripts/check-browser-bundle-safety.mjs",
@@ -119,7 +106,6 @@
119
106
  "test": "vitest",
120
107
  "test:run": "vitest run",
121
108
  "test:e2e": "vitest run --config vitest.e2e.config.ts",
122
- "test:wrapper-scripts": "node wrapper-scripts/cli/test-scripts.js",
123
109
  "test:python": "vitest run --config vitest.python.config.ts",
124
110
  "tests:e2e": "npm run -s test:e2e",
125
111
  "tests:python": "npm run -s test:python",
@@ -1,322 +0,0 @@
1
- /**
2
- * Event Graph — Core Types
3
- *
4
- * Type definitions for the stateless event-graph engine.
5
- * Pure: f(state, event) → newState
6
- */
7
- interface GraphConfig {
8
- id?: string;
9
- settings: GraphSettings;
10
- tasks: Record<string, TaskConfig>;
11
- }
12
- interface GraphSettings {
13
- /** Completion strategy */
14
- completion: CompletionStrategy;
15
- /** Conflict resolution strategy */
16
- conflict_strategy?: ConflictStrategy;
17
- /** Execution mode */
18
- execution_mode?: ExecutionMode;
19
- /** Default refresh strategy for all tasks (default: 'data-changed') */
20
- refreshStrategy?: RefreshStrategy;
21
- /** Goal outputs — used with 'goal-reached' completion */
22
- goal?: string[];
23
- /** Max total scheduler iterations (safety limit, default: 1000) */
24
- max_iterations?: number;
25
- /** Timeout in ms (declared for drivers, not enforced by pure engine) */
26
- timeout_ms?: number;
27
- }
28
- interface TaskConfig {
29
- /** What this task needs to become eligible */
30
- requires?: string[];
31
- /** What this task produces on successful completion */
32
- provides: string[];
33
- /** Conditional provides based on handler result */
34
- on?: Record<string, string[]>;
35
- /** Tokens to inject into available outputs on failure */
36
- on_failure?: string[];
37
- /** Task execution method (informational — driver concern) */
38
- method?: string;
39
- /** Named task handler references — looked up in the handler registry at dispatch time */
40
- taskHandlers?: string[];
41
- /** Arbitrary task configuration (driver concern) */
42
- config?: Record<string, unknown>;
43
- /** Task priority (higher = preferred in conflict resolution) */
44
- priority?: number;
45
- /** Estimated duration in ms (used by duration-first strategy) */
46
- estimatedDuration?: number;
47
- /** Estimated cost (used by cost-optimized strategy) */
48
- estimatedCost?: number;
49
- /** Resource requirements (used by resource-aware strategy) */
50
- estimatedResources?: Record<string, number>;
51
- /** Retry configuration */
52
- retry?: TaskRetryConfig;
53
- /** Refresh strategy — controls when a completed task re-runs (default: 'data-changed') */
54
- refreshStrategy?: RefreshStrategy;
55
- /** Refresh interval in seconds — only used with 'time-based' strategy */
56
- refreshInterval?: number;
57
- /** Max executions cap (safety limit, optional) */
58
- maxExecutions?: number;
59
- /** Circuit breaker: max executions before breaking */
60
- circuit_breaker?: TaskCircuitBreakerConfig;
61
- /** Description */
62
- description?: string;
63
- /** LLM inference hints — opt-in metadata for AI-assisted completion detection */
64
- inference?: {
65
- /** Human-readable completion criteria */
66
- criteria?: string;
67
- /** Keywords to help the LLM understand the domain */
68
- keywords?: string[];
69
- /** Suggested checks for verification */
70
- suggestedChecks?: string[];
71
- /** Whether the LLM should attempt to auto-detect completion (default: false) */
72
- autoDetectable?: boolean;
73
- };
74
- }
75
- interface TaskRetryConfig {
76
- max_attempts: number;
77
- delay_ms?: number;
78
- backoff_multiplier?: number;
79
- }
80
- interface TaskCircuitBreakerConfig {
81
- /** Max executions before injecting break tokens */
82
- max_executions: number;
83
- /** Tokens to inject when breaker trips */
84
- on_break: string[];
85
- }
86
- interface ExecutionConfig {
87
- executionMode: ExecutionMode;
88
- conflictStrategy: ConflictStrategy;
89
- completionStrategy: CompletionStrategy;
90
- }
91
- type GraphEvent = TaskStartedEvent | TaskCompletedEvent | TaskFailedEvent | TaskProgressEvent | TaskRestartEvent | InjectTokensEvent | AgentActionEvent | TaskUpsertEvent | TaskRemovalEvent | NodeRequiresAddEvent | NodeRequiresRemoveEvent | NodeProvidesAddEvent | NodeProvidesRemoveEvent;
92
- interface TaskStartedEvent {
93
- type: 'task-started';
94
- taskName: string;
95
- timestamp: string;
96
- executionId?: string;
97
- }
98
- interface TaskCompletedEvent {
99
- type: 'task-completed';
100
- taskName: string;
101
- /** Handler result key — used for conditional routing via `on` */
102
- result?: string;
103
- /** Data payload from task execution */
104
- data?: Record<string, unknown>;
105
- /** Content hash of the output — used by 'data-changed' refresh strategy */
106
- dataHash?: string;
107
- timestamp: string;
108
- executionId?: string;
109
- }
110
- interface TaskFailedEvent {
111
- type: 'task-failed';
112
- taskName: string;
113
- error: string;
114
- timestamp: string;
115
- executionId?: string;
116
- }
117
- interface TaskProgressEvent {
118
- type: 'task-progress';
119
- taskName: string;
120
- message?: string;
121
- progress?: number;
122
- /**
123
- * Arbitrary update payload — used by source delivery to carry
124
- * { bindTo, fetchedAt, dest } or { bindTo, failure, reason }.
125
- * card-handler receives this via TaskHandlerInput.update.
126
- */
127
- update?: Record<string, unknown>;
128
- timestamp: string;
129
- executionId?: string;
130
- }
131
- interface TaskRestartEvent {
132
- type: 'task-restart';
133
- taskName: string;
134
- timestamp: string;
135
- executionId?: string;
136
- }
137
- interface InjectTokensEvent {
138
- type: 'inject-tokens';
139
- tokens: string[];
140
- timestamp: string;
141
- }
142
- interface AgentActionEvent {
143
- type: 'agent-action';
144
- action: 'start' | 'stop' | 'pause' | 'resume';
145
- timestamp: string;
146
- config?: Partial<ExecutionConfig>;
147
- }
148
- interface TaskUpsertEvent {
149
- type: 'task-upsert';
150
- taskName: string;
151
- taskConfig: TaskConfig;
152
- timestamp: string;
153
- }
154
- interface TaskRemovalEvent {
155
- type: 'task-removal';
156
- taskName: string;
157
- timestamp: string;
158
- }
159
- interface NodeRequiresAddEvent {
160
- type: 'node-requires-add';
161
- nodeName: string;
162
- tokens: string[];
163
- timestamp: string;
164
- }
165
- interface NodeRequiresRemoveEvent {
166
- type: 'node-requires-remove';
167
- nodeName: string;
168
- tokens: string[];
169
- timestamp: string;
170
- }
171
- interface NodeProvidesAddEvent {
172
- type: 'node-provides-add';
173
- nodeName: string;
174
- tokens: string[];
175
- timestamp: string;
176
- }
177
- interface NodeProvidesRemoveEvent {
178
- type: 'node-provides-remove';
179
- nodeName: string;
180
- tokens: string[];
181
- timestamp: string;
182
- }
183
- type CompletionStrategy = 'all-tasks-done' | 'all-outputs-done' | 'only-resolved' | 'goal-reached' | 'manual';
184
- type ExecutionMode = 'dependency-mode' | 'eligibility-mode';
185
- type ConflictStrategy = 'alphabetical' | 'priority-first' | 'duration-first' | 'cost-optimized' | 'resource-aware' | 'random-select' | 'user-choice' | 'parallel-all' | 'skip-conflicts' | 'round-robin';
186
- type RefreshStrategy = 'data-changed' | 'epoch-changed' | 'time-based' | 'manual' | 'once';
187
-
188
- /**
189
- * board-live-cards-lib — Pure logic library for the board-live-cards CLI.
190
- *
191
- * Merged from:
192
- * board-live-cards-all-stores.ts
193
- * board-live-cards-lib-types.ts
194
- * board-live-cards-lib-board-status.ts
195
- * board-live-cards-lib-card-handler.ts
196
- * board-live-cards-cli-board-commands.ts
197
- * board-live-cards-cli-card-commands.ts
198
- * board-live-cards-cli-callbacks.ts
199
- *
200
- * Zero platform imports. All storage is injected via adapter interfaces.
201
- * Safe for Node, browser, and neutral (V8/PyMiniRacer) bundles.
202
- */
203
-
204
- interface LiveCard {
205
- id: string;
206
- [key: string]: unknown;
207
- }
208
- interface CardIndexEntry {
209
- /** Storage-specific address (file path, Cosmos doc id, localStorage key). */
210
- key: string;
211
- /** Checksum of card content — computed by the adapter at write time. */
212
- checksum: string;
213
- updatedAt: string;
214
- }
215
- type CardIndex = Record<string, CardIndexEntry>;
216
- type CardChecksumIndex = Record<string, string>;
217
- interface CardStorageAdapter {
218
- readIndex(): CardIndex | null;
219
- writeIndex(index: CardIndex): void;
220
- readCard(key: string): LiveCard | null;
221
- /** Write card content; returns checksum of what was written. */
222
- writeCard(key: string, card: LiveCard): string;
223
- removeCard(key: string): void;
224
- cardExists(key: string): boolean;
225
- defaultCardKey(cardId: string): string;
226
- }
227
- interface CardStore {
228
- readCard(id: string): LiveCard | null;
229
- readCardKey(id: string): string | null;
230
- readAllCards(): LiveCard[];
231
- readChecksumIndex(): CardChecksumIndex;
232
- changedSince(snapshotChecksumIndex: CardChecksumIndex): string[];
233
- }
234
- interface CardUpsertValidation {
235
- ok: boolean;
236
- error?: string;
237
- }
238
- interface CardAdminStore extends CardStore {
239
- validateUpsert(id: string, cardKey: string): CardUpsertValidation;
240
- writeCard(id: string, card: LiveCard, cardKey?: string): void;
241
- patchCard(id: string, jsonPath: string, value: unknown): void;
242
- removeCard(id: string): void;
243
- readIndex(): CardIndex;
244
- }
245
- declare function createCardStore(adapter: CardStorageAdapter, onWarn?: (msg: string) => void): CardAdminStore;
246
- interface JournalEntry {
247
- id: string;
248
- event: GraphEvent;
249
- }
250
- interface JournalStorageAdapter {
251
- readAllEntries(): JournalEntry[];
252
- appendEntry(entry: JournalEntry): void;
253
- generateId(): string;
254
- }
255
- declare const SNAPSHOT_SCHEMA_VERSION_V1 = "v1";
256
- declare const BOARD_GRAPH_KEY = "board/graph";
257
- type OutputStoreEvent = {
258
- kind: 'computed_values';
259
- cardId: string;
260
- values: Record<string, unknown>;
261
- } | {
262
- kind: 'data_object';
263
- key: string;
264
- payload: unknown;
265
- } | {
266
- kind: 'status';
267
- status: unknown;
268
- };
269
- interface BoardStatusCard {
270
- name: string;
271
- status: string;
272
- error?: {
273
- message: string;
274
- code?: string;
275
- at?: string;
276
- source?: 'task-runtime' | 'source-fetch' | 'timeout' | 'unknown';
277
- };
278
- requires: string[];
279
- requires_satisfied: string[];
280
- requires_missing: string[];
281
- provides_declared: string[];
282
- provides_runtime: string[];
283
- blocked_by: string[];
284
- unblocks: string[];
285
- runtime: {
286
- attempt_count: number;
287
- restart_count: number;
288
- in_progress_since: string | null;
289
- last_transition_at: string | null;
290
- last_completed_at: string | null;
291
- last_restarted_at: string | null;
292
- status_age_ms: number | null;
293
- };
294
- }
295
- interface BoardStatusObject {
296
- schema_version: 'v1';
297
- meta: {
298
- board: {
299
- path: string;
300
- };
301
- };
302
- summary: {
303
- card_count: number;
304
- completed: number;
305
- eligible: number;
306
- pending: number;
307
- blocked: number;
308
- unresolved: number;
309
- failed?: number;
310
- in_progress?: number;
311
- orphan_cards?: number;
312
- topology?: {
313
- edge_count: number;
314
- max_fan_out_card: string | null;
315
- max_fan_out: number;
316
- };
317
- };
318
- cards: BoardStatusCard[];
319
- }
320
- declare const EMPTY_CONFIG: GraphConfig;
321
-
322
- export { type BoardStatusObject as B, type CardAdminStore as C, EMPTY_CONFIG as E, type JournalStorageAdapter as J, type LiveCard as L, type OutputStoreEvent as O, SNAPSHOT_SCHEMA_VERSION_V1 as S, BOARD_GRAPH_KEY as a, createCardStore as c };
@@ -1,36 +0,0 @@
1
- import { B as BoardPlatformAdapter, N as NotificationTransport, C as ChatStorage } from '../types-H3EMBPY2.js';
2
- import { E as ExecutionRef } from '../execution-interface-BCIhu1gO.js';
3
- import '../board-live-cards-lib-COi4bSpk.js';
4
-
5
- declare function createLocalStorageChatStorage(namespace: string): ChatStorage;
6
- interface InMemoryBus {
7
- publish(event: unknown): void;
8
- subscribe(onEvent: (event: unknown) => void): () => void;
9
- }
10
- declare function getInMemoryNotificationBus(channel: string): InMemoryBus;
11
- /**
12
- * In-memory NotificationTransport for the browser.
13
- * Subscribes to the same in-memory bus that the adapter publishes to.
14
- * Use with notifyRef: { kind: 'in-memory-bus', value: '<channel>' }
15
- */
16
- declare function createInMemoryNotificationTransport(): NotificationTransport;
17
-
18
- /**
19
- * Registry of in-browser execution handlers keyed by whatToRun value.
20
- * Consumers register handlers that will be invoked when the drain cycle
21
- * dispatches execution with howToRun === 'in-browser'.
22
- */
23
- type InBrowserHandler = (ref: ExecutionRef, args: Record<string, unknown>) => Promise<{
24
- dispatched: boolean;
25
- error?: string;
26
- }>;
27
- declare function createBrowserBoardPlatformAdapter(namespace: string, opts?: {
28
- callbackBaseUrl?: string;
29
- notifyChannel?: string;
30
- onWarn?: (msg: string) => void;
31
- }): BoardPlatformAdapter & {
32
- registerHandler(name: string, handler: InBrowserHandler): void;
33
- writeMemoryBlob(key: string, data: string): string;
34
- };
35
-
36
- export { type InBrowserHandler, createBrowserBoardPlatformAdapter, createInMemoryNotificationTransport, createLocalStorageChatStorage, getInMemoryNotificationBus };
@@ -1,4 +0,0 @@
1
- var A="b64:";function D(t){let e=new TextEncoder().encode(t),g=globalThis.Buffer,a;if(g)a=g.from(e).toString("base64");else if(typeof btoa=="function"){let s="";for(let l of e)s+=String.fromCharCode(l);a=btoa(s);}else throw new Error("No base64 encoder available in this runtime");return a.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function W(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),g=globalThis.Buffer;if(g)return g.from(e,"base64").toString("utf8");if(typeof atob=="function"){let a=atob(e),s=new Uint8Array(a.length);for(let l=0;l<a.length;l+=1)s[l]=a.charCodeAt(l);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function v(t){return `${A}${D(JSON.stringify(t))}`}function k(t){if(!t.startsWith(A))throw new Error(`Invalid ref format (expected ${A}<base64url(json)>): ${t}`);let e;try{e=JSON.parse(W(t.slice(A.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${t}`)}if(!e||typeof e!="object")throw new Error(`Invalid ref format (expected object payload): ${t}`);let g=e;if(typeof g.kind!="string"||typeof g.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${t}`);return {kind:g.kind,value:g.value}}function E(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function L(t){let e=t.payload??{};return {id:t.id,role:typeof e.role=="string"?e.role:"system",text:typeof e.text=="string"?e.text:"",files:Array.isArray(e.files)?e.files:[],turn:typeof e.turn=="string"?e.turn:"",updated_at:typeof e.updated_at=="string"?e.updated_at:""}}function M(t,e){let g=s=>`chats/${E(s)}/processing`,a=s=>`chats/${E(s)}/config`;return {append(s,l,r,o=[],i=""){return t(s).append({role:l,text:r,files:o,turn:i,updated_at:new Date().toISOString()}).id},readAll(s){return t(s).readAll().map(L)},readAfter(s,l){let r=t(s).readAfter(l);return {records:r.entries.map(L),cursor:r.newCursor}},clear(s){t(s).clear?.();},setProcessing(s,l){l?e.write(g(s),true):e.delete(g(s));},isProcessing(s){return e.read(g(s))===true},getConfig(s){return e.read(a(s))??{}},setConfig(s,l){let r=e.read(a(s))??{};e.write(a(s),{...r,...l});}}}function $(t){if(t==null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return `[${t.map($).join(",")}]`;let e=t;return `{${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${$(e[a])}`).join(",")}}`}function I(t,e){let g=e>>>0;for(let a=0;a<t.length;a++)g^=t.charCodeAt(a),g=Math.imul(g,16777619)>>>0;return g}function O(t){let e=$(t),g=I(e,2166136261),a=I(e,3735928559),s=I(e,19088743),l=I(e,4277009102);return [g,a,s,l].map(r=>r.toString(16).padStart(8,"0")).join("")}function R(t){function e(l){return `${t}:blob:${l}`}let g=new TextEncoder;function a(l){if(typeof btoa=="function"){let r="";for(let o=0;o<l.length;o++)r+=String.fromCharCode(l[o]);return btoa(r)}return ""}function s(l){if(typeof atob=="function"){let r=atob(l),o=new Uint8Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o}return new Uint8Array}return {read(l){return globalThis.localStorage.getItem(e(l))},write(l,r){globalThis.localStorage.setItem(e(l),r);},exists(l){return globalThis.localStorage.getItem(e(l))!==null},remove(l){globalThis.localStorage.removeItem(e(l));},readBytes(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;try{let o=JSON.parse(r);if(o&&o.__kind==="bytes-b64"&&typeof o.data=="string")return s(o.data)}catch{}return g.encode(r)},writeBytes(l,r){let o=JSON.stringify({__kind:"bytes-b64",data:a(r)});globalThis.localStorage.setItem(e(l),o);},listKeys(l){let r=e(l??""),o=[];for(let i=0;i<globalThis.localStorage.length;i++){let u=globalThis.localStorage.key(i);u&&u.startsWith(r)&&o.push(u.slice(e("").length));}return o.sort()},stat(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;let o=g.encode(r).byteLength;try{let i=JSON.parse(r);i&&i.__kind==="bytes-b64"&&typeof i.data=="string"&&(o=s(i.data).byteLength);}catch{}return {key:l,size:o}}}}var V=":scratch-marker",H=":scratch-config",T=":scratch:",z=1440*60*1e3,X=720*60*1e3,q=200;function N(t,e){if(!t)return e;let g=t.replace(/[^A-Za-z0-9._-]/g,"_");return g.length>0?g:e}function B(t){let e=`${t}${V}`,g=`${t}${H}`,a=n=>`${t}${T}${n}`,s=n=>`${t}${T}${n}:__ts`,l=globalThis.localStorage.getItem(e)===null;if(l)try{globalThis.localStorage.setItem(e,`scratch-store
2
- ${new Date().toISOString()}`);}catch{}function r(){let n=globalThis.localStorage.getItem(g);if(n===null)return {};try{let c=JSON.parse(n);return c&&typeof c=="object"&&!Array.isArray(c)?c:{}}catch{return {}}}function o(n){try{globalThis.localStorage.setItem(g,JSON.stringify(n));}catch{}}if(l){let n=r();typeof n["retention.lastSweepAt"]!="number"&&(n["retention.lastSweepAt"]=Date.now(),o(n));}function i(){if(globalThis.localStorage.getItem(e)===null)return;let n=r(),c=typeof n["retention.maxAgeMs"]=="number"?n["retention.maxAgeMs"]:z,f=typeof n["retention.sweepIntervalMs"]=="number"?n["retention.sweepIntervalMs"]:X;if(c<=0||f<=0)return;let h=typeof n["retention.lastSweepAt"]=="number"?n["retention.lastSweepAt"]:0,y=Date.now();if(y-h<f)return;n["retention.lastSweepAt"]=y,o(n);let p=y,S=`${t}${T}`,b=[];for(let m=0;m<globalThis.localStorage.length;m++){let w=globalThis.localStorage.key(m);w&&w.startsWith(S)&&!w.endsWith(":__ts")&&b.push(w);}for(let m of b){if(Date.now()-p>q)break;let w=globalThis.localStorage.getItem(`${m}:__ts`),C=w===null?0:Number(w);if(Number.isFinite(C)&&C>0&&y-C>c){try{globalThis.localStorage.removeItem(m);}catch{}try{globalThis.localStorage.removeItem(`${m}:__ts`);}catch{}}}}function u(n,c){let f=N(n,"scratch"),h=N(c,".json"),y=h.startsWith(".")?h:`.${h}`,p=Math.random().toString(36).slice(2,10);return `${f}-${Date.now()}-${p}${y}`}function d(n,c){globalThis.localStorage.setItem(a(n),c),globalThis.localStorage.setItem(s(n),String(Date.now()));}return {read(n){return globalThis.localStorage.getItem(a(n))},write(n,c){d(n,c);try{i();}catch{}},exists(n){return globalThis.localStorage.getItem(a(n))!==null},remove(n){try{globalThis.localStorage.removeItem(a(n));}catch{}try{globalThis.localStorage.removeItem(s(n));}catch{}},readBytes(n){let c=globalThis.localStorage.getItem(a(n));return c===null?null:new TextEncoder().encode(c)},writeBytes(n,c){let f="";for(let h=0;h<c.length;h++)f+=String.fromCharCode(c[h]);d(n,f);try{i();}catch{}},stat(n){let c=globalThis.localStorage.getItem(a(n));if(c===null)return null;let f=globalThis.localStorage.getItem(s(n)),h=f===null?null:Number(f);return {key:n,size:new TextEncoder().encode(c).byteLength,updatedAt:h!==null&&Number.isFinite(h)?new Date(h).toISOString():void 0}},listKeys(n){let c=`${t}${T}`,f=[];for(let h=0;h<globalThis.localStorage.length;h++){let y=globalThis.localStorage.key(h);if(y&&y.startsWith(c)&&!y.endsWith(":__ts")){let p=y.slice(c.length);(!n||p.startsWith(n))&&f.push(p);}}return f.sort()},getUniqueKey(n,c){return u(n,c)},create(n,c,f){let h=u(c,f);d(h,n);try{i();}catch{}return h},keyRef(n){return {kind:"local-storage-scratch",value:n,extra:{prefix:t}}},config:{get(n){return r()[n]??null},set(n,c){let f=r();c==null?delete f[n]:f[n]=c,o(f);}}}}var G=":archive-marker",Z=":archive-config",_=":archive:stream:",K=":archive:blob:";function U(t){let e=t.replace(/[^A-Za-z0-9._-]/g,"_");if(!e)throw new Error("Archive segment name cannot be empty after sanitization");return e}function J(t){let e=`${t}${G}`,g=`${t}${Z}`,a=o=>`${t}${_}${o}`;if(globalThis.localStorage.getItem(e)===null)try{globalThis.localStorage.setItem(e,`archive-store
3
- ${new Date().toISOString()}`);}catch{}function s(){let o=globalThis.localStorage.getItem(g);if(o===null)return {};try{let i=JSON.parse(o);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return {}}}function l(o){try{globalThis.localStorage.setItem(g,JSON.stringify(o));}catch{}}function r(){if(globalThis.localStorage.getItem(e)===null)return;let o=s(),i=typeof o["retention.maxAgeMs"]=="number"?o["retention.maxAgeMs"]:0,u=typeof o["retention.sweepIntervalMs"]=="number"?o["retention.sweepIntervalMs"]:0;if(i<=0||u<=0)return;let d=typeof o["retention.lastSweepAt"]=="number"?o["retention.lastSweepAt"]:0,n=Date.now();if(n-d<u)return;o["retention.lastSweepAt"]=n,l(o);let c=`${t}${_}`;for(let f=0;f<globalThis.localStorage.length;f++){let h=globalThis.localStorage.key(f);if(!h||!h.startsWith(c))continue;let y=globalThis.localStorage.getItem(h);if(y)try{let p=JSON.parse(y),S=p.filter(b=>typeof b.__ts!="number"||n-b.__ts<=i);S.length!==p.length&&globalThis.localStorage.setItem(h,JSON.stringify(S));}catch{}}}return {stream(o){let i=U(o),u=a(i);function d(){let c=globalThis.localStorage.getItem(u);if(!c)return [];try{return JSON.parse(c)}catch{return []}}function n(c){try{globalThis.localStorage.setItem(u,JSON.stringify(c));}catch{}}return {append(c){let f={id:globalThis.crypto.randomUUID(),payload:c,__ts:Date.now()},h=d();h.push(f),n(h);try{r();}catch{}return {id:f.id,payload:f.payload}},readAll(){return d().map(c=>({id:c.id,payload:c.payload}))},readAfter(c){let f=d();if(!c){let S=f.map(b=>({id:b.id,payload:b.payload}));return {entries:S,newCursor:S.length>0?S[S.length-1].id:null}}let h=f.findIndex(S=>S.id===c),p=(h===-1?f:f.slice(h+1)).map(S=>({id:S.id,payload:S.payload}));return {entries:p,newCursor:p.length>0?p[p.length-1].id:c}},clear(){try{globalThis.localStorage.removeItem(u);}catch{}}}},blob(o){let i=U(o),u=R(`${t}${K}${i}`);return {read:d=>u.read(d),write:(d,n)=>{u.write(d,n);try{r();}catch{}},exists:d=>u.exists(d),remove:d=>u.remove(d),readBytes:u.readBytes?d=>u.readBytes(d):void 0,writeBytes:u.writeBytes?(d,n)=>{u.writeBytes(d,n);try{r();}catch{}}:void 0,listKeys:d=>u.listKeys(d),stat:u.stat?d=>u.stat(d):void 0}},listStreams(o){let i=`${t}${_}`,u=[];for(let d=0;d<globalThis.localStorage.length;d++){let n=globalThis.localStorage.key(d);if(!n||!n.startsWith(i))continue;let c=n.slice(i.length);(!o||c.startsWith(o))&&u.push(c);}return u.sort()},listBlobs(o){let i=`${t}${K}`,u=new Set;for(let d=0;d<globalThis.localStorage.length;d++){let n=globalThis.localStorage.key(d);if(!n||!n.startsWith(i))continue;let c=n.slice(i.length),f=c.indexOf(":"),h=f===-1?c:c.slice(0,f);(!o||h.startsWith(o))&&u.add(h);}return Array.from(u).sort()},config:{get(o){return s()[o]??null},set(o,i){let u=s();i==null?delete u[o]:u[o]=i,l(u);}}}}function x(t){function e(g){return `${t}:kv:${g}`}return {read(g){let a=globalThis.localStorage.getItem(e(g));if(a===null)return null;try{return JSON.parse(a)}catch{return null}},write(g,a){globalThis.localStorage.setItem(e(g),JSON.stringify(a));},delete(g){globalThis.localStorage.removeItem(e(g));},listKeys(g){let a=e(g??""),s=[];for(let l=0;l<globalThis.localStorage.length;l++){let r=globalThis.localStorage.key(l);r!==null&&r.startsWith(a)&&s.push(r.slice(e("").length));}return s}}}function j(t){function e(){let a=globalThis.localStorage.getItem(t);if(!a)return [];try{return JSON.parse(a)}catch{return []}}function g(a){globalThis.localStorage.setItem(t,JSON.stringify(a));}return {readAllEntries(){return e()},appendEntry(a){let s=e();s.push(a),g(s);},generateId(){return globalThis.crypto.randomUUID()}}}function Y(){let t=false;return {tryAcquire(){return t?null:(t=true,()=>{t=false;})}}}function Q(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function tt(t){function e(){let a=globalThis.localStorage.getItem(t);if(!a)return [];try{return JSON.parse(a)}catch{return []}}function g(a){globalThis.localStorage.setItem(t,JSON.stringify(a));}return {append(a){let s={id:globalThis.crypto.randomUUID(),payload:a},l=e();return l.push(s),g(l),s},readAll(){return e()},readAfter(a){let s=e();if(!a)return {entries:s,newCursor:s.length>0?s[s.length-1].id:null};let l=s.findIndex(o=>o.id===a),r=l===-1?s:s.slice(l+1);return {entries:r,newCursor:r.length>0?r[r.length-1].id:a}},clear(){globalThis.localStorage.removeItem(t);}}}function it(t){return M(e=>tt(`${t}:chat:journal:${Q(e)}`),x(`${t}:chat`))}var P=new Map;function F(t){let e=P.get(t);if(!e){let g=new Set;e={publish(a){for(let s of g)s(a);},subscribe(a){return g.add(a),()=>{g.delete(a);}}},P.set(t,e);}return e}function lt(){return {async subscribe(t,e){return t.kind!=="in-memory-bus"?(console.warn(`[in-memory-transport] unsupported kind: ${t.kind}`),()=>{}):F(t.value).subscribe(a=>{let s=a;if(s&&s.kind==="notification-batch"&&Array.isArray(s.notifications)){for(let l of s.notifications)e(l);return}e(a);})}}}function ct(t,e){let g=e?.callbackBaseUrl?{meta:"board-live-cards",howToRun:"http:post",whatToRun:e.callbackBaseUrl}:{meta:"board-live-cards",howToRun:"in-browser",whatToRun:v({kind:"in-browser",value:t})},a=new Map,s=new Map,l=Y();return {kvStorage:r=>x(`${t}:${r}`),blobStorage:r=>R(r?`${t}:${r}`:t),scratchStorage:()=>B(`${t}:scratch`),scratchStorageForRef:r=>B(k(r).value),archiveFactory:()=>J(`${t}:archive`),archiveFactoryForRef:r=>J(k(r).value),journalAdapter:()=>j(`${t}:journal`),lock:l,selfRef:g,async dispatchExecution(r,o){if(r.howToRun==="http:post")try{let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});return d.ok?{dispatched:!0}:{dispatched:!1,error:`HTTP ${d.status}: ${d.statusText}`}}catch(i){return {dispatched:false,error:i instanceof Error?i.message:String(i)}}if(r.howToRun==="http:get")try{let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=new URLSearchParams(Object.entries(o).filter(([,f])=>f!=null).map(([f,h])=>[f,String(h)])),n=`${u}?${d.toString()}`,c=await fetch(n);return c.ok?{dispatched:!0}:{dispatched:!1,error:`HTTP ${c.status}: ${c.statusText}`}}catch(i){return {dispatched:false,error:i instanceof Error?i.message:String(i)}}if(r.howToRun==="in-browser"){let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=a.get(u);return d?d(r,o):{dispatched:false,error:`No in-browser handler registered for: ${u}`}}return {dispatched:false,error:`Browser adapter: unsupported dispatch kind (got: ${r.howToRun})`}},resolveBlob(r){if(r.kind==="in-memory"){let u=s.get(r.value);if(u==null)throw new Error(`resolveBlob: in-memory blob not found: ${v(r)}`);return u}let i=R(t).read(r.value);if(i===null)throw new Error(`resolveBlob: blob not found: ${v(r)}`);return i},hashFn:O,genId:()=>globalThis.crypto.randomUUID().replace(/-/g,""),kvStorageForRef:r=>x(k(r).value),publishBoardChangeNotifications(r){if(!e?.notifyChannel||r.length===0)return;F(e.notifyChannel).publish({kind:"notification-batch",notifications:r});},onWarn:e?.onWarn,registerHandler(r,o){a.set(r,o);},writeMemoryBlob(r,o){return s.set(r,o),v({kind:"in-memory",value:r})}}}export{ct as createBrowserBoardPlatformAdapter,lt as createInMemoryNotificationTransport,it as createLocalStorageChatStorage,F as getInMemoryNotificationBus};//# sourceMappingURL=board-live-cards-browser-adapter.js.map
4
- //# sourceMappingURL=board-live-cards-browser-adapter.js.map
@@ -1,25 +0,0 @@
1
- import { L as LiveCard } from '../board-live-cards-lib-COi4bSpk.js';
2
-
3
- /**
4
- * card-store-browser-api.ts
5
- *
6
- * Simple browser-facing card store API.
7
- * Wraps createCardStore() + createLocalStorageCardStorageAdapter()
8
- * into a minimal read/write interface suitable for browser consumption.
9
- */
10
-
11
- interface BrowserCardStoreApi {
12
- getCard(id: string): LiveCard | null;
13
- getAllCards(): LiveCard[];
14
- upsertCard(card: LiveCard): void;
15
- removeCard(id: string): void;
16
- }
17
- /**
18
- * Create a browser card store backed by localStorage.
19
- *
20
- * @param namespace - localStorage key prefix (e.g. 'my-board:cards').
21
- * Multiple stores can coexist by using distinct namespaces.
22
- */
23
- declare function createBrowserCardStoreApi(namespace: string): BrowserCardStoreApi;
24
-
25
- export { type BrowserCardStoreApi, LiveCard, createBrowserCardStoreApi };
@@ -1,2 +0,0 @@
1
- import {createRequire}from'module';import'ajv-formats';var R=createRequire(import.meta.url);R("./jsonata-sync.cjs");var x=createRequire(import.meta.url);x("./jsonata-sync.cjs");function y(n,o){function e(){return n.readIndex()??{}}function r(t,s,i){let a=String(s||"").split(".").filter(Boolean);if(a.length===0)return i&&typeof i=="object"&&!Array.isArray(i)?i:{value:i};let u={...t},c=u;for(let d=0;d<a.length-1;d++){let l=a[d],g=c[l],m=g&&typeof g=="object"&&!Array.isArray(g)?{...g}:{};c[l]=m,c=m;}return c[a[a.length-1]]=i,u}return {readCard(t){let s=e()[t];return !s||!n.cardExists(s.key)?null:n.readCard(s.key)},readCardKey(t){return e()[t]?.key??null},readAllCards(){let t=[];for(let[s,i]of Object.entries(e())){if(!n.cardExists(i.key))continue;let a=n.readCard(i.key);a?t.push(a):o?.(`[card-store] could not read card "${s}" at key "${i.key}"`);}return t},readChecksumIndex(){let t={};for(let[s,i]of Object.entries(e()))t[s]=i.checksum;return t},changedSince(t){let s=e(),i=[];for(let[a,u]of Object.entries(s))t[a]!==u.checksum&&i.push(a);for(let a of Object.keys(t))s[a]||i.push(a);return i},validateUpsert(t,s){let i=e(),a=i[t],u=Object.entries(i).find(([,c])=>c.key===s);return a&&a.key!==s?{ok:false,error:`Card id "${t}" is already mapped to key "${a.key}", cannot remap to "${s}"`}:u&&u[0]!==t?{ok:false,error:`Key "${s}" is already mapped to card id "${u[0]}", cannot remap to "${t}"`}:{ok:true}},writeCard(t,s,i){let a=e(),u=i??a[t]?.key??n.defaultCardKey(t),c=n.writeCard(u,s);a[t]={key:u,checksum:c,updatedAt:new Date().toISOString()},n.writeIndex(a);},patchCard(t,s,i){let a=e(),u=a[t];if(!u||!n.cardExists(u.key))throw new Error(`card "${t}" not found`);let c=n.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${t}" is not patchable`);let d=r(c,s,i),l=n.writeCard(u.key,d);a[t]={key:u.key,checksum:l,updatedAt:new Date().toISOString()},n.writeIndex(a);},removeCard(t){let s=e(),i=s[t];i&&(n.removeCard(i.key),delete s[t],n.writeIndex(s));},readIndex(){return e()}}}function p(n){if(n==null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(p).join(",")}]`;let o=n;return `{${Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${p(o[r])}`).join(",")}}`}function f(n,o){let e=o>>>0;for(let r=0;r<n.length;r++)e^=n.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e}function _(n){let o=p(n),e=f(o,2166136261),r=f(o,3735928559),t=f(o,19088743),s=f(o,4277009102);return [e,r,t,s].map(i=>i.toString(16).padStart(8,"0")).join("")}function A(n){function o(e){return `${n}:kv:${e}`}return {read(e){let r=globalThis.localStorage.getItem(o(e));if(r===null)return null;try{return JSON.parse(r)}catch{return null}},write(e,r){globalThis.localStorage.setItem(o(e),JSON.stringify(r));},delete(e){globalThis.localStorage.removeItem(o(e));},listKeys(e){let r=o(e??""),t=[];for(let s=0;s<globalThis.localStorage.length;s++){let i=globalThis.localStorage.key(s);i!==null&&i.startsWith(r)&&t.push(i.slice(o("").length));}return t}}}function h(n,o){let e={...n};for(let[r,t]of Object.entries(o))t!==null&&typeof t=="object"&&!Array.isArray(t)&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])?e[r]=h(e[r],t):e[r]=t;return e}function S(n,o,e){if(o.length===0)return n;let[r,...t]=o;if(t.length===0)return {...n,[r]:e};let s=n[r]!==null&&typeof n[r]=="object"&&!Array.isArray(n[r])?n[r]:{};return {...n,[r]:S(s,t,e)}}function T(n){let o=A(n);return {read:e=>o.read(e),get(e,r){let t=o.read(e);if(t===null)return null;let s=t;for(let i of r.split(".").filter(Boolean)){if(s===null||typeof s!="object"||Array.isArray(s))return null;s=s[i]??null;}return s??null},write:(e,r)=>o.write(e,r),delete:e=>o.delete(e),listKeys:e=>o.listKeys(e),shallowMerge(e,r){let t=o.read(e)??{};o.write(e,{...t,...r});},deepMerge(e,r){let t=o.read(e)??{};o.write(e,h(t,r));},patch(e,r,t){let s=o.read(e)??{},i=r.split(".").filter(Boolean);o.write(e,S(s,i,t));}}}function k(n){let o=T(n);return {readIndex(){return o.read("_index")},writeIndex(e){o.write("_index",e);},readCard(e){return o.read(e)},writeCard(e,r){return o.write(e,r),_(r)},removeCard(e){o.delete(e);},cardExists(e){return o.read(e)!==null},defaultCardKey(e){return e}}}function ke(n){let o=k(n),e=y(o);return {getCard(r){return e.readCard(r)},getAllCards(){return e.readAllCards()},upsertCard(r){let t=o.defaultCardKey(r.id);e.writeCard(r.id,r,t);},removeCard(r){e.removeCard(r);}}}export{ke as createBrowserCardStoreApi};//# sourceMappingURL=card-store-browser-api.js.map
2
- //# sourceMappingURL=card-store-browser-api.js.map