yaml-flow 8.7.1 → 8.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/browser/adapters/firebase-storage.js +2 -2
  2. package/browser/adapters/firestore-storage.js +2 -2
  3. package/browser/adapters/localstorage-storage.js +3 -3
  4. package/browser/asset-integrity.json +9 -13
  5. package/browser/server-runtime-controlface.js +5 -5
  6. package/examples/ARCHITECTURE.md +0 -27
  7. package/examples/board/server/board-server.js +150 -100
  8. package/examples/board/server/board-worker/source_def_flows.json +0 -8
  9. package/examples/board/server/board-worker/task-executor.js +1 -3
  10. package/examples/board/test/server-http-test.js +108 -73
  11. package/examples/board-firestore/server/worker.js +8 -0
  12. package/examples/portfolio-tracker/portfolio-tracker.js +11 -1
  13. package/examples/portfolio-tracker/test/portfolio-t4.js +12 -2
  14. package/lib/{artifacts-store-lib-D9nMkVcE.d.cts → artifacts-store-lib-C6qBpMfU.d.cts} +1 -1
  15. package/lib/{artifacts-store-lib-DSSMqVL2.d.ts → artifacts-store-lib-D4qf7Q-7.d.ts} +1 -1
  16. package/lib/artifacts-store-public.d.cts +3 -3
  17. package/lib/artifacts-store-public.d.ts +3 -3
  18. package/lib/board-live-cards-mcp.cjs +1 -1
  19. package/lib/board-live-cards-mcp.d.cts +6 -7
  20. package/lib/board-live-cards-mcp.d.ts +6 -7
  21. package/lib/board-live-cards-mcp.js +1 -1
  22. package/lib/board-live-cards-node.cjs +8 -8
  23. package/lib/board-live-cards-node.d.cts +15 -14
  24. package/lib/board-live-cards-node.d.ts +15 -14
  25. package/lib/board-live-cards-node.js +8 -8
  26. package/lib/{board-live-cards-public-LlVUQPL2.d.cts → board-live-cards-public-BT5HrgqZ.d.cts} +82 -59
  27. package/lib/{board-live-cards-public-JNRKfBZy.d.ts → board-live-cards-public-DSRamFm8.d.ts} +82 -59
  28. package/lib/{board-live-cards-public-async-Di9QB141.d.cts → board-live-cards-public-async-CYjr4mgX.d.cts} +18 -8
  29. package/lib/{board-live-cards-public-async-fwd1QI82.d.ts → board-live-cards-public-async-DlyC3PgC.d.ts} +18 -8
  30. package/lib/board-live-cards-public.cjs +1 -1
  31. package/lib/board-live-cards-public.d.cts +2 -2
  32. package/lib/board-live-cards-public.d.ts +2 -2
  33. package/lib/board-live-cards-public.js +1 -1
  34. package/lib/board-live-cards-server-runtime.cjs +1 -1
  35. package/lib/board-live-cards-server-runtime.d.cts +6 -8
  36. package/lib/board-live-cards-server-runtime.d.ts +6 -8
  37. package/lib/board-live-cards-server-runtime.js +1 -1
  38. package/lib/{board-platform-adapter-async-BfHmHdx2.d.cts → board-platform-adapter-async-BZIftm36.d.cts} +18 -14
  39. package/lib/{board-platform-adapter-async-DYahVzIK.d.ts → board-platform-adapter-async-JP9V-U5E.d.ts} +18 -14
  40. package/lib/board-worker-adapter.cjs +1 -24
  41. package/lib/board-worker-adapter.d.cts +68 -3
  42. package/lib/board-worker-adapter.d.ts +68 -3
  43. package/lib/board-worker-adapter.js +1 -24
  44. package/lib/card-store-public.d.cts +2 -2
  45. package/lib/card-store-public.d.ts +2 -2
  46. package/lib/chat-store-public.cjs +1 -1
  47. package/lib/chat-store-public.d.cts +20 -20
  48. package/lib/chat-store-public.d.ts +20 -20
  49. package/lib/chat-store-public.js +1 -1
  50. package/lib/chunk-2GSI6C45.js +7 -0
  51. package/lib/chunk-35N7ONTH.js +2 -0
  52. package/lib/chunk-37HDEW26.cjs +2 -0
  53. package/lib/{chunk-PMUSJQSR.cjs → chunk-3CZCGNY4.cjs} +2 -2
  54. package/lib/{chunk-BQS3EIEK.js → chunk-44L64VQ2.js} +3 -3
  55. package/lib/chunk-6OPXQPSC.js +2 -0
  56. package/lib/chunk-7BTZCOT5.js +2 -0
  57. package/lib/{chunk-U2N6MCD5.cjs → chunk-7JVHYHT2.cjs} +2 -2
  58. package/lib/chunk-7QZ267XP.cjs +2 -0
  59. package/lib/{chunk-XQRNDX4Q.js → chunk-ANKA7HEJ.js} +2 -2
  60. package/lib/{chunk-KAWQPLIE.cjs → chunk-BQUQTOPB.cjs} +2 -2
  61. package/lib/chunk-CMFD27ZC.cjs +3 -0
  62. package/lib/chunk-DOFNXJ4C.js +3 -0
  63. package/lib/chunk-ETW3BXHD.cjs +2 -0
  64. package/lib/{chunk-SGV7PU4H.js → chunk-FOFGEABN.js} +2 -2
  65. package/lib/chunk-GPCMBPLK.cjs +2 -0
  66. package/lib/chunk-GU3T75C4.js +3 -0
  67. package/lib/chunk-H3EHFCDZ.js +3 -0
  68. package/lib/chunk-H4TYOSMD.cjs +45 -0
  69. package/lib/chunk-HFW7E2Z7.cjs +4 -0
  70. package/lib/chunk-IQIZA7TN.cjs +7 -0
  71. package/lib/chunk-J4MHQ7JF.js +45 -0
  72. package/lib/chunk-MCPADH33.cjs +2 -0
  73. package/lib/chunk-NBJTYAYN.cjs +2 -0
  74. package/lib/chunk-NDAKMJQK.cjs +3 -0
  75. package/lib/chunk-NNSBBO5R.js +2 -0
  76. package/lib/chunk-NU5NO5NM.js +2 -0
  77. package/lib/chunk-O4RKTQBP.cjs +3 -0
  78. package/lib/chunk-O5UYCGIN.js +2 -0
  79. package/lib/chunk-Q3OTUDIE.js +2 -0
  80. package/lib/chunk-R44X3RQB.cjs +2 -0
  81. package/lib/chunk-RKKSVOP2.js +2 -0
  82. package/lib/chunk-UB54HZA4.cjs +2 -0
  83. package/lib/{chunk-CIAJNUR4.js → chunk-VGDLSS2H.js} +2 -2
  84. package/lib/{chunk-SFVO2LB2.cjs → chunk-VQCIOKJV.cjs} +3 -3
  85. package/lib/chunk-VS3BXEYK.js +4 -0
  86. package/lib/chunk-Y4WK7HE4.js +2 -0
  87. package/lib/chunk-ZK3E7L4Y.cjs +2 -0
  88. package/lib/cloud-storage.cjs +1 -1
  89. package/lib/cloud-storage.d.cts +6 -6
  90. package/lib/cloud-storage.d.ts +6 -6
  91. package/lib/cloud-storage.js +1 -1
  92. package/lib/execution-refs.cjs +1 -1
  93. package/lib/execution-refs.js +1 -1
  94. package/lib/firebase-storage/index.cjs +2 -2
  95. package/lib/firebase-storage/index.d.cts +2 -2
  96. package/lib/firebase-storage/index.d.ts +2 -2
  97. package/lib/firebase-storage/index.js +2 -2
  98. package/lib/firestore-storage/index.cjs +2 -2
  99. package/lib/firestore-storage/index.d.cts +12 -10
  100. package/lib/firestore-storage/index.d.ts +12 -10
  101. package/lib/firestore-storage/index.js +2 -2
  102. package/lib/index.d.cts +1 -1
  103. package/lib/index.d.ts +1 -1
  104. package/lib/localstorage-storage/index.cjs +1 -1
  105. package/lib/localstorage-storage/index.d.cts +10 -6
  106. package/lib/localstorage-storage/index.d.ts +10 -6
  107. package/lib/localstorage-storage/index.js +1 -1
  108. package/lib/{mcp-tool-registries-W3TRj6O5.d.cts → mcp-tool-registries-CRtea2x4.d.cts} +3 -0
  109. package/lib/{mcp-tool-registries-BBObLYga.d.ts → mcp-tool-registries-D3rWSppt.d.ts} +3 -0
  110. package/lib/server-jobs-queue-runner/index.cjs +1 -1
  111. package/lib/server-jobs-queue-runner/index.d.cts +12 -9
  112. package/lib/server-jobs-queue-runner/index.d.ts +12 -9
  113. package/lib/server-jobs-queue-runner/index.js +1 -1
  114. package/lib/server-runtime/index.cjs +1 -1
  115. package/lib/server-runtime/index.d.cts +7 -9
  116. package/lib/server-runtime/index.d.ts +7 -9
  117. package/lib/server-runtime/index.js +1 -1
  118. package/lib/server-runtime-agentface/index.d.cts +7 -9
  119. package/lib/server-runtime-agentface/index.d.ts +7 -9
  120. package/lib/server-runtime-controlface/index.cjs +1 -1
  121. package/lib/server-runtime-controlface/index.d.cts +8 -9
  122. package/lib/server-runtime-controlface/index.d.ts +8 -9
  123. package/lib/server-runtime-controlface/index.js +1 -1
  124. package/lib/server-runtime-core/index.cjs +1 -1
  125. package/lib/server-runtime-core/index.d.cts +59 -21
  126. package/lib/server-runtime-core/index.d.ts +59 -21
  127. package/lib/server-runtime-core/index.js +1 -1
  128. package/lib/server-runtime-watchers/index.cjs +1 -1
  129. package/lib/server-runtime-watchers/index.d.cts +9 -65
  130. package/lib/server-runtime-watchers/index.d.ts +9 -65
  131. package/lib/server-runtime-watchers/index.js +1 -1
  132. package/lib/server-runtime-webhooks/index.d.cts +7 -9
  133. package/lib/server-runtime-webhooks/index.d.ts +7 -9
  134. package/lib/sse-hub-CYXisfXJ.d.cts +63 -0
  135. package/lib/sse-hub-Dodwtc3_.d.ts +63 -0
  136. package/lib/step-machine-public/index.cjs +1 -1
  137. package/lib/step-machine-public/index.d.cts +1 -1
  138. package/lib/step-machine-public/index.d.ts +1 -1
  139. package/lib/step-machine-public/index.js +1 -1
  140. package/lib/{storage-async-interface-BRR4eBjx.d.cts → storage-async-interface-CG0bMqvE.d.ts} +20 -1
  141. package/lib/{storage-async-interface-DhlOVPSp.d.ts → storage-async-interface-CyO-zwVQ.d.cts} +20 -1
  142. package/lib/{storage-interface-BFiD3kyB.d.ts → storage-interface-D-iEiTJA.d.cts} +45 -1
  143. package/lib/{storage-interface-BFiD3kyB.d.cts → storage-interface-D-iEiTJA.d.ts} +45 -1
  144. package/lib/stores/index.d.cts +1 -1
  145. package/lib/stores/index.d.ts +1 -1
  146. package/lib/stores/kv.d.cts +1 -1
  147. package/lib/stores/kv.d.ts +1 -1
  148. package/lib/{types-SO5OZm4s.d.ts → types-BtH3scgE.d.ts} +64 -29
  149. package/lib/{types-Ba8H5_Wo.d.cts → types-Ch0u3FKP.d.cts} +64 -29
  150. package/package.json +4 -5
  151. package/browser/board-livecards-client.js +0 -2
  152. package/examples/board/demo-shell-with-server.html +0 -272
  153. package/examples/board/doc.html +0 -465
  154. package/examples/board/server-config.json +0 -24
  155. package/lib/chat-storage-lib-B9Q34Dyv.d.cts +0 -54
  156. package/lib/chat-storage-lib-DB9iSai2.d.ts +0 -54
  157. package/lib/chunk-5XHOHTLZ.cjs +0 -2
  158. package/lib/chunk-6APH25VI.js +0 -2
  159. package/lib/chunk-76C7N4YT.js +0 -3
  160. package/lib/chunk-76ON3V7R.js +0 -2
  161. package/lib/chunk-7ICPAABP.cjs +0 -7
  162. package/lib/chunk-ASR44K7H.cjs +0 -3
  163. package/lib/chunk-CPAXTVBQ.cjs +0 -2
  164. package/lib/chunk-EGRHWZRV.js +0 -2
  165. package/lib/chunk-EZENHAVZ.cjs +0 -2
  166. package/lib/chunk-GL2OHR2E.cjs +0 -2
  167. package/lib/chunk-GYQXDNNI.cjs +0 -2
  168. package/lib/chunk-IPLSRN6P.cjs +0 -4
  169. package/lib/chunk-J6EGN6S4.cjs +0 -3
  170. package/lib/chunk-JH37NJGP.js +0 -3
  171. package/lib/chunk-JJL5VOQZ.cjs +0 -3
  172. package/lib/chunk-NJJ7WEDT.cjs +0 -2
  173. package/lib/chunk-NKIQRCOM.cjs +0 -2
  174. package/lib/chunk-PBOQ4HYB.cjs +0 -2
  175. package/lib/chunk-PRKRXAVN.js +0 -3
  176. package/lib/chunk-QJVR3FWQ.js +0 -2
  177. package/lib/chunk-S44QZUDX.js +0 -2
  178. package/lib/chunk-TSN3RTXT.js +0 -4
  179. package/lib/chunk-VXJHBWK3.js +0 -2
  180. package/lib/chunk-WHDEBJLT.js +0 -7
  181. package/lib/chunk-YGALANRO.js +0 -2
  182. package/lib/chunk-ZCNN6XPV.js +0 -2
@@ -1,20 +1,20 @@
1
- import { d as BoardRuntimePlatformAdapter } from '../types-Ba8H5_Wo.cjs';
2
- export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, 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';
1
+ import { d as BoardRuntimePlatformAdapter } from '../types-Ch0u3FKP.cjs';
2
+ export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, e as BoardRuntimePublic, f as BoardWorkerRequest, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, R as RuntimeLogger, g as RuntimeRequest, h as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from '../types-Ch0u3FKP.cjs';
3
3
  export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from '../server-jobs-queue-runner/index.cjs';
4
- export { M as McpControlplaneRegistryDeps, a as McpFacadeForRegistry, b as McpWebhookFacadeForRegistry, T as ToolRegistry, c as createMcpControlplaneToolRegistry, d as createMcpToolRegistry, e as createMcpWebhookToolRegistry } from '../mcp-tool-registries-W3TRj6O5.cjs';
4
+ export { M as McpControlplaneRegistryDeps, a as McpFacadeForRegistry, b as McpWebhookFacadeForRegistry, T as ToolRegistry, c as createMcpControlplaneToolRegistry, d as createMcpToolRegistry, e as createMcpWebhookToolRegistry } from '../mcp-tool-registries-CRtea2x4.cjs';
5
5
  import { createBoardLiveCardsMcp, BoardLiveCardsMcpBoardDeps, BoardLiveCardsMcpNonCoreDeps, BoardLiveCardsMcpCardStoreDeps, BoardLiveCardsMcp } from '../board-live-cards-mcp.cjs';
6
- import { a as CommandResult } from '../board-live-cards-public-LlVUQPL2.cjs';
7
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as BoardWorkerRequest, C as CommandInput } from '../board-live-cards-public-LlVUQPL2.cjs';
8
- import { C as CardFileMetadataStore } from '../artifacts-store-lib-D9nMkVcE.cjs';
9
- import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-BfHmHdx2.cjs';
6
+ import { a as CommandResult } from '../board-live-cards-public-BT5HrgqZ.cjs';
7
+ export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as ChatStorage, C as CommandInput } from '../board-live-cards-public-BT5HrgqZ.cjs';
8
+ import { S as SseHub } from '../sse-hub-CYXisfXJ.cjs';
9
+ import { C as CardFileMetadataStore } from '../artifacts-store-lib-C6qBpMfU.cjs';
10
+ import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-BZIftm36.cjs';
10
11
  import { ExecutionRef } from '../execution-refs.cjs';
11
- export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-Di9QB141.cjs';
12
- export { B as BlobStorage, K as KVStorage, a as KindValueRef } from '../storage-interface-BFiD3kyB.cjs';
13
- export { C as ChatStorage } from '../chat-storage-lib-B9Q34Dyv.cjs';
12
+ export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-CYjr4mgX.cjs';
13
+ export { B as BlobStorage, K as KVStorage, a as KindValueRef } from '../storage-interface-D-iEiTJA.cjs';
14
14
  import '../queue-lane-registry-PaZuFpwp.cjs';
15
15
  import '../chat-store-public.cjs';
16
16
  import '../types-BBhqYGhE.cjs';
17
- import '../storage-async-interface-BRR4eBjx.cjs';
17
+ import '../storage-async-interface-CyO-zwVQ.cjs';
18
18
 
19
19
  /**
20
20
  * server-runtime/notifications.ts
@@ -221,8 +221,8 @@ interface RuntimePayloadDeps {
221
221
  /** Live reference to the runtime's board-contexts array (read on each call). */
222
222
  boardContexts: ReadonlyArray<RuntimePayloadBoardContext>;
223
223
  readCardDefinitions: () => Promise<Array<Record<string, unknown>>>;
224
- readChatRecords: (cardId: string) => Array<Record<string, unknown>>;
225
- getChatProcessing: (cardId: string) => boolean;
224
+ readChatRecords: (cardId: string) => Promise<Array<Record<string, unknown>>>;
225
+ getChatProcessing: (cardId: string) => Promise<boolean>;
226
226
  }
227
227
  interface RuntimePayloadModule {
228
228
  readStatusSnapshot: () => Promise<unknown>;
@@ -247,17 +247,27 @@ declare function createRuntimePayloadModule(deps: RuntimePayloadDeps): RuntimePa
247
247
 
248
248
  interface ControlplaneToolHandlersDeps {
249
249
  boardId: string;
250
+ bootstrapBoard: () => Promise<void>;
251
+ sseHub: Pick<SseHub, 'has' | 'subscribeChat' | 'unsubscribeChat'>;
252
+ onChannelSubscribed?: (clientId: string, channelName: string, params: {
253
+ cardId?: string;
254
+ }) => void;
255
+ onChannelUnsubscribed?: (clientId: string, channelName: string, params: {
256
+ cardId?: string;
257
+ }) => void;
250
258
  /** Returns the live MCP facade (chat processing getters/setters). */
251
259
  getMcpFacade: () => {
252
260
  setChatProcessing: (args: {
253
261
  cardId: string;
254
262
  active: boolean;
255
- }) => unknown;
263
+ }) => Promise<{
264
+ active: boolean;
265
+ }>;
256
266
  getChatProcessing: (args: {
257
267
  cardId: string;
258
- }) => {
268
+ }) => Promise<{
259
269
  active: boolean;
260
- };
270
+ }>;
261
271
  };
262
272
  /** Returns the card-store facade used for meta reads/writes. */
263
273
  getMcpCardStoreFacade: () => BoardLiveCardsMcpCardStoreDeps;
@@ -266,22 +276,50 @@ interface ControlplaneToolHandlers {
266
276
  requireCardArgs: (args: Record<string, unknown>) => {
267
277
  cardId: string;
268
278
  };
269
- setChatProcessing: (args: Record<string, unknown>, active: boolean) => {
279
+ subscribeChat: (args: Record<string, unknown>) => Promise<{
280
+ status: 'success';
281
+ data: {
282
+ boardId: string;
283
+ cardId: string;
284
+ clientId: string;
285
+ subscribed: boolean;
286
+ };
287
+ }>;
288
+ unsubscribeChat: (args: Record<string, unknown>) => Promise<{
289
+ status: 'success';
290
+ data: {
291
+ boardId: string;
292
+ cardId: string;
293
+ clientId: string;
294
+ subscribed: boolean;
295
+ };
296
+ }>;
297
+ watchChannel: (args: Record<string, unknown>, subscribed: boolean) => Promise<{
298
+ status: 'success';
299
+ data: {
300
+ boardId: string;
301
+ clientId: string;
302
+ channelName: string;
303
+ subscribed: boolean;
304
+ cardId?: string;
305
+ };
306
+ }>;
307
+ setChatProcessing: (args: Record<string, unknown>, active: boolean) => Promise<{
270
308
  status: 'success';
271
309
  data: {
272
310
  boardId: string;
273
311
  cardId: string;
274
312
  active: boolean;
275
313
  };
276
- };
277
- getChatProcessing: (args: Record<string, unknown>) => {
314
+ }>;
315
+ getChatProcessing: (args: Record<string, unknown>) => Promise<{
278
316
  status: 'success';
279
317
  data: {
280
318
  boardId: string;
281
319
  cardId: string;
282
320
  active: boolean;
283
321
  };
284
- };
322
+ }>;
285
323
  setCardMeta: (args: Record<string, unknown>) => Promise<{
286
324
  status: 'success';
287
325
  data: {
@@ -347,7 +385,7 @@ interface CardFileOpsDeps {
347
385
  /** Apply a local-only update to a card; same shape as updateCardLocalOnly. */
348
386
  updateCardLocalOnly: (cardId: string, updateFn: (card: Record<string, unknown>) => Record<string, unknown> | void) => Promise<void>;
349
387
  /** Append a chat record (used for in-chat upload announcements). */
350
- writeChatRecord: (cardId: string, role: string, text: string, files: unknown[], turnId: string) => unknown;
388
+ writeChatRecord: (cardId: string, role: string, text: string, files: unknown[], turnId: string) => unknown | Promise<unknown>;
351
389
  }
352
390
  interface CardFileOps {
353
391
  uploadCardFile: (cardId: string, requestedName: string, contentType: string, buffer: Uint8Array, opts?: {
@@ -1,20 +1,20 @@
1
- import { d as BoardRuntimePlatformAdapter } from '../types-SO5OZm4s.js';
2
- export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, 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';
1
+ import { d as BoardRuntimePlatformAdapter } from '../types-BtH3scgE.js';
2
+ export { A as Awaitable, B as BoardContextConfig, c as BoardRuntimeNonCorePublic, e as BoardRuntimePublic, f as BoardWorkerRequest, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter, a as MultiBoardRuntime, M as MultiBoardRuntimeOptions, N as NotificationTransport, Q as QueueLaneRuntimeTuning, R as RuntimeLogger, g as RuntimeRequest, h as RuntimeResponse, b as SingleBoardRuntime, S as SingleBoardRuntimeOptions } from '../types-BtH3scgE.js';
3
3
  export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from '../server-jobs-queue-runner/index.js';
4
- export { M as McpControlplaneRegistryDeps, a as McpFacadeForRegistry, b as McpWebhookFacadeForRegistry, T as ToolRegistry, c as createMcpControlplaneToolRegistry, d as createMcpToolRegistry, e as createMcpWebhookToolRegistry } from '../mcp-tool-registries-BBObLYga.js';
4
+ export { M as McpControlplaneRegistryDeps, a as McpFacadeForRegistry, b as McpWebhookFacadeForRegistry, T as ToolRegistry, c as createMcpControlplaneToolRegistry, d as createMcpToolRegistry, e as createMcpWebhookToolRegistry } from '../mcp-tool-registries-D3rWSppt.js';
5
5
  import { createBoardLiveCardsMcp, BoardLiveCardsMcpBoardDeps, BoardLiveCardsMcpNonCoreDeps, BoardLiveCardsMcpCardStoreDeps, BoardLiveCardsMcp } from '../board-live-cards-mcp.js';
6
- import { a as CommandResult } from '../board-live-cards-public-JNRKfBZy.js';
7
- export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as BoardWorkerRequest, C as CommandInput } from '../board-live-cards-public-JNRKfBZy.js';
8
- import { C as CardFileMetadataStore } from '../artifacts-store-lib-DSSMqVL2.js';
9
- import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-DYahVzIK.js';
6
+ import { a as CommandResult } from '../board-live-cards-public-DSRamFm8.js';
7
+ export { B as BoardChangeNotification, c as BoardLiveCardsPublic, d as BoardNonCorePlatformAdapter, e as BoardPlatformAdapter, f as ChatStorage, C as CommandInput } from '../board-live-cards-public-DSRamFm8.js';
8
+ import { S as SseHub } from '../sse-hub-Dodwtc3_.js';
9
+ import { C as CardFileMetadataStore } from '../artifacts-store-lib-D4qf7Q-7.js';
10
+ import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-JP9V-U5E.js';
10
11
  import { ExecutionRef } from '../execution-refs.js';
11
- export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-fwd1QI82.js';
12
- export { B as BlobStorage, K as KVStorage, a as KindValueRef } from '../storage-interface-BFiD3kyB.js';
13
- export { C as ChatStorage } from '../chat-storage-lib-DB9iSai2.js';
12
+ export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-DlyC3PgC.js';
13
+ export { B as BlobStorage, K as KVStorage, a as KindValueRef } from '../storage-interface-D-iEiTJA.js';
14
14
  import '../queue-lane-registry-PaZuFpwp.js';
15
15
  import '../chat-store-public.js';
16
16
  import '../types-BBhqYGhE.js';
17
- import '../storage-async-interface-DhlOVPSp.js';
17
+ import '../storage-async-interface-CG0bMqvE.js';
18
18
 
19
19
  /**
20
20
  * server-runtime/notifications.ts
@@ -221,8 +221,8 @@ interface RuntimePayloadDeps {
221
221
  /** Live reference to the runtime's board-contexts array (read on each call). */
222
222
  boardContexts: ReadonlyArray<RuntimePayloadBoardContext>;
223
223
  readCardDefinitions: () => Promise<Array<Record<string, unknown>>>;
224
- readChatRecords: (cardId: string) => Array<Record<string, unknown>>;
225
- getChatProcessing: (cardId: string) => boolean;
224
+ readChatRecords: (cardId: string) => Promise<Array<Record<string, unknown>>>;
225
+ getChatProcessing: (cardId: string) => Promise<boolean>;
226
226
  }
227
227
  interface RuntimePayloadModule {
228
228
  readStatusSnapshot: () => Promise<unknown>;
@@ -247,17 +247,27 @@ declare function createRuntimePayloadModule(deps: RuntimePayloadDeps): RuntimePa
247
247
 
248
248
  interface ControlplaneToolHandlersDeps {
249
249
  boardId: string;
250
+ bootstrapBoard: () => Promise<void>;
251
+ sseHub: Pick<SseHub, 'has' | 'subscribeChat' | 'unsubscribeChat'>;
252
+ onChannelSubscribed?: (clientId: string, channelName: string, params: {
253
+ cardId?: string;
254
+ }) => void;
255
+ onChannelUnsubscribed?: (clientId: string, channelName: string, params: {
256
+ cardId?: string;
257
+ }) => void;
250
258
  /** Returns the live MCP facade (chat processing getters/setters). */
251
259
  getMcpFacade: () => {
252
260
  setChatProcessing: (args: {
253
261
  cardId: string;
254
262
  active: boolean;
255
- }) => unknown;
263
+ }) => Promise<{
264
+ active: boolean;
265
+ }>;
256
266
  getChatProcessing: (args: {
257
267
  cardId: string;
258
- }) => {
268
+ }) => Promise<{
259
269
  active: boolean;
260
- };
270
+ }>;
261
271
  };
262
272
  /** Returns the card-store facade used for meta reads/writes. */
263
273
  getMcpCardStoreFacade: () => BoardLiveCardsMcpCardStoreDeps;
@@ -266,22 +276,50 @@ interface ControlplaneToolHandlers {
266
276
  requireCardArgs: (args: Record<string, unknown>) => {
267
277
  cardId: string;
268
278
  };
269
- setChatProcessing: (args: Record<string, unknown>, active: boolean) => {
279
+ subscribeChat: (args: Record<string, unknown>) => Promise<{
280
+ status: 'success';
281
+ data: {
282
+ boardId: string;
283
+ cardId: string;
284
+ clientId: string;
285
+ subscribed: boolean;
286
+ };
287
+ }>;
288
+ unsubscribeChat: (args: Record<string, unknown>) => Promise<{
289
+ status: 'success';
290
+ data: {
291
+ boardId: string;
292
+ cardId: string;
293
+ clientId: string;
294
+ subscribed: boolean;
295
+ };
296
+ }>;
297
+ watchChannel: (args: Record<string, unknown>, subscribed: boolean) => Promise<{
298
+ status: 'success';
299
+ data: {
300
+ boardId: string;
301
+ clientId: string;
302
+ channelName: string;
303
+ subscribed: boolean;
304
+ cardId?: string;
305
+ };
306
+ }>;
307
+ setChatProcessing: (args: Record<string, unknown>, active: boolean) => Promise<{
270
308
  status: 'success';
271
309
  data: {
272
310
  boardId: string;
273
311
  cardId: string;
274
312
  active: boolean;
275
313
  };
276
- };
277
- getChatProcessing: (args: Record<string, unknown>) => {
314
+ }>;
315
+ getChatProcessing: (args: Record<string, unknown>) => Promise<{
278
316
  status: 'success';
279
317
  data: {
280
318
  boardId: string;
281
319
  cardId: string;
282
320
  active: boolean;
283
321
  };
284
- };
322
+ }>;
285
323
  setCardMeta: (args: Record<string, unknown>) => Promise<{
286
324
  status: 'success';
287
325
  data: {
@@ -347,7 +385,7 @@ interface CardFileOpsDeps {
347
385
  /** Apply a local-only update to a card; same shape as updateCardLocalOnly. */
348
386
  updateCardLocalOnly: (cardId: string, updateFn: (card: Record<string, unknown>) => Record<string, unknown> | void) => Promise<void>;
349
387
  /** Append a chat record (used for in-chat upload announcements). */
350
- writeChatRecord: (cardId: string, role: string, text: string, files: unknown[], turnId: string) => unknown;
388
+ writeChatRecord: (cardId: string, role: string, text: string, files: unknown[], turnId: string) => unknown | Promise<unknown>;
351
389
  }
352
390
  interface CardFileOps {
353
391
  uploadCardFile: (cardId: string, requestedName: string, contentType: string, buffer: Uint8Array, opts?: {
@@ -1,2 +1,2 @@
1
- export{c as appendNotification,j as createCardFileOps,h as createControlplaneToolHandlers,m as createMcpControlplaneToolRegistry,n as createMcpFacadeModule,k as createMcpToolRegistry,l as createMcpWebhookToolRegistry,i as createRuntimePayloadModule,d as expectControlplaneSuccess,e as expectControlplaneSuccessAsync,f as getCardMetaKey,b as hasNonEmptyCardCountStatus,a as makeNotificationState,g as readCardMetaValue}from'../chunk-QJVR3FWQ.js';export{b as getMcpArgNumber,c as getMcpArgRecord,a as getMcpArgString,e as getRequiredMcpArgNumber,d as getRequiredMcpArgRecord,f as parseMcpUploadBytes}from'../chunk-O7NOHKVR.js';export{d as concatUint8Arrays,c as escapeRegExp,b as executionWhatToRunValue,a as isAsyncBoardPlatformAdapter}from'../chunk-SGV7PU4H.js';export{b as extractMcpFailureMessage,a as invokeMcpTool}from'../chunk-ZJ5M5COT.js';export{a as createHostedBoardQueueLaneRegistry}from'../chunk-YGALANRO.js';import'../chunk-VXJHBWK3.js';import'../chunk-BQS3EIEK.js';import'../chunk-ZCNN6XPV.js';import'../chunk-JMDHDY6M.js';import'../chunk-3KC6LBOG.js';import'../chunk-MNEOJWPS.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
1
+ export{c as appendNotification,j as createCardFileOps,h as createControlplaneToolHandlers,m as createMcpControlplaneToolRegistry,n as createMcpFacadeModule,k as createMcpToolRegistry,l as createMcpWebhookToolRegistry,i as createRuntimePayloadModule,d as expectControlplaneSuccess,e as expectControlplaneSuccessAsync,f as getCardMetaKey,b as hasNonEmptyCardCountStatus,a as makeNotificationState,g as readCardMetaValue}from'../chunk-NU5NO5NM.js';export{b as getMcpArgNumber,c as getMcpArgRecord,a as getMcpArgString,e as getRequiredMcpArgNumber,d as getRequiredMcpArgRecord,f as parseMcpUploadBytes}from'../chunk-O7NOHKVR.js';export{b as extractMcpFailureMessage,a as invokeMcpTool}from'../chunk-ZJ5M5COT.js';export{a as createHostedBoardQueueLaneRegistry}from'../chunk-6OPXQPSC.js';export{d as concatUint8Arrays,c as escapeRegExp,b as executionWhatToRunValue,a as isAsyncBoardPlatformAdapter}from'../chunk-FOFGEABN.js';import'../chunk-RKKSVOP2.js';import'../chunk-NNSBBO5R.js';import'../chunk-ANKA7HEJ.js';import'../chunk-44L64VQ2.js';import'../chunk-35N7ONTH.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,2 +1,2 @@
1
- 'use strict';var chunk7ICPAABP_cjs=require('../chunk-7ICPAABP.cjs');require('../chunk-KAWQPLIE.cjs'),require('../chunk-SFVO2LB2.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createRoutesWatchers",{enumerable:true,get:function(){return chunk7ICPAABP_cjs.b}});Object.defineProperty(exports,"createSseHub",{enumerable:true,get:function(){return chunk7ICPAABP_cjs.a}});//# sourceMappingURL=index.cjs.map
1
+ 'use strict';var chunkIQIZA7TN_cjs=require('../chunk-IQIZA7TN.cjs');require('../chunk-BQUQTOPB.cjs'),require('../chunk-VQCIOKJV.cjs'),require('../chunk-GNFE24S7.cjs');Object.defineProperty(exports,"createRoutesWatchers",{enumerable:true,get:function(){return chunkIQIZA7TN_cjs.b}});Object.defineProperty(exports,"createSseHub",{enumerable:true,get:function(){return chunkIQIZA7TN_cjs.a}});//# sourceMappingURL=index.cjs.map
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,69 +1,13 @@
1
- import { g as RuntimeResponse, f as RuntimeRequest } from '../types-Ba8H5_Wo.cjs';
2
- import { C as ChatStorage } from '../chat-storage-lib-B9Q34Dyv.cjs';
3
- import '../artifacts-store-lib-D9nMkVcE.cjs';
4
- import '../storage-interface-BFiD3kyB.cjs';
5
- import '../board-live-cards-public-LlVUQPL2.cjs';
1
+ import { h as RuntimeResponse, g as RuntimeRequest } from '../types-Ch0u3FKP.cjs';
2
+ import { S as SseHub } from '../sse-hub-CYXisfXJ.cjs';
3
+ export { a as SseHubDeps, c as createSseHub } from '../sse-hub-CYXisfXJ.cjs';
4
+ import '../board-live-cards-public-BT5HrgqZ.cjs';
5
+ import '../storage-interface-D-iEiTJA.cjs';
6
6
  import '../execution-refs.cjs';
7
7
  import '../types-BBhqYGhE.cjs';
8
- import '../board-platform-adapter-async-BfHmHdx2.cjs';
9
- import '../storage-async-interface-BRR4eBjx.cjs';
10
- import '../board-live-cards-public-async-Di9QB141.cjs';
11
-
12
- /**
13
- * server-runtime/sse-hub.ts
14
- *
15
- * Owns the per-runtime SSE client registry, the chat-subscription scanner, and
16
- * all broadcast helpers. The HTTP route handler for the SSE endpoint still
17
- * lives in index.ts because it sequences SSE registration with runtime
18
- * bootstrap; this hub exposes the primitives it needs.
19
- *
20
- * State owned here:
21
- * - sseClients (clientId -> { res, subscribedChatCardIds })
22
- * - sseEventId monotonic counter
23
- * - chat-subscription scan timer + per-card cursor/processing snapshots
24
- *
25
- * Dependencies passed in by the runtime:
26
- * - chatStorage for tailing chat history
27
- * - readChatRecords for building chat-scoped notifications
28
- * - optional host hooks (onSseClientDisconnected, etc.)
29
- */
30
-
31
- interface SseClientState {
32
- res: RuntimeResponse;
33
- subscribedChatCardIds: Set<string>;
34
- }
35
- interface SseHub {
36
- /** Number of currently-registered SSE clients. */
37
- size(): number;
38
- /** Whether a client id is currently registered. */
39
- has(clientId: string): boolean;
40
- /** Returns the existing client state if present (used to migrate chat subs on reconnect). */
41
- get(clientId: string): SseClientState | undefined;
42
- /** Build a wire-format SSE frame for the given payload. Increments the event id. */
43
- buildFrame(payload: unknown): string;
44
- /** Best-effort transport-level flush for the underlying response object. */
45
- flushTransport(res: RuntimeResponse): void;
46
- /** Register a fresh client. Any prior registration with the same id is disconnected first. */
47
- register(clientId: string, res: RuntimeResponse, subscribedChatCardIds?: Set<string>): void;
48
- /** Drop a registered client. If expectedRes is supplied and does not match, no-op. */
49
- disconnect(clientId: string, expectedRes?: RuntimeResponse): void;
50
- /** Write an SSE frame to one client; transport errors disconnect that client. */
51
- writeFrame(clientId: string, payload: unknown): void;
52
- /** Subscribe a client to a card's chat stream and prime its cursor. */
53
- subscribeChat(clientId: string, cardId: string): boolean;
54
- /** Unsubscribe a client from a card's chat stream. */
55
- unsubscribeChat(clientId: string, cardId: string): boolean;
56
- /** Broadcast a notification batch; chat-scoped notes are routed to chat-subscribed clients. */
57
- broadcastNotificationBatch(notifications: unknown[]): void;
58
- /** Push a fresh card-chats notification to every chat-subscribed client. */
59
- broadcastCardChats(cardId: string, receiving?: boolean): void;
60
- }
61
- interface SseHubDeps {
62
- chatStorage: ChatStorage;
63
- readChatRecords: (cardId: string) => Array<Record<string, unknown>>;
64
- onSseClientDisconnected?: (clientId: string) => void;
65
- }
66
- declare function createSseHub(deps: SseHubDeps): SseHub;
8
+ import '../board-platform-adapter-async-BZIftm36.cjs';
9
+ import '../storage-async-interface-CyO-zwVQ.cjs';
10
+ import '../board-live-cards-public-async-CYjr4mgX.cjs';
67
11
 
68
12
  /**
69
13
  * server-runtime/routes-sse.ts
@@ -124,4 +68,4 @@ interface RoutesWatchers {
124
68
  }
125
69
  declare function createRoutesWatchers(deps: RoutesWatchersDeps): RoutesWatchers;
126
70
 
127
- export { type RoutesWatchers, type RoutesWatchersDeps, type SseHub, type SseHubDeps, createRoutesWatchers, createSseHub };
71
+ export { type RoutesWatchers, type RoutesWatchersDeps, SseHub, createRoutesWatchers };
@@ -1,69 +1,13 @@
1
- import { g as RuntimeResponse, f as RuntimeRequest } from '../types-SO5OZm4s.js';
2
- import { C as ChatStorage } from '../chat-storage-lib-DB9iSai2.js';
3
- import '../artifacts-store-lib-DSSMqVL2.js';
4
- import '../storage-interface-BFiD3kyB.js';
5
- import '../board-live-cards-public-JNRKfBZy.js';
1
+ import { h as RuntimeResponse, g as RuntimeRequest } from '../types-BtH3scgE.js';
2
+ import { S as SseHub } from '../sse-hub-Dodwtc3_.js';
3
+ export { a as SseHubDeps, c as createSseHub } from '../sse-hub-Dodwtc3_.js';
4
+ import '../board-live-cards-public-DSRamFm8.js';
5
+ import '../storage-interface-D-iEiTJA.js';
6
6
  import '../execution-refs.js';
7
7
  import '../types-BBhqYGhE.js';
8
- import '../board-platform-adapter-async-DYahVzIK.js';
9
- import '../storage-async-interface-DhlOVPSp.js';
10
- import '../board-live-cards-public-async-fwd1QI82.js';
11
-
12
- /**
13
- * server-runtime/sse-hub.ts
14
- *
15
- * Owns the per-runtime SSE client registry, the chat-subscription scanner, and
16
- * all broadcast helpers. The HTTP route handler for the SSE endpoint still
17
- * lives in index.ts because it sequences SSE registration with runtime
18
- * bootstrap; this hub exposes the primitives it needs.
19
- *
20
- * State owned here:
21
- * - sseClients (clientId -> { res, subscribedChatCardIds })
22
- * - sseEventId monotonic counter
23
- * - chat-subscription scan timer + per-card cursor/processing snapshots
24
- *
25
- * Dependencies passed in by the runtime:
26
- * - chatStorage for tailing chat history
27
- * - readChatRecords for building chat-scoped notifications
28
- * - optional host hooks (onSseClientDisconnected, etc.)
29
- */
30
-
31
- interface SseClientState {
32
- res: RuntimeResponse;
33
- subscribedChatCardIds: Set<string>;
34
- }
35
- interface SseHub {
36
- /** Number of currently-registered SSE clients. */
37
- size(): number;
38
- /** Whether a client id is currently registered. */
39
- has(clientId: string): boolean;
40
- /** Returns the existing client state if present (used to migrate chat subs on reconnect). */
41
- get(clientId: string): SseClientState | undefined;
42
- /** Build a wire-format SSE frame for the given payload. Increments the event id. */
43
- buildFrame(payload: unknown): string;
44
- /** Best-effort transport-level flush for the underlying response object. */
45
- flushTransport(res: RuntimeResponse): void;
46
- /** Register a fresh client. Any prior registration with the same id is disconnected first. */
47
- register(clientId: string, res: RuntimeResponse, subscribedChatCardIds?: Set<string>): void;
48
- /** Drop a registered client. If expectedRes is supplied and does not match, no-op. */
49
- disconnect(clientId: string, expectedRes?: RuntimeResponse): void;
50
- /** Write an SSE frame to one client; transport errors disconnect that client. */
51
- writeFrame(clientId: string, payload: unknown): void;
52
- /** Subscribe a client to a card's chat stream and prime its cursor. */
53
- subscribeChat(clientId: string, cardId: string): boolean;
54
- /** Unsubscribe a client from a card's chat stream. */
55
- unsubscribeChat(clientId: string, cardId: string): boolean;
56
- /** Broadcast a notification batch; chat-scoped notes are routed to chat-subscribed clients. */
57
- broadcastNotificationBatch(notifications: unknown[]): void;
58
- /** Push a fresh card-chats notification to every chat-subscribed client. */
59
- broadcastCardChats(cardId: string, receiving?: boolean): void;
60
- }
61
- interface SseHubDeps {
62
- chatStorage: ChatStorage;
63
- readChatRecords: (cardId: string) => Array<Record<string, unknown>>;
64
- onSseClientDisconnected?: (clientId: string) => void;
65
- }
66
- declare function createSseHub(deps: SseHubDeps): SseHub;
8
+ import '../board-platform-adapter-async-JP9V-U5E.js';
9
+ import '../storage-async-interface-CG0bMqvE.js';
10
+ import '../board-live-cards-public-async-DlyC3PgC.js';
67
11
 
68
12
  /**
69
13
  * server-runtime/routes-sse.ts
@@ -124,4 +68,4 @@ interface RoutesWatchers {
124
68
  }
125
69
  declare function createRoutesWatchers(deps: RoutesWatchersDeps): RoutesWatchers;
126
70
 
127
- export { type RoutesWatchers, type RoutesWatchersDeps, type SseHub, type SseHubDeps, createRoutesWatchers, createSseHub };
71
+ export { type RoutesWatchers, type RoutesWatchersDeps, SseHub, createRoutesWatchers };
@@ -1,2 +1,2 @@
1
- export{b as createRoutesWatchers,a as createSseHub}from'../chunk-WHDEBJLT.js';import'../chunk-SGV7PU4H.js';import'../chunk-BQS3EIEK.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
1
+ export{b as createRoutesWatchers,a as createSseHub}from'../chunk-2GSI6C45.js';import'../chunk-FOFGEABN.js';import'../chunk-44L64VQ2.js';import'../chunk-FW4363Y4.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,12 @@
1
- import { f as RuntimeRequest, g as RuntimeResponse } from '../types-Ba8H5_Wo.cjs';
2
- import { T as ToolRegistry } from '../mcp-tool-registries-W3TRj6O5.cjs';
3
- import '../artifacts-store-lib-D9nMkVcE.cjs';
4
- import '../storage-interface-BFiD3kyB.cjs';
5
- import '../board-live-cards-public-LlVUQPL2.cjs';
1
+ import { g as RuntimeRequest, h as RuntimeResponse } from '../types-Ch0u3FKP.cjs';
2
+ import { T as ToolRegistry } from '../mcp-tool-registries-CRtea2x4.cjs';
3
+ import '../board-live-cards-public-BT5HrgqZ.cjs';
4
+ import '../storage-interface-D-iEiTJA.cjs';
6
5
  import '../execution-refs.cjs';
7
6
  import '../types-BBhqYGhE.cjs';
8
- import '../board-platform-adapter-async-BfHmHdx2.cjs';
9
- import '../storage-async-interface-BRR4eBjx.cjs';
10
- import '../board-live-cards-public-async-Di9QB141.cjs';
11
- import '../chat-storage-lib-B9Q34Dyv.cjs';
7
+ import '../board-platform-adapter-async-BZIftm36.cjs';
8
+ import '../storage-async-interface-CyO-zwVQ.cjs';
9
+ import '../board-live-cards-public-async-CYjr4mgX.cjs';
12
10
  import '../board-live-cards-mcp.cjs';
13
11
  import '../chat-store-public.cjs';
14
12
 
@@ -1,14 +1,12 @@
1
- import { f as RuntimeRequest, g as RuntimeResponse } from '../types-SO5OZm4s.js';
2
- import { T as ToolRegistry } from '../mcp-tool-registries-BBObLYga.js';
3
- import '../artifacts-store-lib-DSSMqVL2.js';
4
- import '../storage-interface-BFiD3kyB.js';
5
- import '../board-live-cards-public-JNRKfBZy.js';
1
+ import { g as RuntimeRequest, h as RuntimeResponse } from '../types-BtH3scgE.js';
2
+ import { T as ToolRegistry } from '../mcp-tool-registries-D3rWSppt.js';
3
+ import '../board-live-cards-public-DSRamFm8.js';
4
+ import '../storage-interface-D-iEiTJA.js';
6
5
  import '../execution-refs.js';
7
6
  import '../types-BBhqYGhE.js';
8
- import '../board-platform-adapter-async-DYahVzIK.js';
9
- import '../storage-async-interface-DhlOVPSp.js';
10
- import '../board-live-cards-public-async-fwd1QI82.js';
11
- import '../chat-storage-lib-DB9iSai2.js';
7
+ import '../board-platform-adapter-async-JP9V-U5E.js';
8
+ import '../storage-async-interface-CG0bMqvE.js';
9
+ import '../board-live-cards-public-async-DlyC3PgC.js';
12
10
  import '../board-live-cards-mcp.js';
13
11
  import '../chat-store-public.js';
14
12
 
@@ -0,0 +1,63 @@
1
+ import { h as RuntimeResponse } from './types-Ch0u3FKP.cjs';
2
+
3
+ /**
4
+ * server-runtime/sse-hub.ts
5
+ *
6
+ * Owns the per-runtime SSE client registry, the chat-subscription scanner, and
7
+ * all broadcast helpers. The HTTP route handler for the SSE endpoint still
8
+ * lives in index.ts because it sequences SSE registration with runtime
9
+ * bootstrap; this hub exposes the primitives it needs.
10
+ *
11
+ * State owned here:
12
+ * - sseClients (clientId -> { res, subscribedChatCardIds })
13
+ * - sseEventId monotonic counter
14
+ * - chat-subscription scan timer + per-card cursor/processing snapshots
15
+ *
16
+ * Dependencies passed in by the runtime:
17
+ * - chatStorage for tailing chat history
18
+ * - readChatRecords for building chat-scoped notifications
19
+ * - optional host hooks (onSseClientDisconnected, etc.)
20
+ */
21
+
22
+ interface SseClientState {
23
+ res: RuntimeResponse;
24
+ subscribedChatCardIds: Set<string>;
25
+ }
26
+ interface SseHub {
27
+ /** Number of currently-registered SSE clients. */
28
+ size(): number;
29
+ /** Whether a client id is currently registered. */
30
+ has(clientId: string): boolean;
31
+ /** Returns the existing client state if present (used to migrate chat subs on reconnect). */
32
+ get(clientId: string): SseClientState | undefined;
33
+ /** Build a wire-format SSE frame for the given payload. Increments the event id. */
34
+ buildFrame(payload: unknown): string;
35
+ /** Best-effort transport-level flush for the underlying response object. */
36
+ flushTransport(res: RuntimeResponse): void;
37
+ /** Register a fresh client. Any prior registration with the same id is disconnected first. */
38
+ register(clientId: string, res: RuntimeResponse, subscribedChatCardIds?: Set<string>): void;
39
+ /** Drop a registered client. If expectedRes is supplied and does not match, no-op. */
40
+ disconnect(clientId: string, expectedRes?: RuntimeResponse): void;
41
+ /** Write an SSE frame to one client; transport errors disconnect that client. */
42
+ writeFrame(clientId: string, payload: unknown): void;
43
+ /** Subscribe a client to a card's chat stream and prime its cursor. */
44
+ subscribeChat(clientId: string, cardId: string): Promise<boolean>;
45
+ /** Unsubscribe a client from a card's chat stream. */
46
+ unsubscribeChat(clientId: string, cardId: string): boolean;
47
+ /** Broadcast a notification batch; chat-scoped notes are routed to chat-subscribed clients. */
48
+ broadcastNotificationBatch(notifications: unknown[]): void;
49
+ /** Push a fresh card-chats notification to every chat-subscribed client. */
50
+ broadcastCardChats(cardId: string, receiving?: boolean): Promise<void>;
51
+ }
52
+ interface SseHubDeps {
53
+ readChatRecords: (cardId: string) => Promise<Array<Record<string, unknown>>>;
54
+ readChatAfter: (cardId: string, cursor: string | null) => Promise<{
55
+ records: Array<Record<string, unknown>>;
56
+ cursor: string | null;
57
+ }>;
58
+ getChatProcessing: (cardId: string) => Promise<boolean>;
59
+ onSseClientDisconnected?: (clientId: string) => void;
60
+ }
61
+ declare function createSseHub(deps: SseHubDeps): SseHub;
62
+
63
+ export { type SseHub as S, type SseHubDeps as a, createSseHub as c };
@@ -0,0 +1,63 @@
1
+ import { h as RuntimeResponse } from './types-BtH3scgE.js';
2
+
3
+ /**
4
+ * server-runtime/sse-hub.ts
5
+ *
6
+ * Owns the per-runtime SSE client registry, the chat-subscription scanner, and
7
+ * all broadcast helpers. The HTTP route handler for the SSE endpoint still
8
+ * lives in index.ts because it sequences SSE registration with runtime
9
+ * bootstrap; this hub exposes the primitives it needs.
10
+ *
11
+ * State owned here:
12
+ * - sseClients (clientId -> { res, subscribedChatCardIds })
13
+ * - sseEventId monotonic counter
14
+ * - chat-subscription scan timer + per-card cursor/processing snapshots
15
+ *
16
+ * Dependencies passed in by the runtime:
17
+ * - chatStorage for tailing chat history
18
+ * - readChatRecords for building chat-scoped notifications
19
+ * - optional host hooks (onSseClientDisconnected, etc.)
20
+ */
21
+
22
+ interface SseClientState {
23
+ res: RuntimeResponse;
24
+ subscribedChatCardIds: Set<string>;
25
+ }
26
+ interface SseHub {
27
+ /** Number of currently-registered SSE clients. */
28
+ size(): number;
29
+ /** Whether a client id is currently registered. */
30
+ has(clientId: string): boolean;
31
+ /** Returns the existing client state if present (used to migrate chat subs on reconnect). */
32
+ get(clientId: string): SseClientState | undefined;
33
+ /** Build a wire-format SSE frame for the given payload. Increments the event id. */
34
+ buildFrame(payload: unknown): string;
35
+ /** Best-effort transport-level flush for the underlying response object. */
36
+ flushTransport(res: RuntimeResponse): void;
37
+ /** Register a fresh client. Any prior registration with the same id is disconnected first. */
38
+ register(clientId: string, res: RuntimeResponse, subscribedChatCardIds?: Set<string>): void;
39
+ /** Drop a registered client. If expectedRes is supplied and does not match, no-op. */
40
+ disconnect(clientId: string, expectedRes?: RuntimeResponse): void;
41
+ /** Write an SSE frame to one client; transport errors disconnect that client. */
42
+ writeFrame(clientId: string, payload: unknown): void;
43
+ /** Subscribe a client to a card's chat stream and prime its cursor. */
44
+ subscribeChat(clientId: string, cardId: string): Promise<boolean>;
45
+ /** Unsubscribe a client from a card's chat stream. */
46
+ unsubscribeChat(clientId: string, cardId: string): boolean;
47
+ /** Broadcast a notification batch; chat-scoped notes are routed to chat-subscribed clients. */
48
+ broadcastNotificationBatch(notifications: unknown[]): void;
49
+ /** Push a fresh card-chats notification to every chat-subscribed client. */
50
+ broadcastCardChats(cardId: string, receiving?: boolean): Promise<void>;
51
+ }
52
+ interface SseHubDeps {
53
+ readChatRecords: (cardId: string) => Promise<Array<Record<string, unknown>>>;
54
+ readChatAfter: (cardId: string, cursor: string | null) => Promise<{
55
+ records: Array<Record<string, unknown>>;
56
+ cursor: string | null;
57
+ }>;
58
+ getChatProcessing: (cardId: string) => Promise<boolean>;
59
+ onSseClientDisconnected?: (clientId: string) => void;
60
+ }
61
+ declare function createSseHub(deps: SseHubDeps): SseHub;
62
+
63
+ export { type SseHub as S, type SseHubDeps as a, createSseHub as c };