yaml-flow 8.8.7 → 8.9.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 (155) hide show
  1. package/browser/adapters/firestore-storage.js +2 -2
  2. package/browser/adapters/localstorage-storage.js +3 -3
  3. package/browser/asset-integrity.json +7 -7
  4. package/browser/server-runtime-controlface.js +5 -5
  5. package/examples/board/test/server-http-test-browser.ts +2394 -0
  6. package/examples/board/test/server-http-test.js +44 -35
  7. package/lib/{artifacts-store-lib-C6qBpMfU.d.cts → artifacts-store-lib-CqkJEgbx.d.cts} +1 -1
  8. package/lib/{artifacts-store-lib-D4qf7Q-7.d.ts → artifacts-store-lib-D6Bo4yFN.d.ts} +1 -1
  9. package/lib/artifacts-store-public.d.cts +5 -3
  10. package/lib/artifacts-store-public.d.ts +5 -3
  11. package/lib/board-callback-transport-Bekq8Gp-.d.ts +71 -0
  12. package/lib/board-callback-transport-kP0K6UMq.d.cts +71 -0
  13. package/lib/board-live-cards-lib-DVh3t9NT.d.cts +222 -0
  14. package/lib/board-live-cards-lib-iU8xOwNp.d.ts +222 -0
  15. package/lib/board-live-cards-mcp.cjs +1 -1
  16. package/lib/board-live-cards-mcp.d.cts +4 -8
  17. package/lib/board-live-cards-mcp.d.ts +4 -8
  18. package/lib/board-live-cards-mcp.js +1 -1
  19. package/lib/board-live-cards-node.cjs +7 -7
  20. package/lib/board-live-cards-node.d.cts +15 -11
  21. package/lib/board-live-cards-node.d.ts +15 -11
  22. package/lib/board-live-cards-node.js +7 -7
  23. package/lib/{board-live-cards-public-async-CYjr4mgX.d.cts → board-live-cards-public-async-Cl0M3j5P.d.cts} +6 -4
  24. package/lib/{board-live-cards-public-async-DlyC3PgC.d.ts → board-live-cards-public-async-U98IXUBx.d.ts} +6 -4
  25. package/lib/board-live-cards-public.cjs +1 -1
  26. package/lib/board-live-cards-public.d.cts +325 -3
  27. package/lib/board-live-cards-public.d.ts +325 -3
  28. package/lib/board-live-cards-public.js +1 -1
  29. package/lib/board-live-cards-server-runtime.cjs +1 -1
  30. package/lib/board-live-cards-server-runtime.d.cts +8 -6
  31. package/lib/board-live-cards-server-runtime.d.ts +8 -6
  32. package/lib/board-live-cards-server-runtime.js +1 -1
  33. package/lib/{board-platform-adapter-async-JP9V-U5E.d.ts → board-platform-adapter-async-ByBRFn1G.d.ts} +4 -3
  34. package/lib/{board-platform-adapter-async-BZIftm36.d.cts → board-platform-adapter-async-DjBwE0m9.d.cts} +4 -3
  35. package/lib/board-state-reducer.cjs +2 -0
  36. package/lib/board-state-reducer.d.cts +53 -0
  37. package/lib/board-state-reducer.d.ts +53 -0
  38. package/lib/board-state-reducer.js +2 -0
  39. package/lib/card-store-public.cjs +1 -1
  40. package/lib/card-store-public.d.cts +11 -4
  41. package/lib/card-store-public.d.ts +11 -4
  42. package/lib/card-store-public.js +1 -1
  43. package/lib/chat-store-public.cjs +1 -1
  44. package/lib/chat-store-public.d.cts +15 -4
  45. package/lib/chat-store-public.d.ts +15 -4
  46. package/lib/chat-store-public.js +1 -1
  47. package/lib/chunk-2RIHC5TZ.cjs +2 -0
  48. package/lib/chunk-37FDOKDK.js +3 -0
  49. package/lib/chunk-3S7LV2HZ.cjs +2 -0
  50. package/lib/chunk-3T5TMAWG.cjs +3 -0
  51. package/lib/chunk-5XLFPPTY.cjs +2 -0
  52. package/lib/{chunk-R44X3RQB.cjs → chunk-6EJRZHFP.cjs} +2 -2
  53. package/lib/{chunk-NNSBBO5R.js → chunk-6MD6FVE3.js} +2 -2
  54. package/lib/chunk-7QNEV5S3.js +2 -0
  55. package/lib/{chunk-6OPXQPSC.js → chunk-7UJQMFVS.js} +2 -2
  56. package/lib/chunk-BJGK5FNL.js +2 -0
  57. package/lib/{chunk-ETW3BXHD.cjs → chunk-BQJVCCFU.cjs} +2 -2
  58. package/lib/chunk-DQPBAB5Z.cjs +2 -0
  59. package/lib/chunk-JB4Q2W7I.js +7 -0
  60. package/lib/chunk-JYVYAAXT.js +3 -0
  61. package/lib/chunk-LFVMX23W.cjs +7 -0
  62. package/lib/chunk-NIBLKYXN.js +2 -0
  63. package/lib/chunk-OF4FPYNI.cjs +2 -0
  64. package/lib/chunk-P3R6TXII.js +3 -0
  65. package/lib/{chunk-7BTZCOT5.js → chunk-QLB6PKOT.js} +2 -2
  66. package/lib/chunk-R4YASXSJ.js +2 -0
  67. package/lib/chunk-RZRIXQ6A.cjs +3 -0
  68. package/lib/chunk-SDJ3747Q.cjs +2 -0
  69. package/lib/chunk-SJANU3PL.cjs +3 -0
  70. package/lib/chunk-UGB7PC4P.js +2 -0
  71. package/lib/chunk-VBYNMTWC.js +2 -0
  72. package/lib/{chunk-37HDEW26.cjs → chunk-WRMOGPRG.cjs} +2 -2
  73. package/lib/cloud-storage.cjs +1 -1
  74. package/lib/cloud-storage.d.cts +44 -8
  75. package/lib/cloud-storage.d.ts +44 -8
  76. package/lib/cloud-storage.js +1 -1
  77. package/lib/firebase-storage/index.d.cts +2 -2
  78. package/lib/firebase-storage/index.d.ts +2 -2
  79. package/lib/firestore-storage/index.cjs +2 -2
  80. package/lib/firestore-storage/index.d.cts +6 -5
  81. package/lib/firestore-storage/index.d.ts +6 -5
  82. package/lib/firestore-storage/index.js +2 -2
  83. package/lib/index.cjs +2 -2
  84. package/lib/index.d.cts +1 -1
  85. package/lib/index.d.ts +1 -1
  86. package/lib/index.js +1 -1
  87. package/lib/localstorage-storage/index.cjs +1 -1
  88. package/lib/localstorage-storage/index.d.cts +6 -5
  89. package/lib/localstorage-storage/index.d.ts +6 -5
  90. package/lib/localstorage-storage/index.js +1 -1
  91. package/lib/notification-consumer/index.cjs +2 -0
  92. package/lib/notification-consumer/index.d.cts +17 -0
  93. package/lib/notification-consumer/index.d.ts +17 -0
  94. package/lib/notification-consumer/index.js +2 -0
  95. package/lib/queue-storage-public.cjs +2 -0
  96. package/lib/queue-storage-public.d.cts +13 -0
  97. package/lib/queue-storage-public.d.ts +13 -0
  98. package/lib/queue-storage-public.js +2 -0
  99. package/lib/server-jobs-queue-runner/index.cjs +1 -1
  100. package/lib/server-jobs-queue-runner/index.d.cts +9 -7
  101. package/lib/server-jobs-queue-runner/index.d.ts +9 -7
  102. package/lib/server-jobs-queue-runner/index.js +1 -1
  103. package/lib/server-runtime/index.cjs +1 -1
  104. package/lib/server-runtime/index.d.cts +9 -7
  105. package/lib/server-runtime/index.d.ts +9 -7
  106. package/lib/server-runtime/index.js +1 -1
  107. package/lib/server-runtime-agentface/index.d.cts +8 -6
  108. package/lib/server-runtime-agentface/index.d.ts +8 -6
  109. package/lib/server-runtime-controlface/index.cjs +1 -1
  110. package/lib/server-runtime-controlface/index.d.cts +8 -6
  111. package/lib/server-runtime-controlface/index.d.ts +8 -6
  112. package/lib/server-runtime-controlface/index.js +1 -1
  113. package/lib/server-runtime-core/index.cjs +1 -1
  114. package/lib/server-runtime-core/index.d.cts +16 -37
  115. package/lib/server-runtime-core/index.d.ts +16 -37
  116. package/lib/server-runtime-core/index.js +1 -1
  117. package/lib/server-runtime-watchers/index.cjs +1 -1
  118. package/lib/server-runtime-watchers/index.d.cts +11 -8
  119. package/lib/server-runtime-watchers/index.d.ts +11 -8
  120. package/lib/server-runtime-watchers/index.js +1 -1
  121. package/lib/server-runtime-webhooks/index.d.cts +8 -6
  122. package/lib/server-runtime-webhooks/index.d.ts +8 -6
  123. package/lib/{sse-hub-DM8bw-dO.d.ts → sse-hub-BRBvymHR.d.cts} +18 -15
  124. package/lib/{sse-hub-BDjWI7JR.d.cts → sse-hub-D_94fV87.d.ts} +18 -15
  125. package/lib/step-machine-public/index.d.cts +1 -1
  126. package/lib/step-machine-public/index.d.ts +1 -1
  127. package/lib/{storage-async-interface-CyO-zwVQ.d.cts → storage-async-interface-CLOXiqwC.d.cts} +2 -2
  128. package/lib/{storage-async-interface-CG0bMqvE.d.ts → storage-async-interface-Cb-SULrI.d.ts} +2 -2
  129. package/lib/{storage-interface-D-iEiTJA.d.cts → storage-interface-DogVPooM.d.cts} +1 -1
  130. package/lib/{storage-interface-D-iEiTJA.d.ts → storage-interface-DogVPooM.d.ts} +1 -1
  131. package/lib/stores/index.d.cts +1 -1
  132. package/lib/stores/index.d.ts +1 -1
  133. package/lib/stores/kv.d.cts +1 -1
  134. package/lib/stores/kv.d.ts +1 -1
  135. package/lib/{types-BsfXZyI3.d.ts → types-BsqzUZNl.d.ts} +6 -4
  136. package/lib/{types-CPnYv7RC.d.cts → types-DxhB6Toz.d.cts} +6 -4
  137. package/package.json +16 -1
  138. package/lib/board-live-cards-public-BT5HrgqZ.d.cts +0 -529
  139. package/lib/board-live-cards-public-DSRamFm8.d.ts +0 -529
  140. package/lib/chunk-35N7ONTH.js +0 -2
  141. package/lib/chunk-36QUKFL7.cjs +0 -3
  142. package/lib/chunk-3MMTBEAO.js +0 -2
  143. package/lib/chunk-7QQFDYBM.js +0 -3
  144. package/lib/chunk-7QZ267XP.cjs +0 -2
  145. package/lib/chunk-ABAVFLDP.js +0 -7
  146. package/lib/chunk-EPCJYP4N.js +0 -3
  147. package/lib/chunk-H22NK6KH.cjs +0 -7
  148. package/lib/chunk-KBELAKIY.js +0 -2
  149. package/lib/chunk-OJ2CAQ4C.cjs +0 -2
  150. package/lib/chunk-Q3OTUDIE.js +0 -2
  151. package/lib/chunk-QG6ERLZQ.cjs +0 -3
  152. package/lib/chunk-UB54HZA4.cjs +0 -2
  153. package/lib/chunk-YMEIPKLW.cjs +0 -2
  154. package/lib/chunk-ZENTBLLA.cjs +0 -3
  155. package/lib/chunk-ZWVT24YW.js +0 -3
@@ -331,28 +331,32 @@ function waitForFirstSsePayload(sseUrl, timeoutMs = 15_000) {
331
331
 
332
332
  function captureChatEvents(payload, cardId) {
333
333
  if (!payload || payload.kind !== 'notification-batch' || !Array.isArray(payload.notifications)) return;
334
+ const latestByCardId = new Map();
335
+ for (const existing of NS.allChatNotifications) {
336
+ if (existing && existing.cardId) latestByCardId.set(existing.cardId, existing);
337
+ }
334
338
  for (const n of payload.notifications) {
335
- if (n && n.kind === 'card_chats' && n.cardId) {
336
- const messages = Array.isArray(n.messages) ? n.messages : [];
337
- NS.allChatNotifications.push({
338
- at: Date.now(),
339
- cardId: n.cardId,
340
- processing: !!n.processing,
341
- receiving: !!n.receiving,
342
- messageCount: messages.length,
343
- messages,
344
- });
345
- }
346
- if (n && n.kind === 'card_chats' && n.cardId === cardId) {
347
- const messages = Array.isArray(n.messages) ? n.messages : [];
348
- NS.chatEvents.push({
349
- at: Date.now(),
350
- cardId: n.cardId,
351
- processing: !!n.processing,
352
- receiving: !!n.receiving,
353
- messageCount: messages.length,
354
- messages,
355
- });
339
+ if (!n || !n.cardId) continue;
340
+ if (n.kind !== 'card_chats' && n.kind !== 'chat_messages' && n.kind !== 'chat_processing') continue;
341
+ const previous = latestByCardId.get(n.cardId) || {
342
+ cardId: n.cardId,
343
+ processing: false,
344
+ receiving: false,
345
+ messageCount: 0,
346
+ messages: [],
347
+ };
348
+ const next = {
349
+ at: Date.now(),
350
+ cardId: n.cardId,
351
+ processing: n.kind === 'chat_processing' ? !!n.active : ('processing' in n ? !!n.processing : !!previous.processing),
352
+ receiving: 'receiving' in n ? !!n.receiving : !!previous.receiving,
353
+ messageCount: Array.isArray(n.messages) ? n.messages.length : previous.messageCount,
354
+ messages: Array.isArray(n.messages) ? n.messages : previous.messages,
355
+ };
356
+ latestByCardId.set(n.cardId, next);
357
+ NS.allChatNotifications.push(next);
358
+ if (n.cardId === cardId) {
359
+ NS.chatEvents.push(next);
356
360
  }
357
361
  }
358
362
  }
@@ -585,31 +589,36 @@ const waitForChatPredicate = (predicate, ms, label) =>
585
589
 
586
590
  function deriveProbeLifecycleMilestones(events, opts) {
587
591
  const milestones = [];
588
- let prevMessageCount = Number(opts.beforeCount || 0);
589
592
  let prevProcessing = Boolean(opts.beforeProcessing);
590
593
  const prompt = String(opts.prompt || '');
591
594
  const assistantText = opts.assistantText == null ? `Echo: ${prompt}` : String(opts.assistantText);
592
595
  const inProgressText = String(opts.inProgressText || PROBE_IN_PROGRESS_TEXT);
596
+ const seenRelevantMessages = new Set();
593
597
 
594
598
  for (const event of events) {
595
599
  const messages = Array.isArray(event?.messages) ? event.messages : [];
596
- const nextMessageCount = Number(event?.messageCount || messages.length || 0);
597
- const newMessages = nextMessageCount > prevMessageCount
598
- ? messages.slice(prevMessageCount, nextMessageCount)
599
- : [];
600
-
601
- for (const message of newMessages) {
600
+ for (const message of messages) {
602
601
  const role = String(message?.role || '');
603
602
  const text = String(message?.text || '');
604
- if (role === 'user' && text.includes(prompt)) milestones.push('user');
605
- else if (role === 'system' && text.trim().toLowerCase() === inProgressText) milestones.push('in-progress');
606
- else if (role === 'assistant' && text.includes(assistantText)) milestones.push('assistant');
603
+ const turn = typeof message?.turn === 'string' ? message.turn : '';
604
+ const signature = `${turn}|${role}|${text}`;
605
+ if (seenRelevantMessages.has(signature)) continue;
606
+
607
+ if (role === 'user' && text.includes(prompt)) {
608
+ milestones.push('user');
609
+ seenRelevantMessages.add(signature);
610
+ } else if (role === 'system' && text.trim().toLowerCase() === inProgressText) {
611
+ milestones.push('in-progress');
612
+ seenRelevantMessages.add(signature);
613
+ } else if (role === 'assistant' && text.includes(assistantText)) {
614
+ milestones.push('assistant');
615
+ seenRelevantMessages.add(signature);
616
+ }
607
617
  }
608
618
 
609
619
  const processing = Boolean(event?.processing);
610
620
  if (processing !== prevProcessing) milestones.push(processing ? 'processing-true' : 'processing-false');
611
621
 
612
- prevMessageCount = nextMessageCount;
613
622
  prevProcessing = processing;
614
623
  }
615
624
 
@@ -1163,9 +1172,9 @@ try {
1163
1172
  const t2aAssistant = await waitForChatPredicate((events) => {
1164
1173
  for (let i = events.length - 1; i >= 0; i -= 1) {
1165
1174
  const e = events[i];
1166
- if (e.messageCount < t2aBeforeCount + 2) continue;
1167
- const last = e.messages[e.messages.length - 1];
1168
- if (last?.role === 'assistant' && /paris/i.test(String(last.text || ''))) return e;
1175
+ const messages = Array.isArray(e?.messages) ? e.messages : [];
1176
+ const assistant = [...messages].reverse().find((message) => message?.role === 'assistant');
1177
+ if (assistant?.role === 'assistant' && /paris/i.test(String(assistant.text || ''))) return e;
1169
1178
  }
1170
1179
  return false;
1171
1180
  }, 240_000, 'T3a assistant response with paris');
@@ -1,4 +1,4 @@
1
- import { B as BlobStorage } from './storage-interface-D-iEiTJA.cjs';
1
+ import { B as BlobStorage } from './storage-interface-DogVPooM.cjs';
2
2
 
3
3
  /**
4
4
  * artifacts-store-lib.ts
@@ -1,4 +1,4 @@
1
- import { B as BlobStorage } from './storage-interface-D-iEiTJA.js';
1
+ import { B as BlobStorage } from './storage-interface-DogVPooM.js';
2
2
 
3
3
  /**
4
4
  * artifacts-store-lib.ts
@@ -1,7 +1,9 @@
1
- import { C as CommandInput, a as CommandResult } from './board-live-cards-public-BT5HrgqZ.cjs';
2
- import { A as ArtifactInfo, a as ArtifactsStore } from './artifacts-store-lib-C6qBpMfU.cjs';
3
- import './storage-interface-D-iEiTJA.cjs';
1
+ import { CommandInput, CommandResult } from './board-live-cards-public.cjs';
2
+ import { A as ArtifactInfo, a as ArtifactsStore } from './artifacts-store-lib-CqkJEgbx.cjs';
3
+ import './storage-interface-DogVPooM.cjs';
4
+ import './board-callback-transport-kP0K6UMq.cjs';
4
5
  import './execution-refs.cjs';
6
+ import './board-live-cards-lib-DVh3t9NT.cjs';
5
7
  import './types-BBhqYGhE.cjs';
6
8
 
7
9
  /**
@@ -1,7 +1,9 @@
1
- import { C as CommandInput, a as CommandResult } from './board-live-cards-public-DSRamFm8.js';
2
- import { A as ArtifactInfo, a as ArtifactsStore } from './artifacts-store-lib-D4qf7Q-7.js';
3
- import './storage-interface-D-iEiTJA.js';
1
+ import { CommandInput, CommandResult } from './board-live-cards-public.js';
2
+ import { A as ArtifactInfo, a as ArtifactsStore } from './artifacts-store-lib-D6Bo4yFN.js';
3
+ import './storage-interface-DogVPooM.js';
4
+ import './board-callback-transport-Bekq8Gp-.js';
4
5
  import './execution-refs.js';
6
+ import './board-live-cards-lib-iU8xOwNp.js';
5
7
  import './types-BBhqYGhE.js';
6
8
 
7
9
  /**
@@ -0,0 +1,71 @@
1
+ import { h as JournalStorage, K as KVStorage } from './storage-interface-DogVPooM.js';
2
+ import { ExecutionRef } from './execution-refs.js';
3
+
4
+ /**
5
+ * chat-storage-lib.ts
6
+ *
7
+ * ChatStorage interface + factories backed by JournalStorage (history) and
8
+ * KVStorage (processing state and config).
9
+ *
10
+ * Platform-free — no node:fs or node:crypto imports.
11
+ */
12
+
13
+ type Awaitable<T> = T | Promise<T>;
14
+ interface ChatRecord {
15
+ /** Journal entry id — also used as SSE cursor. */
16
+ id: string;
17
+ role: string;
18
+ text: string;
19
+ files: unknown[];
20
+ turn: string;
21
+ updated_at: string;
22
+ }
23
+ interface ChatConfig {
24
+ systemPrompt?: string;
25
+ }
26
+ interface ChatReadAfterResult {
27
+ records: ChatRecord[];
28
+ /** Pass as cursor on the next call. Null when the journal is empty. */
29
+ cursor: string | null;
30
+ }
31
+ interface ChatStorage {
32
+ /** Append a message; returns the new entry id (usable as a cursor). */
33
+ append(cardId: string, role: string, text: string, files?: unknown[], turn?: string): Awaitable<string>;
34
+ /** Read all messages in insertion order. */
35
+ readAll(cardId: string): Awaitable<ChatRecord[]>;
36
+ /**
37
+ * Read messages appended after cursor.
38
+ * Pass null to read from the beginning.
39
+ */
40
+ readAfter(cardId: string, cursor: string | null): Awaitable<ChatReadAfterResult>;
41
+ /** Remove all messages for this card. */
42
+ clear(cardId: string): Awaitable<void>;
43
+ setProcessing(cardId: string, active: boolean): Awaitable<void>;
44
+ isProcessing(cardId: string): Awaitable<boolean>;
45
+ getConfig(cardId: string): Awaitable<ChatConfig>;
46
+ setConfig(cardId: string, patch: Partial<ChatConfig>): Awaitable<void>;
47
+ }
48
+ /**
49
+ * Create a ChatStorage backed by:
50
+ * - journalFactory(cardId) → JournalStorage (one per-card journal for history)
51
+ * - kv → KVStorage (shared processing flags + config)
52
+ */
53
+ declare function createChatStorage(journalFactory: (cardId: string) => JournalStorage, kv: KVStorage): ChatStorage;
54
+ declare function createInMemoryChatStorage(): ChatStorage;
55
+
56
+ interface BoardTaskCallback {
57
+ token: string;
58
+ via: ExecutionRef;
59
+ }
60
+ interface BoardCallbackTransport {
61
+ createCallback(token: string): BoardTaskCallback;
62
+ }
63
+ declare function createHttpBoardCallbackTransport(baseUrl: string): BoardCallbackTransport;
64
+ declare function createInProcessBoardCallbackTransport(handlerKey: string): BoardCallbackTransport;
65
+ declare function createLocalNodeBoardCallbackTransport(opts?: string | {
66
+ notifyChannel?: string;
67
+ boardRuntimeStoreRef?: string;
68
+ queueStoreRef?: string;
69
+ }): BoardCallbackTransport;
70
+
71
+ export { type BoardCallbackTransport as B, type ChatStorage as C, type ChatRecord as a, type ChatReadAfterResult as b, type ChatConfig as c, createChatStorage as d, createHttpBoardCallbackTransport as e, createInMemoryChatStorage as f, createInProcessBoardCallbackTransport as g, createLocalNodeBoardCallbackTransport as h };
@@ -0,0 +1,71 @@
1
+ import { h as JournalStorage, K as KVStorage } from './storage-interface-DogVPooM.cjs';
2
+ import { ExecutionRef } from './execution-refs.cjs';
3
+
4
+ /**
5
+ * chat-storage-lib.ts
6
+ *
7
+ * ChatStorage interface + factories backed by JournalStorage (history) and
8
+ * KVStorage (processing state and config).
9
+ *
10
+ * Platform-free — no node:fs or node:crypto imports.
11
+ */
12
+
13
+ type Awaitable<T> = T | Promise<T>;
14
+ interface ChatRecord {
15
+ /** Journal entry id — also used as SSE cursor. */
16
+ id: string;
17
+ role: string;
18
+ text: string;
19
+ files: unknown[];
20
+ turn: string;
21
+ updated_at: string;
22
+ }
23
+ interface ChatConfig {
24
+ systemPrompt?: string;
25
+ }
26
+ interface ChatReadAfterResult {
27
+ records: ChatRecord[];
28
+ /** Pass as cursor on the next call. Null when the journal is empty. */
29
+ cursor: string | null;
30
+ }
31
+ interface ChatStorage {
32
+ /** Append a message; returns the new entry id (usable as a cursor). */
33
+ append(cardId: string, role: string, text: string, files?: unknown[], turn?: string): Awaitable<string>;
34
+ /** Read all messages in insertion order. */
35
+ readAll(cardId: string): Awaitable<ChatRecord[]>;
36
+ /**
37
+ * Read messages appended after cursor.
38
+ * Pass null to read from the beginning.
39
+ */
40
+ readAfter(cardId: string, cursor: string | null): Awaitable<ChatReadAfterResult>;
41
+ /** Remove all messages for this card. */
42
+ clear(cardId: string): Awaitable<void>;
43
+ setProcessing(cardId: string, active: boolean): Awaitable<void>;
44
+ isProcessing(cardId: string): Awaitable<boolean>;
45
+ getConfig(cardId: string): Awaitable<ChatConfig>;
46
+ setConfig(cardId: string, patch: Partial<ChatConfig>): Awaitable<void>;
47
+ }
48
+ /**
49
+ * Create a ChatStorage backed by:
50
+ * - journalFactory(cardId) → JournalStorage (one per-card journal for history)
51
+ * - kv → KVStorage (shared processing flags + config)
52
+ */
53
+ declare function createChatStorage(journalFactory: (cardId: string) => JournalStorage, kv: KVStorage): ChatStorage;
54
+ declare function createInMemoryChatStorage(): ChatStorage;
55
+
56
+ interface BoardTaskCallback {
57
+ token: string;
58
+ via: ExecutionRef;
59
+ }
60
+ interface BoardCallbackTransport {
61
+ createCallback(token: string): BoardTaskCallback;
62
+ }
63
+ declare function createHttpBoardCallbackTransport(baseUrl: string): BoardCallbackTransport;
64
+ declare function createInProcessBoardCallbackTransport(handlerKey: string): BoardCallbackTransport;
65
+ declare function createLocalNodeBoardCallbackTransport(opts?: string | {
66
+ notifyChannel?: string;
67
+ boardRuntimeStoreRef?: string;
68
+ queueStoreRef?: string;
69
+ }): BoardCallbackTransport;
70
+
71
+ export { type BoardCallbackTransport as B, type ChatStorage as C, type ChatRecord as a, type ChatReadAfterResult as b, type ChatConfig as c, createChatStorage as d, createHttpBoardCallbackTransport as e, createInMemoryChatStorage as f, createInProcessBoardCallbackTransport as g, createLocalNodeBoardCallbackTransport as h };
@@ -0,0 +1,222 @@
1
+ import { f as GraphEvent, G as GraphConfig } from './types-BBhqYGhE.cjs';
2
+ import { c as QueueMessage } from './storage-interface-DogVPooM.cjs';
3
+
4
+ /**
5
+ * notification-interface.ts
6
+ *
7
+ * Neutral shared notification contracts used by board/public/runtime layers.
8
+ * This file defines shapes only. It does not own routing, transport, or
9
+ * persistence semantics.
10
+ */
11
+
12
+ type NotificationCategory = 'board-output' | 'card-store' | 'chat-store' | 'hosted-runtime' | 'queue-storage' | 'batch';
13
+ interface NotificationChatMessage {
14
+ role: string;
15
+ text: string;
16
+ files?: unknown[];
17
+ turn?: string;
18
+ }
19
+ type BoardOutputNotification = {
20
+ category?: 'board-output';
21
+ kind: 'computed_values';
22
+ cardId: string;
23
+ values: Record<string, unknown>;
24
+ } | {
25
+ category?: 'board-output';
26
+ kind: 'data_object';
27
+ key: string;
28
+ payload: unknown;
29
+ } | {
30
+ category?: 'board-output';
31
+ kind: 'status';
32
+ status: unknown;
33
+ };
34
+ type CardStoreNotification = {
35
+ category?: 'card-store';
36
+ kind: 'card_refreshed';
37
+ cardId: string;
38
+ card: LiveCard;
39
+ } | {
40
+ category?: 'card-store';
41
+ kind: 'card_removed';
42
+ cardId: string;
43
+ };
44
+ type ChatStoreNotification = {
45
+ category?: 'chat-store';
46
+ kind: 'card_chats';
47
+ cardId: string;
48
+ sentAt?: string;
49
+ sentAtMs?: number;
50
+ messages: NotificationChatMessage[];
51
+ receiving: boolean;
52
+ processing?: boolean;
53
+ } | {
54
+ category?: 'chat-store';
55
+ kind: 'chat_messages';
56
+ cardId: string;
57
+ messages: NotificationChatMessage[];
58
+ };
59
+ type HostedRuntimeNotification = {
60
+ category?: 'hosted-runtime';
61
+ kind: 'chat_processing';
62
+ cardId: string;
63
+ active: boolean;
64
+ sentAtMs?: number;
65
+ } | {
66
+ category?: 'hosted-runtime';
67
+ kind: 'card_watchparty';
68
+ cardId: string;
69
+ channel: string;
70
+ payload: unknown;
71
+ clear?: boolean;
72
+ replace?: boolean;
73
+ sentAtMs?: number;
74
+ };
75
+ type QueueStorageNotification = {
76
+ category?: 'queue-storage';
77
+ kind: 'message_enqueued';
78
+ lane?: string;
79
+ message: QueueMessage<unknown>;
80
+ };
81
+ type BoardChangeNotification = BoardOutputNotification | CardStoreNotification;
82
+ type RuntimeNotification = BoardOutputNotification | CardStoreNotification | ChatStoreNotification | HostedRuntimeNotification | QueueStorageNotification;
83
+ type RuntimeNotificationBatch = {
84
+ category?: 'batch';
85
+ kind: 'notification-batch';
86
+ notifications: RuntimeNotification[];
87
+ };
88
+ type NotificationEmitter = (notification: RuntimeNotification | RuntimeNotificationBatch) => void | Promise<void>;
89
+ declare function isRuntimeNotificationBatch(value: unknown): value is RuntimeNotificationBatch;
90
+ declare function isBoardChangeNotification(notification: RuntimeNotification): notification is BoardChangeNotification;
91
+ declare function isChatScopedRuntimeNotification(notification: RuntimeNotification): notification is ChatStoreNotification | HostedRuntimeNotification;
92
+ declare function notificationCategoryForKind(kind: RuntimeNotification['kind']): Exclude<NotificationCategory, 'batch'>;
93
+ declare function withRuntimeNotificationCategories<T extends RuntimeNotification[]>(notifications: T): T;
94
+ declare function withRuntimeNotificationBatchCategories(batch: RuntimeNotificationBatch): RuntimeNotificationBatch;
95
+
96
+ /**
97
+ * board-live-cards-lib — Pure logic library for the board-live-cards CLI.
98
+ *
99
+ * Merged from:
100
+ * board-live-cards-all-stores.ts
101
+ * board-live-cards-lib-types.ts
102
+ * board-live-cards-lib-board-status.ts
103
+ * board-live-cards-lib-card-handler.ts
104
+ * board-live-cards-cli-board-commands.ts
105
+ * board-live-cards-cli-card-commands.ts
106
+ * board-live-cards-cli-callbacks.ts
107
+ *
108
+ * Zero platform imports. All storage is injected via adapter interfaces.
109
+ * Safe for Node, browser, and neutral (V8/PyMiniRacer) bundles.
110
+ */
111
+
112
+ interface LiveCard {
113
+ id: string;
114
+ [key: string]: unknown;
115
+ }
116
+ interface CardIndexEntry {
117
+ /** Storage-specific address (file path, Cosmos doc id, localStorage key). */
118
+ key: string;
119
+ /** Checksum of card content — computed by the adapter at write time. */
120
+ checksum: string;
121
+ updatedAt: string;
122
+ }
123
+ type CardIndex = Record<string, CardIndexEntry>;
124
+ type CardChecksumIndex = Record<string, string>;
125
+ interface CardStorageAdapter {
126
+ readIndex(): CardIndex | null;
127
+ writeIndex(index: CardIndex): void;
128
+ readCard(key: string): LiveCard | null;
129
+ /** Write card content; returns checksum of what was written. */
130
+ writeCard(key: string, card: LiveCard): string;
131
+ removeCard(key: string): void;
132
+ cardExists(key: string): boolean;
133
+ defaultCardKey(cardId: string): string;
134
+ }
135
+ interface CardStore {
136
+ readCard(id: string): LiveCard | null;
137
+ readCardKey(id: string): string | null;
138
+ readAllCards(): LiveCard[];
139
+ readChecksumIndex(): CardChecksumIndex;
140
+ changedSince(snapshotChecksumIndex: CardChecksumIndex): string[];
141
+ }
142
+ interface CardUpsertValidation {
143
+ ok: boolean;
144
+ error?: string;
145
+ }
146
+ interface CardAdminStore extends CardStore {
147
+ validateUpsert(id: string, cardKey: string): CardUpsertValidation;
148
+ writeCard(id: string, card: LiveCard, cardKey?: string): void;
149
+ patchCard(id: string, jsonPath: string, value: unknown): void;
150
+ removeCard(id: string): void;
151
+ readIndex(): CardIndex;
152
+ }
153
+ declare function createCardStore(adapter: CardStorageAdapter, onWarn?: (msg: string) => void): CardAdminStore;
154
+ interface JournalEntry {
155
+ id: string;
156
+ event: GraphEvent;
157
+ }
158
+ interface JournalStorageAdapter {
159
+ readAllEntries(): JournalEntry[];
160
+ appendEntry(entry: JournalEntry): void;
161
+ generateId(): string;
162
+ }
163
+ declare const SNAPSHOT_SCHEMA_VERSION_V1 = "v1";
164
+ declare const BOARD_GRAPH_KEY = "board/graph";
165
+ interface StateSnapshotReadView {
166
+ version: string | null;
167
+ values: Record<string, unknown>;
168
+ }
169
+ interface BoardStatusCard {
170
+ name: string;
171
+ status: string;
172
+ error?: {
173
+ message: string;
174
+ code?: string;
175
+ at?: string;
176
+ source?: 'task-runtime' | 'source-fetch' | 'timeout' | 'unknown';
177
+ };
178
+ requires: string[];
179
+ requires_satisfied: string[];
180
+ requires_missing: string[];
181
+ provides_declared: string[];
182
+ provides_runtime: string[];
183
+ blocked_by: string[];
184
+ unblocks: string[];
185
+ runtime: {
186
+ attempt_count: number;
187
+ restart_count: number;
188
+ in_progress_since: string | null;
189
+ last_transition_at: string | null;
190
+ last_completed_at: string | null;
191
+ last_restarted_at: string | null;
192
+ status_age_ms: number | null;
193
+ };
194
+ }
195
+ interface BoardStatusObject {
196
+ schema_version: 'v1';
197
+ meta: {
198
+ board: {
199
+ path: string;
200
+ };
201
+ };
202
+ summary: {
203
+ card_count: number;
204
+ completed: number;
205
+ eligible: number;
206
+ pending: number;
207
+ blocked: number;
208
+ unresolved: number;
209
+ failed?: number;
210
+ in_progress?: number;
211
+ orphan_cards?: number;
212
+ topology?: {
213
+ edge_count: number;
214
+ max_fan_out_card: string | null;
215
+ max_fan_out: number;
216
+ };
217
+ };
218
+ cards: BoardStatusCard[];
219
+ }
220
+ declare const EMPTY_CONFIG: GraphConfig;
221
+
222
+ export { type BoardChangeNotification as B, type CardStoreNotification as C, EMPTY_CONFIG as E, type HostedRuntimeNotification as H, type JournalStorageAdapter as J, type LiveCard as L, type NotificationCategory as N, type RuntimeNotification as R, SNAPSHOT_SCHEMA_VERSION_V1 as S, type BoardOutputNotification as a, type ChatStoreNotification as b, type NotificationChatMessage as c, type RuntimeNotificationBatch as d, isChatScopedRuntimeNotification as e, isRuntimeNotificationBatch as f, withRuntimeNotificationCategories as g, type NotificationEmitter as h, isBoardChangeNotification as i, type CardAdminStore as j, type BoardStatusObject as k, BOARD_GRAPH_KEY as l, type CardChecksumIndex as m, notificationCategoryForKind as n, type CardUpsertValidation as o, type CardIndex as p, type StateSnapshotReadView as q, createCardStore as r, withRuntimeNotificationBatchCategories as w };