yaml-flow 8.9.2 → 8.11.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 +5 -5
- package/browser/live-cards.js +15 -15
- package/browser/live-cards.schema.json +35 -53
- package/browser/server-runtime-controlface.js +2 -2
- package/examples/board/cards/card-concentration.json +64 -16
- package/examples/board/cards/card-my-identity.json +1 -4
- package/examples/board/cards/card-portfolio-intelligence.json +1 -5
- package/examples/board/cards/card-rebalance-sim.json +1 -4
- package/examples/board/cards/cardT-market-prices.json +1 -4
- package/examples/board/cards/cardT-portfolio-value.json +35 -10
- package/examples/board/cards/cardT-portfolio.json +1 -4
- package/lib/board-live-cards-mcp.cjs +1 -1
- package/lib/board-live-cards-mcp.d.cts +0 -2
- package/lib/board-live-cards-mcp.d.ts +0 -2
- package/lib/board-live-cards-mcp.js +1 -1
- package/lib/board-live-cards-node.cjs +2 -2
- package/lib/board-live-cards-node.js +1 -1
- package/lib/board-live-cards-public.cjs +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.js +1 -1
- package/lib/board-livegraph-runtime/index.cjs +1 -1
- package/lib/board-livegraph-runtime/index.js +1 -1
- package/lib/card-compute/index.cjs +1 -1
- package/lib/card-compute/index.js +1 -1
- package/lib/card-validation.cjs +1 -1
- package/lib/card-validation.js +1 -1
- package/lib/chunk-2LGCYN35.js +2 -0
- package/lib/{chunk-BVQISI6G.js → chunk-5U5NMYGT.js} +3 -3
- package/lib/chunk-6M3RIGUH.js +2 -0
- package/lib/chunk-ATOQP3BD.js +2 -0
- package/lib/{chunk-WYKCHXBZ.cjs → chunk-BDT43KYE.cjs} +3 -3
- package/lib/chunk-CPJXGK2T.cjs +2 -0
- package/lib/{chunk-OEL5P7XE.js → chunk-CZ6ZFWFT.js} +2 -2
- package/lib/{chunk-7W4QQX7S.cjs → chunk-FFHG3CFU.cjs} +2 -2
- package/lib/chunk-GHUW6P4G.cjs +2 -0
- package/lib/{chunk-ZA4FS27N.js → chunk-H5FKNSCO.js} +3 -3
- package/lib/{chunk-GLKWEPX6.js → chunk-MEL5LKF7.js} +2 -2
- package/lib/{chunk-KSKPS6OO.cjs → chunk-NMOUBZXX.cjs} +2 -2
- package/lib/{chunk-GTHQJXYW.cjs → chunk-O65MSWUE.cjs} +2 -2
- package/lib/chunk-QBEQL4TL.cjs +2 -0
- package/lib/chunk-QEHKMLHA.cjs +3 -0
- package/lib/{chunk-YXKWIPQM.cjs → chunk-VNLMJEIX.cjs} +3 -3
- package/lib/{chunk-4VZL3GWU.js → chunk-WQANIJAQ.js} +3 -3
- package/lib/{chunk-N5RUH4NG.cjs → chunk-X5CZE2L7.cjs} +3 -3
- package/lib/chunk-YT76JNKE.js +3 -0
- package/lib/{chunk-7E5NKZIO.js → chunk-ZCU5O2LR.js} +2 -2
- package/lib/cloud-storage.cjs +1 -1
- package/lib/cloud-storage.js +1 -1
- package/lib/continuous-event-graph/index.cjs +1 -1
- package/lib/continuous-event-graph/index.js +1 -1
- package/lib/firestore-storage/index.cjs +1 -1
- package/lib/firestore-storage/index.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/index.js +1 -1
- package/lib/localstorage-storage/index.cjs +1 -1
- package/lib/localstorage-storage/index.js +1 -1
- package/lib/server-runtime/index.cjs +1 -1
- package/lib/server-runtime/index.js +1 -1
- package/lib/server-runtime-controlface/index.cjs +1 -1
- package/lib/server-runtime-controlface/index.js +1 -1
- package/lib/server-runtime-core/index.cjs +1 -1
- package/lib/server-runtime-core/index.js +1 -1
- package/package.json +1 -1
- package/schema/live-cards.schema.json +35 -53
- package/lib/chunk-CBRVINMT.js +0 -2
- package/lib/chunk-E46UCDYN.js +0 -2
- package/lib/chunk-IRGTOCEU.cjs +0 -2
- package/lib/chunk-JHXRGPL7.cjs +0 -3
- package/lib/chunk-M53MX233.js +0 -3
- package/lib/chunk-NLC4FN7V.cjs +0 -2
- package/lib/chunk-RWAEV253.js +0 -2
- package/lib/chunk-UG55PF75.cjs +0 -2
package/lib/chunk-RWAEV253.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-E46UCDYN.js';function P(s,d){if(s?.status==="success")return Object.prototype.hasOwnProperty.call(s,"data")?s.data:void 0;throw s?.status==="fail"||s?.status==="error"?new Error(s.error||`${d} failed`):new Error(`${d} returned an unexpected response`)}function G(s,d){if(s?.status==="success"&&Object.prototype.hasOwnProperty.call(s,"data"))return s.data;throw s?.status==="success"?new Error(`${d} returned success without data`):s?.status==="fail"||s?.status==="error"?new Error(s.error||`${d} failed`):new Error(`${d} returned an unexpected response`)}function n(s){return s&&typeof s=="object"&&!Array.isArray(s)?s:{}}function y(s){return Array.isArray(s)?s:[]}function N(s,d){if(typeof d!="string"||d.length===0)return;let c=s,p=d;p.startsWith("fetched_sources.")&&(c=n(s).fetched_sources,p=p.slice(16));for(let g of p.split(".")){if(c==null||typeof c!="object")return;c=c[g];}return c}function z(s,d){let c=n(s.view),p=y(c.elements);return {layout:c.layout,features:c.features,elements:p.map((g,h)=>{let R=n(g),b=n(R.data),k=typeof R.visible=="string"?!!N(d,R.visible):true,x=typeof b.bind=="string"?b.bind:void 0,S=typeof b.maxRows=="number"?b.maxRows:void 0,B=x?N(d,x):void 0,q={id:typeof R.id=="string"&&R.id?R.id:`element-${h}`,kind:R.kind,label:R.label,visible:k};return B!==void 0&&(q.resolved=Array.isArray(B)&&typeof S=="number"?B.slice(0,S):B),q})}}function Q(s,d){let c=typeof s.id=="string"&&s.id?s.id:"card",p=y(s.provides),g=p.length>0?p:[{bindTo:c,ref:"card_data"}],h={};for(let R of g){let b=n(R),k=typeof b.bindTo=="string"?b.bindTo:"",x=typeof b.ref=="string"?b.ref:"";if(!k||!x)continue;let S=N(d,x);S!==void 0&&(h[k]=S);}return h}function be(s){if(typeof s!="string"||!s.trim())return null;let d=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(s.trim());if(!d)return null;let c=Number.parseInt(d[2],10);return !Number.isInteger(c)||c<0?null:c}function ke(s){return {"card-content":s}}function j(s){let d={...s};return delete d.__private,d}function he(s,d){return Object.prototype.hasOwnProperty.call(s,d)}function Re(s){return typeof structuredClone=="function"?structuredClone(s):JSON.parse(JSON.stringify(s))}function ve(s,d){let c=Re(s);if(!d||Object.keys(d).length===0)return c;function p(g,h,R){let b=String(h||"").split(".").filter(Boolean);if(!b.length)return;let k=g;for(let x=0;x<b.length-1;x+=1){let S=b[x];(!k[S]||typeof k[S]!="object")&&(k[S]={}),k=k[S];}k[b[b.length-1]]=R;}if(d.fieldValues!==void 0&&d.fieldValues!==null){let g=null,h=n(c.view),R=y(h.elements);for(let b of R){let k=n(n(b).data);if(typeof k.writeTo=="string"&&k.writeTo){g=k.writeTo;break}}return g?p(c,g,d.fieldValues):typeof d.fieldValues=="object"&&!Array.isArray(d.fieldValues)&&(c.card_data={...n(c.card_data),...d.fieldValues}),c}if(Array.isArray(d._stagedFiles)&&d._stagedFiles.length>0)return c;for(let[g,h]of Object.entries(d))g!=="_stagedFiles"&&(h!==null&&typeof h=="object"&&!Array.isArray(h)&&c[g]!==null&&typeof c[g]=="object"&&!Array.isArray(c[g])?c[g]={...c[g],...h}:c[g]=h);return c}function D(s){return n(s.__private).visible_controlplane_only===true}async function T(s,d){let c=await A(s.get({params:{id:d}}),"cardStore.get"),p=Array.isArray(c?.cards)?c.cards:[];if(p.length===0)throw new Error(`Card "${d}" not found`);return p[0]}function Ae(s){let{board:d,nonCore:c,cardStore:p,chatStore:g,processAccumulated:h,sourceFetchDone:R,sourceFetchFailed:b,uploadCardFile:k,buildFileDownloadUrl:x,readFetchedSourceJsonByRef:S}=s;function B(e,r){if(typeof e=="function")return e;throw new Error(`${r} is not configured for this MCP facade`)}async function q(){let e=await A(p.get({}),"cardStore.get");return Array.isArray(e.cards)?e.cards.map(r=>n(r)).filter(r=>!D(r)):[]}function X(e){if(Array.isArray(e.bytes))return new Uint8Array(e.bytes.map(r=>Math.max(0,Math.min(255,Number(r)||0))));if(typeof e.text=="string")return new TextEncoder().encode(e.text);if(typeof e.base64=="string"){let r=String(e.base64).replace(/-/g,"+").replace(/_/g,"/"),t=r+"=".repeat((4-r.length%4)%4),a=atob(t);return Uint8Array.from(a,o=>o.charCodeAt(0))}throw new Error("file entry requires bytes, text, or base64")}async function Y(){let e=n(await A(c.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:e.version,commonSourceFields:n(e.commonSourceDefFields),sourceKinds:n(e.sourceKinds)}}async function Z(){let e=n(await A(d.status({}),"status")),r=n(e.summary),t=y(e.cards),a=await A(p.get({}),"cardStore.get"),o=new Set((Array.isArray(a.cards)?a.cards.map(n):[]).filter(D).map(u=>typeof u.id=="string"?u.id:"").filter(Boolean)),i=t.filter(u=>!o.has(String(n(u).name??"")));return {meta:n(e.meta),summary:{card_count:typeof r.card_count=="number"?r.card_count:0,completed:typeof r.completed=="number"?r.completed:0,eligible:typeof r.eligible=="number"?r.eligible:0,pending:typeof r.pending=="number"?r.pending:0,blocked:typeof r.blocked=="number"?r.blocked:0,in_progress:typeof r.in_progress=="number"?r.in_progress:0,failed:typeof r.failed=="number"?r.failed:0,unresolved:typeof r.unresolved=="number"?r.unresolved:0},cards:i.map(u=>{let l=n(u);return {"card-id":typeof l.name=="string"?l.name:null,status:l.status??null,error:l.error??null,requires:y(l.requires),requires_satisfied:y(l.requires_satisfied),requires_missing:y(l.requires_missing),provides_declared:y(l.provides_declared),provides_runtime:y(l.provides_runtime)}})}}async function ee(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let t=n(await A(d.status({}),"status")),o=y(t.cards).map(n).find(f=>f.name===r);if(!o)throw new Error(`card "${r}" not found in board status`);let i=n(await T(p,r)),u=j(i),l=y(o.requires_satisfied).filter(f=>typeof f=="string"&&!!f),I=y(o.provides_runtime).filter(f=>typeof f=="string"&&!!f),v=Object.fromEntries(await Promise.all(l.map(async f=>[f,await A(d.getOutputsDataObject({params:{key:f}}),`getOutputsDataObject(${f})`)]))),_=Object.fromEntries(await Promise.all(I.map(async f=>[f,await A(d.getOutputsDataObject({params:{key:f}}),`getOutputsDataObject(${f})`)]))),m=n(await A(d.getOutputsComputedValues({params:{key:r}}),"getOutputsComputedValues")),C=await A(d.getOutputsFetchedSources({params:{key:r}}),"getOutputsFetchedSources"),M=y(i.source_defs).map(n),w={};for(let f of M)typeof f.bindTo=="string"&&typeof f.outputFile=="string"&&(w[f.outputFile]=f.bindTo);let U={};for(let[f,F]of Object.entries(C)){let O=w[f]??f;if(!S||typeof F!="string"){U[O]=null;continue}try{U[O]=S({cardId:r,ref:F});}catch{U[O]=null;}}let L={card_data:n(i.card_data),requires:v,fetched_sources:U,computed_values:m};return {cardId:r,card_status_in_board:o,card_definition_and_static_data:u,refs_for_fetched_source_files:C,runtime_data:{requires:v,provides:_,computed_values:m,rendered_view:z(i,L)}}}async function re(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("inspectChatMessagesOnCards requires cardId");let t=typeof e.turnId=="string"?e.turnId:"",a=e.allTurns===true,o=typeof e.tailTurnsBeforeId=="string"?e.tailTurnsBeforeId:"",i=a?void 0:e.lastUserTurns??(t?void 0:1),u=e.tail,l={...i===void 0?{}:{tailTurns:i},...t?{turnId:t}:{},...a?{allTurns:true}:{},...o?{tailTurnsBeforeId:o}:{}},I=Object.keys(l).length>0?{params:{cardId:r},body:l}:{params:{cardId:r}},v=P(await g.readAll(I),"chatStore.readAll"),_=n(await T(p,r)),m=y(n(_.card_data).files).map((w,U)=>({idx:U,stored_name:n(w).stored_name})).filter(w=>typeof w.stored_name=="string"&&w.stored_name.length>0),M=(Array.isArray(v.records)?v.records:[]).map(w=>{let L=n(w.payload),f={...w},F=typeof w?.role=="string"?w.role:typeof L.role=="string"?String(L.role):"",O=typeof w?.text=="string"?w.text:typeof L.text=="string"?String(L.text):"";if(F==="system"){let V=be(O);if(V!==null&&m.some(E=>E.idx===V)){let E=`Retrieve using inspect-file-contents --card-id ${r} --file-idx ${V}`;f.retrieval_hint=E,Object.keys(L).length>0&&typeof w.role!="string"&&(f.payload={...L,retrieval_hint:E});}}return f});return {cardId:r,messages:typeof u=="number"&&u>=0?M.slice(-u):M}}async function te(e){let r=String(e.cardId||"").trim(),t=Number(e.fileIdx);if(!r)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(t)||t<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let a=n(await T(p,r)),o=y(n(a.card_data).files).map(n);if(t>=o.length)throw new Error(`attachment index ${t} is out of range for card "${r}"`);let i=o[t],u=typeof i.stored_name=="string"?i.stored_name:null;return {cardId:r,fileIdx:t,downloadUrl:x({cardId:r,fileIdx:t,storedName:u}),...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 $(e){return await c.validateCardPreflight({body:ke(e.candidateCardContent)})}function ne(e){if(!e.mockRequires||typeof e.mockRequires!="object"||Array.isArray(e.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!e.mockFetchedSources||typeof e.mockFetchedSources!="object"||Array.isArray(e.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let r=c.evalCardCompute({body:{"card-content":e.candidateCardContent,"mock-requires":e.mockRequires,"mock-fetched-sources":e.mockFetchedSources}});if(r.status!=="success")return r;let t=n(G(r,"evalCardCompute")),a=n(e.candidateCardContent),o={card_data:n(a.card_data),requires:n(e.mockRequires),fetched_sources:n(e.mockFetchedSources),computed_values:n(t.computed_values)};return {status:"success",data:{cardId:typeof t.cardId=="string"?t.cardId:typeof a.id=="string"?a.id:"(unknown)",ok:t.ok===true,computed_values:n(t.computed_values),errors:y(t.errors).map(i=>{let u=n(i);return {bindTo:typeof u.bindTo=="string"?u.bindTo:"",error:typeof u.error=="string"?u.error:""}}),provides_outputs:Q(a,o),rendered_view:z(a,o)}}}async function ae(e){return await c.probeSourcePreflight({params:{sourceIdx:e.sourceIdx},body:{"card-content":e.candidateCardContent,"mock-projections":e.mockProjections}})}async function oe(e){return await c.runSourcePreflight({params:{sourceIdx:e.sourceIdx},body:{"card-content":e.candidateCardContent,"mock-projections":e.mockProjections}})}async function se(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!e.mockRequires||typeof e.mockRequires!="object"||Array.isArray(e.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let t=n(await T(p,r)),a$1=y(t.source_defs).filter(i=>!!i&&typeof i=="object"&&!Array.isArray(i)),o={};if(e.sourceIdx>=0&&e.sourceIdx<a$1.length){let i=a$1[e.sourceIdx],u=a.enrichSourcesSync([i],{card_data:n(t.card_data),requires:e.mockRequires});Array.isArray(u)&&u.length>0&&(o=n(u[0]._projections));}return await c.runSourcePreflight({params:{sourceIdx:e.sourceIdx},body:{"card-content":t,"mock-requires":e.mockRequires,"mock-projections":o}})}async function ie(e){let r=n(await A(c.simulateCardCycle({body:{"card-content":e.candidateCardContent,"mock-requires":e.mockRequires}}),"simulateCardCycle")),t=n(e.candidateCardContent),a=n(r.validation),o=y(r.source_probes),i=y(r.projection_errors),u=n(r.fetched_sources),l=y(r.compute_errors),I=n(r.computed_values),v={card_data:n(t.card_data),requires:e.mockRequires,fetched_sources:u,computed_values:I},_=[];for(let m of y(a.issues))typeof m=="string"&&m&&_.push(m);for(let m of o){let C=n(m),M=typeof C.bindTo=="string"?C.bindTo:"source",w=typeof C.error=="string"?C.error:"";w&&_.push(`${M}: ${w}`);}for(let m of i){let C=n(m),M=typeof C.bindTo=="string"?C.bindTo:"source",w=typeof C.key=="string"?C.key:"projection",U=typeof C.error=="string"?C.error:"projection failed";_.push(`${M}.${w}: ${U}`);}for(let m of l){let C=n(m),M=typeof C.bindTo=="string"?C.bindTo:"compute",w=typeof C.error=="string"?C.error:"compute failed";_.push(`${M}: ${w}`);}return {status:"success",data:{cardId:typeof r.cardId=="string"?r.cardId:"(unknown)",ok:r.ok===true,issues:_,provides_outputs:Q(t,v),rendered_view:z(t,v)}}}async function K(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("manageReadCard requires cardId");let t=await A(p.get({params:{id:r}}),"cardStore.get");return (Array.isArray(t.cards)?t.cards.map(n):[]).map(o=>j(o))}async function W(e){let r=await Promise.all(y(e.files).map(async t=>{let a=n(t),o=String(a.file_name??a.fileName??a.name??"").trim(),i=String(a.content_type??a.contentType??"application/octet-stream");if(!o)throw new Error("file entry requires file_name");return await k({cardId:e.cardId,fileName:o,contentType:i,bytes:X(a),suppressChatRecordWrite:true})}));for(let[t,a]of r.entries()){let o=n(a.file),i=typeof a.file_idx=="number"&&Number.isInteger(a.file_idx)&&a.file_idx>=0?a.file_idx:t,u=e.role==="assistant"?`AI generated: ${String(o.name||"")} as ${String(o.stored_name||"")} #${i}`:`file uploaded: ${String(o.name||"")} as ${String(o.stored_name||"")} #${i}`;P(await g.append({params:{cardId:e.cardId},body:{role:"system",text:u,files:[],turn:e.turn}}),"chatStore.append(system attachment message)");}return r.map(t=>t.file)}async function de(e){let r=String(e.cardId||"").trim(),t=String(e.role||"user").trim()||"user",a=typeof e.turn=="string"?e.turn:"";if(!r)throw new Error("manageAddChatAttachment requires cardId");let o=await W({cardId:r,role:t,turn:a,files:e.files});return {status:"success",data:{cardId:r,turn:a,files:o}}}async function ce(e){let r=String(e.cardId||"").trim(),t=String(e.role||"").trim(),a=typeof e.text=="string"?e.text:"",o=typeof e.turn=="string"?e.turn:"";if(!r)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!t)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(t==="assistant"&&o){let l=P(await g.readAll({params:{cardId:r},body:{turnId:o}}),"chatStore.readAll(existing turn messages)"),I=Array.isArray(l.records)?l.records.find(v=>v.role==="assistant"&&String(v.turn||"")===o):void 0;if(I)return {status:"success",data:{cardId:r,id:String(I.id),role:t,turn:o,files:Array.isArray(I.files)?I.files:[]}}}let i=await W({cardId:r,role:t,turn:o,files:e.files}),u=P(await g.append({params:{cardId:r},body:{role:t,text:a,files:i,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:r,id:String(u.id),role:t,turn:o,files:i}}}async function ue(e,r={}){let t=String(e.cardId||"").trim(),a=n(e.patch);if(!t)throw new Error("managePatchCard requires cardId");let o=await K({cardId:t}),i=n(o[0]),u=ve(i,a);return J({cardId:t,candidateCardContent:u},r)}async function J(e,r={}){let t=String(e.cardId||"").trim(),a=n(e.candidateCardContent),o=j(a);if(!t)throw new Error("manageUpsertCard requires cardId");if(typeof o.id!="string"||!o.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(o.id!==t)throw new Error(`candidateCardContent.id must match cardId (${t})`);let i=null;try{i=await $({candidateCardContent:o});}catch(m){let C=m instanceof Error?m.message:String(m);if(!/non-core adapter is not configured/i.test(C))throw m;i=null;}if(i!==null){let m=n(i),C=n(m.data);if(m.status!=="success"||C.isValid!==true)return {status:"fail",step:"validate",validation:i}}let u=null;try{u=await T(p,t);}catch{u=null;}let l=u?n(u):null;if(l&&D(l)&&!r.allowControlplaneOnlyCards)throw Object.assign(new Error(`Card "${t}" not found`),{statusCode:404});let I={...o,...l&&he(l,"__private")?{__private:l.__private}:{}},v=await p.set({body:I});P(v,"cardStore.set");let _;try{_=await d.upsertCard({params:{cardId:t,restart:!0}}),P(_,"upsertCard");}catch(m){try{u&&await p.set({body:u});}catch{}throw m}return {status:"success",data:{validation:i,card_saved:null,board_result:_}}}async function le(e,r={}){let t=String(e.cardId||"").trim();if(!t)throw new Error("manageRemoveCard requires cardId");if(!r.allowControlplaneOnlyCards){let i=await A(p.get({params:{id:t}}),"cardStore.get");if((Array.isArray(i.cards)?i.cards.map(n):[]).some(D))throw Object.assign(new Error(`Card "${t}" not found`),{statusCode:404})}let a=await d.removeCard({params:{id:t}});P(a,"removeCard");let o=await p.del({params:{id:t}});return P(o,"cardStore.del"),{status:"success",data:{board_result:a,store_result:o}}}async function pe(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("adminReadCard requires cardId");let t=await A(p.get({params:{id:r}}),"cardStore.get");return Array.isArray(t.cards)?t.cards.map(a=>n(a)):[]}async function me(e){let r=String(e.cardId||"").trim(),t=n(e.candidateCardContent),a=j(t);if(!r)throw new Error("adminUpsertCard requires cardId");if(typeof a.id!="string"||!a.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(a.id!==r)throw new Error(`candidateCardContent.id must match cardId (${r})`);let o=await $({candidateCardContent:a}),i=n(o),u=n(i.data);if(i.status!=="success"||u.isValid!==true)return {status:"fail",step:"validate",validation:o};let l=null;try{l=await T(p,r);}catch{l=null;}let I=l?n(n(l).__private):{},v={...a,__private:{...I,visible_controlplane_only:true}},_=await p.set({body:v});P(_,"cardStore.set");let m;try{m=await d.upsertCard({params:{cardId:r,restart:!0}}),P(m,"upsertCard");}catch(C){try{l&&await p.set({body:l});}catch{}throw C}return {status:"success",data:{validation:o,card_saved:null,board_result:m}}}async function fe(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("getChatProcessing requires cardId");let t=G(await g.isProcessing({params:{cardId:r}}),"chatStore.isProcessing");return {cardId:r,active:!!t.active}}async function ge(e){let r=String(e.cardId||"").trim();if(!r)throw new Error("setChatProcessing requires cardId");if(typeof e.active!="boolean")throw new Error("setChatProcessing requires boolean active");return P(await g.setProcessing({params:{cardId:r},body:{active:e.active}}),"chatStore.setProcessing"),{cardId:r,active:e.active}}async function Ce(){let e=await B(h,"webhook.process-accumulated")();return e?.status==="fail"||e?.status==="error"?e:{status:"success",data:{runtime_result:Object.prototype.hasOwnProperty.call(e??{},"data")?e.data??null:null}}}async function we(e){let r=String(e.token||"").trim(),t=String(e.ref||"").trim();if(!r)throw new Error("webhookSourceFetchDone requires token");if(!t)throw new Error("webhookSourceFetchDone requires ref");let a=await B(R,"webhook.source-fetch-done")({token:r,ref:t});return a?.status==="fail"||a?.status==="error"?a:{status:"success",data:{token:r,ref:t,runtime_result:Object.prototype.hasOwnProperty.call(a??{},"data")?a.data??null:null}}}async function ye(e){let r=String(e.token||"").trim(),t=String(e.reason||"").trim();if(!r)throw new Error("webhookSourceFetchFailed requires token");if(!t)throw new Error("webhookSourceFetchFailed requires reason");let a=await B(b,"webhook.source-fetch-failed")({token:r,reason:t});return a?.status==="fail"||a?.status==="error"?a:{status:"success",data:{token:r,reason:t,runtime_result:Object.prototype.hasOwnProperty.call(a??{},"data")?a.data??null:null}}}return {listRuntimeCards:q,discoverSourceKinds:Y,inspectBoardRuntimeStatus:Z,inspectCardDefinitionAndRuntime:ee,inspectChatMessagesOnCards:re,inspectFileContents:te,preflightValidateCandidateCardDefinition:$,preflightMaterializeCandidateCard:ne,preflightProbeSingleSourceInCandidateCard:ae,preflightRunSingleSourceInCandidateCard:oe,preflightRunSingleSourceInLiveCard:se,preflightRunOneCycleWithCandidateCard:ie,manageReadCard:K,manageAddChatAttachment:de,manageAddChatEntryAndAnyAttachments:ce,managePatchCard:ue,manageUpsertCard:J,manageRemoveCard:le,adminReadCard:pe,adminUpsertCard:me,getChatProcessing:fe,setChatProcessing:ge,webhookProcessAccumulated:Ce,webhookSourceFetchDone:we,webhookSourceFetchFailed:ye}}async function A(s,d){return P(await s,d)}export{Ae as a};//# sourceMappingURL=chunk-RWAEV253.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-RWAEV253.js.map
|
package/lib/chunk-UG55PF75.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use strict';var module$1=require('module');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;var y=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-UG55PF75.cjs', document.baseURI).href))),u=y("./jsonata-sync.cjs"),p=u;function c(t,r){if(!r||!t)return;let s=r.split("."),e=t;for(let n=0;n<s.length;n++){if(e==null)return;e=e[s[n]];}return e}function f(t,r,s){let e=r.split("."),n=t;for(let o=0;o<e.length-1;o++)(n[e[o]]==null||typeof n[e[o]]!="object")&&(n[e[o]]={}),n=n[e[o]];n[e[e.length-1]]=s;}async function m(t,r){if(!t?.compute?.length)return t;t.card_data||(t.card_data={}),t.computed_values={},t._sourcesData=r?.sourcesData??{};let s=t.requires??{},e={card_data:t.card_data,requires:s,expects_data:s,fetched_sources:t._sourcesData,data:t.computed_values,computed_values:t.computed_values};for(let n of t.compute)try{let o=await u(n.expr).evaluate(e);f(t.computed_values,n.bindTo,o),e.computed_values=t.computed_values;}catch{}return t}function g(t,r){if(!t?.compute?.length)return {ok:true,node:t};t.card_data||(t.card_data={}),t.computed_values={},t._sourcesData=r?.sourcesData??{};let s=t.requires??{},e={card_data:t.card_data,requires:s,expects_data:s,fetched_sources:t._sourcesData,data:t.computed_values,computed_values:t.computed_values},n=[];for(let o of t.compute)try{let a=p(o.expr).evaluate(e);f(t.computed_values,o.bindTo,a),e.computed_values=t.computed_values;}catch(a){let i=a instanceof Error?a.message:String(a);n.push({bindTo:o.bindTo,error:i});}return n.length>0?{ok:true,node:t,errors:n}:{ok:true,node:t}}async function b(t,r,s){let e={...s??{},card_data:r.card_data??{},requires:r.requires??{},fetched_sources:r._sourcesData??{},computed_values:r.computed_values??{}};return u(t).evaluate(e)}function _(t,r){return r.startsWith("fetched_sources.")?c(t._sourcesData??{},r.slice(16)):c(t,r)}var d=new Set(["metric","table","editable-table","chart","form","filter","list","notes","todo","alert","narrative","badge","text","markdown","ref","custom","actions"]),v=new Set(["id","meta","requires","provides","view","card_data","compute","source_defs"]);function h(t){let r=[];if(!t||typeof t!="object"||Array.isArray(t))return {ok:false,errors:["Node must be a non-null object"]};let s=t;(typeof s.id!="string"||!s.id)&&r.push("id: required, must be a non-empty string");for(let e of Object.keys(s))v.has(e)||r.push(`Unknown top-level key: "${e}"`);if((s.card_data==null||typeof s.card_data!="object"||Array.isArray(s.card_data))&&r.push("card_data: required, must be an object"),s.meta!=null)if(typeof s.meta!="object"||Array.isArray(s.meta))r.push("meta: must be an object");else {let e=s.meta;e.title!=null&&typeof e.title!="string"&&r.push("meta.title: must be a string"),e.tags!=null&&!Array.isArray(e.tags)&&r.push("meta.tags: must be an array");}if(s.requires!=null&&!Array.isArray(s.requires)&&r.push("requires: must be an array of strings"),s.provides!=null&&(Array.isArray(s.provides)?s.provides.forEach((e,n)=>{if(!e||typeof e!="object"||Array.isArray(e))r.push(`provides[${n}]: must be an object with bindTo and ref`);else {let o=e;(typeof o.bindTo!="string"||!o.bindTo)&&r.push(`provides[${n}]: missing required "bindTo" string`),(typeof o.ref!="string"||!o.ref)&&r.push(`provides[${n}]: missing required "ref" string`);}}):r.push("provides: must be an array of { bindTo, ref } bindings")),s.compute!=null&&(Array.isArray(s.compute)?s.compute.forEach((e,n)=>{if(!e||typeof e!="object"||Array.isArray(e))r.push(`compute[${n}]: must be a compute step object`);else {let o=e;(typeof o.bindTo!="string"||!o.bindTo)&&r.push(`compute[${n}]: missing required "bindTo" property`),(typeof o.expr!="string"||!o.expr)&&r.push(`compute[${n}]: missing required "expr" string (JSONata expression)`);}}):r.push("compute: must be an array of compute steps")),s.source_defs!=null)if(!Array.isArray(s.source_defs))r.push("source_defs: must be an array");else {let e=new Set,n=new Set;s.source_defs.forEach((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))r.push(`source_defs[${a}]: must be an object`);else {let i=o;typeof i.bindTo!="string"||!i.bindTo?r.push(`source_defs[${a}]: missing required "bindTo" property`):(e.has(i.bindTo)&&r.push(`source_defs[${a}]: bindTo "${i.bindTo}" is not unique across source_defs`),e.add(i.bindTo)),typeof i.outputFile!="string"||!i.outputFile?r.push(`source_defs[${a}]: missing required "outputFile" property`):(n.has(i.outputFile)&&r.push(`source_defs[${a}]: outputFile "${i.outputFile}" is not unique across source_defs`),n.add(i.outputFile));}});}if(s.view!=null)if(typeof s.view!="object"||Array.isArray(s.view))r.push("view: must be an object");else {let e=s.view;!Array.isArray(e.elements)||e.elements.length===0?r.push("view.elements: required, must be a non-empty array"):e.elements.forEach((n,o)=>{if(!n||typeof n!="object"){r.push(`view.elements[${o}]: must be an object`);return}!n.kind||typeof n.kind!="string"?r.push(`view.elements[${o}].kind: required, must be a string`):d.has(n.kind)||r.push(`view.elements[${o}].kind: unknown kind "${n.kind}". Valid: ${[...d].join(", ")}`),n.data!=null&&(typeof n.data!="object"||Array.isArray(n.data))&&r.push(`view.elements[${o}].data: must be an object`);}),e.layout!=null&&(typeof e.layout!="object"||Array.isArray(e.layout))&&r.push("view.layout: must be an object"),e.features!=null&&(typeof e.features!="object"||Array.isArray(e.features))&&r.push("view.features: must be an object");}return {ok:r.length===0,errors:r}}async function k(t,r){if(!t||t.length===0)return [];let s={card_data:r.card_data??{},requires:r.requires??{}};return Promise.all(t.map(async e=>{let n={};if(e.projections&&typeof e.projections=="object"&&!Array.isArray(e.projections)){for(let[o,a]of Object.entries(e.projections))if(typeof a=="string"&&a.trim().length>0)try{n[o]=await u(a).evaluate(s);}catch{n[o]=void 0;}}return {...e,_projections:n}}))}function w(t,r){if(!t||t.length===0)return [];let s={card_data:r.card_data??{},requires:r.requires??{}};return t.map(e=>{let n={};if(e.projections&&typeof e.projections=="object"&&!Array.isArray(e.projections)){for(let[o,a]of Object.entries(e.projections))if(typeof a=="string"&&a.trim().length>0)try{n[o]=p(a).evaluate(s);}catch{n[o]=void 0;}}return {...e,_projections:n}})}var j={run:m,runSync:g,eval:b,resolve:_,validate:h,enrichSources:k,enrichSourcesSync:w},$=j;exports.a=j;exports.b=$;//# sourceMappingURL=chunk-UG55PF75.cjs.map
|
|
2
|
-
//# sourceMappingURL=chunk-UG55PF75.cjs.map
|