yaml-flow 8.7.0 → 8.7.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 (107) hide show
  1. package/browser/adapters/firestore-storage.js +2 -2
  2. package/browser/asset-integrity.json +7 -7
  3. package/browser/live-cards.schema.json +10 -1
  4. package/browser/server-runtime-controlface.js +4 -4
  5. package/examples/board/demo-shell-with-server.html +2 -2
  6. package/examples/board/doc.html +2 -2
  7. package/examples/board/server/board-server.js +1 -1
  8. package/examples/board/test/server-http-test.js +73 -79
  9. package/examples/board-firestore/server/worker.js +1 -1
  10. package/lib/artifacts-store-public.d.cts +1 -1
  11. package/lib/artifacts-store-public.d.ts +1 -1
  12. package/lib/board-live-cards-mcp.cjs +1 -1
  13. package/lib/board-live-cards-mcp.d.cts +2 -1
  14. package/lib/board-live-cards-mcp.d.ts +2 -1
  15. package/lib/board-live-cards-mcp.js +1 -1
  16. package/lib/board-live-cards-node.cjs +8 -8
  17. package/lib/board-live-cards-node.d.cts +9 -8
  18. package/lib/board-live-cards-node.d.ts +9 -8
  19. package/lib/board-live-cards-node.js +8 -8
  20. package/lib/{board-live-cards-public-D-DJek3X.d.ts → board-live-cards-public-JNRKfBZy.d.ts} +1 -1
  21. package/lib/{board-live-cards-public-DQzPe7A9.d.cts → board-live-cards-public-LlVUQPL2.d.cts} +1 -1
  22. package/lib/{board-live-cards-public-async-CgMCYYft.d.cts → board-live-cards-public-async-Di9QB141.d.cts} +2 -2
  23. package/lib/{board-live-cards-public-async-3hUuHxDx.d.ts → board-live-cards-public-async-fwd1QI82.d.ts} +2 -2
  24. package/lib/board-live-cards-public.cjs +1 -1
  25. package/lib/board-live-cards-public.d.cts +1 -1
  26. package/lib/board-live-cards-public.d.ts +1 -1
  27. package/lib/board-live-cards-public.js +1 -1
  28. package/lib/board-live-cards-server-runtime.cjs +1 -1
  29. package/lib/board-live-cards-server-runtime.d.cts +4 -4
  30. package/lib/board-live-cards-server-runtime.d.ts +4 -4
  31. package/lib/board-live-cards-server-runtime.js +1 -1
  32. package/lib/board-livegraph-runtime/index.cjs +1 -1
  33. package/lib/board-livegraph-runtime/index.js +1 -1
  34. package/lib/{board-platform-adapter-async-DOfEq_HC.d.cts → board-platform-adapter-async-BfHmHdx2.d.cts} +1 -1
  35. package/lib/{board-platform-adapter-async-JZPCzZnH.d.ts → board-platform-adapter-async-DYahVzIK.d.ts} +1 -1
  36. package/lib/card-compute/index.cjs +1 -1
  37. package/lib/card-compute/index.js +1 -1
  38. package/lib/card-store-public.d.cts +1 -1
  39. package/lib/card-store-public.d.ts +1 -1
  40. package/lib/card-validation.cjs +1 -1
  41. package/lib/card-validation.js +1 -1
  42. package/lib/chat-store-public.d.cts +1 -1
  43. package/lib/chat-store-public.d.ts +1 -1
  44. package/lib/chunk-3KC6LBOG.js +3 -0
  45. package/lib/chunk-76C7N4YT.js +3 -0
  46. package/lib/chunk-ASR44K7H.cjs +3 -0
  47. package/lib/chunk-EZENHAVZ.cjs +2 -0
  48. package/lib/chunk-FO4KNVU7.cjs +2 -0
  49. package/lib/chunk-HWYMZK3N.cjs +3 -0
  50. package/lib/{chunk-H5HBXPOI.cjs → chunk-J6EGN6S4.cjs} +3 -3
  51. package/lib/chunk-JH37NJGP.js +3 -0
  52. package/lib/chunk-JJL5VOQZ.cjs +3 -0
  53. package/lib/chunk-PBOQ4HYB.cjs +2 -0
  54. package/lib/{chunk-VMW4Z6EF.js → chunk-PRKRXAVN.js} +3 -3
  55. package/lib/chunk-QJVR3FWQ.js +2 -0
  56. package/lib/chunk-YBYXCFAI.js +2 -0
  57. package/lib/chunk-ZCNN6XPV.js +2 -0
  58. package/lib/cloud-storage.cjs +1 -1
  59. package/lib/cloud-storage.d.cts +3 -3
  60. package/lib/cloud-storage.d.ts +3 -3
  61. package/lib/cloud-storage.js +1 -1
  62. package/lib/continuous-event-graph/index.cjs +1 -1
  63. package/lib/continuous-event-graph/index.js +1 -1
  64. package/lib/firestore-storage/index.cjs +2 -2
  65. package/lib/firestore-storage/index.d.cts +17 -4
  66. package/lib/firestore-storage/index.d.ts +17 -4
  67. package/lib/firestore-storage/index.js +2 -2
  68. package/lib/index.cjs +2 -2
  69. package/lib/index.js +1 -1
  70. package/lib/localstorage-storage/index.cjs +1 -1
  71. package/lib/localstorage-storage/index.d.cts +2 -2
  72. package/lib/localstorage-storage/index.d.ts +2 -2
  73. package/lib/localstorage-storage/index.js +1 -1
  74. package/lib/server-jobs-queue-runner/index.d.cts +4 -4
  75. package/lib/server-jobs-queue-runner/index.d.ts +4 -4
  76. package/lib/server-runtime/index.cjs +1 -1
  77. package/lib/server-runtime/index.d.cts +5 -5
  78. package/lib/server-runtime/index.d.ts +5 -5
  79. package/lib/server-runtime/index.js +1 -1
  80. package/lib/server-runtime-agentface/index.d.cts +4 -4
  81. package/lib/server-runtime-agentface/index.d.ts +4 -4
  82. package/lib/server-runtime-controlface/index.cjs +1 -1
  83. package/lib/server-runtime-controlface/index.d.cts +16 -67
  84. package/lib/server-runtime-controlface/index.d.ts +16 -67
  85. package/lib/server-runtime-controlface/index.js +1 -1
  86. package/lib/server-runtime-core/index.cjs +1 -1
  87. package/lib/server-runtime-core/index.d.cts +8 -6
  88. package/lib/server-runtime-core/index.d.ts +8 -6
  89. package/lib/server-runtime-core/index.js +1 -1
  90. package/lib/server-runtime-watchers/index.d.cts +4 -4
  91. package/lib/server-runtime-watchers/index.d.ts +4 -4
  92. package/lib/server-runtime-webhooks/index.d.cts +4 -4
  93. package/lib/server-runtime-webhooks/index.d.ts +4 -4
  94. package/lib/{types-BzQY45dH.d.cts → types-Ba8H5_Wo.d.cts} +6 -4
  95. package/lib/{types-CF2xUcZW.d.ts → types-SO5OZm4s.d.ts} +6 -4
  96. package/package.json +1 -1
  97. package/schema/live-cards.schema.json +10 -1
  98. package/lib/chunk-DDYSXP2A.cjs +0 -3
  99. package/lib/chunk-J5J6BG7B.js +0 -2
  100. package/lib/chunk-M3OU6IS5.cjs +0 -2
  101. package/lib/chunk-M6STQR5F.cjs +0 -2
  102. package/lib/chunk-N6P2JW4W.js +0 -3
  103. package/lib/chunk-NMZ6XNLB.cjs +0 -3
  104. package/lib/chunk-OEFTOO47.cjs +0 -3
  105. package/lib/chunk-PRHQBGPT.js +0 -2
  106. package/lib/chunk-VLBB3D6B.js +0 -3
  107. package/lib/chunk-ZXQR7GHT.js +0 -3
@@ -1,6 +1,6 @@
1
1
  import { a as KindValueRef } from './storage-interface-BFiD3kyB.js';
2
- import { C as CommandInput, a as CommandResult, g as BoardStatusObject } from './board-live-cards-public-D-DJek3X.js';
3
- import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-JZPCzZnH.js';
2
+ import { C as CommandInput, a as CommandResult, h as BoardStatusObject } from './board-live-cards-public-JNRKfBZy.js';
3
+ import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-DYahVzIK.js';
4
4
 
5
5
  interface AsyncBoardLiveCardsPublic {
6
6
  init(input: CommandInput): Promise<CommandResult>;
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkOEFTOO47_cjs=require('./chunk-OEFTOO47.cjs');require('./chunk-U2N6MCD5.cjs'),require('./chunk-SFVO2LB2.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-NMZ6XNLB.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"BOARD_GRAPH_KEY",{enumerable:true,get:function(){return chunkOEFTOO47_cjs.n}});Object.defineProperty(exports,"EMPTY_CONFIG",{enumerable:true,get:function(){return chunkOEFTOO47_cjs.u}});Object.defineProperty(exports,"SNAPSHOT_SCHEMA_VERSION_V1",{enumerable:true,get:function(){return chunkOEFTOO47_cjs.m}});Object.defineProperty(exports,"createBoardLiveCardsNonCorePublic",{enumerable:true,get:function(){return chunkOEFTOO47_cjs.z}});Object.defineProperty(exports,"createBoardLiveCardsPublic",{enumerable:true,get:function(){return chunkOEFTOO47_cjs.y}});//# sourceMappingURL=board-live-cards-public.cjs.map
1
+ 'use strict';var chunkJJL5VOQZ_cjs=require('./chunk-JJL5VOQZ.cjs');require('./chunk-U2N6MCD5.cjs'),require('./chunk-SFVO2LB2.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-HWYMZK3N.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"BOARD_GRAPH_KEY",{enumerable:true,get:function(){return chunkJJL5VOQZ_cjs.n}});Object.defineProperty(exports,"EMPTY_CONFIG",{enumerable:true,get:function(){return chunkJJL5VOQZ_cjs.u}});Object.defineProperty(exports,"SNAPSHOT_SCHEMA_VERSION_V1",{enumerable:true,get:function(){return chunkJJL5VOQZ_cjs.m}});Object.defineProperty(exports,"createBoardLiveCardsNonCorePublic",{enumerable:true,get:function(){return chunkJJL5VOQZ_cjs.z}});Object.defineProperty(exports,"createBoardLiveCardsPublic",{enumerable:true,get:function(){return chunkJJL5VOQZ_cjs.y}});//# sourceMappingURL=board-live-cards-public.cjs.map
2
2
  //# sourceMappingURL=board-live-cards-public.cjs.map
@@ -1,4 +1,4 @@
1
1
  import './storage-interface-BFiD3kyB.cjs';
2
- export { m as BOARD_GRAPH_KEY, B as BoardChangeNotification, n as BoardLiveCardsNonCorePublic, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, C as CommandInput, a as CommandResult, E as EMPTY_CONFIG, r as SNAPSHOT_SCHEMA_VERSION_V1, s as createBoardLiveCardsNonCorePublic, t as createBoardLiveCardsPublic } from './board-live-cards-public-DQzPe7A9.cjs';
2
+ export { n as BOARD_GRAPH_KEY, B as BoardChangeNotification, g as BoardLiveCardsNonCorePublic, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, C as CommandInput, a as CommandResult, E as EMPTY_CONFIG, r as SNAPSHOT_SCHEMA_VERSION_V1, s as createBoardLiveCardsNonCorePublic, t as createBoardLiveCardsPublic } from './board-live-cards-public-LlVUQPL2.cjs';
3
3
  import './execution-refs.cjs';
4
4
  import './types-BBhqYGhE.cjs';
@@ -1,4 +1,4 @@
1
1
  import './storage-interface-BFiD3kyB.js';
2
- export { m as BOARD_GRAPH_KEY, B as BoardChangeNotification, n as BoardLiveCardsNonCorePublic, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, C as CommandInput, a as CommandResult, E as EMPTY_CONFIG, r as SNAPSHOT_SCHEMA_VERSION_V1, s as createBoardLiveCardsNonCorePublic, t as createBoardLiveCardsPublic } from './board-live-cards-public-D-DJek3X.js';
2
+ export { n as BOARD_GRAPH_KEY, B as BoardChangeNotification, g as BoardLiveCardsNonCorePublic, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, C as CommandInput, a as CommandResult, E as EMPTY_CONFIG, r as SNAPSHOT_SCHEMA_VERSION_V1, s as createBoardLiveCardsNonCorePublic, t as createBoardLiveCardsPublic } from './board-live-cards-public-JNRKfBZy.js';
3
3
  import './execution-refs.js';
4
4
  import './types-BBhqYGhE.js';
@@ -1,2 +1,2 @@
1
- export{n as BOARD_GRAPH_KEY,u as EMPTY_CONFIG,m as SNAPSHOT_SCHEMA_VERSION_V1,z as createBoardLiveCardsNonCorePublic,y as createBoardLiveCardsPublic}from'./chunk-N6P2JW4W.js';import'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-JMDHDY6M.js';import'./chunk-VLBB3D6B.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-public.js.map
1
+ export{n as BOARD_GRAPH_KEY,u as EMPTY_CONFIG,m as SNAPSHOT_SCHEMA_VERSION_V1,z as createBoardLiveCardsNonCorePublic,y as createBoardLiveCardsPublic}from'./chunk-JH37NJGP.js';import'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-JMDHDY6M.js';import'./chunk-3KC6LBOG.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-public.js.map
2
2
  //# sourceMappingURL=board-live-cards-public.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkDDYSXP2A_cjs=require('./chunk-DDYSXP2A.cjs');require('./chunk-M3OU6IS5.cjs'),require('./chunk-7FGPOGRV.cjs'),require('./chunk-LPXVVMQT.cjs'),require('./chunk-7ICPAABP.cjs'),require('./chunk-KAWQPLIE.cjs'),require('./chunk-NM6O35RY.cjs'),require('./chunk-272IYUKT.cjs');var chunkCPAXTVBQ_cjs=require('./chunk-CPAXTVBQ.cjs');require('./chunk-NJJ7WEDT.cjs'),require('./chunk-GL2OHR2E.cjs'),require('./chunk-H5HBXPOI.cjs'),require('./chunk-PBCDDO4V.cjs'),require('./chunk-OEFTOO47.cjs'),require('./chunk-U2N6MCD5.cjs'),require('./chunk-SFVO2LB2.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-M6STQR5F.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-NMZ6XNLB.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-GYQXDNNI.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createMultiBoardServerRuntime",{enumerable:true,get:function(){return chunkDDYSXP2A_cjs.c}});Object.defineProperty(exports,"createSingleBoardServerRuntime",{enumerable:true,get:function(){return chunkDDYSXP2A_cjs.b}});Object.defineProperty(exports,"createHostedBoardQueueLaneRegistry",{enumerable:true,get:function(){return chunkCPAXTVBQ_cjs.a}});//# sourceMappingURL=board-live-cards-server-runtime.cjs.map
1
+ 'use strict';var chunkASR44K7H_cjs=require('./chunk-ASR44K7H.cjs');require('./chunk-EZENHAVZ.cjs'),require('./chunk-7FGPOGRV.cjs'),require('./chunk-LPXVVMQT.cjs'),require('./chunk-7ICPAABP.cjs'),require('./chunk-KAWQPLIE.cjs'),require('./chunk-NM6O35RY.cjs'),require('./chunk-272IYUKT.cjs');var chunkCPAXTVBQ_cjs=require('./chunk-CPAXTVBQ.cjs');require('./chunk-NJJ7WEDT.cjs'),require('./chunk-GL2OHR2E.cjs'),require('./chunk-J6EGN6S4.cjs'),require('./chunk-PBCDDO4V.cjs'),require('./chunk-JJL5VOQZ.cjs'),require('./chunk-U2N6MCD5.cjs'),require('./chunk-SFVO2LB2.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-PBOQ4HYB.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-HWYMZK3N.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-GYQXDNNI.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createMultiBoardServerRuntime",{enumerable:true,get:function(){return chunkASR44K7H_cjs.b}});Object.defineProperty(exports,"createSingleBoardServerRuntime",{enumerable:true,get:function(){return chunkASR44K7H_cjs.a}});Object.defineProperty(exports,"createHostedBoardQueueLaneRegistry",{enumerable:true,get:function(){return chunkCPAXTVBQ_cjs.a}});//# sourceMappingURL=board-live-cards-server-runtime.cjs.map
2
2
  //# sourceMappingURL=board-live-cards-server-runtime.cjs.map
@@ -1,9 +1,9 @@
1
- export { A as Awaitable, B as BoardContextConfig, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, M as MultiBoardRuntime, b as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, f as RuntimeLogger, R as RuntimeRequest, a as RuntimeResponse, S as SingleBoardRuntime, c as SingleBoardRuntimeOptions } from './types-BzQY45dH.cjs';
1
+ export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, 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, f as RuntimeRequest, g as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-Ba8H5_Wo.cjs';
2
2
  export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from './server-jobs-queue-runner/index.cjs';
3
- export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-CgMCYYft.cjs';
4
- export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-DOfEq_HC.cjs';
3
+ export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-Di9QB141.cjs';
4
+ export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-BfHmHdx2.cjs';
5
5
  export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-BFiD3kyB.cjs';
6
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as BoardWorkerRequest, C as CommandInput, a as CommandResult } from './board-live-cards-public-DQzPe7A9.cjs';
6
+ export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as BoardWorkerRequest, C as CommandInput, a as CommandResult } from './board-live-cards-public-LlVUQPL2.cjs';
7
7
  export { C as ChatStorage } from './chat-storage-lib-B9Q34Dyv.cjs';
8
8
  export { ExecutionRef } from './execution-refs.cjs';
9
9
  export { createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.cjs';
@@ -1,9 +1,9 @@
1
- export { A as Awaitable, B as BoardContextConfig, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, M as MultiBoardRuntime, b as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, f as RuntimeLogger, R as RuntimeRequest, a as RuntimeResponse, S as SingleBoardRuntime, c as SingleBoardRuntimeOptions } from './types-CF2xUcZW.js';
1
+ export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, d as BoardRuntimePlatformAdapter, e as BoardRuntimePublic, 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, f as RuntimeRequest, g as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from './types-SO5OZm4s.js';
2
2
  export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from './server-jobs-queue-runner/index.js';
3
- export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-3hUuHxDx.js';
4
- export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-JZPCzZnH.js';
3
+ export { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-fwd1QI82.js';
4
+ export { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-DYahVzIK.js';
5
5
  export { B as BlobStorage, K as KVStorage, a as KindValueRef } from './storage-interface-BFiD3kyB.js';
6
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as BoardWorkerRequest, C as CommandInput, a as CommandResult } from './board-live-cards-public-D-DJek3X.js';
6
+ export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as BoardWorkerRequest, C as CommandInput, a as CommandResult } from './board-live-cards-public-JNRKfBZy.js';
7
7
  export { C as ChatStorage } from './chat-storage-lib-DB9iSai2.js';
8
8
  export { ExecutionRef } from './execution-refs.js';
9
9
  export { createMultiBoardServerRuntime, createSingleBoardServerRuntime } from './server-runtime/index.js';
@@ -1,2 +1,2 @@
1
- export{c as createMultiBoardServerRuntime,b as createSingleBoardServerRuntime}from'./chunk-ZXQR7GHT.js';import'./chunk-J5J6BG7B.js';import'./chunk-NTICU4OK.js';import'./chunk-O7NOHKVR.js';import'./chunk-WHDEBJLT.js';import'./chunk-SGV7PU4H.js';import'./chunk-XYN5D3GL.js';import'./chunk-ZJ5M5COT.js';export{a as createHostedBoardQueueLaneRegistry}from'./chunk-YGALANRO.js';import'./chunk-6APH25VI.js';import'./chunk-VXJHBWK3.js';import'./chunk-VMW4Z6EF.js';import'./chunk-HEEDJEKM.js';import'./chunk-N6P2JW4W.js';import'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-PRHQBGPT.js';import'./chunk-JMDHDY6M.js';import'./chunk-VLBB3D6B.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-76ON3V7R.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-server-runtime.js.map
1
+ export{b as createMultiBoardServerRuntime,a as createSingleBoardServerRuntime}from'./chunk-76C7N4YT.js';import'./chunk-QJVR3FWQ.js';import'./chunk-NTICU4OK.js';import'./chunk-O7NOHKVR.js';import'./chunk-WHDEBJLT.js';import'./chunk-SGV7PU4H.js';import'./chunk-XYN5D3GL.js';import'./chunk-ZJ5M5COT.js';export{a as createHostedBoardQueueLaneRegistry}from'./chunk-YGALANRO.js';import'./chunk-6APH25VI.js';import'./chunk-VXJHBWK3.js';import'./chunk-PRKRXAVN.js';import'./chunk-HEEDJEKM.js';import'./chunk-JH37NJGP.js';import'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-ZCNN6XPV.js';import'./chunk-JMDHDY6M.js';import'./chunk-3KC6LBOG.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-76ON3V7R.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=board-live-cards-server-runtime.js.map
2
2
  //# sourceMappingURL=board-live-cards-server-runtime.js.map
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkS6DRP2HX_cjs=require('../chunk-S6DRP2HX.cjs');require('../chunk-G4XXRHL2.cjs'),require('../chunk-LODXIALE.cjs'),require('../chunk-IXZG74EW.cjs'),require('../chunk-NMZ6XNLB.cjs'),require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"LocalStorageService",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.a}});Object.defineProperty(exports,"buildBrowserArtifactsFromRuntime",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.e}});Object.defineProperty(exports,"createBoardLiveGraphRuntime",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.b}});Object.defineProperty(exports,"selectAllLiveCardModels",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.d}});Object.defineProperty(exports,"selectLiveCardModel",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.c}});//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunkS6DRP2HX_cjs=require('../chunk-S6DRP2HX.cjs');require('../chunk-G4XXRHL2.cjs'),require('../chunk-LODXIALE.cjs'),require('../chunk-IXZG74EW.cjs'),require('../chunk-HWYMZK3N.cjs'),require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"LocalStorageService",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.a}});Object.defineProperty(exports,"buildBrowserArtifactsFromRuntime",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.e}});Object.defineProperty(exports,"createBoardLiveGraphRuntime",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.b}});Object.defineProperty(exports,"selectAllLiveCardModels",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.d}});Object.defineProperty(exports,"selectLiveCardModel",{enumerable:true,get:function(){return chunkS6DRP2HX_cjs.c}});//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- export{a as LocalStorageService,e as buildBrowserArtifactsFromRuntime,b as createBoardLiveGraphRuntime,d as selectAllLiveCardModels,c as selectLiveCardModel}from'../chunk-YGKDQLYP.js';import'../chunk-VGT3TRQG.js';import'../chunk-WDPOGXTY.js';import'../chunk-JMDHDY6M.js';import'../chunk-VLBB3D6B.js';import'../chunk-MNEOJWPS.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
1
+ export{a as LocalStorageService,e as buildBrowserArtifactsFromRuntime,b as createBoardLiveGraphRuntime,d as selectAllLiveCardModels,c as selectLiveCardModel}from'../chunk-YGKDQLYP.js';import'../chunk-VGT3TRQG.js';import'../chunk-WDPOGXTY.js';import'../chunk-JMDHDY6M.js';import'../chunk-3KC6LBOG.js';import'../chunk-MNEOJWPS.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { h as BoardCallbackTransport, B as BoardChangeNotification } from './board-live-cards-public-DQzPe7A9.cjs';
1
+ import { i as BoardCallbackTransport, B as BoardChangeNotification } from './board-live-cards-public-LlVUQPL2.cjs';
2
2
  import { ExecutionRef } from './execution-refs.cjs';
3
3
  import { a as KindValueRef } from './storage-interface-BFiD3kyB.cjs';
4
4
  import { c as AsyncKVStorage, a as AsyncBlobStorage, f as AsyncScratchStorage, A as AsyncArchiveFactory, b as AsyncJournalStorage, e as AsyncQueueStorage, d as AsyncAtomicRelayLock } from './storage-async-interface-BRR4eBjx.cjs';
@@ -1,4 +1,4 @@
1
- import { h as BoardCallbackTransport, B as BoardChangeNotification } from './board-live-cards-public-D-DJek3X.js';
1
+ import { i as BoardCallbackTransport, B as BoardChangeNotification } from './board-live-cards-public-JNRKfBZy.js';
2
2
  import { ExecutionRef } from './execution-refs.js';
3
3
  import { a as KindValueRef } from './storage-interface-BFiD3kyB.js';
4
4
  import { c as AsyncKVStorage, a as AsyncBlobStorage, f as AsyncScratchStorage, A as AsyncArchiveFactory, b as AsyncJournalStorage, e as AsyncQueueStorage, d as AsyncAtomicRelayLock } from './storage-async-interface-DhlOVPSp.js';
@@ -1,2 +1,2 @@
1
- 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkIXZG74EW_cjs=require('../chunk-IXZG74EW.cjs'),chunkNMZ6XNLB_cjs=require('../chunk-NMZ6XNLB.cjs');require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"CardCompute",{enumerable:true,get:function(){return chunkIXZG74EW_cjs.a}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkIXZG74EW_cjs.b}});Object.defineProperty(exports,"validateLiveCard",{enumerable:true,get:function(){return chunkNMZ6XNLB_cjs.c}});Object.defineProperty(exports,"validateLiveCardDefinition",{enumerable:true,get:function(){return chunkNMZ6XNLB_cjs.d}});Object.defineProperty(exports,"validateLiveCardRuntimeExpressions",{enumerable:true,get:function(){return chunkNMZ6XNLB_cjs.b}});Object.defineProperty(exports,"validateLiveCardSchema",{enumerable:true,get:function(){return chunkNMZ6XNLB_cjs.a}});//# sourceMappingURL=index.cjs.map
1
+ 'use strict';Object.defineProperty(exports,'__esModule',{value:true});var chunkIXZG74EW_cjs=require('../chunk-IXZG74EW.cjs'),chunkHWYMZK3N_cjs=require('../chunk-HWYMZK3N.cjs');require('../chunk-UJ7ZTV4J.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"CardCompute",{enumerable:true,get:function(){return chunkIXZG74EW_cjs.a}});Object.defineProperty(exports,"default",{enumerable:true,get:function(){return chunkIXZG74EW_cjs.b}});Object.defineProperty(exports,"validateLiveCard",{enumerable:true,get:function(){return chunkHWYMZK3N_cjs.c}});Object.defineProperty(exports,"validateLiveCardDefinition",{enumerable:true,get:function(){return chunkHWYMZK3N_cjs.d}});Object.defineProperty(exports,"validateLiveCardRuntimeExpressions",{enumerable:true,get:function(){return chunkHWYMZK3N_cjs.b}});Object.defineProperty(exports,"validateLiveCardSchema",{enumerable:true,get:function(){return chunkHWYMZK3N_cjs.a}});//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,2 +1,2 @@
1
- export{a as CardCompute,b as default}from'../chunk-JMDHDY6M.js';export{c as validateLiveCard,d as validateLiveCardDefinition,b as validateLiveCardRuntimeExpressions,a as validateLiveCardSchema}from'../chunk-VLBB3D6B.js';import'../chunk-MNEOJWPS.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
1
+ export{a as CardCompute,b as default}from'../chunk-JMDHDY6M.js';export{c as validateLiveCard,d as validateLiveCardDefinition,b as validateLiveCardRuntimeExpressions,a as validateLiveCardSchema}from'../chunk-3KC6LBOG.js';import'../chunk-MNEOJWPS.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { C as CommandInput, a as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-DQzPe7A9.cjs';
1
+ import { C as CommandInput, a as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-LlVUQPL2.cjs';
2
2
  import './storage-interface-BFiD3kyB.cjs';
3
3
  import './execution-refs.cjs';
4
4
  import './types-BBhqYGhE.cjs';
@@ -1,4 +1,4 @@
1
- import { C as CommandInput, a as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-D-DJek3X.js';
1
+ import { C as CommandInput, a as CommandResult, L as LiveCard, b as CardAdminStore } from './board-live-cards-public-JNRKfBZy.js';
2
2
  import './storage-interface-BFiD3kyB.js';
3
3
  import './execution-refs.js';
4
4
  import './types-BBhqYGhE.js';
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkNMZ6XNLB_cjs=require('./chunk-NMZ6XNLB.cjs');require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-GNFE24S7.cjs');function s(r){let e=chunkNMZ6XNLB_cjs.d(r);return {isValid:e.ok,issues:e.errors}}exports.validateCardPreflight=s;//# sourceMappingURL=card-validation.cjs.map
1
+ 'use strict';var chunkFO4KNVU7_cjs=require('./chunk-FO4KNVU7.cjs');require('./chunk-HWYMZK3N.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"validateCardPreflight",{enumerable:true,get:function(){return chunkFO4KNVU7_cjs.a}});//# sourceMappingURL=card-validation.cjs.map
2
2
  //# sourceMappingURL=card-validation.cjs.map
@@ -1,2 +1,2 @@
1
- import {d}from'./chunk-VLBB3D6B.js';import'./chunk-MNEOJWPS.js';import'./chunk-FW4363Y4.js';function s(r){let e=d(r);return {isValid:e.ok,issues:e.errors}}export{s as validateCardPreflight};//# sourceMappingURL=card-validation.js.map
1
+ export{a as validateCardPreflight}from'./chunk-YBYXCFAI.js';import'./chunk-3KC6LBOG.js';import'./chunk-MNEOJWPS.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=card-validation.js.map
2
2
  //# sourceMappingURL=card-validation.js.map
@@ -1,4 +1,4 @@
1
- import { C as CommandInput, a as CommandResult } from './board-live-cards-public-DQzPe7A9.cjs';
1
+ import { C as CommandInput, a as CommandResult } from './board-live-cards-public-LlVUQPL2.cjs';
2
2
  import { a as ChatRecord, b as ChatReadAfterResult, c as ChatConfig, C as ChatStorage } from './chat-storage-lib-B9Q34Dyv.cjs';
3
3
  import './storage-interface-BFiD3kyB.cjs';
4
4
  import './execution-refs.cjs';
@@ -1,4 +1,4 @@
1
- import { C as CommandInput, a as CommandResult } from './board-live-cards-public-D-DJek3X.js';
1
+ import { C as CommandInput, a as CommandResult } from './board-live-cards-public-JNRKfBZy.js';
2
2
  import { a as ChatRecord, b as ChatReadAfterResult, c as ChatConfig, C as ChatStorage } from './chat-storage-lib-DB9iSai2.js';
3
3
  import './storage-interface-BFiD3kyB.js';
4
4
  import './execution-refs.js';
@@ -0,0 +1,3 @@
1
+ import {q as q$1}from'./chunk-MNEOJWPS.js';import {b as b$1}from'./chunk-FW4363Y4.js';import A from'ajv-formats';import {createRequire}from'module';var h={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://nsreehari.github.io/boards/live-cards.schema.json",definitions:{bind_ref:{description:"A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",type:"string",pattern:"^(card_data|requires|fetched_sources|computed_values)(\\.|$)"},bind_or_literal:{description:"A literal value or a bind reference object",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref"}},required:["bind"]}]},compute_expr:{description:"A declarative JSON compute expression",type:"object",required:["fn"],properties:{fn:{type:"string",description:"Function name from the built-in vocabulary",enum:["sum","avg","min","max","count","first","last","add","sub","mul","div","round","abs","mod","gt","gte","lt","lte","eq","neq","if","and","or","not","concat","upper","lower","template","filter","pluck","map","sort","slice","flat","unique","group","get","default","now","diff_days","format_date"]},input:{description:"card_data.path, literal, array of inputs, or nested compute_expr",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{$ref:"#/definitions/compute_expr"}]},field:{type:"string",description:"For pluck/sum/group \u2014 the object key to extract"},where:{$ref:"#/definitions/compute_expr",description:"For filter \u2014 predicate expression ($ = current item)"},cond:{$ref:"#/definitions/compute_expr",description:"For if \u2014 condition expression"},then:{description:"For if \u2014 value when cond is truthy"},else:{description:"For if \u2014 value when cond is falsy"},format:{type:"string",description:"For format_date \u2014 date format string"}}},meta:{type:"object",properties:{title:{type:"string"},tags:{type:"array",items:{type:"string"}}},additionalProperties:true},__private:{description:"Control-plane-owned private state. Stripped entirely from all regular /mcp read responses. Writable only via 'setstate.card-private' and 'manage.admin-upsert-card'. Agents must never author this field. Keys inside use plain names (no leading underscores).",type:"object",additionalProperties:true},requires:{type:"array",items:{type:"string"},description:"IDs of upstream nodes this node depends on"},provides:{type:"array",items:{type:"object",required:["bindTo","ref"],properties:{bindTo:{type:"string",description:"Token name published downstream"},ref:{type:"string",description:"Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)"}}},description:"Explicit bindings exposing computed or card_data values downstream as named tokens"},compute_step:{description:"A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",type:"object",required:["bindTo","expr"],properties:{bindTo:{type:"string",description:"Key in computed_values to write result"},expr:{type:"string",description:"JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }"}}},source_def:{description:"One source entry. The engine requires 'bindTo' (compute namespace key) and 'outputFile' (delivery signal path). bindTo and outputFile must be unique across all source_defs in a card. Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",type:"object",required:["bindTo","outputFile"],additionalProperties:true,properties:{bindTo:{type:"string",description:"Key under fetched_sources.* available in compute expressions"},outputFile:{type:"string",description:"Board-relative path the executor writes its JSON result to. Presence of this file signals delivery."},projections:{type:"object",description:"Named data projections from card_data or requires, evaluated before the executor is called. Each key is a ref name; each value is a JSONata expression rooted at card_data or requires. The resolved values are passed to the executor as _projections. fetched_sources, computed_values, and source_defs are not accessible here \u2014 sources run before those exist.",additionalProperties:{type:"string"}},optionalForCompletionGating:{type:"boolean",default:false,description:"When true this source does not gate card completion. Default false when absent, so source_defs are completion-gating by default."},timeout:{type:"integer",minimum:0,default:12e4,description:"Executor/script timeout in ms. Default: 120 000 (2 min)."},script:{type:"string",description:"Legacy direct-run: shell command executed when no .task-executor is registered. stdout is captured as the result."}}},render_element:{type:"object",required:["kind"],properties:{id:{type:"string",description:"Optional element ID for targeted updates"},kind:{enum:["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]},label:{type:"string",description:"Heading above this element"},className:{type:"string",description:"Bootstrap grid class, e.g. 'col-12 col-md-6'"},visible:{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 element shown only if truthy"},data:{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref",description:"card_data/requires/fetched_sources/computed_values path to read data from"},writeTo:{$ref:"#/definitions/bind_ref",description:"card_data path for user input (form, filter, todo, notes)"},columns:{type:"array",items:{type:"string"},description:"table: visible columns"},maxRows:{type:"integer",description:"table/list: max rows to display"},sortable:{type:"boolean",default:true,description:"table: enable click-to-sort"},placeholder:{type:"string",description:"Empty-state message"},chartType:{enum:["bar","line","pie","doughnut"]},chartOptions:{type:"object",description:"Chart.js options passthrough"},fields:{type:"object",description:"JSON Schema for form/filter fields"},thresholds:{type:"object",properties:{green:{type:"string"},amber:{type:"string"}}},colorMap:{type:"object",description:"badge: value \u2192 Bootstrap color"},style:{enum:["heading","muted","default"],description:"text: display style"},upload:{type:"boolean",default:true,description:"file-upload: show drop zone (false = read-only file list)"},accept:{type:"array",items:{type:"string"},description:"file-upload: allowed extensions"},multiple:{type:"boolean",default:true,description:"file-upload: allow multiple files"},fileAttach:{type:"boolean",default:false,description:"chat: enable inline file attachments"},fileAccept:{type:"array",items:{type:"string"},description:"chat: allowed attachment extensions"},buttons:{type:"array",description:"actions: button definitions",items:{type:"object",required:["id","label"],properties:{id:{type:"string"},label:{type:"string"},style:{type:"string",description:"Bootstrap button variant, e.g. 'success', 'outline-danger'"},size:{type:"string",default:"sm"},disabled:{oneOf:[{type:"boolean"},{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 truthy = disabled"}]}}}}}}}},view:{type:"object",required:["elements"],properties:{elements:{type:"array",minItems:1,items:{$ref:"#/definitions/render_element"}},layout:{type:"object",properties:{board:{type:"object",properties:{col:{type:"integer",minimum:1,maximum:12},order:{type:"integer"}}},canvas:{type:"object",properties:{x:{type:"number"},y:{type:"number"},w:{type:"number"},h:{type:"number"}}}}},features:{type:"object",properties:{chat:{type:"boolean",default:false},notes:{type:"boolean",default:false},refresh:{type:"boolean",default:true}}}}}},title:"LiveCard",description:"A unified card node. Behavior depends on which sections are present (source_defs, compute, view, etc.)",type:"object",required:["id"],additionalProperties:false,properties:{id:{type:"string"},requires:{$ref:"#/definitions/requires"},provides:{$ref:"#/definitions/provides"},meta:{$ref:"#/definitions/meta"},__private:{$ref:"#/definitions/__private"},view:{$ref:"#/definitions/view"},card_data:{type:"object",description:"Authored card data and runtime metadata. Includes uploaded-file metadata maintained by host handlers and inference evaluation results.",properties:{files:{type:"array",description:"Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",items:{type:"object",required:["name","stored_name"],properties:{name:{type:"string",minLength:1},stored_name:{type:"string",minLength:5,maxLength:32,pattern:"^[0-9]{3,}-[a-z0-9._-]+$"},size:{oneOf:[{type:"integer",minimum:0},{type:"null"}]},mime_type:{type:"string"},path:{type:"string",pattern:"^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$"},uploaded_at:{type:"string",format:"date-time"},chat:{type:"boolean",description:"Whether this file entry is associated with a chat interaction"}},additionalProperties:false}}},additionalProperties:true},source_defs:{type:"array",description:"Source entries. Each entry is passed verbatim to the board's .task-executor (registered via init --task-executor) as the --in JSON file. The executor fetches/generates the data and writes JSON to --out. If no executor is registered, the built-in executor runs the entry's 'cli' command directly. Sources gate completion by default. Set optionalForCompletionGating: true for enrichment-only source_defs that should not block task-completed.",items:{$ref:"#/definitions/source_def"}},compute:{type:"array",description:"Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",items:{$ref:"#/definitions/compute_step"}}}};var _=b$1(q$1(),1);var k=createRequire(import.meta.url),q=k("./jsonata-sync.cjs"),f=null;var b=/\b(card_data|requires|fetched_sources|computed_values|source_defs)\b/g,N=/^\s*(card_data|requires|fetched_sources|computed_values|source_defs)(\.|$)/;function S(e){let t=new Set,o;for(b.lastIndex=0;(o=b.exec(e))!==null;)t.add(o[1]);return t}function v(e){let t=N.exec(e);return t?t[1]:null}function g(e,t,o,n){try{q(e);}catch(s){let d=s instanceof Error?s.message:String(s);n.push(`${t}: invalid JSONata expression (${d})`);return}let i=S(e);for(let s of i)o.has(s)||n.push(`${t}: disallowed namespace "${s}" in expression`);}function y(e,t,o){if(Array.isArray(e)){e.forEach((i,s)=>{y(i,`${t}/${s}`,o);});return}if(typeof e=="string"){let i=v(e);if(!i)return;new Set(["card_data","requires","computed_values"]).has(i)||o.push(`${t}: disallowed namespace "${i}" in view reference`);return}if(!e||typeof e!="object")return;let n=e;for(let[i,s]of Object.entries(n))y(s,`${t}/${i}`,o);}function E(){if(f)return f;let e=new _.default({allErrors:true});return A(e),f=e.compile(h),f}function R(e){let t=E(),o=t(e),n=(t.errors??[]).map(i=>`${i.instancePath||"/"}: ${i.message??"unknown error"}`);if(e&&typeof e=="object"&&!Array.isArray(e)){let i=e.source_defs;if(Array.isArray(i)){let s=new Set,d=new Set;i.forEach((p,u)=>{if(!p||typeof p!="object"||Array.isArray(p))return;let r=p;typeof r.bindTo=="string"&&r.bindTo&&(s.has(r.bindTo)&&n.push(`/source_defs/${u}/bindTo: bindTo "${r.bindTo}" must be unique across all source_defs`),s.add(r.bindTo)),typeof r.outputFile=="string"&&r.outputFile&&(d.has(r.outputFile)&&n.push(`/source_defs/${u}/outputFile: outputFile "${r.outputFile}" must be unique across all source_defs`),d.add(r.outputFile));});}}return !o||n.length>0?{ok:false,errors:n}:{ok:true,errors:[]}}function T(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return {ok:true,errors:[]};let o=e,n=o.compute;Array.isArray(n)&&n.forEach((r,c)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let a=r.expr;typeof a!="string"||a.trim().length===0||g(a,`/compute/${c}/expr`,new Set(["card_data","requires","fetched_sources","computed_values"]),t);});let i=new Set(["card_data","requires","fetched_sources","computed_values"]),s=o.provides;Array.isArray(s)&&s.forEach((r,c)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let a=r.ref;if(typeof a!="string"||a.trim().length===0)return;let l=v(a);l===null?t.push(`/provides/${c}/ref: path "${a}" must start with a valid namespace (${[...i].join(", ")})`):i.has(l)||t.push(`/provides/${c}/ref: disallowed namespace "${l}" in path "${a}" (valid: ${[...i].join(", ")})`);});let d=o.view;d&&typeof d=="object"&&!Array.isArray(d)&&y(d,"/view",t);let p=new Set(["card_data","requires"]),u=o.source_defs;return Array.isArray(u)&&u.forEach((r,c)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let a=r.projections;if(!(!a||typeof a!="object"||Array.isArray(a)))for(let[l,m]of Object.entries(a))typeof m!="string"||m.trim().length===0||g(m,`/source_defs/${c}/projections/${l}`,p,t);}),{ok:t.length===0,errors:t}}function V(e){return O(e)}function O(e){let t=R(e);if(!t.ok)return t;let o=T(e);return o.ok?{ok:true,errors:[]}:{ok:false,errors:o.errors}}
2
+ export{R as a,T as b,V as c,O as d};//# sourceMappingURL=chunk-3KC6LBOG.js.map
3
+ //# sourceMappingURL=chunk-3KC6LBOG.js.map
@@ -0,0 +1,3 @@
1
+ import {n,h,i,j,a as a$6,b as b$3,k,l as l$1,c as c$3,m}from'./chunk-QJVR3FWQ.js';import {a as a$2}from'./chunk-NTICU4OK.js';import {a as a$1,b as b$1}from'./chunk-WHDEBJLT.js';import {a as a$4,d as d$1,b as b$4,c as c$2}from'./chunk-SGV7PU4H.js';import {a as a$3}from'./chunk-XYN5D3GL.js';import {a as a$7,b as b$5}from'./chunk-ZJ5M5COT.js';import {b,c as c$1,e}from'./chunk-6APH25VI.js';import {j as j$1,d,c,b as b$2}from'./chunk-PRKRXAVN.js';import {y,z,l}from'./chunk-JH37NJGP.js';import {a as a$5}from'./chunk-KBELAKIY.js';import {a}from'./chunk-76ON3V7R.js';function Zt(R){let{apiBasePath:k,json:v,readJsonBody:K,initBoardAndSetup:H,bootstrapBoard:I,buildPublishedRuntimePayload:W,createMcpControlplaneToolRegistry:U,retriggerCard:L,applyCardAction:G,resolveChatHandlerTarget:V,sendCardFileDownloadResponse:_}=R;async function X(Q,x,rt){let c=Q.method||"GET",p=rt,h=p.pathname;try{if(c==="GET"&&h===`${k}/init-board`)return await H(),v(x,200,await W()),!0;if(c==="POST"&&h===`${k}/mcp-controlplane`){await I();let w=await K(Q),b=typeof w.tool=="string"?w.tool.trim():"",S=w.args&&typeof w.args=="object"&&!Array.isArray(w.args)?w.args:{};if(!b)return v(x,400,{error:"tool is required"}),!0;try{let g=await a$7(b,S,U());if(g&&typeof g=="object"&&!Array.isArray(g)){let $=g;if($.status==="fail")return v(x,400,{error:b$5(g,"Request failed")}),!0;if($.status==="error")return v(x,500,{error:b$5(g,"Internal error")}),!0}v(x,200,g);}catch(g){let $=typeof g?.statusCode=="number"?Number(g.statusCode):500,N=g instanceof Error?g.message:String(g);v(x,$,{error:N});}return !0}let d=h.match(new RegExp(`^${c$2(k)}/cards/([^/]+)/retrigger$`));if(c==="POST"&&d){await I();let w=decodeURIComponent(d[1]);return await L(w),v(x,200,{ok:!0}),!0}let O=h.match(new RegExp(`^${c$2(k)}/cards/([^/]+)/actions$`));if(c==="POST"&&O){await I();let w=decodeURIComponent(O[1]),b=Date.now(),S=new Date(b).toISOString(),g=await K(Q),$=g?.actionType;if($==="chat-send"&&!await V(w)){let C=Date.now();return v(x,409,{error:`chat handler is not configured for card: ${w}`,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(C).toISOString(),responseSentAtMs:C,responseStatus:409}),!0}if($==="chat-send"){let C=g?.payload??{},J=typeof C["turn-id"]=="string"?C["turn-id"]:typeof C.turnId=="string"?C.turnId:typeof C.turn=="string"?C.turn:"";if(!J||!String(J).trim()){let q=Date.now();return v(x,400,{error:`chat-send requires a non-empty 'turn-id' (or 'turnId'/'turn') in payload for card: ${w}`,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(q).toISOString(),responseSentAtMs:q,responseStatus:400}),!0}}await G(w,$,g?.payload);let N=Date.now();return v(x,200,{ok:!0,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(N).toISOString(),responseSentAtMs:N,responseStatus:200}),!0}let E=h.match(new RegExp(`^${c$2(k)}/cards/([^/]+)/files/(\\d+)$`));if(c==="GET"&&E){let w=decodeURIComponent(E[1]),b=parseInt(E[2],10),S=p.searchParams.get("sn");return await _(x,w,b,S),!0}return !1}catch(d){let O=d?.statusCode||500;return v(x,O,{error:String(d?.message||d)}),true}}return {handleRuntimeApi:X}}var Yt={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"content-type,x-file-name","Access-Control-Allow-Methods":"GET,POST,PATCH,OPTIONS"},Xt="chat-handler-flow-queue";function nr(R){let k$1=String(R.apiBasePath||"/api/board").replace(/\/$/,""),v={...Yt,...R.corsHeaders||{}},K=R.queueLaneTuning??{},H=R.boardId||"",I=R.logger||{info:console.log,warn:console.warn,error:console.error},W=R.invocationAdapter,U=R.chatFlowRunner||null,L=R.chatStorage??b(),G=a(L),V=R.notificationTransport||null,_=R.serverUrl||null,X=R.executionExtra||{},Q=R.onSseClientConnected,x=R.onSseClientDisconnected,rt=R.onChannelSubscribed,c$2=R.onChannelUnsubscribed,p=a$1({chatStorage:L,readChatRecords:t=>yt(t),onSseClientDisconnected:x});function h$1(t){function e(a){if(Array.isArray(a))return a;if(a&&typeof a=="object"){let s=a;return Array.isArray(s.files)?s.files:[a]}return null}function r(a){return {async get(s){return a.get(s)},async set(s){return a.set(s)},async del(s){return a.del(s)},async patch(s){return a.patch(s)},async appendFiles(s){return a.appendFiles(s)}}}function o(a){function s(m){return {status:"success",data:m}}function l(m){return {status:"fail",error:m}}function u(m){return {status:"error",error:m instanceof Error?m.message:String(m)}}return {async get(m){try{let f=m.params?.id;if(f){let T=await a.readCard(f);return T?s({cards:[T]}):l(`card "${f}" not found`)}return s({cards:await a.readAllCards()})}catch(f){return u(f)}},async set(m){try{let f=m.body;if(f==null)return l("set requires a body (card object or array of cards)");let T=Array.isArray(f)?f:[f];for(let j of T){if(typeof j.id!="string")return l("each card must have a string `id` field");await a.writeCard(j.id,j);}return s({count:T.length})}catch(f){return u(f)}},async del(m){try{let f=m.body?.ids??[],T=m.params?.id,j=T?[...f,T]:f;if(j.length===0)return l("del requires body.ids (string[]) or params.id");for(let tt of j)await a.removeCard(tt);return s({count:j.length})}catch(f){return u(f)}},async patch(m){try{let f=m.params?.id,T=m.params?.path;if(!f)return l("patch requires params.id");if(!T)return l("patch requires params.path");let j=m.body,tt=j&&Object.prototype.hasOwnProperty.call(j,"value")?j.value:m.body;return await a.patchCard(f,T,tt),s({count:1})}catch(f){return u(f)}},async appendFiles(m){try{let f=m.params?.id;if(!f)return l("appendFiles requires params.id");let T=await a.readCard(f);if(!T)return l(`card "${f}" not found`);let j=e(m.body);if(!j||j.length===0)return l("appendFiles requires a file metadata object, array, or body.files array");let tt=T.card_data&&typeof T.card_data=="object"&&!Array.isArray(T.card_data)?T.card_data:{},At=Array.isArray(tt.files)?tt.files:[],ve=[...At,...j];return await a.patchCard(f,"card_data.files",ve),s({files_added:j.map((Oe,Pe)=>({idx:At.length+Pe,entry:Oe}))})}catch(f){return u(f)}}}}let n=a$4(t.boardAdapter)?j$1(t.baseRef,t.boardAdapter):y(t.baseRef,t.boardAdapter),i=t.nonCoreAdapter??(!a$4(t.boardAdapter)&&w(t.boardAdapter)?t.boardAdapter:null),y$1=t.nonCore??(i?z(t.baseRef,i):null),P,A=a$4(t.boardAdapter)?(()=>{let a=d(c(b$2(t.boardAdapter.kvStorageForRef(t.cardStoreRef)),t.boardAdapter.hashFn),I.warn),s=o(a);return P={get(l){return s.get(l)},set(l){return s.set(l)}},s})():(()=>{let a=t.boardAdapter.kvStorageForRef(t.cardStoreRef),l$1=a$5(l({readIndex:()=>a.read("_index"),writeIndex:u=>a.write("_index",u),readCard:u=>a.read(u),writeCard:(u,m)=>(a.write(u,m),u),removeCard:u=>{a.delete(u);},cardExists:u=>a.read(u)!==null,defaultCardKey:u=>u},I.warn));return P=l$1,r(l$1)})(),F=t.artifactsAdapter||t.boardAdapter,B=t.filesArtifactsStore??null,M=B?{putBytes(a,s,l){B.putBytes(a,s,l);},getBytes(a){return B.getBytes(a)},listKeys(a){return B.list(a).map(s=>s.key)}}:null;if(!M&&!a$4(F)){let a=t.artifactsAdapter?F.blobStorage(""):F.blobStorage("files"),s=c$1(a);M={putBytes(l,u,m){s.putBytes(l,u,m);},getBytes(l){return s.getBytes(l)},listKeys(l){return s.list(l).map(u=>u.key)}};}else if(!M&&a$4(F)){let a=t.artifactsAdapter?F.blobStorage(""):F.blobStorage("files");M={async putBytes(s,l){if(a.writeBytes){await a.writeBytes(s,l);return}let u=JSON.stringify({__kind:"bytes-array",data:[...l]});await a.write(s,u);},async getBytes(s){if(a.readBytes){let u=await a.readBytes(s);if(u!==null)return u}let l=await a.read(s);if(l===null)return null;try{let u=JSON.parse(l);if(u&&u.__kind==="bytes-array"&&Array.isArray(u.data))return new Uint8Array(u.data)}catch{}return new TextEncoder().encode(l)},async listKeys(s){return await a.listKeys(s)}};}let D={async init(a){return n.init(a)},async status(a){return n.status(a)},async getConfig(a){return n.getConfig(a)},async getAllOutputsDataObjects(a){return n.getAllOutputsDataObjects(a)},async getAllOutputsComputedValues(a){return n.getAllOutputsComputedValues(a)},async getOutputsFetchedSources(a){return n.getOutputsFetchedSources(a)},async upsertCard(a){return n.upsertCard(a)},async removeCard(a){return n.removeCard(a)},async cardRefreshedNotify(a){return n.cardRefreshedNotify(a)},async sourceDataFetched(a){return n.sourceDataFetched(a)},async sourceDataFetchFailure(a){return n.sourceDataFetchFailure(a)}};return {label:t.label,board:n,nonCore:y$1,publicCardStore:P,boardOps:D,cardStoreOps:A,get filesArtifacts(){return M},boardAdapter:t.boardAdapter,cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef,artifactsStoreRef:t.artifactsStoreRef,chatStoreRef:t.chatStoreRef,scratchStoreRef:t.scratchStoreRef,archiveStoreRef:t.archiveStoreRef,notifyRef:t.notifyRef,taskExecutorRef:t.taskExecutorRef,chatHandlerRef:t.chatHandlerRef,chatHandlerFlow:t.chatHandlerFlow,inferenceAdapterRef:t.inferenceAdapterRef,notification:a$6(),notificationTeardown:null,initialized:false,cardsBootstrapped:false}}let d$2=R.boards.map(h$1),O=new Map;function E(t){return O.get(t)??0}function w(t){let e=t;return typeof e.invokeExecutor=="function"&&typeof e.validateSchema=="function"}function b$5(t){let e=d$2[E(t)];return {files:e?e.filesArtifacts:null}}function S(){return e()}function g(t){return String(t||"").replace(/[^a-zA-Z0-9_-]/g,"_")||"unknown-card"}async function $(t){if(!t||t.notificationTeardown||!V||!t.notifyRef)return;let e=await V.subscribe(t.notifyRef,r=>{c$3(t.notification,r);let o=r.kind==="notification-batch"?r.notifications:[r];p.broadcastNotificationBatch(o);});t.notificationTeardown=e;}async function N(t){if(!t||t.initialized)return;let e={cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef};t.artifactsStoreRef&&(e.artifactsStoreRef=t.artifactsStoreRef),t.chatStoreRef&&(e.chatStoreRef=t.chatStoreRef),t.scratchStoreRef&&(e.scratchStoreRef=t.scratchStoreRef),t.archiveStoreRef&&(e.archiveStoreRef=t.archiveStoreRef);let r={};t.taskExecutorRef&&(r["task-executor-ref"]=t.taskExecutorRef),t.chatHandlerFlow!==void 0&&(r["chat-handler-flow"]=t.chatHandlerFlow),t.inferenceAdapterRef&&(r["inference-adapter-ref"]=t.inferenceAdapterRef);let o=await t.boardOps.init({params:e,body:r});if(o.status!=="success")throw Object.assign(new Error(o.error||`init failed for ${t.label}`),{statusCode:500});if(await $(t),!t.chatHandlerFlow&&t.chatHandlerRef&&W.describe)try{let n=await W.describe(t.chatHandlerRef);n&&n.kind!=="chat-handler"?I.warn(`[init] chat-handler describe returned kind="${n.kind}", expected "chat-handler" for ${t.label}`):n&&I.info(`[init] chat-handler validated: ${n.name} (protocol ${n.protocolVersion}) for ${t.label}`);}catch(n){I.warn(`[init] chat-handler describe failed for ${t.label}: ${n?.message||String(n)}`);}t.initialized=true;}async function C(t){if(!t.boardAdapter.publishBoardChangeNotifications)return;let e=[],r=await t.boardOps.status({});r.status==="success"&&r.data!=null&&b$3(r.data)&&e.push({kind:"status",status:r.data});let o=await t.boardOps.getAllOutputsDataObjects({});if(o.status==="success"&&o.data!=null)for(let[i,y]of Object.entries(o.data))i&&e.push({kind:"data_object",key:i,payload:y});let n=await t.boardOps.getAllOutputsComputedValues({});if(n.status==="success"&&n.data!=null)for(let[i,y]of Object.entries(n.data))i&&e.push({kind:"computed_values",cardId:i,values:y});e.length>0&&t.boardAdapter.publishBoardChangeNotifications(e);}async function J(t,e){if(!t||t.cardsBootstrapped)return;let r=await t.cardStoreOps.get({}),o=r.status==="success"&&Array.isArray(r.data?.cards)?r.data.cards:[];for(let n of o)typeof n.id=="string"&&(O.set(n.id,e),await t.boardOps.upsertCard({params:{cardId:n.id}}));t.cardsBootstrapped=true;}async function q(){for(let t of d$2)await N(t);}async function it(){await q();for(let t=0;t<d$2.length;t++)await C(d$2[t]),await J(d$2[t],t),await C(d$2[t]);}async function ct(t=false){t||await q();for(let e of d$2){let r=await e.board.processAccumulatedEvents({});if(r.status!=="success")return r}return {status:"success"}}async function te(){return await q(),ct(true)}function Y(t){return d$2[E(t)]??null}async function nt(t){let e=Y(t);if(!e)return null;let r=await e.cardStoreOps.get({params:{id:t}});if(r.status!=="success")return null;let o=Array.isArray(r.data?.cards)?r.data.cards:[];return o.length>0?o[0]:null}async function ft(){let t=async r=>{if(!r)return [];let o=await r.cardStoreOps.get({});return o.status!=="success"||!Array.isArray(o.data?.cards)?[]:o.data.cards},e=[];for(let r of d$2)e.push(...await t(r));return e}function ee(){return d$2[0]??null}let pt=n({boardContexts:d$2,cardOwnerIndex:O,cardContextForCard:t=>Y(t),readStatusSnapshot:()=>ie(),readDataObjectsByToken:()=>de(),readCardRuntimeArtifacts:()=>ce(),readCardFromStore:t=>nt(t),readCardDefinitions:()=>ft(),processAccumulatedLaneInternal:t=>ct(t),reportSourceFetched:(t,e)=>bt(t,{ref:e}),reportSourceFetchFailure:(t,e)=>Ct(t,{reason:e}),uploadCardFile:(t,e,r,o,n)=>Rt(t,e,r,o,n),chatStorePublic:G,serverUrl:_,apiBasePath:k$1}),re=pt.mcpCardStoreFacade,z$1=pt.createMcpFacade,ne=h({boardId:H,getMcpFacade:()=>z$1(),getMcpCardStoreFacade:()=>re()});function ae(t){return k(t)}function oe(){return l$1(z$1())}function se(){return m({boardId:H,uploadCardFile:Rt,getMcpFacade:()=>z$1(),controlplane:ne})}let at=i({boardId:H,boardContexts:d$2,readCardDefinitions:()=>ft(),readChatRecords:t=>yt(t),getChatProcessing:t=>z$1().getChatProcessing({cardId:t}).active}),ie=at.readStatusSnapshot,ce=at.readCardRuntimeArtifacts,de=at.readDataObjectsByToken,dt=at.buildPublishedRuntimePayload;async function mt(t,e,r){let o=r?.syncBoard!==false,n=r?.restartOnlyIfChanged===true,i=Y(t);if(!i)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let y=await nt(t);if(!y)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let P=n?JSON.stringify(y):null,A=e(y)||y;if(n&&JSON.stringify(A)===P)return;let F=await i.cardStoreOps.set({body:A});if(F.status!=="success")throw Object.assign(new Error(F.error||`Failed to persist card: ${t}`),{statusCode:500});if(o){let B=await i.boardOps.upsertCard({params:{cardId:t,restart:true}});if(B.status!=="success")throw Object.assign(new Error(B.error||`Failed to upsert card: ${t}`),{statusCode:500})}}async function ue(t,e){await mt(t,e,{syncBoard:true});}async function gt(t,e){await mt(t,e,{syncBoard:false});}async function le(t){let e=Y(t);if(!e)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});if(!await nt(t))throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let o=await e.boardOps.upsertCard({params:{cardId:t,restart:true}});if(o.status!=="success")throw Object.assign(new Error(o.error||`Failed to retrigger card: ${t}`),{statusCode:500})}function fe(t){L.clear(t);try{z$1().setChatProcessing({cardId:t,active:!1});}catch{}}function pe(t,e,r,o,n=""){let i=typeof r=="string"?r.trim():"";return L.append(t,e||"system",i,o,n)}function yt(t){return L.readAll(t)}let Rt=j({safeCardId:t=>g(t),artifactsStores:t=>b$5(t),cardFileMetadataStore:()=>S(),readCardFromStore:t=>nt(t),updateCardLocalOnly:(t,e)=>gt(t,e),writeChatRecord:(t,e,r,o,n)=>pe(t,e,r,o,n)}).uploadCardFile;async function ht(t){let e=Y(t);if(!e)return null;let r=await e.boardOps.getConfig({params:{key:"chat-handler-flow"}}),o=r.status==="success"?r.data?.value:null,n=e.chatHandlerRef;return o==null&&(!n||typeof n!="object")?null:{ctx:e,handlerFlow:o,handlerRef:n}}async function me(t,e,r=false,o=""){let n=await ht(t);if(!n)return;let{ctx:i,handlerFlow:y,handlerRef:P}=n;if(!r)try{z$1().setChatProcessing({cardId:t,active:!0});}catch{}let A={boardId:H,cardId:String(t),lastChatEntryId:e,...o?{turnId:o}:{},...X,..._?{serverUrl:_}:{}},F=y!=null?{meta:"chat-handler-flow",howToRun:"built-in",whatToRun:{kind:"built-in",value:Xt}}:P;try{a$4(i.boardAdapter)?await i.boardAdapter.chatAgentStore().enqueueRequest({boardId:H,ref:F,args:y!=null?{...A,__chatHandlerFlow:y}:A}):i.boardAdapter.chatAgentStore().enqueueRequest({boardId:H,ref:F,args:y!=null?{...A,__chatHandlerFlow:y}:A}),await Promise.resolve(i.boardAdapter.requestProcessAccumulated?.());}catch(B){try{z$1().setChatProcessing({cardId:t,active:!1});}catch{}I.warn(`[chat-handler] queue failed for card "${t}": ${B instanceof Error?B.message:String(B)}`);}}async function ge(t,e,r){if(e.howToRun==="built-in"&&b$4(e)===Xt){let o=U,n=r.__chatHandlerFlow,i={...r};return delete i.__chatHandlerFlow,o?o.run(n,i,{boardId:H,cardId:String(i.cardId||""),label:t.label,logger:I,serverUrl:_,executionExtra:X}):{dispatched:false,error:"chat-handler-flow configured but no chatFlowRunner was provided"}}return W.invoke(e,r)}async function ye(t,e=false){e||await q();let r=typeof t.args?.cardId=="string"?t.args.cardId:"",o=r?Y(r):ee();if(!o)throw new Error(r?`Board context is unavailable for chat-agent request: ${r}`:"Board context is unavailable for chat-agent request");let n=await ge(o,t.ref,t.args);if(!n.dispatched){if(r)try{L.setProcessing(r,!1);}catch{}throw new Error(n.error||`chat-agent dispatch failed for card "${r||"unknown"}"`)}}async function Re(t,e,r){let o=e==="chat-send"?gt:ue,n;await o(t,i=>{let y=new Date().toISOString(),P=i.card_data&&typeof i.card_data=="object"?i.card_data:{};if(i.card_data=P,e==="chat-send"){let A=r&&typeof r.text=="string"?r.text.trim():"",F=r&&typeof r["turn-id"]=="string"?r["turn-id"]:r&&typeof r.turnId=="string"?r.turnId:r&&typeof r.turn=="string"?r.turn:"",B=[];if(Array.isArray(r?.files)){for(let M of r.files)if(M){if(typeof M=="string"){B.push({name:M});continue}if(typeof M=="object"){let D=M;typeof D.name=="string"&&B.push({name:D.name,size:D.size,mime_type:D.mime_type,uploaded_at:D.uploaded_at,stored_name:D.stored_name,chat:D.chat===true});}}}if(A||B.length>0){let M=G.runBatch({cardId:t,commands:[{command:"append",role:"user",text:A,files:B,turn:F},{command:"set-processing",active:true}]});if(M.status!=="success")throw new Error(M.error);let D=M.data.results[0]?.data?.id;if(typeof D!="string"||!D)throw new Error(`chat-send did not return an append id for card ${t}`);n={cardId:t,lastEntryId:D,processingAlreadySet:true,turnId:F};try{p.broadcastCardChats(t);}catch{}}return i}if(e==="file-upload"){let A=S().normalizeIncoming(r?.files,y);return A.length>0&&S().merge(P,A),i}if(e==="action"){let A=r&&typeof r.buttonId=="string"?r.buttonId:"";if(!A)return i;P.lastAction={buttonId:A,at:y},P.lastActionText=`${A} @ ${y}`;}return i}),n&&me(n.cardId,n.lastEntryId,n.processingAlreadySet,n.turnId??"");}function ot(t,e,r){let o=JSON.stringify(r),n=typeof Buffer<"u"?Buffer.byteLength(o):new TextEncoder().encode(o).length;t.writeHead(e,{...v,"Content-Type":"application/json; charset=utf-8","Content-Length":n}),t.end(o);}async function wt(t,e,r){let o=await nt(t);if(!o)throw Object.assign(new Error("Card not found"),{statusCode:404});let n=S().resolve(o.card_data,e,r);if(!n.ok&&n.reason==="stale_reference")throw Object.assign(new Error("File reference is stale. Refresh and try again."),{statusCode:409});if(!n.ok)throw Object.assign(new Error("File not found"),{statusCode:404});let i=n.file,y=g(t),P=b$5(t),A=String(i.stored_name||""),F=`${y}/${A}`,B=P.files?await P.files.getBytes(F):null;if(!B)throw Object.assign(new Error("File not found"),{statusCode:404});return {fileRecord:i,bytes:B}}async function he(t,e,r,o){let{fileRecord:n,bytes:i}=await wt(e,r,o),y=String(n.name||n.stored_name||"download.bin"),P=String(n.mime_type||"application/octet-stream");t.writeHead(200,{"Content-Type":P,"Content-Disposition":`attachment; filename="${y}"`,"Content-Length":i.length}),t.end(i);}function we(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 be(t,e,r){let o=t.split(/\r?\n/);return (e==="head"?o.slice(0,r):o.slice(-r)).join(`
2
+ `)}async function st(t){let e=[];for await(let o of t)e.push(o);let r=typeof Buffer<"u"?Buffer.concat(e).toString("utf-8").trim():new TextDecoder().decode(d$1(e)).trim();return r?JSON.parse(r):{}}async function bt(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 o=d$2[0];return o?o.boardOps.sourceDataFetched({params:{token:t,ref:r}}):{status:"fail",error:"no board context"}}async function Ct(t,e){let r=typeof e.reason=="string"&&e.reason.trim()?e.reason:"unknown",o=d$2[0];return o?o.boardOps.sourceDataFetchFailure({params:{token:t,reason:r}}):{status:"fail",error:"no board context"}}let Ce=b$1({sseHub:p,corsHeaders:v,json:ot,buildPublishedRuntimePayload:()=>dt(),onSseClientConnected:Q,onChannelSubscribed:rt,onChannelUnsubscribed:c$2,apiBasePath:k$1,readJsonBody:t=>st(t),initBoardAndSetup:()=>q(),bootstrapBoard:()=>it(),boardContexts:d$2,publishPersistedStateSnapshot:t=>C(t),upsertCardsFromSource:(t,e)=>J(t,e)}).handleWatchersRoutes,Ae=a$2({apiBasePath:k$1,json:ot,readJsonBody:t=>st(t),bootstrapBoard:()=>it(),createMcpFacade:()=>z$1(),createMcpToolRegistry:t=>ae(t),resolveCardFileDownloadPayload:(t,e,r)=>wt(t,e,r),isLikelyTextMimeType:t=>we(t),sliceTextByLines:(t,e,r)=>be(t,e,r)}).handleAgentfaceApi,Se=a$3({apiBasePath:k$1,json:ot,readJsonBody:t=>st(t),initBoardAndSetup:()=>q(),createMcpWebhookToolRegistry:()=>oe()}).handleWebhooksApi,Be=Zt({apiBasePath:k$1,json:ot,readJsonBody:t=>st(t),initBoardAndSetup:()=>q(),bootstrapBoard:()=>it(),buildPublishedRuntimePayload:()=>dt(),createMcpControlplaneToolRegistry:()=>se(),retriggerCard:t=>le(t),applyCardAction:(t,e,r)=>Re(t,e,r),resolveChatHandlerTarget:t=>ht(t),sendCardFileDownloadResponse:(t,e,r,o)=>he(t,e,r,o)}).handleRuntimeApi;async function ke(t,e,r){return !!(await Ae(t,e,r)||await Se(t,e,r)||await Ce(t,e,r)||await Be(t,e,r))}return {get apiBasePath(){return k$1},get corsHeaders(){return v},get queueLaneTuning(){return K},handleRuntimeApi:ke,buildPublishedRuntimePayload:dt,processAccumulatedEvents:te,processAccumulatedLane:ct,handleChatAgentRequest:ye,clearChatRecords:fe,reportSourceFetched(t,e){return bt(t,{ref:e})},reportSourceFetchFailure(t,e){return Ct(t,{reason:e})},get cardStore(){return d$2[0]?.publicCardStore??{get(){return Promise.resolve({status:"fail",error:"no board context"})},set(){return Promise.resolve({status:"fail",error:"no board context"})}}}}}function ar(R){let k=String(R.apiBasePath||"/api/boards").replace(/\/$/,""),v={...Yt,...R.corsHeaders||{}},K=R.serverMetaStore,H=R.boardRuntimeFactory,I=new Map,W="boards-config.json";function U(){let c=K.getText(W);if(!c)return {boards:[{id:"default",label:"Default Board"}]};try{return JSON.parse(c)}catch{return {boards:[{id:"default",label:"Default Board"}]}}}function L(c){K.putText(W,JSON.stringify(c,null,2));}function G(c){let p=String(c||"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/^_+|_+$/g,"");return p.length>0&&p.length<=64?p:null}function V(c){if(I.has(c))return I.get(c);let h=U().boards.find(O=>O.id===c)||{},d=H(c,h);return I.set(c,d),d}function _(c,p,h){let d=JSON.stringify(h),O=typeof Buffer<"u"?Buffer.byteLength(d):new TextEncoder().encode(d).length;c.writeHead(p,{...v,"Content-Type":"application/json; charset=utf-8","Content-Length":O}),c.end(d);}async function X(c,p,h){let d=c.method||"GET",O=h.pathname;if(d==="GET"&&O===k)return _(p,200,{ok:true,boards:U().boards}),true;if(d==="POST"&&O===k){let E=[];for await(let C of c)E.push(C);let w=typeof Buffer<"u"?Buffer.concat(E).toString("utf-8").trim():new TextDecoder().decode(d$1(E)).trim(),b={};try{b=w?JSON.parse(w):{};}catch{b={};}let S=G(b.id);if(!S)return _(p,400,{error:"board id must be 1-64 alphanumeric/dash/underscore characters"}),true;let g=U();if(g.boards.some(C=>C.id===S))return _(p,409,{error:`Board "${S}" is already registered`}),true;let $=typeof b.label=="string"&&b.label.trim()?b.label.trim():S,N={id:S,label:$};for(let[C,J]of Object.entries(b))C==="id"||C==="label"||J!=null&&(N[C]=J);return g.boards.push(N),L(g),_(p,200,{ok:true,board:N}),true}return false}async function Q(c,p,h){let O=h.pathname.match(new RegExp(`^${c$2(k)}/([^/]+)(/|$)`));if(!O)return false;let E=G(decodeURIComponent(O[1]));return E?U().boards.some(S=>S.id===E)?!!await V(E).handleRuntimeApi(c,p,h):(_(p,404,{error:`Board "${E}" not registered. POST ${k} with {id} to register it first.`}),true):(_(p,400,{error:"Invalid board id"}),true)}async function x(c,p,h){return !!(await X(c,p,h)||await Q(c,p,h))}function rt(c){if(!U().boards.some(h=>h.id===c))throw Object.assign(new Error(`Board "${c}" not registered`),{statusCode:404});return {service:V(c)}}return {get apiBasePath(){return k},get corsHeaders(){return v},handleApi:x,requireBoardService:rt}}export{nr as a,ar as b};//# sourceMappingURL=chunk-76C7N4YT.js.map
3
+ //# sourceMappingURL=chunk-76C7N4YT.js.map
@@ -0,0 +1,3 @@
1
+ 'use strict';var chunkEZENHAVZ_cjs=require('./chunk-EZENHAVZ.cjs'),chunk7FGPOGRV_cjs=require('./chunk-7FGPOGRV.cjs'),chunk7ICPAABP_cjs=require('./chunk-7ICPAABP.cjs'),chunkKAWQPLIE_cjs=require('./chunk-KAWQPLIE.cjs'),chunkNM6O35RY_cjs=require('./chunk-NM6O35RY.cjs'),chunk272IYUKT_cjs=require('./chunk-272IYUKT.cjs'),chunkNJJ7WEDT_cjs=require('./chunk-NJJ7WEDT.cjs'),chunkJ6EGN6S4_cjs=require('./chunk-J6EGN6S4.cjs'),chunkJJL5VOQZ_cjs=require('./chunk-JJL5VOQZ.cjs'),chunkYMEIPKLW_cjs=require('./chunk-YMEIPKLW.cjs'),chunkGYQXDNNI_cjs=require('./chunk-GYQXDNNI.cjs');function Zt(R){let{apiBasePath:k,json:v,readJsonBody:K,initBoardAndSetup:H,bootstrapBoard:I,buildPublishedRuntimePayload:W,createMcpControlplaneToolRegistry:U,retriggerCard:L,applyCardAction:G,resolveChatHandlerTarget:V,sendCardFileDownloadResponse:_}=R;async function X(Q,x,rt){let c=Q.method||"GET",p=rt,h=p.pathname;try{if(c==="GET"&&h===`${k}/init-board`)return await H(),v(x,200,await W()),!0;if(c==="POST"&&h===`${k}/mcp-controlplane`){await I();let w=await K(Q),b=typeof w.tool=="string"?w.tool.trim():"",S=w.args&&typeof w.args=="object"&&!Array.isArray(w.args)?w.args:{};if(!b)return v(x,400,{error:"tool is required"}),!0;try{let g=await chunk272IYUKT_cjs.a(b,S,U());if(g&&typeof g=="object"&&!Array.isArray(g)){let $=g;if($.status==="fail")return v(x,400,{error:chunk272IYUKT_cjs.b(g,"Request failed")}),!0;if($.status==="error")return v(x,500,{error:chunk272IYUKT_cjs.b(g,"Internal error")}),!0}v(x,200,g);}catch(g){let $=typeof g?.statusCode=="number"?Number(g.statusCode):500,N=g instanceof Error?g.message:String(g);v(x,$,{error:N});}return !0}let d=h.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(k)}/cards/([^/]+)/retrigger$`));if(c==="POST"&&d){await I();let w=decodeURIComponent(d[1]);return await L(w),v(x,200,{ok:!0}),!0}let O=h.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(k)}/cards/([^/]+)/actions$`));if(c==="POST"&&O){await I();let w=decodeURIComponent(O[1]),b=Date.now(),S=new Date(b).toISOString(),g=await K(Q),$=g?.actionType;if($==="chat-send"&&!await V(w)){let C=Date.now();return v(x,409,{error:`chat handler is not configured for card: ${w}`,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(C).toISOString(),responseSentAtMs:C,responseStatus:409}),!0}if($==="chat-send"){let C=g?.payload??{},J=typeof C["turn-id"]=="string"?C["turn-id"]:typeof C.turnId=="string"?C.turnId:typeof C.turn=="string"?C.turn:"";if(!J||!String(J).trim()){let q=Date.now();return v(x,400,{error:`chat-send requires a non-empty 'turn-id' (or 'turnId'/'turn') in payload for card: ${w}`,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(q).toISOString(),responseSentAtMs:q,responseStatus:400}),!0}}await G(w,$,g?.payload);let N=Date.now();return v(x,200,{ok:!0,requestReceivedAt:S,requestReceivedAtMs:b,responseSentAt:new Date(N).toISOString(),responseSentAtMs:N,responseStatus:200}),!0}let E=h.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(k)}/cards/([^/]+)/files/(\\d+)$`));if(c==="GET"&&E){let w=decodeURIComponent(E[1]),b=parseInt(E[2],10),S=p.searchParams.get("sn");return await _(x,w,b,S),!0}return !1}catch(d){let O=d?.statusCode||500;return v(x,O,{error:String(d?.message||d)}),true}}return {handleRuntimeApi:X}}var Yt={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"content-type,x-file-name","Access-Control-Allow-Methods":"GET,POST,PATCH,OPTIONS"},Xt="chat-handler-flow-queue";function nr(R){let k=String(R.apiBasePath||"/api/board").replace(/\/$/,""),v={...Yt,...R.corsHeaders||{}},K=R.queueLaneTuning??{},H=R.boardId||"",I=R.logger||{info:console.log,warn:console.warn,error:console.error},W=R.invocationAdapter,U=R.chatFlowRunner||null,L=R.chatStorage??chunkNJJ7WEDT_cjs.b(),G=chunkGYQXDNNI_cjs.a(L),V=R.notificationTransport||null,_=R.serverUrl||null,X=R.executionExtra||{},Q=R.onSseClientConnected,x=R.onSseClientDisconnected,rt=R.onChannelSubscribed,c=R.onChannelUnsubscribed,p=chunk7ICPAABP_cjs.a({chatStorage:L,readChatRecords:t=>yt(t),onSseClientDisconnected:x});function h(t){function e(a){if(Array.isArray(a))return a;if(a&&typeof a=="object"){let s=a;return Array.isArray(s.files)?s.files:[a]}return null}function r(a){return {async get(s){return a.get(s)},async set(s){return a.set(s)},async del(s){return a.del(s)},async patch(s){return a.patch(s)},async appendFiles(s){return a.appendFiles(s)}}}function o(a){function s(m){return {status:"success",data:m}}function l(m){return {status:"fail",error:m}}function u(m){return {status:"error",error:m instanceof Error?m.message:String(m)}}return {async get(m){try{let f=m.params?.id;if(f){let T=await a.readCard(f);return T?s({cards:[T]}):l(`card "${f}" not found`)}return s({cards:await a.readAllCards()})}catch(f){return u(f)}},async set(m){try{let f=m.body;if(f==null)return l("set requires a body (card object or array of cards)");let T=Array.isArray(f)?f:[f];for(let j of T){if(typeof j.id!="string")return l("each card must have a string `id` field");await a.writeCard(j.id,j);}return s({count:T.length})}catch(f){return u(f)}},async del(m){try{let f=m.body?.ids??[],T=m.params?.id,j=T?[...f,T]:f;if(j.length===0)return l("del requires body.ids (string[]) or params.id");for(let tt of j)await a.removeCard(tt);return s({count:j.length})}catch(f){return u(f)}},async patch(m){try{let f=m.params?.id,T=m.params?.path;if(!f)return l("patch requires params.id");if(!T)return l("patch requires params.path");let j=m.body,tt=j&&Object.prototype.hasOwnProperty.call(j,"value")?j.value:m.body;return await a.patchCard(f,T,tt),s({count:1})}catch(f){return u(f)}},async appendFiles(m){try{let f=m.params?.id;if(!f)return l("appendFiles requires params.id");let T=await a.readCard(f);if(!T)return l(`card "${f}" not found`);let j=e(m.body);if(!j||j.length===0)return l("appendFiles requires a file metadata object, array, or body.files array");let tt=T.card_data&&typeof T.card_data=="object"&&!Array.isArray(T.card_data)?T.card_data:{},At=Array.isArray(tt.files)?tt.files:[],ve=[...At,...j];return await a.patchCard(f,"card_data.files",ve),s({files_added:j.map((Oe,Pe)=>({idx:At.length+Pe,entry:Oe}))})}catch(f){return u(f)}}}}let n=chunkKAWQPLIE_cjs.a(t.boardAdapter)?chunkJ6EGN6S4_cjs.j(t.baseRef,t.boardAdapter):chunkJJL5VOQZ_cjs.y(t.baseRef,t.boardAdapter),i=t.nonCoreAdapter??(!chunkKAWQPLIE_cjs.a(t.boardAdapter)&&w(t.boardAdapter)?t.boardAdapter:null),y=t.nonCore??(i?chunkJJL5VOQZ_cjs.z(t.baseRef,i):null),P,A=chunkKAWQPLIE_cjs.a(t.boardAdapter)?(()=>{let a=chunkJ6EGN6S4_cjs.d(chunkJ6EGN6S4_cjs.c(chunkJ6EGN6S4_cjs.b(t.boardAdapter.kvStorageForRef(t.cardStoreRef)),t.boardAdapter.hashFn),I.warn),s=o(a);return P={get(l){return s.get(l)},set(l){return s.set(l)}},s})():(()=>{let a=t.boardAdapter.kvStorageForRef(t.cardStoreRef),l=chunkYMEIPKLW_cjs.a(chunkJJL5VOQZ_cjs.l({readIndex:()=>a.read("_index"),writeIndex:u=>a.write("_index",u),readCard:u=>a.read(u),writeCard:(u,m)=>(a.write(u,m),u),removeCard:u=>{a.delete(u);},cardExists:u=>a.read(u)!==null,defaultCardKey:u=>u},I.warn));return P=l,r(l)})(),F=t.artifactsAdapter||t.boardAdapter,B=t.filesArtifactsStore??null,M=B?{putBytes(a,s,l){B.putBytes(a,s,l);},getBytes(a){return B.getBytes(a)},listKeys(a){return B.list(a).map(s=>s.key)}}:null;if(!M&&!chunkKAWQPLIE_cjs.a(F)){let a=t.artifactsAdapter?F.blobStorage(""):F.blobStorage("files"),s=chunkNJJ7WEDT_cjs.c(a);M={putBytes(l,u,m){s.putBytes(l,u,m);},getBytes(l){return s.getBytes(l)},listKeys(l){return s.list(l).map(u=>u.key)}};}else if(!M&&chunkKAWQPLIE_cjs.a(F)){let a=t.artifactsAdapter?F.blobStorage(""):F.blobStorage("files");M={async putBytes(s,l){if(a.writeBytes){await a.writeBytes(s,l);return}let u=JSON.stringify({__kind:"bytes-array",data:[...l]});await a.write(s,u);},async getBytes(s){if(a.readBytes){let u=await a.readBytes(s);if(u!==null)return u}let l=await a.read(s);if(l===null)return null;try{let u=JSON.parse(l);if(u&&u.__kind==="bytes-array"&&Array.isArray(u.data))return new Uint8Array(u.data)}catch{}return new TextEncoder().encode(l)},async listKeys(s){return await a.listKeys(s)}};}let D={async init(a){return n.init(a)},async status(a){return n.status(a)},async getConfig(a){return n.getConfig(a)},async getAllOutputsDataObjects(a){return n.getAllOutputsDataObjects(a)},async getAllOutputsComputedValues(a){return n.getAllOutputsComputedValues(a)},async getOutputsFetchedSources(a){return n.getOutputsFetchedSources(a)},async upsertCard(a){return n.upsertCard(a)},async removeCard(a){return n.removeCard(a)},async cardRefreshedNotify(a){return n.cardRefreshedNotify(a)},async sourceDataFetched(a){return n.sourceDataFetched(a)},async sourceDataFetchFailure(a){return n.sourceDataFetchFailure(a)}};return {label:t.label,board:n,nonCore:y,publicCardStore:P,boardOps:D,cardStoreOps:A,get filesArtifacts(){return M},boardAdapter:t.boardAdapter,cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef,artifactsStoreRef:t.artifactsStoreRef,chatStoreRef:t.chatStoreRef,scratchStoreRef:t.scratchStoreRef,archiveStoreRef:t.archiveStoreRef,notifyRef:t.notifyRef,taskExecutorRef:t.taskExecutorRef,chatHandlerRef:t.chatHandlerRef,chatHandlerFlow:t.chatHandlerFlow,inferenceAdapterRef:t.inferenceAdapterRef,notification:chunkEZENHAVZ_cjs.a(),notificationTeardown:null,initialized:false,cardsBootstrapped:false}}let d=R.boards.map(h),O=new Map;function E(t){return O.get(t)??0}function w(t){let e=t;return typeof e.invokeExecutor=="function"&&typeof e.validateSchema=="function"}function b(t){let e=d[E(t)];return {files:e?e.filesArtifacts:null}}function S(){return chunkNJJ7WEDT_cjs.e()}function g(t){return String(t||"").replace(/[^a-zA-Z0-9_-]/g,"_")||"unknown-card"}async function $(t){if(!t||t.notificationTeardown||!V||!t.notifyRef)return;let e=await V.subscribe(t.notifyRef,r=>{chunkEZENHAVZ_cjs.c(t.notification,r);let o=r.kind==="notification-batch"?r.notifications:[r];p.broadcastNotificationBatch(o);});t.notificationTeardown=e;}async function N(t){if(!t||t.initialized)return;let e={cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef};t.artifactsStoreRef&&(e.artifactsStoreRef=t.artifactsStoreRef),t.chatStoreRef&&(e.chatStoreRef=t.chatStoreRef),t.scratchStoreRef&&(e.scratchStoreRef=t.scratchStoreRef),t.archiveStoreRef&&(e.archiveStoreRef=t.archiveStoreRef);let r={};t.taskExecutorRef&&(r["task-executor-ref"]=t.taskExecutorRef),t.chatHandlerFlow!==void 0&&(r["chat-handler-flow"]=t.chatHandlerFlow),t.inferenceAdapterRef&&(r["inference-adapter-ref"]=t.inferenceAdapterRef);let o=await t.boardOps.init({params:e,body:r});if(o.status!=="success")throw Object.assign(new Error(o.error||`init failed for ${t.label}`),{statusCode:500});if(await $(t),!t.chatHandlerFlow&&t.chatHandlerRef&&W.describe)try{let n=await W.describe(t.chatHandlerRef);n&&n.kind!=="chat-handler"?I.warn(`[init] chat-handler describe returned kind="${n.kind}", expected "chat-handler" for ${t.label}`):n&&I.info(`[init] chat-handler validated: ${n.name} (protocol ${n.protocolVersion}) for ${t.label}`);}catch(n){I.warn(`[init] chat-handler describe failed for ${t.label}: ${n?.message||String(n)}`);}t.initialized=true;}async function C(t){if(!t.boardAdapter.publishBoardChangeNotifications)return;let e=[],r=await t.boardOps.status({});r.status==="success"&&r.data!=null&&chunkEZENHAVZ_cjs.b(r.data)&&e.push({kind:"status",status:r.data});let o=await t.boardOps.getAllOutputsDataObjects({});if(o.status==="success"&&o.data!=null)for(let[i,y]of Object.entries(o.data))i&&e.push({kind:"data_object",key:i,payload:y});let n=await t.boardOps.getAllOutputsComputedValues({});if(n.status==="success"&&n.data!=null)for(let[i,y]of Object.entries(n.data))i&&e.push({kind:"computed_values",cardId:i,values:y});e.length>0&&t.boardAdapter.publishBoardChangeNotifications(e);}async function J(t,e){if(!t||t.cardsBootstrapped)return;let r=await t.cardStoreOps.get({}),o=r.status==="success"&&Array.isArray(r.data?.cards)?r.data.cards:[];for(let n of o)typeof n.id=="string"&&(O.set(n.id,e),await t.boardOps.upsertCard({params:{cardId:n.id}}));t.cardsBootstrapped=true;}async function q(){for(let t of d)await N(t);}async function it(){await q();for(let t=0;t<d.length;t++)await C(d[t]),await J(d[t],t),await C(d[t]);}async function ct(t=false){t||await q();for(let e of d){let r=await e.board.processAccumulatedEvents({});if(r.status!=="success")return r}return {status:"success"}}async function te(){return await q(),ct(true)}function Y(t){return d[E(t)]??null}async function nt(t){let e=Y(t);if(!e)return null;let r=await e.cardStoreOps.get({params:{id:t}});if(r.status!=="success")return null;let o=Array.isArray(r.data?.cards)?r.data.cards:[];return o.length>0?o[0]:null}async function ft(){let t=async r=>{if(!r)return [];let o=await r.cardStoreOps.get({});return o.status!=="success"||!Array.isArray(o.data?.cards)?[]:o.data.cards},e=[];for(let r of d)e.push(...await t(r));return e}function ee(){return d[0]??null}let pt=chunkEZENHAVZ_cjs.n({boardContexts:d,cardOwnerIndex:O,cardContextForCard:t=>Y(t),readStatusSnapshot:()=>ie(),readDataObjectsByToken:()=>de(),readCardRuntimeArtifacts:()=>ce(),readCardFromStore:t=>nt(t),readCardDefinitions:()=>ft(),processAccumulatedLaneInternal:t=>ct(t),reportSourceFetched:(t,e)=>bt(t,{ref:e}),reportSourceFetchFailure:(t,e)=>Ct(t,{reason:e}),uploadCardFile:(t,e,r,o,n)=>Rt(t,e,r,o,n),chatStorePublic:G,serverUrl:_,apiBasePath:k}),re=pt.mcpCardStoreFacade,z=pt.createMcpFacade,ne=chunkEZENHAVZ_cjs.h({boardId:H,getMcpFacade:()=>z(),getMcpCardStoreFacade:()=>re()});function ae(t){return chunkEZENHAVZ_cjs.k(t)}function oe(){return chunkEZENHAVZ_cjs.l(z())}function se(){return chunkEZENHAVZ_cjs.m({boardId:H,uploadCardFile:Rt,getMcpFacade:()=>z(),controlplane:ne})}let at=chunkEZENHAVZ_cjs.i({boardId:H,boardContexts:d,readCardDefinitions:()=>ft(),readChatRecords:t=>yt(t),getChatProcessing:t=>z().getChatProcessing({cardId:t}).active}),ie=at.readStatusSnapshot,ce=at.readCardRuntimeArtifacts,de=at.readDataObjectsByToken,dt=at.buildPublishedRuntimePayload;async function mt(t,e,r){let o=r?.syncBoard!==false,n=r?.restartOnlyIfChanged===true,i=Y(t);if(!i)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let y=await nt(t);if(!y)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let P=n?JSON.stringify(y):null,A=e(y)||y;if(n&&JSON.stringify(A)===P)return;let F=await i.cardStoreOps.set({body:A});if(F.status!=="success")throw Object.assign(new Error(F.error||`Failed to persist card: ${t}`),{statusCode:500});if(o){let B=await i.boardOps.upsertCard({params:{cardId:t,restart:true}});if(B.status!=="success")throw Object.assign(new Error(B.error||`Failed to upsert card: ${t}`),{statusCode:500})}}async function ue(t,e){await mt(t,e,{syncBoard:true});}async function gt(t,e){await mt(t,e,{syncBoard:false});}async function le(t){let e=Y(t);if(!e)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});if(!await nt(t))throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let o=await e.boardOps.upsertCard({params:{cardId:t,restart:true}});if(o.status!=="success")throw Object.assign(new Error(o.error||`Failed to retrigger card: ${t}`),{statusCode:500})}function fe(t){L.clear(t);try{z().setChatProcessing({cardId:t,active:!1});}catch{}}function pe(t,e,r,o,n=""){let i=typeof r=="string"?r.trim():"";return L.append(t,e||"system",i,o,n)}function yt(t){return L.readAll(t)}let Rt=chunkEZENHAVZ_cjs.j({safeCardId:t=>g(t),artifactsStores:t=>b(t),cardFileMetadataStore:()=>S(),readCardFromStore:t=>nt(t),updateCardLocalOnly:(t,e)=>gt(t,e),writeChatRecord:(t,e,r,o,n)=>pe(t,e,r,o,n)}).uploadCardFile;async function ht(t){let e=Y(t);if(!e)return null;let r=await e.boardOps.getConfig({params:{key:"chat-handler-flow"}}),o=r.status==="success"?r.data?.value:null,n=e.chatHandlerRef;return o==null&&(!n||typeof n!="object")?null:{ctx:e,handlerFlow:o,handlerRef:n}}async function me(t,e,r=false,o=""){let n=await ht(t);if(!n)return;let{ctx:i,handlerFlow:y,handlerRef:P}=n;if(!r)try{z().setChatProcessing({cardId:t,active:!0});}catch{}let A={boardId:H,cardId:String(t),lastChatEntryId:e,...o?{turnId:o}:{},...X,..._?{serverUrl:_}:{}},F=y!=null?{meta:"chat-handler-flow",howToRun:"built-in",whatToRun:{kind:"built-in",value:Xt}}:P;try{chunkKAWQPLIE_cjs.a(i.boardAdapter)?await i.boardAdapter.chatAgentStore().enqueueRequest({boardId:H,ref:F,args:y!=null?{...A,__chatHandlerFlow:y}:A}):i.boardAdapter.chatAgentStore().enqueueRequest({boardId:H,ref:F,args:y!=null?{...A,__chatHandlerFlow:y}:A}),await Promise.resolve(i.boardAdapter.requestProcessAccumulated?.());}catch(B){try{z().setChatProcessing({cardId:t,active:!1});}catch{}I.warn(`[chat-handler] queue failed for card "${t}": ${B instanceof Error?B.message:String(B)}`);}}async function ge(t,e,r){if(e.howToRun==="built-in"&&chunkKAWQPLIE_cjs.b(e)===Xt){let o=U,n=r.__chatHandlerFlow,i={...r};return delete i.__chatHandlerFlow,o?o.run(n,i,{boardId:H,cardId:String(i.cardId||""),label:t.label,logger:I,serverUrl:_,executionExtra:X}):{dispatched:false,error:"chat-handler-flow configured but no chatFlowRunner was provided"}}return W.invoke(e,r)}async function ye(t,e=false){e||await q();let r=typeof t.args?.cardId=="string"?t.args.cardId:"",o=r?Y(r):ee();if(!o)throw new Error(r?`Board context is unavailable for chat-agent request: ${r}`:"Board context is unavailable for chat-agent request");let n=await ge(o,t.ref,t.args);if(!n.dispatched){if(r)try{L.setProcessing(r,!1);}catch{}throw new Error(n.error||`chat-agent dispatch failed for card "${r||"unknown"}"`)}}async function Re(t,e,r){let o=e==="chat-send"?gt:ue,n;await o(t,i=>{let y=new Date().toISOString(),P=i.card_data&&typeof i.card_data=="object"?i.card_data:{};if(i.card_data=P,e==="chat-send"){let A=r&&typeof r.text=="string"?r.text.trim():"",F=r&&typeof r["turn-id"]=="string"?r["turn-id"]:r&&typeof r.turnId=="string"?r.turnId:r&&typeof r.turn=="string"?r.turn:"",B=[];if(Array.isArray(r?.files)){for(let M of r.files)if(M){if(typeof M=="string"){B.push({name:M});continue}if(typeof M=="object"){let D=M;typeof D.name=="string"&&B.push({name:D.name,size:D.size,mime_type:D.mime_type,uploaded_at:D.uploaded_at,stored_name:D.stored_name,chat:D.chat===true});}}}if(A||B.length>0){let M=G.runBatch({cardId:t,commands:[{command:"append",role:"user",text:A,files:B,turn:F},{command:"set-processing",active:true}]});if(M.status!=="success")throw new Error(M.error);let D=M.data.results[0]?.data?.id;if(typeof D!="string"||!D)throw new Error(`chat-send did not return an append id for card ${t}`);n={cardId:t,lastEntryId:D,processingAlreadySet:true,turnId:F};try{p.broadcastCardChats(t);}catch{}}return i}if(e==="file-upload"){let A=S().normalizeIncoming(r?.files,y);return A.length>0&&S().merge(P,A),i}if(e==="action"){let A=r&&typeof r.buttonId=="string"?r.buttonId:"";if(!A)return i;P.lastAction={buttonId:A,at:y},P.lastActionText=`${A} @ ${y}`;}return i}),n&&me(n.cardId,n.lastEntryId,n.processingAlreadySet,n.turnId??"");}function ot(t,e,r){let o=JSON.stringify(r),n=typeof Buffer<"u"?Buffer.byteLength(o):new TextEncoder().encode(o).length;t.writeHead(e,{...v,"Content-Type":"application/json; charset=utf-8","Content-Length":n}),t.end(o);}async function wt(t,e,r){let o=await nt(t);if(!o)throw Object.assign(new Error("Card not found"),{statusCode:404});let n=S().resolve(o.card_data,e,r);if(!n.ok&&n.reason==="stale_reference")throw Object.assign(new Error("File reference is stale. Refresh and try again."),{statusCode:409});if(!n.ok)throw Object.assign(new Error("File not found"),{statusCode:404});let i=n.file,y=g(t),P=b(t),A=String(i.stored_name||""),F=`${y}/${A}`,B=P.files?await P.files.getBytes(F):null;if(!B)throw Object.assign(new Error("File not found"),{statusCode:404});return {fileRecord:i,bytes:B}}async function he(t,e,r,o){let{fileRecord:n,bytes:i}=await wt(e,r,o),y=String(n.name||n.stored_name||"download.bin"),P=String(n.mime_type||"application/octet-stream");t.writeHead(200,{"Content-Type":P,"Content-Disposition":`attachment; filename="${y}"`,"Content-Length":i.length}),t.end(i);}function we(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 be(t,e,r){let o=t.split(/\r?\n/);return (e==="head"?o.slice(0,r):o.slice(-r)).join(`
2
+ `)}async function st(t){let e=[];for await(let o of t)e.push(o);let r=typeof Buffer<"u"?Buffer.concat(e).toString("utf-8").trim():new TextDecoder().decode(chunkKAWQPLIE_cjs.d(e)).trim();return r?JSON.parse(r):{}}async function bt(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 o=d[0];return o?o.boardOps.sourceDataFetched({params:{token:t,ref:r}}):{status:"fail",error:"no board context"}}async function Ct(t,e){let r=typeof e.reason=="string"&&e.reason.trim()?e.reason:"unknown",o=d[0];return o?o.boardOps.sourceDataFetchFailure({params:{token:t,reason:r}}):{status:"fail",error:"no board context"}}let Ce=chunk7ICPAABP_cjs.b({sseHub:p,corsHeaders:v,json:ot,buildPublishedRuntimePayload:()=>dt(),onSseClientConnected:Q,onChannelSubscribed:rt,onChannelUnsubscribed:c,apiBasePath:k,readJsonBody:t=>st(t),initBoardAndSetup:()=>q(),bootstrapBoard:()=>it(),boardContexts:d,publishPersistedStateSnapshot:t=>C(t),upsertCardsFromSource:(t,e)=>J(t,e)}).handleWatchersRoutes,Ae=chunk7FGPOGRV_cjs.a({apiBasePath:k,json:ot,readJsonBody:t=>st(t),bootstrapBoard:()=>it(),createMcpFacade:()=>z(),createMcpToolRegistry:t=>ae(t),resolveCardFileDownloadPayload:(t,e,r)=>wt(t,e,r),isLikelyTextMimeType:t=>we(t),sliceTextByLines:(t,e,r)=>be(t,e,r)}).handleAgentfaceApi,Se=chunkNM6O35RY_cjs.a({apiBasePath:k,json:ot,readJsonBody:t=>st(t),initBoardAndSetup:()=>q(),createMcpWebhookToolRegistry:()=>oe()}).handleWebhooksApi,Be=Zt({apiBasePath:k,json:ot,readJsonBody:t=>st(t),initBoardAndSetup:()=>q(),bootstrapBoard:()=>it(),buildPublishedRuntimePayload:()=>dt(),createMcpControlplaneToolRegistry:()=>se(),retriggerCard:t=>le(t),applyCardAction:(t,e,r)=>Re(t,e,r),resolveChatHandlerTarget:t=>ht(t),sendCardFileDownloadResponse:(t,e,r,o)=>he(t,e,r,o)}).handleRuntimeApi;async function ke(t,e,r){return !!(await Ae(t,e,r)||await Se(t,e,r)||await Ce(t,e,r)||await Be(t,e,r))}return {get apiBasePath(){return k},get corsHeaders(){return v},get queueLaneTuning(){return K},handleRuntimeApi:ke,buildPublishedRuntimePayload:dt,processAccumulatedEvents:te,processAccumulatedLane:ct,handleChatAgentRequest:ye,clearChatRecords:fe,reportSourceFetched(t,e){return bt(t,{ref:e})},reportSourceFetchFailure(t,e){return Ct(t,{reason:e})},get cardStore(){return d[0]?.publicCardStore??{get(){return Promise.resolve({status:"fail",error:"no board context"})},set(){return Promise.resolve({status:"fail",error:"no board context"})}}}}}function ar(R){let k=String(R.apiBasePath||"/api/boards").replace(/\/$/,""),v={...Yt,...R.corsHeaders||{}},K=R.serverMetaStore,H=R.boardRuntimeFactory,I=new Map,W="boards-config.json";function U(){let c=K.getText(W);if(!c)return {boards:[{id:"default",label:"Default Board"}]};try{return JSON.parse(c)}catch{return {boards:[{id:"default",label:"Default Board"}]}}}function L(c){K.putText(W,JSON.stringify(c,null,2));}function G(c){let p=String(c||"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/^_+|_+$/g,"");return p.length>0&&p.length<=64?p:null}function V(c){if(I.has(c))return I.get(c);let h=U().boards.find(O=>O.id===c)||{},d=H(c,h);return I.set(c,d),d}function _(c,p,h){let d=JSON.stringify(h),O=typeof Buffer<"u"?Buffer.byteLength(d):new TextEncoder().encode(d).length;c.writeHead(p,{...v,"Content-Type":"application/json; charset=utf-8","Content-Length":O}),c.end(d);}async function X(c,p,h){let d=c.method||"GET",O=h.pathname;if(d==="GET"&&O===k)return _(p,200,{ok:true,boards:U().boards}),true;if(d==="POST"&&O===k){let E=[];for await(let C of c)E.push(C);let w=typeof Buffer<"u"?Buffer.concat(E).toString("utf-8").trim():new TextDecoder().decode(chunkKAWQPLIE_cjs.d(E)).trim(),b={};try{b=w?JSON.parse(w):{};}catch{b={};}let S=G(b.id);if(!S)return _(p,400,{error:"board id must be 1-64 alphanumeric/dash/underscore characters"}),true;let g=U();if(g.boards.some(C=>C.id===S))return _(p,409,{error:`Board "${S}" is already registered`}),true;let $=typeof b.label=="string"&&b.label.trim()?b.label.trim():S,N={id:S,label:$};for(let[C,J]of Object.entries(b))C==="id"||C==="label"||J!=null&&(N[C]=J);return g.boards.push(N),L(g),_(p,200,{ok:true,board:N}),true}return false}async function Q(c,p,h){let O=h.pathname.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(k)}/([^/]+)(/|$)`));if(!O)return false;let E=G(decodeURIComponent(O[1]));return E?U().boards.some(S=>S.id===E)?!!await V(E).handleRuntimeApi(c,p,h):(_(p,404,{error:`Board "${E}" not registered. POST ${k} with {id} to register it first.`}),true):(_(p,400,{error:"Invalid board id"}),true)}async function x(c,p,h){return !!(await X(c,p,h)||await Q(c,p,h))}function rt(c){if(!U().boards.some(h=>h.id===c))throw Object.assign(new Error(`Board "${c}" not registered`),{statusCode:404});return {service:V(c)}}return {get apiBasePath(){return k},get corsHeaders(){return v},handleApi:x,requireBoardService:rt}}exports.a=nr;exports.b=ar;//# sourceMappingURL=chunk-ASR44K7H.cjs.map
3
+ //# sourceMappingURL=chunk-ASR44K7H.cjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkLPXVVMQT_cjs=require('./chunk-LPXVVMQT.cjs'),chunkKAWQPLIE_cjs=require('./chunk-KAWQPLIE.cjs'),chunkSFVO2LB2_cjs=require('./chunk-SFVO2LB2.cjs'),chunkPBOQ4HYB_cjs=require('./chunk-PBOQ4HYB.cjs');function H(){return {status:null,computedValues:{},dataObjects:{},cards:{}}}function V(n){if(!n||typeof n!="object")return false;let e=n.summary;return !e||typeof e!="object"?false:Number(e.card_count||0)>0}function z(n,e){if(!e||typeof e!="object")return;let a=e;if(a.kind==="notification-batch"&&Array.isArray(a.notifications)){for(let l of a.notifications)z(n,l);return}a.kind==="status"&&V(a.status)&&(n.status=a.status),a.kind==="computed_values"&&a.cardId&&(n.computedValues[a.cardId]=a.values),a.kind==="data_object"&&a.key&&(n.dataObjects[a.key]=a.payload),a.kind==="card_refreshed"&&a.cardId&&(n.cards[a.cardId]=a.card),a.kind==="card_removed"&&a.cardId&&(delete n.cards[a.cardId],delete n.computedValues[a.cardId]);}function B(n,e){if(n?.status==="success")return Object.prototype.hasOwnProperty.call(n,"data")?n.data:void 0;throw n?.status==="fail"||n?.status==="error"?Object.assign(new Error(n.error||`${e} failed`),{statusCode:400}):Object.assign(new Error(`${e} returned an unexpected response`),{statusCode:500})}async function j(n,e){return B(await n,e)}function D(n){let e=chunkLPXVVMQT_cjs.a(n,"key");if(!e)throw Object.assign(new Error("MCP tool requires key"),{statusCode:400});let a=e.split(".");if(!(a.length>=2&&a[0]==="chat"&&a.every(h=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(h))))throw Object.assign(new Error("MCP tool only supports card private keys under chat.*"),{statusCode:400});return e}function q(n,e){let a=n.__private;for(let l of e.split(".")){if(!a||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,l))return {exists:false,value:null};a=a[l];}return {exists:true,value:a}}function Q(n){let{boardId:e,getMcpFacade:a,getMcpCardStoreFacade:l}=n;function h(p){let o=chunkLPXVVMQT_cjs.a(p,"board_id"),c=chunkLPXVVMQT_cjs.a(p,"card_id");if(!o)throw Object.assign(new Error("MCP tool requires board_id"),{statusCode:400});if(!c)throw Object.assign(new Error("MCP tool requires card_id"),{statusCode:400});if(o!==e)throw Object.assign(new Error(`Unknown board_id: ${o}`),{statusCode:400});return {cardId:c}}function R(p,o){let{cardId:c}=h(p);return a().setChatProcessing({cardId:c,active:o}),{status:"success",data:{boardId:e,cardId:c,active:o}}}function _(p){let{cardId:o}=h(p),c=a().getChatProcessing({cardId:o});return {status:"success",data:{boardId:e,cardId:o,active:c.active}}}async function t(p){let{cardId:o}=h(p),c=D(p);if(!Object.prototype.hasOwnProperty.call(p,"value"))throw Object.assign(new Error("MCP tool requires value"),{statusCode:400});if(c.split(".").includes("visible_controlplane_only")){let i=await j(l().get({params:{id:o}}),"cardStore.get"),g=Array.isArray(i.cards)&&i.cards.length>0&&typeof i.cards[0]=="object"&&!Array.isArray(i.cards[0])?i.cards[0]:null,w=g?q(g,"visible_controlplane_only").value:void 0;if(p.value!==w)throw Object.assign(new Error("MCP tool cannot change the reserved private flag visible_controlplane_only"),{statusCode:403});return {status:"success",data:{boardId:e,cardId:o,key:c}}}return B(await l().patch({params:{id:o,path:`__private.${c}`},body:{value:p.value}}),"cardStore.patch"),{status:"success",data:{boardId:e,cardId:o,key:c}}}async function C(p){let{cardId:o}=h(p),c=D(p),i=await j(l().get({params:{id:o}}),"cardStore.get"),g=Array.isArray(i.cards)&&i.cards.length>0&&i.cards[0]&&typeof i.cards[0]=="object"&&!Array.isArray(i.cards[0])?i.cards[0]:null;if(!g)throw Object.assign(new Error(`Card "${o}" not found`),{statusCode:404});let w=q(g,c);return {status:"success",data:{boardId:e,cardId:o,key:c,exists:w.exists,value:w.value}}}return {requireCardArgs:h,setChatProcessing:R,getChatProcessing:_,setCardMeta:t,getCardMeta:C}}function ee(n){let{boardId:e,boardContexts:a,readCardDefinitions:l,readChatRecords:h,getChatProcessing:R}=n;async function _(){let o=(await Promise.all(a.map(async y=>{try{let u=y.boardAdapter.kvStorageForRef(y.outputsStoreRef),m=await Promise.resolve(u.read("status"));if(m!=null)return m}catch{}return y.notification.status}))).filter(Boolean);if(o.length===0)return null;if(o.length===1)return o[0];let c=[],i=["completed","eligible","pending","blocked","unresolved","failed","in_progress","orphan_cards"],g={};for(let y of i)g[y]=0;for(let y of o){let u=y,m=Array.isArray(u.cards)?u.cards:[];c.push(...m);for(let b of i)g[b]+=Number(u?.summary?.[b]||0);}let w=o[0];return {...w,cards:c,summary:{...w.summary||{},card_count:c.length,...g}}}async function t(){let o={},c=async i=>{try{let g=await i.boardOps.getAllOutputsComputedValues({});if(g.status==="success"&&g.data&&typeof g.data=="object"){for(let[w,y]of Object.entries(g.data)){let u=i.notification.cards[w];o[w]={schema_version:"v1",card_id:w,card_data:u?.card_data??{},computed_values:y??{}};}return}}catch{}for(let[g,w]of Object.entries(i.notification.computedValues)){let y=i.notification.cards[g];o[g]={schema_version:"v1",card_id:g,card_data:y?.card_data??{},computed_values:w??{}};}};for(let i of a)await c(i);return o}async function C(){let o={};for(let c of a){try{let i=await c.boardOps.getAllOutputsDataObjects({});if(i.status==="success"&&i.data&&typeof i.data=="object"){Object.assign(o,i.data);continue}}catch{}Object.assign(o,c.notification.dataObjects||{});}return o}async function p(){let o=await l(),c=await t(),i=await C(),g={};for(let y of o){if(!y?.id)continue;let u=y.id,m=c[u]||{},b={...m.card_data&&typeof m.card_data=="object"?m.card_data:y.card_data&&typeof y.card_data=="object"?y.card_data:{}};g[u]={schema_version:m.schema_version||"v1",card_id:m.card_id||u,card_data:b,computed_values:m.computed_values&&typeof m.computed_values=="object"?m.computed_values:{}};}let w={};for(let y of o){if(!y?.id)continue;let u=y.id;try{let m=h(u),b=R(u);(m.length>0||b)&&(w[u]={messages:m.map(v=>({role:String(v.role||"system"),text:String(v.text||""),files:Array.isArray(v.files)?v.files:[]})),receiving:!1,processing:b});}catch{}}return {boardId:e,cardDefinitions:o,statusSnapshot:await _(),dataObjectsByToken:i,cardRuntimeById:g,cardChatsByCardId:w}}return {readStatusSnapshot:_,readCardRuntimeArtifacts:t,readDataObjectsByToken:C,buildPublishedRuntimePayload:p}}function W(n){let e=String(n||"").trim();if(!e)return "upload.bin";let a=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return (a>=0?e.slice(a+1):e)||"upload.bin"}function re(n){let{safeCardId:e,artifactsStores:a,cardFileMetadataStore:l,readCardFromStore:h,updateCardLocalOnly:R,writeChatRecord:_}=n;async function t(o){let c=[];try{let i=await h(o);if(!i)return c;let g=l().read(i.card_data&&typeof i.card_data=="object"?i.card_data:null);for(let w of g)c.push(String(w.stored_name??""));}catch{}return c}async function C(o,c,i,g){let w=e(o),y=a(o),u=W(c),m=await t(o),v=`${String(m.length+1).padStart(3,"0")}-${u}`.slice(-36);return y.files&&await y.files.putBytes(`${w}/${v}`,new Uint8Array(g),i||"application/octet-stream"),{name:u,stored_name:v,size:g.length,mime_type:i||"application/octet-stream",uploaded_at:new Date().toISOString()}}async function p(o,c,i,g,w){if(!g.length)throw Object.assign(new Error("Empty upload body"),{statusCode:400});let y=w?.inChat===true,u=await C(o,c,i,g),m=null;if(await R(o,b=>{let v=new Date().toISOString(),A=b.card_data&&typeof b.card_data=="object"?b.card_data:{};b.card_data=A;let s=l().normalizeIncoming([{name:u.name,stored_name:u.stored_name,size:u.size,mime_type:u.mime_type,uploaded_at:u.uploaded_at||v,chat:y}],v);return m=l().merge(A,s).findIndex(d=>d.stored_name===u.stored_name),b}),y&&w?.suppressChatRecordWrite!==true){let b=typeof m=="number"&&m>=0?` #${m}`:"";_(o,"system",`file uploaded: ${u.name} as ${u.stored_name}${b}`,[],w?.turnId??"");}return {ok:true,file:{...u,...typeof m=="number"&&m>=0?{file_idx:m}:{},chat:y},...typeof m=="number"&&m>=0?{file_idx:m}:{}}}return {uploadCardFile:p,readCardStoredFileNames:t}}function oe(n){return {"discover.source-kinds":()=>n.discoverSourceKinds(),"inspect.board-runtime-status":()=>n.inspectBoardRuntimeStatus(),"inspect.card-definition-and-runtime":e=>n.inspectCardDefinitionAndRuntime({cardId:chunkLPXVVMQT_cjs.a(e,"card_id")}),"inspect.chat-messages-on-cards":e=>{let a=chunkLPXVVMQT_cjs.b(e,"tail_turns"),l=chunkLPXVVMQT_cjs.b(e,"tail"),h=chunkLPXVVMQT_cjs.a(e,"turn_id"),R=e.all_turns===true,_=chunkLPXVVMQT_cjs.a(e,"tail_turns_before_id");return n.inspectChatMessagesOnCards({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),...a!==void 0?{lastUserTurns:a}:{},...l!==void 0?{tail:l}:{},...h?{turnId:h}:{},...R?{allTurns:true}:{},..._?{tailTurnsBeforeId:_}:{}})},"inspect.file-contents":e=>n.inspectFileContents({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),fileIdx:Number(chunkLPXVVMQT_cjs.b(e,"file_idx"))}),"preflight.validate-candidate-card-definition":e=>n.preflightValidateCandidateCardDefinition({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content")}),"preflight.materialize-candidate-card":e=>n.preflightMaterializeCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockRequires:chunkLPXVVMQT_cjs.d(e,"mock_requires","mock_requires"),mockFetchedSources:chunkLPXVVMQT_cjs.d(e,"mock_fetched_sources","mock_fetched_sources")}),"preflight.probe-single-source-in-candidate-card":e=>n.preflightProbeSingleSourceInCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockProjections:chunkLPXVVMQT_cjs.c(e,"mock_projections"),sourceIdx:chunkLPXVVMQT_cjs.e(e,"source_idx","source_idx")}),"preflight.run-single-source-in-candidate-card":e=>n.preflightRunSingleSourceInCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockProjections:chunkLPXVVMQT_cjs.c(e,"mock_projections"),sourceIdx:chunkLPXVVMQT_cjs.e(e,"source_idx","source_idx")}),"preflight.run-single-source-in-live-card":e=>n.preflightRunSingleSourceInLiveCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),sourceIdx:chunkLPXVVMQT_cjs.e(e,"source_idx","source_idx"),mockRequires:chunkLPXVVMQT_cjs.d(e,"mock_requires","mock_requires")}),"preflight.run-one-cycle-with-candidate-card":e=>n.preflightRunOneCycleWithCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockRequires:chunkLPXVVMQT_cjs.c(e,"mock_requires")}),"manage.read-card":e=>n.manageReadCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id")}),"stage-ai-response-and-any-attachments":e=>{let a=chunkLPXVVMQT_cjs.a(e,"turn_id");if(!a)throw Object.assign(new Error("stage-ai-response-and-any-attachments requires a non-empty turn_id"),{statusCode:400});return n.manageAddChatEntryAndAnyAttachments({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),role:"assistant",...typeof e.text=="string"?{text:e.text}:{},...a?{turn:a}:{},...Array.isArray(e.files)?{files:e.files}:{}})},"manage.upsert-card":e=>n.manageUpsertCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),candidateCardContent:chunkLPXVVMQT_cjs.c(e,"candidate_card_content")}),"manage.remove-card":e=>n.manageRemoveCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id")})}}function se(n){return {"webhook.process-accumulated":()=>n.webhookProcessAccumulated(),"webhook.source-fetch-done":e=>n.webhookSourceFetchDone({token:chunkLPXVVMQT_cjs.a(e,"token"),ref:chunkLPXVVMQT_cjs.a(e,"ref")}),"webhook.source-fetch-failed":e=>n.webhookSourceFetchFailed({token:chunkLPXVVMQT_cjs.a(e,"token"),reason:chunkLPXVVMQT_cjs.a(e,"reason")})}}function de(n){let{boardId:e,uploadCardFile:a,getMcpFacade:l,controlplane:h}=n;function R(t,C){let p=chunkLPXVVMQT_cjs.a(t,"board_id");if(!p)throw Object.assign(new Error(`${C} requires board_id`),{statusCode:400});if(p!==e)throw Object.assign(new Error(`Unknown board_id: ${p}`),{statusCode:400})}function _(t,C){let{cardId:p}=h.requireCardArgs(t),o=chunkLPXVVMQT_cjs.a(t,"turn_id");return R(t,C),l().manageAddChatAttachment({cardId:p,role:chunkLPXVVMQT_cjs.a(t,"role")||"user",...o?{turn:o}:{},files:[{file_name:chunkLPXVVMQT_cjs.a(t,"file_name"),content_type:chunkLPXVVMQT_cjs.a(t,"content_type")||"application/octet-stream",...typeof t.text=="string"?{text:t.text}:{},...typeof t.base64=="string"?{base64:t.base64}:{},...Array.isArray(t.bytes)?{bytes:t.bytes}:{}}]})}return {"list-runtime-cards":t=>(R(t,"list-runtime-cards"),l().listRuntimeCards()),"getstate.is-chat-processing":t=>h.getChatProcessing(t),"setstate.chat-processing-started":t=>h.setChatProcessing(t,true),"setstate.chat-processing-done":t=>h.setChatProcessing(t,false),"getstate.card-private":t=>h.getCardMeta(t),"setstate.card-private":t=>h.setCardMeta(t),"manage.upload-card-file":t=>{let C=chunkLPXVVMQT_cjs.a(t,"card_id"),p=chunkLPXVVMQT_cjs.a(t,"file_name"),o=chunkLPXVVMQT_cjs.a(t,"content_type")||"application/octet-stream",c=chunkLPXVVMQT_cjs.f(t);if(R(t,"manage.upload-card-file"),!C)throw Object.assign(new Error("manage.upload-card-file requires card_id"),{statusCode:400});if(!p)throw Object.assign(new Error("manage.upload-card-file requires file_name"),{statusCode:400});if(!c)throw Object.assign(new Error("manage.upload-card-file requires args.bytes, args.text, or args.base64"),{statusCode:400});return a(C,p,o,c,{inChat:false})},"manage.add-chat-attachment":t=>_(t,"manage.add-chat-attachment"),"manage.add-chat-attachement":t=>_(t,"manage.add-chat-attachement"),"manage.add-chat-entry-and-any-attachments":t=>{let{cardId:C}=h.requireCardArgs(t),p=chunkLPXVVMQT_cjs.a(t,"role")||"user",o=chunkLPXVVMQT_cjs.a(t,"turn_id");return R(t,"manage.add-chat-entry-and-any-attachments"),l().manageAddChatEntryAndAnyAttachments({cardId:C,role:p,...typeof t.text=="string"?{text:t.text}:{},...o?{turn:o}:{},...Array.isArray(t.files)?{files:t.files}:{}})},"manage.patch-card":t=>{let{cardId:C}=h.requireCardArgs(t);return R(t,"manage.patch-card"),l().managePatchCard({cardId:C,patch:chunkLPXVVMQT_cjs.c(t,"patch")})},"manage.upsert-card":t=>{let{cardId:C}=h.requireCardArgs(t);return R(t,"manage.upsert-card"),l().manageUpsertCard({cardId:C,candidateCardContent:chunkLPXVVMQT_cjs.c(t,"candidate_card_content")})},"manage.remove-card":t=>{let{cardId:C}=h.requireCardArgs(t);return R(t,"manage.remove-card"),l().manageRemoveCard({cardId:C})},"manage.admin-read-card":async t=>{let{cardId:C}=h.requireCardArgs(t);return {status:"success",data:{cards:await l().adminReadCard({cardId:C})}}},"manage.admin-upsert-card":t=>{let C=chunkLPXVVMQT_cjs.a(t,"board_id"),p=chunkLPXVVMQT_cjs.a(t,"card_id");if(!C)throw Object.assign(new Error("manage.admin-upsert-card requires board_id"),{statusCode:400});if(!p)throw Object.assign(new Error("manage.admin-upsert-card requires card_id"),{statusCode:400});if(C!==e)throw Object.assign(new Error(`Unknown board_id: ${C}`),{statusCode:400});return l().adminUpsertCard({cardId:p,candidateCardContent:chunkLPXVVMQT_cjs.c(t,"candidate_card_content")})}}}function pe(n){let{boardContexts:e,cardOwnerIndex:a,cardContextForCard:l,readStatusSnapshot:h,readDataObjectsByToken:R,readCardRuntimeArtifacts:_,readCardFromStore:t,readCardDefinitions:C,processAccumulatedLaneInternal:p,reportSourceFetched:o,reportSourceFetchFailure:c,uploadCardFile:i,chatStorePublic:g,serverUrl:w,apiBasePath:y}=n;function u(){return e[0]??null}function m(){return {async status(){let s=await h();return s==null?{status:"fail",error:"Board status is unavailable"}:{status:"success",data:s}},async getOutputsDataObject(s){let r=s?.params?.key;return r?{status:"success",data:(await R())[r]}:{status:"fail",error:"getOutputsDataObject requires params.key"}},async getOutputsComputedValues(s){let r=s?.params?.key;return r?{status:"success",data:(await _())[r]?.computed_values}:{status:"fail",error:"getOutputsComputedValues requires params.key"}},async getOutputsFetchedSources(s){let r=s?.params?.key;if(!r)return {status:"fail",error:"getOutputsFetchedSources requires params.key"};let d=l(r)??u();return d?d.boardOps.getOutputsFetchedSources({params:{key:r}}):{status:"fail",error:"Board context is unavailable"}},async removeCard(s){let r=s?.params?.id;if(!r)return {status:"fail",error:"removeCard requires params.id"};let d=l(r)??u();return d?d.boardOps.removeCard({params:{id:r}}):{status:"fail",error:"Board context is unavailable"}},async cardRefreshedNotify(s){let r=s?.params?.cardId;if(!r)return {status:"fail",error:"cardRefreshedNotify requires params.cardId"};let d=l(r)??u();return d?d.boardOps.cardRefreshedNotify({params:{cardId:r}}):{status:"fail",error:"Board context is unavailable"}},async upsertCard(s){let r=s?.params?.cardId;if(!r)return {status:"fail",error:"upsertCard requires params.cardId"};let d=l(r)??u();if(!d)return {status:"fail",error:"Board context is unavailable"};let k=await d.boardOps.upsertCard({params:{cardId:r,restart:s.params.restart===true}});if(k.status!=="success")return k;if(chunkKAWQPLIE_cjs.a(d.boardAdapter)){let x=await p(true);if(x.status!=="success")return x}return k}}}function b(){let s=()=>{let r=u();if(!r?.nonCore)throw new Error("Board non-core adapter is not configured for MCP preflight/discovery tools");return r.nonCore};return {describeTaskExecutorCapabilities(r){return s().describeTaskExecutorCapabilities(r)},validateCardPreflight(r){return s().validateCardPreflight(r)},evalCardCompute(r){return s().evalCardCompute(r)},probeSourcePreflight(r){return s().probeSourcePreflight(r)},runSourcePreflight(r){return s().runSourcePreflight(r)},simulateCardCycle(r){return s().simulateCardCycle(r)}}}function v(){return {async get(s){let r=typeof s.params?.id=="string"?s.params.id:void 0;if(r){let d=await t(r);return d?{status:"success",data:{cards:[d]}}:{status:"success",data:{cards:[]}}}return {status:"success",data:{cards:await C()}}},async set(s){let r=s.body;if(r==null)return {status:"fail",error:"set requires a body (card object or array of cards)"};let d=Array.isArray(r)?r:[r];for(let k of d){let x=k,I=typeof x.id=="string"?x.id:"";if(!I)return {status:"fail",error:"each card must have a string `id` field"};let T=a.get(I)??0,L=e[T]??u();if(!L)return {status:"fail",error:"Board context is unavailable"};let N=await L.cardStoreOps.set({body:x});if(N.status!=="success")return N;a.set(I,T);}return {status:"success",data:{count:d.length}}},async del(s){let r=[s.params?.id,...s.body?.ids??[]].filter(d=>typeof d=="string"&&!!d);if(r.length===0)return {status:"fail",error:"del requires body.ids (string[]) or params.id"};for(let d of r){let k=l(d)??u();if(!k)return {status:"fail",error:"Board context is unavailable"};let x=await k.cardStoreOps.del({params:{id:d}});if(x.status!=="success")return x;a.delete(d);}return {status:"success",data:{count:r.length}}},async patch(s){let r=typeof s.params?.id=="string"?s.params.id:void 0,d=typeof s.params?.path=="string"?s.params.path:void 0;if(!r||!d)return {status:"fail",error:"patch requires params.id and params.path"};let k=l(r)??u();return k?k.cardStoreOps.patch(s):{status:"fail",error:"Board context is unavailable"}},async appendFiles(s){let r=typeof s.params?.id=="string"?s.params.id:void 0;if(!r)return {status:"fail",error:"appendFiles requires params.id"};let d=l(r)??u();return d?d.cardStoreOps.appendFiles(s):{status:"fail",error:"Board context is unavailable"}}}}function A(){return chunkPBOQ4HYB_cjs.a({board:m(),nonCore:b(),cardStore:v(),chatStore:g,processAccumulated:()=>p(true),sourceFetchDone:({token:s,ref:r})=>o(s,r),sourceFetchFailed:({token:s,reason:r})=>c(s,r),uploadCardFile({cardId:s,fileName:r,contentType:d,bytes:k,suppressChatRecordWrite:x}){return i(s,r,d,k,{inChat:true,...x===true?{suppressChatRecordWrite:true}:{}})},buildFileDownloadUrl({cardId:s,fileIdx:r,storedName:d}){let k=`${w||""}${y}/cards/${encodeURIComponent(s)}/files/${r}`;return d?`${k}?sn=${encodeURIComponent(d)}`:k},readFetchedSourceJsonByRef({cardId:s,ref:r}){let d=l(s)??u();if(!d||chunkKAWQPLIE_cjs.a(d.boardAdapter))return null;let I=d.boardAdapter.resolveBlob(chunkSFVO2LB2_cjs.b(r)).trim();return I?JSON.parse(I):null}})}return {mcpBoardFacade:m,mcpNonCoreFacade:b,mcpCardStoreFacade:v,createMcpFacade:A}}exports.a=H;exports.b=V;exports.c=z;exports.d=B;exports.e=j;exports.f=D;exports.g=q;exports.h=Q;exports.i=ee;exports.j=re;exports.k=oe;exports.l=se;exports.m=de;exports.n=pe;//# sourceMappingURL=chunk-EZENHAVZ.cjs.map
2
+ //# sourceMappingURL=chunk-EZENHAVZ.cjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkHWYMZK3N_cjs=require('./chunk-HWYMZK3N.cjs');function s(r){let e=chunkHWYMZK3N_cjs.d(r);return {isValid:e.ok,issues:e.errors}}exports.a=s;//# sourceMappingURL=chunk-FO4KNVU7.cjs.map
2
+ //# sourceMappingURL=chunk-FO4KNVU7.cjs.map
@@ -0,0 +1,3 @@
1
+ 'use strict';var chunkUJ7ZTV4J_cjs=require('./chunk-UJ7ZTV4J.cjs'),chunkGNFE24S7_cjs=require('./chunk-GNFE24S7.cjs'),A=require('ajv-formats'),module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var A__default=/*#__PURE__*/_interopDefault(A);var h={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://nsreehari.github.io/boards/live-cards.schema.json",definitions:{bind_ref:{description:"A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",type:"string",pattern:"^(card_data|requires|fetched_sources|computed_values)(\\.|$)"},bind_or_literal:{description:"A literal value or a bind reference object",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref"}},required:["bind"]}]},compute_expr:{description:"A declarative JSON compute expression",type:"object",required:["fn"],properties:{fn:{type:"string",description:"Function name from the built-in vocabulary",enum:["sum","avg","min","max","count","first","last","add","sub","mul","div","round","abs","mod","gt","gte","lt","lte","eq","neq","if","and","or","not","concat","upper","lower","template","filter","pluck","map","sort","slice","flat","unique","group","get","default","now","diff_days","format_date"]},input:{description:"card_data.path, literal, array of inputs, or nested compute_expr",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{$ref:"#/definitions/compute_expr"}]},field:{type:"string",description:"For pluck/sum/group \u2014 the object key to extract"},where:{$ref:"#/definitions/compute_expr",description:"For filter \u2014 predicate expression ($ = current item)"},cond:{$ref:"#/definitions/compute_expr",description:"For if \u2014 condition expression"},then:{description:"For if \u2014 value when cond is truthy"},else:{description:"For if \u2014 value when cond is falsy"},format:{type:"string",description:"For format_date \u2014 date format string"}}},meta:{type:"object",properties:{title:{type:"string"},tags:{type:"array",items:{type:"string"}}},additionalProperties:true},__private:{description:"Control-plane-owned private state. Stripped entirely from all regular /mcp read responses. Writable only via 'setstate.card-private' and 'manage.admin-upsert-card'. Agents must never author this field. Keys inside use plain names (no leading underscores).",type:"object",additionalProperties:true},requires:{type:"array",items:{type:"string"},description:"IDs of upstream nodes this node depends on"},provides:{type:"array",items:{type:"object",required:["bindTo","ref"],properties:{bindTo:{type:"string",description:"Token name published downstream"},ref:{type:"string",description:"Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)"}}},description:"Explicit bindings exposing computed or card_data values downstream as named tokens"},compute_step:{description:"A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",type:"object",required:["bindTo","expr"],properties:{bindTo:{type:"string",description:"Key in computed_values to write result"},expr:{type:"string",description:"JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }"}}},source_def:{description:"One source entry. The engine requires 'bindTo' (compute namespace key) and 'outputFile' (delivery signal path). bindTo and outputFile must be unique across all source_defs in a card. Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",type:"object",required:["bindTo","outputFile"],additionalProperties:true,properties:{bindTo:{type:"string",description:"Key under fetched_sources.* available in compute expressions"},outputFile:{type:"string",description:"Board-relative path the executor writes its JSON result to. Presence of this file signals delivery."},projections:{type:"object",description:"Named data projections from card_data or requires, evaluated before the executor is called. Each key is a ref name; each value is a JSONata expression rooted at card_data or requires. The resolved values are passed to the executor as _projections. fetched_sources, computed_values, and source_defs are not accessible here \u2014 sources run before those exist.",additionalProperties:{type:"string"}},optionalForCompletionGating:{type:"boolean",default:false,description:"When true this source does not gate card completion. Default false when absent, so source_defs are completion-gating by default."},timeout:{type:"integer",minimum:0,default:12e4,description:"Executor/script timeout in ms. Default: 120 000 (2 min)."},script:{type:"string",description:"Legacy direct-run: shell command executed when no .task-executor is registered. stdout is captured as the result."}}},render_element:{type:"object",required:["kind"],properties:{id:{type:"string",description:"Optional element ID for targeted updates"},kind:{enum:["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]},label:{type:"string",description:"Heading above this element"},className:{type:"string",description:"Bootstrap grid class, e.g. 'col-12 col-md-6'"},visible:{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 element shown only if truthy"},data:{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref",description:"card_data/requires/fetched_sources/computed_values path to read data from"},writeTo:{$ref:"#/definitions/bind_ref",description:"card_data path for user input (form, filter, todo, notes)"},columns:{type:"array",items:{type:"string"},description:"table: visible columns"},maxRows:{type:"integer",description:"table/list: max rows to display"},sortable:{type:"boolean",default:true,description:"table: enable click-to-sort"},placeholder:{type:"string",description:"Empty-state message"},chartType:{enum:["bar","line","pie","doughnut"]},chartOptions:{type:"object",description:"Chart.js options passthrough"},fields:{type:"object",description:"JSON Schema for form/filter fields"},thresholds:{type:"object",properties:{green:{type:"string"},amber:{type:"string"}}},colorMap:{type:"object",description:"badge: value \u2192 Bootstrap color"},style:{enum:["heading","muted","default"],description:"text: display style"},upload:{type:"boolean",default:true,description:"file-upload: show drop zone (false = read-only file list)"},accept:{type:"array",items:{type:"string"},description:"file-upload: allowed extensions"},multiple:{type:"boolean",default:true,description:"file-upload: allow multiple files"},fileAttach:{type:"boolean",default:false,description:"chat: enable inline file attachments"},fileAccept:{type:"array",items:{type:"string"},description:"chat: allowed attachment extensions"},buttons:{type:"array",description:"actions: button definitions",items:{type:"object",required:["id","label"],properties:{id:{type:"string"},label:{type:"string"},style:{type:"string",description:"Bootstrap button variant, e.g. 'success', 'outline-danger'"},size:{type:"string",default:"sm"},disabled:{oneOf:[{type:"boolean"},{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 truthy = disabled"}]}}}}}}}},view:{type:"object",required:["elements"],properties:{elements:{type:"array",minItems:1,items:{$ref:"#/definitions/render_element"}},layout:{type:"object",properties:{board:{type:"object",properties:{col:{type:"integer",minimum:1,maximum:12},order:{type:"integer"}}},canvas:{type:"object",properties:{x:{type:"number"},y:{type:"number"},w:{type:"number"},h:{type:"number"}}}}},features:{type:"object",properties:{chat:{type:"boolean",default:false},notes:{type:"boolean",default:false},refresh:{type:"boolean",default:true}}}}}},title:"LiveCard",description:"A unified card node. Behavior depends on which sections are present (source_defs, compute, view, etc.)",type:"object",required:["id"],additionalProperties:false,properties:{id:{type:"string"},requires:{$ref:"#/definitions/requires"},provides:{$ref:"#/definitions/provides"},meta:{$ref:"#/definitions/meta"},__private:{$ref:"#/definitions/__private"},view:{$ref:"#/definitions/view"},card_data:{type:"object",description:"Authored card data and runtime metadata. Includes uploaded-file metadata maintained by host handlers and inference evaluation results.",properties:{files:{type:"array",description:"Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",items:{type:"object",required:["name","stored_name"],properties:{name:{type:"string",minLength:1},stored_name:{type:"string",minLength:5,maxLength:32,pattern:"^[0-9]{3,}-[a-z0-9._-]+$"},size:{oneOf:[{type:"integer",minimum:0},{type:"null"}]},mime_type:{type:"string"},path:{type:"string",pattern:"^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$"},uploaded_at:{type:"string",format:"date-time"},chat:{type:"boolean",description:"Whether this file entry is associated with a chat interaction"}},additionalProperties:false}}},additionalProperties:true},source_defs:{type:"array",description:"Source entries. Each entry is passed verbatim to the board's .task-executor (registered via init --task-executor) as the --in JSON file. The executor fetches/generates the data and writes JSON to --out. If no executor is registered, the built-in executor runs the entry's 'cli' command directly. Sources gate completion by default. Set optionalForCompletionGating: true for enrichment-only source_defs that should not block task-completed.",items:{$ref:"#/definitions/source_def"}},compute:{type:"array",description:"Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",items:{$ref:"#/definitions/compute_step"}}}};var _=chunkGNFE24S7_cjs.b(chunkUJ7ZTV4J_cjs.q(),1);var k=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-HWYMZK3N.cjs', document.baseURI).href))),q=k("./jsonata-sync.cjs"),f=null;var b=/\b(card_data|requires|fetched_sources|computed_values|source_defs)\b/g,N=/^\s*(card_data|requires|fetched_sources|computed_values|source_defs)(\.|$)/;function S(e){let t=new Set,o;for(b.lastIndex=0;(o=b.exec(e))!==null;)t.add(o[1]);return t}function v(e){let t=N.exec(e);return t?t[1]:null}function g(e,t,o,n){try{q(e);}catch(s){let d=s instanceof Error?s.message:String(s);n.push(`${t}: invalid JSONata expression (${d})`);return}let i=S(e);for(let s of i)o.has(s)||n.push(`${t}: disallowed namespace "${s}" in expression`);}function y(e,t,o){if(Array.isArray(e)){e.forEach((i,s)=>{y(i,`${t}/${s}`,o);});return}if(typeof e=="string"){let i=v(e);if(!i)return;new Set(["card_data","requires","computed_values"]).has(i)||o.push(`${t}: disallowed namespace "${i}" in view reference`);return}if(!e||typeof e!="object")return;let n=e;for(let[i,s]of Object.entries(n))y(s,`${t}/${i}`,o);}function E(){if(f)return f;let e=new _.default({allErrors:true});return A__default.default(e),f=e.compile(h),f}function R(e){let t=E(),o=t(e),n=(t.errors??[]).map(i=>`${i.instancePath||"/"}: ${i.message??"unknown error"}`);if(e&&typeof e=="object"&&!Array.isArray(e)){let i=e.source_defs;if(Array.isArray(i)){let s=new Set,d=new Set;i.forEach((p,u)=>{if(!p||typeof p!="object"||Array.isArray(p))return;let r=p;typeof r.bindTo=="string"&&r.bindTo&&(s.has(r.bindTo)&&n.push(`/source_defs/${u}/bindTo: bindTo "${r.bindTo}" must be unique across all source_defs`),s.add(r.bindTo)),typeof r.outputFile=="string"&&r.outputFile&&(d.has(r.outputFile)&&n.push(`/source_defs/${u}/outputFile: outputFile "${r.outputFile}" must be unique across all source_defs`),d.add(r.outputFile));});}}return !o||n.length>0?{ok:false,errors:n}:{ok:true,errors:[]}}function T(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return {ok:true,errors:[]};let o=e,n=o.compute;Array.isArray(n)&&n.forEach((r,c)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let a=r.expr;typeof a!="string"||a.trim().length===0||g(a,`/compute/${c}/expr`,new Set(["card_data","requires","fetched_sources","computed_values"]),t);});let i=new Set(["card_data","requires","fetched_sources","computed_values"]),s=o.provides;Array.isArray(s)&&s.forEach((r,c)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let a=r.ref;if(typeof a!="string"||a.trim().length===0)return;let l=v(a);l===null?t.push(`/provides/${c}/ref: path "${a}" must start with a valid namespace (${[...i].join(", ")})`):i.has(l)||t.push(`/provides/${c}/ref: disallowed namespace "${l}" in path "${a}" (valid: ${[...i].join(", ")})`);});let d=o.view;d&&typeof d=="object"&&!Array.isArray(d)&&y(d,"/view",t);let p=new Set(["card_data","requires"]),u=o.source_defs;return Array.isArray(u)&&u.forEach((r,c)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let a=r.projections;if(!(!a||typeof a!="object"||Array.isArray(a)))for(let[l,m]of Object.entries(a))typeof m!="string"||m.trim().length===0||g(m,`/source_defs/${c}/projections/${l}`,p,t);}),{ok:t.length===0,errors:t}}function V(e){return O(e)}function O(e){let t=R(e);if(!t.ok)return t;let o=T(e);return o.ok?{ok:true,errors:[]}:{ok:false,errors:o.errors}}
2
+ exports.a=R;exports.b=T;exports.c=V;exports.d=O;//# sourceMappingURL=chunk-HWYMZK3N.cjs.map
3
+ //# sourceMappingURL=chunk-HWYMZK3N.cjs.map