yaml-flow 8.6.3 → 8.7.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 (148) hide show
  1. package/browser/adapters/firebase-storage.js +3 -0
  2. package/browser/adapters/firestore-storage.js +3 -0
  3. package/browser/adapters/localstorage-storage.js +4 -0
  4. package/browser/asset-integrity.json +20 -4
  5. package/browser/server-runtime-controlface.js +8 -0
  6. package/examples/ARCHITECTURE.md +5 -32
  7. package/examples/board/demo-shell-with-server.html +2 -2
  8. package/examples/board/doc.html +2 -2
  9. package/examples/board/server/board-server.js +4 -2
  10. package/examples/board/server/chat-flow/flow-steps.json +10 -5
  11. package/examples/board/test/server-http-test.js +93 -0
  12. package/examples/board-firestore/README.md +81 -0
  13. package/examples/board-firestore/browser/board-runtime.js +263 -0
  14. package/examples/board-firestore/firestore.indexes.json +29 -0
  15. package/examples/board-firestore/package.json +14 -0
  16. package/examples/board-firestore/server/adapters/firestore-archive-factory.js +59 -0
  17. package/examples/board-firestore/server/adapters/firestore-blob-storage.js +82 -0
  18. package/examples/board-firestore/server/adapters/firestore-board-adapter.js +127 -0
  19. package/examples/board-firestore/server/adapters/firestore-journal-storage.js +54 -0
  20. package/examples/board-firestore/server/adapters/firestore-kv-storage.js +47 -0
  21. package/examples/board-firestore/server/adapters/firestore-lock.js +62 -0
  22. package/examples/board-firestore/server/adapters/firestore-queue-storage.js +186 -0
  23. package/examples/board-firestore/server/adapters/firestore-scratch-storage.js +50 -0
  24. package/examples/board-firestore/server/worker.js +146 -0
  25. package/lib/{artifacts-store-lib-BR-Samty.d.cts → artifacts-store-lib-D9nMkVcE.d.cts} +1 -1
  26. package/lib/{artifacts-store-lib-DT7XlWUL.d.ts → artifacts-store-lib-DSSMqVL2.d.ts} +1 -1
  27. package/lib/artifacts-store-public.d.cts +2 -2
  28. package/lib/artifacts-store-public.d.ts +2 -2
  29. package/lib/board-live-cards-mcp.cjs +1 -1
  30. package/lib/board-live-cards-mcp.d.cts +51 -3
  31. package/lib/board-live-cards-mcp.d.ts +51 -3
  32. package/lib/board-live-cards-mcp.js +1 -1
  33. package/lib/board-live-cards-node.cjs +8 -8
  34. package/lib/board-live-cards-node.d.cts +13 -9
  35. package/lib/board-live-cards-node.d.ts +13 -9
  36. package/lib/board-live-cards-node.js +8 -8
  37. package/lib/{board-live-cards-public-BMUIPOrc.d.ts → board-live-cards-public-D-DJek3X.d.ts} +1 -1
  38. package/lib/{board-live-cards-public-wkNmBIRC.d.cts → board-live-cards-public-DQzPe7A9.d.cts} +1 -1
  39. package/lib/board-live-cards-public-async-3hUuHxDx.d.ts +55 -0
  40. package/lib/board-live-cards-public-async-CgMCYYft.d.cts +55 -0
  41. package/lib/board-live-cards-public.d.cts +1 -1
  42. package/lib/board-live-cards-public.d.ts +1 -1
  43. package/lib/board-live-cards-server-runtime.cjs +1 -1
  44. package/lib/board-live-cards-server-runtime.d.cts +10 -6
  45. package/lib/board-live-cards-server-runtime.d.ts +10 -6
  46. package/lib/board-live-cards-server-runtime.js +1 -1
  47. package/lib/board-platform-adapter-async-DOfEq_HC.d.cts +129 -0
  48. package/lib/board-platform-adapter-async-JZPCzZnH.d.ts +129 -0
  49. package/lib/board-worker-adapter.cjs +3 -3
  50. package/lib/board-worker-adapter.js +3 -3
  51. package/lib/card-store-public.d.cts +1 -1
  52. package/lib/card-store-public.d.ts +1 -1
  53. package/lib/{chat-storage-lib-BIUbE-fM.d.cts → chat-storage-lib-B9Q34Dyv.d.cts} +1 -1
  54. package/lib/{chat-storage-lib-BlG-sobS.d.ts → chat-storage-lib-DB9iSai2.d.ts} +1 -1
  55. package/lib/chat-store-public.d.cts +2 -2
  56. package/lib/chat-store-public.d.ts +2 -2
  57. package/lib/chunk-272IYUKT.cjs +2 -0
  58. package/lib/chunk-5XHOHTLZ.cjs +2 -0
  59. package/lib/chunk-6APH25VI.js +2 -0
  60. package/lib/chunk-7FGPOGRV.cjs +2 -0
  61. package/lib/chunk-7ICPAABP.cjs +7 -0
  62. package/lib/chunk-CPAXTVBQ.cjs +2 -0
  63. package/lib/chunk-DDYSXP2A.cjs +3 -0
  64. package/lib/chunk-EGRHWZRV.js +2 -0
  65. package/lib/chunk-GL2OHR2E.cjs +2 -0
  66. package/lib/chunk-IPLSRN6P.cjs +4 -0
  67. package/lib/chunk-J5J6BG7B.js +2 -0
  68. package/lib/chunk-KAWQPLIE.cjs +2 -0
  69. package/lib/chunk-LPXVVMQT.cjs +2 -0
  70. package/lib/chunk-M3OU6IS5.cjs +2 -0
  71. package/lib/chunk-M6STQR5F.cjs +2 -0
  72. package/lib/chunk-NJJ7WEDT.cjs +2 -0
  73. package/lib/chunk-NKIQRCOM.cjs +2 -0
  74. package/lib/chunk-NM6O35RY.cjs +2 -0
  75. package/lib/chunk-NTICU4OK.js +2 -0
  76. package/lib/chunk-O7NOHKVR.js +2 -0
  77. package/lib/chunk-PRHQBGPT.js +2 -0
  78. package/lib/chunk-S44QZUDX.js +2 -0
  79. package/lib/chunk-SGV7PU4H.js +2 -0
  80. package/lib/chunk-TSN3RTXT.js +4 -0
  81. package/lib/chunk-VXJHBWK3.js +2 -0
  82. package/lib/chunk-WHDEBJLT.js +7 -0
  83. package/lib/chunk-XYN5D3GL.js +2 -0
  84. package/lib/chunk-YGALANRO.js +2 -0
  85. package/lib/chunk-ZJ5M5COT.js +2 -0
  86. package/lib/chunk-ZXQR7GHT.js +3 -0
  87. package/lib/cloud-storage.cjs +1 -1
  88. package/lib/cloud-storage.d.cts +5 -3
  89. package/lib/cloud-storage.d.ts +5 -3
  90. package/lib/cloud-storage.js +1 -1
  91. package/lib/firebase-storage/index.cjs +3 -0
  92. package/lib/firebase-storage/index.d.cts +57 -0
  93. package/lib/firebase-storage/index.d.ts +57 -0
  94. package/lib/firebase-storage/index.js +3 -0
  95. package/lib/firestore-storage/index.cjs +3 -0
  96. package/lib/firestore-storage/index.d.cts +98 -0
  97. package/lib/firestore-storage/index.d.ts +98 -0
  98. package/lib/firestore-storage/index.js +3 -0
  99. package/lib/localstorage-storage/index.cjs +2 -0
  100. package/lib/localstorage-storage/index.d.cts +39 -0
  101. package/lib/localstorage-storage/index.d.ts +39 -0
  102. package/lib/localstorage-storage/index.js +2 -0
  103. package/lib/mcp-tool-registries-BBObLYga.d.ts +41 -0
  104. package/lib/mcp-tool-registries-W3TRj6O5.d.cts +41 -0
  105. package/lib/queue-lane-registry-PaZuFpwp.d.cts +30 -0
  106. package/lib/queue-lane-registry-PaZuFpwp.d.ts +30 -0
  107. package/lib/server-jobs-queue-runner/index.cjs +2 -0
  108. package/lib/server-jobs-queue-runner/index.d.cts +22 -0
  109. package/lib/server-jobs-queue-runner/index.d.ts +22 -0
  110. package/lib/server-jobs-queue-runner/index.js +2 -0
  111. package/lib/server-runtime/index.cjs +1 -1
  112. package/lib/server-runtime/index.d.cts +11 -17
  113. package/lib/server-runtime/index.d.ts +11 -17
  114. package/lib/server-runtime/index.js +1 -1
  115. package/lib/server-runtime-agentface/index.cjs +2 -0
  116. package/lib/server-runtime-agentface/index.d.cts +53 -0
  117. package/lib/server-runtime-agentface/index.d.ts +53 -0
  118. package/lib/server-runtime-agentface/index.js +2 -0
  119. package/lib/server-runtime-controlface/index.cjs +2 -0
  120. package/lib/server-runtime-controlface/index.d.cts +80 -0
  121. package/lib/server-runtime-controlface/index.d.ts +80 -0
  122. package/lib/server-runtime-controlface/index.js +2 -0
  123. package/lib/server-runtime-core/index.cjs +2 -0
  124. package/lib/server-runtime-core/index.d.cts +376 -0
  125. package/lib/server-runtime-core/index.d.ts +376 -0
  126. package/lib/server-runtime-core/index.js +2 -0
  127. package/lib/server-runtime-watchers/index.cjs +2 -0
  128. package/lib/server-runtime-watchers/index.d.cts +127 -0
  129. package/lib/server-runtime-watchers/index.d.ts +127 -0
  130. package/lib/server-runtime-watchers/index.js +2 -0
  131. package/lib/server-runtime-webhooks/index.cjs +2 -0
  132. package/lib/server-runtime-webhooks/index.d.cts +34 -0
  133. package/lib/server-runtime-webhooks/index.d.ts +34 -0
  134. package/lib/server-runtime-webhooks/index.js +2 -0
  135. package/lib/storage-async-interface-BRR4eBjx.d.cts +81 -0
  136. package/lib/storage-async-interface-DhlOVPSp.d.ts +81 -0
  137. package/lib/{queue-lane-registry-BPKWWgd4.d.cts → types-BzQY45dH.d.cts} +8 -34
  138. package/lib/{queue-lane-registry-Be6c0ftj.d.ts → types-CF2xUcZW.d.ts} +8 -34
  139. package/package.json +46 -2
  140. package/examples/board-local/demo-shell-localstorage.html +0 -843
  141. package/lib/board-live-cards-public-async-DKZqbJVU.d.ts +0 -256
  142. package/lib/board-live-cards-public-async-dMWNbWq6.d.cts +0 -256
  143. package/lib/chunk-GJJMEAVN.cjs +0 -2
  144. package/lib/chunk-GLIX37VG.cjs +0 -8
  145. package/lib/chunk-LRVAVWAG.js +0 -8
  146. package/lib/chunk-MLVTJASJ.js +0 -2
  147. package/lib/chunk-SCWHDI3I.js +0 -2
  148. package/lib/chunk-WOALA3V5.cjs +0 -2
@@ -1,256 +0,0 @@
1
- import { b as BlobStat, a as KindValueRef, c as JournalEntry, d as JournalReadResult, Q as QueueMessage, e as QueueLeasedMessage, f as QueueDeadLetterMessage } from './storage-interface-BFiD3kyB.js';
2
- import { g as BoardCallbackTransport, c as BoardChangeNotification, a as CommandInput, C as CommandResult, h as BoardStatusObject } from './board-live-cards-public-BMUIPOrc.js';
3
- import { ExecutionRef } from './execution-refs.js';
4
-
5
- interface AsyncBlobStorage {
6
- read(key: string): Promise<string | null>;
7
- write(key: string, content: string): Promise<void>;
8
- exists(key: string): Promise<boolean>;
9
- remove(key: string): Promise<void>;
10
- readBytes?(key: string): Promise<Uint8Array | null>;
11
- writeBytes?(key: string, content: Uint8Array): Promise<void>;
12
- listKeys(prefix?: string): Promise<string[]>;
13
- stat?(key: string): Promise<BlobStat | null>;
14
- keyRef?(key: string): Promise<KindValueRef> | KindValueRef;
15
- }
16
- interface AsyncJournalStorage {
17
- append(payload: unknown): Promise<JournalEntry>;
18
- readAll(): Promise<JournalEntry[]>;
19
- readAfter(cursor: string | null): Promise<JournalReadResult>;
20
- clear?(): Promise<void>;
21
- }
22
- interface AsyncQueueStorage {
23
- enqueue<T>(body: T): Promise<QueueMessage<T>>;
24
- /** See QueueStorage.enqueueIfAbsent. Optional on adapters that cannot cheaply dedup. */
25
- enqueueIfAbsent?<T>(body: T, dedupKey: string): Promise<QueueMessage<T> | null>;
26
- lease<T>(opts?: {
27
- max?: number;
28
- visibilityMs?: number;
29
- }): Promise<QueueLeasedMessage<T>[]>;
30
- ack(messageId: string, leaseToken: string): Promise<boolean>;
31
- nack(messageId: string, leaseToken: string, opts?: {
32
- dead?: boolean;
33
- reason?: string;
34
- }): Promise<boolean>;
35
- peekActive<T>(prefix?: string): Promise<QueueMessage<T>[]>;
36
- peekDeadLetter<T>(prefix?: string): Promise<QueueDeadLetterMessage<T>[]>;
37
- }
38
- interface AsyncKVStorage {
39
- read(key: string): Promise<unknown | null>;
40
- write(key: string, value: unknown): Promise<void>;
41
- delete(key: string): Promise<void>;
42
- listKeys(prefix?: string): Promise<string[]>;
43
- }
44
- interface AsyncJSONStorage {
45
- read(key: string): Promise<unknown | null>;
46
- get(key: string, jsonPath: string): Promise<unknown | null>;
47
- write(key: string, value: unknown): Promise<void>;
48
- delete(key: string): Promise<void>;
49
- listKeys(prefix?: string): Promise<string[]>;
50
- shallowMerge(key: string, patch: Record<string, unknown>): Promise<void>;
51
- deepMerge(key: string, patch: Record<string, unknown>): Promise<void>;
52
- patch(key: string, jsonPath: string, value: unknown): Promise<void>;
53
- }
54
- interface AsyncScratchStorage extends AsyncBlobStorage {
55
- getUniqueKey(prefix?: string, suffix?: string): Promise<string>;
56
- create(data: string, prefix?: string, suffix?: string): Promise<string>;
57
- keyRef(key: string): Promise<KindValueRef> | KindValueRef;
58
- config: {
59
- get(k: string): Promise<unknown> | unknown;
60
- set(k: string, v: unknown): Promise<void> | void;
61
- };
62
- }
63
- interface AsyncArchiveFactory {
64
- stream(name: string): AsyncJournalStorage;
65
- blob(name: string): AsyncBlobStorage;
66
- listStreams(prefix?: string): Promise<string[]>;
67
- listBlobs(prefix?: string): Promise<string[]>;
68
- config: {
69
- get(k: string): Promise<unknown> | unknown;
70
- set(k: string, v: unknown): Promise<void> | void;
71
- };
72
- }
73
- interface AsyncStorageProvider {
74
- blob: AsyncBlobStorage;
75
- journal: AsyncJournalStorage;
76
- kv: AsyncKVStorage;
77
- }
78
- interface AsyncAtomicRelayLock {
79
- tryAcquire(): Promise<(() => Promise<void> | void) | null>;
80
- }
81
- declare function withAsyncRelayLock(lock: AsyncAtomicRelayLock, work: () => Promise<void>, continuation?: () => Promise<void> | void): Promise<boolean>;
82
-
83
- interface AsyncBoardWorkerRequest {
84
- boardId?: string;
85
- ref: ExecutionRef;
86
- args: Record<string, unknown>;
87
- }
88
- interface AsyncBoardWorkerQueuedRequest {
89
- messageId: string;
90
- enqueuedAt: string;
91
- attempt: number;
92
- request: AsyncBoardWorkerRequest;
93
- }
94
- interface AsyncBoardWorkerLeasedRequest extends AsyncBoardWorkerQueuedRequest {
95
- leaseToken: string;
96
- leaseExpiresAt: string;
97
- }
98
- interface AsyncBoardWorkerDeadLetterRequest extends AsyncBoardWorkerQueuedRequest {
99
- reason?: string;
100
- }
101
- interface AsyncBoardWorkerStore {
102
- enqueueRequest(request: AsyncBoardWorkerRequest): Promise<string>;
103
- leaseRequests(opts?: {
104
- max?: number;
105
- visibilityMs?: number;
106
- }): Promise<AsyncBoardWorkerLeasedRequest[]>;
107
- ackRequest(messageId: string, leaseToken: string): Promise<boolean>;
108
- nackRequest(messageId: string, leaseToken: string, opts?: {
109
- dead?: boolean;
110
- reason?: string;
111
- }): Promise<boolean>;
112
- peekActive(): Promise<AsyncBoardWorkerQueuedRequest[]>;
113
- peekDeadLetter(): Promise<AsyncBoardWorkerDeadLetterRequest[]>;
114
- }
115
- interface AsyncBoardConfigStore {
116
- readTaskExecutorRef(): Promise<ExecutionRef | undefined>;
117
- writeTaskExecutorRef(ref: ExecutionRef): Promise<void>;
118
- readChatHandlerFlow(): Promise<unknown>;
119
- writeChatHandlerFlow(flow: unknown): Promise<void>;
120
- readCardStoreRef(): Promise<string | null>;
121
- writeCardStoreRef(ref: string): Promise<void>;
122
- readOutputsStoreRef(): Promise<string | null>;
123
- writeOutputsStoreRef(ref: string): Promise<void>;
124
- readScratchStoreRef(): Promise<string | null>;
125
- writeScratchStoreRef(ref: string): Promise<void>;
126
- readArchiveStoreRef(): Promise<string | null>;
127
- writeArchiveStoreRef(ref: string): Promise<void>;
128
- readChatStoreRef(): Promise<string | null>;
129
- writeChatStoreRef(ref: string): Promise<void>;
130
- readArtifactsStoreRef(): Promise<string | null>;
131
- writeArtifactsStoreRef(ref: string): Promise<void>;
132
- }
133
- interface AsyncBoardPlatformAdapter {
134
- kvStorage(namespace: string): AsyncKVStorage;
135
- kvStorageForRef(ref: string): AsyncKVStorage;
136
- blobStorage(namespace: string): AsyncBlobStorage;
137
- scratchStorage(): AsyncScratchStorage;
138
- scratchStorageForRef(ref: string): AsyncScratchStorage;
139
- archiveFactory(): AsyncArchiveFactory;
140
- archiveFactoryForRef(ref: string): AsyncArchiveFactory;
141
- journalStorage(): AsyncJournalStorage;
142
- boardWorkerStore(): AsyncBoardWorkerStore;
143
- chatAgentStore(): AsyncBoardWorkerStore;
144
- processAccumulatedStore(): AsyncQueueStorage;
145
- lock: AsyncAtomicRelayLock;
146
- callbackTransport?: BoardCallbackTransport;
147
- dispatchExecution(ref: ExecutionRef, args: Record<string, unknown>): Promise<{
148
- dispatched: boolean;
149
- error?: string;
150
- }>;
151
- supportsDirectSourceOutput?(ref: ExecutionRef): boolean;
152
- resolveBlob(ref: KindValueRef): Promise<string>;
153
- hashFn(value: unknown): string;
154
- genId(): string;
155
- requestProcessAccumulated?(): void | Promise<void>;
156
- publishBoardChangeNotifications?(notifications: BoardChangeNotification[]): void | Promise<void>;
157
- warn?: (msg: string) => void;
158
- }
159
- interface HostedFetchResponseLike {
160
- ok: boolean;
161
- status: number;
162
- text(): Promise<string>;
163
- }
164
- interface HostedFetchLike {
165
- (input: string, init: {
166
- method: string;
167
- headers: Record<string, string>;
168
- body: string;
169
- }): Promise<HostedFetchResponseLike>;
170
- }
171
- interface HostedAsyncBoardPlatformAdapterOptions {
172
- boardId?: string;
173
- kvStorage(namespace: string): AsyncKVStorage;
174
- kvStorageForRef(ref: string): AsyncKVStorage;
175
- blobStorage(namespace: string): AsyncBlobStorage;
176
- scratchStorage(): AsyncScratchStorage;
177
- scratchStorageForRef(ref: string): AsyncScratchStorage;
178
- archiveFactory(): AsyncArchiveFactory;
179
- archiveFactoryForRef(ref: string): AsyncArchiveFactory;
180
- journalStorage(): AsyncJournalStorage;
181
- queueStorage?: AsyncQueueStorage;
182
- boardWorkerStore?: AsyncBoardWorkerStore;
183
- chatAgentQueueStorage?: AsyncQueueStorage;
184
- chatAgentStore?: AsyncBoardWorkerStore;
185
- processAccumulatedQueueStorage?: AsyncQueueStorage;
186
- processAccumulatedStore?: AsyncQueueStorage;
187
- lock: AsyncAtomicRelayLock;
188
- callbackTransport?: BoardCallbackTransport;
189
- fetch?: HostedFetchLike;
190
- dispatchExecution?: (ref: ExecutionRef, args: Record<string, unknown>) => Promise<{
191
- dispatched: boolean;
192
- error?: string;
193
- }>;
194
- supportsDirectSourceOutput?: (ref: ExecutionRef) => boolean;
195
- resolveBlob?: (ref: KindValueRef) => Promise<string>;
196
- hashFn: (value: unknown) => string;
197
- genId: () => string;
198
- requestProcessAccumulated?: () => void | Promise<void>;
199
- publishBoardChangeNotifications?: (notifications: BoardChangeNotification[]) => void | Promise<void>;
200
- onWarn?: (msg: string) => void;
201
- }
202
- declare function createAsyncBoardWorkerStore(queue: AsyncQueueStorage): AsyncBoardWorkerStore;
203
- declare function createAsyncBoardConfigStore(kv: AsyncKVStorage): AsyncBoardConfigStore;
204
- declare function createHostedAsyncBoardPlatformAdapter(options: HostedAsyncBoardPlatformAdapterOptions): AsyncBoardPlatformAdapter;
205
-
206
- interface AsyncBoardLiveCardsPublic {
207
- init(input: CommandInput): Promise<CommandResult>;
208
- status(input: CommandInput): Promise<CommandResult<BoardStatusObject>>;
209
- getCardStoreRef(input: CommandInput): Promise<CommandResult<{
210
- storeRef: string;
211
- }>>;
212
- getOutputsStoreRef(input: CommandInput): Promise<CommandResult<{
213
- storeRef: string;
214
- }>>;
215
- getScratchStoreRef(input: CommandInput): Promise<CommandResult<{
216
- storeRef: string | null;
217
- }>>;
218
- getArchiveStoreRef(input: CommandInput): Promise<CommandResult<{
219
- storeRef: string | null;
220
- }>>;
221
- getChatStoreRef(input: CommandInput): Promise<CommandResult<{
222
- storeRef: string | null;
223
- }>>;
224
- getArtifactsStoreRef(input: CommandInput): Promise<CommandResult<{
225
- storeRef: string | null;
226
- }>>;
227
- getConfig(input: CommandInput): Promise<CommandResult<{
228
- value: unknown;
229
- }>>;
230
- getOutputsDataObject(input: CommandInput): Promise<CommandResult>;
231
- getAllOutputsDataObjects(input: CommandInput): Promise<CommandResult<Record<string, unknown>>>;
232
- getOutputsComputedValues(input: CommandInput): Promise<CommandResult>;
233
- getAllOutputsComputedValues(input: CommandInput): Promise<CommandResult<Record<string, unknown>>>;
234
- getOutputsFetchedSources(input: CommandInput): Promise<CommandResult<Record<string, string>>>;
235
- getAllOutputsFetchedSources(input: CommandInput): Promise<CommandResult<Record<string, Record<string, string>>>>;
236
- addCardFiles(input: CommandInput): Promise<CommandResult<{
237
- cardId: string;
238
- files_added: Array<{
239
- idx: number;
240
- entry: unknown;
241
- }>;
242
- notified: true;
243
- }>>;
244
- cardRefreshedNotify(input: CommandInput): Promise<CommandResult>;
245
- removeCard(input: CommandInput): Promise<CommandResult>;
246
- retrigger(input: CommandInput): Promise<CommandResult>;
247
- upsertCard(input: CommandInput): Promise<CommandResult>;
248
- processAccumulatedEvents(input: CommandInput): Promise<CommandResult>;
249
- taskFailed(input: CommandInput): Promise<CommandResult>;
250
- taskProgress(input: CommandInput): Promise<CommandResult>;
251
- sourceDataFetched(input: CommandInput): Promise<CommandResult>;
252
- sourceDataFetchFailure(input: CommandInput): Promise<CommandResult>;
253
- }
254
- declare function createAsyncBoardLiveCardsPublic(baseRef: KindValueRef, adapter: AsyncBoardPlatformAdapter): AsyncBoardLiveCardsPublic;
255
-
256
- export { type AsyncBoardLiveCardsPublic as A, type HostedAsyncBoardPlatformAdapterOptions as H, type AsyncBoardPlatformAdapter as a, type AsyncJSONStorage as b, type AsyncKVStorage as c, type AsyncBlobStorage as d, type AsyncJournalStorage as e, type AsyncStorageProvider as f, type AsyncAtomicRelayLock as g, type AsyncQueueStorage as h, type AsyncBoardConfigStore as i, type AsyncBoardWorkerDeadLetterRequest as j, type AsyncBoardWorkerLeasedRequest as k, type AsyncBoardWorkerQueuedRequest as l, type AsyncBoardWorkerRequest as m, type AsyncBoardWorkerStore as n, type HostedFetchLike as o, type HostedFetchResponseLike as p, createAsyncBoardConfigStore as q, createAsyncBoardLiveCardsPublic as r, createAsyncBoardWorkerStore as s, createHostedAsyncBoardPlatformAdapter as t, withAsyncRelayLock as w };
@@ -1,256 +0,0 @@
1
- import { b as BlobStat, a as KindValueRef, c as JournalEntry, d as JournalReadResult, Q as QueueMessage, e as QueueLeasedMessage, f as QueueDeadLetterMessage } from './storage-interface-BFiD3kyB.cjs';
2
- import { g as BoardCallbackTransport, c as BoardChangeNotification, a as CommandInput, C as CommandResult, h as BoardStatusObject } from './board-live-cards-public-wkNmBIRC.cjs';
3
- import { ExecutionRef } from './execution-refs.cjs';
4
-
5
- interface AsyncBlobStorage {
6
- read(key: string): Promise<string | null>;
7
- write(key: string, content: string): Promise<void>;
8
- exists(key: string): Promise<boolean>;
9
- remove(key: string): Promise<void>;
10
- readBytes?(key: string): Promise<Uint8Array | null>;
11
- writeBytes?(key: string, content: Uint8Array): Promise<void>;
12
- listKeys(prefix?: string): Promise<string[]>;
13
- stat?(key: string): Promise<BlobStat | null>;
14
- keyRef?(key: string): Promise<KindValueRef> | KindValueRef;
15
- }
16
- interface AsyncJournalStorage {
17
- append(payload: unknown): Promise<JournalEntry>;
18
- readAll(): Promise<JournalEntry[]>;
19
- readAfter(cursor: string | null): Promise<JournalReadResult>;
20
- clear?(): Promise<void>;
21
- }
22
- interface AsyncQueueStorage {
23
- enqueue<T>(body: T): Promise<QueueMessage<T>>;
24
- /** See QueueStorage.enqueueIfAbsent. Optional on adapters that cannot cheaply dedup. */
25
- enqueueIfAbsent?<T>(body: T, dedupKey: string): Promise<QueueMessage<T> | null>;
26
- lease<T>(opts?: {
27
- max?: number;
28
- visibilityMs?: number;
29
- }): Promise<QueueLeasedMessage<T>[]>;
30
- ack(messageId: string, leaseToken: string): Promise<boolean>;
31
- nack(messageId: string, leaseToken: string, opts?: {
32
- dead?: boolean;
33
- reason?: string;
34
- }): Promise<boolean>;
35
- peekActive<T>(prefix?: string): Promise<QueueMessage<T>[]>;
36
- peekDeadLetter<T>(prefix?: string): Promise<QueueDeadLetterMessage<T>[]>;
37
- }
38
- interface AsyncKVStorage {
39
- read(key: string): Promise<unknown | null>;
40
- write(key: string, value: unknown): Promise<void>;
41
- delete(key: string): Promise<void>;
42
- listKeys(prefix?: string): Promise<string[]>;
43
- }
44
- interface AsyncJSONStorage {
45
- read(key: string): Promise<unknown | null>;
46
- get(key: string, jsonPath: string): Promise<unknown | null>;
47
- write(key: string, value: unknown): Promise<void>;
48
- delete(key: string): Promise<void>;
49
- listKeys(prefix?: string): Promise<string[]>;
50
- shallowMerge(key: string, patch: Record<string, unknown>): Promise<void>;
51
- deepMerge(key: string, patch: Record<string, unknown>): Promise<void>;
52
- patch(key: string, jsonPath: string, value: unknown): Promise<void>;
53
- }
54
- interface AsyncScratchStorage extends AsyncBlobStorage {
55
- getUniqueKey(prefix?: string, suffix?: string): Promise<string>;
56
- create(data: string, prefix?: string, suffix?: string): Promise<string>;
57
- keyRef(key: string): Promise<KindValueRef> | KindValueRef;
58
- config: {
59
- get(k: string): Promise<unknown> | unknown;
60
- set(k: string, v: unknown): Promise<void> | void;
61
- };
62
- }
63
- interface AsyncArchiveFactory {
64
- stream(name: string): AsyncJournalStorage;
65
- blob(name: string): AsyncBlobStorage;
66
- listStreams(prefix?: string): Promise<string[]>;
67
- listBlobs(prefix?: string): Promise<string[]>;
68
- config: {
69
- get(k: string): Promise<unknown> | unknown;
70
- set(k: string, v: unknown): Promise<void> | void;
71
- };
72
- }
73
- interface AsyncStorageProvider {
74
- blob: AsyncBlobStorage;
75
- journal: AsyncJournalStorage;
76
- kv: AsyncKVStorage;
77
- }
78
- interface AsyncAtomicRelayLock {
79
- tryAcquire(): Promise<(() => Promise<void> | void) | null>;
80
- }
81
- declare function withAsyncRelayLock(lock: AsyncAtomicRelayLock, work: () => Promise<void>, continuation?: () => Promise<void> | void): Promise<boolean>;
82
-
83
- interface AsyncBoardWorkerRequest {
84
- boardId?: string;
85
- ref: ExecutionRef;
86
- args: Record<string, unknown>;
87
- }
88
- interface AsyncBoardWorkerQueuedRequest {
89
- messageId: string;
90
- enqueuedAt: string;
91
- attempt: number;
92
- request: AsyncBoardWorkerRequest;
93
- }
94
- interface AsyncBoardWorkerLeasedRequest extends AsyncBoardWorkerQueuedRequest {
95
- leaseToken: string;
96
- leaseExpiresAt: string;
97
- }
98
- interface AsyncBoardWorkerDeadLetterRequest extends AsyncBoardWorkerQueuedRequest {
99
- reason?: string;
100
- }
101
- interface AsyncBoardWorkerStore {
102
- enqueueRequest(request: AsyncBoardWorkerRequest): Promise<string>;
103
- leaseRequests(opts?: {
104
- max?: number;
105
- visibilityMs?: number;
106
- }): Promise<AsyncBoardWorkerLeasedRequest[]>;
107
- ackRequest(messageId: string, leaseToken: string): Promise<boolean>;
108
- nackRequest(messageId: string, leaseToken: string, opts?: {
109
- dead?: boolean;
110
- reason?: string;
111
- }): Promise<boolean>;
112
- peekActive(): Promise<AsyncBoardWorkerQueuedRequest[]>;
113
- peekDeadLetter(): Promise<AsyncBoardWorkerDeadLetterRequest[]>;
114
- }
115
- interface AsyncBoardConfigStore {
116
- readTaskExecutorRef(): Promise<ExecutionRef | undefined>;
117
- writeTaskExecutorRef(ref: ExecutionRef): Promise<void>;
118
- readChatHandlerFlow(): Promise<unknown>;
119
- writeChatHandlerFlow(flow: unknown): Promise<void>;
120
- readCardStoreRef(): Promise<string | null>;
121
- writeCardStoreRef(ref: string): Promise<void>;
122
- readOutputsStoreRef(): Promise<string | null>;
123
- writeOutputsStoreRef(ref: string): Promise<void>;
124
- readScratchStoreRef(): Promise<string | null>;
125
- writeScratchStoreRef(ref: string): Promise<void>;
126
- readArchiveStoreRef(): Promise<string | null>;
127
- writeArchiveStoreRef(ref: string): Promise<void>;
128
- readChatStoreRef(): Promise<string | null>;
129
- writeChatStoreRef(ref: string): Promise<void>;
130
- readArtifactsStoreRef(): Promise<string | null>;
131
- writeArtifactsStoreRef(ref: string): Promise<void>;
132
- }
133
- interface AsyncBoardPlatformAdapter {
134
- kvStorage(namespace: string): AsyncKVStorage;
135
- kvStorageForRef(ref: string): AsyncKVStorage;
136
- blobStorage(namespace: string): AsyncBlobStorage;
137
- scratchStorage(): AsyncScratchStorage;
138
- scratchStorageForRef(ref: string): AsyncScratchStorage;
139
- archiveFactory(): AsyncArchiveFactory;
140
- archiveFactoryForRef(ref: string): AsyncArchiveFactory;
141
- journalStorage(): AsyncJournalStorage;
142
- boardWorkerStore(): AsyncBoardWorkerStore;
143
- chatAgentStore(): AsyncBoardWorkerStore;
144
- processAccumulatedStore(): AsyncQueueStorage;
145
- lock: AsyncAtomicRelayLock;
146
- callbackTransport?: BoardCallbackTransport;
147
- dispatchExecution(ref: ExecutionRef, args: Record<string, unknown>): Promise<{
148
- dispatched: boolean;
149
- error?: string;
150
- }>;
151
- supportsDirectSourceOutput?(ref: ExecutionRef): boolean;
152
- resolveBlob(ref: KindValueRef): Promise<string>;
153
- hashFn(value: unknown): string;
154
- genId(): string;
155
- requestProcessAccumulated?(): void | Promise<void>;
156
- publishBoardChangeNotifications?(notifications: BoardChangeNotification[]): void | Promise<void>;
157
- warn?: (msg: string) => void;
158
- }
159
- interface HostedFetchResponseLike {
160
- ok: boolean;
161
- status: number;
162
- text(): Promise<string>;
163
- }
164
- interface HostedFetchLike {
165
- (input: string, init: {
166
- method: string;
167
- headers: Record<string, string>;
168
- body: string;
169
- }): Promise<HostedFetchResponseLike>;
170
- }
171
- interface HostedAsyncBoardPlatformAdapterOptions {
172
- boardId?: string;
173
- kvStorage(namespace: string): AsyncKVStorage;
174
- kvStorageForRef(ref: string): AsyncKVStorage;
175
- blobStorage(namespace: string): AsyncBlobStorage;
176
- scratchStorage(): AsyncScratchStorage;
177
- scratchStorageForRef(ref: string): AsyncScratchStorage;
178
- archiveFactory(): AsyncArchiveFactory;
179
- archiveFactoryForRef(ref: string): AsyncArchiveFactory;
180
- journalStorage(): AsyncJournalStorage;
181
- queueStorage?: AsyncQueueStorage;
182
- boardWorkerStore?: AsyncBoardWorkerStore;
183
- chatAgentQueueStorage?: AsyncQueueStorage;
184
- chatAgentStore?: AsyncBoardWorkerStore;
185
- processAccumulatedQueueStorage?: AsyncQueueStorage;
186
- processAccumulatedStore?: AsyncQueueStorage;
187
- lock: AsyncAtomicRelayLock;
188
- callbackTransport?: BoardCallbackTransport;
189
- fetch?: HostedFetchLike;
190
- dispatchExecution?: (ref: ExecutionRef, args: Record<string, unknown>) => Promise<{
191
- dispatched: boolean;
192
- error?: string;
193
- }>;
194
- supportsDirectSourceOutput?: (ref: ExecutionRef) => boolean;
195
- resolveBlob?: (ref: KindValueRef) => Promise<string>;
196
- hashFn: (value: unknown) => string;
197
- genId: () => string;
198
- requestProcessAccumulated?: () => void | Promise<void>;
199
- publishBoardChangeNotifications?: (notifications: BoardChangeNotification[]) => void | Promise<void>;
200
- onWarn?: (msg: string) => void;
201
- }
202
- declare function createAsyncBoardWorkerStore(queue: AsyncQueueStorage): AsyncBoardWorkerStore;
203
- declare function createAsyncBoardConfigStore(kv: AsyncKVStorage): AsyncBoardConfigStore;
204
- declare function createHostedAsyncBoardPlatformAdapter(options: HostedAsyncBoardPlatformAdapterOptions): AsyncBoardPlatformAdapter;
205
-
206
- interface AsyncBoardLiveCardsPublic {
207
- init(input: CommandInput): Promise<CommandResult>;
208
- status(input: CommandInput): Promise<CommandResult<BoardStatusObject>>;
209
- getCardStoreRef(input: CommandInput): Promise<CommandResult<{
210
- storeRef: string;
211
- }>>;
212
- getOutputsStoreRef(input: CommandInput): Promise<CommandResult<{
213
- storeRef: string;
214
- }>>;
215
- getScratchStoreRef(input: CommandInput): Promise<CommandResult<{
216
- storeRef: string | null;
217
- }>>;
218
- getArchiveStoreRef(input: CommandInput): Promise<CommandResult<{
219
- storeRef: string | null;
220
- }>>;
221
- getChatStoreRef(input: CommandInput): Promise<CommandResult<{
222
- storeRef: string | null;
223
- }>>;
224
- getArtifactsStoreRef(input: CommandInput): Promise<CommandResult<{
225
- storeRef: string | null;
226
- }>>;
227
- getConfig(input: CommandInput): Promise<CommandResult<{
228
- value: unknown;
229
- }>>;
230
- getOutputsDataObject(input: CommandInput): Promise<CommandResult>;
231
- getAllOutputsDataObjects(input: CommandInput): Promise<CommandResult<Record<string, unknown>>>;
232
- getOutputsComputedValues(input: CommandInput): Promise<CommandResult>;
233
- getAllOutputsComputedValues(input: CommandInput): Promise<CommandResult<Record<string, unknown>>>;
234
- getOutputsFetchedSources(input: CommandInput): Promise<CommandResult<Record<string, string>>>;
235
- getAllOutputsFetchedSources(input: CommandInput): Promise<CommandResult<Record<string, Record<string, string>>>>;
236
- addCardFiles(input: CommandInput): Promise<CommandResult<{
237
- cardId: string;
238
- files_added: Array<{
239
- idx: number;
240
- entry: unknown;
241
- }>;
242
- notified: true;
243
- }>>;
244
- cardRefreshedNotify(input: CommandInput): Promise<CommandResult>;
245
- removeCard(input: CommandInput): Promise<CommandResult>;
246
- retrigger(input: CommandInput): Promise<CommandResult>;
247
- upsertCard(input: CommandInput): Promise<CommandResult>;
248
- processAccumulatedEvents(input: CommandInput): Promise<CommandResult>;
249
- taskFailed(input: CommandInput): Promise<CommandResult>;
250
- taskProgress(input: CommandInput): Promise<CommandResult>;
251
- sourceDataFetched(input: CommandInput): Promise<CommandResult>;
252
- sourceDataFetchFailure(input: CommandInput): Promise<CommandResult>;
253
- }
254
- declare function createAsyncBoardLiveCardsPublic(baseRef: KindValueRef, adapter: AsyncBoardPlatformAdapter): AsyncBoardLiveCardsPublic;
255
-
256
- export { type AsyncBoardLiveCardsPublic as A, type HostedAsyncBoardPlatformAdapterOptions as H, type AsyncBoardPlatformAdapter as a, type AsyncJSONStorage as b, type AsyncKVStorage as c, type AsyncBlobStorage as d, type AsyncJournalStorage as e, type AsyncStorageProvider as f, type AsyncAtomicRelayLock as g, type AsyncQueueStorage as h, type AsyncBoardConfigStore as i, type AsyncBoardWorkerDeadLetterRequest as j, type AsyncBoardWorkerLeasedRequest as k, type AsyncBoardWorkerQueuedRequest as l, type AsyncBoardWorkerRequest as m, type AsyncBoardWorkerStore as n, type HostedFetchLike as o, type HostedFetchResponseLike as p, createAsyncBoardConfigStore as q, createAsyncBoardLiveCardsPublic as r, createAsyncBoardWorkerStore as s, createHostedAsyncBoardPlatformAdapter as t, withAsyncRelayLock as w };
@@ -1,2 +0,0 @@
1
- 'use strict';var chunkIXZG74EW_cjs=require('./chunk-IXZG74EW.cjs');function h(a,i){if(a?.status==="success")return Object.prototype.hasOwnProperty.call(a,"data")?a.data:void 0;throw a?.status==="fail"||a?.status==="error"?new Error(a.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function K(a,i){if(a?.status==="success"&&Object.prototype.hasOwnProperty.call(a,"data"))return a.data;throw a?.status==="success"?new Error(`${i} returned success without data`):a?.status==="fail"||a?.status==="error"?new Error(a.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function t(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function y(a){return Array.isArray(a)?a:[]}function V(a,i){if(typeof i!="string"||i.length===0)return;let u=a,m=i;m.startsWith("fetched_sources.")&&(u=t(a).fetched_sources,m=m.slice(16));for(let k of m.split(".")){if(u==null||typeof u!="object")return;u=u[k];}return u}function N(a,i){let u=t(a.view),m=y(u.elements);return {layout:u.layout,features:u.features,elements:m.map((k,x)=>{let v=t(k),I=t(v.data),B=typeof v.visible=="string"?!!V(i,v.visible):true,U=typeof I.bind=="string"?I.bind:void 0,M=typeof I.maxRows=="number"?I.maxRows:void 0,L=U?V(i,U):void 0,E={id:typeof v.id=="string"&&v.id?v.id:`element-${x}`,kind:v.kind,label:v.label,visible:B};return L!==void 0&&(E.resolved=Array.isArray(L)&&typeof M=="number"?L.slice(0,M):L),E})}}function W(a,i){let u=typeof a.id=="string"&&a.id?a.id:"card",m=y(a.provides),k=m.length>0?m:[{bindTo:u,ref:"card_data"}],x={};for(let v of k){let I=t(v),B=typeof I.bindTo=="string"?I.bindTo:"",U=typeof I.ref=="string"?I.ref:"";if(!B||!U)continue;let M=V(i,U);M!==void 0&&(x[B]=M);}return x}function ie(a){if(typeof a!="string"||!a.trim())return null;let i=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(a.trim());if(!i)return null;let u=Number.parseInt(i[2],10);return !Number.isInteger(u)||u<0?null:u}function ce(a){return {"card-content":a}}function F(a){let{meta:i,...u}=a;return u}function ue(a,i){return Object.prototype.hasOwnProperty.call(a,i)}function J(a){return t(a.meta).__visible_controlplane_only===true}async function T(a,i){let u=await S(a.get({params:{id:i}}),"cardStore.get"),m=Array.isArray(u?.cards)?u.cards:[];if(m.length===0)throw new Error(`Card "${i}" not found`);return m[0]}function me(a){let{board:i,nonCore:u,cardStore:m,chatStore:k,uploadCardFile:x,buildFileDownloadUrl:v,readFetchedSourceJsonByRef:I}=a;function B(r){if(Array.isArray(r.bytes))return new Uint8Array(r.bytes.map(e=>Math.max(0,Math.min(255,Number(e)||0))));if(typeof r.text=="string")return new TextEncoder().encode(r.text);if(typeof r.base64=="string"){let e=String(r.base64).replace(/-/g,"+").replace(/_/g,"/"),n=e+"=".repeat((4-e.length%4)%4),s=atob(n);return Uint8Array.from(s,o=>o.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}async function U(){let r=t(await S(u.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:r.version,commonSourceFields:t(r.commonSourceDefFields),sourceKinds:t(r.sourceKinds)}}async function M(){let r=t(await S(i.status({}),"status")),e=t(r.summary),n=y(r.cards);return {meta:t(r.meta),summary:{card_count:typeof e.card_count=="number"?e.card_count:0,completed:typeof e.completed=="number"?e.completed:0,eligible:typeof e.eligible=="number"?e.eligible:0,pending:typeof e.pending=="number"?e.pending:0,blocked:typeof e.blocked=="number"?e.blocked:0,in_progress:typeof e.in_progress=="number"?e.in_progress:0,failed:typeof e.failed=="number"?e.failed:0,unresolved:typeof e.unresolved=="number"?e.unresolved:0},cards:n.map(s=>{let o=t(s);return {"card-id":typeof o.name=="string"?o.name:null,status:o.status??null,error:o.error??null,requires:y(o.requires),requires_satisfied:y(o.requires_satisfied),requires_missing:y(o.requires_missing),provides_declared:y(o.provides_declared),provides_runtime:y(o.provides_runtime)}})}}async function L(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let n=t(await S(i.status({}),"status")),o=y(n.cards).map(t).find(p=>p.name===e);if(!o)throw new Error(`card "${e}" not found in board status`);let d=t(await T(m,e));if(J(d))throw Object.assign(new Error(`card "${e}" not found`),{statusCode:404});let f=F(d),c=y(o.requires_satisfied).filter(p=>typeof p=="string"&&!!p),g=y(o.provides_runtime).filter(p=>typeof p=="string"&&!!p),b=Object.fromEntries(await Promise.all(c.map(async p=>[p,await S(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),R=Object.fromEntries(await Promise.all(g.map(async p=>[p,await S(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),C=t(await S(i.getOutputsComputedValues({params:{key:e}}),"getOutputsComputedValues")),l=await S(i.getOutputsFetchedSources({params:{key:e}}),"getOutputsFetchedSources"),_=y(d.source_defs).map(t),w={};for(let p of _)typeof p.bindTo=="string"&&typeof p.outputFile=="string"&&(w[p.outputFile]=p.bindTo);let A={};for(let[p,j]of Object.entries(l)){let q=w[p]??p;if(!I||typeof j!="string"){A[q]=null;continue}try{A[q]=I({cardId:e,ref:j});}catch{A[q]=null;}}let P={card_data:t(d.card_data),requires:b,fetched_sources:A,computed_values:C};return {cardId:e,card_status_in_board:o,card_definition_and_static_data:f,refs_for_fetched_source_files:l,runtime_data:{requires:b,provides:R,computed_values:C,rendered_view:N(d,P)}}}async function E(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectChatMessagesOnCards requires cardId");let n=typeof r.turnId=="string"?r.turnId:"",s=r.allTurns===true,o=typeof r.tailTurnsBeforeId=="string"?r.tailTurnsBeforeId:"",d=s?void 0:r.lastUserTurns??(n?void 0:1),f=r.tail,c={...d===void 0?{}:{tailTurns:d},...n?{turnId:n}:{},...s?{allTurns:true}:{},...o?{tailTurnsBeforeId:o}:{}},g=Object.keys(c).length>0?{params:{cardId:e},body:c}:{params:{cardId:e}},b=h(k.readAll(g),"chatStore.readAll"),R=t(await T(m,e)),C=y(t(R.card_data).files).map((w,A)=>({idx:A,stored_name:t(w).stored_name})).filter(w=>typeof w.stored_name=="string"&&w.stored_name.length>0),_=(Array.isArray(b.records)?b.records:[]).map(w=>{let P=t(w.payload),p={...w},j=typeof w?.role=="string"?w.role:typeof P.role=="string"?String(P.role):"",q=typeof w?.text=="string"?w.text:typeof P.text=="string"?String(P.text):"";if(j==="system"){let $=ie(q);if($!==null&&C.some(O=>O.idx===$)){let O=`Retrieve using inspect-file-contents --card-id ${e} --file-idx ${$}`;p.retrieval_hint=O,Object.keys(P).length>0&&typeof w.role!="string"&&(p.payload={...P,retrieval_hint:O});}}return p});return {cardId:e,messages:typeof f=="number"&&f>=0?_.slice(-f):_}}async function H(r){let e=String(r.cardId||"").trim(),n=Number(r.fileIdx);if(!e)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(n)||n<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let s=t(await T(m,e)),o=y(t(s.card_data).files).map(t);if(n>=o.length)throw new Error(`attachment index ${n} is out of range for card "${e}"`);let d=o[n],f=typeof d.stored_name=="string"?d.stored_name:null;return {cardId:e,fileIdx:n,downloadUrl:v({cardId:e,fileIdx:n,storedName:f}),...typeof d.name=="string"?{name:d.name}:{},...typeof d.stored_name=="string"?{stored_name:d.stored_name}:{},...typeof d.mime_type=="string"?{mime_type:d.mime_type}:{},...typeof d.size=="number"?{size:d.size}:{},...typeof d.uploaded_at=="string"?{uploaded_at:d.uploaded_at}:{}}}async function D(r){return await u.validateCardPreflight({body:ce(r.candidateCardContent)})}function G(r){if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!r.mockFetchedSources||typeof r.mockFetchedSources!="object"||Array.isArray(r.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let e=u.evalCardCompute({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires,"mock-fetched-sources":r.mockFetchedSources}});if(e.status!=="success")return e;let n=t(K(e,"evalCardCompute")),s=t(r.candidateCardContent),o={card_data:t(s.card_data),requires:t(r.mockRequires),fetched_sources:t(r.mockFetchedSources),computed_values:t(n.computed_values)};return {status:"success",data:{cardId:typeof n.cardId=="string"?n.cardId:typeof s.id=="string"?s.id:"(unknown)",ok:n.ok===true,computed_values:t(n.computed_values),errors:y(n.errors).map(d=>{let f=t(d);return {bindTo:typeof f.bindTo=="string"?f.bindTo:"",error:typeof f.error=="string"?f.error:""}}),provides_outputs:W(s,o),rendered_view:N(s,o)}}}async function Q(r){return await u.probeSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function X(r){return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function Y(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let n=t(await T(m,e)),s=y(n.source_defs).filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)),o={};if(r.sourceIdx>=0&&r.sourceIdx<s.length){let d=s[r.sourceIdx],f=chunkIXZG74EW_cjs.a.enrichSourcesSync([d],{card_data:t(n.card_data),requires:r.mockRequires});Array.isArray(f)&&f.length>0&&(o=t(f[0]._projections));}return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":n,"mock-requires":r.mockRequires,"mock-projections":o}})}async function Z(r){let e=t(await S(u.simulateCardCycle({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires}}),"simulateCardCycle")),n=t(r.candidateCardContent),s=t(e.validation),o=y(e.source_probes),d=y(e.projection_errors),f=t(e.fetched_sources),c=y(e.compute_errors),g=t(e.computed_values),b={card_data:t(n.card_data),requires:r.mockRequires,fetched_sources:f,computed_values:g},R=[];for(let C of y(s.issues))typeof C=="string"&&C&&R.push(C);for(let C of o){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",w=typeof l.error=="string"?l.error:"";w&&R.push(`${_}: ${w}`);}for(let C of d){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",w=typeof l.key=="string"?l.key:"projection",A=typeof l.error=="string"?l.error:"projection failed";R.push(`${_}.${w}: ${A}`);}for(let C of c){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"compute",w=typeof l.error=="string"?l.error:"compute failed";R.push(`${_}: ${w}`);}return {status:"success",data:{cardId:typeof e.cardId=="string"?e.cardId:"(unknown)",ok:e.ok===true,issues:R,provides_outputs:W(n,b),rendered_view:N(n,b)}}}async function ee(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get"),s=Array.isArray(n.cards)?n.cards.map(t):[];if(s.some(J))throw Object.assign(new Error(`Card "${e}" not found`),{statusCode:404});return s.map(o=>F(o))}async function re(r){let e=String(r.cardId||"").trim(),n=String(r.role||"").trim(),s=typeof r.text=="string"?r.text:"",o=typeof r.turn=="string"?r.turn:"";if(!e)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!n)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(n==="assistant"&&o){let c=h(k.readAll({params:{cardId:e},body:{turnId:o}}),"chatStore.readAll(existing turn messages)"),g=Array.isArray(c.records)?c.records.find(b=>b.role==="assistant"&&String(b.turn||"")===o):void 0;if(g)return {status:"success",data:{cardId:e,id:String(g.id),role:n,turn:o,files:Array.isArray(g.files)?g.files:[]}}}let d=await Promise.all(y(r.files).map(async c=>{let g=t(c),b=String(g.file_name??g.fileName??g.name??"").trim(),R=String(g.content_type??g.contentType??"application/octet-stream");if(!b)throw new Error("file entry requires file_name");return (await x({cardId:e,fileName:b,contentType:R,bytes:B(g)})).file}));d.forEach((c,g)=>{let b=n==="assistant"?`AI generated: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`:`file uploaded: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`;h(k.append({params:{cardId:e},body:{role:"system",text:b,files:[],turn:o}}),"chatStore.append(system attachment message)");});let f=h(k.append({params:{cardId:e},body:{role:n,text:s,files:d,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:e,id:String(f.id),role:n,turn:o,files:d}}}async function te(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("manageUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),d=t(o),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let c=null;try{c=await T(m,e);}catch{c=null;}let g=c&&ue(t(c),"meta")?{...s,meta:t(c).meta}:s,b=await m.set({body:g});h(b,"cardStore.set");let R;try{R=await i.upsertCard({params:{cardId:e,restart:!0}}),h(R,"upsertCard");}catch(l){try{c&&await m.set({body:c});}catch{}throw l}let C=null;try{C=await i.cardRefreshedNotify({params:{cardId:e}}),h(C,"cardRefreshedNotify");}catch{C=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:R,refresh_notify:C}}}async function ne(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageRemoveCard requires cardId");let n=await i.removeCard({params:{id:e}});h(n,"removeCard");let s=await m.del({params:{id:e}});return h(s,"cardStore.del"),{status:"success",data:{board_result:n,store_result:s}}}async function ae(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("adminReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get");return Array.isArray(n.cards)?n.cards.map(s=>t(s)):[]}async function oe(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("adminUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),d=t(o),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let c=null;try{c=await T(m,e);}catch{c=null;}let g=c?t(t(c).meta):{},b={...s,meta:{...g,__visible_controlplane_only:true}},R=await m.set({body:b});h(R,"cardStore.set");let C;try{C=await i.upsertCard({params:{cardId:e,restart:!0}}),h(C,"upsertCard");}catch(_){try{c&&await m.set({body:c});}catch{}throw _}let l=null;try{l=await i.cardRefreshedNotify({params:{cardId:e}}),h(l,"cardRefreshedNotify");}catch{l=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:C,refresh_notify:l}}}function se(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("getChatProcessing requires cardId");let n=K(k.isProcessing({params:{cardId:e}}),"chatStore.isProcessing");return {cardId:e,active:!!n.active}}function de(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("setChatProcessing requires cardId");if(typeof r.active!="boolean")throw new Error("setChatProcessing requires boolean active");return h(k.setProcessing({params:{cardId:e},body:{active:r.active}}),"chatStore.setProcessing"),{cardId:e,active:r.active}}return {discoverSourceKinds:U,inspectBoardRuntimeStatus:M,inspectCardDefinitionAndRuntime:L,inspectChatMessagesOnCards:E,inspectFileContents:H,preflightValidateCandidateCardDefinition:D,preflightMaterializeCandidateCard:G,preflightProbeSingleSourceInCandidateCard:Q,preflightRunSingleSourceInCandidateCard:X,preflightRunSingleSourceInLiveCard:Y,preflightRunOneCycleWithCandidateCard:Z,manageReadCard:ee,manageAddChatEntryAndAnyAttachments:re,manageUpsertCard:te,manageRemoveCard:ne,adminReadCard:ae,adminUpsertCard:oe,getChatProcessing:se,setChatProcessing:de}}async function S(a,i){return h(await a,i)}exports.a=me;//# sourceMappingURL=chunk-GJJMEAVN.cjs.map
2
- //# sourceMappingURL=chunk-GJJMEAVN.cjs.map