yaml-flow 8.6.1 → 8.6.2
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/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board/server/board-server.js +544 -45
- package/examples/board/server-config.json +2 -1
- package/examples/board/test/server-http-test.js +12 -4
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/{artifacts-store-lib-CLOtsiav.d.cts → artifacts-store-lib-BR-Samty.d.cts} +1 -1
- package/lib/{artifacts-store-lib-C1rtrkxm.d.ts → artifacts-store-lib-DT7XlWUL.d.ts} +1 -1
- package/lib/artifacts-store-public.d.cts +3 -3
- package/lib/artifacts-store-public.d.ts +3 -3
- package/lib/board-live-cards-mcp.cjs +1 -1
- package/lib/board-live-cards-mcp.d.cts +56 -23
- package/lib/board-live-cards-mcp.d.ts +56 -23
- package/lib/board-live-cards-mcp.js +1 -1
- package/lib/board-live-cards-node.cjs +8 -8
- package/lib/board-live-cards-node.d.cts +39 -21
- package/lib/board-live-cards-node.d.ts +39 -21
- package/lib/board-live-cards-node.js +8 -8
- package/lib/{board-live-cards-public-CBVjm327.d.ts → board-live-cards-public-BMUIPOrc.d.ts} +67 -42
- package/lib/board-live-cards-public-async-DKZqbJVU.d.ts +256 -0
- package/lib/board-live-cards-public-async-dMWNbWq6.d.cts +256 -0
- package/lib/{board-live-cards-public-CPJy-aGW.d.cts → board-live-cards-public-wkNmBIRC.d.cts} +67 -42
- package/lib/board-live-cards-public.cjs +1 -1
- package/lib/board-live-cards-public.d.cts +2 -2
- package/lib/board-live-cards-public.d.ts +2 -2
- 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 +7 -6
- package/lib/board-live-cards-server-runtime.d.ts +7 -6
- package/lib/board-live-cards-server-runtime.js +1 -1
- package/lib/board-worker-adapter.cjs +4 -3
- package/lib/board-worker-adapter.d.cts +24 -14
- package/lib/board-worker-adapter.d.ts +24 -14
- package/lib/board-worker-adapter.js +4 -3
- package/lib/card-store-public.d.cts +2 -2
- package/lib/card-store-public.d.ts +2 -2
- package/lib/{chat-storage-lib-CKylihjm.d.cts → chat-storage-lib-BIUbE-fM.d.cts} +1 -1
- package/lib/{chat-storage-lib-Bce-xx6l.d.ts → chat-storage-lib-BlG-sobS.d.ts} +1 -1
- package/lib/chat-store-public.d.cts +3 -3
- package/lib/chat-store-public.d.ts +3 -3
- package/lib/{chunk-CWREBRXS.js → chunk-BQS3EIEK.js} +3 -3
- package/lib/{chunk-LDAP75GN.js → chunk-CIAJNUR4.js} +2 -2
- package/lib/chunk-GJJMEAVN.cjs +2 -0
- package/lib/chunk-H5HBXPOI.cjs +3 -0
- package/lib/chunk-HEEDJEKM.js +2 -0
- package/lib/chunk-KQX6R4PV.cjs +8 -0
- package/lib/chunk-MLVTJASJ.js +2 -0
- package/lib/chunk-N6P2JW4W.js +3 -0
- package/lib/chunk-OEFTOO47.cjs +3 -0
- package/lib/chunk-OSWJKJLB.js +8 -0
- package/lib/chunk-PBCDDO4V.cjs +2 -0
- package/lib/{chunk-I4WH5U5D.cjs → chunk-PMUSJQSR.cjs} +2 -2
- package/lib/chunk-SCWHDI3I.js +2 -0
- package/lib/{chunk-UVE65IPR.cjs → chunk-SFVO2LB2.cjs} +3 -3
- package/lib/{chunk-5DB54ZX2.cjs → chunk-U2N6MCD5.cjs} +2 -2
- package/lib/chunk-VMW4Z6EF.js +3 -0
- package/lib/chunk-WOALA3V5.cjs +2 -0
- package/lib/{chunk-LBMEVV4U.js → chunk-XQRNDX4Q.js} +2 -2
- package/lib/cloud-storage.cjs +2 -0
- package/lib/cloud-storage.d.cts +177 -0
- package/lib/cloud-storage.d.ts +177 -0
- package/lib/cloud-storage.js +2 -0
- package/lib/execution-refs.cjs +1 -1
- package/lib/execution-refs.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/{types-DRl0Hy_p.d.cts → queue-lane-registry-BPKWWgd4.d.cts} +66 -14
- package/lib/{types-BuK2UMxk.d.ts → queue-lane-registry-Be6c0ftj.d.ts} +66 -14
- package/lib/server-runtime/index.cjs +1 -1
- package/lib/server-runtime/index.d.cts +18 -7
- package/lib/server-runtime/index.d.ts +18 -7
- package/lib/server-runtime/index.js +1 -1
- package/lib/step-machine-public/index.cjs +1 -1
- package/lib/step-machine-public/index.d.cts +1 -1
- package/lib/step-machine-public/index.d.ts +1 -1
- package/lib/step-machine-public/index.js +1 -1
- package/lib/{storage-interface-Ct-C4tlz.d.cts → storage-interface-BFiD3kyB.d.cts} +11 -1
- package/lib/{storage-interface-Ct-C4tlz.d.ts → storage-interface-BFiD3kyB.d.ts} +11 -1
- package/lib/stores/index.cjs +1 -1
- package/lib/stores/index.d.cts +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/index.js +1 -1
- package/lib/stores/kv.d.cts +1 -1
- package/lib/stores/kv.d.ts +1 -1
- package/package.json +6 -1
- package/lib/chunk-6APH25VI.js +0 -2
- package/lib/chunk-KNFFDVLD.cjs +0 -2
- package/lib/chunk-LVNQCE5X.cjs +0 -3
- package/lib/chunk-M7EQRS6W.js +0 -3
- package/lib/chunk-NJJ7WEDT.cjs +0 -2
- package/lib/chunk-P64UKI3L.cjs +0 -8
- package/lib/chunk-Q6VSL327.js +0 -8
- package/lib/chunk-VCCTAUIG.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-JMDHDY6M.js';function h(a,i){if(a?.status==="success")return Object.prototype.hasOwnProperty.call(a,"data")?a.data:void 0;throw a?.status==="fail"||a?.status==="error"?new Error(a.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function K(a,i){if(a?.status==="success"&&Object.prototype.hasOwnProperty.call(a,"data"))return a.data;throw a?.status==="success"?new Error(`${i} returned success without data`):a?.status==="fail"||a?.status==="error"?new Error(a.error||`${i} failed`):new Error(`${i} returned an unexpected response`)}function t(a){return a&&typeof a=="object"&&!Array.isArray(a)?a:{}}function y(a){return Array.isArray(a)?a:[]}function V(a,i){if(typeof i!="string"||i.length===0)return;let u=a,m=i;m.startsWith("fetched_sources.")&&(u=t(a).fetched_sources,m=m.slice(16));for(let k of m.split(".")){if(u==null||typeof u!="object")return;u=u[k];}return u}function N(a,i){let u=t(a.view),m=y(u.elements);return {layout:u.layout,features:u.features,elements:m.map((k,x)=>{let v=t(k),I=t(v.data),B=typeof v.visible=="string"?!!V(i,v.visible):true,U=typeof I.bind=="string"?I.bind:void 0,M=typeof I.maxRows=="number"?I.maxRows:void 0,L=U?V(i,U):void 0,E={id:typeof v.id=="string"&&v.id?v.id:`element-${x}`,kind:v.kind,label:v.label,visible:B};return L!==void 0&&(E.resolved=Array.isArray(L)&&typeof M=="number"?L.slice(0,M):L),E})}}function W(a,i){let u=typeof a.id=="string"&&a.id?a.id:"card",m=y(a.provides),k=m.length>0?m:[{bindTo:u,ref:"card_data"}],x={};for(let v of k){let I=t(v),B=typeof I.bindTo=="string"?I.bindTo:"",U=typeof I.ref=="string"?I.ref:"";if(!B||!U)continue;let M=V(i,U);M!==void 0&&(x[B]=M);}return x}function ie(a){if(typeof a!="string"||!a.trim())return null;let i=/^(file uploaded|AI generated|AI geneterated):\s*.*?#(\d+)\s*$/i.exec(a.trim());if(!i)return null;let u=Number.parseInt(i[2],10);return !Number.isInteger(u)||u<0?null:u}function ce(a){return {"card-content":a}}function F(a){let{meta:i,...u}=a;return u}function ue(a,i){return Object.prototype.hasOwnProperty.call(a,i)}function J(a){return t(a.meta).__visible_controlplane_only===true}async function T(a,i){let u=await S(a.get({params:{id:i}}),"cardStore.get"),m=Array.isArray(u?.cards)?u.cards:[];if(m.length===0)throw new Error(`Card "${i}" not found`);return m[0]}function me(a$1){let{board:i,nonCore:u,cardStore:m,chatStore:k,uploadCardFile:x,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 U(){let r=t(await S(u.describeTaskExecutorCapabilities({}),"describeTaskExecutorCapabilities"));return {version:r.version,commonSourceFields:t(r.commonSourceDefFields),sourceKinds:t(r.sourceKinds)}}async function M(){let r=t(await S(i.status({}),"status")),e=t(r.summary),n=y(r.cards);return {meta:t(r.meta),summary:{card_count:typeof e.card_count=="number"?e.card_count:0,completed:typeof e.completed=="number"?e.completed:0,eligible:typeof e.eligible=="number"?e.eligible:0,pending:typeof e.pending=="number"?e.pending:0,blocked:typeof e.blocked=="number"?e.blocked:0,in_progress:typeof e.in_progress=="number"?e.in_progress:0,failed:typeof e.failed=="number"?e.failed:0,unresolved:typeof e.unresolved=="number"?e.unresolved:0},cards:n.map(s=>{let o=t(s);return {"card-id":typeof o.name=="string"?o.name:null,status:o.status??null,error:o.error??null,requires:y(o.requires),requires_satisfied:y(o.requires_satisfied),requires_missing:y(o.requires_missing),provides_declared:y(o.provides_declared),provides_runtime:y(o.provides_runtime)}})}}async function L(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectCardDefinitionAndRuntime requires cardId");let n=t(await S(i.status({}),"status")),o=y(n.cards).map(t).find(p=>p.name===e);if(!o)throw new Error(`card "${e}" not found in board status`);let d=t(await T(m,e));if(J(d))throw Object.assign(new Error(`card "${e}" not found`),{statusCode:404});let f=F(d),c=y(o.requires_satisfied).filter(p=>typeof p=="string"&&!!p),g=y(o.provides_runtime).filter(p=>typeof p=="string"&&!!p),b=Object.fromEntries(await Promise.all(c.map(async p=>[p,await S(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),R=Object.fromEntries(await Promise.all(g.map(async p=>[p,await S(i.getOutputsDataObject({params:{key:p}}),`getOutputsDataObject(${p})`)]))),C=t(await S(i.getOutputsComputedValues({params:{key:e}}),"getOutputsComputedValues")),l=await S(i.getOutputsFetchedSources({params:{key:e}}),"getOutputsFetchedSources"),_=y(d.source_defs).map(t),w={};for(let p of _)typeof p.bindTo=="string"&&typeof p.outputFile=="string"&&(w[p.outputFile]=p.bindTo);let A={};for(let[p,j]of Object.entries(l)){let q=w[p]??p;if(!I||typeof j!="string"){A[q]=null;continue}try{A[q]=I({cardId:e,ref:j});}catch{A[q]=null;}}let P={card_data:t(d.card_data),requires:b,fetched_sources:A,computed_values:C};return {cardId:e,card_status_in_board:o,card_definition_and_static_data:f,refs_for_fetched_source_files:l,runtime_data:{requires:b,provides:R,computed_values:C,rendered_view:N(d,P)}}}async function E(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("inspectChatMessagesOnCards requires cardId");let n=typeof r.turnId=="string"?r.turnId:"",s=r.allTurns===true,o=typeof r.tailTurnsBeforeId=="string"?r.tailTurnsBeforeId:"",d=s?void 0:r.lastUserTurns??(n?void 0:1),f=r.tail,c={...d===void 0?{}:{tailTurns:d},...n?{turnId:n}:{},...s?{allTurns:true}:{},...o?{tailTurnsBeforeId:o}:{}},g=Object.keys(c).length>0?{params:{cardId:e},body:c}:{params:{cardId:e}},b=h(k.readAll(g),"chatStore.readAll"),R=t(await T(m,e)),C=y(t(R.card_data).files).map((w,A)=>({idx:A,stored_name:t(w).stored_name})).filter(w=>typeof w.stored_name=="string"&&w.stored_name.length>0),_=(Array.isArray(b.records)?b.records:[]).map(w=>{let P=t(w.payload),p={...w},j=typeof w?.role=="string"?w.role:typeof P.role=="string"?String(P.role):"",q=typeof w?.text=="string"?w.text:typeof P.text=="string"?String(P.text):"";if(j==="system"){let $=ie(q);if($!==null&&C.some(O=>O.idx===$)){let O=`Retrieve using inspect-file-contents --card-id ${e} --file-idx ${$}`;p.retrieval_hint=O,Object.keys(P).length>0&&typeof w.role!="string"&&(p.payload={...P,retrieval_hint:O});}}return p});return {cardId:e,messages:typeof f=="number"&&f>=0?_.slice(-f):_}}async function H(r){let e=String(r.cardId||"").trim(),n=Number(r.fileIdx);if(!e)throw new Error("inspectFileContents requires cardId");if(!Number.isInteger(n)||n<0)throw new Error("inspectFileContents requires fileIdx to be a non-negative integer");let s=t(await T(m,e)),o=y(t(s.card_data).files).map(t);if(n>=o.length)throw new Error(`attachment index ${n} is out of range for card "${e}"`);let d=o[n],f=typeof d.stored_name=="string"?d.stored_name:null;return {cardId:e,fileIdx:n,downloadUrl:v({cardId:e,fileIdx:n,storedName:f}),...typeof d.name=="string"?{name:d.name}:{},...typeof d.stored_name=="string"?{stored_name:d.stored_name}:{},...typeof d.mime_type=="string"?{mime_type:d.mime_type}:{},...typeof d.size=="number"?{size:d.size}:{},...typeof d.uploaded_at=="string"?{uploaded_at:d.uploaded_at}:{}}}async function D(r){return await u.validateCardPreflight({body:ce(r.candidateCardContent)})}function G(r){if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightMaterializeCandidateCard requires mockRequires");if(!r.mockFetchedSources||typeof r.mockFetchedSources!="object"||Array.isArray(r.mockFetchedSources))throw new Error("preflightMaterializeCandidateCard requires mockFetchedSources");let e=u.evalCardCompute({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires,"mock-fetched-sources":r.mockFetchedSources}});if(e.status!=="success")return e;let n=t(K(e,"evalCardCompute")),s=t(r.candidateCardContent),o={card_data:t(s.card_data),requires:t(r.mockRequires),fetched_sources:t(r.mockFetchedSources),computed_values:t(n.computed_values)};return {status:"success",data:{cardId:typeof n.cardId=="string"?n.cardId:typeof s.id=="string"?s.id:"(unknown)",ok:n.ok===true,computed_values:t(n.computed_values),errors:y(n.errors).map(d=>{let f=t(d);return {bindTo:typeof f.bindTo=="string"?f.bindTo:"",error:typeof f.error=="string"?f.error:""}}),provides_outputs:W(s,o),rendered_view:N(s,o)}}}async function Q(r){return await u.probeSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function X(r){return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":r.candidateCardContent,"mock-projections":r.mockProjections}})}async function Y(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("preflightRunSingleSourceInLiveCard requires cardId");if(!r.mockRequires||typeof r.mockRequires!="object"||Array.isArray(r.mockRequires))throw new Error("preflightRunSingleSourceInLiveCard requires mockRequires");let n=t(await T(m,e)),s=y(n.source_defs).filter(d=>!!d&&typeof d=="object"&&!Array.isArray(d)),o={};if(r.sourceIdx>=0&&r.sourceIdx<s.length){let d=s[r.sourceIdx],f=a.enrichSourcesSync([d],{card_data:t(n.card_data),requires:r.mockRequires});Array.isArray(f)&&f.length>0&&(o=t(f[0]._projections));}return await u.runSourcePreflight({params:{sourceIdx:r.sourceIdx},body:{"card-content":n,"mock-requires":r.mockRequires,"mock-projections":o}})}async function Z(r){let e=t(await S(u.simulateCardCycle({body:{"card-content":r.candidateCardContent,"mock-requires":r.mockRequires}}),"simulateCardCycle")),n=t(r.candidateCardContent),s=t(e.validation),o=y(e.source_probes),d=y(e.projection_errors),f=t(e.fetched_sources),c=y(e.compute_errors),g=t(e.computed_values),b={card_data:t(n.card_data),requires:r.mockRequires,fetched_sources:f,computed_values:g},R=[];for(let C of y(s.issues))typeof C=="string"&&C&&R.push(C);for(let C of o){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",w=typeof l.error=="string"?l.error:"";w&&R.push(`${_}: ${w}`);}for(let C of d){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"source",w=typeof l.key=="string"?l.key:"projection",A=typeof l.error=="string"?l.error:"projection failed";R.push(`${_}.${w}: ${A}`);}for(let C of c){let l=t(C),_=typeof l.bindTo=="string"?l.bindTo:"compute",w=typeof l.error=="string"?l.error:"compute failed";R.push(`${_}: ${w}`);}return {status:"success",data:{cardId:typeof e.cardId=="string"?e.cardId:"(unknown)",ok:e.ok===true,issues:R,provides_outputs:W(n,b),rendered_view:N(n,b)}}}async function ee(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get"),s=Array.isArray(n.cards)?n.cards.map(t):[];if(s.some(J))throw Object.assign(new Error(`Card "${e}" not found`),{statusCode:404});return s.map(o=>F(o))}async function re(r){let e=String(r.cardId||"").trim(),n=String(r.role||"").trim(),s=typeof r.text=="string"?r.text:"",o=typeof r.turn=="string"?r.turn:"";if(!e)throw new Error("manageAddChatEntryAndAnyAttachments requires cardId");if(!n)throw new Error("manageAddChatEntryAndAnyAttachments requires role");if(n==="assistant"&&o){let c=h(k.readAll({params:{cardId:e},body:{turnId:o}}),"chatStore.readAll(existing turn messages)"),g=Array.isArray(c.records)?c.records.find(b=>b.role==="assistant"&&String(b.turn||"")===o):void 0;if(g)return {status:"success",data:{cardId:e,id:String(g.id),role:n,turn:o,files:Array.isArray(g.files)?g.files:[]}}}let d=await Promise.all(y(r.files).map(async c=>{let g=t(c),b=String(g.file_name??g.fileName??g.name??"").trim(),R=String(g.content_type??g.contentType??"application/octet-stream");if(!b)throw new Error("file entry requires file_name");return (await x({cardId:e,fileName:b,contentType:R,bytes:B(g)})).file}));d.forEach((c,g)=>{let b=n==="assistant"?`AI generated: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`:`file uploaded: ${String(c.name||"")} as ${String(c.stored_name||"")} #${g}`;h(k.append({params:{cardId:e},body:{role:"system",text:b,files:[],turn:o}}),"chatStore.append(system attachment message)");});let f=h(k.append({params:{cardId:e},body:{role:n,text:s,files:d,turn:o}}),"chatStore.append");return {status:"success",data:{cardId:e,id:String(f.id),role:n,turn:o,files:d}}}async function te(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("manageUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),d=t(o),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let c=null;try{c=await T(m,e);}catch{c=null;}let g=c&&ue(t(c),"meta")?{...s,meta:t(c).meta}:s,b=await m.set({body:g});h(b,"cardStore.set");let R;try{R=await i.upsertCard({params:{cardId:e,restart:!0}}),h(R,"upsertCard");}catch(l){try{c&&await m.set({body:c});}catch{}throw l}let C=null;try{C=await i.cardRefreshedNotify({params:{cardId:e}}),h(C,"cardRefreshedNotify");}catch{C=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:R,refresh_notify:C}}}async function ne(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("manageRemoveCard requires cardId");let n=await i.removeCard({params:{id:e}});h(n,"removeCard");let s=await m.del({params:{id:e}});return h(s,"cardStore.del"),{status:"success",data:{board_result:n,store_result:s}}}async function ae(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("adminReadCard requires cardId");let n=await S(m.get({params:{id:e}}),"cardStore.get");return Array.isArray(n.cards)?n.cards.map(s=>t(s)):[]}async function oe(r){let e=String(r.cardId||"").trim(),n=t(r.candidateCardContent),s=F(n);if(!e)throw new Error("adminUpsertCard requires cardId");if(typeof s.id!="string"||!s.id.trim())throw new Error("candidateCardContent.id must be a non-empty string");if(s.id!==e)throw new Error(`candidateCardContent.id must match cardId (${e})`);let o=await D({candidateCardContent:s}),d=t(o),f=t(d.data);if(d.status!=="success"||f.isValid!==true)return {status:"fail",step:"validate",validation:o};let c=null;try{c=await T(m,e);}catch{c=null;}let g=c?t(t(c).meta):{},b={...s,meta:{...g,__visible_controlplane_only:true}},R=await m.set({body:b});h(R,"cardStore.set");let C;try{C=await i.upsertCard({params:{cardId:e,restart:!0}}),h(C,"upsertCard");}catch(_){try{c&&await m.set({body:c});}catch{}throw _}let l=null;try{l=await i.cardRefreshedNotify({params:{cardId:e}}),h(l,"cardRefreshedNotify");}catch{l=null;}return {status:"success",data:{validation:o,card_saved:null,board_result:C,refresh_notify:l}}}function se(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("getChatProcessing requires cardId");let n=K(k.isProcessing({params:{cardId:e}}),"chatStore.isProcessing");return {cardId:e,active:!!n.active}}function de(r){let e=String(r.cardId||"").trim();if(!e)throw new Error("setChatProcessing requires cardId");if(typeof r.active!="boolean")throw new Error("setChatProcessing requires boolean active");return h(k.setProcessing({params:{cardId:e},body:{active:r.active}}),"chatStore.setProcessing"),{cardId:e,active:r.active}}return {discoverSourceKinds:U,inspectBoardRuntimeStatus:M,inspectCardDefinitionAndRuntime:L,inspectChatMessagesOnCards:E,inspectFileContents:H,preflightValidateCandidateCardDefinition:D,preflightMaterializeCandidateCard:G,preflightProbeSingleSourceInCandidateCard:Q,preflightRunSingleSourceInCandidateCard:X,preflightRunSingleSourceInLiveCard:Y,preflightRunOneCycleWithCandidateCard:Z,manageReadCard:ee,manageAddChatEntryAndAnyAttachments:re,manageUpsertCard:te,manageRemoveCard:ne,adminReadCard:ae,adminUpsertCard:oe,getChatProcessing:se,setChatProcessing:de}}async function S(a,i){return h(await a,i)}export{me as a};//# sourceMappingURL=chunk-SCWHDI3I.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-SCWHDI3I.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
exports.a=l;exports.b=u;exports.c=f;//# sourceMappingURL=chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
'use strict';var s="b64:";function a(e){let n=new TextEncoder().encode(e),r=globalThis.Buffer,t;if(r)t=r.from(n).toString("base64");else if(typeof btoa=="function"){let o="";for(let i of n)o+=String.fromCharCode(i);t=btoa(o);}else throw new Error("No base64 encoder available in this runtime");return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function g(e){let n=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4),r=globalThis.Buffer;if(r)return r.from(n,"base64").toString("utf8");if(typeof atob=="function"){let t=atob(n),o=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)o[i]=t.charCodeAt(i);return new TextDecoder().decode(o)}throw new Error("No base64 decoder available in this runtime")}function l(e){return `${s}${a(JSON.stringify(e))}`}function u(e){if(!e.startsWith(s))throw new Error(`Invalid ref format (expected ${s}<base64url(json)>): ${e}`);let n;try{n=JSON.parse(g(e.slice(s.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${e}`)}if(!n||typeof n!="object")throw new Error(`Invalid ref format (expected object payload): ${e}`);let r=n;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${e}`);return {kind:r.kind,value:r.value}}async function f(e,n,r){let t=e.tryAcquire();if(!t)return false;try{await n();}finally{t();}return r?.(),true}
|
|
2
|
+
exports.a=l;exports.b=u;exports.c=f;//# sourceMappingURL=chunk-SFVO2LB2.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-SFVO2LB2.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
'use strict';var chunkSFVO2LB2_cjs=require('./chunk-SFVO2LB2.cjs');function i(e,t){let n;return /\.m?js$/i.test(e)?n="local-node":/\.py$/i.test(e)?n="local-python":n="local-process",{meta:"task-executor",howToRun:n,whatToRun:chunkSFVO2LB2_cjs.a({kind:"fs-path",value:e}),...t?{extra:t}:{}}}function s(e){return JSON.stringify(e)}function a(e){let t;try{t=JSON.parse(e);}catch{throw new Error(`parseExecutionRef: invalid JSON \u2014 ${e}`)}if(typeof t!="object"||t===null||typeof t.howToRun!="string"||typeof t.whatToRun!="string")throw new Error(`parseExecutionRef: missing required fields howToRun/whatToRun \u2014 ${e}`);return t}exports.a=i;exports.b=s;exports.c=a;//# sourceMappingURL=chunk-U2N6MCD5.cjs.map
|
|
2
|
+
//# sourceMappingURL=chunk-U2N6MCD5.cjs.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {b,a}from'./chunk-HEEDJEKM.js';import {a as a$1,d,x,t,u,n,w as w$1,v,k,b as b$3,c as c$1,h,i,j,o,s,r,q as q$1,p as p$1}from'./chunk-N6P2JW4W.js';import {b as b$1,c}from'./chunk-XQRNDX4Q.js';import {a as a$2,b as b$2}from'./chunk-BQS3EIEK.js';import {q,p,a as a$3,u as u$1}from'./chunk-VGT3TRQG.js';import {a as a$4}from'./chunk-JMDHDY6M.js';async function $e(e,t,a){let u=await e.tryAcquire();if(!u)return false;try{await t();}finally{await u();}return await a?.(),true}function We(e){return b(e)}function Le(e,t){return {async readIndex(){return await e.read("_index")},writeIndex(a){return e.write("_index",a)},async readCard(a){return await e.read(a)},async writeCard(a,u){return await e.write(a,u),t(u)},removeCard(a){return e.delete(a)},async cardExists(a){return await e.read(a)!==null},defaultCardKey(a){return a}}}function Je(e,t){async function a$1(){return await e.readIndex()??{}}return {async readCard(u){let p=(await a$1())[u];return !p||!await e.cardExists(p.key)?null:await e.readCard(p.key)},async readCardKey(u){return (await a$1())[u]?.key??null},async readAllCards(){let u=[];for(let[p,S]of Object.entries(await a$1())){if(!await e.cardExists(S.key))continue;let f=await e.readCard(S.key);f?u.push(f):t?.(`[card-store] could not read card "${p}" at key "${S.key}"`);}return u},async readChecksumIndex(){let u={};for(let[p,S]of Object.entries(await a$1()))u[p]=S.checksum;return u},async changedSince(u){let p=await a$1(),S=[];for(let[f,l]of Object.entries(p))u[f]!==l.checksum&&S.push(f);for(let f of Object.keys(u))p[f]||S.push(f);return S},async validateUpsert(u,p){let S=await a$1(),f=S[u],l=Object.entries(S).find(([,k])=>k.key===p);return f&&f.key!==p?{ok:false,error:`Card id "${u}" is already mapped to key "${f.key}", cannot remap to "${p}"`}:l&&l[0]!==u?{ok:false,error:`Key "${p}" is already mapped to card id "${l[0]}", cannot remap to "${u}"`}:{ok:true}},async writeCard(u,p,S){let f=await a$1(),l=S??f[u]?.key??e.defaultCardKey(u),k=await e.writeCard(l,p);f[u]={key:l,checksum:k,updatedAt:new Date().toISOString()},await e.writeIndex(f);},async patchCard(u,p,S){let f=await a$1(),l=f[u];if(!l||!await e.cardExists(l.key))throw new Error(`card "${u}" not found`);let k=await e.readCard(l.key);if(!k||typeof k!="object"||Array.isArray(k))throw new Error(`card "${u}" is not patchable`);let v=String(p||"").split(".").filter(Boolean),q=a(k,v,S),P=await e.writeCard(l.key,q);f[u]={key:l.key,checksum:P,updatedAt:new Date().toISOString()},await e.writeIndex(f);},async removeCard(u){let p=await a$1(),S=p[u];S&&(await e.removeCard(S.key),delete p[u],await e.writeIndex(p));},readIndex(){return a$1()}}}function cr(e,t){return a$1(e,t)}function dr(e,t,a){return {blob:e,kv:t,journal:a}}function Se(e){return {messageId:e.id,enqueuedAt:e.enqueuedAt,attempt:e.attempt,request:e.body}}function Xe(e){return typeof e=="string"?e.startsWith("b64:")?b$2(e).value:e:e.value}function ie(e){return {async enqueueRequest(t){return (await e.enqueue(t)).id},async leaseRequests(t){return (await e.lease(t)).map(a=>({...Se(a),leaseToken:a.leaseToken,leaseExpiresAt:a.leaseExpiresAt}))},ackRequest(t,a){return e.ack(t,a)},nackRequest(t,a,u){return e.nack(t,a,u)},async peekActive(){return (await e.peekActive()).map(Se)},async peekDeadLetter(){return (await e.peekDeadLetter()).map(t=>({...Se(t),reason:t.reason}))}}}function Qe(e){async function t(a){let u=await e.read(a);return u==null?null:typeof u=="string"?u:JSON.stringify(u)}return {async readTaskExecutorRef(){let a=await t("task-executor");if(a?.trim())return c(a.trim())},writeTaskExecutorRef(a){return e.write("task-executor",b$1(a))},readChatHandlerFlow(){return e.read("chat-handler-flow")},writeChatHandlerFlow(a){return e.write("chat-handler-flow",a)},readCardStoreRef(){return t("card-store-ref")},writeCardStoreRef(a){return e.write("card-store-ref",a)},readOutputsStoreRef(){return t("outputs-store-ref")},writeOutputsStoreRef(a){return e.write("outputs-store-ref",a)},readScratchStoreRef(){return t("scratch-store-ref")},writeScratchStoreRef(a){return e.write("scratch-store-ref",a)},readArchiveStoreRef(){return t("archive-store-ref")},writeArchiveStoreRef(a){return e.write("archive-store-ref",a)},readChatStoreRef(){return t("chat-store-ref")},writeChatStoreRef(a){return e.write("chat-store-ref",a)},readArtifactsStoreRef(){return t("artifacts-store-ref")},writeArtifactsStoreRef(a){return e.write("artifacts-store-ref",a)}}}function gr(e){let t,a,u,p=e.callbackTransport,S=e.resolveBlob??(async l=>{let k=await e.blobStorage("").read(l.value);if(k==null)throw new Error(`Blob not found for ref ${l.kind}:${l.value}`);return k});async function f(l,k){if(l.howToRun==="queue-storage"){let v=e.boardWorkerStore??t??(e.queueStorage?ie(e.queueStorage):void 0);return v?(t||(t=v),await v.enqueueRequest({boardId:typeof l.extra?.boardId=="string"?l.extra.boardId:e.boardId,ref:l,args:k}),{dispatched:true}):{dispatched:false,error:"queue-storage dispatch requires queueStorage or boardWorkerStore"}}if(l.howToRun==="http:post"){let v=e.fetch??globalThis.fetch;if(!v)return {dispatched:false,error:"http:post dispatch requires fetch support"};let q=await v(Xe(l.whatToRun),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...k,...l.extra?{extra:l.extra}:{}})});if(!q.ok){let P=await q.text().catch(()=>"");return {dispatched:false,error:`HTTP ${q.status}: ${P}`}}return {dispatched:true}}return {dispatched:false,error:`Unsupported hosted async transport "${l.howToRun}"`}}return {kvStorage:e.kvStorage,kvStorageForRef:e.kvStorageForRef,blobStorage:e.blobStorage,scratchStorage:e.scratchStorage,scratchStorageForRef:e.scratchStorageForRef,archiveFactory:e.archiveFactory,archiveFactoryForRef:e.archiveFactoryForRef,journalStorage:e.journalStorage,boardWorkerStore:()=>{if(!t)if(e.boardWorkerStore)t=e.boardWorkerStore;else if(e.queueStorage)t=ie(e.queueStorage);else throw new Error("Hosted async board adapter requires queueStorage or boardWorkerStore");return t},chatAgentStore:()=>{if(!a)if(e.chatAgentStore)a=e.chatAgentStore;else if(e.chatAgentQueueStorage)a=ie(e.chatAgentQueueStorage);else if(e.boardWorkerStore)a=e.boardWorkerStore;else if(e.queueStorage)a=ie(e.queueStorage);else throw new Error("Hosted async board adapter requires chatAgentStore, chatAgentQueueStorage, queueStorage, or boardWorkerStore");return a},processAccumulatedStore:()=>{if(u||(u=e.processAccumulatedStore??e.processAccumulatedQueueStorage??e.queueStorage),!u)throw new Error("Hosted async board adapter requires processAccumulatedStore, processAccumulatedQueueStorage, or queueStorage");return u},lock:e.lock,get callbackTransport(){return p},set callbackTransport(l){p=l;},dispatchExecution:(l,k)=>e.dispatchExecution?.(l,k)??f(l,k),supportsDirectSourceOutput:e.supportsDirectSourceOutput,resolveBlob:S,hashFn:e.hashFn,genId:e.genId,requestProcessAccumulated:e.requestProcessAccumulated,publishBoardChangeNotifications:e.publishBoardChangeNotifications,warn:e.onWarn}}function C(e){return e!==void 0?{status:"success",data:e}:{status:"success"}}function R(e){return {status:"fail",error:e}}function w(e){return {status:"error",error:e instanceof Error?e.message:String(e)}}function I(){return new Date().toISOString()}function Ze(e){let t=new TextEncoder().encode(e),a=Array.from(t,u=>String.fromCharCode(u)).join("");return btoa(a).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Me(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),a=t+"=".repeat((4-t.length%4)%4),u=atob(a),p=Uint8Array.from(u,S=>S.charCodeAt(0));return new TextDecoder().decode(p)}function ue(e){try{let t=JSON.parse(Me(e));return typeof t?.t=="string"?{taskName:t.t}:null}catch{return null}}function er(e){return Ze(JSON.stringify(e))}function He(e){try{let t=JSON.parse(Me(e));return typeof t?.cbk=="string"&&typeof t?.cid=="string"&&typeof t?.b=="string"&&typeof t?.d=="string"?t:null}catch{return null}}function rr(e){return j(e,o,()=>({_sources:{}}))}function tr(e,t){return h(e,t)}function nr(e){return k(e)}function ar(e,t){return i(e,t)}function or(e,t,a,u,p,S){return async f=>{let l=[],k=await a.cardStore.readCard(f.nodeId);if(!k)return "task-initiate-failure";let v=k.id,q=k.card_data??{},P=k.source_defs??[],N=P.filter(s=>s.optionalForCompletionGating!==true),V=await a.cardRuntimeStore.readRuntime(v),K=false,L=async()=>{K&&(await a.cardRuntimeStore.writeRuntime(v,V),K=false);},j=s=>p$1(V._sources[s]),b=(s,i)=>{V._sources[s]=p$1(i),K=true;},$=f.taskState?.executionCount??0;if(V._lastExecutionCount!==$&&(V._sources={},V._lastExecutionCount=$,K=true),f.update){let s$1=f.update.outputFile;if(s$1){let i=j(s$1);if(f.update.failure){let m=f.update.rqt??i.lastRequestedToken??i.queueRequestedToken;m&&b(s$1,s(i,m));}else {let m=f.update.rqt;if(!i.lastCompletedToken||m>i.lastCompletedToken){let h=typeof f.update.deliveryToken=="string"?f.update.deliveryToken:void 0,x=h?await a.fetchedSourcesStore.commitSourceData(v,s$1,h):false;b(s$1,x?r(i,m):s(i,m));}}await L();}}let J={};for(let s of P){if(!s.outputFile)continue;let i=await a.fetchedSourcesStore.readSourceData(v,s.outputFile);i!==null&&(J[s.bindTo]=i);}let Q={};for(let[s,i]of Object.entries(f.state??{}))if(i!==null&&typeof i=="object"&&!Array.isArray(i)){let m=i[s];Q[s]=m!==void 0?m:i;}else Q[s]=i;let H={id:v,card_data:{...q},requires:Q,source_defs:P,compute:k.compute};H._sourcesData=J,k.compute&&a$4.runSync(H,{sourcesData:J}),(p??(()=>{}))(v,H.computed_values??{});let G=a$4.enrichSourcesSync(Array.isArray(k.source_defs)?k.source_defs:void 0,{card_data:k.card_data,requires:Q}),z={...k,source_defs:Array.isArray(G)?G.map(s=>({...s,boardDir:typeof s.boardDir=="string"&&s.boardDir?s.boardDir:e.value})):G},_=I(),O=f.update?void 0:_,n=N.filter(s=>{let i=s.outputFile;if(typeof i!="string"||!i)return true;let m=j(i);O&&(m={...m,queueRequestedToken:O},b(i,m));let h=m.queueRequestedToken??m.lastRequestedToken??_;return q$1(m,h)==="dispatch"});if(await L(),n.length>0){let s=false,i=_;for(let m of n){let h=m.outputFile;if(typeof h!="string"||!h)continue;let x=j(h),F=x.queueRequestedToken??_;b(h,{...x,lastRequestedToken:F}),i=F,s=true;}return s&&await L(),s&&(l.push({taskKind:"source-fetch",payload:{boardRef:a$2(e),enrichedCard:z,callbackToken:f.callbackToken,rqt:i}}),await a.executionRequestStore.appendEntries(t,l)),"task-initiated"}if(N.some(s=>{let i=s.outputFile;if(typeof i!="string"||!i)return false;let m=j(i),h=m.queueRequestedToken??m.lastRequestedToken??_;return q$1(m,h)==="in-flight"}))return "task-initiated";let d=k.provides??[],o={};for(let{bindTo:s,ref:i}of d)o[s]=a$4.resolve(H,i);return (S??(()=>{}))(o),P.filter(s=>{if(s.optionalForCompletionGating!==true)return false;let i=j(s.outputFile);return !i.lastRequestedToken||!i.lastCompletedToken?true:i.lastCompletedToken<=i.lastRequestedToken}).length>0&&l.push({taskKind:"source-fetch",payload:{boardRef:a$2(e),enrichedCard:z,callbackToken:f.callbackToken,rqt:_}}),u(f.nodeId,o),l.length>0&&await a.executionRequestStore.appendEntries(t,l),"task-initiated"}}function Ir(e,t$1){d(t$1.callbackTransport,"createAsyncBoardLiveCardsPublic");let a=t$1.callbackTransport,u$2=t$1.warn??(()=>{}),p$1=a$2(e),S=null;function f(n){if(n.length!==0)try{return Promise.resolve(t$1.publishBoardChangeNotifications?.(n)).catch(r=>{u$2(`[async-board-live-cards-public] publishBoardChangeNotifications failed: ${r instanceof Error?r.message:String(r)}`);})}catch(r){u$2(`[async-board-live-cards-public] publishBoardChangeNotifications failed: ${r instanceof Error?r.message:String(r)}`);return}}let l=()=>Qe(t$1.kvStorage("config")),k=()=>t$1.kvStorage("state-snapshot"),v$1=e.value,q$1=()=>b$3(a$1(()=>k(),t$1.hashFn),"v1"),P=async()=>{let n=await l().readOutputsStoreRef();if(!n)throw new Error(`Board at ${e.value} has no outputs store configured.`);return nr(t$1.kvStorageForRef(n))},N=async()=>{let n=await l().readCardStoreRef();if(!n)throw new Error(`Board at ${e.value} has no card store configured.`);let r=t$1.kvStorageForRef(n);return Je(Le(We(r),t$1.hashFn),u$2)};async function V(){return !!(await q$1().readSnapshot(v$1)).values[n]}async function K(){let n$1=await q$1().readSnapshot(v$1);if(!n$1.values[n])throw new Error(`Board not initialized at ${e.value}`);return w$1(n$1.values)}async function L(n,r){let d=await q$1().commitSnapshot(v$1,{schemaVersion:"v1",expectedVersion:r,deleteKeys:[],shallowMerge:v(n)});if(!d.ok)throw new Error(`Snapshot commit failed (version mismatch): expected=${r??"null"} current=${d.currentVersion??"null"}`)}let j=()=>c$1(t$1.journalStorage());async function b(n){await j().appendEvent(n);}function $(){return tr(t$1.blobStorage("sources"),n=>t$1.resolveBlob(n))}async function J(n){let r=await Promise.resolve(t$1.blobStorage("sources").keyRef?.(n));return r?a$2(r):n}async function Q(){let n=ar(t$1.kvStorage("execution-requests"),async(c,g)=>{let A=c.payload,T=(A.enrichedCard??{}).id??A.cardId??"unknown";await b({type:"task-failed",taskName:T,error:g,timestamp:I()});}),r=rr(t$1.kvStorage("card-runtime")),d=$(),o=await N(),y=await P(),s=new Map,i=new Map,m=[],h=[],x=[],F=new Map,W=new Set,M={async readRuntime(c){return s.get(c)??await r.readRuntime(c)},async writeRuntime(c,g){s.set(c,g);}},ce={async readSourceData(c,g){let A=`${c}/${g}`;return i.has(A)?i.get(A):await d.readSourceData(c,g)},ingestSourceDataStaged(c,g,A,B){return d.ingestSourceDataStaged(c,g,A,B)},async commitSourceData(c,g,A){let B=`${c}/.staged/${A}/${g}`,T=t$1.blobStorage("sources"),D=await T.read(B);if(D==null){let X=await T.keyRef?.(B);X&&(D=await t$1.resolveBlob(X));}if(D==null)return false;let re=`${c}/${g}`,Y=D.trim();try{i.set(re,JSON.parse(Y));}catch{i.set(re,Y);}return m.push({cardId:c,outputFile:g,deliveryToken:A}),true},async hasSource(c,g){let A=`${c}/${g}`;return i.has(A)||await d.hasSource(c,g)},async listSources(c){let g=await d.listSources(c),A=[...i.keys()].filter(B=>B.startsWith(`${c}/`)).map(B=>B.slice(`${c}/`.length));return [...new Set([...g,...A])]}},ke=await K(),Ue=q(ke.graph),{events:Ge,newCursor:de}=await j().readEntriesAfterCursor(ke.lastDrainedJournalId),Z=Ge,ee=u$1(Ue,{handlers:{"card-handler":or(e,de,{cardStore:o,cardRuntimeStore:M,fetchedSourcesStore:ce,executionRequestStore:n},(c,g)=>{Z.push({type:"task-completed",taskName:c,data:g,timestamp:I()});},(c,g)=>{h.push({cardId:c,values:g});},c=>{x.push(c);})},onNodeRemoved:c=>{F.delete(c),s.delete(c),W.add(c);}});for(;Z.length>0;){let c=Z;Z=[];for(let g of c)if(g.type==="task-restart"){let A=await o.readCard(g.taskName);A&&F.set(g.taskName,A);}ee.pushAll(c),await ee.waitForHandlers();}let Re=ee.getState();await ee.dispose({wait:true}),await L({lastDrainedJournalId:de,graph:p(Re)},(await q$1().readSnapshot(v$1)).version);for(let{cardId:c,values:g}of h)await y.writeComputedValues(c,g);for(let c of x)await y.writeDataObjects(c);for(let[c,g]of s)await r.writeRuntime(c,g);for(let c of m)await d.commitSourceData(c.cardId,c.outputFile,c.deliveryToken);let he=t(p$1,Re);await y.writeStatusSnapshot(he);let U=[];for(let{cardId:c,values:g}of h)U.push({kind:"computed_values",cardId:c,values:g});for(let c of x)for(let[g,A]of Object.entries(c))U.push({kind:"data_object",key:g,payload:A});for(let[c,g]of F)U.push({kind:"card_refreshed",cardId:c,card:g});for(let c of W)U.push({kind:"card_removed",cardId:c});U.push({kind:"status",status:he}),await f(U);let le=await l().readTaskExecutorRef();if(!le)return;let ze=t$1.supportsDirectSourceOutput?.(le)===true;await n.dispatchEntriesForJournalId(de,async c=>{if(c.taskKind!=="source-fetch"){u$2(`[async-process-accumulated-events] unknown taskKind "${c.taskKind}" \u2014 skipping`);return}let g=c.payload,A=g.enrichedCard?.id??"unknown",B=g.enrichedCard?.source_defs??[];for(let T of B){if(!T.outputFile)continue;let D;if(ze){let X=t$1.genId(),Ye=`${A}/.staged/${X}/${T.outputFile}`,Ce=await Promise.resolve(t$1.blobStorage("sources").keyRef?.(Ye));Ce&&(D={ref:a$2(Ce),deliveryToken:X,outputFile:T.outputFile,cardId:A});}let re=er({cbk:g.callbackToken,rg:e.value,br:a$2(e),cid:A,b:T.bindTo,d:T.outputFile,cs:void 0,rqt:g.rqt,...D?{dt:D.deliveryToken}:{}}),Y=await t$1.dispatchExecution(le,{source_def:T,base_ref:a$2(e),callback:a.createCallback(re),...D?{output:D}:{}});Y.dispatched||await b({type:"task-failed",taskName:A,error:Y.error??"dispatch failed",timestamp:I()});}});}async function H(){try{let n=async()=>{let d=await K(),{events:o}=await j().readEntriesAfterCursor(d.lastDrainedJournalId);o.length>0&&await z();},r=await $e(t$1.lock,Q,n);return C({ran:r!==!1})}catch(n){return w(n)}}async function G(){return S||(S=H().finally(()=>{S=null;}),S)}async function z(){let n=t$1.processAccumulatedStore();n.enqueueIfAbsent?await n.enqueueIfAbsent({boardRef:a$2(e)},`process-accumulated:${a$2(e)}`):await n.enqueue({boardRef:a$2(e)}),await t$1.requestProcessAccumulated?.();}async function _(){let n=t$1.processAccumulatedStore();for(;;){let r=await n.lease({max:64,visibilityMs:1e3});if(r.length<=0)return;for(let d of r)await n.ack(d.id,d.leaseToken);if(r.length<64)return}}function O(){z();}return {async init(n){try{let r=n.params?.cardStoreRef;if(!r)return R("init requires params.cardStoreRef");let d=n.params?.outputsStoreRef;if(!d)return R("init requires params.outputsStoreRef");await V()||await L({lastDrainedJournalId:"",graph:p(a$3(u))},null);let o=l();await o.writeCardStoreRef(r),await o.writeOutputsStoreRef(d);let y=n.params?.scratchStoreRef,s=n.params?.archiveStoreRef,i=n.params?.chatStoreRef,m=n.params?.artifactsStoreRef;y&&await o.writeScratchStoreRef(y),s&&await o.writeArchiveStoreRef(s),i&&await o.writeChatStoreRef(i),m&&await o.writeArtifactsStoreRef(m);let h=n.body??{};return h["task-executor-ref"]&&await o.writeTaskExecutorRef(h["task-executor-ref"]),Object.prototype.hasOwnProperty.call(h,"chat-handler-flow")&&await o.writeChatHandlerFlow(h["chat-handler-flow"]),await(await P()).writeStatusSnapshot(t(p$1,q((await K()).graph))),C()}catch(r){return w(r)}},async status(n){try{let r=await P(),d=await r.readStatusSnapshot();return d||(d=t(p$1,q((await K()).graph)),await r.writeStatusSnapshot(d)),C(d)}catch(r){return w(r)}},async getCardStoreRef(n){try{let r=await l().readCardStoreRef();return r?C({storeRef:r}):R(`Board at ${e.value} has no card store configured`)}catch(r){return w(r)}},async getOutputsStoreRef(n){try{let r=await l().readOutputsStoreRef();return r?C({storeRef:r}):R(`Board at ${e.value} has no outputs store configured`)}catch(r){return w(r)}},async getScratchStoreRef(n){try{return C({storeRef:await l().readScratchStoreRef()})}catch(r){return w(r)}},async getArchiveStoreRef(n){try{return C({storeRef:await l().readArchiveStoreRef()})}catch(r){return w(r)}},async getChatStoreRef(n){try{return C({storeRef:await l().readChatStoreRef()})}catch(r){return w(r)}},async getArtifactsStoreRef(n){try{return C({storeRef:await l().readArtifactsStoreRef()})}catch(r){return w(r)}},async getConfig(n){try{let r=n.params?.key;if(!r)return R("getConfig requires params.key");let d=l(),o;switch(r){case "task-executor":o=await d.readTaskExecutorRef()??null;break;case "chat-handler-flow":o=await d.readChatHandlerFlow()??null;break;case "card-store-ref":o=await d.readCardStoreRef();break;case "outputs-store-ref":o=await d.readOutputsStoreRef();break;case "scratch-store-ref":o=await d.readScratchStoreRef();break;case "archive-store-ref":o=await d.readArchiveStoreRef();break;case "chat-store-ref":o=await d.readChatStoreRef();break;case "artifacts-store-ref":o=await d.readArtifactsStoreRef();break;default:return R(`getConfig: unknown key "${r}"`)}return C({value:o})}catch(r){return w(r)}},async getOutputsDataObject(n){try{let r=n.params?.key;return r?C(await(await P()).readDataObject(r)):R("getOutputsDataObject requires params.key")}catch(r){return w(r)}},async getAllOutputsDataObjects(n){try{return C(await(await P()).readAllDataObjects())}catch(r){return w(r)}},async getOutputsComputedValues(n){try{let r=n.params?.key;return r?C(await(await P()).readComputedValues(r)):R("getOutputsComputedValues requires params.key")}catch(r){return w(r)}},async getAllOutputsComputedValues(n){try{return C(await(await P()).readAllComputedValues())}catch(r){return w(r)}},async getOutputsFetchedSources(n){try{let r=n.params?.key;if(!r)return R("getOutputsFetchedSources requires params.key");let d=await $().listSources(r),o={};for(let y of d)o[y]=await J(`${r}/${y}`);return C(o)}catch(r){return w(r)}},async getAllOutputsFetchedSources(n){try{let r=$(),d=await t$1.blobStorage("sources").listKeys(),o=new Set;for(let s of d){let i=s.indexOf("/");i>0&&!s.includes("/.staged/")&&o.add(s.slice(0,i));}let y={};for(let s of o){let i=await r.listSources(s);if(i.length!==0){y[s]={};for(let m of i)y[s][m]=await J(`${s}/${m}`);}}return C(y)}catch(r){return w(r)}},async addCardFiles(n){try{let r=n.params?.cardId;if(!r)return R("addCardFiles requires params.cardId");let d=await N(),o=await d.readCard(r);if(!o)return R(`card "${r}" not found`);let y=n.body,s=Array.isArray(y)?y:y&&typeof y=="object"&&Array.isArray(y.files)?y.files:y!=null?[y]:null;if(!s||s.length===0)return R("addCardFiles requires a file metadata object, array, or body.files array");let i=o.card_data&&typeof o.card_data=="object"&&!Array.isArray(o.card_data)?o.card_data:{},m=Array.isArray(i.files)?i.files:[],h=[...m,...s],x=s.map((W,M)=>({idx:m.length+M,entry:W}));await d.writeCard(r,{...o,card_data:{...i,files:h}});let F=await this.cardRefreshedNotify({params:{cardId:r}});return F.status!=="success"?F:C({cardId:r,files_added:x,notified:!0})}catch(r){return w(r)}},async cardRefreshedNotify(n){try{let r=n.params?.cardId;if(!r)return R("cardRefreshedNotify requires params.cardId");let d=await(await N()).readCard(r);return d?(await f([{kind:"card_refreshed",cardId:r,card:d}]),C({cardId:r,notified:!0})):R(`Card "${r}" not found in board at ${e.value}`)}catch(r){return w(r)}},async removeCard(n){try{let r=n.params?.id;if(!r)return R("removeCard requires params.id");try{await t$1.kvStorage("card-upsert").delete(r);}catch{}return await b({type:"task-removal",taskName:r,timestamp:I()}),O(),C()}catch(r){return w(r)}},async retrigger(n){try{let r=n.params?.id;return r?(await b({type:"task-restart",taskName:r,timestamp:I()}),O(),C()):R("retrigger requires params.id")}catch(r){return w(r)}},async processAccumulatedEvents(n){return await _(),G()},async upsertCard(n){try{let r=n.params?.cardId,d=n.params?.all,o=!!n.params?.restart;if(!r&&!d)return R("upsertCard requires --card-id <id> or --all");let y=await N(),s=d?(await y.readAllCards()).map(m=>m.id):[r];for(let m of s)if(!await y.readCard(m))return R(`Card "${m}" not found in board at ${e.value}`);let i=t$1.kvStorage("card-upsert");for(let m of s){let h=await y.readCard(m);if(!h)continue;let x$1=x(h),F=t$1.hashFn(x$1),W=await i.read(m),M=W?.taskConfigHash!==F;if(!(!M&&!o)){if(M){let ce=W?.blobRef??await y.readCardKey(m)??m;await b({type:"task-upsert",taskName:m,taskConfig:x$1,timestamp:I()}),await i.write(m,{blobRef:ce,taskConfigHash:F,updatedAt:I()});}o&&await b({type:"task-restart",taskName:m,timestamp:I()});}}return O(),C()}catch(r){return w(r)}},async taskFailed(n){try{let r=n.params?.token;if(!r)return R("taskFailed requires params.token");let d=n.params?.error??"unknown error",o=ue(r);return o?(await b({type:"task-failed",taskName:o.taskName,error:d,timestamp:I()}),O(),C()):R("Invalid callback token")}catch(r){return w(r)}},async taskProgress(n){try{let r=n.params?.token;if(!r)return R("taskProgress requires params.token");let d=(n.body??{}).update??{},o=ue(r);return o?(await b({type:"task-progress",taskName:o.taskName,update:d,timestamp:I()}),O(),C()):R("Invalid callback token")}catch(r){return w(r)}},async sourceDataFetched(n){try{let r=n.params?.token,d=n.params?.ref;if(!r)return R("sourceDataFetched requires params.token");if(!d)return R("sourceDataFetched requires params.ref");let o=He(r);if(!o)return R("Invalid source token");let y=$(),s=o.dt||t$1.genId();o.dt||await y.ingestSourceDataStaged(o.cid,o.d,b$2(d),s);let i=ue(o.cbk);return i?(await b({type:"task-progress",taskName:i.taskName,update:{bindTo:o.b,outputFile:o.d,fetchedAt:I(),deliveryToken:s,sourceChecksum:o.cs,rqt:o.rqt},timestamp:I()}),O(),C()):R("Invalid callback token embedded in source token")}catch(r){return w(r)}},async sourceDataFetchFailure(n){try{let r=n.params?.token,d=n.params?.reason??"unknown";if(!r)return R("sourceDataFetchFailure requires params.token");let o=He(r);if(!o)return R("Invalid source token");let y=ue(o.cbk);return y?(await b({type:"task-progress",taskName:y.taskName,update:{bindTo:o.b,outputFile:o.d,failure:!0,reason:d,sourceChecksum:o.cs,rqt:o.rqt},timestamp:I()}),O(),C()):R("Invalid callback token embedded in source token")}catch(r){return w(r)}}}}
|
|
2
|
+
export{$e as a,We as b,Le as c,Je as d,cr as e,dr as f,ie as g,Qe as h,gr as i,Ir as j};//# sourceMappingURL=chunk-VMW4Z6EF.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-VMW4Z6EF.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import {a as a$1}from'./chunk-BQS3EIEK.js';function i(e,t){let n;return /\.m?js$/i.test(e)?n="local-node":/\.py$/i.test(e)?n="local-python":n="local-process",{meta:"task-executor",howToRun:n,whatToRun:a$1({kind:"fs-path",value:e}),...t?{extra:t}:{}}}function s(e){return JSON.stringify(e)}function a(e){let t;try{t=JSON.parse(e);}catch{throw new Error(`parseExecutionRef: invalid JSON \u2014 ${e}`)}if(typeof t!="object"||t===null||typeof t.howToRun!="string"||typeof t.whatToRun!="string")throw new Error(`parseExecutionRef: missing required fields howToRun/whatToRun \u2014 ${e}`);return t}export{i as a,s as b,a as c};//# sourceMappingURL=chunk-XQRNDX4Q.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-XQRNDX4Q.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use strict';var chunkH5HBXPOI_cjs=require('./chunk-H5HBXPOI.cjs');require('./chunk-PBCDDO4V.cjs'),require('./chunk-OEFTOO47.cjs'),require('./chunk-U2N6MCD5.cjs'),require('./chunk-SFVO2LB2.cjs'),require('./chunk-G4XXRHL2.cjs'),require('./chunk-LODXIALE.cjs'),require('./chunk-IXZG74EW.cjs'),require('./chunk-NMZ6XNLB.cjs'),require('./chunk-UJ7ZTV4J.cjs'),require('./chunk-YMEIPKLW.cjs'),require('./chunk-GNFE24S7.cjs');function Q(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.statusCode=="number")return t.statusCode;if(typeof t.code=="number")return t.code}function c(e,t){return Q(e)===t}function l(e,t,r){return t?typeof t=="function"?t(e):t:r}function b(e){return (e?.()??new Date).toISOString()}function O(e,t){if(t)return t();let r=String((e?.()??new Date).getTime()).padStart(13,"0"),n=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `${r}-${n}`}function p(e){return {id:e.id,payload:e.payload}}function z(e,t={}){return {async read(r){let n=l(r,t.partitionKey,"kv");try{return (await e.item(r,n).read()).resource?.value??null}catch(o){if(c(o,404))return null;throw o}},async write(r,n){let o=l(r,t.partitionKey,"kv");await e.items.upsert({id:r,pk:o,kind:"kv",value:n});},async delete(r){let n=l(r,t.partitionKey,"kv");try{await e.item(r,n).delete();}catch(o){if(!c(o,404))throw o}},async listKeys(r=""){let{resources:n}=await e.items.query({query:"SELECT c.id FROM c WHERE c.kind = @kind AND STARTSWITH(c.id, @prefix)",parameters:[{name:"@kind",value:"kv"},{name:"@prefix",value:r}]}).fetchAll();return n.map(o=>o.id).sort()}}}function I(e,t,r={}){let n=l(t,r.partitionKey,`journal:${t}`);return {async append(o){let s={id:O(r.now,r.idFactory),pk:n,kind:"journal",streamKey:t,createdAt:b(r.now),payload:o};return await e.items.create(s),p(s)},async readAll(){let{resources:o}=await e.items.query({query:"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:n},{name:"@streamKey",value:t}]}).fetchAll();return o.sort((s,a)=>s.id.localeCompare(a.id)).map(p)},async readAfter(o){let{resources:s}=await e.items.query({query:o?"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey AND c.id > @cursor ORDER BY c.id":"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:n},{name:"@streamKey",value:t},...o?[{name:"@cursor",value:o}]:[]]}).fetchAll(),a=s.sort((m,g)=>m.id.localeCompare(g.id));return {entries:a.map(p),newCursor:a.length>0?a[a.length-1].id:o}},async clear(){let o=await this.readAll();await Promise.all(o.map(s=>e.item(s.id,n).delete()));}}}function K(e,t,r={}){let n=r.partitionKey??"lock",o=r.holderId??`holder-${Math.random().toString(36).slice(2,10)}`,s=r.now,a=r.ttlMs??3e4;function m(){let i=s?.()??new Date;return {id:t,pk:n,kind:"lock",held:true,holderId:o,expiresAt:new Date(i.getTime()+a).toISOString(),updatedAt:i.toISOString()}}function g(i){return {...i??{id:t,pk:n,kind:"lock"},kind:"lock",held:false,holderId:o,expiresAt:null,updatedAt:b(s)}}async function k(){try{return (await e.item(t,n).read()).resource??null}catch(i){if(c(i,404))return null;throw i}}function S(i){return i?.held?i.expiresAt?Date.parse(i.expiresAt)>(s?.()??new Date).getTime():true:false}return {async tryAcquire(){let i=await k(),A=m();if(i){if(S(i))return null;try{await e.item(t,n).replace(A,i._etag?{accessCondition:{type:"IfMatch",condition:i._etag}}:void 0);}catch(u){if(c(u,412)||c(u,409))return null;throw u}}else try{await e.items.create(A);}catch(u){if(c(u,409))return null;throw u}return async()=>{let u=await k();if(!u)return;let w=g(u);try{await e.item(t,n).replace(w,u._etag?{accessCondition:{type:"IfMatch",condition:u._etag}}:void 0);}catch{}}}}}function E(e){return new TextDecoder().decode(e)}function J(e,t={}){return {async read(r){if(!await e.getBlobClient(r).exists())return null;let n=await e.getBlobClient(r).downloadToBuffer();return E(n)},async write(r,n){await e.getBlockBlobClient(r).upload(n,new TextEncoder().encode(n).byteLength,{blobHTTPHeaders:{blobContentType:t.defaultContentType??"application/json; charset=utf-8"}});},exists(r){return e.getBlobClient(r).exists()},async remove(r){await e.getBlobClient(r).deleteIfExists();},async readBytes(r){return await e.getBlobClient(r).exists()?await e.getBlobClient(r).downloadToBuffer():null},async writeBytes(r,n){await e.getBlockBlobClient(r).upload(n,n.byteLength,{blobHTTPHeaders:{blobContentType:t.defaultContentType??"application/octet-stream"}});},async listKeys(r=""){let n=[];for await(let o of e.listBlobsFlat({prefix:r}))n.push(o.name);return n.sort()},async stat(r){if(!await e.getBlobClient(r).exists())return null;let n=await e.getBlobClient(r).getProperties();return {key:r,size:Number(n.contentLength??0),updatedAt:n.lastModified?.toISOString(),contentType:n.contentType}},keyRef(r){return t.keyRef?.(r)??{kind:"azure-blob-key",value:r}}}}function C(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.statusCode=="number")return t.statusCode;if(typeof t.code=="number")return t.code}function y(e){let t=JSON.stringify(e),r=globalThis.Buffer;if(r)return r.from(t,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(t);throw new Error("No base64 encoder available in this runtime")}function f(e){let t=e??"",r=globalThis.Buffer;if(r)return JSON.parse(r.from(t,"base64").toString("utf-8"));if(typeof atob=="function")return JSON.parse(atob(t));throw new Error("No base64 decoder available in this runtime")}function d(e,t){return (e??t()).toISOString()}function q(e,t){return {id:String(e.messageId??""),body:f(e.messageText),enqueuedAt:d(e.insertedOn??e.insertionTime,t),attempt:Number(e.dequeueCount??0)}}function j(e,t){return {id:String(e.messageId??""),body:f(e.messageText),enqueuedAt:d(e.insertedOn??e.insertionTime,t),attempt:Number(e.dequeueCount??0),leaseToken:String(e.popReceipt??""),leaseExpiresAt:d(e.nextVisibleOn,t)}}function N(e,t={}){let r=t.now??(()=>new Date);return {async enqueue(n){let o=await e.sendMessage(y(n));return {id:String(o.messageId??""),body:n,enqueuedAt:d(o.insertionTime,r),attempt:0}},async lease(n){return (await e.receiveMessages({numberOfMessages:n?.max,visibilityTimeout:n?.visibilityMs?Math.max(1,Math.ceil(n.visibilityMs/1e3)):void 0})).receivedMessageItems.map(s=>j(s,r))},async ack(n,o){try{return await e.deleteMessage(n,o),!0}catch(s){if(C(s)===404)return false;throw s}},async nack(n,o,s){try{if(s?.dead){if(!t.deadLetterQueueClient)return !1;let a={messageId:n,reason:s.reason??null};return await t.deadLetterQueueClient.sendMessage(y(a)),await e.deleteMessage(n,o),!0}return await e.updateMessage(n,o,y({requeued:!0}),0),!0}catch(a){if(C(a)===404)return false;throw a}},async peekActive(n=""){return (await e.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>q(s,r)).filter(s=>!n||s.id.startsWith(n))},async peekDeadLetter(n=""){return t.deadLetterQueueClient?(await t.deadLetterQueueClient.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>{let a=f(s.messageText);return {id:String(s.messageId??""),body:a,enqueuedAt:d(s.insertedOn??s.insertionTime,r),attempt:Number(s.dequeueCount??0),reason:typeof a.reason=="string"?a.reason:void 0}}).filter(s=>!n||s.id.startsWith(n)):[]}}}Object.defineProperty(exports,"createAsyncBoardConfigStore",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.h}});Object.defineProperty(exports,"createAsyncBoardLiveCardsPublic",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.j}});Object.defineProperty(exports,"createAsyncBoardWorkerStore",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.g}});Object.defineProperty(exports,"createAsyncCardStorageAdapter",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.c}});Object.defineProperty(exports,"createAsyncCardStore",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.d}});Object.defineProperty(exports,"createAsyncJsonStorage",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.b}});Object.defineProperty(exports,"createAsyncStateSnapshotAdapter",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.e}});Object.defineProperty(exports,"createAsyncStorageProvider",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.f}});Object.defineProperty(exports,"createHostedAsyncBoardPlatformAdapter",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.i}});Object.defineProperty(exports,"withAsyncRelayLock",{enumerable:true,get:function(){return chunkH5HBXPOI_cjs.a}});exports.createAzureBlobStorage=J;exports.createAzureQueueStorage=N;exports.createCosmosAtomicRelayLock=K;exports.createCosmosJournalStorage=I;exports.createCosmosKvStorage=z;//# sourceMappingURL=cloud-storage.cjs.map
|
|
2
|
+
//# sourceMappingURL=cloud-storage.cjs.map
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { b as AsyncJSONStorage, c as AsyncKVStorage, d as AsyncBlobStorage, e as AsyncJournalStorage, f as AsyncStorageProvider, g as AsyncAtomicRelayLock, h as AsyncQueueStorage } from './board-live-cards-public-async-dMWNbWq6.cjs';
|
|
2
|
+
export { i as AsyncBoardConfigStore, A as AsyncBoardLiveCardsPublic, a as AsyncBoardPlatformAdapter, j as AsyncBoardWorkerDeadLetterRequest, k as AsyncBoardWorkerLeasedRequest, l as AsyncBoardWorkerQueuedRequest, m as AsyncBoardWorkerRequest, n as AsyncBoardWorkerStore, H as HostedAsyncBoardPlatformAdapterOptions, o as HostedFetchLike, p as HostedFetchResponseLike, q as createAsyncBoardConfigStore, r as createAsyncBoardLiveCardsPublic, s as createAsyncBoardWorkerStore, t as createHostedAsyncBoardPlatformAdapter, w as withAsyncRelayLock } from './board-live-cards-public-async-dMWNbWq6.cjs';
|
|
3
|
+
import { L as LiveCard, i as CardChecksumIndex, j as CardUpsertValidation, k as CardIndex, S as StateSnapshotReadView } from './board-live-cards-public-wkNmBIRC.cjs';
|
|
4
|
+
import { a as KindValueRef } from './storage-interface-BFiD3kyB.cjs';
|
|
5
|
+
import './execution-refs.cjs';
|
|
6
|
+
import './types-BBhqYGhE.cjs';
|
|
7
|
+
|
|
8
|
+
interface AsyncCardStorageAdapter {
|
|
9
|
+
readIndex(): Promise<CardIndex | null>;
|
|
10
|
+
writeIndex(index: CardIndex): Promise<void>;
|
|
11
|
+
readCard(key: string): Promise<LiveCard | null>;
|
|
12
|
+
writeCard(key: string, card: LiveCard): Promise<string>;
|
|
13
|
+
removeCard(key: string): Promise<void>;
|
|
14
|
+
cardExists(key: string): Promise<boolean>;
|
|
15
|
+
defaultCardKey(cardId: string): string;
|
|
16
|
+
}
|
|
17
|
+
interface AsyncCardStore {
|
|
18
|
+
readCard(id: string): Promise<LiveCard | null>;
|
|
19
|
+
readCardKey(id: string): Promise<string | null>;
|
|
20
|
+
readAllCards(): Promise<LiveCard[]>;
|
|
21
|
+
readChecksumIndex(): Promise<CardChecksumIndex>;
|
|
22
|
+
changedSince(snapshotChecksumIndex: CardChecksumIndex): Promise<string[]>;
|
|
23
|
+
}
|
|
24
|
+
interface AsyncCardAdminStore extends AsyncCardStore {
|
|
25
|
+
validateUpsert(id: string, cardKey: string): Promise<CardUpsertValidation>;
|
|
26
|
+
writeCard(id: string, card: LiveCard, cardKey?: string): Promise<void>;
|
|
27
|
+
patchCard(id: string, jsonPath: string, value: unknown): Promise<void>;
|
|
28
|
+
removeCard(id: string): Promise<void>;
|
|
29
|
+
readIndex(): Promise<CardIndex>;
|
|
30
|
+
}
|
|
31
|
+
interface AsyncStateSnapshotStorageAdapter {
|
|
32
|
+
readValues(scopeId: string): Promise<StateSnapshotReadView>;
|
|
33
|
+
writeValues(scopeId: string, nextValues: Record<string, unknown>, deletedKeys: string[]): Promise<string>;
|
|
34
|
+
}
|
|
35
|
+
declare function createAsyncJsonStorage(kv: AsyncKVStorage): AsyncJSONStorage;
|
|
36
|
+
declare function createAsyncCardStorageAdapter(json: AsyncJSONStorage, computeHash: (v: unknown) => string): AsyncCardStorageAdapter;
|
|
37
|
+
declare function createAsyncCardStore(adapter: AsyncCardStorageAdapter, onWarn?: (msg: string) => void): AsyncCardAdminStore;
|
|
38
|
+
declare function createAsyncStateSnapshotAdapter(kvFactory: (scopeId: string) => AsyncKVStorage, computeHash: (v: unknown) => string): AsyncStateSnapshotStorageAdapter;
|
|
39
|
+
declare function createAsyncStorageProvider(blob: AsyncBlobStorage, kv: AsyncKVStorage, journal: AsyncJournalStorage): AsyncStorageProvider;
|
|
40
|
+
|
|
41
|
+
type CosmosStatusResult<T> = {
|
|
42
|
+
resource?: T;
|
|
43
|
+
statusCode?: number;
|
|
44
|
+
};
|
|
45
|
+
type CosmosAccessCondition = {
|
|
46
|
+
type: 'IfMatch';
|
|
47
|
+
condition: string;
|
|
48
|
+
};
|
|
49
|
+
interface CosmosSqlQuerySpec {
|
|
50
|
+
query: string;
|
|
51
|
+
parameters?: Array<{
|
|
52
|
+
name: string;
|
|
53
|
+
value: unknown;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
56
|
+
interface CosmosQueryIteratorLike<T> {
|
|
57
|
+
fetchAll(): Promise<{
|
|
58
|
+
resources: T[];
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
interface CosmosItemLike<T> {
|
|
62
|
+
read(): Promise<CosmosStatusResult<T>>;
|
|
63
|
+
replace(body: T, options?: {
|
|
64
|
+
accessCondition?: CosmosAccessCondition;
|
|
65
|
+
}): Promise<CosmosStatusResult<T>>;
|
|
66
|
+
delete(): Promise<{
|
|
67
|
+
statusCode?: number;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
interface CosmosContainerLike {
|
|
71
|
+
item<T = unknown>(id: string, partitionKey?: unknown): CosmosItemLike<T>;
|
|
72
|
+
items: {
|
|
73
|
+
upsert<T>(body: T): Promise<CosmosStatusResult<T>>;
|
|
74
|
+
create<T>(body: T): Promise<CosmosStatusResult<T>>;
|
|
75
|
+
query<T>(query: CosmosSqlQuerySpec): CosmosQueryIteratorLike<T>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
type PartitionResolver = string | ((key: string) => string);
|
|
79
|
+
interface CosmosKvStorageOptions {
|
|
80
|
+
partitionKey?: PartitionResolver;
|
|
81
|
+
}
|
|
82
|
+
interface CosmosJournalStorageOptions {
|
|
83
|
+
partitionKey?: PartitionResolver;
|
|
84
|
+
now?: () => Date;
|
|
85
|
+
idFactory?: () => string;
|
|
86
|
+
}
|
|
87
|
+
interface CosmosAtomicRelayLockOptions {
|
|
88
|
+
partitionKey?: string;
|
|
89
|
+
holderId?: string;
|
|
90
|
+
ttlMs?: number;
|
|
91
|
+
now?: () => Date;
|
|
92
|
+
}
|
|
93
|
+
declare function createCosmosKvStorage(container: CosmosContainerLike, options?: CosmosKvStorageOptions): AsyncKVStorage;
|
|
94
|
+
declare function createCosmosJournalStorage(container: CosmosContainerLike, streamKey: string, options?: CosmosJournalStorageOptions): AsyncJournalStorage;
|
|
95
|
+
declare function createCosmosAtomicRelayLock(container: CosmosContainerLike, lockId: string, options?: CosmosAtomicRelayLockOptions): AsyncAtomicRelayLock;
|
|
96
|
+
|
|
97
|
+
interface AzureBlobItemLike {
|
|
98
|
+
name: string;
|
|
99
|
+
properties?: {
|
|
100
|
+
contentLength?: number;
|
|
101
|
+
lastModified?: Date;
|
|
102
|
+
contentType?: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
interface AzureBlobClientLike {
|
|
106
|
+
downloadToBuffer(): Promise<Uint8Array>;
|
|
107
|
+
exists(): Promise<boolean>;
|
|
108
|
+
deleteIfExists(): Promise<unknown>;
|
|
109
|
+
getProperties(): Promise<{
|
|
110
|
+
contentLength?: number;
|
|
111
|
+
lastModified?: Date;
|
|
112
|
+
contentType?: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
115
|
+
interface AzureBlockBlobClientLike {
|
|
116
|
+
upload(data: string | Uint8Array, length: number, options?: {
|
|
117
|
+
blobHTTPHeaders?: {
|
|
118
|
+
blobContentType?: string;
|
|
119
|
+
};
|
|
120
|
+
}): Promise<unknown>;
|
|
121
|
+
}
|
|
122
|
+
interface AzureBlobContainerClientLike {
|
|
123
|
+
getBlobClient(key: string): AzureBlobClientLike;
|
|
124
|
+
getBlockBlobClient(key: string): AzureBlockBlobClientLike;
|
|
125
|
+
listBlobsFlat(options?: {
|
|
126
|
+
prefix?: string;
|
|
127
|
+
}): AsyncIterable<AzureBlobItemLike>;
|
|
128
|
+
}
|
|
129
|
+
interface AzureBlobStorageOptions {
|
|
130
|
+
defaultContentType?: string;
|
|
131
|
+
keyRef?: (key: string) => KindValueRef;
|
|
132
|
+
}
|
|
133
|
+
declare function createAzureBlobStorage(containerClient: AzureBlobContainerClientLike, options?: AzureBlobStorageOptions): AsyncBlobStorage;
|
|
134
|
+
|
|
135
|
+
interface AzureQueueSentMessageLike {
|
|
136
|
+
messageId?: string;
|
|
137
|
+
insertionTime?: Date;
|
|
138
|
+
}
|
|
139
|
+
interface AzureQueueReceivedMessageLike {
|
|
140
|
+
messageId?: string;
|
|
141
|
+
messageText?: string;
|
|
142
|
+
insertedOn?: Date;
|
|
143
|
+
insertionTime?: Date;
|
|
144
|
+
dequeueCount?: number;
|
|
145
|
+
popReceipt?: string;
|
|
146
|
+
nextVisibleOn?: Date;
|
|
147
|
+
}
|
|
148
|
+
interface AzureQueuePeekedMessageLike {
|
|
149
|
+
messageId?: string;
|
|
150
|
+
messageText?: string;
|
|
151
|
+
insertedOn?: Date;
|
|
152
|
+
insertionTime?: Date;
|
|
153
|
+
dequeueCount?: number;
|
|
154
|
+
}
|
|
155
|
+
interface AzureQueueClientLike {
|
|
156
|
+
sendMessage(content: string): Promise<AzureQueueSentMessageLike>;
|
|
157
|
+
receiveMessages(options?: {
|
|
158
|
+
numberOfMessages?: number;
|
|
159
|
+
visibilityTimeout?: number;
|
|
160
|
+
}): Promise<{
|
|
161
|
+
receivedMessageItems: AzureQueueReceivedMessageLike[];
|
|
162
|
+
}>;
|
|
163
|
+
deleteMessage(messageId: string, popReceipt: string): Promise<unknown>;
|
|
164
|
+
updateMessage(messageId: string, popReceipt: string, content: string, visibilityTimeout?: number): Promise<unknown>;
|
|
165
|
+
peekMessages(options?: {
|
|
166
|
+
numberOfMessages?: number;
|
|
167
|
+
}): Promise<{
|
|
168
|
+
peekedMessageItems: AzureQueuePeekedMessageLike[];
|
|
169
|
+
}>;
|
|
170
|
+
}
|
|
171
|
+
interface AzureQueueStorageOptions {
|
|
172
|
+
deadLetterQueueClient?: AzureQueueClientLike;
|
|
173
|
+
now?: () => Date;
|
|
174
|
+
}
|
|
175
|
+
declare function createAzureQueueStorage(queueClient: AzureQueueClientLike, options?: AzureQueueStorageOptions): AsyncQueueStorage;
|
|
176
|
+
|
|
177
|
+
export { AsyncAtomicRelayLock, AsyncBlobStorage, type AsyncCardAdminStore, type AsyncCardStorageAdapter, type AsyncCardStore, AsyncJSONStorage, AsyncJournalStorage, AsyncKVStorage, AsyncQueueStorage, type AsyncStateSnapshotStorageAdapter, AsyncStorageProvider, type AzureBlobClientLike, type AzureBlobContainerClientLike, type AzureBlobItemLike, type AzureBlobStorageOptions, type AzureBlockBlobClientLike, type AzureQueueClientLike, type AzureQueuePeekedMessageLike, type AzureQueueReceivedMessageLike, type AzureQueueSentMessageLike, type AzureQueueStorageOptions, type CosmosAtomicRelayLockOptions, type CosmosContainerLike, type CosmosItemLike, type CosmosJournalStorageOptions, type CosmosKvStorageOptions, type CosmosQueryIteratorLike, type CosmosSqlQuerySpec, createAsyncCardStorageAdapter, createAsyncCardStore, createAsyncJsonStorage, createAsyncStateSnapshotAdapter, createAsyncStorageProvider, createAzureBlobStorage, createAzureQueueStorage, createCosmosAtomicRelayLock, createCosmosJournalStorage, createCosmosKvStorage };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { b as AsyncJSONStorage, c as AsyncKVStorage, d as AsyncBlobStorage, e as AsyncJournalStorage, f as AsyncStorageProvider, g as AsyncAtomicRelayLock, h as AsyncQueueStorage } from './board-live-cards-public-async-DKZqbJVU.js';
|
|
2
|
+
export { i as AsyncBoardConfigStore, A as AsyncBoardLiveCardsPublic, a as AsyncBoardPlatformAdapter, j as AsyncBoardWorkerDeadLetterRequest, k as AsyncBoardWorkerLeasedRequest, l as AsyncBoardWorkerQueuedRequest, m as AsyncBoardWorkerRequest, n as AsyncBoardWorkerStore, H as HostedAsyncBoardPlatformAdapterOptions, o as HostedFetchLike, p as HostedFetchResponseLike, q as createAsyncBoardConfigStore, r as createAsyncBoardLiveCardsPublic, s as createAsyncBoardWorkerStore, t as createHostedAsyncBoardPlatformAdapter, w as withAsyncRelayLock } from './board-live-cards-public-async-DKZqbJVU.js';
|
|
3
|
+
import { L as LiveCard, i as CardChecksumIndex, j as CardUpsertValidation, k as CardIndex, S as StateSnapshotReadView } from './board-live-cards-public-BMUIPOrc.js';
|
|
4
|
+
import { a as KindValueRef } from './storage-interface-BFiD3kyB.js';
|
|
5
|
+
import './execution-refs.js';
|
|
6
|
+
import './types-BBhqYGhE.js';
|
|
7
|
+
|
|
8
|
+
interface AsyncCardStorageAdapter {
|
|
9
|
+
readIndex(): Promise<CardIndex | null>;
|
|
10
|
+
writeIndex(index: CardIndex): Promise<void>;
|
|
11
|
+
readCard(key: string): Promise<LiveCard | null>;
|
|
12
|
+
writeCard(key: string, card: LiveCard): Promise<string>;
|
|
13
|
+
removeCard(key: string): Promise<void>;
|
|
14
|
+
cardExists(key: string): Promise<boolean>;
|
|
15
|
+
defaultCardKey(cardId: string): string;
|
|
16
|
+
}
|
|
17
|
+
interface AsyncCardStore {
|
|
18
|
+
readCard(id: string): Promise<LiveCard | null>;
|
|
19
|
+
readCardKey(id: string): Promise<string | null>;
|
|
20
|
+
readAllCards(): Promise<LiveCard[]>;
|
|
21
|
+
readChecksumIndex(): Promise<CardChecksumIndex>;
|
|
22
|
+
changedSince(snapshotChecksumIndex: CardChecksumIndex): Promise<string[]>;
|
|
23
|
+
}
|
|
24
|
+
interface AsyncCardAdminStore extends AsyncCardStore {
|
|
25
|
+
validateUpsert(id: string, cardKey: string): Promise<CardUpsertValidation>;
|
|
26
|
+
writeCard(id: string, card: LiveCard, cardKey?: string): Promise<void>;
|
|
27
|
+
patchCard(id: string, jsonPath: string, value: unknown): Promise<void>;
|
|
28
|
+
removeCard(id: string): Promise<void>;
|
|
29
|
+
readIndex(): Promise<CardIndex>;
|
|
30
|
+
}
|
|
31
|
+
interface AsyncStateSnapshotStorageAdapter {
|
|
32
|
+
readValues(scopeId: string): Promise<StateSnapshotReadView>;
|
|
33
|
+
writeValues(scopeId: string, nextValues: Record<string, unknown>, deletedKeys: string[]): Promise<string>;
|
|
34
|
+
}
|
|
35
|
+
declare function createAsyncJsonStorage(kv: AsyncKVStorage): AsyncJSONStorage;
|
|
36
|
+
declare function createAsyncCardStorageAdapter(json: AsyncJSONStorage, computeHash: (v: unknown) => string): AsyncCardStorageAdapter;
|
|
37
|
+
declare function createAsyncCardStore(adapter: AsyncCardStorageAdapter, onWarn?: (msg: string) => void): AsyncCardAdminStore;
|
|
38
|
+
declare function createAsyncStateSnapshotAdapter(kvFactory: (scopeId: string) => AsyncKVStorage, computeHash: (v: unknown) => string): AsyncStateSnapshotStorageAdapter;
|
|
39
|
+
declare function createAsyncStorageProvider(blob: AsyncBlobStorage, kv: AsyncKVStorage, journal: AsyncJournalStorage): AsyncStorageProvider;
|
|
40
|
+
|
|
41
|
+
type CosmosStatusResult<T> = {
|
|
42
|
+
resource?: T;
|
|
43
|
+
statusCode?: number;
|
|
44
|
+
};
|
|
45
|
+
type CosmosAccessCondition = {
|
|
46
|
+
type: 'IfMatch';
|
|
47
|
+
condition: string;
|
|
48
|
+
};
|
|
49
|
+
interface CosmosSqlQuerySpec {
|
|
50
|
+
query: string;
|
|
51
|
+
parameters?: Array<{
|
|
52
|
+
name: string;
|
|
53
|
+
value: unknown;
|
|
54
|
+
}>;
|
|
55
|
+
}
|
|
56
|
+
interface CosmosQueryIteratorLike<T> {
|
|
57
|
+
fetchAll(): Promise<{
|
|
58
|
+
resources: T[];
|
|
59
|
+
}>;
|
|
60
|
+
}
|
|
61
|
+
interface CosmosItemLike<T> {
|
|
62
|
+
read(): Promise<CosmosStatusResult<T>>;
|
|
63
|
+
replace(body: T, options?: {
|
|
64
|
+
accessCondition?: CosmosAccessCondition;
|
|
65
|
+
}): Promise<CosmosStatusResult<T>>;
|
|
66
|
+
delete(): Promise<{
|
|
67
|
+
statusCode?: number;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
interface CosmosContainerLike {
|
|
71
|
+
item<T = unknown>(id: string, partitionKey?: unknown): CosmosItemLike<T>;
|
|
72
|
+
items: {
|
|
73
|
+
upsert<T>(body: T): Promise<CosmosStatusResult<T>>;
|
|
74
|
+
create<T>(body: T): Promise<CosmosStatusResult<T>>;
|
|
75
|
+
query<T>(query: CosmosSqlQuerySpec): CosmosQueryIteratorLike<T>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
type PartitionResolver = string | ((key: string) => string);
|
|
79
|
+
interface CosmosKvStorageOptions {
|
|
80
|
+
partitionKey?: PartitionResolver;
|
|
81
|
+
}
|
|
82
|
+
interface CosmosJournalStorageOptions {
|
|
83
|
+
partitionKey?: PartitionResolver;
|
|
84
|
+
now?: () => Date;
|
|
85
|
+
idFactory?: () => string;
|
|
86
|
+
}
|
|
87
|
+
interface CosmosAtomicRelayLockOptions {
|
|
88
|
+
partitionKey?: string;
|
|
89
|
+
holderId?: string;
|
|
90
|
+
ttlMs?: number;
|
|
91
|
+
now?: () => Date;
|
|
92
|
+
}
|
|
93
|
+
declare function createCosmosKvStorage(container: CosmosContainerLike, options?: CosmosKvStorageOptions): AsyncKVStorage;
|
|
94
|
+
declare function createCosmosJournalStorage(container: CosmosContainerLike, streamKey: string, options?: CosmosJournalStorageOptions): AsyncJournalStorage;
|
|
95
|
+
declare function createCosmosAtomicRelayLock(container: CosmosContainerLike, lockId: string, options?: CosmosAtomicRelayLockOptions): AsyncAtomicRelayLock;
|
|
96
|
+
|
|
97
|
+
interface AzureBlobItemLike {
|
|
98
|
+
name: string;
|
|
99
|
+
properties?: {
|
|
100
|
+
contentLength?: number;
|
|
101
|
+
lastModified?: Date;
|
|
102
|
+
contentType?: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
interface AzureBlobClientLike {
|
|
106
|
+
downloadToBuffer(): Promise<Uint8Array>;
|
|
107
|
+
exists(): Promise<boolean>;
|
|
108
|
+
deleteIfExists(): Promise<unknown>;
|
|
109
|
+
getProperties(): Promise<{
|
|
110
|
+
contentLength?: number;
|
|
111
|
+
lastModified?: Date;
|
|
112
|
+
contentType?: string;
|
|
113
|
+
}>;
|
|
114
|
+
}
|
|
115
|
+
interface AzureBlockBlobClientLike {
|
|
116
|
+
upload(data: string | Uint8Array, length: number, options?: {
|
|
117
|
+
blobHTTPHeaders?: {
|
|
118
|
+
blobContentType?: string;
|
|
119
|
+
};
|
|
120
|
+
}): Promise<unknown>;
|
|
121
|
+
}
|
|
122
|
+
interface AzureBlobContainerClientLike {
|
|
123
|
+
getBlobClient(key: string): AzureBlobClientLike;
|
|
124
|
+
getBlockBlobClient(key: string): AzureBlockBlobClientLike;
|
|
125
|
+
listBlobsFlat(options?: {
|
|
126
|
+
prefix?: string;
|
|
127
|
+
}): AsyncIterable<AzureBlobItemLike>;
|
|
128
|
+
}
|
|
129
|
+
interface AzureBlobStorageOptions {
|
|
130
|
+
defaultContentType?: string;
|
|
131
|
+
keyRef?: (key: string) => KindValueRef;
|
|
132
|
+
}
|
|
133
|
+
declare function createAzureBlobStorage(containerClient: AzureBlobContainerClientLike, options?: AzureBlobStorageOptions): AsyncBlobStorage;
|
|
134
|
+
|
|
135
|
+
interface AzureQueueSentMessageLike {
|
|
136
|
+
messageId?: string;
|
|
137
|
+
insertionTime?: Date;
|
|
138
|
+
}
|
|
139
|
+
interface AzureQueueReceivedMessageLike {
|
|
140
|
+
messageId?: string;
|
|
141
|
+
messageText?: string;
|
|
142
|
+
insertedOn?: Date;
|
|
143
|
+
insertionTime?: Date;
|
|
144
|
+
dequeueCount?: number;
|
|
145
|
+
popReceipt?: string;
|
|
146
|
+
nextVisibleOn?: Date;
|
|
147
|
+
}
|
|
148
|
+
interface AzureQueuePeekedMessageLike {
|
|
149
|
+
messageId?: string;
|
|
150
|
+
messageText?: string;
|
|
151
|
+
insertedOn?: Date;
|
|
152
|
+
insertionTime?: Date;
|
|
153
|
+
dequeueCount?: number;
|
|
154
|
+
}
|
|
155
|
+
interface AzureQueueClientLike {
|
|
156
|
+
sendMessage(content: string): Promise<AzureQueueSentMessageLike>;
|
|
157
|
+
receiveMessages(options?: {
|
|
158
|
+
numberOfMessages?: number;
|
|
159
|
+
visibilityTimeout?: number;
|
|
160
|
+
}): Promise<{
|
|
161
|
+
receivedMessageItems: AzureQueueReceivedMessageLike[];
|
|
162
|
+
}>;
|
|
163
|
+
deleteMessage(messageId: string, popReceipt: string): Promise<unknown>;
|
|
164
|
+
updateMessage(messageId: string, popReceipt: string, content: string, visibilityTimeout?: number): Promise<unknown>;
|
|
165
|
+
peekMessages(options?: {
|
|
166
|
+
numberOfMessages?: number;
|
|
167
|
+
}): Promise<{
|
|
168
|
+
peekedMessageItems: AzureQueuePeekedMessageLike[];
|
|
169
|
+
}>;
|
|
170
|
+
}
|
|
171
|
+
interface AzureQueueStorageOptions {
|
|
172
|
+
deadLetterQueueClient?: AzureQueueClientLike;
|
|
173
|
+
now?: () => Date;
|
|
174
|
+
}
|
|
175
|
+
declare function createAzureQueueStorage(queueClient: AzureQueueClientLike, options?: AzureQueueStorageOptions): AsyncQueueStorage;
|
|
176
|
+
|
|
177
|
+
export { AsyncAtomicRelayLock, AsyncBlobStorage, type AsyncCardAdminStore, type AsyncCardStorageAdapter, type AsyncCardStore, AsyncJSONStorage, AsyncJournalStorage, AsyncKVStorage, AsyncQueueStorage, type AsyncStateSnapshotStorageAdapter, AsyncStorageProvider, type AzureBlobClientLike, type AzureBlobContainerClientLike, type AzureBlobItemLike, type AzureBlobStorageOptions, type AzureBlockBlobClientLike, type AzureQueueClientLike, type AzureQueuePeekedMessageLike, type AzureQueueReceivedMessageLike, type AzureQueueSentMessageLike, type AzureQueueStorageOptions, type CosmosAtomicRelayLockOptions, type CosmosContainerLike, type CosmosItemLike, type CosmosJournalStorageOptions, type CosmosKvStorageOptions, type CosmosQueryIteratorLike, type CosmosSqlQuerySpec, createAsyncCardStorageAdapter, createAsyncCardStore, createAsyncJsonStorage, createAsyncStateSnapshotAdapter, createAsyncStorageProvider, createAzureBlobStorage, createAzureQueueStorage, createCosmosAtomicRelayLock, createCosmosJournalStorage, createCosmosKvStorage };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export{h as createAsyncBoardConfigStore,j as createAsyncBoardLiveCardsPublic,g as createAsyncBoardWorkerStore,c as createAsyncCardStorageAdapter,d as createAsyncCardStore,b as createAsyncJsonStorage,e as createAsyncStateSnapshotAdapter,f as createAsyncStorageProvider,i as createHostedAsyncBoardPlatformAdapter,a as withAsyncRelayLock}from'./chunk-VMW4Z6EF.js';import'./chunk-HEEDJEKM.js';import'./chunk-N6P2JW4W.js';import'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-VGT3TRQG.js';import'./chunk-WDPOGXTY.js';import'./chunk-JMDHDY6M.js';import'./chunk-VLBB3D6B.js';import'./chunk-MNEOJWPS.js';import'./chunk-KBELAKIY.js';import'./chunk-FW4363Y4.js';function Q(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.statusCode=="number")return t.statusCode;if(typeof t.code=="number")return t.code}function c(e,t){return Q(e)===t}function l(e,t,r){return t?typeof t=="function"?t(e):t:r}function b(e){return (e?.()??new Date).toISOString()}function O(e,t){if(t)return t();let r=String((e?.()??new Date).getTime()).padStart(13,"0"),n=Math.random().toString(36).slice(2,10).padEnd(8,"0");return `${r}-${n}`}function p(e){return {id:e.id,payload:e.payload}}function z(e,t={}){return {async read(r){let n=l(r,t.partitionKey,"kv");try{return (await e.item(r,n).read()).resource?.value??null}catch(o){if(c(o,404))return null;throw o}},async write(r,n){let o=l(r,t.partitionKey,"kv");await e.items.upsert({id:r,pk:o,kind:"kv",value:n});},async delete(r){let n=l(r,t.partitionKey,"kv");try{await e.item(r,n).delete();}catch(o){if(!c(o,404))throw o}},async listKeys(r=""){let{resources:n}=await e.items.query({query:"SELECT c.id FROM c WHERE c.kind = @kind AND STARTSWITH(c.id, @prefix)",parameters:[{name:"@kind",value:"kv"},{name:"@prefix",value:r}]}).fetchAll();return n.map(o=>o.id).sort()}}}function I(e,t,r={}){let n=l(t,r.partitionKey,`journal:${t}`);return {async append(o){let s={id:O(r.now,r.idFactory),pk:n,kind:"journal",streamKey:t,createdAt:b(r.now),payload:o};return await e.items.create(s),p(s)},async readAll(){let{resources:o}=await e.items.query({query:"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:n},{name:"@streamKey",value:t}]}).fetchAll();return o.sort((s,a)=>s.id.localeCompare(a.id)).map(p)},async readAfter(o){let{resources:s}=await e.items.query({query:o?"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey AND c.id > @cursor ORDER BY c.id":"SELECT * FROM c WHERE c.kind = @kind AND c.pk = @pk AND c.streamKey = @streamKey ORDER BY c.id",parameters:[{name:"@kind",value:"journal"},{name:"@pk",value:n},{name:"@streamKey",value:t},...o?[{name:"@cursor",value:o}]:[]]}).fetchAll(),a=s.sort((m,g)=>m.id.localeCompare(g.id));return {entries:a.map(p),newCursor:a.length>0?a[a.length-1].id:o}},async clear(){let o=await this.readAll();await Promise.all(o.map(s=>e.item(s.id,n).delete()));}}}function K(e,t,r={}){let n=r.partitionKey??"lock",o=r.holderId??`holder-${Math.random().toString(36).slice(2,10)}`,s=r.now,a=r.ttlMs??3e4;function m(){let i=s?.()??new Date;return {id:t,pk:n,kind:"lock",held:true,holderId:o,expiresAt:new Date(i.getTime()+a).toISOString(),updatedAt:i.toISOString()}}function g(i){return {...i??{id:t,pk:n,kind:"lock"},kind:"lock",held:false,holderId:o,expiresAt:null,updatedAt:b(s)}}async function k(){try{return (await e.item(t,n).read()).resource??null}catch(i){if(c(i,404))return null;throw i}}function S(i){return i?.held?i.expiresAt?Date.parse(i.expiresAt)>(s?.()??new Date).getTime():true:false}return {async tryAcquire(){let i=await k(),A=m();if(i){if(S(i))return null;try{await e.item(t,n).replace(A,i._etag?{accessCondition:{type:"IfMatch",condition:i._etag}}:void 0);}catch(u){if(c(u,412)||c(u,409))return null;throw u}}else try{await e.items.create(A);}catch(u){if(c(u,409))return null;throw u}return async()=>{let u=await k();if(!u)return;let w=g(u);try{await e.item(t,n).replace(w,u._etag?{accessCondition:{type:"IfMatch",condition:u._etag}}:void 0);}catch{}}}}}function E(e){return new TextDecoder().decode(e)}function J(e,t={}){return {async read(r){if(!await e.getBlobClient(r).exists())return null;let n=await e.getBlobClient(r).downloadToBuffer();return E(n)},async write(r,n){await e.getBlockBlobClient(r).upload(n,new TextEncoder().encode(n).byteLength,{blobHTTPHeaders:{blobContentType:t.defaultContentType??"application/json; charset=utf-8"}});},exists(r){return e.getBlobClient(r).exists()},async remove(r){await e.getBlobClient(r).deleteIfExists();},async readBytes(r){return await e.getBlobClient(r).exists()?await e.getBlobClient(r).downloadToBuffer():null},async writeBytes(r,n){await e.getBlockBlobClient(r).upload(n,n.byteLength,{blobHTTPHeaders:{blobContentType:t.defaultContentType??"application/octet-stream"}});},async listKeys(r=""){let n=[];for await(let o of e.listBlobsFlat({prefix:r}))n.push(o.name);return n.sort()},async stat(r){if(!await e.getBlobClient(r).exists())return null;let n=await e.getBlobClient(r).getProperties();return {key:r,size:Number(n.contentLength??0),updatedAt:n.lastModified?.toISOString(),contentType:n.contentType}},keyRef(r){return t.keyRef?.(r)??{kind:"azure-blob-key",value:r}}}}function C(e){if(!e||typeof e!="object")return;let t=e;if(typeof t.statusCode=="number")return t.statusCode;if(typeof t.code=="number")return t.code}function y(e){let t=JSON.stringify(e),r=globalThis.Buffer;if(r)return r.from(t,"utf-8").toString("base64");if(typeof btoa=="function")return btoa(t);throw new Error("No base64 encoder available in this runtime")}function f(e){let t=e??"",r=globalThis.Buffer;if(r)return JSON.parse(r.from(t,"base64").toString("utf-8"));if(typeof atob=="function")return JSON.parse(atob(t));throw new Error("No base64 decoder available in this runtime")}function d(e,t){return (e??t()).toISOString()}function q(e,t){return {id:String(e.messageId??""),body:f(e.messageText),enqueuedAt:d(e.insertedOn??e.insertionTime,t),attempt:Number(e.dequeueCount??0)}}function j(e,t){return {id:String(e.messageId??""),body:f(e.messageText),enqueuedAt:d(e.insertedOn??e.insertionTime,t),attempt:Number(e.dequeueCount??0),leaseToken:String(e.popReceipt??""),leaseExpiresAt:d(e.nextVisibleOn,t)}}function N(e,t={}){let r=t.now??(()=>new Date);return {async enqueue(n){let o=await e.sendMessage(y(n));return {id:String(o.messageId??""),body:n,enqueuedAt:d(o.insertionTime,r),attempt:0}},async lease(n){return (await e.receiveMessages({numberOfMessages:n?.max,visibilityTimeout:n?.visibilityMs?Math.max(1,Math.ceil(n.visibilityMs/1e3)):void 0})).receivedMessageItems.map(s=>j(s,r))},async ack(n,o){try{return await e.deleteMessage(n,o),!0}catch(s){if(C(s)===404)return false;throw s}},async nack(n,o,s){try{if(s?.dead){if(!t.deadLetterQueueClient)return !1;let a={messageId:n,reason:s.reason??null};return await t.deadLetterQueueClient.sendMessage(y(a)),await e.deleteMessage(n,o),!0}return await e.updateMessage(n,o,y({requeued:!0}),0),!0}catch(a){if(C(a)===404)return false;throw a}},async peekActive(n=""){return (await e.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>q(s,r)).filter(s=>!n||s.id.startsWith(n))},async peekDeadLetter(n=""){return t.deadLetterQueueClient?(await t.deadLetterQueueClient.peekMessages({numberOfMessages:32})).peekedMessageItems.map(s=>{let a=f(s.messageText);return {id:String(s.messageId??""),body:a,enqueuedAt:d(s.insertedOn??s.insertionTime,r),attempt:Number(s.dequeueCount??0),reason:typeof a.reason=="string"?a.reason:void 0}}).filter(s=>!n||s.id.startsWith(n)):[]}}}export{J as createAzureBlobStorage,N as createAzureQueueStorage,K as createCosmosAtomicRelayLock,I as createCosmosJournalStorage,z as createCosmosKvStorage};//# sourceMappingURL=cloud-storage.js.map
|
|
2
|
+
//# sourceMappingURL=cloud-storage.js.map
|
package/lib/execution-refs.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunkU2N6MCD5_cjs=require('./chunk-U2N6MCD5.cjs');require('./chunk-SFVO2LB2.cjs'),require('./chunk-GNFE24S7.cjs');Object.defineProperty(exports,"executionRefFromScriptPath",{enumerable:true,get:function(){return chunkU2N6MCD5_cjs.a}});Object.defineProperty(exports,"parseExecutionRef",{enumerable:true,get:function(){return chunkU2N6MCD5_cjs.c}});Object.defineProperty(exports,"serializeExecutionRef",{enumerable:true,get:function(){return chunkU2N6MCD5_cjs.b}});//# sourceMappingURL=execution-refs.cjs.map
|
|
2
2
|
//# sourceMappingURL=execution-refs.cjs.map
|
package/lib/execution-refs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{a as executionRefFromScriptPath,c as parseExecutionRef,b as serializeExecutionRef}from'./chunk-
|
|
1
|
+
export{a as executionRefFromScriptPath,c as parseExecutionRef,b as serializeExecutionRef}from'./chunk-XQRNDX4Q.js';import'./chunk-BQS3EIEK.js';import'./chunk-FW4363Y4.js';//# sourceMappingURL=execution-refs.js.map
|
|
2
2
|
//# sourceMappingURL=execution-refs.js.map
|