yaml-flow 8.6.4 → 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/firebase-storage.js +3 -0
- package/browser/adapters/firestore-storage.js +3 -0
- package/browser/adapters/localstorage-storage.js +4 -0
- package/browser/asset-integrity.json +22 -6
- package/browser/live-cards.schema.json +10 -1
- package/browser/server-runtime-controlface.js +8 -0
- package/examples/ARCHITECTURE.md +5 -32
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board/server/board-server.js +4 -2
- package/examples/board/test/server-http-test.js +73 -79
- package/examples/board-firestore/README.md +81 -0
- package/examples/board-firestore/browser/board-runtime.js +263 -0
- package/examples/board-firestore/firestore.indexes.json +29 -0
- package/examples/board-firestore/package.json +14 -0
- package/examples/board-firestore/server/adapters/firestore-archive-factory.js +59 -0
- package/examples/board-firestore/server/adapters/firestore-blob-storage.js +82 -0
- package/examples/board-firestore/server/adapters/firestore-board-adapter.js +127 -0
- package/examples/board-firestore/server/adapters/firestore-journal-storage.js +54 -0
- package/examples/board-firestore/server/adapters/firestore-kv-storage.js +47 -0
- package/examples/board-firestore/server/adapters/firestore-lock.js +62 -0
- package/examples/board-firestore/server/adapters/firestore-queue-storage.js +186 -0
- package/examples/board-firestore/server/adapters/firestore-scratch-storage.js +50 -0
- package/examples/board-firestore/server/worker.js +146 -0
- package/lib/{artifacts-store-lib-BR-Samty.d.cts → artifacts-store-lib-D9nMkVcE.d.cts} +1 -1
- package/lib/{artifacts-store-lib-DT7XlWUL.d.ts → artifacts-store-lib-DSSMqVL2.d.ts} +1 -1
- package/lib/artifacts-store-public.d.cts +2 -2
- package/lib/artifacts-store-public.d.ts +2 -2
- package/lib/board-live-cards-mcp.cjs +1 -1
- package/lib/board-live-cards-mcp.d.cts +51 -3
- package/lib/board-live-cards-mcp.d.ts +51 -3
- package/lib/board-live-cards-mcp.js +1 -1
- package/lib/board-live-cards-node.cjs +5 -5
- package/lib/board-live-cards-node.d.cts +16 -11
- package/lib/board-live-cards-node.d.ts +16 -11
- package/lib/board-live-cards-node.js +5 -5
- package/lib/{board-live-cards-public-BMUIPOrc.d.ts → board-live-cards-public-JNRKfBZy.d.ts} +1 -1
- package/lib/{board-live-cards-public-wkNmBIRC.d.cts → board-live-cards-public-LlVUQPL2.d.cts} +1 -1
- package/lib/board-live-cards-public-async-Di9QB141.d.cts +55 -0
- package/lib/board-live-cards-public-async-fwd1QI82.d.ts +55 -0
- 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 +10 -6
- package/lib/board-live-cards-server-runtime.d.ts +10 -6
- 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-BfHmHdx2.d.cts +129 -0
- package/lib/board-platform-adapter-async-DYahVzIK.d.ts +129 -0
- package/lib/board-worker-adapter.cjs +3 -3
- package/lib/board-worker-adapter.js +3 -3
- 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-storage-lib-BIUbE-fM.d.cts → chat-storage-lib-B9Q34Dyv.d.cts} +1 -1
- package/lib/{chat-storage-lib-BlG-sobS.d.ts → chat-storage-lib-DB9iSai2.d.ts} +1 -1
- package/lib/chat-store-public.d.cts +2 -2
- package/lib/chat-store-public.d.ts +2 -2
- package/lib/chunk-272IYUKT.cjs +2 -0
- package/lib/chunk-3KC6LBOG.js +3 -0
- package/lib/chunk-5XHOHTLZ.cjs +2 -0
- package/lib/chunk-6APH25VI.js +2 -0
- package/lib/chunk-76C7N4YT.js +3 -0
- package/lib/chunk-7FGPOGRV.cjs +2 -0
- package/lib/chunk-7ICPAABP.cjs +7 -0
- package/lib/chunk-ASR44K7H.cjs +3 -0
- package/lib/chunk-CPAXTVBQ.cjs +2 -0
- package/lib/chunk-EGRHWZRV.js +2 -0
- package/lib/chunk-EZENHAVZ.cjs +2 -0
- package/lib/chunk-FO4KNVU7.cjs +2 -0
- package/lib/chunk-GL2OHR2E.cjs +2 -0
- package/lib/chunk-HWYMZK3N.cjs +3 -0
- package/lib/chunk-IPLSRN6P.cjs +4 -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-KAWQPLIE.cjs +2 -0
- package/lib/chunk-LPXVVMQT.cjs +2 -0
- package/lib/chunk-NJJ7WEDT.cjs +2 -0
- package/lib/chunk-NKIQRCOM.cjs +2 -0
- package/lib/chunk-NM6O35RY.cjs +2 -0
- package/lib/chunk-NTICU4OK.js +2 -0
- package/lib/chunk-O7NOHKVR.js +2 -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-S44QZUDX.js +2 -0
- package/lib/chunk-SGV7PU4H.js +2 -0
- package/lib/chunk-TSN3RTXT.js +4 -0
- package/lib/chunk-VXJHBWK3.js +2 -0
- package/lib/chunk-WHDEBJLT.js +7 -0
- package/lib/chunk-XYN5D3GL.js +2 -0
- package/lib/chunk-YBYXCFAI.js +2 -0
- package/lib/chunk-YGALANRO.js +2 -0
- package/lib/chunk-ZCNN6XPV.js +2 -0
- package/lib/chunk-ZJ5M5COT.js +2 -0
- package/lib/cloud-storage.cjs +1 -1
- package/lib/cloud-storage.d.cts +5 -3
- package/lib/cloud-storage.d.ts +5 -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/firebase-storage/index.cjs +3 -0
- package/lib/firebase-storage/index.d.cts +57 -0
- package/lib/firebase-storage/index.d.ts +57 -0
- package/lib/firebase-storage/index.js +3 -0
- package/lib/firestore-storage/index.cjs +3 -0
- package/lib/firestore-storage/index.d.cts +111 -0
- package/lib/firestore-storage/index.d.ts +111 -0
- package/lib/firestore-storage/index.js +3 -0
- package/lib/index.cjs +2 -2
- package/lib/index.js +1 -1
- package/lib/localstorage-storage/index.cjs +2 -0
- package/lib/localstorage-storage/index.d.cts +39 -0
- package/lib/localstorage-storage/index.d.ts +39 -0
- package/lib/localstorage-storage/index.js +2 -0
- package/lib/mcp-tool-registries-BBObLYga.d.ts +41 -0
- package/lib/mcp-tool-registries-W3TRj6O5.d.cts +41 -0
- package/lib/queue-lane-registry-PaZuFpwp.d.cts +30 -0
- package/lib/queue-lane-registry-PaZuFpwp.d.ts +30 -0
- package/lib/server-jobs-queue-runner/index.cjs +2 -0
- package/lib/server-jobs-queue-runner/index.d.cts +22 -0
- package/lib/server-jobs-queue-runner/index.d.ts +22 -0
- package/lib/server-jobs-queue-runner/index.js +2 -0
- package/lib/server-runtime/index.cjs +1 -1
- package/lib/server-runtime/index.d.cts +11 -17
- package/lib/server-runtime/index.d.ts +11 -17
- package/lib/server-runtime/index.js +1 -1
- package/lib/server-runtime-agentface/index.cjs +2 -0
- package/lib/server-runtime-agentface/index.d.cts +53 -0
- package/lib/server-runtime-agentface/index.d.ts +53 -0
- package/lib/server-runtime-agentface/index.js +2 -0
- package/lib/server-runtime-controlface/index.cjs +2 -0
- package/lib/server-runtime-controlface/index.d.cts +29 -0
- package/lib/server-runtime-controlface/index.d.ts +29 -0
- package/lib/server-runtime-controlface/index.js +2 -0
- package/lib/server-runtime-core/index.cjs +2 -0
- package/lib/server-runtime-core/index.d.cts +378 -0
- package/lib/server-runtime-core/index.d.ts +378 -0
- package/lib/server-runtime-core/index.js +2 -0
- package/lib/server-runtime-watchers/index.cjs +2 -0
- package/lib/server-runtime-watchers/index.d.cts +127 -0
- package/lib/server-runtime-watchers/index.d.ts +127 -0
- package/lib/server-runtime-watchers/index.js +2 -0
- package/lib/server-runtime-webhooks/index.cjs +2 -0
- package/lib/server-runtime-webhooks/index.d.cts +34 -0
- package/lib/server-runtime-webhooks/index.d.ts +34 -0
- package/lib/server-runtime-webhooks/index.js +2 -0
- package/lib/storage-async-interface-BRR4eBjx.d.cts +81 -0
- package/lib/storage-async-interface-DhlOVPSp.d.ts +81 -0
- package/lib/{queue-lane-registry-BPKWWgd4.d.cts → types-Ba8H5_Wo.d.cts} +10 -34
- package/lib/{queue-lane-registry-Be6c0ftj.d.ts → types-SO5OZm4s.d.ts} +10 -34
- package/package.json +46 -2
- package/schema/live-cards.schema.json +10 -1
- package/examples/board-local/demo-shell-localstorage.html +0 -843
- package/lib/board-live-cards-public-async-DKZqbJVU.d.ts +0 -256
- package/lib/board-live-cards-public-async-dMWNbWq6.d.cts +0 -256
- package/lib/chunk-KXWT3CY6.cjs +0 -8
- package/lib/chunk-MLVTJASJ.js +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-OJLA6NLU.js +0 -8
- package/lib/chunk-R5L5WUKN.js +0 -2
- package/lib/chunk-VLBB3D6B.js +0 -3
- package/lib/chunk-WOALA3V5.cjs +0 -2
- package/lib/chunk-YEB5QHGE.cjs +0 -2
package/lib/chunk-R5L5WUKN.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-JMDHDY6M.js';function h(a,d){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||`${d} failed`):new Error(`${d} returned an unexpected response`)}function K(a,d){if(a?.status==="success"&&Object.prototype.hasOwnProperty.call(a,"data"))return a.data;throw a?.status==="success"?new Error(`${d} returned success without data`):a?.status==="fail"||a?.status==="error"?new Error(a.error||`${d} failed`):new Error(`${d} returned an unexpected response`)}function t(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function R(a){return Array.isArray(a)?a:[]}function V(a,d){if(typeof d!="string"||d.length===0)return;let c=a,m=d;m.startsWith("fetched_sources.")&&(c=t(a).fetched_sources,m=m.slice(16));for(let k of m.split(".")){if(c==null||typeof c!="object")return;c=c[k];}return c}function N(a,d){let c=t(a.view),m=R(c.elements);return {layout:c.layout,features:c.features,elements:m.map((k,M)=>{let v=t(k),I=t(v.data),B=typeof v.visible=="string"?!!V(d,v.visible):true,P=typeof I.bind=="string"?I.bind:void 0,U=typeof I.maxRows=="number"?I.maxRows:void 0,L=P?V(d,P):void 0,E={id:typeof v.id=="string"&&v.id?v.id:`element-${M}`,kind:v.kind,label:v.label,visible:B};return L!==void 0&&(E.resolved=Array.isArray(L)&&typeof U=="number"?L.slice(0,U):L),E})}}function W(a,d){let c=typeof a.id=="string"&&a.id?a.id:"card",m=R(a.provides),k=m.length>0?m:[{bindTo:c,ref:"card_data"}],M={};for(let v of k){let I=t(v),B=typeof I.bindTo=="string"?I.bindTo:"",P=typeof I.ref=="string"?I.ref:"";if(!B||!P)continue;let U=V(d,P);U!==void 0&&(M[B]=U);}return M}function de(a){if(typeof a!="string"||!a.trim())return null;let d=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(a.trim());if(!d)return null;let c=Number.parseInt(d[2],10);return !Number.isInteger(c)||c<0?null:c}function ce(a){return {"card-content":a}}function F(a){let{meta:d,...c}=a;return c}function ue(a,d){return Object.prototype.hasOwnProperty.call(a,d)}function J(a){return t(a.meta).__visible_controlplane_only===true}async function T(a,d){let c=await S(a.get({params:{id:d}}),"cardStore.get"),m=Array.isArray(c?.cards)?c.cards:[];if(m.length===0)throw new Error(`Card "${d}" not found`);return m[0]}function me(a$1){let{board:d,nonCore:c,cardStore:m,chatStore:k,uploadCardFile:M,buildFileDownloadUrl:v,readFetchedSourceJsonByRef:I}=a$1;function B(r){if(Array.isArray(r.bytes))return new Uint8Array(r.bytes.map(e=>Math.max(0,Math.min(255,Number(e)||0))));if(typeof r.text=="string")return new TextEncoder().encode(r.text);if(typeof r.base64=="string"){let e=String(r.base64).replace(/-/g,"+").replace(/_/g,"/"),n=e+"=".repeat((4-e.length%4)%4),s=atob(n);return Uint8Array.from(s,o=>o.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}async function P(){let r=t(await S(c.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:r.version,commonSourceFields:t(r.commonSourceDefFields),sourceKinds:t(r.sourceKinds)}}async function U(){let r=t(await S(d.status({}),"status")),e=t(r.summary),n=R(r.cards);return {meta:t(r.meta),summary:{card_count:typeof e.card_count=="number"?e.card_count:0,completed:typeof e.completed=="number"?e.completed:0,eligible:typeof e.eligible=="number"?e.eligible:0,pending:typeof e.pending=="number"?e.pending:0,blocked:typeof e.blocked=="number"?e.blocked:0,in_progress:typeof e.in_progress=="number"?e.in_progress:0,failed:typeof e.failed=="number"?e.failed:0,unresolved:typeof e.unresolved=="number"?e.unresolved:0},cards:n.map(s=>{let o=t(s);return {"card-id":typeof o.name=="string"?o.name:null,status:o.status??null,error:o.error??null,requires:R(o.requires),requires_satisfied:R(o.requires_satisfied),requires_missing:R(o.requires_missing),provides_declared:R(o.provides_declared),provides_runtime:R(o.provides_runtime)}})}}async function L(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let n=t(await S(d.status({}),"status")),o=R(n.cards).map(t).find(p=>p.name===e);if(!o)throw new Error(`card "${e}" not found in board status`);let i=t(await T(m,e));if(J(i))throw Object.assign(new Error(`card "${e}" not found`),{statusCode:404});let C=F(i),w=R(o.requires_satisfied).filter(p=>typeof p=="string"&&!!p),y=R(o.provides_runtime).filter(p=>typeof p=="string"&&!!p),f=Object.fromEntries(await Promise.all(w.map(async p=>[p,await S(d.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),g=Object.fromEntries(await Promise.all(y.map(async p=>[p,await S(d.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),l=t(await S(d.getOutputsComputedValues({params:{key:e}}),"getOutputsComputedValues")),u=await S(d.getOutputsFetchedSources({params:{key:e}}),"getOutputsFetchedSources"),_=R(i.source_defs).map(t),b={};for(let p of _)typeof p.bindTo=="string"&&typeof p.outputFile=="string"&&(b[p.outputFile]=p.bindTo);let A={};for(let[p,j]of Object.entries(u)){let q=b[p]??p;if(!I||typeof j!="string"){A[q]=null;continue}try{A[q]=I({cardId:e,ref:j});}catch{A[q]=null;}}let x={card_data:t(i.card_data),requires:f,fetched_sources:A,computed_values:l};return {cardId:e,card_status_in_board:o,card_definition_and_static_data:C,refs_for_fetched_source_files:u,runtime_data:{requires:f,provides:g,computed_values:l,rendered_view:N(i,x)}}}async function E(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectChatMessagesOnCards requires cardId");let n=typeof r.turnId=="string"?r.turnId:"",s=r.allTurns===true,o=typeof r.tailTurnsBeforeId=="string"?r.tailTurnsBeforeId:"",i=s?void 0:r.lastUserTurns??(n?void 0:1),C=r.tail,w={...i===void 0?{}:{tailTurns:i},...n?{turnId:n}:{},...s?{allTurns:true}:{},...o?{tailTurnsBeforeId:o}:{}},y=Object.keys(w).length>0?{params:{cardId:e},body:w}:{params:{cardId:e}},f=h(k.readAll(y),"chatStore.readAll"),g=t(await T(m,e)),l=R(t(g.card_data).files).map((b,A)=>({idx:A,stored_name:t(b).stored_name})).filter(b=>typeof b.stored_name=="string"&&b.stored_name.length>0),_=(Array.isArray(f.records)?f.records:[]).map(b=>{let x=t(b.payload),p={...b},j=typeof b?.role=="string"?b.role:typeof x.role=="string"?String(x.role):"",q=typeof b?.text=="string"?b.text:typeof x.text=="string"?String(x.text):"";if(j==="system"){let $=de(q);if($!==null&&l.some(O=>O.idx===$)){let O=`Retrieve using inspect-file-contents --card-id ${e} --file-idx ${$}`;p.retrieval_hint=O,Object.keys(x).length>0&&typeof b.role!="string"&&(p.payload={...x,retrieval_hint:O});}}return p});return {cardId:e,messages:typeof C=="number"&&C>=0?_.slice(-C):_}}async function H(r){let e=String(r.cardId||"").trim(),n=Number(r.fileIdx);if(!e)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(n)||n<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let s=t(await T(m,e)),o=R(t(s.card_data).files).map(t);if(n>=o.length)throw new Error(`attachment index ${n} is out of range for card "${e}"`);let i=o[n],C=typeof i.stored_name=="string"?i.stored_name:null;return {cardId:e,fileIdx:n,downloadUrl:v({cardId:e,fileIdx:n,storedName:C}),...typeof i.name=="string"?{name:i.name}:{},...typeof i.stored_name=="string"?{stored_name:i.stored_name}:{},...typeof i.mime_type=="string"?{mime_type:i.mime_type}:{},...typeof i.size=="number"?{size:i.size}:{},...typeof i.uploaded_at=="string"?{uploaded_at:i.uploaded_at}:{}}}async function D(r){return await c.validateCardPreflight({body:ce(r.candidateCardContent)})}function G(r){if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!r.mockFetchedSources||typeof r.mockFetchedSources!="object"||Array.isArray(r.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let e=c.evalCardCompute({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires,"mock-fetched-sources":r.mockFetchedSources}});if(e.status!=="success")return e;let n=t(K(e,"evalCardCompute")),s=t(r.candidateCardContent),o={card_data:t(s.card_data),requires:t(r.mockRequires),fetched_sources:t(r.mockFetchedSources),computed_values:t(n.computed_values)};return {status:"success",data:{cardId:typeof n.cardId=="string"?n.cardId:typeof s.id=="string"?s.id:"(unknown)",ok:n.ok===true,computed_values:t(n.computed_values),errors:R(n.errors).map(i=>{let C=t(i);return {bindTo:typeof C.bindTo=="string"?C.bindTo:"",error:typeof C.error=="string"?C.error:""}}),provides_outputs:W(s,o),rendered_view:N(s,o)}}}async function Q(r){return await c.probeSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function X(r){return await c.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function Y(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let n=t(await T(m,e)),s=R(n.source_defs).filter(i=>!!i&&typeof i=="object"&&!Array.isArray(i)),o={};if(r.sourceIdx>=0&&r.sourceIdx<s.length){let i=s[r.sourceIdx],C=a.enrichSourcesSync([i],{card_data:t(n.card_data),requires:r.mockRequires});Array.isArray(C)&&C.length>0&&(o=t(C[0]._projections));}return await c.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":n,"mock-requires":r.mockRequires,"mock-projections":o}})}async function Z(r){let e=t(await S(c.simulateCardCycle({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires}}),"simulateCardCycle")),n=t(r.candidateCardContent),s=t(e.validation),o=R(e.source_probes),i=R(e.projection_errors),C=t(e.fetched_sources),w=R(e.compute_errors),y=t(e.computed_values),f={card_data:t(n.card_data),requires:r.mockRequires,fetched_sources:C,computed_values:y},g=[];for(let l of R(s.issues))typeof l=="string"&&l&&g.push(l);for(let l of o){let u=t(l),_=typeof u.bindTo=="string"?u.bindTo:"source",b=typeof u.error=="string"?u.error:"";b&&g.push(`${_}: ${b}`);}for(let l of i){let u=t(l),_=typeof u.bindTo=="string"?u.bindTo:"source",b=typeof u.key=="string"?u.key:"projection",A=typeof u.error=="string"?u.error:"projection failed";g.push(`${_}.${b}: ${A}`);}for(let l of w){let u=t(l),_=typeof u.bindTo=="string"?u.bindTo:"compute",b=typeof u.error=="string"?u.error:"compute failed";g.push(`${_}: ${b}`);}return {status:"success",data:{cardId:typeof e.cardId=="string"?e.cardId:"(unknown)",ok:e.ok===true,issues:g,provides_outputs:W(n,f),rendered_view:N(n,f)}}}async function ee(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get"),s=Array.isArray(n.cards)?n.cards.map(t):[];if(s.some(J))throw Object.assign(new Error(`Card "${e}" not found`),{statusCode:404});return s.map(o=>F(o))}async function re(r){let e=String(r.cardId||"").trim(),n=String(r.role||"").trim(),s=typeof r.text=="string"?r.text:"",o=typeof r.turn=="string"?r.turn:"";if(!e)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!n)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(n==="assistant"&&o){let y=h(k.readAll({params:{cardId:e},body:{turnId:o}}),"chatStore.readAll(existing turn messages)"),f=Array.isArray(y.records)?y.records.find(g=>g.role==="assistant"&&String(g.turn||"")===o):void 0;if(f)return {status:"success",data:{cardId:e,id:String(f.id),role:n,turn:o,files:Array.isArray(f.files)?f.files:[]}}}let i=await Promise.all(R(r.files).map(async y=>{let f=t(y),g=String(f.file_name??f.fileName??f.name??"").trim(),l=String(f.content_type??f.contentType??"application/octet-stream");if(!g)throw new Error("file entry requires file_name");return await M({cardId:e,fileName:g,contentType:l,bytes:B(f)})})),C=i.map(y=>y.file);i.forEach((y,f)=>{let g=t(y.file),l=typeof y.file_idx=="number"&&Number.isInteger(y.file_idx)&&y.file_idx>=0?y.file_idx:f,u=n==="assistant"?`AI generated: ${String(g.name||"")} as ${String(g.stored_name||"")} #${l}`:`file uploaded: ${String(g.name||"")} as ${String(g.stored_name||"")} #${l}`;h(k.append({params:{cardId:e},body:{role:"system",text:u,files:[],turn:o}}),"chatStore.append(system attachment message)");});let w=h(k.append({params:{cardId:e},body:{role:n,text:s,files:C,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:e,id:String(w.id),role:n,turn:o,files:C}}}async function te(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("manageUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),i=t(o),C=t(i.data);if(i.status!=="success"||C.isValid!==true)return {status:"fail",step:"validate",validation:o};let w=null;try{w=await T(m,e);}catch{w=null;}let y=w&&ue(t(w),"meta")?{...s,meta:t(w).meta}:s,f=await m.set({body:y});h(f,"cardStore.set");let g;try{g=await d.upsertCard({params:{cardId:e,restart:!0}}),h(g,"upsertCard");}catch(u){try{w&&await m.set({body:w});}catch{}throw u}let l=null;try{l=await d.cardRefreshedNotify({params:{cardId:e}}),h(l,"cardRefreshedNotify");}catch{l=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:g,refresh_notify:l}}}async function ne(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageRemoveCard requires cardId");let n=await d.removeCard({params:{id:e}});h(n,"removeCard");let s=await m.del({params:{id:e}});return h(s,"cardStore.del"),{status:"success",data:{board_result:n,store_result:s}}}async function ae(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("adminReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get");return Array.isArray(n.cards)?n.cards.map(s=>t(s)):[]}async function oe(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("adminUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),i=t(o),C=t(i.data);if(i.status!=="success"||C.isValid!==true)return {status:"fail",step:"validate",validation:o};let w=null;try{w=await T(m,e);}catch{w=null;}let y=w?t(t(w).meta):{},f={...s,meta:{...y,__visible_controlplane_only:true}},g=await m.set({body:f});h(g,"cardStore.set");let l;try{l=await d.upsertCard({params:{cardId:e,restart:!0}}),h(l,"upsertCard");}catch(_){try{w&&await m.set({body:w});}catch{}throw _}let u=null;try{u=await d.cardRefreshedNotify({params:{cardId:e}}),h(u,"cardRefreshedNotify");}catch{u=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:l,refresh_notify:u}}}function se(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("getChatProcessing requires cardId");let n=K(k.isProcessing({params:{cardId:e}}),"chatStore.isProcessing");return {cardId:e,active:!!n.active}}function ie(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("setChatProcessing requires cardId");if(typeof r.active!="boolean")throw new Error("setChatProcessing requires boolean active");return h(k.setProcessing({params:{cardId:e},body:{active:r.active}}),"chatStore.setProcessing"),{cardId:e,active:r.active}}return {discoverSourceKinds:P,inspectBoardRuntimeStatus:U,inspectCardDefinitionAndRuntime:L,inspectChatMessagesOnCards:E,inspectFileContents:H,preflightValidateCandidateCardDefinition:D,preflightMaterializeCandidateCard:G,preflightProbeSingleSourceInCandidateCard:Q,preflightRunSingleSourceInCandidateCard:X,preflightRunSingleSourceInLiveCard:Y,preflightRunOneCycleWithCandidateCard:Z,manageReadCard:ee,manageAddChatEntryAndAnyAttachments:re,manageUpsertCard:te,manageRemoveCard:ne,adminReadCard:ae,adminUpsertCard:oe,getChatProcessing:se,setChatProcessing:ie}}async function S(a,d){return h(await a,d)}export{me as a};//# sourceMappingURL=chunk-R5L5WUKN.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-R5L5WUKN.js.map
|
package/lib/chunk-VLBB3D6B.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {q as q$1}from'./chunk-MNEOJWPS.js';import {b as b$1}from'./chunk-FW4363Y4.js';import A from'ajv-formats';import {createRequire}from'module';var h={$schema:"http://json-schema.org/draft-07/schema#",$id:"https://nsreehari.github.io/boards/live-cards.schema.json",definitions:{bind_ref:{description:"A card data path reference, e.g. 'card_data.raw_quotes' or 'requires.upstream'",type:"string",pattern:"^(card_data|requires|fetched_sources|computed_values)(\\.|$)"},bind_or_literal:{description:"A literal value or a bind reference object",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref"}},required:["bind"]}]},compute_expr:{description:"A declarative JSON compute expression",type:"object",required:["fn"],properties:{fn:{type:"string",description:"Function name from the built-in vocabulary",enum:["sum","avg","min","max","count","first","last","add","sub","mul","div","round","abs","mod","gt","gte","lt","lte","eq","neq","if","and","or","not","concat","upper","lower","template","filter","pluck","map","sort","slice","flat","unique","group","get","default","now","diff_days","format_date"]},input:{description:"card_data.path, literal, array of inputs, or nested compute_expr",oneOf:[{type:"string"},{type:"number"},{type:"boolean"},{type:"array"},{$ref:"#/definitions/compute_expr"}]},field:{type:"string",description:"For pluck/sum/group \u2014 the object key to extract"},where:{$ref:"#/definitions/compute_expr",description:"For filter \u2014 predicate expression ($ = current item)"},cond:{$ref:"#/definitions/compute_expr",description:"For if \u2014 condition expression"},then:{description:"For if \u2014 value when cond is truthy"},else:{description:"For if \u2014 value when cond is falsy"},format:{type:"string",description:"For format_date \u2014 date format string"}}},meta:{type:"object",properties:{title:{type:"string"},tags:{type:"array",items:{type:"string"}}}},requires:{type:"array",items:{type:"string"},description:"IDs of upstream nodes this node depends on"},provides:{type:"array",items:{type:"object",required:["bindTo","ref"],properties:{bindTo:{type:"string",description:"Token name published downstream"},ref:{type:"string",description:"Path to read value from (card_data.*, requires.*, fetched_sources.*, computed_values.*)"}}},description:"Explicit bindings exposing computed or card_data values downstream as named tokens"},compute_step:{description:"A single ordered compute step: reads card_data.*/requires.*/computed_values.*, writes to computed_values[bindTo]",type:"object",required:["bindTo","expr"],properties:{bindTo:{type:"string",description:"Key in computed_values to write result"},expr:{type:"string",description:"JSONata expression evaluated against { card_data, requires, fetched_sources, computed_values }"}}},source_def:{description:"One source entry. The engine requires 'bindTo' (compute namespace key) and 'outputFile' (delivery signal path). bindTo and outputFile must be unique across all source_defs in a card. Every other property is yours \u2014 add whatever your task-executor needs: kind, url, headers, mailbox, channel, model, query, etc. The full object is passed verbatim as the --in JSON to the executor.",type:"object",required:["bindTo","outputFile"],additionalProperties:true,properties:{bindTo:{type:"string",description:"Key under fetched_sources.* available in compute expressions"},outputFile:{type:"string",description:"Board-relative path the executor writes its JSON result to. Presence of this file signals delivery."},projections:{type:"object",description:"Named data projections from card_data or requires, evaluated before the executor is called. Each key is a ref name; each value is a JSONata expression rooted at card_data or requires. The resolved values are passed to the executor as _projections. fetched_sources, computed_values, and source_defs are not accessible here \u2014 sources run before those exist.",additionalProperties:{type:"string"}},optionalForCompletionGating:{type:"boolean",default:false,description:"When true this source does not gate card completion. Default false when absent, so source_defs are completion-gating by default."},timeout:{type:"integer",minimum:0,default:12e4,description:"Executor/script timeout in ms. Default: 120 000 (2 min)."},script:{type:"string",description:"Legacy direct-run: shell command executed when no .task-executor is registered. stdout is captured as the result."}}},render_element:{type:"object",required:["kind"],properties:{id:{type:"string",description:"Optional element ID for targeted updates"},kind:{enum:["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]},label:{type:"string",description:"Heading above this element"},className:{type:"string",description:"Bootstrap grid class, e.g. 'col-12 col-md-6'"},visible:{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 element shown only if truthy"},data:{type:"object",properties:{bind:{$ref:"#/definitions/bind_ref",description:"card_data/requires/fetched_sources/computed_values path to read data from"},writeTo:{$ref:"#/definitions/bind_ref",description:"card_data path for user input (form, filter, todo, notes)"},columns:{type:"array",items:{type:"string"},description:"table: visible columns"},maxRows:{type:"integer",description:"table/list: max rows to display"},sortable:{type:"boolean",default:true,description:"table: enable click-to-sort"},placeholder:{type:"string",description:"Empty-state message"},chartType:{enum:["bar","line","pie","doughnut"]},chartOptions:{type:"object",description:"Chart.js options passthrough"},fields:{type:"object",description:"JSON Schema for form/filter fields"},thresholds:{type:"object",properties:{green:{type:"string"},amber:{type:"string"}}},colorMap:{type:"object",description:"badge: value \u2192 Bootstrap color"},style:{enum:["heading","muted","default"],description:"text: display style"},upload:{type:"boolean",default:true,description:"file-upload: show drop zone (false = read-only file list)"},accept:{type:"array",items:{type:"string"},description:"file-upload: allowed extensions"},multiple:{type:"boolean",default:true,description:"file-upload: allow multiple files"},fileAttach:{type:"boolean",default:false,description:"chat: enable inline file attachments"},fileAccept:{type:"array",items:{type:"string"},description:"chat: allowed attachment extensions"},buttons:{type:"array",description:"actions: button definitions",items:{type:"object",required:["id","label"],properties:{id:{type:"string"},label:{type:"string"},style:{type:"string",description:"Bootstrap button variant, e.g. 'success', 'outline-danger'"},size:{type:"string",default:"sm"},disabled:{oneOf:[{type:"boolean"},{type:"string",description:"card_data/requires/fetched_sources/computed_values path \u2014 truthy = disabled"}]}}}}}}}},view:{type:"object",required:["elements"],properties:{elements:{type:"array",minItems:1,items:{$ref:"#/definitions/render_element"}},layout:{type:"object",properties:{board:{type:"object",properties:{col:{type:"integer",minimum:1,maximum:12},order:{type:"integer"}}},canvas:{type:"object",properties:{x:{type:"number"},y:{type:"number"},w:{type:"number"},h:{type:"number"}}}}},features:{type:"object",properties:{chat:{type:"boolean",default:false},notes:{type:"boolean",default:false},refresh:{type:"boolean",default:true}}}}}},title:"LiveCard",description:"A unified card node. Behavior depends on which sections are present (source_defs, compute, view, etc.)",type:"object",required:["id"],additionalProperties:false,properties:{id:{type:"string"},requires:{$ref:"#/definitions/requires"},provides:{$ref:"#/definitions/provides"},meta:{$ref:"#/definitions/meta"},view:{$ref:"#/definitions/view"},card_data:{type:"object",description:"Authored card data and runtime metadata. Includes uploaded-file metadata maintained by host handlers and inference evaluation results.",properties:{files:{type:"array",description:"Optional uploaded-file metadata maintained by host handlers. Stored name is normalized and serial-prefixed (for example 001-my_file.pdf).",items:{type:"object",required:["name","stored_name"],properties:{name:{type:"string",minLength:1},stored_name:{type:"string",minLength:5,maxLength:32,pattern:"^[0-9]{3,}-[a-z0-9._-]+$"},size:{oneOf:[{type:"integer",minimum:0},{type:"null"}]},mime_type:{type:"string"},path:{type:"string",pattern:"^[^\\s]+/files/[0-9]{3,}-[a-z0-9._-]+$"},uploaded_at:{type:"string",format:"date-time"},chat:{type:"boolean",description:"Whether this file entry is associated with a chat interaction"}},additionalProperties:false}}},additionalProperties:true},source_defs:{type:"array",description:"Source entries. Each entry is passed verbatim to the board's .task-executor (registered via init --task-executor) as the --in JSON file. The executor fetches/generates the data and writes JSON to --out. If no executor is registered, the built-in executor runs the entry's 'cli' command directly. Sources gate completion by default. Set optionalForCompletionGating: true for enrichment-only source_defs that should not block task-completed.",items:{$ref:"#/definitions/source_def"}},compute:{type:"array",description:"Ordered array of compute steps. Each reads card_data.*/requires.*/fetched_sources.*/computed_values.* and writes to ephemeral computed_values[bindTo].",items:{$ref:"#/definitions/compute_step"}}}};var _=b$1(q$1(),1);var $=createRequire(import.meta.url),q=$("./jsonata-sync.cjs"),f=null;var b=/\b(card_data|requires|fetched_sources|computed_values|source_defs)\b/g,N=/^\s*(card_data|requires|fetched_sources|computed_values|source_defs)(\.|$)/;function E(e){let t=new Set,o;for(b.lastIndex=0;(o=b.exec(e))!==null;)t.add(o[1]);return t}function v(e){let t=N.exec(e);return t?t[1]:null}function g(e,t,o,a){try{q(e);}catch(s){let d=s instanceof Error?s.message:String(s);a.push(`${t}: invalid JSONata expression (${d})`);return}let i=E(e);for(let s of i)o.has(s)||a.push(`${t}: disallowed namespace "${s}" in expression`);}function y(e,t,o){if(Array.isArray(e)){e.forEach((i,s)=>{y(i,`${t}/${s}`,o);});return}if(typeof e=="string"){let i=v(e);if(!i)return;new Set(["card_data","requires","computed_values"]).has(i)||o.push(`${t}: disallowed namespace "${i}" in view reference`);return}if(!e||typeof e!="object")return;let a=e;for(let[i,s]of Object.entries(a))y(s,`${t}/${i}`,o);}function S(){if(f)return f;let e=new _.default({allErrors:true});return A(e),f=e.compile(h),f}function R(e){let t=S(),o=t(e),a=(t.errors??[]).map(i=>`${i.instancePath||"/"}: ${i.message??"unknown error"}`);if(e&&typeof e=="object"&&!Array.isArray(e)){let i=e.source_defs;if(Array.isArray(i)){let s=new Set,d=new Set;i.forEach((c,u)=>{if(!c||typeof c!="object"||Array.isArray(c))return;let r=c;typeof r.bindTo=="string"&&r.bindTo&&(s.has(r.bindTo)&&a.push(`/source_defs/${u}/bindTo: bindTo "${r.bindTo}" must be unique across all source_defs`),s.add(r.bindTo)),typeof r.outputFile=="string"&&r.outputFile&&(d.has(r.outputFile)&&a.push(`/source_defs/${u}/outputFile: outputFile "${r.outputFile}" must be unique across all source_defs`),d.add(r.outputFile));});}}return !o||a.length>0?{ok:false,errors:a}:{ok:true,errors:[]}}function T(e){let t=[];if(!e||typeof e!="object"||Array.isArray(e))return {ok:true,errors:[]};let o=e,a=o.compute;Array.isArray(a)&&a.forEach((r,p)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let n=r.expr;typeof n!="string"||n.trim().length===0||g(n,`/compute/${p}/expr`,new Set(["card_data","requires","fetched_sources","computed_values"]),t);});let i=new Set(["card_data","requires","fetched_sources","computed_values"]),s=o.provides;Array.isArray(s)&&s.forEach((r,p)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let n=r.ref;if(typeof n!="string"||n.trim().length===0)return;let l=v(n);l===null?t.push(`/provides/${p}/ref: path "${n}" must start with a valid namespace (${[...i].join(", ")})`):i.has(l)||t.push(`/provides/${p}/ref: disallowed namespace "${l}" in path "${n}" (valid: ${[...i].join(", ")})`);});let d=o.view;d&&typeof d=="object"&&!Array.isArray(d)&&y(d,"/view",t);let c=new Set(["card_data","requires"]),u=o.source_defs;return Array.isArray(u)&&u.forEach((r,p)=>{if(!r||typeof r!="object"||Array.isArray(r))return;let n=r.projections;if(!(!n||typeof n!="object"||Array.isArray(n)))for(let[l,m]of Object.entries(n))typeof m!="string"||m.trim().length===0||g(m,`/source_defs/${p}/projections/${l}`,c,t);}),{ok:t.length===0,errors:t}}function V(e){return O(e)}function O(e){let t=R(e);if(!t.ok)return t;let o=T(e);return o.ok?{ok:true,errors:[]}:{ok:false,errors:o.errors}}
|
|
2
|
-
export{R as a,T as b,V as c,O as d};//# sourceMappingURL=chunk-VLBB3D6B.js.map
|
|
3
|
-
//# sourceMappingURL=chunk-VLBB3D6B.js.map
|
package/lib/chunk-WOALA3V5.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';function p(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function m(t){let n=t.payload??{};return {id:t.id,role:typeof n.role=="string"?n.role:"system",text:typeof n.text=="string"?n.text:"",files:Array.isArray(n.files)?n.files:[],turn:typeof n.turn=="string"?n.turn:"",updated_at:typeof n.updated_at=="string"?n.updated_at:""}}function T(t,n){let i=e=>`chats/${p(e)}/processing`,r=e=>`chats/${p(e)}/config`;return {append(e,a,o,u=[],s=""){return t(e).append({role:a,text:o,files:u,turn:s,updated_at:new Date().toISOString()}).id},readAll(e){return t(e).readAll().map(m)},readAfter(e,a){let o=t(e).readAfter(a);return {records:o.entries.map(m),cursor:o.newCursor}},clear(e){t(e).clear?.();},setProcessing(e,a){a?n.write(i(e),true):n.delete(i(e));},isProcessing(e){return n.read(i(e))===true},getConfig(e){return n.read(r(e))??{}},setConfig(e,a){let o=n.read(r(e))??{};n.write(r(e),{...o,...a});}}}function _(){let t=globalThis.crypto;return typeof t?.randomUUID=="function"?String(t.randomUUID()):`id-${Date.now()}-${Math.random().toString(36).slice(2)}`}function z(){let t=new Map,n=new Map;function i(r){return t.has(r)||t.set(r,[]),t.get(r)}return {append(r,e,a,o=[],u=""){let s={id:_(),role:e,text:a,files:o,turn:u,updated_at:new Date().toISOString()};return i(r).push(s),s.id},readAll(r){return i(r).slice()},readAfter(r,e){let a=i(r);if(!e)return {records:a.slice(),cursor:a.length>0?a[a.length-1].id:null};let o=a.findIndex(s=>s.id===e),u=o===-1?a.slice():a.slice(o+1);return {records:u,cursor:u.length>0?u[u.length-1].id:e}},clear(r){t.set(r,[]);},setProcessing(r,e){e?n.set(`p:${r}`,true):n.delete(`p:${r}`);},isProcessing(r){return n.get(`p:${r}`)===true},getConfig(r){return n.get(`c:${r}`)??{}},setConfig(r,e){let a=n.get(`c:${r}`)??{};n.set(`c:${r}`,{...a,...e});}}}function y(){return new Date().toISOString()}function x(t){return new TextEncoder().encode(t).byteLength}function S(t){return t?{key:t.key,size:t.size,updatedAt:t.updatedAt,contentType:t.contentType}:null}function w(t){let n=String(t||"").match(/^(\d+)[-_]/);return n?parseInt(n[1],10):0}function L(t){let n=String(t||"").trim();if(!n)return "upload.bin";let i=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\"));return (i>=0?n.slice(i+1):n)||"upload.bin"}function b(t){return String(t||"").toLowerCase().replace(/\s+/g,"_").replace(/[^a-z0-9_-]/g,"_").replace(/_+/g,"_").replace(/^_+|_+$/g,"")||"file"}function I(t){if(!t||t===".")return "";let n=String(t).replace(/^\./,"").toLowerCase().replace(/[^a-z0-9]/g,"");return n?`.${n}`:""}function k(t){let n=L(t),i=n.lastIndexOf(".");return i<=0||i===n.length-1?{stem:n,ext:""}:{stem:n.slice(0,i),ext:n.slice(i)}}function M(t){let n=t.lastIndexOf("/");return n>=0?t.slice(n+1):t}function F(t){function n(i){let r=t.stat?S(t.stat(i)):null;if(r)return r;if(!t.exists(i))return null;let e=t.read(i);return e===null?{key:i}:{key:i,size:x(e)}}return {exists(i){return t.exists(i)},putText(i,r,e="text/plain; charset=utf-8"){t.write(i,r);let a=n(i)??{key:i};return a.contentType=e,a.updatedAt=a.updatedAt??y(),a.size=a.size??x(r),a},putBytes(i,r,e="application/octet-stream"){if(t.writeBytes)t.writeBytes(i,r);else {let o=JSON.stringify({__kind:"bytes-array",data:[...r]});t.write(i,o);}let a=n(i)??{key:i};return a.contentType=e,a.updatedAt=a.updatedAt??y(),a.size=a.size??r.byteLength,a},getText(i){let r=t.read(i);if(r===null){if(!t.readBytes)return null;let e=t.readBytes(i);return e===null?null:Buffer.from(e).toString("utf-8")}try{let e=JSON.parse(r);if(e&&e.__kind==="bytes-array"&&Array.isArray(e.data))return new TextDecoder("utf-8").decode(new Uint8Array(e.data))}catch{}return r},getBytes(i){if(t.readBytes){let e=t.readBytes(i);if(e!==null)return e}let r=t.read(i);if(r===null)return null;try{let e=JSON.parse(r);if(e&&e.__kind==="bytes-array"&&Array.isArray(e.data))return new Uint8Array(e.data)}catch{}return new TextEncoder().encode(r)},head:n,list(i=""){return t.listKeys(i).map(r=>n(r)??{key:r}).sort((r,e)=>r.key.localeCompare(e.key))},remove(i){t.remove(i);}}}function $(t){function n(e,a){let o=0,u=[];Array.isArray(a)&&u.push(...a);for(let s of t.list(`${e}/`))u.push(M(s.key));for(let s of u){let l=w(s);Number.isFinite(l)&&l>o&&(o=l);}return o+1}function i(e,a,o){let u=Number(o?.maxLen||32),{stem:s,ext:l}=k(e),h=I(l),A=b(s),g=`${String(a).padStart(3,"0")}-`,d=h,f=u-g.length-d.length;f<1&&(d="",f=u-g.length);let C=A.slice(0,Math.max(1,f)),c=`${g}${C}${d}`;return c.length>u&&(c=c.slice(0,u).replace(/\.$/,"")),c}function r(e,a,o){let u=n(e,o?.seedNames),s=i(a,u,{maxLen:o?.maxLen});for(;t.exists(`${e}/${s}`);)u+=1,s=i(a,u,{maxLen:o?.maxLen});return s}return {nextSerial:n,buildStoredName:i,allocateStoredName:r}}function B(){function t(e,a){if(!Array.isArray(e))return [];let o=[];for(let u of e){if(!u||typeof u!="object")continue;let s=u;typeof s.stored_name=="string"&&o.push({name:typeof s.name=="string"?s.name:s.stored_name,stored_name:s.stored_name,size:typeof s.size=="number"&&Number.isFinite(s.size)?s.size:null,mime_type:typeof s.mime_type=="string"?s.mime_type:null,uploaded_at:typeof s.uploaded_at=="string"?s.uploaded_at:a||null,chat:s.chat===true});}return o}function n(e){return !e||typeof e!="object"?[]:t(e.files,void 0)}function i(e,a){let o=n(e);if(a.length===0)return e.files=o,o;let u=new Set(o.map(s=>s.stored_name));for(let s of a)u.has(s.stored_name)||(o.push(s),u.add(s.stored_name));return e.files=o,o}function r(e,a,o){let u=n(e);if(!Number.isInteger(a)||a<0||a>=u.length)return {ok:false,reason:"index_out_of_range"};let s=u[a];return !s||!s.stored_name?{ok:false,reason:"missing_stored_name"}:o&&o!==s.stored_name?{ok:false,reason:"stale_reference"}:{ok:true,file:s}}return {read:n,normalizeIncoming:t,merge:i,resolve:r}}function Q(t){return {lanes:t}}exports.a=T;exports.b=z;exports.c=F;exports.d=$;exports.e=B;exports.f=Q;//# sourceMappingURL=chunk-WOALA3V5.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-WOALA3V5.cjs.map
|
package/lib/chunk-YEB5QHGE.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkIXZG74EW_cjs=require('./chunk-IXZG74EW.cjs');function h(a,d){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||`${d} failed`):new Error(`${d} returned an unexpected response`)}function K(a,d){if(a?.status==="success"&&Object.prototype.hasOwnProperty.call(a,"data"))return a.data;throw a?.status==="success"?new Error(`${d} returned success without data`):a?.status==="fail"||a?.status==="error"?new Error(a.error||`${d} failed`):new Error(`${d} returned an unexpected response`)}function t(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function R(a){return Array.isArray(a)?a:[]}function V(a,d){if(typeof d!="string"||d.length===0)return;let c=a,m=d;m.startsWith("fetched_sources.")&&(c=t(a).fetched_sources,m=m.slice(16));for(let k of m.split(".")){if(c==null||typeof c!="object")return;c=c[k];}return c}function N(a,d){let c=t(a.view),m=R(c.elements);return {layout:c.layout,features:c.features,elements:m.map((k,M)=>{let v=t(k),I=t(v.data),B=typeof v.visible=="string"?!!V(d,v.visible):true,P=typeof I.bind=="string"?I.bind:void 0,U=typeof I.maxRows=="number"?I.maxRows:void 0,L=P?V(d,P):void 0,E={id:typeof v.id=="string"&&v.id?v.id:`element-${M}`,kind:v.kind,label:v.label,visible:B};return L!==void 0&&(E.resolved=Array.isArray(L)&&typeof U=="number"?L.slice(0,U):L),E})}}function W(a,d){let c=typeof a.id=="string"&&a.id?a.id:"card",m=R(a.provides),k=m.length>0?m:[{bindTo:c,ref:"card_data"}],M={};for(let v of k){let I=t(v),B=typeof I.bindTo=="string"?I.bindTo:"",P=typeof I.ref=="string"?I.ref:"";if(!B||!P)continue;let U=V(d,P);U!==void 0&&(M[B]=U);}return M}function de(a){if(typeof a!="string"||!a.trim())return null;let d=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(a.trim());if(!d)return null;let c=Number.parseInt(d[2],10);return !Number.isInteger(c)||c<0?null:c}function ce(a){return {"card-content":a}}function F(a){let{meta:d,...c}=a;return c}function ue(a,d){return Object.prototype.hasOwnProperty.call(a,d)}function J(a){return t(a.meta).__visible_controlplane_only===true}async function T(a,d){let c=await S(a.get({params:{id:d}}),"cardStore.get"),m=Array.isArray(c?.cards)?c.cards:[];if(m.length===0)throw new Error(`Card "${d}" not found`);return m[0]}function me(a){let{board:d,nonCore:c,cardStore:m,chatStore:k,uploadCardFile:M,buildFileDownloadUrl:v,readFetchedSourceJsonByRef:I}=a;function B(r){if(Array.isArray(r.bytes))return new Uint8Array(r.bytes.map(e=>Math.max(0,Math.min(255,Number(e)||0))));if(typeof r.text=="string")return new TextEncoder().encode(r.text);if(typeof r.base64=="string"){let e=String(r.base64).replace(/-/g,"+").replace(/_/g,"/"),n=e+"=".repeat((4-e.length%4)%4),s=atob(n);return Uint8Array.from(s,o=>o.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}async function P(){let r=t(await S(c.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:r.version,commonSourceFields:t(r.commonSourceDefFields),sourceKinds:t(r.sourceKinds)}}async function U(){let r=t(await S(d.status({}),"status")),e=t(r.summary),n=R(r.cards);return {meta:t(r.meta),summary:{card_count:typeof e.card_count=="number"?e.card_count:0,completed:typeof e.completed=="number"?e.completed:0,eligible:typeof e.eligible=="number"?e.eligible:0,pending:typeof e.pending=="number"?e.pending:0,blocked:typeof e.blocked=="number"?e.blocked:0,in_progress:typeof e.in_progress=="number"?e.in_progress:0,failed:typeof e.failed=="number"?e.failed:0,unresolved:typeof e.unresolved=="number"?e.unresolved:0},cards:n.map(s=>{let o=t(s);return {"card-id":typeof o.name=="string"?o.name:null,status:o.status??null,error:o.error??null,requires:R(o.requires),requires_satisfied:R(o.requires_satisfied),requires_missing:R(o.requires_missing),provides_declared:R(o.provides_declared),provides_runtime:R(o.provides_runtime)}})}}async function L(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let n=t(await S(d.status({}),"status")),o=R(n.cards).map(t).find(p=>p.name===e);if(!o)throw new Error(`card "${e}" not found in board status`);let i=t(await T(m,e));if(J(i))throw Object.assign(new Error(`card "${e}" not found`),{statusCode:404});let C=F(i),w=R(o.requires_satisfied).filter(p=>typeof p=="string"&&!!p),y=R(o.provides_runtime).filter(p=>typeof p=="string"&&!!p),f=Object.fromEntries(await Promise.all(w.map(async p=>[p,await S(d.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),g=Object.fromEntries(await Promise.all(y.map(async p=>[p,await S(d.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),l=t(await S(d.getOutputsComputedValues({params:{key:e}}),"getOutputsComputedValues")),u=await S(d.getOutputsFetchedSources({params:{key:e}}),"getOutputsFetchedSources"),_=R(i.source_defs).map(t),b={};for(let p of _)typeof p.bindTo=="string"&&typeof p.outputFile=="string"&&(b[p.outputFile]=p.bindTo);let A={};for(let[p,j]of Object.entries(u)){let q=b[p]??p;if(!I||typeof j!="string"){A[q]=null;continue}try{A[q]=I({cardId:e,ref:j});}catch{A[q]=null;}}let x={card_data:t(i.card_data),requires:f,fetched_sources:A,computed_values:l};return {cardId:e,card_status_in_board:o,card_definition_and_static_data:C,refs_for_fetched_source_files:u,runtime_data:{requires:f,provides:g,computed_values:l,rendered_view:N(i,x)}}}async function E(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectChatMessagesOnCards requires cardId");let n=typeof r.turnId=="string"?r.turnId:"",s=r.allTurns===true,o=typeof r.tailTurnsBeforeId=="string"?r.tailTurnsBeforeId:"",i=s?void 0:r.lastUserTurns??(n?void 0:1),C=r.tail,w={...i===void 0?{}:{tailTurns:i},...n?{turnId:n}:{},...s?{allTurns:true}:{},...o?{tailTurnsBeforeId:o}:{}},y=Object.keys(w).length>0?{params:{cardId:e},body:w}:{params:{cardId:e}},f=h(k.readAll(y),"chatStore.readAll"),g=t(await T(m,e)),l=R(t(g.card_data).files).map((b,A)=>({idx:A,stored_name:t(b).stored_name})).filter(b=>typeof b.stored_name=="string"&&b.stored_name.length>0),_=(Array.isArray(f.records)?f.records:[]).map(b=>{let x=t(b.payload),p={...b},j=typeof b?.role=="string"?b.role:typeof x.role=="string"?String(x.role):"",q=typeof b?.text=="string"?b.text:typeof x.text=="string"?String(x.text):"";if(j==="system"){let $=de(q);if($!==null&&l.some(O=>O.idx===$)){let O=`Retrieve using inspect-file-contents --card-id ${e} --file-idx ${$}`;p.retrieval_hint=O,Object.keys(x).length>0&&typeof b.role!="string"&&(p.payload={...x,retrieval_hint:O});}}return p});return {cardId:e,messages:typeof C=="number"&&C>=0?_.slice(-C):_}}async function H(r){let e=String(r.cardId||"").trim(),n=Number(r.fileIdx);if(!e)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(n)||n<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let s=t(await T(m,e)),o=R(t(s.card_data).files).map(t);if(n>=o.length)throw new Error(`attachment index ${n} is out of range for card "${e}"`);let i=o[n],C=typeof i.stored_name=="string"?i.stored_name:null;return {cardId:e,fileIdx:n,downloadUrl:v({cardId:e,fileIdx:n,storedName:C}),...typeof i.name=="string"?{name:i.name}:{},...typeof i.stored_name=="string"?{stored_name:i.stored_name}:{},...typeof i.mime_type=="string"?{mime_type:i.mime_type}:{},...typeof i.size=="number"?{size:i.size}:{},...typeof i.uploaded_at=="string"?{uploaded_at:i.uploaded_at}:{}}}async function D(r){return await c.validateCardPreflight({body:ce(r.candidateCardContent)})}function G(r){if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!r.mockFetchedSources||typeof r.mockFetchedSources!="object"||Array.isArray(r.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let e=c.evalCardCompute({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires,"mock-fetched-sources":r.mockFetchedSources}});if(e.status!=="success")return e;let n=t(K(e,"evalCardCompute")),s=t(r.candidateCardContent),o={card_data:t(s.card_data),requires:t(r.mockRequires),fetched_sources:t(r.mockFetchedSources),computed_values:t(n.computed_values)};return {status:"success",data:{cardId:typeof n.cardId=="string"?n.cardId:typeof s.id=="string"?s.id:"(unknown)",ok:n.ok===true,computed_values:t(n.computed_values),errors:R(n.errors).map(i=>{let C=t(i);return {bindTo:typeof C.bindTo=="string"?C.bindTo:"",error:typeof C.error=="string"?C.error:""}}),provides_outputs:W(s,o),rendered_view:N(s,o)}}}async function Q(r){return await c.probeSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function X(r){return await c.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function Y(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let n=t(await T(m,e)),s=R(n.source_defs).filter(i=>!!i&&typeof i=="object"&&!Array.isArray(i)),o={};if(r.sourceIdx>=0&&r.sourceIdx<s.length){let i=s[r.sourceIdx],C=chunkIXZG74EW_cjs.a.enrichSourcesSync([i],{card_data:t(n.card_data),requires:r.mockRequires});Array.isArray(C)&&C.length>0&&(o=t(C[0]._projections));}return await c.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":n,"mock-requires":r.mockRequires,"mock-projections":o}})}async function Z(r){let e=t(await S(c.simulateCardCycle({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires}}),"simulateCardCycle")),n=t(r.candidateCardContent),s=t(e.validation),o=R(e.source_probes),i=R(e.projection_errors),C=t(e.fetched_sources),w=R(e.compute_errors),y=t(e.computed_values),f={card_data:t(n.card_data),requires:r.mockRequires,fetched_sources:C,computed_values:y},g=[];for(let l of R(s.issues))typeof l=="string"&&l&&g.push(l);for(let l of o){let u=t(l),_=typeof u.bindTo=="string"?u.bindTo:"source",b=typeof u.error=="string"?u.error:"";b&&g.push(`${_}: ${b}`);}for(let l of i){let u=t(l),_=typeof u.bindTo=="string"?u.bindTo:"source",b=typeof u.key=="string"?u.key:"projection",A=typeof u.error=="string"?u.error:"projection failed";g.push(`${_}.${b}: ${A}`);}for(let l of w){let u=t(l),_=typeof u.bindTo=="string"?u.bindTo:"compute",b=typeof u.error=="string"?u.error:"compute failed";g.push(`${_}: ${b}`);}return {status:"success",data:{cardId:typeof e.cardId=="string"?e.cardId:"(unknown)",ok:e.ok===true,issues:g,provides_outputs:W(n,f),rendered_view:N(n,f)}}}async function ee(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get"),s=Array.isArray(n.cards)?n.cards.map(t):[];if(s.some(J))throw Object.assign(new Error(`Card "${e}" not found`),{statusCode:404});return s.map(o=>F(o))}async function re(r){let e=String(r.cardId||"").trim(),n=String(r.role||"").trim(),s=typeof r.text=="string"?r.text:"",o=typeof r.turn=="string"?r.turn:"";if(!e)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!n)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(n==="assistant"&&o){let y=h(k.readAll({params:{cardId:e},body:{turnId:o}}),"chatStore.readAll(existing turn messages)"),f=Array.isArray(y.records)?y.records.find(g=>g.role==="assistant"&&String(g.turn||"")===o):void 0;if(f)return {status:"success",data:{cardId:e,id:String(f.id),role:n,turn:o,files:Array.isArray(f.files)?f.files:[]}}}let i=await Promise.all(R(r.files).map(async y=>{let f=t(y),g=String(f.file_name??f.fileName??f.name??"").trim(),l=String(f.content_type??f.contentType??"application/octet-stream");if(!g)throw new Error("file entry requires file_name");return await M({cardId:e,fileName:g,contentType:l,bytes:B(f)})})),C=i.map(y=>y.file);i.forEach((y,f)=>{let g=t(y.file),l=typeof y.file_idx=="number"&&Number.isInteger(y.file_idx)&&y.file_idx>=0?y.file_idx:f,u=n==="assistant"?`AI generated: ${String(g.name||"")} as ${String(g.stored_name||"")} #${l}`:`file uploaded: ${String(g.name||"")} as ${String(g.stored_name||"")} #${l}`;h(k.append({params:{cardId:e},body:{role:"system",text:u,files:[],turn:o}}),"chatStore.append(system attachment message)");});let w=h(k.append({params:{cardId:e},body:{role:n,text:s,files:C,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:e,id:String(w.id),role:n,turn:o,files:C}}}async function te(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("manageUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),i=t(o),C=t(i.data);if(i.status!=="success"||C.isValid!==true)return {status:"fail",step:"validate",validation:o};let w=null;try{w=await T(m,e);}catch{w=null;}let y=w&&ue(t(w),"meta")?{...s,meta:t(w).meta}:s,f=await m.set({body:y});h(f,"cardStore.set");let g;try{g=await d.upsertCard({params:{cardId:e,restart:!0}}),h(g,"upsertCard");}catch(u){try{w&&await m.set({body:w});}catch{}throw u}let l=null;try{l=await d.cardRefreshedNotify({params:{cardId:e}}),h(l,"cardRefreshedNotify");}catch{l=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:g,refresh_notify:l}}}async function ne(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageRemoveCard requires cardId");let n=await d.removeCard({params:{id:e}});h(n,"removeCard");let s=await m.del({params:{id:e}});return h(s,"cardStore.del"),{status:"success",data:{board_result:n,store_result:s}}}async function ae(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("adminReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get");return Array.isArray(n.cards)?n.cards.map(s=>t(s)):[]}async function oe(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("adminUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),i=t(o),C=t(i.data);if(i.status!=="success"||C.isValid!==true)return {status:"fail",step:"validate",validation:o};let w=null;try{w=await T(m,e);}catch{w=null;}let y=w?t(t(w).meta):{},f={...s,meta:{...y,__visible_controlplane_only:true}},g=await m.set({body:f});h(g,"cardStore.set");let l;try{l=await d.upsertCard({params:{cardId:e,restart:!0}}),h(l,"upsertCard");}catch(_){try{w&&await m.set({body:w});}catch{}throw _}let u=null;try{u=await d.cardRefreshedNotify({params:{cardId:e}}),h(u,"cardRefreshedNotify");}catch{u=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:l,refresh_notify:u}}}function se(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("getChatProcessing requires cardId");let n=K(k.isProcessing({params:{cardId:e}}),"chatStore.isProcessing");return {cardId:e,active:!!n.active}}function ie(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("setChatProcessing requires cardId");if(typeof r.active!="boolean")throw new Error("setChatProcessing requires boolean active");return h(k.setProcessing({params:{cardId:e},body:{active:r.active}}),"chatStore.setProcessing"),{cardId:e,active:r.active}}return {discoverSourceKinds:P,inspectBoardRuntimeStatus:U,inspectCardDefinitionAndRuntime:L,inspectChatMessagesOnCards:E,inspectFileContents:H,preflightValidateCandidateCardDefinition:D,preflightMaterializeCandidateCard:G,preflightProbeSingleSourceInCandidateCard:Q,preflightRunSingleSourceInCandidateCard:X,preflightRunSingleSourceInLiveCard:Y,preflightRunOneCycleWithCandidateCard:Z,manageReadCard:ee,manageAddChatEntryAndAnyAttachments:re,manageUpsertCard:te,manageRemoveCard:ne,adminReadCard:ae,adminUpsertCard:oe,getChatProcessing:se,setChatProcessing:ie}}async function S(a,d){return h(await a,d)}exports.a=me;//# sourceMappingURL=chunk-YEB5QHGE.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-YEB5QHGE.cjs.map
|