yaml-flow 8.4.23 → 8.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/asset-integrity.json +3 -3
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +1 -1
- package/cli/browser-api/board-live-cards-browser-adapter.js +1 -1
- package/cli/bundled/board-live-cards-cli.mjs +14 -14
- package/cli/bundled/chat-store-cli.mjs +6 -6
- package/cli/{types-juH2nFpz.d.ts → types-D2s3VzyY.d.ts} +3 -2
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board/server/board-server.js +8 -0
- package/examples/board/server/chat-flow/copilot-chat/assistant.js +4 -2
- package/examples/board/server/chat-flow/flow-steps.json +70 -10
- package/examples/board/test/server-http-mcp-test.js +791 -0
- package/examples/board/test/server-http-test.js +32 -15
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- 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 +2 -0
- package/lib/board-live-cards-mcp.d.cts +259 -0
- package/lib/board-live-cards-mcp.d.ts +259 -0
- package/lib/board-live-cards-mcp.js +2 -0
- package/lib/board-live-cards-node.cjs +14 -14
- package/lib/board-live-cards-node.d.cts +8 -6
- package/lib/board-live-cards-node.d.ts +8 -6
- package/lib/board-live-cards-node.js +14 -14
- package/lib/{board-live-cards-public-B4RcYPC_.d.cts → board-live-cards-public-CvkDfZQ7.d.cts} +1 -1
- package/lib/{board-live-cards-public-ydXuA4zh.d.ts → board-live-cards-public-DdVhH4M-.d.ts} +1 -1
- 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 +5 -4
- package/lib/board-live-cards-server-runtime.d.cts +3 -3
- package/lib/board-live-cards-server-runtime.d.ts +3 -3
- package/lib/board-live-cards-server-runtime.js +5 -4
- package/lib/card-store-public.d.cts +1 -1
- package/lib/card-store-public.d.ts +1 -1
- package/lib/{chat-storage-lib-B1wU27y3.d.cts → chat-storage-lib-0imhRX3l.d.cts} +2 -1
- package/lib/{chat-storage-lib-DsF4kPon.d.ts → chat-storage-lib-CJn7a6OH.d.ts} +2 -1
- package/lib/chat-store-public.cjs +1 -1
- package/lib/chat-store-public.d.cts +2 -2
- package/lib/chat-store-public.d.ts +2 -2
- package/lib/chat-store-public.js +1 -1
- package/lib/server-runtime/index.cjs +5 -4
- package/lib/server-runtime/index.d.cts +4 -4
- package/lib/server-runtime/index.d.ts +4 -4
- package/lib/server-runtime/index.js +5 -4
- package/lib/{types-D501gMQt.d.cts → types-NM_d_1oZ.d.cts} +5 -2
- package/lib/{types-1L1D33mr.d.ts → types-QNI__eAf.d.ts} +5 -2
- package/package.json +10 -2
- package/browser/board-livecards-localstorage.js +0 -10
|
@@ -50,6 +50,7 @@ const BOARD_DIR = path.resolve(__dirname, '..');
|
|
|
50
50
|
const SERVER_SCRIPT = path.resolve(BOARD_DIR, 'server', 'board-server.js');
|
|
51
51
|
const SSE_WORKER_SCRIPT = path.join(__dirname, 'sse-worker.js');
|
|
52
52
|
const CARD_PATTERN = 'cardT*';
|
|
53
|
+
const T2_FILE_CARD_ID = 'card-market-prices';
|
|
53
54
|
const CHAT_CARD_ID = 'card-portfolio';
|
|
54
55
|
|
|
55
56
|
function findFreePort() {
|
|
@@ -236,6 +237,7 @@ function deriveProbeLifecycleMilestones(events, opts) {
|
|
|
236
237
|
let prevMessageCount = Number(opts.beforeCount || 0);
|
|
237
238
|
let prevProcessing = Boolean(opts.beforeProcessing);
|
|
238
239
|
const prompt = String(opts.prompt || '');
|
|
240
|
+
const assistantText = opts.assistantText == null ? `Echo: ${prompt}` : String(opts.assistantText);
|
|
239
241
|
const inProgressText = String(opts.inProgressText || PROBE_IN_PROGRESS_TEXT);
|
|
240
242
|
|
|
241
243
|
for (const event of events) {
|
|
@@ -250,7 +252,7 @@ function deriveProbeLifecycleMilestones(events, opts) {
|
|
|
250
252
|
const text = String(message?.text || '');
|
|
251
253
|
if (role === 'user' && text.includes(prompt)) milestones.push('user');
|
|
252
254
|
else if (role === 'system' && text.trim().toLowerCase() === inProgressText) milestones.push('in-progress');
|
|
253
|
-
else if (role === 'assistant' && text.includes(
|
|
255
|
+
else if (role === 'assistant' && text.includes(assistantText)) milestones.push('assistant');
|
|
254
256
|
}
|
|
255
257
|
|
|
256
258
|
const processing = Boolean(event?.processing);
|
|
@@ -510,7 +512,7 @@ try {
|
|
|
510
512
|
console.log('\n=== T2: skipped (--skip-t2) ===');
|
|
511
513
|
} else {
|
|
512
514
|
console.log('\n=== T2: plain file upload -> card_data.files -> download ===');
|
|
513
|
-
const t2CardBefore = await httpGet(`${BASE}/cards/${
|
|
515
|
+
const t2CardBefore = await httpGet(`${BASE}/cards/${T2_FILE_CARD_ID}`);
|
|
514
516
|
assert(t2CardBefore.status === 200, `T2 pre card read returned ${t2CardBefore.status}`);
|
|
515
517
|
const t2FilesBefore = Array.isArray(t2CardBefore.data?.card_data?.files)
|
|
516
518
|
? t2CardBefore.data.card_data.files
|
|
@@ -520,7 +522,7 @@ try {
|
|
|
520
522
|
const t2UploadText = `plain-file-upload-${Date.now()}`;
|
|
521
523
|
const t2UploadName = 't2-upload.txt';
|
|
522
524
|
const t2UploadRes = await httpUploadChatFile(
|
|
523
|
-
`${BASE}/cards/${
|
|
525
|
+
`${BASE}/cards/${T2_FILE_CARD_ID}/files`,
|
|
524
526
|
t2UploadName,
|
|
525
527
|
t2UploadText,
|
|
526
528
|
);
|
|
@@ -529,7 +531,7 @@ try {
|
|
|
529
531
|
assert(t2UploadedFile && typeof t2UploadedFile === 'object', 'T2 upload response missing file metadata');
|
|
530
532
|
assert(String(t2UploadedFile?.name || '') === t2UploadName, 'T2 uploaded file name mismatch');
|
|
531
533
|
|
|
532
|
-
const t2CardAfter = await httpGet(`${BASE}/cards/${
|
|
534
|
+
const t2CardAfter = await httpGet(`${BASE}/cards/${T2_FILE_CARD_ID}`);
|
|
533
535
|
assert(t2CardAfter.status === 200, `T2 post card read returned ${t2CardAfter.status}`);
|
|
534
536
|
const t2FilesAfter = Array.isArray(t2CardAfter.data?.card_data?.files)
|
|
535
537
|
? t2CardAfter.data.card_data.files
|
|
@@ -540,7 +542,7 @@ try {
|
|
|
540
542
|
assert(t2FileIndex >= 0, 'T2 uploaded file metadata not found in card_data.files');
|
|
541
543
|
|
|
542
544
|
const t2DownloadRes = await httpGetRaw(
|
|
543
|
-
`${BASE}/cards/${
|
|
545
|
+
`${BASE}/cards/${T2_FILE_CARD_ID}/files/${t2FileIndex}?sn=${encodeURIComponent(String(t2UploadedFile?.stored_name || ''))}`,
|
|
544
546
|
);
|
|
545
547
|
assert(t2DownloadRes.status === 200, `T2 file download returned ${t2DownloadRes.status}`);
|
|
546
548
|
const t2DownloadedText = t2DownloadRes.body.toString('utf-8');
|
|
@@ -563,7 +565,7 @@ try {
|
|
|
563
565
|
const subRes = await httpJson('POST', `${BASE}/cards/${CHAT_CARD_ID}/chats/subscribe-sse`, { clientId: chatSseClientId });
|
|
564
566
|
assert(subRes.status === 200, `chat subscribe returned ${subRes.status}`);
|
|
565
567
|
|
|
566
|
-
const t2Before = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats`);
|
|
568
|
+
const t2Before = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats?all-turns=true`);
|
|
567
569
|
assert(t2Before.status === 200, `T3 pre chats returned ${t2Before.status}`);
|
|
568
570
|
const t2BeforeMessages = Array.isArray(t2Before.data?.messages) ? t2Before.data.messages : [];
|
|
569
571
|
const t2BeforeCount = t2BeforeMessages.length;
|
|
@@ -588,7 +590,7 @@ try {
|
|
|
588
590
|
}, 45_000, 'T3 ordered lifecycle');
|
|
589
591
|
assert(!!t2Lifecycle, 'T3 ordered lifecycle not observed');
|
|
590
592
|
|
|
591
|
-
const t2After = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats`);
|
|
593
|
+
const t2After = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats?all-turns=true`);
|
|
592
594
|
assert(t2After.status === 200, `T3 post chats returned ${t2After.status}`);
|
|
593
595
|
const t2AfterMessages = Array.isArray(t2After.data?.messages) ? t2After.data.messages : [];
|
|
594
596
|
const t2NewMessages = t2AfterMessages.slice(t2BeforeCount);
|
|
@@ -611,7 +613,7 @@ try {
|
|
|
611
613
|
console.log('\n=== T3a: skipped (--skip-t3a) ===');
|
|
612
614
|
} else {
|
|
613
615
|
console.log('\n=== T3a: non-probe chat protocol (expect paris) ===');
|
|
614
|
-
const t2aBefore = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats`);
|
|
616
|
+
const t2aBefore = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats?all-turns=true`);
|
|
615
617
|
assert(t2aBefore.status === 200, `T3a pre chats returned ${t2aBefore.status}`);
|
|
616
618
|
const t2aBeforeMessages = Array.isArray(t2aBefore.data?.messages) ? t2aBefore.data.messages : [];
|
|
617
619
|
const t2aBeforeCount = t2aBeforeMessages.length;
|
|
@@ -639,7 +641,7 @@ try {
|
|
|
639
641
|
}, 240_000, 'T3a assistant response with paris');
|
|
640
642
|
assert(!!t2aAssistant, 'T3a assistant response with paris not observed on SSE');
|
|
641
643
|
|
|
642
|
-
const t2aAfter = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats`);
|
|
644
|
+
const t2aAfter = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats?all-turns=true`);
|
|
643
645
|
assert(t2aAfter.status === 200, `T3a post chats returned ${t2aAfter.status}`);
|
|
644
646
|
const t2aAfterMessages = Array.isArray(t2aAfter.data?.messages) ? t2aAfter.data.messages : [];
|
|
645
647
|
const t2aNewMessages = t2aAfterMessages.slice(t2aBeforeCount);
|
|
@@ -655,7 +657,7 @@ try {
|
|
|
655
657
|
console.log('\n=== T3b: skipped (--skip-t3b) ===');
|
|
656
658
|
} else {
|
|
657
659
|
console.log('\n=== T3b: probe-echo chat with file upload protocol ===');
|
|
658
|
-
const t2bBefore = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats`);
|
|
660
|
+
const t2bBefore = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats?all-turns=true`);
|
|
659
661
|
assert(t2bBefore.status === 200, `T3b pre chats returned ${t2bBefore.status}`);
|
|
660
662
|
const t2bBeforeMessages = Array.isArray(t2bBefore.data?.messages) ? t2bBefore.data.messages : [];
|
|
661
663
|
const t2bBeforeCount = t2bBeforeMessages.length;
|
|
@@ -663,13 +665,13 @@ try {
|
|
|
663
665
|
const t2bUploadRes = await httpUploadChatFile(
|
|
664
666
|
`${BASE}/cards/${CHAT_CARD_ID}/files?inChat=true`,
|
|
665
667
|
'q1.txt',
|
|
666
|
-
'
|
|
668
|
+
'tokyo',
|
|
667
669
|
);
|
|
668
670
|
assert(t2bUploadRes.status === 200, `T3b file upload returned ${t2bUploadRes.status}`);
|
|
669
671
|
const uploadedFile = t2bUploadRes.data?.file;
|
|
670
672
|
assert(uploadedFile && typeof uploadedFile === 'object', 'T3b upload response missing file metadata');
|
|
671
673
|
|
|
672
|
-
const t2bAfterUpload = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats`);
|
|
674
|
+
const t2bAfterUpload = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats?all-turns=true`);
|
|
673
675
|
assert(t2bAfterUpload.status === 200, `T3b chats after upload returned ${t2bAfterUpload.status}`);
|
|
674
676
|
const t2bUploadMessages = Array.isArray(t2bAfterUpload.data?.messages) ? t2bAfterUpload.data.messages : [];
|
|
675
677
|
const t2bUploadNewMessages = t2bUploadMessages.slice(t2bBeforeCount);
|
|
@@ -677,6 +679,20 @@ try {
|
|
|
677
679
|
assert(!!t2bUploadSystem, 'T3b upload protocol missing system chat file');
|
|
678
680
|
assert(String(t2bUploadSystem?.text || '').toLowerCase().includes('file uploaded:'), 'T3b upload system message does not describe uploaded file');
|
|
679
681
|
|
|
682
|
+
const t2bCardAfterUpload = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}`);
|
|
683
|
+
assert(t2bCardAfterUpload.status === 200, `T3b card read after upload returned ${t2bCardAfterUpload.status}`);
|
|
684
|
+
const t2bFilesAfterUpload = Array.isArray(t2bCardAfterUpload.data?.card_data?.files)
|
|
685
|
+
? t2bCardAfterUpload.data.card_data.files
|
|
686
|
+
: [];
|
|
687
|
+
const t2bFileIndex = t2bFilesAfterUpload.findIndex((f) => String(f?.stored_name || '') === String(uploadedFile?.stored_name || ''));
|
|
688
|
+
assert(t2bFileIndex >= 0, 'T3b uploaded file metadata not found in card_data.files');
|
|
689
|
+
|
|
690
|
+
const t2bDownloadRes = await httpGetRaw(
|
|
691
|
+
`${BASE}/cards/${CHAT_CARD_ID}/files/${t2bFileIndex}?sn=${encodeURIComponent(String(uploadedFile?.stored_name || ''))}`,
|
|
692
|
+
);
|
|
693
|
+
assert(t2bDownloadRes.status === 200, `T3b file download returned ${t2bDownloadRes.status}`);
|
|
694
|
+
assert(t2bDownloadRes.body.toString('utf-8') === 'tokyo', 'T3b downloaded content mismatch');
|
|
695
|
+
|
|
680
696
|
const t2bSendBaseline = t2bUploadMessages.length;
|
|
681
697
|
const t2bEventStart = NS.chatEvents.length;
|
|
682
698
|
|
|
@@ -695,12 +711,13 @@ try {
|
|
|
695
711
|
beforeCount: t2bSendBaseline,
|
|
696
712
|
beforeProcessing: false,
|
|
697
713
|
prompt: t2bPrompt,
|
|
714
|
+
assistantText: 'tokyo',
|
|
698
715
|
inProgressText: PROBE_IN_PROGRESS_TEXT,
|
|
699
716
|
});
|
|
700
717
|
}, 60_000, 'T3b ordered lifecycle');
|
|
701
718
|
assert(!!t2bLifecycle, 'T3b ordered lifecycle not observed');
|
|
702
719
|
|
|
703
|
-
const t2bAfter = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats`);
|
|
720
|
+
const t2bAfter = await httpGet(`${BASE}/cards/${CHAT_CARD_ID}/chats?all-turns=true`);
|
|
704
721
|
assert(t2bAfter.status === 200, `T3b post chats returned ${t2bAfter.status}`);
|
|
705
722
|
const t2bAfterMessages = Array.isArray(t2bAfter.data?.messages) ? t2bAfter.data.messages : [];
|
|
706
723
|
const t2bNewMessages = t2bAfterMessages.slice(t2bSendBaseline);
|
|
@@ -714,8 +731,8 @@ try {
|
|
|
714
731
|
assert(!!t2bInProgress && typeof t2bInProgress.id === 'string', 'T3b missing in-progress system chat message');
|
|
715
732
|
assert(!!t2bAssistantMsg && typeof t2bAssistantMsg.id === 'string', 'T3b missing assistant chat message notification');
|
|
716
733
|
assert(Array.isArray(t2bUser?.files) && t2bUser.files.length === 1, 'T3b user chat message missing uploaded file metadata');
|
|
717
|
-
assert(String(t2bAssistantMsg?.text || '').
|
|
718
|
-
console.log('[T3b] ok: upload protocol and ordered probe lifecycle observed
|
|
734
|
+
assert(String(t2bAssistantMsg?.text || '').trim() === 'tokyo', 'T3b assistant attachment content mismatch');
|
|
735
|
+
console.log('[T3b] ok: upload protocol and ordered probe lifecycle observed with attachment-derived assistant reply');
|
|
719
736
|
}
|
|
720
737
|
}
|
|
721
738
|
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
<title>Example Board Demo (LocalStorage Runtime)</title>
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="../../browser/favicon.svg" />
|
|
8
8
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />
|
|
9
|
-
<script src="https://cdn.jsdelivr.net/npm/yaml-flow@8.
|
|
9
|
+
<script src="https://cdn.jsdelivr.net/npm/yaml-flow@8.5.0/browser/compute-jsonata.js"></script>
|
|
10
10
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
11
11
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
|
12
12
|
<script src="https://cdn.jsdelivr.net/npm/dompurify/dist/purify.min.js"></script>
|
|
13
13
|
<script src="https://cdn.jsdelivr.net/npm/leader-line/leader-line.min.js"></script>
|
|
14
|
-
<script src="https://cdn.jsdelivr.net/npm/yaml-flow@8.
|
|
15
|
-
<script src="https://cdn.jsdelivr.net/npm/yaml-flow@8.
|
|
14
|
+
<script src="https://cdn.jsdelivr.net/npm/yaml-flow@8.5.0/browser/live-cards.js"></script>
|
|
15
|
+
<script src="https://cdn.jsdelivr.net/npm/yaml-flow@8.5.0/browser/board-livecards-localstorage.js"></script>
|
|
16
16
|
</head>
|
|
17
17
|
<body class="bg-light">
|
|
18
18
|
<div class="container-fluid py-3">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as CommandInput, C as CommandResult } from './board-live-cards-public-CvkDfZQ7.cjs';
|
|
2
2
|
import { A as ArtifactInfo, a as ArtifactsStore } from './artifacts-store-lib-CVgtQrNZ.cjs';
|
|
3
3
|
import './storage-interface-B2WD9D5n.cjs';
|
|
4
4
|
import './execution-refs.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as CommandInput, C as CommandResult } from './board-live-cards-public-DdVhH4M-.js';
|
|
2
2
|
import { A as ArtifactInfo, a as ArtifactsStore } from './artifacts-store-lib-D-k-E8Vy.js';
|
|
3
3
|
import './storage-interface-B2WD9D5n.js';
|
|
4
4
|
import './execution-refs.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';function m(a,i){if(a?.status==="success")return Object.prototype.hasOwnProperty.call(a,"data")?a.data:void 0;throw a?.status==="fail"||a?.status==="error"?new Error(a.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function d(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function C(a){return Array.isArray(a)?a:[]}function F(a,i){if(typeof i!="string"||i.length===0)return;let c=a,p=i;p.startsWith("fetched_sources.")&&(c=d(a).fetched_sources,p=p.slice(16));for(let x of p.split(".")){if(c==null||typeof c!="object")return;c=c[x];}return c}function G(a,i){let c=d(a.view),p=C(c.elements);return {layout:c.layout,features:c.features,elements:p.map((x,T)=>{let k=d(x),v=d(k.data),q=typeof k.visible=="string"?!!F(i,k.visible):true,A=typeof v.bind=="string"?v.bind:void 0,M=A?F(i,A):void 0,I={id:typeof k.id=="string"&&k.id?k.id:`element-${T}`,kind:k.kind,label:k.label,visible:q};return A&&(I.bind=A),Array.isArray(v.columns)&&(I.columns=v.columns),typeof v.maxRows=="number"&&(I.maxRows=v.maxRows),M!==void 0&&(I.resolved=Array.isArray(M)&&typeof I.maxRows=="number"?M.slice(0,I.maxRows):M),I})}}function Q(a){if(typeof a!="string"||!a.trim())return null;let i=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(a.trim());if(!i)return null;let c=Number.parseInt(i[2],10);return !Number.isInteger(c)||c<0?null:c}function X(a){return {"card-content":a}}function O(a,i){let c=m(a.get({params:{id:i}}),"cardStore.get"),p=Array.isArray(c?.cards)?c.cards:[];if(p.length===0)throw new Error(`Card "${i}" not found`);return p[0]}function Z(a){let{board:i,nonCore:c,cardStore:p,chatStore:x,uploadCardFile:T,buildFileDownloadUrl:k,readFetchedSourceJsonByRef:v}=a;function q(r){if(Array.isArray(r.bytes))return new Uint8Array(r.bytes.map(e=>Math.max(0,Math.min(255,Number(e)||0))));if(typeof r.text=="string")return new TextEncoder().encode(r.text);if(typeof r.base64=="string"){let e=String(r.base64).replace(/-/g,"+").replace(/_/g,"/"),n=e+"=".repeat((4-e.length%4)%4),f=atob(n);return Uint8Array.from(f,o=>o.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}function A(){let r=d(m(c.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:r.version,commonSourceFields:d(r.commonSourceDefFields),sourceKinds:d(r.sourceKinds)}}function M(){let r=d(m(i.status({}),"status")),e=d(r.summary),n=C(r.cards);return {meta:d(r.meta),summary:{card_count:typeof e.card_count=="number"?e.card_count:0,completed:typeof e.completed=="number"?e.completed:0,eligible:typeof e.eligible=="number"?e.eligible:0,pending:typeof e.pending=="number"?e.pending:0,blocked:typeof e.blocked=="number"?e.blocked:0,in_progress:typeof e.in_progress=="number"?e.in_progress:0,failed:typeof e.failed=="number"?e.failed:0,unresolved:typeof e.unresolved=="number"?e.unresolved:0},cards:n.map(f=>{let o=d(f);return {"card-id":typeof o.name=="string"?o.name:null,status:o.status??null,error:o.error??null,requires:C(o.requires),requires_satisfied:C(o.requires_satisfied),requires_missing:C(o.requires_missing),provides_declared:C(o.provides_declared),provides_runtime:C(o.provides_runtime)}})}}function I(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let n=d(m(i.status({}),"status")),o=C(n.cards).map(d).find(s=>s.name===e);if(!o)throw new Error(`card "${e}" not found in board status`);let t=d(O(p,e)),g=C(o.requires_satisfied).filter(s=>typeof s=="string"&&!!s),b=C(o.provides_runtime).filter(s=>typeof s=="string"&&!!s),l=Object.fromEntries(g.map(s=>[s,m(i.getOutputsDataObject({params:{key:s}}),`getOutputsDataObject(${s})`)])),w=Object.fromEntries(b.map(s=>[s,m(i.getOutputsDataObject({params:{key:s}}),`getOutputsDataObject(${s})`)])),_=d(m(i.getOutputsComputedValues({params:{key:e}}),"getOutputsComputedValues")),U=m(i.getOutputsFetchedSources({params:{key:e}}),"getOutputsFetchedSources"),L=C(t.source_defs).map(d),u={};for(let s of L)typeof s.bindTo=="string"&&typeof s.outputFile=="string"&&(u[s.outputFile]=s.bindTo);let h={};for(let[s,B]of Object.entries(U)){let y=u[s]??s;if(!v||typeof B!="string"){h[y]=null;continue}try{h[y]=v({cardId:e,ref:B});}catch{h[y]=null;}}let R={card_data:d(t.card_data),requires:l,fetched_sources:h,computed_values:_};return {cardId:e,card_status_in_board:o,card_definition_and_static_data:t,refs_for_fetched_source_files:U,runtime_data:{requires:l,provides:w,computed_values:_,rendered_view:G(t,R)}}}function j(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectChatMessagesOnCards requires cardId");let n=typeof r.turnId=="string"?r.turnId:"",f=r.allTurns===true,o=typeof r.tailTurnsBeforeId=="string"?r.tailTurnsBeforeId:"",t=f?void 0:r.lastUserTurns??(n?void 0:1),g=r.tail,b=t===void 0?{params:{cardId:e}}:{params:{cardId:e},body:{lastUserTurns:t}},l=m(x.readAll(b),"chatStore.readAll"),w=d(O(p,e)),_=C(d(w.card_data).files).map((u,h)=>({idx:h,stored_name:d(u).stored_name})).filter(u=>typeof u.stored_name=="string"&&u.stored_name.length>0),U=(Array.isArray(l.records)?l.records:[]).filter(u=>n?typeof u?.turn=="string"?u.turn===n:n==="":true);if(o){if(t===void 0||!Number.isInteger(t)||t<=0)throw new Error("inspectChatMessagesOnCards requires tail-turns when tail-turns-before-id is provided");let u=new Map,h=[];for(let y of Array.isArray(l.records)?l.records:[]){let S=typeof y?.turn=="string"?y.turn:"";u.has(S)||(u.set(S,[]),h.push(S)),u.get(S).push(y);}let R=h.findIndex(y=>y===o),s=Math.max(0,R-t);U=(R===-1?[]:h.slice(s,R)).flatMap(y=>u.get(y)??[]);}let L=U.map(u=>{let R=d(u.payload),s={...u},B=typeof u?.role=="string"?u.role:typeof R.role=="string"?String(R.role):"",y=typeof u?.text=="string"?u.text:typeof R.text=="string"?String(R.text):"";if(B==="system"){let S=Q(y);if(S!==null&&_.some(D=>D.idx===S)){let D=`Retrieve using inspect-file-contents --card-id ${e} --file-idx ${S}`;s.retrieval_hint=D,Object.keys(R).length>0&&typeof u.role!="string"&&(s.payload={...R,retrieval_hint:D});}}return s});return {cardId:e,messages:typeof g=="number"&&g>=0?L.slice(-g):L}}function P(r){let e=String(r.cardId||"").trim(),n=Number(r.fileIdx);if(!e)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(n)||n<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let f=d(O(p,e)),o=C(d(f.card_data).files).map(d);if(n>=o.length)throw new Error(`attachment index ${n} is out of range for card "${e}"`);let t=o[n],g=typeof t.stored_name=="string"?t.stored_name:null;return {cardId:e,fileIdx:n,downloadUrl:k({cardId:e,fileIdx:n,storedName:g}),...typeof t.name=="string"?{name:t.name}:{},...typeof t.stored_name=="string"?{stored_name:t.stored_name}:{},...typeof t.mime_type=="string"?{mime_type:t.mime_type}:{},...typeof t.size=="number"?{size:t.size}:{},...typeof t.uploaded_at=="string"?{uploaded_at:t.uploaded_at}:{}}}function E(r){return c.validateCardPreflight({body:X(r.candidateCardContent)})}function $(r){return c.evalCardCompute({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires,"mock-fetched-sources":r.mockFetchedSources}})}function N(r){return c.probeSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}function V(r){return c.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}function K(r){return c.simulateCardCycle({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires}})}function z(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageReadCard requires cardId");let n=m(p.get({params:{id:e}}),"cardStore.get");return Array.isArray(n.cards)?n.cards:[]}function W(r){let e=String(r.cardId||"").trim(),n=String(r.role||"").trim(),f=typeof r.text=="string"?r.text:"",o=typeof r.turn=="string"?r.turn:"";if(!e)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!n)throw new Error("manageAddChatEntryAndAnyAttachments requires role");let t=C(r.files).map(b=>{let l=d(b),w=String(l.file_name??l.fileName??l.name??"").trim(),_=String(l.content_type??l.contentType??"application/octet-stream");if(!w)throw new Error("file entry requires file_name");return T({cardId:e,fileName:w,contentType:_,bytes:q(l)}).file});t.forEach((b,l)=>{let w=n==="assistant"?`AI generated: ${String(b.name||"")} as ${String(b.stored_name||"")} #${l}`:`file uploaded: ${String(b.name||"")} as ${String(b.stored_name||"")} #${l}`;m(x.append({params:{cardId:e},body:{role:"system",text:w,files:[],turn:o}}),"chatStore.append(system attachment message)");});let g=m(x.append({params:{cardId:e},body:{role:n,text:f,files:t,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:e,id:String(g.id),role:n,turn:o,files:t}}}function J(r){let e=String(r.cardId||"").trim(),n=d(r.candidateCardContent);if(!e)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!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let f=E({candidateCardContent:n}),o=d(f),t=d(o.data);if(o.status!=="success"||t.isValid!==true)return {status:"fail",step:"validate",validation:f};let g=null;try{g=O(p,e);}catch{g=null;}let b=p.set({body:n});m(b,"cardStore.set");let l;try{l=i.upsertCard({params:{cardId:e,restart:!0}}),m(l,"upsertCard");}catch(_){try{g&&p.set({body:g});}catch{}throw _}let w=null;try{w=i.cardRefreshedNotify({params:{cardId:e}}),m(w,"cardRefreshedNotify");}catch{w=null;}return {status:"success",data:{validation:f,card_saved:null,board_result:l,refresh_notify:w}}}function H(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageDeprecate requires cardId");let n=i.removeCard({params:{id:e}});return m(n,"removeCard"),n}return {discoverSourceKinds:A,inspectBoardRuntimeStatus:M,inspectCardDefinitionAndRuntime:I,inspectChatMessagesOnCards:j,inspectFileContents:P,preflightValidateCandidateCardDefinition:E,preflightMaterializeCandidateCard:$,preflightProbeSingleSourceInCandidateCard:N,preflightRunSingleSourceInCandidateCard:V,preflightRunOneCycleWithCandidateCard:K,manageReadCard:z,manageAddChatEntryAndAnyAttachments:W,manageUpsertCard:J,manageDeprecate:H}}exports.createBoardLiveCardsMcp=Z;//# sourceMappingURL=board-live-cards-mcp.cjs.map
|
|
2
|
+
//# sourceMappingURL=board-live-cards-mcp.cjs.map
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { L as LiveCard, C as CommandResult } from './board-live-cards-public-CvkDfZQ7.cjs';
|
|
2
|
+
import { CardStorePublic } from './card-store-public.cjs';
|
|
3
|
+
import { ChatStorePublic } from './chat-store-public.cjs';
|
|
4
|
+
import { C as ChatRecord } from './chat-storage-lib-0imhRX3l.cjs';
|
|
5
|
+
import './storage-interface-B2WD9D5n.cjs';
|
|
6
|
+
import './execution-refs.cjs';
|
|
7
|
+
import './types-BBhqYGhE.cjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* board-live-cards-mcp.ts
|
|
11
|
+
*
|
|
12
|
+
* Platform-free MCP-oriented facade for board-live-cards.
|
|
13
|
+
*
|
|
14
|
+
* This layer preserves the wrapper-script-visible tool semantics while using
|
|
15
|
+
* the existing public library surfaces instead of shelling out to CLIs.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
type UnknownRecord = Record<string, unknown>;
|
|
19
|
+
interface BoardLiveCardsMcpFileDownloadDescriptor {
|
|
20
|
+
cardId: string;
|
|
21
|
+
fileIdx: number;
|
|
22
|
+
downloadUrl: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
stored_name?: string;
|
|
25
|
+
mime_type?: string;
|
|
26
|
+
size?: number;
|
|
27
|
+
uploaded_at?: string;
|
|
28
|
+
}
|
|
29
|
+
interface BoardLiveCardsMcpDiscoverSourceKindsResult {
|
|
30
|
+
version?: unknown;
|
|
31
|
+
commonSourceFields: UnknownRecord;
|
|
32
|
+
sourceKinds: UnknownRecord;
|
|
33
|
+
}
|
|
34
|
+
interface BoardLiveCardsMcpBoardStatusCard {
|
|
35
|
+
'card-id': string | null;
|
|
36
|
+
status: unknown;
|
|
37
|
+
error: unknown;
|
|
38
|
+
requires: unknown[];
|
|
39
|
+
requires_satisfied: unknown[];
|
|
40
|
+
requires_missing: unknown[];
|
|
41
|
+
provides_declared: unknown[];
|
|
42
|
+
provides_runtime: unknown[];
|
|
43
|
+
}
|
|
44
|
+
interface BoardLiveCardsMcpBoardStatusResult {
|
|
45
|
+
meta: UnknownRecord;
|
|
46
|
+
summary: {
|
|
47
|
+
card_count: number;
|
|
48
|
+
completed: number;
|
|
49
|
+
eligible: number;
|
|
50
|
+
pending: number;
|
|
51
|
+
blocked: number;
|
|
52
|
+
in_progress: number;
|
|
53
|
+
failed: number;
|
|
54
|
+
unresolved: number;
|
|
55
|
+
};
|
|
56
|
+
cards: BoardLiveCardsMcpBoardStatusCard[];
|
|
57
|
+
}
|
|
58
|
+
interface BoardLiveCardsMcpRenderedViewElement {
|
|
59
|
+
id: string;
|
|
60
|
+
kind: unknown;
|
|
61
|
+
label: unknown;
|
|
62
|
+
visible: boolean;
|
|
63
|
+
bind?: string;
|
|
64
|
+
columns?: unknown[];
|
|
65
|
+
maxRows?: number;
|
|
66
|
+
resolved?: unknown;
|
|
67
|
+
}
|
|
68
|
+
interface BoardLiveCardsMcpRenderedView {
|
|
69
|
+
layout: unknown;
|
|
70
|
+
features: unknown;
|
|
71
|
+
elements: BoardLiveCardsMcpRenderedViewElement[];
|
|
72
|
+
}
|
|
73
|
+
interface BoardLiveCardsMcpInspectCardDefinitionAndRuntimeResult {
|
|
74
|
+
cardId: string;
|
|
75
|
+
card_status_in_board: UnknownRecord;
|
|
76
|
+
card_definition_and_static_data: UnknownRecord;
|
|
77
|
+
refs_for_fetched_source_files: Record<string, string>;
|
|
78
|
+
runtime_data: {
|
|
79
|
+
requires: Record<string, unknown>;
|
|
80
|
+
provides: Record<string, unknown>;
|
|
81
|
+
computed_values: UnknownRecord;
|
|
82
|
+
rendered_view: BoardLiveCardsMcpRenderedView;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
interface BoardLiveCardsMcpInspectChatMessagesResult {
|
|
86
|
+
cardId: string;
|
|
87
|
+
messages: Array<ChatRecord & {
|
|
88
|
+
retrieval_hint?: string;
|
|
89
|
+
payload?: UnknownRecord;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
92
|
+
interface BoardLiveCardsMcpManageUpsertCardFailureResult {
|
|
93
|
+
status: 'fail';
|
|
94
|
+
step: 'validate';
|
|
95
|
+
validation: unknown;
|
|
96
|
+
}
|
|
97
|
+
interface BoardLiveCardsMcpManageUpsertCardSuccessResult {
|
|
98
|
+
status: 'success';
|
|
99
|
+
data: {
|
|
100
|
+
validation: unknown;
|
|
101
|
+
card_saved: unknown;
|
|
102
|
+
board_result: unknown;
|
|
103
|
+
refresh_notify: unknown;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
type BoardLiveCardsMcpManageUpsertCardResult = BoardLiveCardsMcpManageUpsertCardFailureResult | BoardLiveCardsMcpManageUpsertCardSuccessResult;
|
|
107
|
+
interface BoardLiveCardsMcpManageAddChatEntryAndAnyAttachmentsResult {
|
|
108
|
+
status: 'success';
|
|
109
|
+
data: {
|
|
110
|
+
cardId: string;
|
|
111
|
+
id: string;
|
|
112
|
+
role: string;
|
|
113
|
+
turn: string;
|
|
114
|
+
files: Array<Record<string, unknown>>;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
interface BoardLiveCardsMcpBoardDeps {
|
|
118
|
+
status(input: {}): CommandResult;
|
|
119
|
+
getOutputsDataObject(input: {
|
|
120
|
+
params: {
|
|
121
|
+
key: string;
|
|
122
|
+
};
|
|
123
|
+
}): CommandResult;
|
|
124
|
+
getOutputsComputedValues(input: {
|
|
125
|
+
params: {
|
|
126
|
+
key: string;
|
|
127
|
+
};
|
|
128
|
+
}): CommandResult;
|
|
129
|
+
getOutputsFetchedSources(input: {
|
|
130
|
+
params: {
|
|
131
|
+
key: string;
|
|
132
|
+
};
|
|
133
|
+
}): CommandResult<Record<string, string>>;
|
|
134
|
+
removeCard(input: {
|
|
135
|
+
params: {
|
|
136
|
+
id: string;
|
|
137
|
+
};
|
|
138
|
+
}): CommandResult;
|
|
139
|
+
cardRefreshedNotify(input: {
|
|
140
|
+
params: {
|
|
141
|
+
cardId: string;
|
|
142
|
+
};
|
|
143
|
+
}): CommandResult;
|
|
144
|
+
upsertCard(input: {
|
|
145
|
+
params: {
|
|
146
|
+
cardId: string;
|
|
147
|
+
restart?: boolean;
|
|
148
|
+
};
|
|
149
|
+
}): CommandResult;
|
|
150
|
+
}
|
|
151
|
+
interface BoardLiveCardsMcpNonCoreDeps {
|
|
152
|
+
describeTaskExecutorCapabilities(input: {}): CommandResult;
|
|
153
|
+
validateCardPreflight(input: {
|
|
154
|
+
body: unknown;
|
|
155
|
+
}): CommandResult;
|
|
156
|
+
evalCardCompute(input: {
|
|
157
|
+
body: unknown;
|
|
158
|
+
}): CommandResult;
|
|
159
|
+
probeSourcePreflight(input: {
|
|
160
|
+
params: {
|
|
161
|
+
sourceIdx: number;
|
|
162
|
+
};
|
|
163
|
+
body: unknown;
|
|
164
|
+
}): CommandResult;
|
|
165
|
+
runSourcePreflight(input: {
|
|
166
|
+
params: {
|
|
167
|
+
sourceIdx: number;
|
|
168
|
+
};
|
|
169
|
+
body: unknown;
|
|
170
|
+
}): CommandResult;
|
|
171
|
+
simulateCardCycle(input: {
|
|
172
|
+
body: unknown;
|
|
173
|
+
}): CommandResult;
|
|
174
|
+
}
|
|
175
|
+
interface BoardLiveCardsMcpDeps {
|
|
176
|
+
board: BoardLiveCardsMcpBoardDeps;
|
|
177
|
+
nonCore: BoardLiveCardsMcpNonCoreDeps;
|
|
178
|
+
cardStore: CardStorePublic;
|
|
179
|
+
chatStore: ChatStorePublic;
|
|
180
|
+
uploadCardFile(args: {
|
|
181
|
+
cardId: string;
|
|
182
|
+
fileName: string;
|
|
183
|
+
contentType: string;
|
|
184
|
+
bytes: Uint8Array;
|
|
185
|
+
}): {
|
|
186
|
+
ok: true;
|
|
187
|
+
file: Record<string, unknown>;
|
|
188
|
+
};
|
|
189
|
+
buildFileDownloadUrl(args: {
|
|
190
|
+
cardId: string;
|
|
191
|
+
fileIdx: number;
|
|
192
|
+
storedName?: string | null;
|
|
193
|
+
}): string;
|
|
194
|
+
readFetchedSourceJsonByRef?(args: {
|
|
195
|
+
cardId: string;
|
|
196
|
+
ref: string;
|
|
197
|
+
}): unknown | null;
|
|
198
|
+
}
|
|
199
|
+
interface BoardLiveCardsMcp {
|
|
200
|
+
discoverSourceKinds(): BoardLiveCardsMcpDiscoverSourceKindsResult;
|
|
201
|
+
inspectBoardRuntimeStatus(): BoardLiveCardsMcpBoardStatusResult;
|
|
202
|
+
inspectCardDefinitionAndRuntime(args: {
|
|
203
|
+
cardId: string;
|
|
204
|
+
}): BoardLiveCardsMcpInspectCardDefinitionAndRuntimeResult;
|
|
205
|
+
inspectChatMessagesOnCards(args: {
|
|
206
|
+
cardId: string;
|
|
207
|
+
lastUserTurns?: number;
|
|
208
|
+
tail?: number;
|
|
209
|
+
turnId?: string;
|
|
210
|
+
allTurns?: boolean;
|
|
211
|
+
tailTurnsBeforeId?: string;
|
|
212
|
+
}): BoardLiveCardsMcpInspectChatMessagesResult;
|
|
213
|
+
inspectFileContents(args: {
|
|
214
|
+
cardId: string;
|
|
215
|
+
fileIdx: number;
|
|
216
|
+
}): BoardLiveCardsMcpFileDownloadDescriptor;
|
|
217
|
+
preflightValidateCandidateCardDefinition(args: {
|
|
218
|
+
candidateCardContent: UnknownRecord;
|
|
219
|
+
}): unknown;
|
|
220
|
+
preflightMaterializeCandidateCard(args: {
|
|
221
|
+
candidateCardContent: UnknownRecord;
|
|
222
|
+
mockRequires: UnknownRecord;
|
|
223
|
+
mockFetchedSources: UnknownRecord;
|
|
224
|
+
}): unknown;
|
|
225
|
+
preflightProbeSingleSourceInCandidateCard(args: {
|
|
226
|
+
candidateCardContent: UnknownRecord;
|
|
227
|
+
mockProjections: UnknownRecord;
|
|
228
|
+
sourceIdx: number;
|
|
229
|
+
}): unknown;
|
|
230
|
+
preflightRunSingleSourceInCandidateCard(args: {
|
|
231
|
+
candidateCardContent: UnknownRecord;
|
|
232
|
+
mockProjections: UnknownRecord;
|
|
233
|
+
sourceIdx: number;
|
|
234
|
+
}): unknown;
|
|
235
|
+
preflightRunOneCycleWithCandidateCard(args: {
|
|
236
|
+
candidateCardContent: UnknownRecord;
|
|
237
|
+
mockRequires: UnknownRecord;
|
|
238
|
+
}): unknown;
|
|
239
|
+
manageReadCard(args: {
|
|
240
|
+
cardId: string;
|
|
241
|
+
}): LiveCard[];
|
|
242
|
+
manageAddChatEntryAndAnyAttachments(args: {
|
|
243
|
+
cardId: string;
|
|
244
|
+
role: string;
|
|
245
|
+
text?: string;
|
|
246
|
+
turn?: string;
|
|
247
|
+
files?: unknown[];
|
|
248
|
+
}): BoardLiveCardsMcpManageAddChatEntryAndAnyAttachmentsResult;
|
|
249
|
+
manageUpsertCard(args: {
|
|
250
|
+
cardId: string;
|
|
251
|
+
candidateCardContent: UnknownRecord;
|
|
252
|
+
}): BoardLiveCardsMcpManageUpsertCardResult;
|
|
253
|
+
manageDeprecate(args: {
|
|
254
|
+
cardId: string;
|
|
255
|
+
}): unknown;
|
|
256
|
+
}
|
|
257
|
+
declare function createBoardLiveCardsMcp(deps: BoardLiveCardsMcpDeps): BoardLiveCardsMcp;
|
|
258
|
+
|
|
259
|
+
export { type BoardLiveCardsMcp, type BoardLiveCardsMcpBoardDeps, type BoardLiveCardsMcpBoardStatusCard, type BoardLiveCardsMcpBoardStatusResult, type BoardLiveCardsMcpDeps, type BoardLiveCardsMcpDiscoverSourceKindsResult, type BoardLiveCardsMcpFileDownloadDescriptor, type BoardLiveCardsMcpInspectCardDefinitionAndRuntimeResult, type BoardLiveCardsMcpInspectChatMessagesResult, type BoardLiveCardsMcpManageAddChatEntryAndAnyAttachmentsResult, type BoardLiveCardsMcpManageUpsertCardFailureResult, type BoardLiveCardsMcpManageUpsertCardResult, type BoardLiveCardsMcpManageUpsertCardSuccessResult, type BoardLiveCardsMcpNonCoreDeps, type BoardLiveCardsMcpRenderedView, type BoardLiveCardsMcpRenderedViewElement, createBoardLiveCardsMcp };
|