yaml-flow 8.7.0 → 8.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/adapters/firestore-storage.js +2 -2
- package/browser/asset-integrity.json +7 -7
- package/browser/live-cards.schema.json +10 -1
- package/browser/server-runtime-controlface.js +4 -4
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board/server/board-server.js +1 -1
- package/examples/board/test/server-http-test.js +73 -79
- package/examples/board-firestore/server/worker.js +1 -1
- package/lib/artifacts-store-public.d.cts +1 -1
- package/lib/artifacts-store-public.d.ts +1 -1
- package/lib/board-live-cards-mcp.cjs +1 -1
- package/lib/board-live-cards-mcp.d.cts +2 -1
- package/lib/board-live-cards-mcp.d.ts +2 -1
- package/lib/board-live-cards-mcp.js +1 -1
- package/lib/board-live-cards-node.cjs +8 -8
- package/lib/board-live-cards-node.d.cts +9 -8
- package/lib/board-live-cards-node.d.ts +9 -8
- package/lib/board-live-cards-node.js +8 -8
- package/lib/{board-live-cards-public-D-DJek3X.d.ts → board-live-cards-public-JNRKfBZy.d.ts} +1 -1
- package/lib/{board-live-cards-public-DQzPe7A9.d.cts → board-live-cards-public-LlVUQPL2.d.cts} +1 -1
- package/lib/{board-live-cards-public-async-CgMCYYft.d.cts → board-live-cards-public-async-Di9QB141.d.cts} +2 -2
- package/lib/{board-live-cards-public-async-3hUuHxDx.d.ts → board-live-cards-public-async-fwd1QI82.d.ts} +2 -2
- package/lib/board-live-cards-public.cjs +1 -1
- package/lib/board-live-cards-public.d.cts +1 -1
- package/lib/board-live-cards-public.d.ts +1 -1
- package/lib/board-live-cards-public.js +1 -1
- package/lib/board-live-cards-server-runtime.cjs +1 -1
- package/lib/board-live-cards-server-runtime.d.cts +4 -4
- package/lib/board-live-cards-server-runtime.d.ts +4 -4
- package/lib/board-live-cards-server-runtime.js +1 -1
- package/lib/board-livegraph-runtime/index.cjs +1 -1
- package/lib/board-livegraph-runtime/index.js +1 -1
- package/lib/{board-platform-adapter-async-DOfEq_HC.d.cts → board-platform-adapter-async-BfHmHdx2.d.cts} +1 -1
- package/lib/{board-platform-adapter-async-JZPCzZnH.d.ts → board-platform-adapter-async-DYahVzIK.d.ts} +1 -1
- package/lib/card-compute/index.cjs +1 -1
- package/lib/card-compute/index.js +1 -1
- package/lib/card-store-public.d.cts +1 -1
- package/lib/card-store-public.d.ts +1 -1
- package/lib/card-validation.cjs +1 -1
- package/lib/card-validation.js +1 -1
- package/lib/chat-store-public.d.cts +1 -1
- package/lib/chat-store-public.d.ts +1 -1
- package/lib/chunk-3KC6LBOG.js +3 -0
- package/lib/chunk-76C7N4YT.js +3 -0
- package/lib/chunk-ASR44K7H.cjs +3 -0
- package/lib/chunk-EZENHAVZ.cjs +2 -0
- package/lib/chunk-FO4KNVU7.cjs +2 -0
- package/lib/chunk-HWYMZK3N.cjs +3 -0
- package/lib/{chunk-H5HBXPOI.cjs → chunk-J6EGN6S4.cjs} +3 -3
- package/lib/chunk-JH37NJGP.js +3 -0
- package/lib/chunk-JJL5VOQZ.cjs +3 -0
- package/lib/chunk-PBOQ4HYB.cjs +2 -0
- package/lib/{chunk-VMW4Z6EF.js → chunk-PRKRXAVN.js} +3 -3
- package/lib/chunk-QJVR3FWQ.js +2 -0
- package/lib/chunk-YBYXCFAI.js +2 -0
- package/lib/chunk-ZCNN6XPV.js +2 -0
- package/lib/cloud-storage.cjs +1 -1
- package/lib/cloud-storage.d.cts +3 -3
- package/lib/cloud-storage.d.ts +3 -3
- package/lib/cloud-storage.js +1 -1
- package/lib/continuous-event-graph/index.cjs +1 -1
- package/lib/continuous-event-graph/index.js +1 -1
- package/lib/firestore-storage/index.cjs +2 -2
- package/lib/firestore-storage/index.d.cts +17 -4
- package/lib/firestore-storage/index.d.ts +17 -4
- package/lib/firestore-storage/index.js +2 -2
- package/lib/index.cjs +2 -2
- package/lib/index.js +1 -1
- package/lib/localstorage-storage/index.cjs +1 -1
- package/lib/localstorage-storage/index.d.cts +2 -2
- package/lib/localstorage-storage/index.d.ts +2 -2
- package/lib/localstorage-storage/index.js +1 -1
- package/lib/server-jobs-queue-runner/index.d.cts +4 -4
- package/lib/server-jobs-queue-runner/index.d.ts +4 -4
- package/lib/server-runtime/index.cjs +1 -1
- package/lib/server-runtime/index.d.cts +5 -5
- package/lib/server-runtime/index.d.ts +5 -5
- package/lib/server-runtime/index.js +1 -1
- package/lib/server-runtime-agentface/index.d.cts +4 -4
- package/lib/server-runtime-agentface/index.d.ts +4 -4
- package/lib/server-runtime-controlface/index.cjs +1 -1
- package/lib/server-runtime-controlface/index.d.cts +16 -67
- package/lib/server-runtime-controlface/index.d.ts +16 -67
- package/lib/server-runtime-controlface/index.js +1 -1
- package/lib/server-runtime-core/index.cjs +1 -1
- package/lib/server-runtime-core/index.d.cts +8 -6
- package/lib/server-runtime-core/index.d.ts +8 -6
- package/lib/server-runtime-core/index.js +1 -1
- package/lib/server-runtime-watchers/index.d.cts +4 -4
- package/lib/server-runtime-watchers/index.d.ts +4 -4
- package/lib/server-runtime-webhooks/index.d.cts +4 -4
- package/lib/server-runtime-webhooks/index.d.ts +4 -4
- package/lib/{types-BzQY45dH.d.cts → types-Ba8H5_Wo.d.cts} +6 -4
- package/lib/{types-CF2xUcZW.d.ts → types-SO5OZm4s.d.ts} +6 -4
- package/package.json +1 -1
- package/schema/live-cards.schema.json +10 -1
- package/lib/chunk-DDYSXP2A.cjs +0 -3
- package/lib/chunk-J5J6BG7B.js +0 -2
- package/lib/chunk-M3OU6IS5.cjs +0 -2
- package/lib/chunk-M6STQR5F.cjs +0 -2
- package/lib/chunk-N6P2JW4W.js +0 -3
- package/lib/chunk-NMZ6XNLB.cjs +0 -3
- package/lib/chunk-OEFTOO47.cjs +0 -3
- package/lib/chunk-PRHQBGPT.js +0 -2
- package/lib/chunk-VLBB3D6B.js +0 -3
- package/lib/chunk-ZXQR7GHT.js +0 -3
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { d as BoardRuntimePlatformAdapter } from '../types-
|
|
2
|
-
export { A as Awaitable, B as BoardContextConfig, e as BoardRuntimePublic, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter,
|
|
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';
|
|
3
3
|
export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from '../server-jobs-queue-runner/index.cjs';
|
|
4
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';
|
|
5
5
|
import { createBoardLiveCardsMcp, BoardLiveCardsMcpBoardDeps, BoardLiveCardsMcpNonCoreDeps, BoardLiveCardsMcpCardStoreDeps, BoardLiveCardsMcp } from '../board-live-cards-mcp.cjs';
|
|
6
|
-
import { a as CommandResult } from '../board-live-cards-public-
|
|
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-
|
|
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
8
|
import { C as CardFileMetadataStore } from '../artifacts-store-lib-D9nMkVcE.cjs';
|
|
9
|
-
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-
|
|
9
|
+
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-BfHmHdx2.cjs';
|
|
10
10
|
import { ExecutionRef } from '../execution-refs.cjs';
|
|
11
|
-
export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-
|
|
11
|
+
export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-Di9QB141.cjs';
|
|
12
12
|
export { B as BlobStorage, K as KVStorage, a as KindValueRef } from '../storage-interface-BFiD3kyB.cjs';
|
|
13
13
|
export { C as ChatStorage } from '../chat-storage-lib-B9Q34Dyv.cjs';
|
|
14
14
|
import '../queue-lane-registry-PaZuFpwp.cjs';
|
|
@@ -156,6 +156,7 @@ interface McpFacadeDeps {
|
|
|
156
156
|
reportSourceFetchFailure: (token: string, reason: string) => Promise<CommandResult>;
|
|
157
157
|
uploadCardFile: (cardId: string, fileName: string, contentType: string, bytes: Uint8Array, opts?: {
|
|
158
158
|
inChat?: boolean;
|
|
159
|
+
suppressChatRecordWrite?: boolean;
|
|
159
160
|
}) => unknown | Promise<unknown>;
|
|
160
161
|
chatStorePublic: Parameters<typeof createBoardLiveCardsMcp>[0]['chatStore'];
|
|
161
162
|
serverUrl: string | null;
|
|
@@ -352,6 +353,7 @@ interface CardFileOps {
|
|
|
352
353
|
uploadCardFile: (cardId: string, requestedName: string, contentType: string, buffer: Uint8Array, opts?: {
|
|
353
354
|
inChat?: boolean;
|
|
354
355
|
turnId?: string;
|
|
356
|
+
suppressChatRecordWrite?: boolean;
|
|
355
357
|
}) => Promise<{
|
|
356
358
|
ok: true;
|
|
357
359
|
file: Record<string, unknown>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { d as BoardRuntimePlatformAdapter } from '../types-
|
|
2
|
-
export { A as Awaitable, B as BoardContextConfig, e as BoardRuntimePublic, C as ChatHandlerFlowRunner, D as DescribeEnvelope, H as HostedBoardQueueLaneTuning, I as InvocationAdapter,
|
|
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';
|
|
3
3
|
export { HostedBoardQueueLaneRegistryOptions, createHostedBoardQueueLaneRegistry } from '../server-jobs-queue-runner/index.js';
|
|
4
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';
|
|
5
5
|
import { createBoardLiveCardsMcp, BoardLiveCardsMcpBoardDeps, BoardLiveCardsMcpNonCoreDeps, BoardLiveCardsMcpCardStoreDeps, BoardLiveCardsMcp } from '../board-live-cards-mcp.js';
|
|
6
|
-
import { a as CommandResult } from '../board-live-cards-public-
|
|
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-
|
|
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
8
|
import { C as CardFileMetadataStore } from '../artifacts-store-lib-DSSMqVL2.js';
|
|
9
|
-
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-
|
|
9
|
+
import { A as AsyncBoardPlatformAdapter } from '../board-platform-adapter-async-DYahVzIK.js';
|
|
10
10
|
import { ExecutionRef } from '../execution-refs.js';
|
|
11
|
-
export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-
|
|
11
|
+
export { A as AsyncBoardLiveCardsPublic } from '../board-live-cards-public-async-fwd1QI82.js';
|
|
12
12
|
export { B as BlobStorage, K as KVStorage, a as KindValueRef } from '../storage-interface-BFiD3kyB.js';
|
|
13
13
|
export { C as ChatStorage } from '../chat-storage-lib-DB9iSai2.js';
|
|
14
14
|
import '../queue-lane-registry-PaZuFpwp.js';
|
|
@@ -156,6 +156,7 @@ interface McpFacadeDeps {
|
|
|
156
156
|
reportSourceFetchFailure: (token: string, reason: string) => Promise<CommandResult>;
|
|
157
157
|
uploadCardFile: (cardId: string, fileName: string, contentType: string, bytes: Uint8Array, opts?: {
|
|
158
158
|
inChat?: boolean;
|
|
159
|
+
suppressChatRecordWrite?: boolean;
|
|
159
160
|
}) => unknown | Promise<unknown>;
|
|
160
161
|
chatStorePublic: Parameters<typeof createBoardLiveCardsMcp>[0]['chatStore'];
|
|
161
162
|
serverUrl: string | null;
|
|
@@ -352,6 +353,7 @@ interface CardFileOps {
|
|
|
352
353
|
uploadCardFile: (cardId: string, requestedName: string, contentType: string, buffer: Uint8Array, opts?: {
|
|
353
354
|
inChat?: boolean;
|
|
354
355
|
turnId?: string;
|
|
356
|
+
suppressChatRecordWrite?: boolean;
|
|
355
357
|
}) => Promise<{
|
|
356
358
|
ok: true;
|
|
357
359
|
file: Record<string, unknown>;
|
|
@@ -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-
|
|
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
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as RuntimeResponse, f as RuntimeRequest } from '../types-Ba8H5_Wo.cjs';
|
|
2
2
|
import { C as ChatStorage } from '../chat-storage-lib-B9Q34Dyv.cjs';
|
|
3
3
|
import '../artifacts-store-lib-D9nMkVcE.cjs';
|
|
4
4
|
import '../storage-interface-BFiD3kyB.cjs';
|
|
5
|
-
import '../board-live-cards-public-
|
|
5
|
+
import '../board-live-cards-public-LlVUQPL2.cjs';
|
|
6
6
|
import '../execution-refs.cjs';
|
|
7
7
|
import '../types-BBhqYGhE.cjs';
|
|
8
|
-
import '../board-platform-adapter-async-
|
|
8
|
+
import '../board-platform-adapter-async-BfHmHdx2.cjs';
|
|
9
9
|
import '../storage-async-interface-BRR4eBjx.cjs';
|
|
10
|
-
import '../board-live-cards-public-async-
|
|
10
|
+
import '../board-live-cards-public-async-Di9QB141.cjs';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* server-runtime/sse-hub.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as RuntimeResponse, f as RuntimeRequest } from '../types-SO5OZm4s.js';
|
|
2
2
|
import { C as ChatStorage } from '../chat-storage-lib-DB9iSai2.js';
|
|
3
3
|
import '../artifacts-store-lib-DSSMqVL2.js';
|
|
4
4
|
import '../storage-interface-BFiD3kyB.js';
|
|
5
|
-
import '../board-live-cards-public-
|
|
5
|
+
import '../board-live-cards-public-JNRKfBZy.js';
|
|
6
6
|
import '../execution-refs.js';
|
|
7
7
|
import '../types-BBhqYGhE.js';
|
|
8
|
-
import '../board-platform-adapter-async-
|
|
8
|
+
import '../board-platform-adapter-async-DYahVzIK.js';
|
|
9
9
|
import '../storage-async-interface-DhlOVPSp.js';
|
|
10
|
-
import '../board-live-cards-public-async-
|
|
10
|
+
import '../board-live-cards-public-async-fwd1QI82.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* server-runtime/sse-hub.ts
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as RuntimeRequest, g as RuntimeResponse } from '../types-Ba8H5_Wo.cjs';
|
|
2
2
|
import { T as ToolRegistry } from '../mcp-tool-registries-W3TRj6O5.cjs';
|
|
3
3
|
import '../artifacts-store-lib-D9nMkVcE.cjs';
|
|
4
4
|
import '../storage-interface-BFiD3kyB.cjs';
|
|
5
|
-
import '../board-live-cards-public-
|
|
5
|
+
import '../board-live-cards-public-LlVUQPL2.cjs';
|
|
6
6
|
import '../execution-refs.cjs';
|
|
7
7
|
import '../types-BBhqYGhE.cjs';
|
|
8
|
-
import '../board-platform-adapter-async-
|
|
8
|
+
import '../board-platform-adapter-async-BfHmHdx2.cjs';
|
|
9
9
|
import '../storage-async-interface-BRR4eBjx.cjs';
|
|
10
|
-
import '../board-live-cards-public-async-
|
|
10
|
+
import '../board-live-cards-public-async-Di9QB141.cjs';
|
|
11
11
|
import '../chat-storage-lib-B9Q34Dyv.cjs';
|
|
12
12
|
import '../board-live-cards-mcp.cjs';
|
|
13
13
|
import '../chat-store-public.cjs';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as RuntimeRequest, g as RuntimeResponse } from '../types-SO5OZm4s.js';
|
|
2
2
|
import { T as ToolRegistry } from '../mcp-tool-registries-BBObLYga.js';
|
|
3
3
|
import '../artifacts-store-lib-DSSMqVL2.js';
|
|
4
4
|
import '../storage-interface-BFiD3kyB.js';
|
|
5
|
-
import '../board-live-cards-public-
|
|
5
|
+
import '../board-live-cards-public-JNRKfBZy.js';
|
|
6
6
|
import '../execution-refs.js';
|
|
7
7
|
import '../types-BBhqYGhE.js';
|
|
8
|
-
import '../board-platform-adapter-async-
|
|
8
|
+
import '../board-platform-adapter-async-DYahVzIK.js';
|
|
9
9
|
import '../storage-async-interface-DhlOVPSp.js';
|
|
10
|
-
import '../board-live-cards-public-async-
|
|
10
|
+
import '../board-live-cards-public-async-fwd1QI82.js';
|
|
11
11
|
import '../chat-storage-lib-DB9iSai2.js';
|
|
12
12
|
import '../board-live-cards-mcp.js';
|
|
13
13
|
import '../chat-store-public.js';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { a as ArtifactsStore } from './artifacts-store-lib-D9nMkVcE.cjs';
|
|
2
|
-
import { e as BoardPlatformAdapter, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult, f as BoardWorkerRequest } from './board-live-cards-public-
|
|
3
|
-
import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-
|
|
4
|
-
import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-
|
|
2
|
+
import { e as BoardPlatformAdapter, g as BoardLiveCardsNonCorePublic, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult, f as BoardWorkerRequest } from './board-live-cards-public-LlVUQPL2.cjs';
|
|
3
|
+
import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-BfHmHdx2.cjs';
|
|
4
|
+
import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-Di9QB141.cjs';
|
|
5
5
|
import { ExecutionRef } from './execution-refs.cjs';
|
|
6
6
|
import { a as KindValueRef } from './storage-interface-BFiD3kyB.cjs';
|
|
7
7
|
import { C as ChatStorage } from './chat-storage-lib-B9Q34Dyv.cjs';
|
|
8
8
|
|
|
9
|
+
type BoardRuntimeNonCorePublic = Pick<BoardLiveCardsNonCorePublic, 'describeTaskExecutorCapabilities' | 'validateCardPreflight' | 'evalCardCompute' | 'probeSourcePreflight' | 'runSourcePreflight' | 'simulateCardCycle'>;
|
|
9
10
|
type Awaitable<T> = T | Promise<T>;
|
|
10
11
|
type BoardRuntimePlatformAdapter = BoardPlatformAdapter | AsyncBoardPlatformAdapter;
|
|
11
12
|
type BoardRuntimePublic = BoardLiveCardsPublic | AsyncBoardLiveCardsPublic;
|
|
@@ -80,6 +81,7 @@ interface HostedBoardQueueLaneTuning {
|
|
|
80
81
|
interface BoardContextConfig {
|
|
81
82
|
label: string;
|
|
82
83
|
boardAdapter: BoardRuntimePlatformAdapter;
|
|
84
|
+
nonCore?: BoardRuntimeNonCorePublic;
|
|
83
85
|
nonCoreAdapter?: BoardNonCorePlatformAdapter;
|
|
84
86
|
/** Optional separate adapter for file/chat blob storage (defaults to boardAdapter) */
|
|
85
87
|
artifactsAdapter?: BoardRuntimePlatformAdapter;
|
|
@@ -209,4 +211,4 @@ interface RuntimeResponse {
|
|
|
209
211
|
end(data?: string | Buffer): void;
|
|
210
212
|
}
|
|
211
213
|
|
|
212
|
-
export type { Awaitable as A, BoardContextConfig as B, ChatHandlerFlowRunner as C, DescribeEnvelope as D, HostedBoardQueueLaneTuning as H, InvocationAdapter as I,
|
|
214
|
+
export type { Awaitable as A, BoardContextConfig as B, ChatHandlerFlowRunner as C, DescribeEnvelope as D, HostedBoardQueueLaneTuning as H, InvocationAdapter as I, MultiBoardRuntimeOptions as M, NotificationTransport as N, QueueLaneRuntimeTuning as Q, RuntimeLogger as R, SingleBoardRuntimeOptions as S, MultiBoardRuntime as a, SingleBoardRuntime as b, BoardRuntimeNonCorePublic as c, BoardRuntimePlatformAdapter as d, BoardRuntimePublic as e, RuntimeRequest as f, RuntimeResponse as g };
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { a as ArtifactsStore } from './artifacts-store-lib-DSSMqVL2.js';
|
|
2
|
-
import { e as BoardPlatformAdapter, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult, f as BoardWorkerRequest } from './board-live-cards-public-
|
|
3
|
-
import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-
|
|
4
|
-
import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-
|
|
2
|
+
import { e as BoardPlatformAdapter, g as BoardLiveCardsNonCorePublic, d as BoardNonCorePlatformAdapter, c as BoardLiveCardsPublic, a as CommandResult, f as BoardWorkerRequest } from './board-live-cards-public-JNRKfBZy.js';
|
|
3
|
+
import { A as AsyncBoardPlatformAdapter } from './board-platform-adapter-async-DYahVzIK.js';
|
|
4
|
+
import { A as AsyncBoardLiveCardsPublic } from './board-live-cards-public-async-fwd1QI82.js';
|
|
5
5
|
import { ExecutionRef } from './execution-refs.js';
|
|
6
6
|
import { a as KindValueRef } from './storage-interface-BFiD3kyB.js';
|
|
7
7
|
import { C as ChatStorage } from './chat-storage-lib-DB9iSai2.js';
|
|
8
8
|
|
|
9
|
+
type BoardRuntimeNonCorePublic = Pick<BoardLiveCardsNonCorePublic, 'describeTaskExecutorCapabilities' | 'validateCardPreflight' | 'evalCardCompute' | 'probeSourcePreflight' | 'runSourcePreflight' | 'simulateCardCycle'>;
|
|
9
10
|
type Awaitable<T> = T | Promise<T>;
|
|
10
11
|
type BoardRuntimePlatformAdapter = BoardPlatformAdapter | AsyncBoardPlatformAdapter;
|
|
11
12
|
type BoardRuntimePublic = BoardLiveCardsPublic | AsyncBoardLiveCardsPublic;
|
|
@@ -80,6 +81,7 @@ interface HostedBoardQueueLaneTuning {
|
|
|
80
81
|
interface BoardContextConfig {
|
|
81
82
|
label: string;
|
|
82
83
|
boardAdapter: BoardRuntimePlatformAdapter;
|
|
84
|
+
nonCore?: BoardRuntimeNonCorePublic;
|
|
83
85
|
nonCoreAdapter?: BoardNonCorePlatformAdapter;
|
|
84
86
|
/** Optional separate adapter for file/chat blob storage (defaults to boardAdapter) */
|
|
85
87
|
artifactsAdapter?: BoardRuntimePlatformAdapter;
|
|
@@ -209,4 +211,4 @@ interface RuntimeResponse {
|
|
|
209
211
|
end(data?: string | Buffer): void;
|
|
210
212
|
}
|
|
211
213
|
|
|
212
|
-
export type { Awaitable as A, BoardContextConfig as B, ChatHandlerFlowRunner as C, DescribeEnvelope as D, HostedBoardQueueLaneTuning as H, InvocationAdapter as I,
|
|
214
|
+
export type { Awaitable as A, BoardContextConfig as B, ChatHandlerFlowRunner as C, DescribeEnvelope as D, HostedBoardQueueLaneTuning as H, InvocationAdapter as I, MultiBoardRuntimeOptions as M, NotificationTransport as N, QueueLaneRuntimeTuning as Q, RuntimeLogger as R, SingleBoardRuntimeOptions as S, MultiBoardRuntime as a, SingleBoardRuntime as b, BoardRuntimeNonCorePublic as c, BoardRuntimePlatformAdapter as d, BoardRuntimePublic as e, RuntimeRequest as f, RuntimeResponse as g };
|
package/package.json
CHANGED
|
@@ -145,7 +145,13 @@
|
|
|
145
145
|
"type": "string"
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
}
|
|
148
|
+
},
|
|
149
|
+
"additionalProperties": true
|
|
150
|
+
},
|
|
151
|
+
"__private": {
|
|
152
|
+
"description": "Control-plane-owned private state. Stripped entirely from all regular /mcp read responses. Writable only via 'setstate.card-private' and 'manage.admin-upsert-card'. Agents must never author this field. Keys inside use plain names (no leading underscores).",
|
|
153
|
+
"type": "object",
|
|
154
|
+
"additionalProperties": true
|
|
149
155
|
},
|
|
150
156
|
"requires": {
|
|
151
157
|
"type": "array",
|
|
@@ -506,6 +512,9 @@
|
|
|
506
512
|
"meta": {
|
|
507
513
|
"$ref": "#/definitions/meta"
|
|
508
514
|
},
|
|
515
|
+
"__private": {
|
|
516
|
+
"$ref": "#/definitions/__private"
|
|
517
|
+
},
|
|
509
518
|
"view": {
|
|
510
519
|
"$ref": "#/definitions/view"
|
|
511
520
|
},
|
package/lib/chunk-DDYSXP2A.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkM3OU6IS5_cjs=require('./chunk-M3OU6IS5.cjs'),chunk7FGPOGRV_cjs=require('./chunk-7FGPOGRV.cjs'),chunk7ICPAABP_cjs=require('./chunk-7ICPAABP.cjs'),chunkKAWQPLIE_cjs=require('./chunk-KAWQPLIE.cjs'),chunkNM6O35RY_cjs=require('./chunk-NM6O35RY.cjs'),chunk272IYUKT_cjs=require('./chunk-272IYUKT.cjs'),chunkNJJ7WEDT_cjs=require('./chunk-NJJ7WEDT.cjs'),chunkH5HBXPOI_cjs=require('./chunk-H5HBXPOI.cjs'),chunkOEFTOO47_cjs=require('./chunk-OEFTOO47.cjs'),chunkYMEIPKLW_cjs=require('./chunk-YMEIPKLW.cjs'),chunkGYQXDNNI_cjs=require('./chunk-GYQXDNNI.cjs');function te(S){let{apiBasePath:v,json:h,readJsonBody:Z,readRawBody:V,initBoardAndSetup:N,bootstrapBoard:$,buildPublishedRuntimePayload:K,createMcpControlplaneToolRegistry:Q,readCardFromStore:tt,patchCard:nt,retriggerCard:U,applyCardAction:ot,resolveChatHandlerTarget:it,createMcpFacade:ct,chatStorePublic:dt,uploadCardFile:m,sendCardFileDownloadResponse:C}=S;async function I(d,u,q){let x=d.method||"GET",O=q,P=O.pathname;try{if(x==="GET"&&P===`${v}/init-board`)return await N(),h(u,200,await K()),!0;if(x==="GET"&&P===`${v}/board-status`)return h(u,200,await K()),!0;if(x==="POST"&&P===`${v}/mcp-controlplane`){await $();let f=await Z(d),c=typeof f.tool=="string"?f.tool.trim():"",j=f.args&&typeof f.args=="object"&&!Array.isArray(f.args)?f.args:{};if(!c)return h(u,400,{error:"tool is required"}),!0;try{let l=await chunk272IYUKT_cjs.a(c,j,Q());if(l&&typeof l=="object"&&!Array.isArray(l)){let k=l;if(k.status==="fail")return h(u,400,{error:chunk272IYUKT_cjs.b(l,"Request failed")}),!0;if(k.status==="error")return h(u,500,{error:chunk272IYUKT_cjs.b(l,"Internal error")}),!0}h(u,200,l);}catch(l){let k=typeof l?.statusCode=="number"?Number(l.statusCode):500,L=l instanceof Error?l.message:String(l);h(u,k,{error:L});}return !0}let D=P.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(v)}/cards/([^/]+)$`));if(x==="GET"&&D){await $();let f=decodeURIComponent(D[1]),c=await tt(f);return c?(h(u,200,c),!0):(h(u,404,{error:`card not found: ${f}`}),!0)}if(x==="PATCH"&&D){await $();let f=decodeURIComponent(D[1]),c=await Z(d);return await nt(f,c),h(u,200,{ok:!0}),!0}let et=P.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(v)}/cards/([^/]+)/retrigger$`));if(x==="POST"&&et){await $();let f=decodeURIComponent(et[1]);return await U(f),h(u,200,{ok:!0}),!0}let rt=P.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(v)}/cards/([^/]+)/actions$`));if(x==="POST"&&rt){await $();let f=decodeURIComponent(rt[1]),c=Date.now(),j=new Date(c).toISOString(),l=await Z(d),k=l?.actionType;if(k==="chat-send"&&!await it(f)){let T=Date.now();return h(u,409,{error:`chat handler is not configured for card: ${f}`,requestReceivedAt:j,requestReceivedAtMs:c,responseSentAt:new Date(T).toISOString(),responseSentAtMs:T,responseStatus:409}),!0}if(k==="chat-send"){let T=l?.payload??{},W=typeof T["turn-id"]=="string"?T["turn-id"]:typeof T.turnId=="string"?T.turnId:typeof T.turn=="string"?T.turn:"";if(!W||!String(W).trim()){let ut=Date.now();return h(u,400,{error:`chat-send requires a non-empty 'turn-id' (or 'turnId'/'turn') in payload for card: ${f}`,requestReceivedAt:j,requestReceivedAtMs:c,responseSentAt:new Date(ut).toISOString(),responseSentAtMs:ut,responseStatus:400}),!0}}await ot(f,k,l?.payload);let L=Date.now();return h(u,200,{ok:!0,requestReceivedAt:j,requestReceivedAtMs:c,responseSentAt:new Date(L).toISOString(),responseSentAtMs:L,responseStatus:200}),!0}let M=P.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(v)}/cards/([^/]+)/chats$`));if(x==="GET"&&M){await $();let f=decodeURIComponent(M[1]),c=String(O.searchParams.get("turn-id")||""),j=String(O.searchParams.get("all-turns")||"").toLowerCase()==="true",l=String(O.searchParams.get("tail-turns-before-id")||""),k=O.searchParams.get("tail-turns"),L=k==null||k===""?j||c?void 0:1:Number.parseInt(k,10),T=dt.readAll({params:{cardId:f},body:{...L===void 0?{}:{tailTurns:L},...c?{turnId:c}:{},...j?{allTurns:!0}:{},...l?{tailTurnsBeforeId:l}:{}}});if(T.status!=="success")return h(u,400,{error:T.error||"Failed to read chats"}),!0;let W=T.data.records;return h(u,200,{ok:!0,messages:W}),!0}if(x==="POST"&&M){await $();let f=decodeURIComponent(M[1]),c=await Z(d),j=typeof c?.role=="string"?c.role:"assistant",l=typeof c?.text=="string"?c.text:"",k=Array.isArray(c?.files)?c.files:[],L=typeof c?.turn=="string"?c.turn:typeof c?.["turn-id"]=="string"?c["turn-id"]:typeof c?.turnId=="string"?c.turnId:"",T=c?.done===!0,W=ct(),G=(await W.manageAddChatEntryAndAnyAttachments({cardId:f,role:j,text:l,files:k,turn:L})).data.id;return T&&W.setChatProcessing({cardId:f,active:!1}),h(u,200,{ok:!0,id:G}),!0}let X=P.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(v)}/cards/([^/]+)/files$`));if(x==="POST"&&X){await $();let f=decodeURIComponent(X[1]),c=String(O.searchParams.get("inChat")||"").toLowerCase()==="true",j=String(O.searchParams.get("turn-id")||"").trim();if(c&&!j)return h(u,400,{error:`file upload with inChat=true requires a non-empty 'turn-id' query parameter for card: ${f}`}),!0;let l=d.headers["x-file-name"],k=String(d.headers["content-type"]||"application/octet-stream"),L=Array.isArray(l)?l[0]:l,T=L?decodeURIComponent(String(L)):"upload.bin",W=await V(d);return h(u,200,await m(f,T,k,W,{inChat:c,turnId:j})),!0}let z=P.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(v)}/cards/([^/]+)/files/(\\d+)$`));if(x==="GET"&&z){let f=decodeURIComponent(z[1]),c=parseInt(z[2],10),j=O.searchParams.get("sn");return await C(u,f,c,j),!0}return !1}catch(D){let et=D?.statusCode||500;return h(u,et,{error:String(D?.message||D)}),true}}return {handleRuntimeApi:I}}var re={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Headers":"content-type,x-file-name","Access-Control-Allow-Methods":"GET,POST,PATCH,OPTIONS"},ee="chat-handler-flow-queue";function or(S){let v=String(S.apiBasePath||"/api/board").replace(/\/$/,""),h={...re,...S.corsHeaders||{}},Z=S.queueLaneTuning??{},V=S.boardId||"",N=S.logger||{info:console.log,warn:console.warn,error:console.error},$=S.invocationAdapter,K=S.chatFlowRunner||null,Q=S.chatStorage??chunkNJJ7WEDT_cjs.b(),tt=chunkGYQXDNNI_cjs.a(Q),nt=S.notificationTransport||null,U=S.serverUrl||null,ot=S.executionExtra||{},it=S.onSseClientConnected,ct=S.onSseClientDisconnected,dt=S.onChannelSubscribed,m=S.onChannelUnsubscribed,C=chunk7ICPAABP_cjs.a({chatStorage:Q,readChatRecords:t=>bt(t),onSseClientDisconnected:ct});function I(t){function e(o){if(Array.isArray(o))return o;if(o&&typeof o=="object"){let i=o;return Array.isArray(i.files)?i.files:[o]}return null}function r(o){return {async get(i){return o.get(i)},async set(i){return o.set(i)},async del(i){return o.del(i)},async patch(i){return o.patch(i)},async appendFiles(i){return o.appendFiles(i)}}}function a(o){function i(b){return {status:"success",data:b}}function g(b){return {status:"fail",error:b}}function p(b){return {status:"error",error:b instanceof Error?b.message:String(b)}}return {async get(b){try{let R=b.params?.id;if(R){let E=await o.readCard(R);return E?i({cards:[E]}):g(`card "${R}" not found`)}return i({cards:await o.readAllCards()})}catch(R){return p(R)}},async set(b){try{let R=b.body;if(R==null)return g("set requires a body (card object or array of cards)");let E=Array.isArray(R)?R:[R];for(let _ of E){if(typeof _.id!="string")return g("each card must have a string `id` field");await o.writeCard(_.id,_);}return i({count:E.length})}catch(R){return p(R)}},async del(b){try{let R=b.body?.ids??[],E=b.params?.id,_=E?[...R,E]:R;if(_.length===0)return g("del requires body.ids (string[]) or params.id");for(let st of _)await o.removeCard(st);return i({count:_.length})}catch(R){return p(R)}},async patch(b){try{let R=b.params?.id,E=b.params?.path;if(!R)return g("patch requires params.id");if(!E)return g("patch requires params.path");let _=b.body,st=_&&Object.prototype.hasOwnProperty.call(_,"value")?_.value:b.body;return await o.patchCard(R,E,st),i({count:1})}catch(R){return p(R)}},async appendFiles(b){try{let R=b.params?.id;if(!R)return g("appendFiles requires params.id");let E=await o.readCard(R);if(!E)return g(`card "${R}" not found`);let _=e(b.body);if(!_||_.length===0)return g("appendFiles requires a file metadata object, array, or body.files array");let st=E.card_data&&typeof E.card_data=="object"&&!Array.isArray(E.card_data)?E.card_data:{},Bt=Array.isArray(st.files)?st.files:[],Fe=[...Bt,..._];return await o.patchCard(R,"card_data.files",Fe),i({files_added:_.map((Oe,Te)=>({idx:Bt.length+Te,entry:Oe}))})}catch(R){return p(R)}}}}let n=chunkKAWQPLIE_cjs.a(t.boardAdapter)?chunkH5HBXPOI_cjs.j(t.baseRef,t.boardAdapter):chunkOEFTOO47_cjs.y(t.baseRef,t.boardAdapter),s=t.nonCoreAdapter??(!chunkKAWQPLIE_cjs.a(t.boardAdapter)&&x(t.boardAdapter)?t.boardAdapter:null),y=s?chunkOEFTOO47_cjs.z(t.baseRef,s):null,B,w=chunkKAWQPLIE_cjs.a(t.boardAdapter)?(()=>{let o=chunkH5HBXPOI_cjs.d(chunkH5HBXPOI_cjs.c(chunkH5HBXPOI_cjs.b(t.boardAdapter.kvStorageForRef(t.cardStoreRef)),t.boardAdapter.hashFn),N.warn),i=a(o);return B={get(g){return i.get(g)},set(g){return i.set(g)}},i})():(()=>{let o=t.boardAdapter.kvStorageForRef(t.cardStoreRef),g=chunkYMEIPKLW_cjs.a(chunkOEFTOO47_cjs.l({readIndex:()=>o.read("_index"),writeIndex:p=>o.write("_index",p),readCard:p=>o.read(p),writeCard:(p,b)=>(o.write(p,b),p),removeCard:p=>{o.delete(p);},cardExists:p=>o.read(p)!==null,defaultCardKey:p=>p},N.warn));return B=g,r(g)})(),F=t.artifactsAdapter||t.boardAdapter,A=t.filesArtifactsStore??null,H=A?{putBytes(o,i,g){A.putBytes(o,i,g);},getBytes(o){return A.getBytes(o)},listKeys(o){return A.list(o).map(i=>i.key)}}:null;if(!H&&!chunkKAWQPLIE_cjs.a(F)){let o=t.artifactsAdapter?F.blobStorage(""):F.blobStorage("files"),i=chunkNJJ7WEDT_cjs.c(o);H={putBytes(g,p,b){i.putBytes(g,p,b);},getBytes(g){return i.getBytes(g)},listKeys(g){return i.list(g).map(p=>p.key)}};}else if(!H&&chunkKAWQPLIE_cjs.a(F)){let o=t.artifactsAdapter?F.blobStorage(""):F.blobStorage("files");H={async putBytes(i,g){if(o.writeBytes){await o.writeBytes(i,g);return}let p=JSON.stringify({__kind:"bytes-array",data:[...g]});await o.write(i,p);},async getBytes(i){if(o.readBytes){let p=await o.readBytes(i);if(p!==null)return p}let g=await o.read(i);if(g===null)return null;try{let p=JSON.parse(g);if(p&&p.__kind==="bytes-array"&&Array.isArray(p.data))return new Uint8Array(p.data)}catch{}return new TextEncoder().encode(g)},async listKeys(i){return await o.listKeys(i)}};}let J={async init(o){return n.init(o)},async status(o){return n.status(o)},async getConfig(o){return n.getConfig(o)},async getAllOutputsDataObjects(o){return n.getAllOutputsDataObjects(o)},async getAllOutputsComputedValues(o){return n.getAllOutputsComputedValues(o)},async getOutputsFetchedSources(o){return n.getOutputsFetchedSources(o)},async upsertCard(o){return n.upsertCard(o)},async removeCard(o){return n.removeCard(o)},async cardRefreshedNotify(o){return n.cardRefreshedNotify(o)},async sourceDataFetched(o){return n.sourceDataFetched(o)},async sourceDataFetchFailure(o){return n.sourceDataFetchFailure(o)}};return {label:t.label,board:n,nonCore:y,publicCardStore:B,boardOps:J,cardStoreOps:w,get filesArtifacts(){return H},boardAdapter:t.boardAdapter,cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef,artifactsStoreRef:t.artifactsStoreRef,chatStoreRef:t.chatStoreRef,scratchStoreRef:t.scratchStoreRef,archiveStoreRef:t.archiveStoreRef,notifyRef:t.notifyRef,taskExecutorRef:t.taskExecutorRef,chatHandlerRef:t.chatHandlerRef,chatHandlerFlow:t.chatHandlerFlow,inferenceAdapterRef:t.inferenceAdapterRef,notification:chunkM3OU6IS5_cjs.a(),notificationTeardown:null,initialized:false,cardsBootstrapped:false}}let d=S.boards.map(I),u=new Map;function q(t){return u.get(t)??0}function x(t){let e=t;return typeof e.invokeExecutor=="function"&&typeof e.validateSchema=="function"}function O(t){let e=d[q(t)];return {files:e?e.filesArtifacts:null}}function P(){return chunkNJJ7WEDT_cjs.e()}function D(t){return String(t||"").replace(/[^a-zA-Z0-9_-]/g,"_")||"unknown-card"}async function et(t){if(!t||t.notificationTeardown||!nt||!t.notifyRef)return;let e=await nt.subscribe(t.notifyRef,r=>{chunkM3OU6IS5_cjs.c(t.notification,r);let a=r.kind==="notification-batch"?r.notifications:[r];C.broadcastNotificationBatch(a);});t.notificationTeardown=e;}async function rt(t){if(!t||t.initialized)return;let e={cardStoreRef:t.cardStoreRef,outputsStoreRef:t.outputsStoreRef};t.artifactsStoreRef&&(e.artifactsStoreRef=t.artifactsStoreRef),t.chatStoreRef&&(e.chatStoreRef=t.chatStoreRef),t.scratchStoreRef&&(e.scratchStoreRef=t.scratchStoreRef),t.archiveStoreRef&&(e.archiveStoreRef=t.archiveStoreRef);let r={};t.taskExecutorRef&&(r["task-executor-ref"]=t.taskExecutorRef),t.chatHandlerFlow!==void 0&&(r["chat-handler-flow"]=t.chatHandlerFlow),t.inferenceAdapterRef&&(r["inference-adapter-ref"]=t.inferenceAdapterRef);let a=await t.boardOps.init({params:e,body:r});if(a.status!=="success")throw Object.assign(new Error(a.error||`init failed for ${t.label}`),{statusCode:500});if(await et(t),!t.chatHandlerFlow&&t.chatHandlerRef&&$.describe)try{let n=await $.describe(t.chatHandlerRef);n&&n.kind!=="chat-handler"?N.warn(`[init] chat-handler describe returned kind="${n.kind}", expected "chat-handler" for ${t.label}`):n&&N.info(`[init] chat-handler validated: ${n.name} (protocol ${n.protocolVersion}) for ${t.label}`);}catch(n){N.warn(`[init] chat-handler describe failed for ${t.label}: ${n?.message||String(n)}`);}t.initialized=true;}async function M(t){if(!t.boardAdapter.publishBoardChangeNotifications)return;let e=[],r=await t.boardOps.status({});r.status==="success"&&r.data!=null&&chunkM3OU6IS5_cjs.b(r.data)&&e.push({kind:"status",status:r.data});let a=await t.boardOps.getAllOutputsDataObjects({});if(a.status==="success"&&a.data!=null)for(let[s,y]of Object.entries(a.data))s&&e.push({kind:"data_object",key:s,payload:y});let n=await t.boardOps.getAllOutputsComputedValues({});if(n.status==="success"&&n.data!=null)for(let[s,y]of Object.entries(n.data))s&&e.push({kind:"computed_values",cardId:s,values:y});e.length>0&&t.boardAdapter.publishBoardChangeNotifications(e);}async function X(t,e){if(!t||t.cardsBootstrapped)return;let r=await t.cardStoreOps.get({}),a=r.status==="success"&&Array.isArray(r.data?.cards)?r.data.cards:[];for(let n of a)typeof n.id=="string"&&(u.set(n.id,e),await t.boardOps.upsertCard({params:{cardId:n.id}}));t.cardsBootstrapped=true;}async function z(){for(let t of d)await rt(t);}async function f(){await z();for(let t=0;t<d.length;t++)await M(d[t]),await X(d[t],t),await M(d[t]);}async function c(t=false){t||await z();for(let e of d){let r=await e.board.processAccumulatedEvents({});if(r.status!=="success")return r}return {status:"success"}}async function j(){return await z(),c(true)}function l(t){return d[q(t)]??null}async function k(t){let e=l(t);if(!e)return null;let r=await e.cardStoreOps.get({params:{id:t}});if(r.status!=="success")return null;let a=Array.isArray(r.data?.cards)?r.data.cards:[];return a.length>0?a[0]:null}async function L(){let t=async r=>{if(!r)return [];let a=await r.cardStoreOps.get({});return a.status!=="success"||!Array.isArray(a.data?.cards)?[]:a.data.cards},e=[];for(let r of d)e.push(...await t(r));return e}function T(){return d[0]??null}let W=chunkM3OU6IS5_cjs.n({boardContexts:d,cardOwnerIndex:u,cardContextForCard:t=>l(t),readStatusSnapshot:()=>ie(),readDataObjectsByToken:()=>de(),readCardRuntimeArtifacts:()=>ce(),readCardFromStore:t=>k(t),readCardDefinitions:()=>L(),processAccumulatedLaneInternal:t=>c(t),reportSourceFetched:(t,e)=>St(t,{ref:e}),reportSourceFetchFailure:(t,e)=>kt(t,{reason:e}),uploadCardFile:(t,e,r,a,n)=>Rt(t,e,r,a,n),chatStorePublic:tt,serverUrl:U,apiBasePath:v}),ut=W.mcpCardStoreFacade,G=W.createMcpFacade,ne=chunkM3OU6IS5_cjs.h({boardId:V,getMcpFacade:()=>G(),getMcpCardStoreFacade:()=>ut()});function ae(t){return chunkM3OU6IS5_cjs.k(t)}function oe(){return chunkM3OU6IS5_cjs.l(G())}function se(){return chunkM3OU6IS5_cjs.m({boardId:V,uploadCardFile:Rt,getMcpFacade:()=>G(),controlplane:ne})}let lt=chunkM3OU6IS5_cjs.i({boardId:V,boardContexts:d,readCardDefinitions:()=>L(),readChatRecords:t=>bt(t),getChatProcessing:t=>G().getChatProcessing({cardId:t}).active}),ie=lt.readStatusSnapshot,ce=lt.readCardRuntimeArtifacts,de=lt.readDataObjectsByToken,gt=lt.buildPublishedRuntimePayload;async function yt(t,e,r){let a=r?.syncBoard!==false,n=r?.restartOnlyIfChanged===true,s=l(t);if(!s)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let y=await k(t);if(!y)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let B=n?JSON.stringify(y):null,w=e(y)||y;if(n&&JSON.stringify(w)===B)return;let F=await s.cardStoreOps.set({body:w});if(F.status!=="success")throw Object.assign(new Error(F.error||`Failed to persist card: ${t}`),{statusCode:500});if(a){let A=await s.boardOps.upsertCard({params:{cardId:t,restart:true}});if(A.status!=="success")throw Object.assign(new Error(A.error||`Failed to upsert card: ${t}`),{statusCode:500})}}async function ue(t,e){await yt(t,e,{syncBoard:true});}async function ht(t,e){await yt(t,e,{syncBoard:false});}async function le(t){let e=l(t);if(!e)throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});if(!await k(t))throw Object.assign(new Error(`Card not found: ${t}`),{statusCode:404});let a=await e.boardOps.upsertCard({params:{cardId:t,restart:true}});if(a.status!=="success")throw Object.assign(new Error(a.error||`Failed to retrigger card: ${t}`),{statusCode:500})}async function fe(t,e){await yt(t,r=>{if(!e||typeof e!="object"||Object.keys(e).length===0)return r;function a(n,s,y){let B=String(s||"").split(".").filter(Boolean);if(!B.length)return;let w=n;for(let F=0;F<B.length-1;F++){let A=B[F];(!w[A]||typeof w[A]!="object")&&(w[A]={}),w=w[A];}w[B[B.length-1]]=y;}if(e.fieldValues!==void 0&&e.fieldValues!==null){let n=null,s=r.view;if(s&&Array.isArray(s.elements)){for(let y of s.elements)if(y?.data&&y.data.writeTo){n=y.data.writeTo;break}}n?a(r,n,e.fieldValues):typeof e.fieldValues=="object"&&!Array.isArray(e.fieldValues)&&(r.card_data={...r.card_data||{},...e.fieldValues});}else {if(Array.isArray(e._stagedFiles)&&e._stagedFiles.length>0)return r;for(let[n,s]of Object.entries(e))n!=="_stagedFiles"&&(s!==null&&typeof s=="object"&&!Array.isArray(s)&&r[n]!==null&&typeof r[n]=="object"&&!Array.isArray(r[n])?r[n]={...r[n],...s}:r[n]=s);}return r},{syncBoard:true,restartOnlyIfChanged:true});}function pe(t){Q.clear(t);try{G().setChatProcessing({cardId:t,active:!1});}catch{}}function me(t,e,r,a,n=""){let s=typeof r=="string"?r.trim():"";return Q.append(t,e||"system",s,a,n)}function bt(t){return Q.readAll(t)}let Rt=chunkM3OU6IS5_cjs.j({safeCardId:t=>D(t),artifactsStores:t=>O(t),cardFileMetadataStore:()=>P(),readCardFromStore:t=>k(t),updateCardLocalOnly:(t,e)=>ht(t,e),writeChatRecord:(t,e,r,a,n)=>me(t,e,r,a,n)}).uploadCardFile;async function Ct(t){let e=l(t);if(!e)return null;let r=await e.boardOps.getConfig({params:{key:"chat-handler-flow"}}),a=r.status==="success"?r.data?.value:null,n=e.chatHandlerRef;return a==null&&(!n||typeof n!="object")?null:{ctx:e,handlerFlow:a,handlerRef:n}}async function ge(t,e,r=false,a=""){let n=await Ct(t);if(!n)return;let{ctx:s,handlerFlow:y,handlerRef:B}=n;if(!r)try{G().setChatProcessing({cardId:t,active:!0});}catch{}let w={boardId:V,cardId:String(t),lastChatEntryId:e,...a?{turnId:a}:{},...ot,...U?{serverUrl:U}:{}},F=y!=null?{meta:"chat-handler-flow",howToRun:"built-in",whatToRun:{kind:"built-in",value:ee}}:B;try{chunkKAWQPLIE_cjs.a(s.boardAdapter)?await s.boardAdapter.chatAgentStore().enqueueRequest({boardId:V,ref:F,args:y!=null?{...w,__chatHandlerFlow:y}:w}):s.boardAdapter.chatAgentStore().enqueueRequest({boardId:V,ref:F,args:y!=null?{...w,__chatHandlerFlow:y}:w}),await Promise.resolve(s.boardAdapter.requestProcessAccumulated?.());}catch(A){try{G().setChatProcessing({cardId:t,active:!1});}catch{}N.warn(`[chat-handler] queue failed for card "${t}": ${A instanceof Error?A.message:String(A)}`);}}async function ye(t,e,r){if(e.howToRun==="built-in"&&chunkKAWQPLIE_cjs.b(e)===ee){let a=K,n=r.__chatHandlerFlow,s={...r};return delete s.__chatHandlerFlow,a?a.run(n,s,{boardId:V,cardId:String(s.cardId||""),label:t.label,logger:N,serverUrl:U,executionExtra:ot}):{dispatched:false,error:"chat-handler-flow configured but no chatFlowRunner was provided"}}return $.invoke(e,r)}async function Re(t,e=false){e||await z();let r=typeof t.args?.cardId=="string"?t.args.cardId:"",a=r?l(r):T();if(!a)throw new Error(r?`Board context is unavailable for chat-agent request: ${r}`:"Board context is unavailable for chat-agent request");let n=await ye(a,t.ref,t.args);if(!n.dispatched){if(r)try{Q.setProcessing(r,!1);}catch{}throw new Error(n.error||`chat-agent dispatch failed for card "${r||"unknown"}"`)}}async function we(t,e,r){let a=e==="chat-send"?ht:ue,n;await a(t,s=>{let y=new Date().toISOString(),B=s.card_data&&typeof s.card_data=="object"?s.card_data:{};if(s.card_data=B,e==="chat-send"){let w=r&&typeof r.text=="string"?r.text.trim():"",F=r&&typeof r["turn-id"]=="string"?r["turn-id"]:r&&typeof r.turnId=="string"?r.turnId:r&&typeof r.turn=="string"?r.turn:"",A=[];if(Array.isArray(r?.files)){for(let H of r.files)if(H){if(typeof H=="string"){A.push({name:H});continue}if(typeof H=="object"){let J=H;typeof J.name=="string"&&A.push({name:J.name,size:J.size,mime_type:J.mime_type,uploaded_at:J.uploaded_at,stored_name:J.stored_name,chat:J.chat===true});}}}if(w||A.length>0){let H=tt.runBatch({cardId:t,commands:[{command:"append",role:"user",text:w,files:A,turn:F},{command:"set-processing",active:true}]});if(H.status!=="success")throw new Error(H.error);let J=H.data.results[0]?.data?.id;if(typeof J!="string"||!J)throw new Error(`chat-send did not return an append id for card ${t}`);n={cardId:t,lastEntryId:J,processingAlreadySet:true,turnId:F};try{C.broadcastCardChats(t);}catch{}}return s}if(e==="file-upload"){let w=P().normalizeIncoming(r?.files,y);return w.length>0&&P().merge(B,w),s}if(e==="action"){let w=r&&typeof r.buttonId=="string"?r.buttonId:"";if(!w)return s;B.lastAction={buttonId:w,at:y},B.lastActionText=`${w} @ ${y}`;}return s}),n&&ge(n.cardId,n.lastEntryId,n.processingAlreadySet,n.turnId??"");}function ft(t,e,r){let a=JSON.stringify(r),n=typeof Buffer<"u"?Buffer.byteLength(a):new TextEncoder().encode(a).length;t.writeHead(e,{...h,"Content-Type":"application/json; charset=utf-8","Content-Length":n}),t.end(a);}async function At(t,e,r){let a=await k(t);if(!a)throw Object.assign(new Error("Card not found"),{statusCode:404});let n=P().resolve(a.card_data,e,r);if(!n.ok&&n.reason==="stale_reference")throw Object.assign(new Error("File reference is stale. Refresh and try again."),{statusCode:409});if(!n.ok)throw Object.assign(new Error("File not found"),{statusCode:404});let s=n.file,y=D(t),B=O(t),w=String(s.stored_name||""),F=`${y}/${w}`,A=B.files?await B.files.getBytes(F):null;if(!A)throw Object.assign(new Error("File not found"),{statusCode:404});return {fileRecord:s,bytes:A}}async function he(t,e,r,a){let{fileRecord:n,bytes:s}=await At(e,r,a),y=String(n.name||n.stored_name||"download.bin"),B=String(n.mime_type||"application/octet-stream");t.writeHead(200,{"Content-Type":B,"Content-Disposition":`attachment; filename="${y}"`,"Content-Length":s.length}),t.end(s);}function be(t){let e=String(t||"").toLowerCase();return e.startsWith("text/")||e.includes("json")||e.includes("xml")||e.includes("javascript")||e.includes("typescript")||e.includes("yaml")||e.includes("csv")}function Ce(t,e,r){let a=t.split(/\r?\n/);return (e==="head"?a.slice(0,r):a.slice(-r)).join(`
|
|
2
|
-
`)}async function pt(t){let e=[];for await(let a of t)e.push(a);let r=typeof Buffer<"u"?Buffer.concat(e).toString("utf-8").trim():new TextDecoder().decode(chunkKAWQPLIE_cjs.d(e)).trim();return r?JSON.parse(r):{}}async function Ae(t){let e=[];for await(let r of t)e.push(r);return typeof Buffer<"u"?Buffer.concat(e):chunkKAWQPLIE_cjs.d(e)}async function St(t,e){let r=typeof e.ref=="string"?e.ref.trim():"";if(!r)return {status:"fail",error:"board-worker success callback requires body.ref"};let a=d[0];return a?a.boardOps.sourceDataFetched({params:{token:t,ref:r}}):{status:"fail",error:"no board context"}}async function kt(t,e){let r=typeof e.reason=="string"&&e.reason.trim()?e.reason:"unknown",a=d[0];return a?a.boardOps.sourceDataFetchFailure({params:{token:t,reason:r}}):{status:"fail",error:"no board context"}}let Se=chunk7ICPAABP_cjs.b({sseHub:C,corsHeaders:h,json:ft,buildPublishedRuntimePayload:()=>gt(),onSseClientConnected:it,onChannelSubscribed:dt,onChannelUnsubscribed:m,apiBasePath:v,readJsonBody:t=>pt(t),initBoardAndSetup:()=>z(),bootstrapBoard:()=>f(),boardContexts:d,publishPersistedStateSnapshot:t=>M(t),upsertCardsFromSource:(t,e)=>X(t,e)}).handleWatchersRoutes,ke=chunk7FGPOGRV_cjs.a({apiBasePath:v,json:ft,readJsonBody:t=>pt(t),bootstrapBoard:()=>f(),createMcpFacade:()=>G(),createMcpToolRegistry:t=>ae(t),resolveCardFileDownloadPayload:(t,e,r)=>At(t,e,r),isLikelyTextMimeType:t=>be(t),sliceTextByLines:(t,e,r)=>Ce(t,e,r)}).handleAgentfaceApi,Be=chunkNM6O35RY_cjs.a({apiBasePath:v,json:ft,readJsonBody:t=>pt(t),initBoardAndSetup:()=>z(),createMcpWebhookToolRegistry:()=>oe()}).handleWebhooksApi,ve=te({apiBasePath:v,json:ft,readJsonBody:t=>pt(t),readRawBody:t=>Ae(t),initBoardAndSetup:()=>z(),bootstrapBoard:()=>f(),buildPublishedRuntimePayload:()=>gt(),createMcpControlplaneToolRegistry:()=>se(),readCardFromStore:t=>k(t),patchCard:(t,e)=>fe(t,e),retriggerCard:t=>le(t),applyCardAction:(t,e,r)=>we(t,e,r),resolveChatHandlerTarget:t=>Ct(t),createMcpFacade:()=>G(),chatStorePublic:tt,uploadCardFile:(t,e,r,a,n)=>Rt(t,e,r,a,n),sendCardFileDownloadResponse:(t,e,r,a)=>he(t,e,r,a)}).handleRuntimeApi;async function Pe(t,e,r){return !!(await ke(t,e,r)||await Be(t,e,r)||await Se(t,e,r)||await ve(t,e,r))}return {get apiBasePath(){return v},get corsHeaders(){return h},get queueLaneTuning(){return Z},handleRuntimeApi:Pe,buildPublishedRuntimePayload:gt,processAccumulatedEvents:j,processAccumulatedLane:c,handleChatAgentRequest:Re,clearChatRecords:pe,reportSourceFetched(t,e){return St(t,{ref:e})},reportSourceFetchFailure(t,e){return kt(t,{reason:e})},get cardStore(){return d[0]?.publicCardStore??{get(){return Promise.resolve({status:"fail",error:"no board context"})},set(){return Promise.resolve({status:"fail",error:"no board context"})}}}}}function sr(S){let v=String(S.apiBasePath||"/api/boards").replace(/\/$/,""),h={...re,...S.corsHeaders||{}},Z=S.serverMetaStore,V=S.boardRuntimeFactory,N=new Map,$="boards-config.json";function K(){let m=Z.getText($);if(!m)return {boards:[{id:"default",label:"Default Board"}]};try{return JSON.parse(m)}catch{return {boards:[{id:"default",label:"Default Board"}]}}}function Q(m){Z.putText($,JSON.stringify(m,null,2));}function tt(m){let C=String(m||"").replace(/[^a-zA-Z0-9_-]/g,"_").replace(/^_+|_+$/g,"");return C.length>0&&C.length<=64?C:null}function nt(m){if(N.has(m))return N.get(m);let I=K().boards.find(u=>u.id===m)||{},d=V(m,I);return N.set(m,d),d}function U(m,C,I){let d=JSON.stringify(I),u=typeof Buffer<"u"?Buffer.byteLength(d):new TextEncoder().encode(d).length;m.writeHead(C,{...h,"Content-Type":"application/json; charset=utf-8","Content-Length":u}),m.end(d);}async function ot(m,C,I){let d=m.method||"GET",u=I.pathname;if(d==="GET"&&u===v)return U(C,200,{ok:true,boards:K().boards}),true;if(d==="POST"&&u===v){let q=[];for await(let M of m)q.push(M);let x=typeof Buffer<"u"?Buffer.concat(q).toString("utf-8").trim():new TextDecoder().decode(chunkKAWQPLIE_cjs.d(q)).trim(),O={};try{O=x?JSON.parse(x):{};}catch{O={};}let P=tt(O.id);if(!P)return U(C,400,{error:"board id must be 1-64 alphanumeric/dash/underscore characters"}),true;let D=K();if(D.boards.some(M=>M.id===P))return U(C,409,{error:`Board "${P}" is already registered`}),true;let et=typeof O.label=="string"&&O.label.trim()?O.label.trim():P,rt={id:P,label:et};for(let[M,X]of Object.entries(O))M==="id"||M==="label"||X!=null&&(rt[M]=X);return D.boards.push(rt),Q(D),U(C,200,{ok:true,board:rt}),true}return false}async function it(m,C,I){let u=I.pathname.match(new RegExp(`^${chunkKAWQPLIE_cjs.c(v)}/([^/]+)(/|$)`));if(!u)return false;let q=tt(decodeURIComponent(u[1]));return q?K().boards.some(P=>P.id===q)?!!await nt(q).handleRuntimeApi(m,C,I):(U(C,404,{error:`Board "${q}" not registered. POST ${v} with {id} to register it first.`}),true):(U(C,400,{error:"Invalid board id"}),true)}async function ct(m,C,I){return !!(await ot(m,C,I)||await it(m,C,I))}function dt(m){if(!K().boards.some(I=>I.id===m))throw Object.assign(new Error(`Board "${m}" not registered`),{statusCode:404});return {service:nt(m)}}return {get apiBasePath(){return v},get corsHeaders(){return h},handleApi:ct,requireBoardService:dt}}exports.a=te;exports.b=or;exports.c=sr;//# sourceMappingURL=chunk-DDYSXP2A.cjs.map
|
|
3
|
-
//# sourceMappingURL=chunk-DDYSXP2A.cjs.map
|
package/lib/chunk-J5J6BG7B.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a,c,d,e,b,f}from'./chunk-O7NOHKVR.js';import {a as a$1}from'./chunk-SGV7PU4H.js';import {b as b$1}from'./chunk-BQS3EIEK.js';import {a as a$2}from'./chunk-PRHQBGPT.js';function K(){return {status:null,computedValues:{},dataObjects:{},cards:{}}}function V(n){if(!n||typeof n!="object")return false;let e=n.summary;return !e||typeof e!="object"?false:Number(e.card_count||0)>0}function z(n,e){if(!e||typeof e!="object")return;let a=e;if(a.kind==="notification-batch"&&Array.isArray(a.notifications)){for(let l of a.notifications)z(n,l);return}a.kind==="status"&&V(a.status)&&(n.status=a.status),a.kind==="computed_values"&&a.cardId&&(n.computedValues[a.cardId]=a.values),a.kind==="data_object"&&a.key&&(n.dataObjects[a.key]=a.payload),a.kind==="card_refreshed"&&a.cardId&&(n.cards[a.cardId]=a.card),a.kind==="card_removed"&&a.cardId&&(delete n.cards[a.cardId],delete n.computedValues[a.cardId]);}function B(n,e){if(n?.status==="success")return Object.prototype.hasOwnProperty.call(n,"data")?n.data:void 0;throw n?.status==="fail"||n?.status==="error"?Object.assign(new Error(n.error||`${e} failed`),{statusCode:400}):Object.assign(new Error(`${e} returned an unexpected response`),{statusCode:500})}async function j(n,e){return B(await n,e)}function D(n){let e=a(n,"key");if(!e)throw Object.assign(new Error("MCP tool requires key"),{statusCode:400});let a$1=e.split(".");if(!(a$1.length>=2&&a$1[0]==="chat"&&a$1.every(w=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(w))))throw Object.assign(new Error("MCP tool only supports card meta keys under chat.*"),{statusCode:400});return e}function q(n,e){let a=n.meta;for(let l of e.split(".")){if(!a||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,l))return {exists:false,value:null};a=a[l];}return {exists:true,value:a}}function Q(n){let{boardId:e,getMcpFacade:a$1,getMcpCardStoreFacade:l}=n;function w(p){let o=a(p,"board_id"),c=a(p,"card_id");if(!o)throw Object.assign(new Error("MCP tool requires board_id"),{statusCode:400});if(!c)throw Object.assign(new Error("MCP tool requires card_id"),{statusCode:400});if(o!==e)throw Object.assign(new Error(`Unknown board_id: ${o}`),{statusCode:400});return {cardId:c}}function _(p,o){let{cardId:c}=w(p);return a$1().setChatProcessing({cardId:c,active:o}),{status:"success",data:{boardId:e,cardId:c,active:o}}}function R(p){let{cardId:o}=w(p),c=a$1().getChatProcessing({cardId:o});return {status:"success",data:{boardId:e,cardId:o,active:c.active}}}async function t(p){let{cardId:o}=w(p),c=D(p);if(!Object.prototype.hasOwnProperty.call(p,"value"))throw Object.assign(new Error("MCP tool requires value"),{statusCode:400});if(c.split(".").includes("__visible_controlplane_only")){let i=await j(l().get({params:{id:o}}),"cardStore.get"),g=Array.isArray(i.cards)&&i.cards.length>0&&typeof i.cards[0]=="object"&&!Array.isArray(i.cards[0])?i.cards[0]:null,h=g?q(g,"__visible_controlplane_only").value:void 0;if(p.value!==h)throw Object.assign(new Error("MCP tool cannot change the reserved meta flag __visible_controlplane_only"),{statusCode:403});return {status:"success",data:{boardId:e,cardId:o,key:c}}}return B(await l().patch({params:{id:o,path:`meta.${c}`},body:{value:p.value}}),"cardStore.patch"),{status:"success",data:{boardId:e,cardId:o,key:c}}}async function C(p){let{cardId:o}=w(p),c=D(p),i=await j(l().get({params:{id:o}}),"cardStore.get"),g=Array.isArray(i.cards)&&i.cards.length>0&&i.cards[0]&&typeof i.cards[0]=="object"&&!Array.isArray(i.cards[0])?i.cards[0]:null;if(!g)throw Object.assign(new Error(`Card "${o}" not found`),{statusCode:404});let h=q(g,c);return {status:"success",data:{boardId:e,cardId:o,key:c,exists:h.exists,value:h.value}}}return {requireCardArgs:w,setChatProcessing:_,getChatProcessing:R,setCardMeta:t,getCardMeta:C}}function ee(n){let{boardId:e,boardContexts:a,readCardDefinitions:l,readChatRecords:w,getChatProcessing:_}=n;async function R(){let o=(await Promise.all(a.map(async y=>{try{let u=y.boardAdapter.kvStorageForRef(y.outputsStoreRef),m=await Promise.resolve(u.read("status"));if(m!=null)return m}catch{}return y.notification.status}))).filter(Boolean);if(o.length===0)return null;if(o.length===1)return o[0];let c=[],i=["completed","eligible","pending","blocked","unresolved","failed","in_progress","orphan_cards"],g={};for(let y of i)g[y]=0;for(let y of o){let u=y,m=Array.isArray(u.cards)?u.cards:[];c.push(...m);for(let k of i)g[k]+=Number(u?.summary?.[k]||0);}let h=o[0];return {...h,cards:c,summary:{...h.summary||{},card_count:c.length,...g}}}async function t(){let o={},c=async i=>{try{let g=await i.boardOps.getAllOutputsComputedValues({});if(g.status==="success"&&g.data&&typeof g.data=="object"){for(let[h,y]of Object.entries(g.data)){let u=i.notification.cards[h];o[h]={schema_version:"v1",card_id:h,card_data:u?.card_data??{},computed_values:y??{}};}return}}catch{}for(let[g,h]of Object.entries(i.notification.computedValues)){let y=i.notification.cards[g];o[g]={schema_version:"v1",card_id:g,card_data:y?.card_data??{},computed_values:h??{}};}};for(let i of a)await c(i);return o}async function C(){let o={};for(let c of a){try{let i=await c.boardOps.getAllOutputsDataObjects({});if(i.status==="success"&&i.data&&typeof i.data=="object"){Object.assign(o,i.data);continue}}catch{}Object.assign(o,c.notification.dataObjects||{});}return o}async function p(){let o=await l(),c=await t(),i=await C(),g={};for(let y of o){if(!y?.id)continue;let u=y.id,m=c[u]||{},k={...m.card_data&&typeof m.card_data=="object"?m.card_data:y.card_data&&typeof y.card_data=="object"?y.card_data:{}};g[u]={schema_version:m.schema_version||"v1",card_id:m.card_id||u,card_data:k,computed_values:m.computed_values&&typeof m.computed_values=="object"?m.computed_values:{}};}let h={};for(let y of o){if(!y?.id)continue;let u=y.id;try{let m=w(u),k=_(u);(m.length>0||k)&&(h[u]={messages:m.map(v=>({role:String(v.role||"system"),text:String(v.text||""),files:Array.isArray(v.files)?v.files:[]})),receiving:!1,processing:k});}catch{}}return {boardId:e,cardDefinitions:o,statusSnapshot:await R(),dataObjectsByToken:i,cardRuntimeById:g,cardChatsByCardId:h}}return {readStatusSnapshot:R,readCardRuntimeArtifacts:t,readDataObjectsByToken:C,buildPublishedRuntimePayload:p}}function H(n){let e=String(n||"").trim();if(!e)return "upload.bin";let a=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return (a>=0?e.slice(a+1):e)||"upload.bin"}function re(n){let{safeCardId:e,artifactsStores:a,cardFileMetadataStore:l,readCardFromStore:w,updateCardLocalOnly:_,writeChatRecord:R}=n;async function t(o){let c=[];try{let i=await w(o);if(!i)return c;let g=l().read(i.card_data&&typeof i.card_data=="object"?i.card_data:null);for(let h of g)c.push(String(h.stored_name??""));}catch{}return c}async function C(o,c,i,g){let h=e(o),y=a(o),u=H(c),m=await t(o),v=`${String(m.length+1).padStart(3,"0")}-${u}`.slice(-36);return y.files&&await y.files.putBytes(`${h}/${v}`,new Uint8Array(g),i||"application/octet-stream"),{name:u,stored_name:v,size:g.length,mime_type:i||"application/octet-stream",uploaded_at:new Date().toISOString()}}async function p(o,c,i,g,h){if(!g.length)throw Object.assign(new Error("Empty upload body"),{statusCode:400});let y=h?.inChat===true,u=await C(o,c,i,g),m=null;if(await _(o,k=>{let v=new Date().toISOString(),A=k.card_data&&typeof k.card_data=="object"?k.card_data:{};k.card_data=A;let s=l().normalizeIncoming([{name:u.name,stored_name:u.stored_name,size:u.size,mime_type:u.mime_type,uploaded_at:u.uploaded_at||v,chat:y}],v);return m=l().merge(A,s).findIndex(d=>d.stored_name===u.stored_name),k}),y){let k=typeof m=="number"&&m>=0?` #${m}`:"";R(o,"system",`file uploaded: ${u.name} as ${u.stored_name}${k}`,[],h?.turnId??"");}return {ok:true,file:{...u,...typeof m=="number"&&m>=0?{file_idx:m}:{},chat:y},...typeof m=="number"&&m>=0?{file_idx:m}:{}}}return {uploadCardFile:p,readCardStoredFileNames:t}}function oe(n){return {"discover.source-kinds":()=>n.discoverSourceKinds(),"inspect.board-runtime-status":()=>n.inspectBoardRuntimeStatus(),"inspect.card-definition-and-runtime":e=>n.inspectCardDefinitionAndRuntime({cardId:a(e,"card_id")}),"inspect.chat-messages-on-cards":e=>{let a$1=b(e,"tail_turns"),l=b(e,"tail"),w=a(e,"turn_id"),_=e.all_turns===true,R=a(e,"tail_turns_before_id");return n.inspectChatMessagesOnCards({cardId:a(e,"card_id"),...a$1!==void 0?{lastUserTurns:a$1}:{},...l!==void 0?{tail:l}:{},...w?{turnId:w}:{},..._?{allTurns:true}:{},...R?{tailTurnsBeforeId:R}:{}})},"inspect.file-contents":e=>n.inspectFileContents({cardId:a(e,"card_id"),fileIdx:Number(b(e,"file_idx"))}),"preflight.validate-candidate-card-definition":e=>n.preflightValidateCandidateCardDefinition({candidateCardContent:d(e,"candidate_card_content","candidate_card_content")}),"preflight.materialize-candidate-card":e=>n.preflightMaterializeCandidateCard({candidateCardContent:d(e,"candidate_card_content","candidate_card_content"),mockRequires:d(e,"mock_requires","mock_requires"),mockFetchedSources:d(e,"mock_fetched_sources","mock_fetched_sources")}),"preflight.probe-single-source-in-candidate-card":e$1=>n.preflightProbeSingleSourceInCandidateCard({candidateCardContent:d(e$1,"candidate_card_content","candidate_card_content"),mockProjections:c(e$1,"mock_projections"),sourceIdx:e(e$1,"source_idx","source_idx")}),"preflight.run-single-source-in-candidate-card":e$1=>n.preflightRunSingleSourceInCandidateCard({candidateCardContent:d(e$1,"candidate_card_content","candidate_card_content"),mockProjections:c(e$1,"mock_projections"),sourceIdx:e(e$1,"source_idx","source_idx")}),"preflight.run-single-source-in-live-card":e$1=>n.preflightRunSingleSourceInLiveCard({cardId:a(e$1,"card_id"),sourceIdx:e(e$1,"source_idx","source_idx"),mockRequires:d(e$1,"mock_requires","mock_requires")}),"preflight.run-one-cycle-with-candidate-card":e=>n.preflightRunOneCycleWithCandidateCard({candidateCardContent:d(e,"candidate_card_content","candidate_card_content"),mockRequires:c(e,"mock_requires")}),"manage.read-card":e=>n.manageReadCard({cardId:a(e,"card_id")}),"stage-ai-response-and-any-attachments":e=>{let a$1=a(e,"turn_id");if(!a$1)throw Object.assign(new Error("stage-ai-response-and-any-attachments requires a non-empty turn_id"),{statusCode:400});return n.manageAddChatEntryAndAnyAttachments({cardId:a(e,"card_id"),role:"assistant",...typeof e.text=="string"?{text:e.text}:{},...a$1?{turn:a$1}:{},...Array.isArray(e.files)?{files:e.files}:{}})},"manage.upsert-card":e=>n.manageUpsertCard({cardId:a(e,"card_id"),candidateCardContent:c(e,"candidate_card_content")}),"manage.remove-card":e=>n.manageRemoveCard({cardId:a(e,"card_id")})}}function se(n){return {"webhook.process-accumulated":()=>n.webhookProcessAccumulated(),"webhook.source-fetch-done":e=>n.webhookSourceFetchDone({token:a(e,"token"),ref:a(e,"ref")}),"webhook.source-fetch-failed":e=>n.webhookSourceFetchFailed({token:a(e,"token"),reason:a(e,"reason")})}}function de(n){let{boardId:e,uploadCardFile:a$1,getMcpFacade:l,controlplane:w}=n;function _(t,C){let p=a(t,"board_id");if(!p)throw Object.assign(new Error(`${C} requires board_id`),{statusCode:400});if(p!==e)throw Object.assign(new Error(`Unknown board_id: ${p}`),{statusCode:400})}function R(t,C){let{cardId:p}=w.requireCardArgs(t),o=a(t,"turn_id");return _(t,C),l().manageAddChatAttachment({cardId:p,role:a(t,"role")||"user",...o?{turn:o}:{},files:[{file_name:a(t,"file_name"),content_type:a(t,"content_type")||"application/octet-stream",...typeof t.text=="string"?{text:t.text}:{},...typeof t.base64=="string"?{base64:t.base64}:{},...Array.isArray(t.bytes)?{bytes:t.bytes}:{}}]})}return {"list-runtime-cards":t=>(_(t,"list-runtime-cards"),l().listRuntimeCards()),"getstate.is-chat-processing":t=>w.getChatProcessing(t),"setstate.chat-processing-started":t=>w.setChatProcessing(t,true),"setstate.chat-processing-done":t=>w.setChatProcessing(t,false),"getstate.card-meta":t=>w.getCardMeta(t),"setstate.card-meta":t=>w.setCardMeta(t),"manage.upload-card-file":t=>{let C=a(t,"card_id"),p=a(t,"file_name"),o=a(t,"content_type")||"application/octet-stream",c=f(t);if(_(t,"manage.upload-card-file"),!C)throw Object.assign(new Error("manage.upload-card-file requires card_id"),{statusCode:400});if(!p)throw Object.assign(new Error("manage.upload-card-file requires file_name"),{statusCode:400});if(!c)throw Object.assign(new Error("manage.upload-card-file requires args.bytes, args.text, or args.base64"),{statusCode:400});return a$1(C,p,o,c,{inChat:false})},"manage.add-chat-attachment":t=>R(t,"manage.add-chat-attachment"),"manage.add-chat-attachement":t=>R(t,"manage.add-chat-attachement"),"manage.add-chat-entry-and-any-attachments":t=>{let{cardId:C}=w.requireCardArgs(t),p=a(t,"role")||"user",o=a(t,"turn_id");return _(t,"manage.add-chat-entry-and-any-attachments"),l().manageAddChatEntryAndAnyAttachments({cardId:C,role:p,...typeof t.text=="string"?{text:t.text}:{},...o?{turn:o}:{},...Array.isArray(t.files)?{files:t.files}:{}})},"manage.patch-card":t=>{let{cardId:C}=w.requireCardArgs(t);return _(t,"manage.patch-card"),l().managePatchCard({cardId:C,patch:c(t,"patch")})},"manage.upsert-card":t=>{let{cardId:C}=w.requireCardArgs(t);return _(t,"manage.upsert-card"),l().manageUpsertCard({cardId:C,candidateCardContent:c(t,"candidate_card_content")})},"manage.remove-card":t=>{let{cardId:C}=w.requireCardArgs(t);return _(t,"manage.remove-card"),l().manageRemoveCard({cardId:C})},"manage.admin-read-card":async t=>{let{cardId:C}=w.requireCardArgs(t);return {status:"success",data:{cards:await l().adminReadCard({cardId:C})}}},"manage.admin-upsert-card":t=>{let C=a(t,"board_id"),p=a(t,"card_id");if(!C)throw Object.assign(new Error("manage.admin-upsert-card requires board_id"),{statusCode:400});if(!p)throw Object.assign(new Error("manage.admin-upsert-card requires card_id"),{statusCode:400});if(C!==e)throw Object.assign(new Error(`Unknown board_id: ${C}`),{statusCode:400});return l().adminUpsertCard({cardId:p,candidateCardContent:c(t,"candidate_card_content")})}}}function pe(n){let{boardContexts:e,cardOwnerIndex:a,cardContextForCard:l,readStatusSnapshot:w,readDataObjectsByToken:_,readCardRuntimeArtifacts:R,readCardFromStore:t,readCardDefinitions:C,processAccumulatedLaneInternal:p,reportSourceFetched:o,reportSourceFetchFailure:c,uploadCardFile:i,chatStorePublic:g,serverUrl:h,apiBasePath:y}=n;function u(){return e[0]??null}function m(){return {async status(){let s=await w();return s==null?{status:"fail",error:"Board status is unavailable"}:{status:"success",data:s}},async getOutputsDataObject(s){let r=s?.params?.key;return r?{status:"success",data:(await _())[r]}:{status:"fail",error:"getOutputsDataObject requires params.key"}},async getOutputsComputedValues(s){let r=s?.params?.key;return r?{status:"success",data:(await R())[r]?.computed_values}:{status:"fail",error:"getOutputsComputedValues requires params.key"}},async getOutputsFetchedSources(s){let r=s?.params?.key;if(!r)return {status:"fail",error:"getOutputsFetchedSources requires params.key"};let d=l(r)??u();return d?d.boardOps.getOutputsFetchedSources({params:{key:r}}):{status:"fail",error:"Board context is unavailable"}},async removeCard(s){let r=s?.params?.id;if(!r)return {status:"fail",error:"removeCard requires params.id"};let d=l(r)??u();return d?d.boardOps.removeCard({params:{id:r}}):{status:"fail",error:"Board context is unavailable"}},async cardRefreshedNotify(s){let r=s?.params?.cardId;if(!r)return {status:"fail",error:"cardRefreshedNotify requires params.cardId"};let d=l(r)??u();return d?d.boardOps.cardRefreshedNotify({params:{cardId:r}}):{status:"fail",error:"Board context is unavailable"}},async upsertCard(s){let r=s?.params?.cardId;if(!r)return {status:"fail",error:"upsertCard requires params.cardId"};let d=l(r)??u();if(!d)return {status:"fail",error:"Board context is unavailable"};let b=await d.boardOps.upsertCard({params:{cardId:r,restart:s.params.restart===true}});if(b.status!=="success")return b;if(a$1(d.boardAdapter)){let x=await p(true);if(x.status!=="success")return x}return b}}}function k(){let s=()=>{let r=u();if(!r?.nonCore)throw new Error("Board non-core adapter is not configured for MCP preflight/discovery tools");return r.nonCore};return {describeTaskExecutorCapabilities(r){return s().describeTaskExecutorCapabilities(r)},validateCardPreflight(r){return s().validateCardPreflight(r)},evalCardCompute(r){return s().evalCardCompute(r)},probeSourcePreflight(r){return s().probeSourcePreflight(r)},runSourcePreflight(r){return s().runSourcePreflight(r)},simulateCardCycle(r){return s().simulateCardCycle(r)}}}function v(){return {async get(s){let r=typeof s.params?.id=="string"?s.params.id:void 0;if(r){let d=await t(r);return d?{status:"success",data:{cards:[d]}}:{status:"success",data:{cards:[]}}}return {status:"success",data:{cards:await C()}}},async set(s){let r=s.body;if(r==null)return {status:"fail",error:"set requires a body (card object or array of cards)"};let d=Array.isArray(r)?r:[r];for(let b of d){let x=b,I=typeof x.id=="string"?x.id:"";if(!I)return {status:"fail",error:"each card must have a string `id` field"};let T=a.get(I)??0,L=e[T]??u();if(!L)return {status:"fail",error:"Board context is unavailable"};let N=await L.cardStoreOps.set({body:x});if(N.status!=="success")return N;a.set(I,T);}return {status:"success",data:{count:d.length}}},async del(s){let r=[s.params?.id,...s.body?.ids??[]].filter(d=>typeof d=="string"&&!!d);if(r.length===0)return {status:"fail",error:"del requires body.ids (string[]) or params.id"};for(let d of r){let b=l(d)??u();if(!b)return {status:"fail",error:"Board context is unavailable"};let x=await b.cardStoreOps.del({params:{id:d}});if(x.status!=="success")return x;a.delete(d);}return {status:"success",data:{count:r.length}}},async patch(s){let r=typeof s.params?.id=="string"?s.params.id:void 0,d=typeof s.params?.path=="string"?s.params.path:void 0;if(!r||!d)return {status:"fail",error:"patch requires params.id and params.path"};let b=l(r)??u();return b?b.cardStoreOps.patch(s):{status:"fail",error:"Board context is unavailable"}},async appendFiles(s){let r=typeof s.params?.id=="string"?s.params.id:void 0;if(!r)return {status:"fail",error:"appendFiles requires params.id"};let d=l(r)??u();return d?d.cardStoreOps.appendFiles(s):{status:"fail",error:"Board context is unavailable"}}}}function A(){return a$2({board:m(),nonCore:k(),cardStore:v(),chatStore:g,processAccumulated:()=>p(true),sourceFetchDone:({token:s,ref:r})=>o(s,r),sourceFetchFailed:({token:s,reason:r})=>c(s,r),uploadCardFile({cardId:s,fileName:r,contentType:d,bytes:b}){return i(s,r,d,b,{inChat:true})},buildFileDownloadUrl({cardId:s,fileIdx:r,storedName:d}){let b=`${h||""}${y}/cards/${encodeURIComponent(s)}/files/${r}`;return d?`${b}?sn=${encodeURIComponent(d)}`:b},readFetchedSourceJsonByRef({cardId:s,ref:r}){let d=l(s)??u();if(!d||a$1(d.boardAdapter))return null;let I=d.boardAdapter.resolveBlob(b$1(r)).trim();return I?JSON.parse(I):null}})}return {mcpBoardFacade:m,mcpNonCoreFacade:k,mcpCardStoreFacade:v,createMcpFacade:A}}export{K as a,V as b,z as c,B as d,j as e,D as f,q as g,Q as h,ee as i,re as j,oe as k,se as l,de as m,pe as n};//# sourceMappingURL=chunk-J5J6BG7B.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-J5J6BG7B.js.map
|
package/lib/chunk-M3OU6IS5.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkLPXVVMQT_cjs=require('./chunk-LPXVVMQT.cjs'),chunkKAWQPLIE_cjs=require('./chunk-KAWQPLIE.cjs'),chunkSFVO2LB2_cjs=require('./chunk-SFVO2LB2.cjs'),chunkM6STQR5F_cjs=require('./chunk-M6STQR5F.cjs');function K(){return {status:null,computedValues:{},dataObjects:{},cards:{}}}function V(n){if(!n||typeof n!="object")return false;let e=n.summary;return !e||typeof e!="object"?false:Number(e.card_count||0)>0}function z(n,e){if(!e||typeof e!="object")return;let a=e;if(a.kind==="notification-batch"&&Array.isArray(a.notifications)){for(let l of a.notifications)z(n,l);return}a.kind==="status"&&V(a.status)&&(n.status=a.status),a.kind==="computed_values"&&a.cardId&&(n.computedValues[a.cardId]=a.values),a.kind==="data_object"&&a.key&&(n.dataObjects[a.key]=a.payload),a.kind==="card_refreshed"&&a.cardId&&(n.cards[a.cardId]=a.card),a.kind==="card_removed"&&a.cardId&&(delete n.cards[a.cardId],delete n.computedValues[a.cardId]);}function B(n,e){if(n?.status==="success")return Object.prototype.hasOwnProperty.call(n,"data")?n.data:void 0;throw n?.status==="fail"||n?.status==="error"?Object.assign(new Error(n.error||`${e} failed`),{statusCode:400}):Object.assign(new Error(`${e} returned an unexpected response`),{statusCode:500})}async function j(n,e){return B(await n,e)}function D(n){let e=chunkLPXVVMQT_cjs.a(n,"key");if(!e)throw Object.assign(new Error("MCP tool requires key"),{statusCode:400});let a=e.split(".");if(!(a.length>=2&&a[0]==="chat"&&a.every(w=>/^[A-Za-z_][A-Za-z0-9_]*$/.test(w))))throw Object.assign(new Error("MCP tool only supports card meta keys under chat.*"),{statusCode:400});return e}function q(n,e){let a=n.meta;for(let l of e.split(".")){if(!a||typeof a!="object"||Array.isArray(a)||!Object.prototype.hasOwnProperty.call(a,l))return {exists:false,value:null};a=a[l];}return {exists:true,value:a}}function Q(n){let{boardId:e,getMcpFacade:a,getMcpCardStoreFacade:l}=n;function w(p){let o=chunkLPXVVMQT_cjs.a(p,"board_id"),c=chunkLPXVVMQT_cjs.a(p,"card_id");if(!o)throw Object.assign(new Error("MCP tool requires board_id"),{statusCode:400});if(!c)throw Object.assign(new Error("MCP tool requires card_id"),{statusCode:400});if(o!==e)throw Object.assign(new Error(`Unknown board_id: ${o}`),{statusCode:400});return {cardId:c}}function _(p,o){let{cardId:c}=w(p);return a().setChatProcessing({cardId:c,active:o}),{status:"success",data:{boardId:e,cardId:c,active:o}}}function R(p){let{cardId:o}=w(p),c=a().getChatProcessing({cardId:o});return {status:"success",data:{boardId:e,cardId:o,active:c.active}}}async function t(p){let{cardId:o}=w(p),c=D(p);if(!Object.prototype.hasOwnProperty.call(p,"value"))throw Object.assign(new Error("MCP tool requires value"),{statusCode:400});if(c.split(".").includes("__visible_controlplane_only")){let i=await j(l().get({params:{id:o}}),"cardStore.get"),g=Array.isArray(i.cards)&&i.cards.length>0&&typeof i.cards[0]=="object"&&!Array.isArray(i.cards[0])?i.cards[0]:null,h=g?q(g,"__visible_controlplane_only").value:void 0;if(p.value!==h)throw Object.assign(new Error("MCP tool cannot change the reserved meta flag __visible_controlplane_only"),{statusCode:403});return {status:"success",data:{boardId:e,cardId:o,key:c}}}return B(await l().patch({params:{id:o,path:`meta.${c}`},body:{value:p.value}}),"cardStore.patch"),{status:"success",data:{boardId:e,cardId:o,key:c}}}async function C(p){let{cardId:o}=w(p),c=D(p),i=await j(l().get({params:{id:o}}),"cardStore.get"),g=Array.isArray(i.cards)&&i.cards.length>0&&i.cards[0]&&typeof i.cards[0]=="object"&&!Array.isArray(i.cards[0])?i.cards[0]:null;if(!g)throw Object.assign(new Error(`Card "${o}" not found`),{statusCode:404});let h=q(g,c);return {status:"success",data:{boardId:e,cardId:o,key:c,exists:h.exists,value:h.value}}}return {requireCardArgs:w,setChatProcessing:_,getChatProcessing:R,setCardMeta:t,getCardMeta:C}}function ee(n){let{boardId:e,boardContexts:a,readCardDefinitions:l,readChatRecords:w,getChatProcessing:_}=n;async function R(){let o=(await Promise.all(a.map(async y=>{try{let u=y.boardAdapter.kvStorageForRef(y.outputsStoreRef),m=await Promise.resolve(u.read("status"));if(m!=null)return m}catch{}return y.notification.status}))).filter(Boolean);if(o.length===0)return null;if(o.length===1)return o[0];let c=[],i=["completed","eligible","pending","blocked","unresolved","failed","in_progress","orphan_cards"],g={};for(let y of i)g[y]=0;for(let y of o){let u=y,m=Array.isArray(u.cards)?u.cards:[];c.push(...m);for(let k of i)g[k]+=Number(u?.summary?.[k]||0);}let h=o[0];return {...h,cards:c,summary:{...h.summary||{},card_count:c.length,...g}}}async function t(){let o={},c=async i=>{try{let g=await i.boardOps.getAllOutputsComputedValues({});if(g.status==="success"&&g.data&&typeof g.data=="object"){for(let[h,y]of Object.entries(g.data)){let u=i.notification.cards[h];o[h]={schema_version:"v1",card_id:h,card_data:u?.card_data??{},computed_values:y??{}};}return}}catch{}for(let[g,h]of Object.entries(i.notification.computedValues)){let y=i.notification.cards[g];o[g]={schema_version:"v1",card_id:g,card_data:y?.card_data??{},computed_values:h??{}};}};for(let i of a)await c(i);return o}async function C(){let o={};for(let c of a){try{let i=await c.boardOps.getAllOutputsDataObjects({});if(i.status==="success"&&i.data&&typeof i.data=="object"){Object.assign(o,i.data);continue}}catch{}Object.assign(o,c.notification.dataObjects||{});}return o}async function p(){let o=await l(),c=await t(),i=await C(),g={};for(let y of o){if(!y?.id)continue;let u=y.id,m=c[u]||{},k={...m.card_data&&typeof m.card_data=="object"?m.card_data:y.card_data&&typeof y.card_data=="object"?y.card_data:{}};g[u]={schema_version:m.schema_version||"v1",card_id:m.card_id||u,card_data:k,computed_values:m.computed_values&&typeof m.computed_values=="object"?m.computed_values:{}};}let h={};for(let y of o){if(!y?.id)continue;let u=y.id;try{let m=w(u),k=_(u);(m.length>0||k)&&(h[u]={messages:m.map(v=>({role:String(v.role||"system"),text:String(v.text||""),files:Array.isArray(v.files)?v.files:[]})),receiving:!1,processing:k});}catch{}}return {boardId:e,cardDefinitions:o,statusSnapshot:await R(),dataObjectsByToken:i,cardRuntimeById:g,cardChatsByCardId:h}}return {readStatusSnapshot:R,readCardRuntimeArtifacts:t,readDataObjectsByToken:C,buildPublishedRuntimePayload:p}}function H(n){let e=String(n||"").trim();if(!e)return "upload.bin";let a=Math.max(e.lastIndexOf("/"),e.lastIndexOf("\\"));return (a>=0?e.slice(a+1):e)||"upload.bin"}function re(n){let{safeCardId:e,artifactsStores:a,cardFileMetadataStore:l,readCardFromStore:w,updateCardLocalOnly:_,writeChatRecord:R}=n;async function t(o){let c=[];try{let i=await w(o);if(!i)return c;let g=l().read(i.card_data&&typeof i.card_data=="object"?i.card_data:null);for(let h of g)c.push(String(h.stored_name??""));}catch{}return c}async function C(o,c,i,g){let h=e(o),y=a(o),u=H(c),m=await t(o),v=`${String(m.length+1).padStart(3,"0")}-${u}`.slice(-36);return y.files&&await y.files.putBytes(`${h}/${v}`,new Uint8Array(g),i||"application/octet-stream"),{name:u,stored_name:v,size:g.length,mime_type:i||"application/octet-stream",uploaded_at:new Date().toISOString()}}async function p(o,c,i,g,h){if(!g.length)throw Object.assign(new Error("Empty upload body"),{statusCode:400});let y=h?.inChat===true,u=await C(o,c,i,g),m=null;if(await _(o,k=>{let v=new Date().toISOString(),A=k.card_data&&typeof k.card_data=="object"?k.card_data:{};k.card_data=A;let s=l().normalizeIncoming([{name:u.name,stored_name:u.stored_name,size:u.size,mime_type:u.mime_type,uploaded_at:u.uploaded_at||v,chat:y}],v);return m=l().merge(A,s).findIndex(d=>d.stored_name===u.stored_name),k}),y){let k=typeof m=="number"&&m>=0?` #${m}`:"";R(o,"system",`file uploaded: ${u.name} as ${u.stored_name}${k}`,[],h?.turnId??"");}return {ok:true,file:{...u,...typeof m=="number"&&m>=0?{file_idx:m}:{},chat:y},...typeof m=="number"&&m>=0?{file_idx:m}:{}}}return {uploadCardFile:p,readCardStoredFileNames:t}}function oe(n){return {"discover.source-kinds":()=>n.discoverSourceKinds(),"inspect.board-runtime-status":()=>n.inspectBoardRuntimeStatus(),"inspect.card-definition-and-runtime":e=>n.inspectCardDefinitionAndRuntime({cardId:chunkLPXVVMQT_cjs.a(e,"card_id")}),"inspect.chat-messages-on-cards":e=>{let a=chunkLPXVVMQT_cjs.b(e,"tail_turns"),l=chunkLPXVVMQT_cjs.b(e,"tail"),w=chunkLPXVVMQT_cjs.a(e,"turn_id"),_=e.all_turns===true,R=chunkLPXVVMQT_cjs.a(e,"tail_turns_before_id");return n.inspectChatMessagesOnCards({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),...a!==void 0?{lastUserTurns:a}:{},...l!==void 0?{tail:l}:{},...w?{turnId:w}:{},..._?{allTurns:true}:{},...R?{tailTurnsBeforeId:R}:{}})},"inspect.file-contents":e=>n.inspectFileContents({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),fileIdx:Number(chunkLPXVVMQT_cjs.b(e,"file_idx"))}),"preflight.validate-candidate-card-definition":e=>n.preflightValidateCandidateCardDefinition({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content")}),"preflight.materialize-candidate-card":e=>n.preflightMaterializeCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockRequires:chunkLPXVVMQT_cjs.d(e,"mock_requires","mock_requires"),mockFetchedSources:chunkLPXVVMQT_cjs.d(e,"mock_fetched_sources","mock_fetched_sources")}),"preflight.probe-single-source-in-candidate-card":e=>n.preflightProbeSingleSourceInCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockProjections:chunkLPXVVMQT_cjs.c(e,"mock_projections"),sourceIdx:chunkLPXVVMQT_cjs.e(e,"source_idx","source_idx")}),"preflight.run-single-source-in-candidate-card":e=>n.preflightRunSingleSourceInCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockProjections:chunkLPXVVMQT_cjs.c(e,"mock_projections"),sourceIdx:chunkLPXVVMQT_cjs.e(e,"source_idx","source_idx")}),"preflight.run-single-source-in-live-card":e=>n.preflightRunSingleSourceInLiveCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),sourceIdx:chunkLPXVVMQT_cjs.e(e,"source_idx","source_idx"),mockRequires:chunkLPXVVMQT_cjs.d(e,"mock_requires","mock_requires")}),"preflight.run-one-cycle-with-candidate-card":e=>n.preflightRunOneCycleWithCandidateCard({candidateCardContent:chunkLPXVVMQT_cjs.d(e,"candidate_card_content","candidate_card_content"),mockRequires:chunkLPXVVMQT_cjs.c(e,"mock_requires")}),"manage.read-card":e=>n.manageReadCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id")}),"stage-ai-response-and-any-attachments":e=>{let a=chunkLPXVVMQT_cjs.a(e,"turn_id");if(!a)throw Object.assign(new Error("stage-ai-response-and-any-attachments requires a non-empty turn_id"),{statusCode:400});return n.manageAddChatEntryAndAnyAttachments({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),role:"assistant",...typeof e.text=="string"?{text:e.text}:{},...a?{turn:a}:{},...Array.isArray(e.files)?{files:e.files}:{}})},"manage.upsert-card":e=>n.manageUpsertCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id"),candidateCardContent:chunkLPXVVMQT_cjs.c(e,"candidate_card_content")}),"manage.remove-card":e=>n.manageRemoveCard({cardId:chunkLPXVVMQT_cjs.a(e,"card_id")})}}function se(n){return {"webhook.process-accumulated":()=>n.webhookProcessAccumulated(),"webhook.source-fetch-done":e=>n.webhookSourceFetchDone({token:chunkLPXVVMQT_cjs.a(e,"token"),ref:chunkLPXVVMQT_cjs.a(e,"ref")}),"webhook.source-fetch-failed":e=>n.webhookSourceFetchFailed({token:chunkLPXVVMQT_cjs.a(e,"token"),reason:chunkLPXVVMQT_cjs.a(e,"reason")})}}function de(n){let{boardId:e,uploadCardFile:a,getMcpFacade:l,controlplane:w}=n;function _(t,C){let p=chunkLPXVVMQT_cjs.a(t,"board_id");if(!p)throw Object.assign(new Error(`${C} requires board_id`),{statusCode:400});if(p!==e)throw Object.assign(new Error(`Unknown board_id: ${p}`),{statusCode:400})}function R(t,C){let{cardId:p}=w.requireCardArgs(t),o=chunkLPXVVMQT_cjs.a(t,"turn_id");return _(t,C),l().manageAddChatAttachment({cardId:p,role:chunkLPXVVMQT_cjs.a(t,"role")||"user",...o?{turn:o}:{},files:[{file_name:chunkLPXVVMQT_cjs.a(t,"file_name"),content_type:chunkLPXVVMQT_cjs.a(t,"content_type")||"application/octet-stream",...typeof t.text=="string"?{text:t.text}:{},...typeof t.base64=="string"?{base64:t.base64}:{},...Array.isArray(t.bytes)?{bytes:t.bytes}:{}}]})}return {"list-runtime-cards":t=>(_(t,"list-runtime-cards"),l().listRuntimeCards()),"getstate.is-chat-processing":t=>w.getChatProcessing(t),"setstate.chat-processing-started":t=>w.setChatProcessing(t,true),"setstate.chat-processing-done":t=>w.setChatProcessing(t,false),"getstate.card-meta":t=>w.getCardMeta(t),"setstate.card-meta":t=>w.setCardMeta(t),"manage.upload-card-file":t=>{let C=chunkLPXVVMQT_cjs.a(t,"card_id"),p=chunkLPXVVMQT_cjs.a(t,"file_name"),o=chunkLPXVVMQT_cjs.a(t,"content_type")||"application/octet-stream",c=chunkLPXVVMQT_cjs.f(t);if(_(t,"manage.upload-card-file"),!C)throw Object.assign(new Error("manage.upload-card-file requires card_id"),{statusCode:400});if(!p)throw Object.assign(new Error("manage.upload-card-file requires file_name"),{statusCode:400});if(!c)throw Object.assign(new Error("manage.upload-card-file requires args.bytes, args.text, or args.base64"),{statusCode:400});return a(C,p,o,c,{inChat:false})},"manage.add-chat-attachment":t=>R(t,"manage.add-chat-attachment"),"manage.add-chat-attachement":t=>R(t,"manage.add-chat-attachement"),"manage.add-chat-entry-and-any-attachments":t=>{let{cardId:C}=w.requireCardArgs(t),p=chunkLPXVVMQT_cjs.a(t,"role")||"user",o=chunkLPXVVMQT_cjs.a(t,"turn_id");return _(t,"manage.add-chat-entry-and-any-attachments"),l().manageAddChatEntryAndAnyAttachments({cardId:C,role:p,...typeof t.text=="string"?{text:t.text}:{},...o?{turn:o}:{},...Array.isArray(t.files)?{files:t.files}:{}})},"manage.patch-card":t=>{let{cardId:C}=w.requireCardArgs(t);return _(t,"manage.patch-card"),l().managePatchCard({cardId:C,patch:chunkLPXVVMQT_cjs.c(t,"patch")})},"manage.upsert-card":t=>{let{cardId:C}=w.requireCardArgs(t);return _(t,"manage.upsert-card"),l().manageUpsertCard({cardId:C,candidateCardContent:chunkLPXVVMQT_cjs.c(t,"candidate_card_content")})},"manage.remove-card":t=>{let{cardId:C}=w.requireCardArgs(t);return _(t,"manage.remove-card"),l().manageRemoveCard({cardId:C})},"manage.admin-read-card":async t=>{let{cardId:C}=w.requireCardArgs(t);return {status:"success",data:{cards:await l().adminReadCard({cardId:C})}}},"manage.admin-upsert-card":t=>{let C=chunkLPXVVMQT_cjs.a(t,"board_id"),p=chunkLPXVVMQT_cjs.a(t,"card_id");if(!C)throw Object.assign(new Error("manage.admin-upsert-card requires board_id"),{statusCode:400});if(!p)throw Object.assign(new Error("manage.admin-upsert-card requires card_id"),{statusCode:400});if(C!==e)throw Object.assign(new Error(`Unknown board_id: ${C}`),{statusCode:400});return l().adminUpsertCard({cardId:p,candidateCardContent:chunkLPXVVMQT_cjs.c(t,"candidate_card_content")})}}}function pe(n){let{boardContexts:e,cardOwnerIndex:a,cardContextForCard:l,readStatusSnapshot:w,readDataObjectsByToken:_,readCardRuntimeArtifacts:R,readCardFromStore:t,readCardDefinitions:C,processAccumulatedLaneInternal:p,reportSourceFetched:o,reportSourceFetchFailure:c,uploadCardFile:i,chatStorePublic:g,serverUrl:h,apiBasePath:y}=n;function u(){return e[0]??null}function m(){return {async status(){let s=await w();return s==null?{status:"fail",error:"Board status is unavailable"}:{status:"success",data:s}},async getOutputsDataObject(s){let r=s?.params?.key;return r?{status:"success",data:(await _())[r]}:{status:"fail",error:"getOutputsDataObject requires params.key"}},async getOutputsComputedValues(s){let r=s?.params?.key;return r?{status:"success",data:(await R())[r]?.computed_values}:{status:"fail",error:"getOutputsComputedValues requires params.key"}},async getOutputsFetchedSources(s){let r=s?.params?.key;if(!r)return {status:"fail",error:"getOutputsFetchedSources requires params.key"};let d=l(r)??u();return d?d.boardOps.getOutputsFetchedSources({params:{key:r}}):{status:"fail",error:"Board context is unavailable"}},async removeCard(s){let r=s?.params?.id;if(!r)return {status:"fail",error:"removeCard requires params.id"};let d=l(r)??u();return d?d.boardOps.removeCard({params:{id:r}}):{status:"fail",error:"Board context is unavailable"}},async cardRefreshedNotify(s){let r=s?.params?.cardId;if(!r)return {status:"fail",error:"cardRefreshedNotify requires params.cardId"};let d=l(r)??u();return d?d.boardOps.cardRefreshedNotify({params:{cardId:r}}):{status:"fail",error:"Board context is unavailable"}},async upsertCard(s){let r=s?.params?.cardId;if(!r)return {status:"fail",error:"upsertCard requires params.cardId"};let d=l(r)??u();if(!d)return {status:"fail",error:"Board context is unavailable"};let b=await d.boardOps.upsertCard({params:{cardId:r,restart:s.params.restart===true}});if(b.status!=="success")return b;if(chunkKAWQPLIE_cjs.a(d.boardAdapter)){let x=await p(true);if(x.status!=="success")return x}return b}}}function k(){let s=()=>{let r=u();if(!r?.nonCore)throw new Error("Board non-core adapter is not configured for MCP preflight/discovery tools");return r.nonCore};return {describeTaskExecutorCapabilities(r){return s().describeTaskExecutorCapabilities(r)},validateCardPreflight(r){return s().validateCardPreflight(r)},evalCardCompute(r){return s().evalCardCompute(r)},probeSourcePreflight(r){return s().probeSourcePreflight(r)},runSourcePreflight(r){return s().runSourcePreflight(r)},simulateCardCycle(r){return s().simulateCardCycle(r)}}}function v(){return {async get(s){let r=typeof s.params?.id=="string"?s.params.id:void 0;if(r){let d=await t(r);return d?{status:"success",data:{cards:[d]}}:{status:"success",data:{cards:[]}}}return {status:"success",data:{cards:await C()}}},async set(s){let r=s.body;if(r==null)return {status:"fail",error:"set requires a body (card object or array of cards)"};let d=Array.isArray(r)?r:[r];for(let b of d){let x=b,I=typeof x.id=="string"?x.id:"";if(!I)return {status:"fail",error:"each card must have a string `id` field"};let T=a.get(I)??0,L=e[T]??u();if(!L)return {status:"fail",error:"Board context is unavailable"};let N=await L.cardStoreOps.set({body:x});if(N.status!=="success")return N;a.set(I,T);}return {status:"success",data:{count:d.length}}},async del(s){let r=[s.params?.id,...s.body?.ids??[]].filter(d=>typeof d=="string"&&!!d);if(r.length===0)return {status:"fail",error:"del requires body.ids (string[]) or params.id"};for(let d of r){let b=l(d)??u();if(!b)return {status:"fail",error:"Board context is unavailable"};let x=await b.cardStoreOps.del({params:{id:d}});if(x.status!=="success")return x;a.delete(d);}return {status:"success",data:{count:r.length}}},async patch(s){let r=typeof s.params?.id=="string"?s.params.id:void 0,d=typeof s.params?.path=="string"?s.params.path:void 0;if(!r||!d)return {status:"fail",error:"patch requires params.id and params.path"};let b=l(r)??u();return b?b.cardStoreOps.patch(s):{status:"fail",error:"Board context is unavailable"}},async appendFiles(s){let r=typeof s.params?.id=="string"?s.params.id:void 0;if(!r)return {status:"fail",error:"appendFiles requires params.id"};let d=l(r)??u();return d?d.cardStoreOps.appendFiles(s):{status:"fail",error:"Board context is unavailable"}}}}function A(){return chunkM6STQR5F_cjs.a({board:m(),nonCore:k(),cardStore:v(),chatStore:g,processAccumulated:()=>p(true),sourceFetchDone:({token:s,ref:r})=>o(s,r),sourceFetchFailed:({token:s,reason:r})=>c(s,r),uploadCardFile({cardId:s,fileName:r,contentType:d,bytes:b}){return i(s,r,d,b,{inChat:true})},buildFileDownloadUrl({cardId:s,fileIdx:r,storedName:d}){let b=`${h||""}${y}/cards/${encodeURIComponent(s)}/files/${r}`;return d?`${b}?sn=${encodeURIComponent(d)}`:b},readFetchedSourceJsonByRef({cardId:s,ref:r}){let d=l(s)??u();if(!d||chunkKAWQPLIE_cjs.a(d.boardAdapter))return null;let I=d.boardAdapter.resolveBlob(chunkSFVO2LB2_cjs.b(r)).trim();return I?JSON.parse(I):null}})}return {mcpBoardFacade:m,mcpNonCoreFacade:k,mcpCardStoreFacade:v,createMcpFacade:A}}exports.a=K;exports.b=V;exports.c=z;exports.d=B;exports.e=j;exports.f=D;exports.g=q;exports.h=Q;exports.i=ee;exports.j=re;exports.k=oe;exports.l=se;exports.m=de;exports.n=pe;//# sourceMappingURL=chunk-M3OU6IS5.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-M3OU6IS5.cjs.map
|
package/lib/chunk-M6STQR5F.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkIXZG74EW_cjs=require('./chunk-IXZG74EW.cjs');function A(s,i){if(s?.status==="success")return Object.prototype.hasOwnProperty.call(s,"data")?s.data:void 0;throw s?.status==="fail"||s?.status==="error"?new Error(s.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function H(s,i){if(s?.status==="success"&&Object.prototype.hasOwnProperty.call(s,"data"))return s.data;throw s?.status==="success"?new Error(`${i} returned success without data`):s?.status==="fail"||s?.status==="error"?new Error(s.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function a(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}function y(s){return Array.isArray(s)?s:[]}function N(s,i){if(typeof i!="string"||i.length===0)return;let c=s,u=i;u.startsWith("fetched_sources.")&&(c=a(s).fetched_sources,u=u.slice(16));for(let p of u.split(".")){if(c==null||typeof c!="object")return;c=c[p];}return c}function V(s,i){let c=a(s.view),u=y(c.elements);return {layout:c.layout,features:c.features,elements:u.map((p,k)=>{let R=a(p),b=a(R.data),h=typeof R.visible=="string"?!!N(i,R.visible):true,U=typeof b.bind=="string"?b.bind:void 0,S=typeof b.maxRows=="number"?b.maxRows:void 0,B=U?N(i,U):void 0,F={id:typeof R.id=="string"&&R.id?R.id:`element-${k}`,kind:R.kind,label:R.label,visible:h};return B!==void 0&&(F.resolved=Array.isArray(B)&&typeof S=="number"?B.slice(0,S):B),F})}}function G(s,i){let c=typeof s.id=="string"&&s.id?s.id:"card",u=y(s.provides),p=u.length>0?u:[{bindTo:c,ref:"card_data"}],k={};for(let R of p){let b=a(R),h=typeof b.bindTo=="string"?b.bindTo:"",U=typeof b.ref=="string"?b.ref:"";if(!h||!U)continue;let S=N(i,U);S!==void 0&&(k[h]=S);}return k}function be(s){if(typeof s!="string"||!s.trim())return null;let i=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(s.trim());if(!i)return null;let c=Number.parseInt(i[2],10);return !Number.isInteger(c)||c<0?null:c}function he(s){return {"card-content":s}}function E(s){let{meta:i,...c}=s;return c}function ke(s,i){return Object.prototype.hasOwnProperty.call(s,i)}function Re(s){return typeof structuredClone=="function"?structuredClone(s):JSON.parse(JSON.stringify(s))}function ve(s,i){let c=Re(s);if(!i||Object.keys(i).length===0)return c;function u(p,k,R){let b=String(k||"").split(".").filter(Boolean);if(!b.length)return;let h=p;for(let U=0;U<b.length-1;U+=1){let S=b[U];(!h[S]||typeof h[S]!="object")&&(h[S]={}),h=h[S];}h[b[b.length-1]]=R;}if(i.fieldValues!==void 0&&i.fieldValues!==null){let p=null,k=a(c.view),R=y(k.elements);for(let b of R){let h=a(a(b).data);if(typeof h.writeTo=="string"&&h.writeTo){p=h.writeTo;break}}return p?u(c,p,i.fieldValues):typeof i.fieldValues=="object"&&!Array.isArray(i.fieldValues)&&(c.card_data={...a(c.card_data),...i.fieldValues}),c}if(Array.isArray(i._stagedFiles)&&i._stagedFiles.length>0)return c;for(let[p,k]of Object.entries(i))p!=="_stagedFiles"&&(k!==null&&typeof k=="object"&&!Array.isArray(k)&&c[p]!==null&&typeof c[p]=="object"&&!Array.isArray(c[p])?c[p]={...c[p],...k}:c[p]=k);return c}function Q(s){return a(s.meta).__visible_controlplane_only===true}async function T(s,i){let c=await M(s.get({params:{id:i}}),"cardStore.get"),u=Array.isArray(c?.cards)?c.cards:[];if(u.length===0)throw new Error(`Card "${i}" not found`);return u[0]}function Ae(s){let{board:i,nonCore:c,cardStore:u,chatStore:p,processAccumulated:k,sourceFetchDone:R,sourceFetchFailed:b,uploadCardFile:h,buildFileDownloadUrl:U,readFetchedSourceJsonByRef:S}=s;function B(e,r){if(typeof e=="function")return e;throw new Error(`${r} is not configured for this MCP facade`)}async function F(){let e=await M(u.get({}),"cardStore.get");return Array.isArray(e.cards)?e.cards.map(r=>a(r)):[]}function X(e){if(Array.isArray(e.bytes))return new Uint8Array(e.bytes.map(r=>Math.max(0,Math.min(255,Number(r)||0))));if(typeof e.text=="string")return new TextEncoder().encode(e.text);if(typeof e.base64=="string"){let r=String(e.base64).replace(/-/g,"+").replace(/_/g,"/"),t=r+"=".repeat((4-r.length%4)%4),n=atob(t);return Uint8Array.from(n,o=>o.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}async function Y(){let e=a(await M(c.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:e.version,commonSourceFields:a(e.commonSourceDefFields),sourceKinds:a(e.sourceKinds)}}async function Z(){let e=a(await M(i.status({}),"status")),r=a(e.summary),t=y(e.cards);return {meta:a(e.meta),summary:{card_count:typeof r.card_count=="number"?r.card_count:0,completed:typeof r.completed=="number"?r.completed:0,eligible:typeof r.eligible=="number"?r.eligible:0,pending:typeof r.pending=="number"?r.pending:0,blocked:typeof r.blocked=="number"?r.blocked:0,in_progress:typeof r.in_progress=="number"?r.in_progress:0,failed:typeof r.failed=="number"?r.failed:0,unresolved:typeof r.unresolved=="number"?r.unresolved:0},cards:t.map(n=>{let o=a(n);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 ee(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let t=a(await M(i.status({}),"status")),o=y(t.cards).map(a).find(m=>m.name===r);if(!o)throw new Error(`card "${r}" not found in board status`);let d=a(await T(u,r));if(Q(d))throw Object.assign(new Error(`card "${r}" not found`),{statusCode:404});let f=E(d),g=y(o.requires_satisfied).filter(m=>typeof m=="string"&&!!m),_=y(o.provides_runtime).filter(m=>typeof m=="string"&&!!m),v=Object.fromEntries(await Promise.all(g.map(async m=>[m,await M(i.getOutputsDataObject({params:{key:m}}),`getOutputsDataObject(${m})`)]))),I=Object.fromEntries(await Promise.all(_.map(async m=>[m,await M(i.getOutputsDataObject({params:{key:m}}),`getOutputsDataObject(${m})`)]))),w=a(await M(i.getOutputsComputedValues({params:{key:r}}),"getOutputsComputedValues")),l=await M(i.getOutputsFetchedSources({params:{key:r}}),"getOutputsFetchedSources"),P=y(d.source_defs).map(a),C={};for(let m of P)typeof m.bindTo=="string"&&typeof m.outputFile=="string"&&(C[m.outputFile]=m.bindTo);let x={};for(let[m,O]of Object.entries(l)){let q=C[m]??m;if(!S||typeof O!="string"){x[q]=null;continue}try{x[q]=S({cardId:r,ref:O});}catch{x[q]=null;}}let L={card_data:a(d.card_data),requires:v,fetched_sources:x,computed_values:w};return {cardId:r,card_status_in_board:o,card_definition_and_static_data:f,refs_for_fetched_source_files:l,runtime_data:{requires:v,provides:I,computed_values:w,rendered_view:V(d,L)}}}async function re(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("inspectChatMessagesOnCards requires cardId");let t=typeof e.turnId=="string"?e.turnId:"",n=e.allTurns===true,o=typeof e.tailTurnsBeforeId=="string"?e.tailTurnsBeforeId:"",d=n?void 0:e.lastUserTurns??(t?void 0:1),f=e.tail,g={...d===void 0?{}:{tailTurns:d},...t?{turnId:t}:{},...n?{allTurns:true}:{},...o?{tailTurnsBeforeId:o}:{}},_=Object.keys(g).length>0?{params:{cardId:r},body:g}:{params:{cardId:r}},v=A(p.readAll(_),"chatStore.readAll"),I=a(await T(u,r)),w=y(a(I.card_data).files).map((C,x)=>({idx:x,stored_name:a(C).stored_name})).filter(C=>typeof C.stored_name=="string"&&C.stored_name.length>0),P=(Array.isArray(v.records)?v.records:[]).map(C=>{let L=a(C.payload),m={...C},O=typeof C?.role=="string"?C.role:typeof L.role=="string"?String(L.role):"",q=typeof C?.text=="string"?C.text:typeof L.text=="string"?String(L.text):"";if(O==="system"){let $=be(q);if($!==null&&w.some(j=>j.idx===$)){let j=`Retrieve using inspect-file-contents --card-id ${r} --file-idx ${$}`;m.retrieval_hint=j,Object.keys(L).length>0&&typeof C.role!="string"&&(m.payload={...L,retrieval_hint:j});}}return m});return {cardId:r,messages:typeof f=="number"&&f>=0?P.slice(-f):P}}async function te(e){let r=String(e.cardId||"").trim(),t=Number(e.fileIdx);if(!r)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(t)||t<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let n=a(await T(u,r)),o=y(a(n.card_data).files).map(a);if(t>=o.length)throw new Error(`attachment index ${t} is out of range for card "${r}"`);let d=o[t],f=typeof d.stored_name=="string"?d.stored_name:null;return {cardId:r,fileIdx:t,downloadUrl:U({cardId:r,fileIdx:t,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(e){return await c.validateCardPreflight({body:he(e.candidateCardContent)})}function ne(e){if(!e.mockRequires||typeof e.mockRequires!="object"||Array.isArray(e.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!e.mockFetchedSources||typeof e.mockFetchedSources!="object"||Array.isArray(e.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let r=c.evalCardCompute({body:{"card-content":e.candidateCardContent,"mock-requires":e.mockRequires,"mock-fetched-sources":e.mockFetchedSources}});if(r.status!=="success")return r;let t=a(H(r,"evalCardCompute")),n=a(e.candidateCardContent),o={card_data:a(n.card_data),requires:a(e.mockRequires),fetched_sources:a(e.mockFetchedSources),computed_values:a(t.computed_values)};return {status:"success",data:{cardId:typeof t.cardId=="string"?t.cardId:typeof n.id=="string"?n.id:"(unknown)",ok:t.ok===true,computed_values:a(t.computed_values),errors:y(t.errors).map(d=>{let f=a(d);return {bindTo:typeof f.bindTo=="string"?f.bindTo:"",error:typeof f.error=="string"?f.error:""}}),provides_outputs:G(n,o),rendered_view:V(n,o)}}}async function ae(e){return await c.probeSourcePreflight({params:{sourceIdx:e.sourceIdx},body:{"card-content":e.candidateCardContent,"mock-projections":e.mockProjections}})}async function oe(e){return await c.runSourcePreflight({params:{sourceIdx:e.sourceIdx},body:{"card-content":e.candidateCardContent,"mock-projections":e.mockProjections}})}async function se(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!e.mockRequires||typeof e.mockRequires!="object"||Array.isArray(e.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let t=a(await T(u,r)),n=y(t.source_defs).filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)),o={};if(e.sourceIdx>=0&&e.sourceIdx<n.length){let d=n[e.sourceIdx],f=chunkIXZG74EW_cjs.a.enrichSourcesSync([d],{card_data:a(t.card_data),requires:e.mockRequires});Array.isArray(f)&&f.length>0&&(o=a(f[0]._projections));}return await c.runSourcePreflight({params:{sourceIdx:e.sourceIdx},body:{"card-content":t,"mock-requires":e.mockRequires,"mock-projections":o}})}async function ie(e){let r=a(await M(c.simulateCardCycle({body:{"card-content":e.candidateCardContent,"mock-requires":e.mockRequires}}),"simulateCardCycle")),t=a(e.candidateCardContent),n=a(r.validation),o=y(r.source_probes),d=y(r.projection_errors),f=a(r.fetched_sources),g=y(r.compute_errors),_=a(r.computed_values),v={card_data:a(t.card_data),requires:e.mockRequires,fetched_sources:f,computed_values:_},I=[];for(let w of y(n.issues))typeof w=="string"&&w&&I.push(w);for(let w of o){let l=a(w),P=typeof l.bindTo=="string"?l.bindTo:"source",C=typeof l.error=="string"?l.error:"";C&&I.push(`${P}: ${C}`);}for(let w of d){let l=a(w),P=typeof l.bindTo=="string"?l.bindTo:"source",C=typeof l.key=="string"?l.key:"projection",x=typeof l.error=="string"?l.error:"projection failed";I.push(`${P}.${C}: ${x}`);}for(let w of g){let l=a(w),P=typeof l.bindTo=="string"?l.bindTo:"compute",C=typeof l.error=="string"?l.error:"compute failed";I.push(`${P}: ${C}`);}return {status:"success",data:{cardId:typeof r.cardId=="string"?r.cardId:"(unknown)",ok:r.ok===true,issues:I,provides_outputs:G(t,v),rendered_view:V(t,v)}}}async function z(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("manageReadCard requires cardId");let t=await M(u.get({params:{id:r}}),"cardStore.get"),n=Array.isArray(t.cards)?t.cards.map(a):[];if(n.some(Q))throw Object.assign(new Error(`Card "${r}" not found`),{statusCode:404});return n.map(o=>E(o))}async function K(e){let r=await Promise.all(y(e.files).map(async t=>{let n=a(t),o=String(n.file_name??n.fileName??n.name??"").trim(),d=String(n.content_type??n.contentType??"application/octet-stream");if(!o)throw new Error("file entry requires file_name");return await h({cardId:e.cardId,fileName:o,contentType:d,bytes:X(n)})}));return r.forEach((t,n)=>{let o=a(t.file),d=typeof t.file_idx=="number"&&Number.isInteger(t.file_idx)&&t.file_idx>=0?t.file_idx:n,f=e.role==="assistant"?`AI generated: ${String(o.name||"")} as ${String(o.stored_name||"")} #${d}`:`file uploaded: ${String(o.name||"")} as ${String(o.stored_name||"")} #${d}`;A(p.append({params:{cardId:e.cardId},body:{role:"system",text:f,files:[],turn:e.turn}}),"chatStore.append(system attachment message)");}),r.map(t=>t.file)}async function de(e){let r=String(e.cardId||"").trim(),t=String(e.role||"user").trim()||"user",n=typeof e.turn=="string"?e.turn:"";if(!r)throw new Error("manageAddChatAttachment requires cardId");let o=await K({cardId:r,role:t,turn:n,files:e.files});return {status:"success",data:{cardId:r,turn:n,files:o}}}async function ce(e){let r=String(e.cardId||"").trim(),t=String(e.role||"").trim(),n=typeof e.text=="string"?e.text:"",o=typeof e.turn=="string"?e.turn:"";if(!r)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!t)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(t==="assistant"&&o){let g=A(p.readAll({params:{cardId:r},body:{turnId:o}}),"chatStore.readAll(existing turn messages)"),_=Array.isArray(g.records)?g.records.find(v=>v.role==="assistant"&&String(v.turn||"")===o):void 0;if(_)return {status:"success",data:{cardId:r,id:String(_.id),role:t,turn:o,files:Array.isArray(_.files)?_.files:[]}}}let d=await K({cardId:r,role:t,turn:o,files:e.files}),f=A(p.append({params:{cardId:r},body:{role:t,text:n,files:d,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:r,id:String(f.id),role:t,turn:o,files:d}}}async function ue(e){let r=String(e.cardId||"").trim(),t=a(e.patch);if(!r)throw new Error("managePatchCard requires cardId");let n=await z({cardId:r}),o=a(n[0]),d=ve(o,t);return J({cardId:r,candidateCardContent:d})}async function J(e){let r=String(e.cardId||"").trim(),t=a(e.candidateCardContent),n=E(t);if(!r)throw new Error("manageUpsertCard requires cardId");if(typeof n.id!="string"||!n.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(n.id!==r)throw new Error(`candidateCardContent.id must match cardId (${r})`);let o=await D({candidateCardContent:n}),d=a(o),f=a(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let g=null;try{g=await T(u,r);}catch{g=null;}let _=g&&ke(a(g),"meta")?{...n,meta:a(g).meta}:n,v=await u.set({body:_});A(v,"cardStore.set");let I;try{I=await i.upsertCard({params:{cardId:r,restart:!0}}),A(I,"upsertCard");}catch(l){try{g&&await u.set({body:g});}catch{}throw l}let w=null;try{w=await i.cardRefreshedNotify({params:{cardId:r}}),A(w,"cardRefreshedNotify");}catch{w=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:I,refresh_notify:w}}}async function le(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("manageRemoveCard requires cardId");let t=await i.removeCard({params:{id:r}});A(t,"removeCard");let n=await u.del({params:{id:r}});return A(n,"cardStore.del"),{status:"success",data:{board_result:t,store_result:n}}}async function me(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("adminReadCard requires cardId");let t=await M(u.get({params:{id:r}}),"cardStore.get");return Array.isArray(t.cards)?t.cards.map(n=>a(n)):[]}async function pe(e){let r=String(e.cardId||"").trim(),t=a(e.candidateCardContent),n=E(t);if(!r)throw new Error("adminUpsertCard requires cardId");if(typeof n.id!="string"||!n.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(n.id!==r)throw new Error(`candidateCardContent.id must match cardId (${r})`);let o=await D({candidateCardContent:n}),d=a(o),f=a(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let g=null;try{g=await T(u,r);}catch{g=null;}let _=g?a(a(g).meta):{},v={...n,meta:{..._,__visible_controlplane_only:true}},I=await u.set({body:v});A(I,"cardStore.set");let w;try{w=await i.upsertCard({params:{cardId:r,restart:!0}}),A(w,"upsertCard");}catch(P){try{g&&await u.set({body:g});}catch{}throw P}let l=null;try{l=await i.cardRefreshedNotify({params:{cardId:r}}),A(l,"cardRefreshedNotify");}catch{l=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:w,refresh_notify:l}}}function fe(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("getChatProcessing requires cardId");let t=H(p.isProcessing({params:{cardId:r}}),"chatStore.isProcessing");return {cardId:r,active:!!t.active}}function ge(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("setChatProcessing requires cardId");if(typeof e.active!="boolean")throw new Error("setChatProcessing requires boolean active");return A(p.setProcessing({params:{cardId:r},body:{active:e.active}}),"chatStore.setProcessing"),{cardId:r,active:e.active}}async function we(){let e=await B(k,"webhook.process-accumulated")();return e?.status==="fail"||e?.status==="error"?e:{status:"success",data:{runtime_result:Object.prototype.hasOwnProperty.call(e??{},"data")?e.data??null:null}}}async function Ce(e){let r=String(e.token||"").trim(),t=String(e.ref||"").trim();if(!r)throw new Error("webhookSourceFetchDone requires token");if(!t)throw new Error("webhookSourceFetchDone requires ref");let n=await B(R,"webhook.source-fetch-done")({token:r,ref:t});return n?.status==="fail"||n?.status==="error"?n:{status:"success",data:{token:r,ref:t,runtime_result:Object.prototype.hasOwnProperty.call(n??{},"data")?n.data??null:null}}}async function ye(e){let r=String(e.token||"").trim(),t=String(e.reason||"").trim();if(!r)throw new Error("webhookSourceFetchFailed requires token");if(!t)throw new Error("webhookSourceFetchFailed requires reason");let n=await B(b,"webhook.source-fetch-failed")({token:r,reason:t});return n?.status==="fail"||n?.status==="error"?n:{status:"success",data:{token:r,reason:t,runtime_result:Object.prototype.hasOwnProperty.call(n??{},"data")?n.data??null:null}}}return {listRuntimeCards:F,discoverSourceKinds:Y,inspectBoardRuntimeStatus:Z,inspectCardDefinitionAndRuntime:ee,inspectChatMessagesOnCards:re,inspectFileContents:te,preflightValidateCandidateCardDefinition:D,preflightMaterializeCandidateCard:ne,preflightProbeSingleSourceInCandidateCard:ae,preflightRunSingleSourceInCandidateCard:oe,preflightRunSingleSourceInLiveCard:se,preflightRunOneCycleWithCandidateCard:ie,manageReadCard:z,manageAddChatAttachment:de,manageAddChatEntryAndAnyAttachments:ce,managePatchCard:ue,manageUpsertCard:J,manageRemoveCard:le,adminReadCard:me,adminUpsertCard:pe,getChatProcessing:fe,setChatProcessing:ge,webhookProcessAccumulated:we,webhookSourceFetchDone:Ce,webhookSourceFetchFailed:ye}}async function M(s,i){return A(await s,i)}exports.a=Ae;//# sourceMappingURL=chunk-M6STQR5F.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-M6STQR5F.cjs.map
|