yaml-flow 8.8.7 → 8.9.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 (155) hide show
  1. package/browser/adapters/firestore-storage.js +2 -2
  2. package/browser/adapters/localstorage-storage.js +3 -3
  3. package/browser/asset-integrity.json +7 -7
  4. package/browser/server-runtime-controlface.js +5 -5
  5. package/examples/board/test/server-http-test-browser.ts +2410 -0
  6. package/examples/board/test/server-http-test.js +66 -41
  7. package/lib/{artifacts-store-lib-C6qBpMfU.d.cts → artifacts-store-lib-CqkJEgbx.d.cts} +1 -1
  8. package/lib/{artifacts-store-lib-D4qf7Q-7.d.ts → artifacts-store-lib-D6Bo4yFN.d.ts} +1 -1
  9. package/lib/artifacts-store-public.d.cts +5 -3
  10. package/lib/artifacts-store-public.d.ts +5 -3
  11. package/lib/board-callback-transport-Bekq8Gp-.d.ts +71 -0
  12. package/lib/board-callback-transport-kP0K6UMq.d.cts +71 -0
  13. package/lib/board-live-cards-lib-DVh3t9NT.d.cts +222 -0
  14. package/lib/board-live-cards-lib-iU8xOwNp.d.ts +222 -0
  15. package/lib/board-live-cards-mcp.cjs +1 -1
  16. package/lib/board-live-cards-mcp.d.cts +10 -8
  17. package/lib/board-live-cards-mcp.d.ts +10 -8
  18. package/lib/board-live-cards-mcp.js +1 -1
  19. package/lib/board-live-cards-node.cjs +7 -7
  20. package/lib/board-live-cards-node.d.cts +15 -11
  21. package/lib/board-live-cards-node.d.ts +15 -11
  22. package/lib/board-live-cards-node.js +7 -7
  23. package/lib/{board-live-cards-public-async-CYjr4mgX.d.cts → board-live-cards-public-async-Cl0M3j5P.d.cts} +6 -4
  24. package/lib/{board-live-cards-public-async-DlyC3PgC.d.ts → board-live-cards-public-async-U98IXUBx.d.ts} +6 -4
  25. package/lib/board-live-cards-public.cjs +1 -1
  26. package/lib/board-live-cards-public.d.cts +325 -3
  27. package/lib/board-live-cards-public.d.ts +325 -3
  28. package/lib/board-live-cards-public.js +1 -1
  29. package/lib/board-live-cards-server-runtime.cjs +1 -1
  30. package/lib/board-live-cards-server-runtime.d.cts +8 -6
  31. package/lib/board-live-cards-server-runtime.d.ts +8 -6
  32. package/lib/board-live-cards-server-runtime.js +1 -1
  33. package/lib/{board-platform-adapter-async-JP9V-U5E.d.ts → board-platform-adapter-async-ByBRFn1G.d.ts} +4 -3
  34. package/lib/{board-platform-adapter-async-BZIftm36.d.cts → board-platform-adapter-async-DjBwE0m9.d.cts} +4 -3
  35. package/lib/board-state-reducer.cjs +2 -0
  36. package/lib/board-state-reducer.d.cts +53 -0
  37. package/lib/board-state-reducer.d.ts +53 -0
  38. package/lib/board-state-reducer.js +2 -0
  39. package/lib/card-store-public.cjs +1 -1
  40. package/lib/card-store-public.d.cts +11 -4
  41. package/lib/card-store-public.d.ts +11 -4
  42. package/lib/card-store-public.js +1 -1
  43. package/lib/chat-store-public.cjs +1 -1
  44. package/lib/chat-store-public.d.cts +15 -4
  45. package/lib/chat-store-public.d.ts +15 -4
  46. package/lib/chat-store-public.js +1 -1
  47. package/lib/chunk-2RIHC5TZ.cjs +2 -0
  48. package/lib/chunk-32GZ4ODA.js +3 -0
  49. package/lib/chunk-5XLFPPTY.cjs +2 -0
  50. package/lib/{chunk-R44X3RQB.cjs → chunk-6EJRZHFP.cjs} +2 -2
  51. package/lib/{chunk-NNSBBO5R.js → chunk-6MD6FVE3.js} +2 -2
  52. package/lib/chunk-7KSENEPK.js +2 -0
  53. package/lib/chunk-7QNEV5S3.js +2 -0
  54. package/lib/{chunk-6OPXQPSC.js → chunk-7UJQMFVS.js} +2 -2
  55. package/lib/chunk-BJGK5FNL.js +2 -0
  56. package/lib/{chunk-ETW3BXHD.cjs → chunk-BQJVCCFU.cjs} +2 -2
  57. package/lib/chunk-HDGEWOC2.cjs +2 -0
  58. package/lib/chunk-INRLKWC2.cjs +3 -0
  59. package/lib/chunk-JB4Q2W7I.js +7 -0
  60. package/lib/chunk-LFVMX23W.cjs +7 -0
  61. package/lib/chunk-NIBLKYXN.js +2 -0
  62. package/lib/chunk-OF4FPYNI.cjs +2 -0
  63. package/lib/chunk-ORBKEBNX.cjs +2 -0
  64. package/lib/{chunk-7BTZCOT5.js → chunk-QLB6PKOT.js} +2 -2
  65. package/lib/chunk-RP2I3OLA.cjs +3 -0
  66. package/lib/chunk-SDJ3747Q.cjs +2 -0
  67. package/lib/chunk-TMS7KDKH.js +3 -0
  68. package/lib/chunk-UGB7PC4P.js +2 -0
  69. package/lib/chunk-UIUCNV3X.cjs +3 -0
  70. package/lib/chunk-VS4E7QFN.js +3 -0
  71. package/lib/{chunk-37HDEW26.cjs → chunk-WRMOGPRG.cjs} +2 -2
  72. package/lib/chunk-XLHMUPBW.js +2 -0
  73. package/lib/cloud-storage.cjs +1 -1
  74. package/lib/cloud-storage.d.cts +44 -8
  75. package/lib/cloud-storage.d.ts +44 -8
  76. package/lib/cloud-storage.js +1 -1
  77. package/lib/firebase-storage/index.d.cts +2 -2
  78. package/lib/firebase-storage/index.d.ts +2 -2
  79. package/lib/firestore-storage/index.cjs +2 -2
  80. package/lib/firestore-storage/index.d.cts +6 -5
  81. package/lib/firestore-storage/index.d.ts +6 -5
  82. package/lib/firestore-storage/index.js +2 -2
  83. package/lib/index.cjs +2 -2
  84. package/lib/index.d.cts +1 -1
  85. package/lib/index.d.ts +1 -1
  86. package/lib/index.js +1 -1
  87. package/lib/localstorage-storage/index.cjs +1 -1
  88. package/lib/localstorage-storage/index.d.cts +6 -5
  89. package/lib/localstorage-storage/index.d.ts +6 -5
  90. package/lib/localstorage-storage/index.js +1 -1
  91. package/lib/notification-consumer/index.cjs +2 -0
  92. package/lib/notification-consumer/index.d.cts +17 -0
  93. package/lib/notification-consumer/index.d.ts +17 -0
  94. package/lib/notification-consumer/index.js +2 -0
  95. package/lib/queue-storage-public.cjs +2 -0
  96. package/lib/queue-storage-public.d.cts +13 -0
  97. package/lib/queue-storage-public.d.ts +13 -0
  98. package/lib/queue-storage-public.js +2 -0
  99. package/lib/server-jobs-queue-runner/index.cjs +1 -1
  100. package/lib/server-jobs-queue-runner/index.d.cts +9 -7
  101. package/lib/server-jobs-queue-runner/index.d.ts +9 -7
  102. package/lib/server-jobs-queue-runner/index.js +1 -1
  103. package/lib/server-runtime/index.cjs +1 -1
  104. package/lib/server-runtime/index.d.cts +9 -7
  105. package/lib/server-runtime/index.d.ts +9 -7
  106. package/lib/server-runtime/index.js +1 -1
  107. package/lib/server-runtime-agentface/index.d.cts +8 -6
  108. package/lib/server-runtime-agentface/index.d.ts +8 -6
  109. package/lib/server-runtime-controlface/index.cjs +1 -1
  110. package/lib/server-runtime-controlface/index.d.cts +8 -6
  111. package/lib/server-runtime-controlface/index.d.ts +8 -6
  112. package/lib/server-runtime-controlface/index.js +1 -1
  113. package/lib/server-runtime-core/index.cjs +1 -1
  114. package/lib/server-runtime-core/index.d.cts +16 -37
  115. package/lib/server-runtime-core/index.d.ts +16 -37
  116. package/lib/server-runtime-core/index.js +1 -1
  117. package/lib/server-runtime-watchers/index.cjs +1 -1
  118. package/lib/server-runtime-watchers/index.d.cts +11 -8
  119. package/lib/server-runtime-watchers/index.d.ts +11 -8
  120. package/lib/server-runtime-watchers/index.js +1 -1
  121. package/lib/server-runtime-webhooks/index.d.cts +8 -6
  122. package/lib/server-runtime-webhooks/index.d.ts +8 -6
  123. package/lib/{sse-hub-DM8bw-dO.d.ts → sse-hub-BRBvymHR.d.cts} +18 -15
  124. package/lib/{sse-hub-BDjWI7JR.d.cts → sse-hub-D_94fV87.d.ts} +18 -15
  125. package/lib/step-machine-public/index.d.cts +1 -1
  126. package/lib/step-machine-public/index.d.ts +1 -1
  127. package/lib/{storage-async-interface-CyO-zwVQ.d.cts → storage-async-interface-CLOXiqwC.d.cts} +2 -2
  128. package/lib/{storage-async-interface-CG0bMqvE.d.ts → storage-async-interface-Cb-SULrI.d.ts} +2 -2
  129. package/lib/{storage-interface-D-iEiTJA.d.cts → storage-interface-DogVPooM.d.cts} +1 -1
  130. package/lib/{storage-interface-D-iEiTJA.d.ts → storage-interface-DogVPooM.d.ts} +1 -1
  131. package/lib/stores/index.d.cts +1 -1
  132. package/lib/stores/index.d.ts +1 -1
  133. package/lib/stores/kv.d.cts +1 -1
  134. package/lib/stores/kv.d.ts +1 -1
  135. package/lib/{types-BsfXZyI3.d.ts → types-BsqzUZNl.d.ts} +6 -4
  136. package/lib/{types-CPnYv7RC.d.cts → types-DxhB6Toz.d.cts} +6 -4
  137. package/package.json +16 -1
  138. package/lib/board-live-cards-public-BT5HrgqZ.d.cts +0 -529
  139. package/lib/board-live-cards-public-DSRamFm8.d.ts +0 -529
  140. package/lib/chunk-35N7ONTH.js +0 -2
  141. package/lib/chunk-36QUKFL7.cjs +0 -3
  142. package/lib/chunk-3MMTBEAO.js +0 -2
  143. package/lib/chunk-7QQFDYBM.js +0 -3
  144. package/lib/chunk-7QZ267XP.cjs +0 -2
  145. package/lib/chunk-ABAVFLDP.js +0 -7
  146. package/lib/chunk-EPCJYP4N.js +0 -3
  147. package/lib/chunk-H22NK6KH.cjs +0 -7
  148. package/lib/chunk-KBELAKIY.js +0 -2
  149. package/lib/chunk-OJ2CAQ4C.cjs +0 -2
  150. package/lib/chunk-Q3OTUDIE.js +0 -2
  151. package/lib/chunk-QG6ERLZQ.cjs +0 -3
  152. package/lib/chunk-UB54HZA4.cjs +0 -2
  153. package/lib/chunk-YMEIPKLW.cjs +0 -2
  154. package/lib/chunk-ZENTBLLA.cjs +0 -3
  155. package/lib/chunk-ZWVT24YW.js +0 -3
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkQG6ERLZQ_cjs=require('./chunk-QG6ERLZQ.cjs');require('./chunk-OJ2CAQ4C.cjs'),require('./chunk-7FGPOGRV.cjs'),require('./chunk-LPXVVMQT.cjs'),require('./chunk-H22NK6KH.cjs'),require('./chunk-NM6O35RY.cjs'),require('./chunk-272IYUKT.cjs');var chunkETW3BXHD_cjs=require('./chunk-ETW3BXHD.cjs');require('./chunk-BQUQTOPB.cjs'),require('./chunk-NBJTYAYN.cjs'),require('./chunk-GPCMBPLK.cjs'),require('./chunk-36QUKFL7.cjs'),require('./chunk-37HDEW26.cjs'),require('./chunk-ZENTBLLA.cjs'),require('./chunk-7JVHYHT2.cjs'),require('./chunk-VQCIOKJV.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-7QZ267XP.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-HWYMZK3N.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-UB54HZA4.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createMultiBoardServerRuntime",{enumerable:true,get:function(){return chunkQG6ERLZQ_cjs.b}});Object.defineProperty(exports,"createSingleBoardServerRuntime",{enumerable:true,get:function(){return chunkQG6ERLZQ_cjs.a}});Object.defineProperty(exports,"createHostedBoardQueueLaneRegistry",{enumerable:true,get:function(){return chunkETW3BXHD_cjs.a}});//# sourceMappingURL=board-live-cards-server-runtime.cjs.map
1
+ 'use strict';var chunkINRLKWC2_cjs=require('./chunk-INRLKWC2.cjs');require('./chunk-LFVMX23W.cjs'),require('./chunk-NM6O35RY.cjs'),require('./chunk-NBJTYAYN.cjs'),require('./chunk-HDGEWOC2.cjs');var chunkBQJVCCFU_cjs=require('./chunk-BQJVCCFU.cjs');require('./chunk-BQUQTOPB.cjs'),require('./chunk-GPCMBPLK.cjs'),require('./chunk-7FGPOGRV.cjs'),require('./chunk-LPXVVMQT.cjs'),require('./chunk-272IYUKT.cjs'),require('./chunk-UIUCNV3X.cjs'),require('./chunk-WRMOGPRG.cjs'),require('./chunk-RP2I3OLA.cjs'),require('./chunk-7JVHYHT2.cjs'),require('./chunk-VQCIOKJV.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-ORBKEBNX.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-HWYMZK3N.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-5XLFPPTY.cjs'),require('./chunk-SDJ3747Q.cjs'),require('./chunk-OF4FPYNI.cjs'),require('./chunk-2RIHC5TZ.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createMultiBoardServerRuntime",{enumerable:true,get:function(){return chunkINRLKWC2_cjs.b}});Object.defineProperty(exports,"createSingleBoardServerRuntime",{enumerable:true,get:function(){return chunkINRLKWC2_cjs.a}});Object.defineProperty(exports,"createHostedBoardQueueLaneRegistry",{enumerable:true,get:function(){return chunkBQJVCCFU_cjs.a}});//# sourceMappingURL=board-live-cards-server-runtime.cjs.map
2
2
  //# sourceMappingURL=board-live-cards-server-runtime.cjs.map
@@ -1,11 +1,13 @@
1
- export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, f as BoardWorkerRequest, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, R as RuntimeLogger, g as RuntimeRequest, h as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-CPnYv7RC.cjs';
1
+ export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, f as BoardWorkerRequest, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, R as RuntimeLogger, g as RuntimeRequest, h as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-DxhB6Toz.cjs';
2
2
  export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from './server-jobs-queue-runner/index.cjs';
3
- export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-CYjr4mgX.cjs';
4
- export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-BZIftm36.cjs';
5
- export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-D-iEiTJA.cjs';
6
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as ChatStorage, C as CommandInput, a as CommandResult } from './board-live-cards-public-BT5HrgqZ.cjs';
3
+ export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-Cl0M3j5P.cjs';
4
+ export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-DjBwE0m9.cjs';
5
+ export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-DogVPooM.cjs';
6
+ export { B as BoardChangeNotification } from './board-live-cards-lib-DVh3t9NT.cjs';
7
+ export { BoardLiveCardsPublic, BoardNonCorePlatformAdapter, BoardPlatformAdapter, CommandInput, CommandResult } from './board-live-cards-public.cjs';
8
+ export { C as ChatStorage } from './board-callback-transport-kP0K6UMq.cjs';
7
9
  export { ExecutionRef } from './execution-refs.cjs';
8
10
  export { createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.cjs';
9
11
  import './queue-lane-registry-PaZuFpwp.cjs';
10
- import './storage-async-interface-CyO-zwVQ.cjs';
11
12
  import './types-BBhqYGhE.cjs';
13
+ import './storage-async-interface-CLOXiqwC.cjs';
@@ -1,11 +1,13 @@
1
- export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, f as BoardWorkerRequest, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, R as RuntimeLogger, g as RuntimeRequest, h as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-BsfXZyI3.js';
1
+ export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, f as BoardWorkerRequest, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, R as RuntimeLogger, g as RuntimeRequest, h as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-BsqzUZNl.js';
2
2
  export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from './server-jobs-queue-runner/index.js';
3
- export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-DlyC3PgC.js';
4
- export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-JP9V-U5E.js';
5
- export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-D-iEiTJA.js';
6
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as ChatStorage, C as CommandInput, a as CommandResult } from './board-live-cards-public-DSRamFm8.js';
3
+ export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-U98IXUBx.js';
4
+ export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-ByBRFn1G.js';
5
+ export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-DogVPooM.js';
6
+ export { B as BoardChangeNotification } from './board-live-cards-lib-iU8xOwNp.js';
7
+ export { BoardLiveCardsPublic, BoardNonCorePlatformAdapter, BoardPlatformAdapter, CommandInput, CommandResult } from './board-live-cards-public.js';
8
+ export { C as ChatStorage } from './board-callback-transport-Bekq8Gp-.js';
7
9
  export { ExecutionRef } from './execution-refs.js';
8
10
  export { createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.js';
9
11
  import './queue-lane-registry-PaZuFpwp.js';
10
- import './storage-async-interface-CG0bMqvE.js';
11
12
  import './types-BBhqYGhE.js';
13
+ import './storage-async-interface-Cb-SULrI.js';
@@ -1,2 +1,2 @@
1
- export{b as createMultiBoardServerRuntime,a as createSingleBoardServerRuntime}from'./chunk-EPCJYP4N.js';import'./chunk-3MMTBEAO.js';import'./chunk-NTICU4OK.js';import'./chunk-O7NOHKVR.js';import'./chunk-ABAVFLDP.js';import'./chunk-XYN5D3GL.js';import'./chunk-ZJ5M5COT.js';export{a as createHostedBoardQueueLaneRegistry}from'./chunk-6OPXQPSC.js';import'./chunk-FOFGEABN.js';import'./chunk-O5UYCGIN.js';import'./chunk-RKKSVOP2.js';import'./chunk-7QQFDYBM.js';import'./chunk-NNSBBO5R.js';import'./chunk-ZWVT24YW.js';import'./chunk-ANKA7HEJ.js';import'./chunk-44L64VQ2.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-35N7ONTH.js';import'./chunk-JMDHDY6M.js';import'./chunk-3KC6LBOG.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-Q3OTUDIE.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-server-runtime.js.map
1
+ export{b as createMultiBoardServerRuntime,a as createSingleBoardServerRuntime}from'./chunk-32GZ4ODA.js';import'./chunk-JB4Q2W7I.js';import'./chunk-XYN5D3GL.js';import'./chunk-O5UYCGIN.js';import'./chunk-7KSENEPK.js';export{a as createHostedBoardQueueLaneRegistry}from'./chunk-7UJQMFVS.js';import'./chunk-FOFGEABN.js';import'./chunk-RKKSVOP2.js';import'./chunk-NTICU4OK.js';import'./chunk-O7NOHKVR.js';import'./chunk-ZJ5M5COT.js';import'./chunk-TMS7KDKH.js';import'./chunk-6MD6FVE3.js';import'./chunk-VS4E7QFN.js';import'./chunk-ANKA7HEJ.js';import'./chunk-44L64VQ2.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-XLHMUPBW.js';import'./chunk-JMDHDY6M.js';import'./chunk-3KC6LBOG.js';import'./chunk-MNEOJWPS.js';import'./chunk-7QNEV5S3.js';import'./chunk-BJGK5FNL.js';import'./chunk-NIBLKYXN.js';import'./chunk-UGB7PC4P.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-server-runtime.js.map
2
2
  //# sourceMappingURL=board-live-cards-server-runtime.js.map
@@ -1,7 +1,8 @@
1
- import { f as ChatStorage, k as BoardCallbackTransport, B as BoardChangeNotification } from './board-live-cards-public-DSRamFm8.js';
1
+ import { B as BoardChangeNotification } from './board-live-cards-lib-iU8xOwNp.js';
2
+ import { C as ChatStorage, B as BoardCallbackTransport } from './board-callback-transport-Bekq8Gp-.js';
2
3
  import { ExecutionRef } from './execution-refs.js';
3
- import { a as KindValueRef } from './storage-interface-D-iEiTJA.js';
4
- import { c as AsyncKVStorage, a as AsyncBlobStorage, e as AsyncQueueStorage, f as AsyncScratchStorage, A as AsyncArchiveFactory, b as AsyncJournalStorage, d as AsyncAtomicRelayLock } from './storage-async-interface-CG0bMqvE.js';
4
+ import { a as KindValueRef } from './storage-interface-DogVPooM.js';
5
+ import { A as AsyncKVStorage, a as AsyncBlobStorage, b as AsyncQueueStorage, c as AsyncScratchStorage, d as AsyncArchiveFactory, e as AsyncJournalStorage, f as AsyncAtomicRelayLock } from './storage-async-interface-Cb-SULrI.js';
5
6
 
6
7
  interface AsyncBoardWorkerRequest {
7
8
  boardId?: string;
@@ -1,7 +1,8 @@
1
- import { f as ChatStorage, k as BoardCallbackTransport, B as BoardChangeNotification } from './board-live-cards-public-BT5HrgqZ.cjs';
1
+ import { B as BoardChangeNotification } from './board-live-cards-lib-DVh3t9NT.cjs';
2
+ import { C as ChatStorage, B as BoardCallbackTransport } from './board-callback-transport-kP0K6UMq.cjs';
2
3
  import { ExecutionRef } from './execution-refs.cjs';
3
- import { a as KindValueRef } from './storage-interface-D-iEiTJA.cjs';
4
- import { c as AsyncKVStorage, a as AsyncBlobStorage, e as AsyncQueueStorage, f as AsyncScratchStorage, A as AsyncArchiveFactory, b as AsyncJournalStorage, d as AsyncAtomicRelayLock } from './storage-async-interface-CyO-zwVQ.cjs';
4
+ import { a as KindValueRef } from './storage-interface-DogVPooM.cjs';
5
+ import { A as AsyncKVStorage, a as AsyncBlobStorage, b as AsyncQueueStorage, c as AsyncScratchStorage, d as AsyncArchiveFactory, e as AsyncJournalStorage, f as AsyncAtomicRelayLock } from './storage-async-interface-CLOXiqwC.cjs';
5
6
 
6
7
  interface AsyncBoardWorkerRequest {
7
8
  boardId?: string;
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk2RIHC5TZ_cjs=require('./chunk-2RIHC5TZ.cjs');require('./chunk-GNFE24S7.cjs');function k(a){return JSON.parse(JSON.stringify(a))}function v(a,o){if(a===o)return a;try{if(JSON.stringify(a)===JSON.stringify(o))return a}catch{}return o}function m(a,o){if(a===o)return true;try{return JSON.stringify(a)===JSON.stringify(o)}catch{return false}}function B(a){return a==="running"||a==="in-progress"?"loading":a==="failed"?"error":"fresh"}function S(a,o,h){let C=a,l=(C&&Array.isArray(C.cardDefinitions)?C.cardDefinitions:[]).map(d=>d.id),f=o&&o.modelsById||{},_={};for(let d of l){let p=h(a,d),t=f[d];if(!t){_[d]=p;continue}let r=p.card_chats!=null?v(t.card_chats,p.card_chats??null):t.card_chats??null,e={id:p.id,card:v(t.card,p.card),card_data:v(t.card_data,p.card_data),requires:v(t.requires,p.requires),computed_values:v(t.computed_values,p.computed_values),runtime_state:v(t.runtime_state,p.runtime_state),card_chats:r};_[d]=e.card===t.card&&e.card_data===t.card_data&&e.requires===t.requires&&e.computed_values===t.computed_values&&e.runtime_state===t.runtime_state&&e.card_chats===t.card_chats?t:e;}let u=o?.cardWatchParties||{},g=Object.fromEntries(l.filter(d=>Object.prototype.hasOwnProperty.call(u,d)).map(d=>[d,u[d]]));return {payload:a,cardIds:l,modelsById:_,cardWatchParties:g}}function q(a,o={}){if(!a)return a;let h=typeof o.includeCard=="function"?o.includeCard:(()=>true),C=typeof o.mapCard=="function"?o.mapCard:(u=>u),c=false,l=[],f={};for(let u of a.cardIds){let g=a.modelsById[u];if(!g){c=true;continue}if(!h(g,a)){c=true;continue}let d=C(g,a);if(!d||d.id!==u)throw new Error(`deriveBoardState: mapped card must preserve id "${u}"`);d!==g&&(c=true),l.push(u),f[u]=d;}let _=typeof o.mapPayload=="function"?o.mapPayload(a.payload,{sourceState:a,cardIds:l,modelsById:f}):a.payload;return _!==a.payload&&(c=true),!c&&l.length===a.cardIds.length?a:{payload:_,cardIds:l,modelsById:f,cardWatchParties:a.cardWatchParties}}function x(a,o,h,C){if(!a||!Array.isArray(o)||o.length===0)return a;let c=a.modelsById,l=a.cardIds,f=a.cardWatchParties||{},_=false,u=false,g={};for(let t of l){let r=c[t],e=r&&r.requires;if(e&&typeof e=="object")for(let s of Object.keys(e))(g[s]=g[s]||[]).push(t);}function d(){_||(c={...c},_=true);}function p(t){if(t.kind!=="card_watchparty"||!t.cardId||!t.channel)return;let r=f[t.cardId]||{},e=Array.isArray(r[t.channel])?r[t.channel]:[],s=e;if(t.clear){if(e.length===0)return;s=[];}else if(t.replace){let i=Number.isFinite(Number(t.sentAtMs))?Number(t.sentAtMs):0,n={payload:t.payload,ts:i};if(e.length===1&&e[0]?.ts===n.ts&&m(e[0]?.payload,n.payload))return;s=[n];}else {let i={payload:t.payload,ts:Number.isFinite(Number(t.sentAtMs))?Number(t.sentAtMs):0};s=[...e,i];}f={...f,[t.cardId]:{...r,[t.channel]:s}},u=true;}for(let t of o)if(!(!t||!t.kind)){if(t.kind==="card_watchparty"){p(t);continue}if(chunk2RIHC5TZ_cjs.c(t)){if(t.kind==="card_chats"){let r=t.cardId,e=c[r];if(!e)continue;let s=Array.isArray(t.messages)?t.messages:e.card_chats?.messages??[],i=typeof t.receiving=="boolean"?t.receiving:e.card_chats?.receiving??false,n=typeof t.processing=="boolean"?t.processing:e.card_chats?.processing??false,y={messages:s,receiving:i,processing:n};if(m(e.card_chats,y))continue;d(),c[r]={...e,card_chats:y},u=true;}else if(t.kind==="chat_messages"){let r=t.cardId,e=c[r];if(!e)continue;let s=Array.isArray(t.messages)?t.messages:[],i=e.card_chats||{receiving:false,processing:false},n={messages:s,receiving:i.receiving,processing:!!i.processing};if(m(e.card_chats,n))continue;d(),c[r]={...e,card_chats:n},u=true;}else if(t.kind==="chat_processing"){let r=t.cardId,e=c[r];if(!e)continue;let s=e.card_chats||{messages:[],receiving:false},i={messages:s.messages,receiving:s.receiving,processing:t.active===true};if(m(e.card_chats,i))continue;d(),c[r]={...e,card_chats:i},u=true;}continue}if(chunk2RIHC5TZ_cjs.b(t)){if(t.kind==="computed_values"){let r=t.cardId,e=c[r];if(!e)continue;let s=t.values||{};if(m(e.computed_values,s))continue;d(),c[r]={...e,computed_values:s},u=true;}else if(t.kind==="data_object"){let r=t.key,e=t.payload,s=g[r]||[];for(let i of s){let n=c[i];if(!n)continue;let y=n.requires||{};m(y[r],e)||(d(),c[i]={...n,requires:{...y,[r]:e}},u=true);}}else if(t.kind==="card_refreshed"){let r=t.cardId,e=null,s=c[r],i=t.card;if(s&&i&&typeof i=="object"&&!Array.isArray(i)){let n=i,y=n.card_data&&typeof n.card_data=="object"&&!Array.isArray(n.card_data)?n.card_data:s.card_data,b=n.requires&&typeof n.requires=="object"&&!Array.isArray(n.requires)?n.requires:s.requires,w=n.computed_values&&typeof n.computed_values=="object"&&!Array.isArray(n.computed_values)?n.computed_values:s.computed_values,A=n.runtime_state&&typeof n.runtime_state=="object"&&!Array.isArray(n.runtime_state)?n.runtime_state:s.runtime_state;e={...s,card:i,card_data:y,requires:b,computed_values:w,runtime_state:A};}if(!e)try{let n=C();n&&(e=h(n,r));}catch{}if(!e||s&&m(s.card,e.card)&&m(s.card_data,e.card_data)&&m(s.requires,e.requires)&&m(s.computed_values,e.computed_values)&&m(s.runtime_state,e.runtime_state))continue;d(),c[r]=e,l.includes(r)||(l=[...l,r]),u=true;}else if(t.kind==="card_removed"){let r=t.cardId;if(!c[r])continue;if(d(),delete c[r],l=l.filter(e=>e!==r),Object.prototype.hasOwnProperty.call(f,r)){let e={...f};delete e[r],f=e;}u=true;}else if(t.kind==="status"){let r=t.status?.cards??[];for(let e of r){let s=e?.name;if(!s||!c[s])continue;let i=c[s],n=B(e.status),y={...i.card_data||{},status:n,lastRun:e.runtime?.last_transition_at??null,...e.error?.message?{error:e.error.message}:{}};e.error?.message||delete y.error;let b={task_status:e.status??null,card_status:n,runtime:e.runtime?k(e.runtime):{},error:e.error?k(e.error):null,blocked_by:Array.isArray(e.blocked_by)?k(e.blocked_by):[],requires_missing:Array.isArray(e.requires_missing)?k(e.requires_missing):[]};m(i.card_data,y)&&m(i.runtime_state,b)||(d(),c[s]={...i,card_data:y,runtime_state:b},u=true);}}}}return u?{payload:a.payload,cardIds:l,modelsById:c,cardWatchParties:f}:a}exports.applyNotification=x;exports.buildBoardState=S;exports.deriveBoardState=q;//# sourceMappingURL=board-state-reducer.cjs.map
2
+ //# sourceMappingURL=board-state-reducer.cjs.map
@@ -0,0 +1,53 @@
1
+ import { c as NotificationChatMessage, R as RuntimeNotification } from './board-live-cards-lib-DVh3t9NT.cjs';
2
+ import './types-BBhqYGhE.cjs';
3
+ import './storage-interface-DogVPooM.cjs';
4
+
5
+ /**
6
+ * board-state-reducer — shared reactive state helpers for browser board shells.
7
+ *
8
+ * Used by browser board shells and transport clients.
9
+ *
10
+ * Pure functions; no side effects; no DOM/localStorage/fetch dependencies.
11
+ */
12
+
13
+ type CardChatMessage = NotificationChatMessage;
14
+ interface CardChatState {
15
+ messages: CardChatMessage[];
16
+ receiving: boolean;
17
+ processing?: boolean;
18
+ }
19
+ interface CardWatchPartyEvent {
20
+ payload: unknown;
21
+ ts: number;
22
+ }
23
+ type CardWatchPartyChannelState = Record<string, CardWatchPartyEvent[]>;
24
+ interface CardModel {
25
+ id: string;
26
+ card: unknown;
27
+ card_data: unknown;
28
+ requires: unknown;
29
+ computed_values: unknown;
30
+ runtime_state: unknown;
31
+ card_chats: CardChatState | null;
32
+ }
33
+ interface BoardState {
34
+ payload: unknown;
35
+ cardIds: string[];
36
+ modelsById: Record<string, CardModel>;
37
+ cardWatchParties: Record<string, CardWatchPartyChannelState>;
38
+ }
39
+ interface DeriveBoardStateOptions {
40
+ includeCard?: (model: CardModel, sourceState: BoardState) => boolean;
41
+ mapCard?: (model: CardModel, sourceState: BoardState) => CardModel;
42
+ mapPayload?: (payload: unknown, context: {
43
+ sourceState: BoardState;
44
+ cardIds: string[];
45
+ modelsById: Record<string, CardModel>;
46
+ }) => unknown;
47
+ }
48
+ type SelectLiveCardModelFn = (payload: unknown, cardId: string) => CardModel;
49
+ declare function buildBoardState(payload: unknown, prevState: BoardState | null, selectLiveCardModel: SelectLiveCardModelFn): BoardState;
50
+ declare function deriveBoardState(sourceState: BoardState, options?: DeriveBoardStateOptions): BoardState;
51
+ declare function applyNotification(prevState: BoardState, notifications: RuntimeNotification[], selectLiveCardModel: SelectLiveCardModelFn, getFullPayload: () => unknown): BoardState;
52
+
53
+ export { type BoardState, type CardChatMessage, type CardChatState, type CardModel, type DeriveBoardStateOptions, type SelectLiveCardModelFn, applyNotification, buildBoardState, deriveBoardState };
@@ -0,0 +1,53 @@
1
+ import { c as NotificationChatMessage, R as RuntimeNotification } from './board-live-cards-lib-iU8xOwNp.js';
2
+ import './types-BBhqYGhE.js';
3
+ import './storage-interface-DogVPooM.js';
4
+
5
+ /**
6
+ * board-state-reducer — shared reactive state helpers for browser board shells.
7
+ *
8
+ * Used by browser board shells and transport clients.
9
+ *
10
+ * Pure functions; no side effects; no DOM/localStorage/fetch dependencies.
11
+ */
12
+
13
+ type CardChatMessage = NotificationChatMessage;
14
+ interface CardChatState {
15
+ messages: CardChatMessage[];
16
+ receiving: boolean;
17
+ processing?: boolean;
18
+ }
19
+ interface CardWatchPartyEvent {
20
+ payload: unknown;
21
+ ts: number;
22
+ }
23
+ type CardWatchPartyChannelState = Record<string, CardWatchPartyEvent[]>;
24
+ interface CardModel {
25
+ id: string;
26
+ card: unknown;
27
+ card_data: unknown;
28
+ requires: unknown;
29
+ computed_values: unknown;
30
+ runtime_state: unknown;
31
+ card_chats: CardChatState | null;
32
+ }
33
+ interface BoardState {
34
+ payload: unknown;
35
+ cardIds: string[];
36
+ modelsById: Record<string, CardModel>;
37
+ cardWatchParties: Record<string, CardWatchPartyChannelState>;
38
+ }
39
+ interface DeriveBoardStateOptions {
40
+ includeCard?: (model: CardModel, sourceState: BoardState) => boolean;
41
+ mapCard?: (model: CardModel, sourceState: BoardState) => CardModel;
42
+ mapPayload?: (payload: unknown, context: {
43
+ sourceState: BoardState;
44
+ cardIds: string[];
45
+ modelsById: Record<string, CardModel>;
46
+ }) => unknown;
47
+ }
48
+ type SelectLiveCardModelFn = (payload: unknown, cardId: string) => CardModel;
49
+ declare function buildBoardState(payload: unknown, prevState: BoardState | null, selectLiveCardModel: SelectLiveCardModelFn): BoardState;
50
+ declare function deriveBoardState(sourceState: BoardState, options?: DeriveBoardStateOptions): BoardState;
51
+ declare function applyNotification(prevState: BoardState, notifications: RuntimeNotification[], selectLiveCardModel: SelectLiveCardModelFn, getFullPayload: () => unknown): BoardState;
52
+
53
+ export { type BoardState, type CardChatMessage, type CardChatState, type CardModel, type DeriveBoardStateOptions, type SelectLiveCardModelFn, applyNotification, buildBoardState, deriveBoardState };
@@ -0,0 +1,2 @@
1
+ import {c,b}from'./chunk-UGB7PC4P.js';import'./chunk-FW4363Y4.js';function k(a){return JSON.parse(JSON.stringify(a))}function v(a,o){if(a===o)return a;try{if(JSON.stringify(a)===JSON.stringify(o))return a}catch{}return o}function m(a,o){if(a===o)return true;try{return JSON.stringify(a)===JSON.stringify(o)}catch{return false}}function B(a){return a==="running"||a==="in-progress"?"loading":a==="failed"?"error":"fresh"}function S(a,o,h){let C=a,l=(C&&Array.isArray(C.cardDefinitions)?C.cardDefinitions:[]).map(d=>d.id),f=o&&o.modelsById||{},_={};for(let d of l){let p=h(a,d),t=f[d];if(!t){_[d]=p;continue}let r=p.card_chats!=null?v(t.card_chats,p.card_chats??null):t.card_chats??null,e={id:p.id,card:v(t.card,p.card),card_data:v(t.card_data,p.card_data),requires:v(t.requires,p.requires),computed_values:v(t.computed_values,p.computed_values),runtime_state:v(t.runtime_state,p.runtime_state),card_chats:r};_[d]=e.card===t.card&&e.card_data===t.card_data&&e.requires===t.requires&&e.computed_values===t.computed_values&&e.runtime_state===t.runtime_state&&e.card_chats===t.card_chats?t:e;}let u=o?.cardWatchParties||{},g=Object.fromEntries(l.filter(d=>Object.prototype.hasOwnProperty.call(u,d)).map(d=>[d,u[d]]));return {payload:a,cardIds:l,modelsById:_,cardWatchParties:g}}function q(a,o={}){if(!a)return a;let h=typeof o.includeCard=="function"?o.includeCard:(()=>true),C=typeof o.mapCard=="function"?o.mapCard:(u=>u),c=false,l=[],f={};for(let u of a.cardIds){let g=a.modelsById[u];if(!g){c=true;continue}if(!h(g,a)){c=true;continue}let d=C(g,a);if(!d||d.id!==u)throw new Error(`deriveBoardState: mapped card must preserve id "${u}"`);d!==g&&(c=true),l.push(u),f[u]=d;}let _=typeof o.mapPayload=="function"?o.mapPayload(a.payload,{sourceState:a,cardIds:l,modelsById:f}):a.payload;return _!==a.payload&&(c=true),!c&&l.length===a.cardIds.length?a:{payload:_,cardIds:l,modelsById:f,cardWatchParties:a.cardWatchParties}}function x(a,o,h,C){if(!a||!Array.isArray(o)||o.length===0)return a;let c$1=a.modelsById,l=a.cardIds,f=a.cardWatchParties||{},_=false,u=false,g={};for(let t of l){let r=c$1[t],e=r&&r.requires;if(e&&typeof e=="object")for(let s of Object.keys(e))(g[s]=g[s]||[]).push(t);}function d(){_||(c$1={...c$1},_=true);}function p(t){if(t.kind!=="card_watchparty"||!t.cardId||!t.channel)return;let r=f[t.cardId]||{},e=Array.isArray(r[t.channel])?r[t.channel]:[],s=e;if(t.clear){if(e.length===0)return;s=[];}else if(t.replace){let i=Number.isFinite(Number(t.sentAtMs))?Number(t.sentAtMs):0,n={payload:t.payload,ts:i};if(e.length===1&&e[0]?.ts===n.ts&&m(e[0]?.payload,n.payload))return;s=[n];}else {let i={payload:t.payload,ts:Number.isFinite(Number(t.sentAtMs))?Number(t.sentAtMs):0};s=[...e,i];}f={...f,[t.cardId]:{...r,[t.channel]:s}},u=true;}for(let t of o)if(!(!t||!t.kind)){if(t.kind==="card_watchparty"){p(t);continue}if(c(t)){if(t.kind==="card_chats"){let r=t.cardId,e=c$1[r];if(!e)continue;let s=Array.isArray(t.messages)?t.messages:e.card_chats?.messages??[],i=typeof t.receiving=="boolean"?t.receiving:e.card_chats?.receiving??false,n=typeof t.processing=="boolean"?t.processing:e.card_chats?.processing??false,y={messages:s,receiving:i,processing:n};if(m(e.card_chats,y))continue;d(),c$1[r]={...e,card_chats:y},u=true;}else if(t.kind==="chat_messages"){let r=t.cardId,e=c$1[r];if(!e)continue;let s=Array.isArray(t.messages)?t.messages:[],i=e.card_chats||{receiving:false,processing:false},n={messages:s,receiving:i.receiving,processing:!!i.processing};if(m(e.card_chats,n))continue;d(),c$1[r]={...e,card_chats:n},u=true;}else if(t.kind==="chat_processing"){let r=t.cardId,e=c$1[r];if(!e)continue;let s=e.card_chats||{messages:[],receiving:false},i={messages:s.messages,receiving:s.receiving,processing:t.active===true};if(m(e.card_chats,i))continue;d(),c$1[r]={...e,card_chats:i},u=true;}continue}if(b(t)){if(t.kind==="computed_values"){let r=t.cardId,e=c$1[r];if(!e)continue;let s=t.values||{};if(m(e.computed_values,s))continue;d(),c$1[r]={...e,computed_values:s},u=true;}else if(t.kind==="data_object"){let r=t.key,e=t.payload,s=g[r]||[];for(let i of s){let n=c$1[i];if(!n)continue;let y=n.requires||{};m(y[r],e)||(d(),c$1[i]={...n,requires:{...y,[r]:e}},u=true);}}else if(t.kind==="card_refreshed"){let r=t.cardId,e=null,s=c$1[r],i=t.card;if(s&&i&&typeof i=="object"&&!Array.isArray(i)){let n=i,y=n.card_data&&typeof n.card_data=="object"&&!Array.isArray(n.card_data)?n.card_data:s.card_data,b=n.requires&&typeof n.requires=="object"&&!Array.isArray(n.requires)?n.requires:s.requires,w=n.computed_values&&typeof n.computed_values=="object"&&!Array.isArray(n.computed_values)?n.computed_values:s.computed_values,A=n.runtime_state&&typeof n.runtime_state=="object"&&!Array.isArray(n.runtime_state)?n.runtime_state:s.runtime_state;e={...s,card:i,card_data:y,requires:b,computed_values:w,runtime_state:A};}if(!e)try{let n=C();n&&(e=h(n,r));}catch{}if(!e||s&&m(s.card,e.card)&&m(s.card_data,e.card_data)&&m(s.requires,e.requires)&&m(s.computed_values,e.computed_values)&&m(s.runtime_state,e.runtime_state))continue;d(),c$1[r]=e,l.includes(r)||(l=[...l,r]),u=true;}else if(t.kind==="card_removed"){let r=t.cardId;if(!c$1[r])continue;if(d(),delete c$1[r],l=l.filter(e=>e!==r),Object.prototype.hasOwnProperty.call(f,r)){let e={...f};delete e[r],f=e;}u=true;}else if(t.kind==="status"){let r=t.status?.cards??[];for(let e of r){let s=e?.name;if(!s||!c$1[s])continue;let i=c$1[s],n=B(e.status),y={...i.card_data||{},status:n,lastRun:e.runtime?.last_transition_at??null,...e.error?.message?{error:e.error.message}:{}};e.error?.message||delete y.error;let b={task_status:e.status??null,card_status:n,runtime:e.runtime?k(e.runtime):{},error:e.error?k(e.error):null,blocked_by:Array.isArray(e.blocked_by)?k(e.blocked_by):[],requires_missing:Array.isArray(e.requires_missing)?k(e.requires_missing):[]};m(i.card_data,y)&&m(i.runtime_state,b)||(d(),c$1[s]={...i,card_data:y,runtime_state:b},u=true);}}}}return u?{payload:a.payload,cardIds:l,modelsById:c$1,cardWatchParties:f}:a}export{x as applyNotification,S as buildBoardState,q as deriveBoardState};//# sourceMappingURL=board-state-reducer.js.map
2
+ //# sourceMappingURL=board-state-reducer.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkYMEIPKLW_cjs=require('./chunk-YMEIPKLW.cjs');require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createCardStorePublic",{enumerable:true,get:function(){return chunkYMEIPKLW_cjs.a}});//# sourceMappingURL=card-store-public.cjs.map
1
+ 'use strict';var chunk5XLFPPTY_cjs=require('./chunk-5XLFPPTY.cjs');require('./chunk-2RIHC5TZ.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createCardStorePublic",{enumerable:true,get:function(){return chunk5XLFPPTY_cjs.a}});//# sourceMappingURL=card-store-public.cjs.map
2
2
  //# sourceMappingURL=card-store-public.cjs.map
@@ -1,5 +1,7 @@
1
- import { C as CommandInput, a as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-BT5HrgqZ.cjs';
2
- import './storage-interface-D-iEiTJA.cjs';
1
+ import { CommandInput, CommandResult } from './board-live-cards-public.cjs';
2
+ import { L as LiveCard, d as RuntimeNotificationBatch, h as NotificationEmitter, j as CardAdminStore } from './board-live-cards-lib-DVh3t9NT.cjs';
3
+ import './storage-interface-DogVPooM.cjs';
4
+ import './board-callback-transport-kP0K6UMq.cjs';
3
5
  import './execution-refs.cjs';
4
6
  import './types-BBhqYGhE.cjs';
5
7
 
@@ -31,6 +33,8 @@ interface CardStorePublic {
31
33
  get(input: CommandInput): CommandResult<{
32
34
  cards: LiveCard[];
33
35
  }>;
36
+ /** Build a notification-batch snapshot from one card (params.id) or all cards. */
37
+ buildNotificationBatch(input: CommandInput): CommandResult<RuntimeNotificationBatch>;
34
38
  /**
35
39
  * Write cards into the store.
36
40
  * body: single card object { id, ... } or an array of card objects.
@@ -67,6 +71,9 @@ interface CardStorePublic {
67
71
  }>;
68
72
  }>;
69
73
  }
70
- declare function createCardStorePublic(store: CardAdminStore): CardStorePublic;
74
+ interface CardStorePublicOptions {
75
+ emitNotification?: NotificationEmitter;
76
+ }
77
+ declare function createCardStorePublic(store: CardAdminStore, options?: CardStorePublicOptions): CardStorePublic;
71
78
 
72
- export { type CardStorePublic, createCardStorePublic };
79
+ export { type CardStorePublic, type CardStorePublicOptions, createCardStorePublic };
@@ -1,5 +1,7 @@
1
- import { C as CommandInput, a as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-DSRamFm8.js';
2
- import './storage-interface-D-iEiTJA.js';
1
+ import { CommandInput, CommandResult } from './board-live-cards-public.js';
2
+ import { L as LiveCard, d as RuntimeNotificationBatch, h as NotificationEmitter, j as CardAdminStore } from './board-live-cards-lib-iU8xOwNp.js';
3
+ import './storage-interface-DogVPooM.js';
4
+ import './board-callback-transport-Bekq8Gp-.js';
3
5
  import './execution-refs.js';
4
6
  import './types-BBhqYGhE.js';
5
7
 
@@ -31,6 +33,8 @@ interface CardStorePublic {
31
33
  get(input: CommandInput): CommandResult<{
32
34
  cards: LiveCard[];
33
35
  }>;
36
+ /** Build a notification-batch snapshot from one card (params.id) or all cards. */
37
+ buildNotificationBatch(input: CommandInput): CommandResult<RuntimeNotificationBatch>;
34
38
  /**
35
39
  * Write cards into the store.
36
40
  * body: single card object { id, ... } or an array of card objects.
@@ -67,6 +71,9 @@ interface CardStorePublic {
67
71
  }>;
68
72
  }>;
69
73
  }
70
- declare function createCardStorePublic(store: CardAdminStore): CardStorePublic;
74
+ interface CardStorePublicOptions {
75
+ emitNotification?: NotificationEmitter;
76
+ }
77
+ declare function createCardStorePublic(store: CardAdminStore, options?: CardStorePublicOptions): CardStorePublic;
71
78
 
72
- export { type CardStorePublic, createCardStorePublic };
79
+ export { type CardStorePublic, type CardStorePublicOptions, createCardStorePublic };
@@ -1,2 +1,2 @@
1
- export{a as createCardStorePublic}from'./chunk-KBELAKIY.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=card-store-public.js.map
1
+ export{a as createCardStorePublic}from'./chunk-7QNEV5S3.js';import'./chunk-UGB7PC4P.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=card-store-public.js.map
2
2
  //# sourceMappingURL=card-store-public.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkUB54HZA4_cjs=require('./chunk-UB54HZA4.cjs');require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createChatStorePublic",{enumerable:true,get:function(){return chunkUB54HZA4_cjs.a}});//# sourceMappingURL=chat-store-public.cjs.map
1
+ 'use strict';var chunkOF4FPYNI_cjs=require('./chunk-OF4FPYNI.cjs');require('./chunk-2RIHC5TZ.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createChatStorePublic",{enumerable:true,get:function(){return chunkOF4FPYNI_cjs.a}});//# sourceMappingURL=chat-store-public.cjs.map
2
2
  //# sourceMappingURL=chat-store-public.cjs.map
@@ -1,5 +1,7 @@
1
- import { C as CommandInput, a as CommandResult, g as ChatRecord, h as ChatReadAfterResult, i as ChatConfig, f as ChatStorage } from './board-live-cards-public-BT5HrgqZ.cjs';
2
- import './storage-interface-D-iEiTJA.cjs';
1
+ import { CommandInput, CommandResult } from './board-live-cards-public.cjs';
2
+ import { a as ChatRecord, b as ChatReadAfterResult, c as ChatConfig, C as ChatStorage } from './board-callback-transport-kP0K6UMq.cjs';
3
+ import { d as RuntimeNotificationBatch, h as NotificationEmitter } from './board-live-cards-lib-DVh3t9NT.cjs';
4
+ import './storage-interface-DogVPooM.cjs';
3
5
  import './execution-refs.cjs';
4
6
  import './types-BBhqYGhE.cjs';
5
7
 
@@ -57,6 +59,9 @@ type ChatStoreBatchResult = {
57
59
  data?: unknown;
58
60
  }>;
59
61
  };
62
+ interface ChatStorePublicOptions {
63
+ emitNotification?: NotificationEmitter;
64
+ }
60
65
  interface ChatStorePublic {
61
66
  /**
62
67
  * Append a message to a card's chat history.
@@ -76,6 +81,12 @@ interface ChatStorePublic {
76
81
  readAll(input: CommandInput): Awaitable<CommandResult<{
77
82
  records: ChatRecord[];
78
83
  }>>;
84
+ /**
85
+ * Build the per-card chat subscription hydration batch.
86
+ * params.cardId: string
87
+ * body.receiving?: boolean
88
+ */
89
+ buildSseOneShotBatch(input: CommandInput): Awaitable<CommandResult<RuntimeNotificationBatch>>;
79
90
  /**
80
91
  * Read messages appended after a cursor.
81
92
  * params.cardId: string
@@ -131,6 +142,6 @@ interface ChatStorePublic {
131
142
  */
132
143
  runBatch(envelope: ChatStoreCommandBatchEnvelope): Awaitable<CommandResult<ChatStoreBatchResult>>;
133
144
  }
134
- declare function createChatStorePublic(store: ChatStorage): ChatStorePublic;
145
+ declare function createChatStorePublic(store: ChatStorage, options?: ChatStorePublicOptions): ChatStorePublic;
135
146
 
136
- export { type ChatStoreBatchResult, type ChatStoreCommandBatchEnvelope, type ChatStoreCommandEnvelope, type ChatStoreCommandName, type ChatStorePublic, createChatStorePublic };
147
+ export { type ChatStoreBatchResult, type ChatStoreCommandBatchEnvelope, type ChatStoreCommandEnvelope, type ChatStoreCommandName, type ChatStorePublic, type ChatStorePublicOptions, createChatStorePublic };
@@ -1,5 +1,7 @@
1
- import { C as CommandInput, a as CommandResult, g as ChatRecord, h as ChatReadAfterResult, i as ChatConfig, f as ChatStorage } from './board-live-cards-public-DSRamFm8.js';
2
- import './storage-interface-D-iEiTJA.js';
1
+ import { CommandInput, CommandResult } from './board-live-cards-public.js';
2
+ import { a as ChatRecord, b as ChatReadAfterResult, c as ChatConfig, C as ChatStorage } from './board-callback-transport-Bekq8Gp-.js';
3
+ import { d as RuntimeNotificationBatch, h as NotificationEmitter } from './board-live-cards-lib-iU8xOwNp.js';
4
+ import './storage-interface-DogVPooM.js';
3
5
  import './execution-refs.js';
4
6
  import './types-BBhqYGhE.js';
5
7
 
@@ -57,6 +59,9 @@ type ChatStoreBatchResult = {
57
59
  data?: unknown;
58
60
  }>;
59
61
  };
62
+ interface ChatStorePublicOptions {
63
+ emitNotification?: NotificationEmitter;
64
+ }
60
65
  interface ChatStorePublic {
61
66
  /**
62
67
  * Append a message to a card's chat history.
@@ -76,6 +81,12 @@ interface ChatStorePublic {
76
81
  readAll(input: CommandInput): Awaitable<CommandResult<{
77
82
  records: ChatRecord[];
78
83
  }>>;
84
+ /**
85
+ * Build the per-card chat subscription hydration batch.
86
+ * params.cardId: string
87
+ * body.receiving?: boolean
88
+ */
89
+ buildSseOneShotBatch(input: CommandInput): Awaitable<CommandResult<RuntimeNotificationBatch>>;
79
90
  /**
80
91
  * Read messages appended after a cursor.
81
92
  * params.cardId: string
@@ -131,6 +142,6 @@ interface ChatStorePublic {
131
142
  */
132
143
  runBatch(envelope: ChatStoreCommandBatchEnvelope): Awaitable<CommandResult<ChatStoreBatchResult>>;
133
144
  }
134
- declare function createChatStorePublic(store: ChatStorage): ChatStorePublic;
145
+ declare function createChatStorePublic(store: ChatStorage, options?: ChatStorePublicOptions): ChatStorePublic;
135
146
 
136
- export { type ChatStoreBatchResult, type ChatStoreCommandBatchEnvelope, type ChatStoreCommandEnvelope, type ChatStoreCommandName, type ChatStorePublic, createChatStorePublic };
147
+ export { type ChatStoreBatchResult, type ChatStoreCommandBatchEnvelope, type ChatStoreCommandEnvelope, type ChatStoreCommandName, type ChatStorePublic, type ChatStorePublicOptions, createChatStorePublic };
@@ -1,2 +1,2 @@
1
- export{a as createChatStorePublic}from'./chunk-Q3OTUDIE.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=chat-store-public.js.map
1
+ export{a as createChatStorePublic}from'./chunk-NIBLKYXN.js';import'./chunk-UGB7PC4P.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=chat-store-public.js.map
2
2
  //# sourceMappingURL=chat-store-public.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';function n(t){if(!t||typeof t!="object")return false;let e=t;return e.kind==="notification-batch"&&Array.isArray(e.notifications)}function r(t){let e=t.category??i(t.kind);return e==="board-output"||e==="card-store"}function c(t){let e=t.category??i(t.kind);return e==="chat-store"||e==="hosted-runtime"}function i(t){switch(t){case "computed_values":case "data_object":case "status":return "board-output";case "card_refreshed":case "card_removed":return "card-store";case "card_chats":case "chat_messages":return "chat-store";case "chat_processing":case "card_watchparty":return "hosted-runtime";case "message_enqueued":return "queue-storage"}}function o(t){return t.category?t:{...t,category:i(t.kind)}}function a(t){return t.map(e=>o(e))}function s(t){return {...t,category:t.category??"batch",notifications:a(t.notifications)}}exports.a=n;exports.b=r;exports.c=c;exports.d=i;exports.e=a;exports.f=s;//# sourceMappingURL=chunk-2RIHC5TZ.cjs.map
2
+ //# sourceMappingURL=chunk-2RIHC5TZ.cjs.map
@@ -0,0 +1,3 @@
1
+ import {a,b}from'./chunk-JB4Q2W7I.js';import {a as a$3}from'./chunk-XYN5D3GL.js';import {a as a$6,c as c$2}from'./chunk-O5UYCGIN.js';import {p,j,k,l,c as c$1,d as d$1,m,n,e as e$1,a as a$8,b as b$3,o}from'./chunk-7KSENEPK.js';import {a as a$4,d as d$2,b as b$2,c as c$3}from'./chunk-FOFGEABN.js';import {a as a$c}from'./chunk-RKKSVOP2.js';import {a as a$2}from'./chunk-NTICU4OK.js';import {a as a$9,c as c$4}from'./chunk-O7NOHKVR.js';import {a as a$a,b as b$4}from'./chunk-ZJ5M5COT.js';import {i,d,c,b as b$1,g,h}from'./chunk-TMS7KDKH.js';import {a as a$b}from'./chunk-6MD6FVE3.js';import {y,z,l as l$1}from'./chunk-VS4E7QFN.js';import {a as a$5}from'./chunk-7QNEV5S3.js';import {a as a$7}from'./chunk-BJGK5FNL.js';import {a as a$1}from'./chunk-NIBLKYXN.js';import {e}from'./chunk-UGB7PC4P.js';function ce(R){let{apiBasePath:h,json:w,readJsonBody:L,initBoardAndSetup:F,bootstrapBoard:v,buildPublishedRuntimePayload:W,createMcpControlplaneToolRegistry:j,retriggerCard:M,applyCardAction:I,resolveChatHandlerTarget:E,sendCardFileDownloadResponse:$}=R;async function J(H,B,V){let l=H.method||"GET",A=V,u=A.pathname;try{if(l==="POST"&&u===`${h}/mcp-actions`){await v();let m=Date.now(),b=new Date(m).toISOString(),S=await L(H),f=typeof S.tool=="string"?S.tool.trim():"",T=S.args&&typeof S.args=="object"&&!Array.isArray(S.args)?S.args:{};if(!f)return w(B,400,{error:"tool is required"}),!0;let P=a$9(T,"card_id");if(!P)return w(B,400,{error:"MCP action requires card_id"}),!0;if(f==="retrigger-card"||f==="retrigger"){await M(P);let O=Date.now();return w(B,200,{status:"success",data:{ok:!0,cardId:P,actionType:f,requestReceivedAt:b,requestReceivedAtMs:m,responseSentAt:new Date(O).toISOString(),responseSentAtMs:O,responseStatus:200}}),!0}let g=c$4(T,"payload");if(f==="chat-send"&&!await E(P)){let O=Date.now();return w(B,409,{error:`chat handler is not configured for card: ${P}`,requestReceivedAt:b,requestReceivedAtMs:m,responseSentAt:new Date(O).toISOString(),responseSentAtMs:O,responseStatus:409}),!0}if(f==="chat-send"){let O=typeof g["turn-id"]=="string"?g["turn-id"]:typeof g.turnId=="string"?g.turnId:typeof g.turn=="string"?g.turn:"";if(!O||!String(O).trim()){let at=Date.now();return w(B,400,{error:`chat-send requires a non-empty 'turn-id' (or 'turnId'/'turn') in payload for card: ${P}`,requestReceivedAt:b,requestReceivedAtMs:m,responseSentAt:new Date(at).toISOString(),responseSentAtMs:at,responseStatus:400}),!0}}await I(P,f,g);let _=Date.now();return w(B,200,{status:"success",data:{ok:!0,cardId:P,actionType:f,requestReceivedAt:b,requestReceivedAtMs:m,responseSentAt:new Date(_).toISOString(),responseSentAtMs:_,responseStatus:200}}),!0}if(l==="POST"&&u===`${h}/mcp-controlplane`){await v();let m=await L(H),b=typeof m.tool=="string"?m.tool.trim():"",S=m.args&&typeof m.args=="object"&&!Array.isArray(m.args)?m.args:{};if(!b)return w(B,400,{error:"tool is required"}),!0;try{let f=await a$a(b,S,j());if(f&&typeof f=="object"&&!Array.isArray(f)){let T=f;if(T.status==="fail")return w(B,400,{error:b$4(f,"Request failed")}),!0;if(T.status==="error")return w(B,500,{error:b$4(f,"Internal error")}),!0}w(B,200,f);}catch(f){let T=typeof f?.statusCode=="number"?Number(f.statusCode):500,P=f instanceof Error?f.message:String(f);w(B,T,{error:P});}return !0}let k=u.match(new RegExp(`^${c$3(h)}/cards/([^/]+)/retrigger$`));if(l==="POST"&&k){await v();let m=decodeURIComponent(k[1]);return await M(m),w(B,200,{ok:!0}),!0}let x=u.match(new RegExp(`^${c$3(h)}/cards/([^/]+)/actions$`));if(l==="POST"&&x){await v();let m=decodeURIComponent(x[1]),b=Date.now(),S=new Date(b).toISOString(),f=await L(H),T=f?.actionType;if(T==="chat-send"&&!await E(m)){let g=Date.now();return w(B,409,{error:`chat handler is not configured for card: ${m}`,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(g).toISOString(),responseSentAtMs:g,responseStatus:409}),!0}if(T==="chat-send"){let g=f?.payload??{},_=typeof g["turn-id"]=="string"?g["turn-id"]:typeof g.turnId=="string"?g.turnId:typeof g.turn=="string"?g.turn:"";if(!_||!String(_).trim()){let O=Date.now();return w(B,400,{error:`chat-send requires a non-empty 'turn-id' (or 'turnId'/'turn') in payload for card: ${m}`,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(O).toISOString(),responseSentAtMs:O,responseStatus:400}),!0}}await I(m,T,f?.payload);let P=Date.now();return w(B,200,{ok:!0,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(P).toISOString(),responseSentAtMs:P,responseStatus:200}),!0}let N=u.match(new RegExp(`^${c$3(h)}/cards/([^/]+)/files/(\\d+)$`));if(l==="GET"&&N){let m=decodeURIComponent(N[1]),b=parseInt(N[2],10),S=A.searchParams.get("sn");return await $(B,m,b,S),!0}return !1}catch(k){let x=k?.statusCode||500;return w(B,x,{error:String(k?.message||k)}),true}}return {handleRuntimeApi:J}}var ze=3e4;function Ke(R){let h=R.socket?.remoteAddress??"";return h==="127.0.0.1"||h==="::1"||h==="::ffff:127.0.0.1"}function ue(R){let{apiBasePath:h,emitNotifications:w,readJsonBody:L,json:F}=R,v=`${h}/notify-q`;async function W(j,M,I){if(I.pathname!==v)return false;if((j.method??"").toUpperCase()!=="POST")return F(M,405,{status:"error",error:"Method not allowed"}),true;if(!Ke(j))return F(M,403,{status:"error",error:"Forbidden"}),true;let E;try{E=await L(j);}catch{return F(M,400,{status:"error",error:"Invalid JSON body"}),true}if(!E||typeof E!="object"||!Array.isArray(E.notifications))return F(M,400,{status:"error",error:"body.notifications must be an array"}),true;let $=E.notifications,{accepted:J,rejected:H}=b$3($,Date.now(),ze);return J.length>0&&w(J),F(M,200,{status:"success",data:{accepted:J.length,rejected:H}}),true}return {handleNotifyRoute:W}}var le={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"content-type,x-file-name","Access-Control-Allow-Methods":"GET,POST,PATCH,OPTIONS"},de="chat-handler-flow-queue",ot="__probe__echo__probe__";function jr(R){let h$1=String(R.apiBasePath||"/api/board").replace(/\/$/,""),w={...le,...R.corsHeaders||{}},L=R.queueLaneTuning??{},F=R.boardId||"",v=R.logger||{info:console.log,warn:console.warn,error:console.error},W=R.invocationAdapter,j$1=R.chatFlowRunner||null,M=R.notificationTransport||null,I=R.serverUrl||null,E=R.executionExtra||{},$=R.onSseClientConnected,J=R.onSseClientDisconnected,H=R.onChannelSubscribed,B=R.onChannelUnsubscribed,V=a({buildChatOneShotBatch:async(t,e)=>await tt.buildSseOneShotBatch({params:{cardId:t},body:{receiving:e}}),onSseClientDisconnected:J}),l$2=a({buildChatOneShotBatch:async()=>({status:"success",data:{kind:"notification-batch",category:"batch",notifications:[]}})});function A(t){function e(a){return {...a,queueStorageForRef(d,C){return a$7(a.queueStorageForRef(d,C),{lane:C,emitNotification:i$1})}}}function r(a){return {...a,queueStorageForRef(d,C){return h(a.queueStorageForRef(d,C),{lane:C,emitNotification:i$1})}}}function n(a){return {async get(d){return a.get(d)},async set(d){return a.set(d)},async del(d){return a.del(d)},async patch(d){return a.patch(d)},async appendFiles(d){return a.appendFiles(d)}}}function o(a){return {async get(d){return await a.get(d)},async set(d){return await a.set(d)},async del(d){return await a.del(d)},async patch(d){return await a.patch(d)},async appendFiles(d){return await a.appendFiles(d)}}}let s=null;function i$1(a){if(a.kind==="notification-batch"){O(a.notifications,s??void 0);return}O([a],s??void 0);}let c$2=a$4(t.boardAdapter)?r(t.boardAdapter):e(t.boardAdapter),D=t.nonCoreAdapter??(!a$4(c$2)&&b$3(c$2)?c$2:null),y$1=a$4(c$2)?i(t.baseRef,c$2,{boardRuntimeStoreRef:t.boardRuntimeStoreRef,scratchStoreRef:t.scratchStoreRef,taskExecutorRef:t.taskExecutorRef,chatHandlerFlow:t.chatHandlerFlow,emitNotification:i$1}):y(t.baseRef,c$2,{boardRuntimeStoreRef:t.boardRuntimeStoreRef,scratchStoreRef:t.scratchStoreRef,taskExecutorRef:t.taskExecutorRef,chatHandlerFlow:t.chatHandlerFlow,emitNotification:i$1}),q=t.nonCore??(D?z(t.baseRef,D,{boardRuntimeStoreRef:t.boardRuntimeStoreRef,taskExecutorRef:t.taskExecutorRef}):null),Ue=c$2.chatStorageForRef(t.chatStoreRef),lt,We=a$4(c$2)?(()=>{let a=d(c(b$1(c$2.kvStorageForRef(t.cardStoreRef)),c$2.hashFn),v.warn),d$1=g(a,{emitNotification:i$1}),C=o(d$1);return lt={get(p){return C.get(p)},set(p){return C.set(p)}},C})():(()=>{let a=c$2.kvStorageForRef(t.cardStoreRef),C=a$5(l$1({readIndex:()=>a.read("_index"),writeIndex:p=>a.write("_index",p),readCard:p=>a.read(p),writeCard:(p,pt)=>(a.write(p,pt),p),removeCard:p=>{a.delete(p);},cardExists:p=>a.read(p)!==null,defaultCardKey:p=>p},v.warn),{emitNotification:i$1});return lt=C,n(C)})(),ft;if(a$4(c$2)){let a=c$2.blobStorageForRef(t.artifactsStoreRef);ft={async putBytes(d,C){if(a.writeBytes){await a.writeBytes(d,C);return}let p=JSON.stringify({__kind:"bytes-array",data:[...C]});await a.write(d,p);},async getBytes(d){if(a.readBytes){let p=await a.readBytes(d);if(p!==null)return p}let C=await a.read(d);if(C===null)return null;try{let p=JSON.parse(C);if(p&&p.__kind==="bytes-array"&&Array.isArray(p.data))return new Uint8Array(p.data)}catch{}return new TextEncoder().encode(C)},async listKeys(d){return await a.listKeys(d)}};}else {let a=c$2.blobStorageForRef(t.artifactsStoreRef),d=a$6(a);ft={putBytes(C,p,pt){d.putBytes(C,p,pt);},getBytes(C){return d.getBytes(C)},listKeys(C){return d.list(C).map(p=>p.key)}};}let Je={async init(a){return y$1.init(a)},async status(a){return y$1.status(a)},async getConfig(a){return y$1.getConfig(a)},async getAllOutputsDataObjects(a){return y$1.getAllOutputsDataObjects(a)},async getAllOutputsComputedValues(a){return y$1.getAllOutputsComputedValues(a)},async getOutputsFetchedSources(a){return y$1.getOutputsFetchedSources(a)},async buildSseOneShotPayload(a){return y$1.buildSseOneShotPayload(a)},async upsertCard(a){return y$1.upsertCard(a)},async removeCard(a){return y$1.removeCard(a)},async sourceDataFetched(a){return y$1.sourceDataFetched(a)},async sourceDataFetchFailure(a){return y$1.sourceDataFetchFailure(a)}};return s={label:t.label,board:y$1,nonCore:q,publicCardStore:lt,boardOps:Je,cardStoreOps:We,get filesArtifacts(){return ft},get chatStorage(){return Ue},boardAdapter:c$2,boardRuntimeStoreRef:t.boardRuntimeStoreRef,cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef,artifactsStoreRef:t.artifactsStoreRef,fetchedSourcesStoreRef:t.fetchedSourcesStoreRef,queueStoreRef:t.queueStoreRef,chatStoreRef:t.chatStoreRef,scratchStoreRef:t.scratchStoreRef,notifyRef:t.notifyRef,taskExecutorRef:t.taskExecutorRef,chatHandlerRef:t.chatHandlerRef,chatHandlerFlow:t.chatHandlerFlow,inferenceAdapterRef:t.inferenceAdapterRef,notification:c$1(),notificationTeardown:null,initialized:false,cardsBootstrapped:false},s}let u=R.boards.map(A),k$1=new Map;function x(t){return k$1.get(t)??0}function N(t){return t.queueStoreRef}function m$1(t,e){if(a$4(t.boardAdapter)){let n=t.boardAdapter.queueStorageForRef(N(t),e);return a$b(n)}let r=t.boardAdapter.queueStorageForRef(N(t),e);return a$c(r)}function b$3(t){let e=t;return typeof e.invokeExecutor=="function"&&typeof e.validateSchema=="function"}function S(t){let e=u[x(t)];return {files:e?e.filesArtifacts:null}}function f(){return c$2()}function T(t){return String(t||"").replace(/[^a-zA-Z0-9_-]/g,"_")||"unknown-card"}function P(t){return "cardId"in t&&typeof t.cardId=="string"?z$1(t.cardId)??void 0:u[0]??void 0}function g$1(t){for(let e of t){let r=P(e);if(r)return r}return u[0]??void 0}function _(t,e$2={}){if(!t||t.length===0)return;let r=e(t),n={kind:"notification-batch",category:"batch",notifications:r},o=e$2.ctx??g$1(r);if(e$2.appendState!==false&&o&&e$1(o.notification,n),e$2.broadcastSse!==false){let s=r.filter(c=>c.kind==="message_enqueued"),i=r.filter(c=>c.kind!=="message_enqueued");i.length>0&&V.broadcastNotificationBatch(i),s.length>0&&l$2.broadcastNotificationBatch(s);}if(!(e$2.mirrorExternal===false||!o?.boardAdapter.publishBoardChangeNotifications))try{let s=r.filter(i=>i.category==="board-output"||i.category==="card-store");s.length>0&&o.boardAdapter.publishBoardChangeNotifications(s);}catch{}}function O(t,e){_(t,{ctx:e,appendState:true,broadcastSse:true,mirrorExternal:true});}async function at(t){if(!t||t.notificationTeardown||!M||!t.notifyRef)return;let e=await M.subscribe(t.notifyRef,r=>{let n=a$8(r);_(n,{ctx:t,appendState:true,broadcastSse:true,mirrorExternal:false});});t.notificationTeardown=e;}async function fe(t){if(!t||t.initialized)return;let e={boardRuntimeStoreRef:t.boardRuntimeStoreRef,cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef,fetchedSourcesStoreRef:t.fetchedSourcesStoreRef,artifactsStoreRef:t.artifactsStoreRef,queueStoreRef:t.queueStoreRef,chatStoreRef:t.chatStoreRef,scratchStoreRef:t.scratchStoreRef},r={};t.taskExecutorRef&&(r["task-executor-ref"]=t.taskExecutorRef),t.chatHandlerFlow!==void 0&&(r["chat-handler-flow"]=t.chatHandlerFlow);let n=await t.boardOps.init({params:e,body:r});if(n.status!=="success")throw Object.assign(new Error(n.error||`init failed for ${t.label}`),{statusCode:500});if(await at(t),!t.chatHandlerFlow&&t.chatHandlerRef&&W.describe)try{let o=await W.describe(t.chatHandlerRef);o&&o.kind!=="chat-handler"?v.warn(`[init] chat-handler describe returned kind="${o.kind}", expected "chat-handler" for ${t.label}`):o&&v.info(`[init] chat-handler validated: ${o.name} (protocol ${o.protocolVersion}) for ${t.label}`);}catch(o){v.warn(`[init] chat-handler describe failed for ${t.label}: ${o?.message||String(o)}`);}t.initialized=true;}async function ut(t){let e=[],r=await t.boardOps.status({});r.status==="success"&&r.data!=null&&d$1(r.data)&&e.push({kind:"status",status:r.data});let n=await t.boardOps.getAllOutputsDataObjects({});if(n.status==="success"&&n.data!=null)for(let[s,i]of Object.entries(n.data))s&&e.push({kind:"data_object",key:s,payload:i});let o=await t.boardOps.getAllOutputsComputedValues({});if(o.status==="success"&&o.data!=null)for(let[s,i]of Object.entries(o.data))s&&i&&typeof i=="object"&&!Array.isArray(i)&&e.push({kind:"computed_values",cardId:s,values:i});e.length>0&&_(e,{ctx:t,appendState:true,broadcastSse:true,mirrorExternal:false});}async function Rt(t,e){if(!t||t.cardsBootstrapped)return;let r=await t.cardStoreOps.get({}),n=r.status==="success"&&Array.isArray(r.data?.cards)?r.data.cards:[];for(let o of n)typeof o.id=="string"&&(k$1.set(o.id,e),await t.boardOps.upsertCard({params:{cardId:o.id}}));t.cardsBootstrapped=true;}async function G(){for(let t of u)await fe(t);}async function st(){await G();for(let t=0;t<u.length;t++)await ut(u[t]),await Rt(u[t],t),await ut(u[t]);}async function yt(t=false){t||await G();for(let e of u){let r=await e.board.processAccumulatedEvents({});if(r.status!=="success")return r}return {status:"success"}}function z$1(t){return u[x(t)]??null}async function X(t){let e=z$1(t);if(!e)return null;let r=await e.cardStoreOps.get({params:{id:t}});if(r.status!=="success")return null;let n=Array.isArray(r.data?.cards)?r.data.cards:[];return n.length>0?n[0]:null}async function pe(){let t=async r=>{if(!r)return [];let n=await r.cardStoreOps.get({});return n.status!=="success"||!Array.isArray(n.data?.cards)?[]:n.data.cards},e=[];for(let r of u)e.push(...await t(r));return e}function ht(){return u[0]??null}function me(t){return z$1(t)??ht()}function U(t){let e=me(t);if(!e)throw Object.assign(new Error(`Board context is unavailable for chat operations: ${t}`),{statusCode:404});return e.chatStorage}async function ge(t){return await U(t).isProcessing(t)}async function Y(t,e){let r=await tt.setProcessing({params:{cardId:t},body:{active:e}});if(r.status!=="success")throw Object.assign(new Error(r.error||`Failed to set chat processing for card: ${t}`),{statusCode:500})}let tt=a$1({append(t,e,r,n,o){return U(t).append(t,e,r,n,o)},readAll(t){return U(t).readAll(t)},readAfter(t,e){return U(t).readAfter(t,e)},clear(t){return U(t).clear(t)},setProcessing(t,e){return U(t).setProcessing(t,e)},isProcessing(t){return U(t).isProcessing(t)},getConfig(t){return U(t).getConfig(t)},setConfig(t,e){return U(t).setConfig(t,e)}},{emitNotification(t){if(t.kind==="notification-batch"){O(t.notifications);return}O([t]);}}),wt=p({boardContexts:u,cardOwnerIndex:k$1,cardContextForCard:t=>z$1(t),readStatusSnapshot:()=>be(),readDataObjectsByToken:()=>Ce(),readCardRuntimeArtifacts:()=>Se(),readCardFromStore:t=>X(t),readCardDefinitions:()=>pe(),processAccumulatedLaneInternal:t=>yt(t),reportSourceFetched:(t,e)=>kt(t,{ref:e}),reportSourceFetchFailure:(t,e)=>Pt(t,{reason:e}),uploadCardFile:(t,e,r,n,o)=>Ct(t,e,r,n,o),chatStorePublic:tt,serverUrl:I,apiBasePath:h$1}),Re=wt.mcpCardStoreFacade,it=wt.createMcpFacade,ye=j({boardId:F,bootstrapBoard:()=>st(),sseHub:V,onChannelSubscribed:H,onChannelUnsubscribed:B,getMcpFacade:()=>it(),getMcpCardStoreFacade:()=>Re()});function he(t){return m(t)}function we(){return n(it())}function bt(){return o({boardId:F,uploadCardFile:Ct,getMcpFacade:()=>it(),controlplane:ye})}let ct=k({boardId:F,boardContexts:u,readChatRecords:t=>Fe(t),getChatProcessing:t=>ge(t)}),be=ct.readStatusSnapshot,Se=ct.readCardRuntimeArtifacts,Ce=ct.readDataObjectsByToken,dt=ct.buildPublishedRuntimePayload;async function St(t,e,r){let n=r?.syncBoard!==false,o=r?.restartOnlyIfChanged===true,s=z$1(t);if(!s)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let i=await X(t);if(!i)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let c=o?JSON.stringify(i):null,D=e(i)||i;if(o&&JSON.stringify(D)===c)return;let y=await s.cardStoreOps.set({body:D});if(y.status!=="success")throw Object.assign(new Error(y.error||`Failed to persist card: ${t}`),{statusCode:500});if(n){let q=await s.boardOps.upsertCard({params:{cardId:t,restart:true}});if(q.status!=="success")throw Object.assign(new Error(q.error||`Failed to upsert card: ${t}`),{statusCode:500})}}async function Ae(t,e){await St(t,e,{syncBoard:true});}async function Be(t,e){await St(t,e,{syncBoard:false});}async function ke(t){let e=z$1(t);if(!e)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});if(!await X(t))throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let n=await e.boardOps.upsertCard({params:{cardId:t,restart:true}});if(n.status!=="success")throw Object.assign(new Error(n.error||`Failed to retrigger card: ${t}`),{statusCode:500})}async function Pe(t){let e=await tt.clear({params:{cardId:t}});if(e.status!=="success")throw Object.assign(new Error(e.error||`Failed to clear chat records for card: ${t}`),{statusCode:500});try{await Y(t,!1);}catch{}}async function Oe(t,e,r,n,o=""){let s=typeof r=="string"?r.trim():"",i=await tt.append({params:{cardId:t},body:{role:e||"system",text:s,files:n,turn:o}});if(i.status!=="success")throw Object.assign(new Error(i.error||`Failed to append chat record for card: ${t}`),{statusCode:500});return String(i.data?.id||"")}async function Fe(t){return await U(t).readAll(t)}let Ct=l({safeCardId:t=>T(t),artifactsStores:t=>S(t),cardFileMetadataStore:()=>f(),readCardFromStore:t=>X(t),updateCardLocalOnly:(t,e)=>Be(t,e),writeChatRecord:(t,e,r,n,o)=>Oe(t,e,r,n,o)}).uploadCardFile;async function At(t){let e=z$1(t);if(!e)return null;let r=await e.boardOps.getConfig({params:{key:"chat-handler-flow"}}),o=(r.status==="success"?r.data?.value:null)??e.chatHandlerFlow??null,s=e.chatHandlerRef;return o==null&&(!s||typeof s!="object")?null:{ctx:e,handlerFlow:o,handlerRef:s}}function ve(t){let e=typeof t=="string"?t.trim():"";if(e.length<ot.length*2||!e.startsWith(ot)||!e.endsWith(ot))return null;let r=e.slice(ot.length,e.length-ot.length).trim(),n=/^([A-Za-z0-9_-]+)__(.*)$/s.exec(r);return n?{assistant:n[1].trim().toLowerCase(),text:n[2].trim()}:{assistant:"echo",text:r}}async function xe(t,e,r=false,n="",o=""){try{let s=await At(t);if(!s){try{await Y(t,!1);}catch{}return}let{ctx:i,handlerFlow:c,handlerRef:D}=s;if(!r)try{await Y(t,!0);}catch{}let y={boardId:F,cardId:String(t),lastChatEntryId:e,...n?{turnId:n}:{},...typeof o=="string"&&o.trim()?{probe:o.trim()}:{},...E,...I?{serverUrl:I}:{}},q=c!=null?{meta:"chat-handler-flow",howToRun:"built-in",whatToRun:{kind:"built-in",value:de}}:D;a$4(i.boardAdapter)?await m$1(i,"chat-agent").enqueueRequest({boardId:F,ref:q,args:c!=null?{...y,__chatHandlerFlow:c}:y}):m$1(i,"chat-agent").enqueueRequest({boardId:F,ref:q,args:c!=null?{...y,__chatHandlerFlow:c}:y}),await Promise.resolve(i.boardAdapter.requestProcessAccumulated?.());}catch(s){try{await Y(t,!1);}catch{}v.warn(`[chat-handler] queue failed for card "${t}": ${s instanceof Error?s.message:String(s)}`);}}async function Te(t,e,r){if(e.howToRun==="built-in"&&b$2(e)===de){let n=j$1,o=r.__chatHandlerFlow,s={...r};return delete s.__chatHandlerFlow,n?n.run(o,s,{boardId:F,cardId:String(s.cardId||""),label:t.label,logger:v,serverUrl:I,executionExtra:E}):{dispatched:false,error:"chat-handler-flow configured but no chatFlowRunner was provided"}}return W.invoke(e,r)}async function Ne(t,e=false){e||await G();let r=typeof t.args?.cardId=="string"?t.args.cardId:"",n=r?z$1(r):ht();if(!n)throw new Error(r?`Board context is unavailable for chat-agent request: ${r}`:"Board context is unavailable for chat-agent request");let o=await Te(n,t.ref,t.args);if(!o.dispatched){if(r)try{await Y(r,!1);}catch{}throw new Error(o.error||`chat-agent dispatch failed for card "${r||"unknown"}"`)}}async function Ee(t,e,r){if(e==="chat-send"){let o=r&&typeof r["turn-id"]=="string"?r["turn-id"]:r&&typeof r.turnId=="string"?r.turnId:r&&typeof r.turn=="string"?r.turn:"";if(r&&"files"in r&&r.files!==void 0&&r.files!==null)throw Object.assign(new Error('chat-send does not accept a "files" parameter; upload attachments via manage.add-chat-attachment first'),{statusCode:400});let s=bt(),i=ve(r?.text),c=i?i.text:r?.text,D=await a$a("manage.add-chat-entry-and-any-attachments",{board_id:F,card_id:t,role:"user",text:c,turn_id:o,files:[]},s);if(D?.status!=="success")throw new Error(b$4(D,`chat-send append failed for card ${t}`));let y=D?.data?.id;if(typeof y!="string"||!y)throw new Error(`chat-send did not return an append id for card ${t}`);let q=await a$a("setstate.chat-processing-started",{board_id:F,card_id:t},s);if(q?.status!=="success")throw new Error(b$4(q,`chat-send processing update failed for card ${t}`));xe(t,y,true,o,i?.assistant||"");return}await Ae(t,o=>{let s=new Date().toISOString(),i=o.card_data&&typeof o.card_data=="object"?o.card_data:{};if(o.card_data=i,e==="file-upload"){let c=f().normalizeIncoming(r?.files,s);return c.length>0&&f().merge(i,c),o}if(e==="action"){let c=r&&typeof r.buttonId=="string"?r.buttonId:"";if(!c)return o;i.lastAction={buttonId:c,at:s},i.lastActionText=`${c} @ ${s}`;}return o});}function et(t,e,r){let n=JSON.stringify(r),o=typeof Buffer<"u"?Buffer.byteLength(n):new TextEncoder().encode(n).length;t.writeHead(e,{...w,"Content-Type":"application/json; charset=utf-8","Content-Length":o}),t.end(n);}async function Bt(t,e,r){let n=await X(t);if(!n)throw Object.assign(new Error("Card not found"),{statusCode:404});let o=f().resolve(n.card_data,e,r);if(!o.ok&&o.reason==="stale_reference")throw Object.assign(new Error("File reference is stale. Refresh and try again."),{statusCode:409});if(!o.ok)throw Object.assign(new Error("File not found"),{statusCode:404});let s=o.file,i=T(t),c=S(t),D=String(s.stored_name||""),y=`${i}/${D}`,q=c.files?await c.files.getBytes(y):null;if(!q)throw Object.assign(new Error("File not found"),{statusCode:404});return {fileRecord:s,bytes:q}}async function je(t,e,r,n){let{fileRecord:o,bytes:s}=await Bt(e,r,n),i=String(o.name||o.stored_name||"download.bin"),c=String(o.mime_type||"application/octet-stream");t.writeHead(200,{"Content-Type":c,"Content-Disposition":`attachment; filename="${i}"`,"Content-Length":s.length}),t.end(s);}function Me(t){let e=String(t||"").toLowerCase();return e.startsWith("text/")||e.includes("json")||e.includes("xml")||e.includes("javascript")||e.includes("typescript")||e.includes("yaml")||e.includes("csv")}function _e(t,e,r){let n=t.split(/\r?\n/);return (e==="head"?n.slice(0,r):n.slice(-r)).join(`
2
+ `)}async function rt(t){let e=[];for await(let n of t)e.push(n);let r=typeof Buffer<"u"?Buffer.concat(e).toString("utf-8").trim():new TextDecoder().decode(d$2(e)).trim();return r?JSON.parse(r):{}}async function kt(t,e){let r=typeof e.ref=="string"?e.ref.trim():"";if(!r)return {status:"fail",error:"board-worker success callback requires body.ref"};let n=u[0];return n?n.boardOps.sourceDataFetched({params:{token:t,ref:r}}):{status:"fail",error:"no board context"}}async function Pt(t,e){let r=typeof e.reason=="string"&&e.reason.trim()?e.reason:"unknown",n=u[0];return n?n.boardOps.sourceDataFetchFailure({params:{token:t,reason:r}}):{status:"fail",error:"no board context"}}let De=b({sseHub:V,queueSseHub:l$2,corsHeaders:w,json:et,buildPublishedRuntimePayload:()=>dt(),onSseClientConnected:$,onChannelSubscribed:H,onChannelUnsubscribed:B,apiBasePath:h$1,readJsonBody:t=>rt(t),initBoardAndSetup:()=>G(),bootstrapBoard:()=>st(),boardContexts:u,publishPersistedStateSnapshot:t=>ut(t),upsertCardsFromSource:(t,e)=>Rt(t,e)}).handleWatchersRoutes,qe=a$2({apiBasePath:h$1,json:et,readJsonBody:t=>rt(t),bootstrapBoard:()=>st(),createMcpFacade:()=>it(),createMcpToolRegistry:t=>he(t),resolveCardFileDownloadPayload:(t,e,r)=>Bt(t,e,r),isLikelyTextMimeType:t=>Me(t),sliceTextByLines:(t,e,r)=>_e(t,e,r)}).handleAgentfaceApi,Ie=a$3({apiBasePath:h$1,json:et,readJsonBody:t=>rt(t),initBoardAndSetup:()=>G(),createMcpWebhookToolRegistry:()=>we()}).handleWebhooksApi,$e=ce({apiBasePath:h$1,json:et,readJsonBody:t=>rt(t),initBoardAndSetup:()=>G(),bootstrapBoard:()=>st(),buildPublishedRuntimePayload:()=>dt(),createMcpControlplaneToolRegistry:()=>bt(),retriggerCard:t=>ke(t),applyCardAction:(t,e,r)=>Ee(t,e,r),resolveChatHandlerTarget:t=>At(t),sendCardFileDownloadResponse:(t,e,r,n)=>je(t,e,r,n)}).handleRuntimeApi,He=ue({apiBasePath:h$1,emitNotifications:t=>O(t),readJsonBody:t=>rt(t),json:(t,e,r)=>et(t,e,r)}).handleNotifyRoute;async function Le(t,e,r){return !!(await qe(t,e,r)||await Ie(t,e,r)||await De(t,e,r)||await He(t,e,r)||await $e(t,e,r))}return {get apiBasePath(){return h$1},get corsHeaders(){return w},get queueLaneTuning(){return L},handleRuntimeApi:Le,emitNotification(t){if(t.kind==="notification-batch"){O(t.notifications);return}O([t]);},buildPublishedRuntimePayload:dt,__drainProcessAccumulatedLane:yt,handleChatAgentRequest:Ne,clearChatRecords:Pe,reportSourceFetched(t,e){return kt(t,{ref:e})},reportSourceFetchFailure(t,e){return Pt(t,{reason:e})},get cardStore(){return u[0]?.publicCardStore??{get(){return Promise.resolve({status:"fail",error:"no board context"})},set(){return Promise.resolve({status:"fail",error:"no board context"})}}}}}function Mr(R){let h=String(R.apiBasePath||"/api/boards").replace(/\/$/,""),w={...le,...R.corsHeaders||{}},L=R.serverMetaStore,F=R.boardRuntimeFactory,v=new Map,W="boards-config.json";function j(){let l=L.getText(W);if(!l)return {boards:[{id:"default",label:"Default Board"}]};try{return JSON.parse(l)}catch{return {boards:[{id:"default",label:"Default Board"}]}}}function M(l){L.putText(W,JSON.stringify(l,null,2));}function I(l){let A=String(l||"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/^_+|_+$/g,"");return A.length>0&&A.length<=64?A:null}function E(l){if(v.has(l))return v.get(l);let u=j().boards.find(x=>x.id===l)||{},k=F(l,u);return v.set(l,k),k}function $(l,A,u){let k=JSON.stringify(u),x=typeof Buffer<"u"?Buffer.byteLength(k):new TextEncoder().encode(k).length;l.writeHead(A,{...w,"Content-Type":"application/json; charset=utf-8","Content-Length":x}),l.end(k);}async function J(l,A,u){let k=l.method||"GET",x=u.pathname;if(k==="GET"&&x===h)return $(A,200,{ok:true,boards:j().boards}),true;if(k==="POST"&&x===h){let N=[];for await(let g of l)N.push(g);let m=typeof Buffer<"u"?Buffer.concat(N).toString("utf-8").trim():new TextDecoder().decode(d$2(N)).trim(),b={};try{b=m?JSON.parse(m):{};}catch{b={};}let S=I(b.id);if(!S)return $(A,400,{error:"board id must be 1-64 alphanumeric/dash/underscore characters"}),true;let f=j();if(f.boards.some(g=>g.id===S))return $(A,409,{error:`Board "${S}" is already registered`}),true;let T=typeof b.label=="string"&&b.label.trim()?b.label.trim():S,P={id:S,label:T};for(let[g,_]of Object.entries(b))g==="id"||g==="label"||_!=null&&(P[g]=_);return f.boards.push(P),M(f),$(A,200,{ok:true,board:P}),true}return false}async function H(l,A,u){let x=u.pathname.match(new RegExp(`^${c$3(h)}/([^/]+)(/|$)`));if(!x)return false;let N=I(decodeURIComponent(x[1]));return N?j().boards.some(S=>S.id===N)?!!await E(N).handleRuntimeApi(l,A,u):($(A,404,{error:`Board "${N}" not registered. POST ${h} with {id} to register it first.`}),true):($(A,400,{error:"Invalid board id"}),true)}async function B(l,A,u){return !!(await J(l,A,u)||await H(l,A,u))}function V(l){if(!j().boards.some(u=>u.id===l))throw Object.assign(new Error(`Board "${l}" not registered`),{statusCode:404});return {service:E(l)}}return {get apiBasePath(){return h},get corsHeaders(){return w},handleApi:B,requireBoardService:V}}export{jr as a,Mr as b};//# sourceMappingURL=chunk-32GZ4ODA.js.map
3
+ //# sourceMappingURL=chunk-32GZ4ODA.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk2RIHC5TZ_cjs=require('./chunk-2RIHC5TZ.cjs');function A(d,C={}){function o(r){return {status:"success",data:r}}function e(r){return {status:"fail",error:r}}function s(r){return {status:"error",error:r instanceof Error?r.message:String(r)}}async function c(r){let t=C.emitNotification;if(!t||r.length===0)return;let n=chunk2RIHC5TZ_cjs.e(r);if(n.length===1){await t(n[0]);return}await t(chunk2RIHC5TZ_cjs.f({kind:"notification-batch",notifications:n}));}function l(r){let t=r.params?.id;if(t){let n=d.readCard(t);if(!n)throw new Error(`card "${t}" not found`);return [n]}return d.readAllCards()}function h(r){return chunk2RIHC5TZ_cjs.f({kind:"notification-batch",notifications:chunk2RIHC5TZ_cjs.e(r.map(t=>({kind:"card_refreshed",cardId:t.id,card:t})))})}function y(r){if(Array.isArray(r))return r;if(r&&typeof r=="object"){let t=r;return Array.isArray(t.files)?t.files:[r]}return null}return {get(r){try{return o({cards:l(r)})}catch(t){return s(t)}},buildNotificationBatch(r){try{return o(h(l(r)))}catch(t){return s(t)}},set(r){try{let t=r.body;if(t==null)return e("set requires a body (card object or array of cards)");let n=Array.isArray(t)?t:[t];for(let a of n){if(typeof a.id!="string")return e("each card must have a string `id` field");d.writeCard(a.id,a);}return c(n.map(a=>({kind:"card_refreshed",cardId:a.id,card:a}))),o({count:n.length})}catch(t){return s(t)}},del(r){try{let t=r.body?.ids??[],n=r.params?.id,a=n?[...t,n]:t;if(a.length===0)return e("del requires body.ids (string[]) or params.id");for(let i of a)d.removeCard(i);return c(a.map(i=>({kind:"card_removed",cardId:i}))),o({count:a.length})}catch(t){return s(t)}},patch(r){try{let t=r.params?.id,n=r.params?.path;if(!t)return e("patch requires params.id");if(!n)return e("patch requires params.path");let a=r.body,i=a&&Object.prototype.hasOwnProperty.call(a,"value")?a.value:r.body;d.patchCard(t,n,i);let u=d.readCard(t);return u?(c([{kind:"card_refreshed",cardId:t,card:u}]),o({count:1})):e(`card "${t}" not found`)}catch(t){return s(t)}},appendFiles(r){try{let t=r.params?.id;if(!t)return e("appendFiles requires params.id");let n=d.readCard(t);if(!n)return e(`card "${t}" not found`);let a=y(r.body);if(!a||a.length===0)return e("appendFiles requires a file metadata object, array, or body.files array");let i=n.card_data&&typeof n.card_data=="object"&&!Array.isArray(n.card_data)?n.card_data:{},u=Array.isArray(i.files)?i.files:[],b=[...u,...a],R=a.map((v,g)=>({idx:u.length+g,entry:v})),p=this.patch({params:{id:t,path:"card_data.files"},body:{value:b}});return p.status!=="success"?p:o({files_added:R})}catch(t){return s(t)}}}}exports.a=A;//# sourceMappingURL=chunk-5XLFPPTY.cjs.map
2
+ //# sourceMappingURL=chunk-5XLFPPTY.cjs.map
@@ -1,2 +1,2 @@
1
- 'use strict';function w(e){if(!e||typeof e!="object")return;let n=e;if(typeof n.statusCode=="number")return n.statusCode;if(typeof n.code=="number")return n.code}function l(e,n){return w(e)===n}function p(e,n,r){return n?typeof n=="function"?n(e):n:r}function A(e){return (e?.()??new Date).toISOString()}function L(e,n){if(n)return n();let r=String((e?.()??new Date).getTime()).padStart(13,"0"),o=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `${r}-${o}`}function f(e){return {id:e.id,payload:e.payload}}function B(e,n={}){return {async read(r){let o=p(r,n.partitionKey,"kv");try{return (await e.item(r,o).read()).resource?.value??null}catch(t){if(l(t,404))return null;throw t}},async write(r,o){let t=p(r,n.partitionKey,"kv");await e.items.upsert({id:r,pk:t,kind:"kv",value:o});},async delete(r){let o=p(r,n.partitionKey,"kv");try{await e.item(r,o).delete();}catch(t){if(!l(t,404))throw t}},async listKeys(r=""){let{resources:o}=await e.items.query({query:"SELECT c.id FROM c WHERE c.kind = @kind AND STARTSWITH(c.id, @prefix)",parameters:[{name:"@kind",value:"kv"},{name:"@prefix",value:r}]}).fetchAll();return o.map(t=>t.id).sort()}}}function M(e,n,r={}){let o=p(n,r.partitionKey,`journal:${n}`);return {async append(t){let a={id:L(r.now,r.idFactory),pk:o,kind:"journal",streamKey:n,createdAt:A(r.now),payload:t};return await e.items.create(a),f(a)},async readAll(){let{resources:t}=await e.items.query({query:"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:o},{name:"@streamKey",value:n}]}).fetchAll();return t.sort((a,s)=>a.id.localeCompare(s.id)).map(f)},async readAfter(t){let{resources:a}=await e.items.query({query:t?"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey AND c.id > @cursor ORDER BY c.id":"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:o},{name:"@streamKey",value:n},...t?[{name:"@cursor",value:t}]:[]]}).fetchAll(),s=a.sort((u,d)=>u.id.localeCompare(d.id));return {entries:s.map(f),newCursor:s.length>0?s[s.length-1].id:t}},async clear(){let t=await this.readAll();await Promise.all(t.map(a=>e.item(a.id,o).delete()));}}}function P(e,n,r={}){let o=r.partitionKey??"lock",t=r.holderId??`holder-${Math.random().toString(36).slice(2,10)}`,a=r.now,s=r.ttlMs??3e4;function u(){let i=a?.()??new Date;return {id:n,pk:o,kind:"lock",held:true,holderId:t,expiresAt:new Date(i.getTime()+s).toISOString(),updatedAt:i.toISOString()}}function d(i){return {...i??{id:n,pk:o,kind:"lock"},kind:"lock",held:false,holderId:t,expiresAt:null,updatedAt:A(a)}}async function g(){try{return (await e.item(n,o).read()).resource??null}catch(i){if(l(i,404))return null;throw i}}function S(i){return i?.held?i.expiresAt?Date.parse(i.expiresAt)>(a?.()??new Date).getTime():true:false}return {async tryAcquire(){let i=await g(),b=u();if(i){if(S(i))return null;try{await e.item(n,o).replace(b,i._etag?{accessCondition:{type:"IfMatch",condition:i._etag}}:void 0);}catch(c){if(l(c,412)||l(c,409))return null;throw c}}else try{await e.items.create(b);}catch(c){if(l(c,409))return null;throw c}return async()=>{let c=await g();if(!c)return;let T=d(c);try{await e.item(n,o).replace(T,c._etag?{accessCondition:{type:"IfMatch",condition:c._etag}}:void 0);}catch{}}}}}function x(e){return new TextDecoder().decode(e)}function h(e,n={}){return {async read(r){if(!await e.getBlobClient(r).exists())return null;let o=await e.getBlobClient(r).downloadToBuffer();return x(o)},async write(r,o){await e.getBlockBlobClient(r).upload(o,new TextEncoder().encode(o).byteLength,{blobHTTPHeaders:{blobContentType:n.defaultContentType??"application/json; charset=utf-8"}});},exists(r){return e.getBlobClient(r).exists()},async remove(r){await e.getBlobClient(r).deleteIfExists();},async readBytes(r){return await e.getBlobClient(r).exists()?await e.getBlobClient(r).downloadToBuffer():null},async writeBytes(r,o){await e.getBlockBlobClient(r).upload(o,o.byteLength,{blobHTTPHeaders:{blobContentType:n.defaultContentType??"application/octet-stream"}});},async listKeys(r=""){let o=[];for await(let t of e.listBlobsFlat({prefix:r}))o.push(t.name);return o.sort()},async stat(r){if(!await e.getBlobClient(r).exists())return null;let o=await e.getBlobClient(r).getProperties();return {key:r,size:Number(o.contentLength??0),updatedAt:o.lastModified?.toISOString(),contentType:o.contentType}},keyRef(r){return n.keyRef?.(r)??{kind:"azure-blob-key",value:r}},async renameKey(r,o){let t=e.getBlobClient(r);if(!await t.exists())return false;let[a,s]=await Promise.all([t.downloadToBuffer(),t.getProperties()]);return await e.getBlockBlobClient(o).upload(a,a.byteLength,{blobHTTPHeaders:{blobContentType:s.contentType??n.defaultContentType??"application/octet-stream"}}),await t.deleteIfExists(),true}}}function C(e){if(!e||typeof e!="object")return;let n=e;if(typeof n.statusCode=="number")return n.statusCode;if(typeof n.code=="number")return n.code}function y(e){let n=JSON.stringify(e),r=globalThis.Buffer;if(r)return r.from(n,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(n);throw new Error("No base64 encoder available in this runtime")}function k(e){let n=e??"",r=globalThis.Buffer;if(r)return JSON.parse(r.from(n,"base64").toString("utf-8"));if(typeof atob=="function")return JSON.parse(atob(n));throw new Error("No base64 decoder available in this runtime")}function m(e,n){return (e??n()).toISOString()}function D(e,n){return {id:String(e.messageId??""),body:k(e.messageText),enqueuedAt:m(e.insertedOn??e.insertionTime,n),attempt:Number(e.dequeueCount??0)}}function v(e,n){return {id:String(e.messageId??""),body:k(e.messageText),enqueuedAt:m(e.insertedOn??e.insertionTime,n),attempt:Number(e.dequeueCount??0),leaseToken:String(e.popReceipt??""),leaseExpiresAt:m(e.nextVisibleOn,n)}}function R(e,n={}){let r=n.now??(()=>new Date),o=new Map;return {async enqueue(t){let a=await e.sendMessage(y(t));return {id:String(a.messageId??""),body:t,enqueuedAt:m(a.insertionTime,r),attempt:0}},async enqueueMany(t){let a=[];for(let s of t)a.push(await this.enqueue(s));return a},async stage(t,a){let s=a?.dedupKey;if(s){for(let g of o.values())if(g.dedupKey===s)return null}let u=`staged:${crypto.randomUUID?.()??Math.random().toString(36).slice(2,10)}`,d={body:t,enqueuedAt:r().toISOString(),attempt:0,...s?{dedupKey:s}:{}};return o.set(u,d),{id:u,body:t,enqueuedAt:d.enqueuedAt,attempt:0}},async commitStaged(t){let a=o.get(t);return a?(o.delete(t),await e.sendMessage(y(a.body)),true):false},async discardStaged(t){return o.has(t)?(o.delete(t),true):false},async peekStaged(t=""){return Array.from(o.entries()).filter(([a])=>!t||a.startsWith(t)).map(([a,s])=>({id:a,body:s.body,enqueuedAt:s.enqueuedAt,attempt:s.attempt}))},async lease(t){return (await e.receiveMessages({numberOfMessages:t?.max,visibilityTimeout:t?.visibilityMs?Math.max(1,Math.ceil(t.visibilityMs/1e3)):void 0})).receivedMessageItems.map(s=>v(s,r))},async ack(t,a){try{return await e.deleteMessage(t,a),!0}catch(s){if(C(s)===404)return false;throw s}},async nack(t,a,s){try{if(s?.dead){if(!n.deadLetterQueueClient)return !1;let u={messageId:t,reason:s.reason??null};return await n.deadLetterQueueClient.sendMessage(y(u)),await e.deleteMessage(t,a),!0}return await e.updateMessage(t,a,y({requeued:!0}),0),!0}catch(u){if(C(u)===404)return false;throw u}},async peekActive(t=""){return (await e.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>D(s,r)).filter(s=>!t||s.id.startsWith(t))},async peekDeadLetter(t=""){return n.deadLetterQueueClient?(await n.deadLetterQueueClient.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>{let u=k(s.messageText);return {id:String(s.messageId??""),body:u,enqueuedAt:m(s.insertedOn??s.insertionTime,r),attempt:Number(s.dequeueCount??0),reason:typeof u.reason=="string"?u.reason:void 0}}).filter(s=>!t||s.id.startsWith(t)):[]}}}exports.a=B;exports.b=M;exports.c=P;exports.d=h;exports.e=R;//# sourceMappingURL=chunk-R44X3RQB.cjs.map
2
- //# sourceMappingURL=chunk-R44X3RQB.cjs.map
1
+ 'use strict';function w(e){if(!e||typeof e!="object")return;let n=e;if(typeof n.statusCode=="number")return n.statusCode;if(typeof n.code=="number")return n.code}function l(e,n){return w(e)===n}function p(e,n,r){return n?typeof n=="function"?n(e):n:r}function A(e){return (e?.()??new Date).toISOString()}function L(e,n){if(n)return n();let r=String((e?.()??new Date).getTime()).padStart(13,"0"),o=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `${r}-${o}`}function f(e){return {id:e.id,payload:e.payload}}function B(e,n={}){return {async read(r){let o=p(r,n.partitionKey,"kv");try{return (await e.item(r,o).read()).resource?.value??null}catch(t){if(l(t,404))return null;throw t}},async write(r,o){let t=p(r,n.partitionKey,"kv");await e.items.upsert({id:r,pk:t,kind:"kv",value:o});},async delete(r){let o=p(r,n.partitionKey,"kv");try{await e.item(r,o).delete();}catch(t){if(!l(t,404))throw t}},async listKeys(r=""){let{resources:o}=await e.items.query({query:"SELECT c.id FROM c WHERE c.kind = @kind AND STARTSWITH(c.id, @prefix)",parameters:[{name:"@kind",value:"kv"},{name:"@prefix",value:r}]}).fetchAll();return o.map(t=>t.id).sort()}}}function P(e,n,r={}){let o=p(n,r.partitionKey,`journal:${n}`);return {async append(t){let a={id:L(r.now,r.idFactory),pk:o,kind:"journal",streamKey:n,createdAt:A(r.now),payload:t};return await e.items.create(a),f(a)},async readAll(){let{resources:t}=await e.items.query({query:"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:o},{name:"@streamKey",value:n}]}).fetchAll();return t.sort((a,s)=>a.id.localeCompare(s.id)).map(f)},async readAfter(t){let{resources:a}=await e.items.query({query:t?"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey AND c.id > @cursor ORDER BY c.id":"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:o},{name:"@streamKey",value:n},...t?[{name:"@cursor",value:t}]:[]]}).fetchAll(),s=a.sort((u,d)=>u.id.localeCompare(d.id));return {entries:s.map(f),newCursor:s.length>0?s[s.length-1].id:t}},async clear(){let t=await this.readAll();await Promise.all(t.map(a=>e.item(a.id,o).delete()));}}}function x(e,n,r={}){let o=r.partitionKey??"lock",t=r.holderId??`holder-${Math.random().toString(36).slice(2,10)}`,a=r.now,s=r.ttlMs??3e4;function u(){let i=a?.()??new Date;return {id:n,pk:o,kind:"lock",held:true,holderId:t,expiresAt:new Date(i.getTime()+s).toISOString(),updatedAt:i.toISOString()}}function d(i){return {...i??{id:n,pk:o,kind:"lock"},kind:"lock",held:false,holderId:t,expiresAt:null,updatedAt:A(a)}}async function g(){try{return (await e.item(n,o).read()).resource??null}catch(i){if(l(i,404))return null;throw i}}function S(i){return i?.held?i.expiresAt?Date.parse(i.expiresAt)>(a?.()??new Date).getTime():true:false}return {async tryAcquire(){let i=await g(),k=u();if(i){if(S(i))return null;try{await e.item(n,o).replace(k,i._etag?{accessCondition:{type:"IfMatch",condition:i._etag}}:void 0);}catch(c){if(l(c,412)||l(c,409))return null;throw c}}else try{await e.items.create(k);}catch(c){if(l(c,409))return null;throw c}return async()=>{let c=await g();if(!c)return;let T=d(c);try{await e.item(n,o).replace(T,c._etag?{accessCondition:{type:"IfMatch",condition:c._etag}}:void 0);}catch{}}}}}function M(e){return new TextDecoder().decode(e)}function h(e,n={}){return {async read(r){if(!await e.getBlobClient(r).exists())return null;let o=await e.getBlobClient(r).downloadToBuffer();return M(o)},async write(r,o){await e.getBlockBlobClient(r).upload(o,new TextEncoder().encode(o).byteLength,{blobHTTPHeaders:{blobContentType:n.defaultContentType??"application/json; charset=utf-8"}});},exists(r){return e.getBlobClient(r).exists()},async remove(r){await e.getBlobClient(r).deleteIfExists();},async readBytes(r){return await e.getBlobClient(r).exists()?await e.getBlobClient(r).downloadToBuffer():null},async writeBytes(r,o){await e.getBlockBlobClient(r).upload(o,o.byteLength,{blobHTTPHeaders:{blobContentType:n.defaultContentType??"application/octet-stream"}});},async listKeys(r=""){let o=[];for await(let t of e.listBlobsFlat({prefix:r}))o.push(t.name);return o.sort()},async stat(r){if(!await e.getBlobClient(r).exists())return null;let o=await e.getBlobClient(r).getProperties();return {key:r,size:Number(o.contentLength??0),updatedAt:o.lastModified?.toISOString(),contentType:o.contentType}},keyRef(r){return n.keyRef?.(r)??{kind:"azure-blob-key",value:r}},async renameKey(r,o){let t=e.getBlobClient(r);if(!await t.exists())return false;let[a,s]=await Promise.all([t.downloadToBuffer(),t.getProperties()]);return await e.getBlockBlobClient(o).upload(a,a.byteLength,{blobHTTPHeaders:{blobContentType:s.contentType??n.defaultContentType??"application/octet-stream"}}),await t.deleteIfExists(),true}}}function C(e){if(!e||typeof e!="object")return;let n=e;if(typeof n.statusCode=="number")return n.statusCode;if(typeof n.code=="number")return n.code}function y(e){let n=JSON.stringify(e),r=globalThis.Buffer;if(r)return r.from(n,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(n);throw new Error("No base64 encoder available in this runtime")}function b(e){let n=e??"",r=globalThis.Buffer;if(r)return JSON.parse(r.from(n,"base64").toString("utf-8"));if(typeof atob=="function")return JSON.parse(atob(n));throw new Error("No base64 decoder available in this runtime")}function m(e,n){return (e??n()).toISOString()}function D(e,n){return {id:String(e.messageId??""),body:b(e.messageText),enqueuedAt:m(e.insertedOn??e.insertionTime,n),attempt:Number(e.dequeueCount??0)}}function v(e,n){return {id:String(e.messageId??""),body:b(e.messageText),enqueuedAt:m(e.insertedOn??e.insertionTime,n),attempt:Number(e.dequeueCount??0),leaseToken:String(e.popReceipt??""),leaseExpiresAt:m(e.nextVisibleOn,n)}}function R(e,n={}){let r=n.now??(()=>new Date),o=new Map;return {async enqueue(t){let a=await e.sendMessage(y(t));return {id:String(a.messageId??""),body:t,enqueuedAt:m(a.insertionTime,r),attempt:0}},async enqueueMany(t){let a=[];for(let s of t)a.push(await this.enqueue(s));return a},async stage(t,a){let s=a?.dedupKey;if(s){for(let g of o.values())if(g.dedupKey===s)return null}let u=`staged:${crypto.randomUUID?.()??Math.random().toString(36).slice(2,10)}`,d={body:t,enqueuedAt:r().toISOString(),attempt:0,...s?{dedupKey:s}:{}};return o.set(u,d),{id:u,body:t,enqueuedAt:d.enqueuedAt,attempt:0}},async commitStaged(t){let a=o.get(t);return a?(o.delete(t),await e.sendMessage(y(a.body)),true):false},async discardStaged(t){return o.has(t)?(o.delete(t),true):false},async peekStaged(t=""){return Array.from(o.entries()).filter(([a])=>!t||a.startsWith(t)).map(([a,s])=>({id:a,body:s.body,enqueuedAt:s.enqueuedAt,attempt:s.attempt}))},async lease(t){return (await e.receiveMessages({numberOfMessages:t?.max,visibilityTimeout:t?.visibilityMs?Math.max(1,Math.ceil(t.visibilityMs/1e3)):void 0})).receivedMessageItems.map(s=>v(s,r))},async ack(t,a){try{return await e.deleteMessage(t,a),!0}catch(s){if(C(s)===404)return false;throw s}},async nack(t,a,s){try{if(s?.dead){if(!n.deadLetterQueueClient)return !1;let u={messageId:t,reason:s.reason??null};return await n.deadLetterQueueClient.sendMessage(y(u)),await e.deleteMessage(t,a),!0}return await e.updateMessage(t,a,y({requeued:!0}),0),!0}catch(u){if(C(u)===404)return false;throw u}},async peekActive(t=""){return (await e.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>D(s,r)).filter(s=>!t||s.id.startsWith(t))},async peekDeadLetter(t=""){return n.deadLetterQueueClient?(await n.deadLetterQueueClient.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>{let u=b(s.messageText);return {id:String(s.messageId??""),body:u,enqueuedAt:m(s.insertedOn??s.insertionTime,r),attempt:Number(s.dequeueCount??0),reason:typeof u.reason=="string"?u.reason:void 0}}).filter(s=>!t||s.id.startsWith(t)):[]}}}exports.a=B;exports.b=P;exports.c=x;exports.d=h;exports.e=R;//# sourceMappingURL=chunk-6EJRZHFP.cjs.map
2
+ //# sourceMappingURL=chunk-6EJRZHFP.cjs.map
@@ -1,2 +1,2 @@
1
- import {b,c as c$1}from'./chunk-ANKA7HEJ.js';import {b as b$1}from'./chunk-44L64VQ2.js';function c(e){return {messageId:e.id,enqueuedAt:e.enqueuedAt,attempt:e.attempt,request:e.body}}function l(e){return typeof e=="string"?e.startsWith("b64:")?b$1(e).value:e:e.value}function m(e){return {async enqueueRequest(t){return (await e.enqueue(t)).id},async leaseRequests(t){return (await e.lease(t)).map(r=>({...c(r),leaseToken:r.leaseToken,leaseExpiresAt:r.leaseExpiresAt}))},ackRequest(t,r){return e.ack(t,r)},nackRequest(t,r,a){return e.nack(t,r,a)},async peekActive(){return (await e.peekActive()).map(c)},async peekDeadLetter(){return (await e.peekDeadLetter()).map(t=>({...c(t),reason:t.reason}))}}}function h(e){async function t(r){let a=await e.read(r);return a==null?null:typeof a=="string"?a:JSON.stringify(a)}return {async readTaskExecutorRef(){let r=await t("task-executor");if(r?.trim())return c$1(r.trim())},writeTaskExecutorRef(r){return e.write("task-executor",b(r))},readChatHandlerFlow(){return e.read("chat-handler-flow")},writeChatHandlerFlow(r){return e.write("chat-handler-flow",r)},readBoardRuntimeStoreRef(){return t("board-runtime-store-ref")},writeBoardRuntimeStoreRef(r){return e.write("board-runtime-store-ref",r)},readCardStoreRef(){return t("card-store-ref")},writeCardStoreRef(r){return e.write("card-store-ref",r)},readOutputsStoreRef(){return t("outputs-store-ref")},writeOutputsStoreRef(r){return e.write("outputs-store-ref",r)},readQueueStoreRef(){return t("queue-store-ref")},writeQueueStoreRef(r){return e.write("queue-store-ref",r)},readScratchStoreRef(){return t("scratch-store-ref")},writeScratchStoreRef(r){return e.write("scratch-store-ref",r)},readChatStoreRef(){return t("chat-store-ref")},writeChatStoreRef(r){return e.write("chat-store-ref",r)},readArtifactsStoreRef(){return t("artifacts-store-ref")},writeArtifactsStoreRef(r){return e.write("artifacts-store-ref",r)},readFetchedSourcesStoreRef(){return t("fetched-sources-store-ref")},writeFetchedSourcesStoreRef(r){return e.write("fetched-sources-store-ref",r)}}}function y(e){let t=e.callbackTransport,r=e.resolveBlob??(async o=>{let s=await e.blobStorage("").read(o.value);if(s==null)throw new Error(`Blob not found for ref ${o.kind}:${o.value}`);return s});async function a(o,s){if(o.howToRun==="queue-storage")return e.queueStoreRef?(await m(e.queueStorageForRef(e.queueStoreRef,"task-executor")).enqueueRequest({boardId:typeof o.extra?.boardId=="string"?o.extra.boardId:e.boardId,ref:o,args:s}),{dispatched:true}):{dispatched:false,error:"queue-storage dispatch requires queueStoreRef"};if(o.howToRun==="http:post"){let n=e.fetch??globalThis.fetch;if(!n)return {dispatched:false,error:"http:post dispatch requires fetch support"};let i=await n(l(o.whatToRun),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,...o.extra?{extra:o.extra}:{}})});if(!i.ok){let g=await i.text().catch(()=>"");return {dispatched:false,error:`HTTP ${i.status}: ${g}`}}return {dispatched:true}}return {dispatched:false,error:`Unsupported hosted async transport "${o.howToRun}"`}}return {kvStorage:e.kvStorage,kvStorageForRef:e.kvStorageForRef,blobStorage:e.blobStorage,blobStorageForRef:e.blobStorageForRef,chatStorageForRef:e.chatStorageForRef,queueStorageForRef:e.queueStorageForRef,scratchStorage:e.scratchStorage,scratchStorageForRef:e.scratchStorageForRef,archiveFactory:e.archiveFactory,archiveFactoryForRef:e.archiveFactoryForRef,journalStorage:e.journalStorage,journalStorageForRef:e.journalStorageForRef,lock:e.lock,get callbackTransport(){return t},set callbackTransport(o){t=o;},dispatchExecution:(o,s)=>e.dispatchExecution?.(o,s)??a(o,s),supportsDirectSourceOutput:e.supportsDirectSourceOutput,resolveBlob:r,hashFn:e.hashFn,genId:e.genId,requestProcessAccumulated:e.requestProcessAccumulated,publishBoardChangeNotifications:e.publishBoardChangeNotifications,warn:e.onWarn}}export{m as a,h as b,y as c};//# sourceMappingURL=chunk-NNSBBO5R.js.map
2
- //# sourceMappingURL=chunk-NNSBBO5R.js.map
1
+ import {b,c as c$1}from'./chunk-ANKA7HEJ.js';import {b as b$1}from'./chunk-44L64VQ2.js';function c(e){return {messageId:e.id,enqueuedAt:e.enqueuedAt,attempt:e.attempt,request:e.body}}function l(e){return typeof e=="string"?e.startsWith("b64:")?b$1(e).value:e:e.value}function m(e){return {async enqueueRequest(t){return (await e.enqueue(t)).id},async leaseRequests(t){return (await e.lease(t)).map(r=>({...c(r),leaseToken:r.leaseToken,leaseExpiresAt:r.leaseExpiresAt}))},ackRequest(t,r){return e.ack(t,r)},nackRequest(t,r,a){return e.nack(t,r,a)},async peekActive(){return (await e.peekActive()).map(c)},async peekDeadLetter(){return (await e.peekDeadLetter()).map(t=>({...c(t),reason:t.reason}))}}}function h(e){async function t(r){let a=await e.read(r);return a==null?null:typeof a=="string"?a:JSON.stringify(a)}return {async readTaskExecutorRef(){let r=await t("task-executor");if(r?.trim())return c$1(r.trim())},writeTaskExecutorRef(r){return e.write("task-executor",b(r))},readChatHandlerFlow(){return e.read("chat-handler-flow")},writeChatHandlerFlow(r){return e.write("chat-handler-flow",r)},readBoardRuntimeStoreRef(){return t("board-runtime-store-ref")},writeBoardRuntimeStoreRef(r){return e.write("board-runtime-store-ref",r)},readCardStoreRef(){return t("card-store-ref")},writeCardStoreRef(r){return e.write("card-store-ref",r)},readOutputsStoreRef(){return t("outputs-store-ref")},writeOutputsStoreRef(r){return e.write("outputs-store-ref",r)},readQueueStoreRef(){return t("queue-store-ref")},writeQueueStoreRef(r){return e.write("queue-store-ref",r)},readScratchStoreRef(){return t("scratch-store-ref")},writeScratchStoreRef(r){return e.write("scratch-store-ref",r)},readChatStoreRef(){return t("chat-store-ref")},writeChatStoreRef(r){return e.write("chat-store-ref",r)},readArtifactsStoreRef(){return t("artifacts-store-ref")},writeArtifactsStoreRef(r){return e.write("artifacts-store-ref",r)},readFetchedSourcesStoreRef(){return t("fetched-sources-store-ref")},writeFetchedSourcesStoreRef(r){return e.write("fetched-sources-store-ref",r)}}}function y(e){let t=e.callbackTransport,r=e.resolveBlob??(async o=>{let s=await e.blobStorage("").read(o.value);if(s==null)throw new Error(`Blob not found for ref ${o.kind}:${o.value}`);return s});async function a(o,s){if(o.howToRun==="queue-storage")return e.queueStoreRef?(await m(e.queueStorageForRef(e.queueStoreRef,"task-executor")).enqueueRequest({boardId:typeof o.extra?.boardId=="string"?o.extra.boardId:e.boardId,ref:o,args:s}),{dispatched:true}):{dispatched:false,error:"queue-storage dispatch requires queueStoreRef"};if(o.howToRun==="http:post"){let n=e.fetch??globalThis.fetch;if(!n)return {dispatched:false,error:"http:post dispatch requires fetch support"};let i=await n(l(o.whatToRun),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,...o.extra?{extra:o.extra}:{}})});if(!i.ok){let g=await i.text().catch(()=>"");return {dispatched:false,error:`HTTP ${i.status}: ${g}`}}return {dispatched:true}}return {dispatched:false,error:`Unsupported hosted async transport "${o.howToRun}"`}}return {kvStorage:e.kvStorage,kvStorageForRef:e.kvStorageForRef,blobStorage:e.blobStorage,blobStorageForRef:e.blobStorageForRef,chatStorageForRef:e.chatStorageForRef,queueStorageForRef:e.queueStorageForRef,scratchStorage:e.scratchStorage,scratchStorageForRef:e.scratchStorageForRef,archiveFactory:e.archiveFactory,archiveFactoryForRef:e.archiveFactoryForRef,journalStorage:e.journalStorage,journalStorageForRef:e.journalStorageForRef,lock:e.lock,get callbackTransport(){return t},set callbackTransport(o){t=o;},dispatchExecution:(o,s)=>e.dispatchExecution?.(o,s)??a(o,s),supportsDirectSourceOutput:e.supportsDirectSourceOutput,resolveBlob:r,hashFn:e.hashFn,genId:e.genId,requestProcessAccumulated:e.requestProcessAccumulated,publishBoardChangeNotifications:e.publishBoardChangeNotifications,warn:e.onWarn}}export{m as a,h as b,y as c};//# sourceMappingURL=chunk-6MD6FVE3.js.map
2
+ //# sourceMappingURL=chunk-6MD6FVE3.js.map