yaml-flow 8.3.0 → 8.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/asset-integrity.json +3 -3
- package/browser/board-livecards-localstorage.js +6 -4
- package/browser/live-cards.js +19 -25
- package/cli/browser-api/board-live-cards-browser-adapter.d.ts +2 -2
- package/cli/browser-api/board-live-cards-browser-adapter.js +3 -2
- package/cli/browser-api/card-store-browser-api.js +1 -1
- package/cli/{execution-interface-CrG5gzAx.d.ts → execution-interface-DCFBy4L8.d.ts} +36 -1
- package/cli/node/artifacts-store-cli.js +5 -5
- package/cli/node/batch-runner-cli.js +2 -2
- package/cli/node/board-live-cards-cli.js +15 -9
- package/cli/node/card-store-cli.js +6 -6
- package/cli/node/chat-store-cli.js +7 -7
- package/cli/node/execution-adapter.d.ts +1 -1
- package/cli/node/execution-adapter.js +2 -2
- package/cli/node/fs-board-adapter.d.ts +72 -73
- package/cli/node/fs-board-adapter.js +14 -10
- package/cli/node/step-machine-cli.js +3 -3
- package/cli/{types-PUfPBxc_.d.ts → types-Dc2VRMUw.d.ts} +24 -16
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board/server/board-server.js +10 -1
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/{artifacts-store-lib-public-ksGIExhc.d.ts → artifacts-store-lib-454TAuov.d.ts} +2 -32
- package/lib/{artifacts-store-lib-public-Cz8-kdXG.d.cts → artifacts-store-lib-zsGFbBV8.d.cts} +2 -32
- package/lib/artifacts-store-public.d.cts +34 -3
- package/lib/artifacts-store-public.d.ts +34 -3
- package/lib/board-live-cards-node.cjs +14 -10
- package/lib/board-live-cards-node.d.cts +24 -23
- package/lib/board-live-cards-node.d.ts +24 -23
- package/lib/board-live-cards-node.js +14 -10
- package/lib/{board-live-cards-public-BwZYGAsF.d.cts → board-live-cards-public-BM6jCEIa.d.cts} +24 -4
- package/lib/{board-live-cards-public-DWpZVDXN.d.ts → board-live-cards-public-Bz07XKRK.d.ts} +24 -4
- package/lib/board-live-cards-public.cjs +2 -2
- 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 +2 -2
- package/lib/board-live-cards-server-runtime.cjs +4 -4
- package/lib/board-live-cards-server-runtime.d.cts +5 -4
- package/lib/board-live-cards-server-runtime.d.ts +5 -4
- package/lib/board-live-cards-server-runtime.js +4 -4
- package/lib/card-store-public.d.cts +2 -2
- package/lib/card-store-public.d.ts +2 -2
- package/lib/{chat-storage-lib-BK5Njslc.d.ts → chat-storage-lib-DGaKrjVe.d.ts} +1 -1
- package/lib/{chat-storage-lib-C5bQ7bGe.d.cts → chat-storage-lib-OX0Q_Ttf.d.cts} +1 -1
- package/lib/chat-store-public.d.cts +3 -3
- package/lib/chat-store-public.d.ts +3 -3
- package/lib/execution-refs.cjs +1 -1
- package/lib/execution-refs.js +1 -1
- package/lib/index.d.cts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/server-runtime/index.cjs +4 -4
- package/lib/server-runtime/index.d.cts +6 -5
- package/lib/server-runtime/index.d.ts +6 -5
- package/lib/server-runtime/index.js +4 -4
- package/lib/step-machine-public/index.cjs +3 -3
- 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 +3 -3
- package/lib/{storage-interface-B6ecOulj.d.cts → storage-interface-B-7pDHwD.d.cts} +36 -1
- package/lib/{storage-interface-B6ecOulj.d.ts → storage-interface-B-7pDHwD.d.ts} +36 -1
- package/lib/stores/index.d.cts +1 -1
- package/lib/stores/index.d.ts +1 -1
- package/lib/stores/kv.d.cts +1 -1
- package/lib/stores/kv.d.ts +1 -1
- package/lib/{types-DNYhCFNJ.d.ts → types-Cn0b8G-i.d.ts} +15 -15
- package/lib/{types-D9B0Vrwg.d.cts → types-Dszjwfud.d.cts} +15 -15
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BoardPlatformAdapter, N as NotificationTransport, C as ChatStorage } from '../types-
|
|
2
|
-
import { E as ExecutionRef } from '../execution-interface-
|
|
1
|
+
import { B as BoardPlatformAdapter, N as NotificationTransport, C as ChatStorage } from '../types-Dc2VRMUw.js';
|
|
2
|
+
import { E as ExecutionRef } from '../execution-interface-DCFBy4L8.js';
|
|
3
3
|
import '../board-live-cards-lib-tjYsPt5U.js';
|
|
4
4
|
|
|
5
5
|
declare function createLocalStorageChatStorage(namespace: string): ChatStorage;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var A="b64:";function D(t){let e=new TextEncoder().encode(t),g=globalThis.Buffer,a;if(g)a=g.from(e).toString("base64");else if(typeof btoa=="function"){let s="";for(let l of e)s+=String.fromCharCode(l);a=btoa(s);}else throw new Error("No base64 encoder available in this runtime");return a.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function W(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),g=globalThis.Buffer;if(g)return g.from(e,"base64").toString("utf8");if(typeof atob=="function"){let a=atob(e),s=new Uint8Array(a.length);for(let l=0;l<a.length;l+=1)s[l]=a.charCodeAt(l);return new TextDecoder().decode(s)}throw new Error("No base64 decoder available in this runtime")}function v(t){return `${A}${D(JSON.stringify(t))}`}function k(t){if(!t.startsWith(A))throw new Error(`Invalid ref format (expected ${A}<base64url(json)>): ${t}`);let e;try{e=JSON.parse(W(t.slice(A.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${t}`)}if(!e||typeof e!="object")throw new Error(`Invalid ref format (expected object payload): ${t}`);let g=e;if(typeof g.kind!="string"||typeof g.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${t}`);return {kind:g.kind,value:g.value}}function E(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function L(t){let e=t.payload??{};return {id:t.id,role:typeof e.role=="string"?e.role:"system",text:typeof e.text=="string"?e.text:"",files:Array.isArray(e.files)?e.files:[],updated_at:typeof e.updated_at=="string"?e.updated_at:""}}function M(t,e){let g=s=>`chats/${E(s)}/processing`,a=s=>`chats/${E(s)}/config`;return {append(s,l,r,o=[]){return t(s).append({role:l,text:r,files:o,updated_at:new Date().toISOString()}).id},readAll(s){return t(s).readAll().map(L)},readAfter(s,l){let r=t(s).readAfter(l);return {records:r.entries.map(L),cursor:r.newCursor}},clear(s){t(s).clear?.();},setProcessing(s,l){l?e.write(g(s),true):e.delete(g(s));},isProcessing(s){return e.read(g(s))===true},getConfig(s){return e.read(a(s))??{}},setConfig(s,l){let r=e.read(a(s))??{};e.write(a(s),{...r,...l});}}}function $(t){if(t==null||typeof t!="object")return JSON.stringify(t);if(Array.isArray(t))return `[${t.map($).join(",")}]`;let e=t;return `{${Object.keys(e).sort().map(a=>`${JSON.stringify(a)}:${$(e[a])}`).join(",")}}`}function I(t,e){let g=e>>>0;for(let a=0;a<t.length;a++)g^=t.charCodeAt(a),g=Math.imul(g,16777619)>>>0;return g}function O(t){let e=$(t),g=I(e,2166136261),a=I(e,3735928559),s=I(e,19088743),l=I(e,4277009102);return [g,a,s,l].map(r=>r.toString(16).padStart(8,"0")).join("")}function R(t){function e(l){return `${t}:blob:${l}`}let g=new TextEncoder;function a(l){if(typeof btoa=="function"){let r="";for(let o=0;o<l.length;o++)r+=String.fromCharCode(l[o]);return btoa(r)}return ""}function s(l){if(typeof atob=="function"){let r=atob(l),o=new Uint8Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);return o}return new Uint8Array}return {read(l){return globalThis.localStorage.getItem(e(l))},write(l,r){globalThis.localStorage.setItem(e(l),r);},exists(l){return globalThis.localStorage.getItem(e(l))!==null},remove(l){globalThis.localStorage.removeItem(e(l));},readBytes(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;try{let o=JSON.parse(r);if(o&&o.__kind==="bytes-b64"&&typeof o.data=="string")return s(o.data)}catch{}return g.encode(r)},writeBytes(l,r){let o=JSON.stringify({__kind:"bytes-b64",data:a(r)});globalThis.localStorage.setItem(e(l),o);},listKeys(l){let r=e(l??""),o=[];for(let i=0;i<globalThis.localStorage.length;i++){let u=globalThis.localStorage.key(i);u&&u.startsWith(r)&&o.push(u.slice(e("").length));}return o.sort()},stat(l){let r=globalThis.localStorage.getItem(e(l));if(r===null)return null;let o=g.encode(r).byteLength;try{let i=JSON.parse(r);i&&i.__kind==="bytes-b64"&&typeof i.data=="string"&&(o=s(i.data).byteLength);}catch{}return {key:l,size:o}}}}var H=":scratch-marker",V=":scratch-config",T=":scratch:",z=1440*60*1e3,X=720*60*1e3,q=200;function N(t,e){if(!t)return e;let g=t.replace(/[^A-Za-z0-9._-]/g,"_");return g.length>0?g:e}function B(t){let e=`${t}${H}`,g=`${t}${V}`,a=n=>`${t}${T}${n}`,s=n=>`${t}${T}${n}:__ts`,l=globalThis.localStorage.getItem(e)===null;if(l)try{globalThis.localStorage.setItem(e,`scratch-store
|
|
2
|
+
${new Date().toISOString()}`);}catch{}function r(){let n=globalThis.localStorage.getItem(g);if(n===null)return {};try{let c=JSON.parse(n);return c&&typeof c=="object"&&!Array.isArray(c)?c:{}}catch{return {}}}function o(n){try{globalThis.localStorage.setItem(g,JSON.stringify(n));}catch{}}if(l){let n=r();typeof n["retention.lastSweepAt"]!="number"&&(n["retention.lastSweepAt"]=Date.now(),o(n));}function i(){if(globalThis.localStorage.getItem(e)===null)return;let n=r(),c=typeof n["retention.maxAgeMs"]=="number"?n["retention.maxAgeMs"]:z,f=typeof n["retention.sweepIntervalMs"]=="number"?n["retention.sweepIntervalMs"]:X;if(c<=0||f<=0)return;let h=typeof n["retention.lastSweepAt"]=="number"?n["retention.lastSweepAt"]:0,y=Date.now();if(y-h<f)return;n["retention.lastSweepAt"]=y,o(n);let p=y,S=`${t}${T}`,b=[];for(let m=0;m<globalThis.localStorage.length;m++){let w=globalThis.localStorage.key(m);w&&w.startsWith(S)&&!w.endsWith(":__ts")&&b.push(w);}for(let m of b){if(Date.now()-p>q)break;let w=globalThis.localStorage.getItem(`${m}:__ts`),C=w===null?0:Number(w);if(Number.isFinite(C)&&C>0&&y-C>c){try{globalThis.localStorage.removeItem(m);}catch{}try{globalThis.localStorage.removeItem(`${m}:__ts`);}catch{}}}}function u(n,c){let f=N(n,"scratch"),h=N(c,".json"),y=h.startsWith(".")?h:`.${h}`,p=Math.random().toString(36).slice(2,10);return `${f}-${Date.now()}-${p}${y}`}function d(n,c){globalThis.localStorage.setItem(a(n),c),globalThis.localStorage.setItem(s(n),String(Date.now()));}return {read(n){return globalThis.localStorage.getItem(a(n))},write(n,c){d(n,c);try{i();}catch{}},exists(n){return globalThis.localStorage.getItem(a(n))!==null},remove(n){try{globalThis.localStorage.removeItem(a(n));}catch{}try{globalThis.localStorage.removeItem(s(n));}catch{}},readBytes(n){let c=globalThis.localStorage.getItem(a(n));return c===null?null:new TextEncoder().encode(c)},writeBytes(n,c){let f="";for(let h=0;h<c.length;h++)f+=String.fromCharCode(c[h]);d(n,f);try{i();}catch{}},stat(n){let c=globalThis.localStorage.getItem(a(n));if(c===null)return null;let f=globalThis.localStorage.getItem(s(n)),h=f===null?null:Number(f);return {key:n,size:new TextEncoder().encode(c).byteLength,updatedAt:h!==null&&Number.isFinite(h)?new Date(h).toISOString():void 0}},listKeys(n){let c=`${t}${T}`,f=[];for(let h=0;h<globalThis.localStorage.length;h++){let y=globalThis.localStorage.key(h);if(y&&y.startsWith(c)&&!y.endsWith(":__ts")){let p=y.slice(c.length);(!n||p.startsWith(n))&&f.push(p);}}return f.sort()},getUniqueKey(n,c){return u(n,c)},create(n,c,f){let h=u(c,f);d(h,n);try{i();}catch{}return h},keyRef(n){return {kind:"local-storage-scratch",value:n,extra:{prefix:t}}},config:{get(n){return r()[n]??null},set(n,c){let f=r();c==null?delete f[n]:f[n]=c,o(f);}}}}var G=":archive-marker",Z=":archive-config",_=":archive:stream:",U=":archive:blob:";function K(t){let e=t.replace(/[^A-Za-z0-9._-]/g,"_");if(!e)throw new Error("Archive segment name cannot be empty after sanitization");return e}function J(t){let e=`${t}${G}`,g=`${t}${Z}`,a=o=>`${t}${_}${o}`;if(globalThis.localStorage.getItem(e)===null)try{globalThis.localStorage.setItem(e,`archive-store
|
|
3
|
+
${new Date().toISOString()}`);}catch{}function s(){let o=globalThis.localStorage.getItem(g);if(o===null)return {};try{let i=JSON.parse(o);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return {}}}function l(o){try{globalThis.localStorage.setItem(g,JSON.stringify(o));}catch{}}function r(){if(globalThis.localStorage.getItem(e)===null)return;let o=s(),i=typeof o["retention.maxAgeMs"]=="number"?o["retention.maxAgeMs"]:0,u=typeof o["retention.sweepIntervalMs"]=="number"?o["retention.sweepIntervalMs"]:0;if(i<=0||u<=0)return;let d=typeof o["retention.lastSweepAt"]=="number"?o["retention.lastSweepAt"]:0,n=Date.now();if(n-d<u)return;o["retention.lastSweepAt"]=n,l(o);let c=`${t}${_}`;for(let f=0;f<globalThis.localStorage.length;f++){let h=globalThis.localStorage.key(f);if(!h||!h.startsWith(c))continue;let y=globalThis.localStorage.getItem(h);if(y)try{let p=JSON.parse(y),S=p.filter(b=>typeof b.__ts!="number"||n-b.__ts<=i);S.length!==p.length&&globalThis.localStorage.setItem(h,JSON.stringify(S));}catch{}}}return {stream(o){let i=K(o),u=a(i);function d(){let c=globalThis.localStorage.getItem(u);if(!c)return [];try{return JSON.parse(c)}catch{return []}}function n(c){try{globalThis.localStorage.setItem(u,JSON.stringify(c));}catch{}}return {append(c){let f={id:globalThis.crypto.randomUUID(),payload:c,__ts:Date.now()},h=d();h.push(f),n(h);try{r();}catch{}return {id:f.id,payload:f.payload}},readAll(){return d().map(c=>({id:c.id,payload:c.payload}))},readAfter(c){let f=d();if(!c){let S=f.map(b=>({id:b.id,payload:b.payload}));return {entries:S,newCursor:S.length>0?S[S.length-1].id:null}}let h=f.findIndex(S=>S.id===c),p=(h===-1?f:f.slice(h+1)).map(S=>({id:S.id,payload:S.payload}));return {entries:p,newCursor:p.length>0?p[p.length-1].id:c}},clear(){try{globalThis.localStorage.removeItem(u);}catch{}}}},blob(o){let i=K(o),u=R(`${t}${U}${i}`);return {read:d=>u.read(d),write:(d,n)=>{u.write(d,n);try{r();}catch{}},exists:d=>u.exists(d),remove:d=>u.remove(d),readBytes:u.readBytes?d=>u.readBytes(d):void 0,writeBytes:u.writeBytes?(d,n)=>{u.writeBytes(d,n);try{r();}catch{}}:void 0,listKeys:d=>u.listKeys(d),stat:u.stat?d=>u.stat(d):void 0}},listStreams(o){let i=`${t}${_}`,u=[];for(let d=0;d<globalThis.localStorage.length;d++){let n=globalThis.localStorage.key(d);if(!n||!n.startsWith(i))continue;let c=n.slice(i.length);(!o||c.startsWith(o))&&u.push(c);}return u.sort()},listBlobs(o){let i=`${t}${U}`,u=new Set;for(let d=0;d<globalThis.localStorage.length;d++){let n=globalThis.localStorage.key(d);if(!n||!n.startsWith(i))continue;let c=n.slice(i.length),f=c.indexOf(":"),h=f===-1?c:c.slice(0,f);(!o||h.startsWith(o))&&u.add(h);}return Array.from(u).sort()},config:{get(o){return s()[o]??null},set(o,i){let u=s();i==null?delete u[o]:u[o]=i,l(u);}}}}function x(t){function e(g){return `${t}:kv:${g}`}return {read(g){let a=globalThis.localStorage.getItem(e(g));if(a===null)return null;try{return JSON.parse(a)}catch{return null}},write(g,a){globalThis.localStorage.setItem(e(g),JSON.stringify(a));},delete(g){globalThis.localStorage.removeItem(e(g));},listKeys(g){let a=e(g??""),s=[];for(let l=0;l<globalThis.localStorage.length;l++){let r=globalThis.localStorage.key(l);r!==null&&r.startsWith(a)&&s.push(r.slice(e("").length));}return s}}}function j(t){function e(){let a=globalThis.localStorage.getItem(t);if(!a)return [];try{return JSON.parse(a)}catch{return []}}function g(a){globalThis.localStorage.setItem(t,JSON.stringify(a));}return {readAllEntries(){return e()},appendEntry(a){let s=e();s.push(a),g(s);},generateId(){return globalThis.crypto.randomUUID()}}}function Y(){let t=false;return {tryAcquire(){return t?null:(t=true,()=>{t=false;})}}}function Q(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function tt(t){function e(){let a=globalThis.localStorage.getItem(t);if(!a)return [];try{return JSON.parse(a)}catch{return []}}function g(a){globalThis.localStorage.setItem(t,JSON.stringify(a));}return {append(a){let s={id:globalThis.crypto.randomUUID(),payload:a},l=e();return l.push(s),g(l),s},readAll(){return e()},readAfter(a){let s=e();if(!a)return {entries:s,newCursor:s.length>0?s[s.length-1].id:null};let l=s.findIndex(o=>o.id===a),r=l===-1?s:s.slice(l+1);return {entries:r,newCursor:r.length>0?r[r.length-1].id:a}},clear(){globalThis.localStorage.removeItem(t);}}}function it(t){return M(e=>tt(`${t}:chat:journal:${Q(e)}`),x(`${t}:chat`))}var P=new Map;function F(t){let e=P.get(t);if(!e){let g=new Set;e={publish(a){for(let s of g)s(a);},subscribe(a){return g.add(a),()=>{g.delete(a);}}},P.set(t,e);}return e}function lt(){return {async subscribe(t,e){return t.kind!=="in-memory-bus"?(console.warn(`[in-memory-transport] unsupported kind: ${t.kind}`),()=>{}):F(t.value).subscribe(a=>{let s=a;if(s&&s.kind==="notification-batch"&&Array.isArray(s.notifications)){for(let l of s.notifications)e(l);return}e(a);})}}}function ct(t,e){let g=e?.callbackBaseUrl?{meta:"board-live-cards",howToRun:"http:post",whatToRun:e.callbackBaseUrl}:{meta:"board-live-cards",howToRun:"in-browser",whatToRun:v({kind:"in-browser",value:t})},a=new Map,s=new Map,l=Y();return {kvStorage:r=>x(`${t}:${r}`),blobStorage:r=>R(r?`${t}:${r}`:t),scratchStorage:()=>B(`${t}:scratch`),scratchStorageForRef:r=>B(k(r).value),archiveFactory:()=>J(`${t}:archive`),archiveFactoryForRef:r=>J(k(r).value),journalAdapter:()=>j(`${t}:journal`),lock:l,selfRef:g,async dispatchExecution(r,o){if(r.howToRun==="http:post")try{let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=await fetch(u,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});return d.ok?{dispatched:!0}:{dispatched:!1,error:`HTTP ${d.status}: ${d.statusText}`}}catch(i){return {dispatched:false,error:i instanceof Error?i.message:String(i)}}if(r.howToRun==="http:get")try{let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=new URLSearchParams(Object.entries(o).filter(([,f])=>f!=null).map(([f,h])=>[f,String(h)])),n=`${u}?${d.toString()}`,c=await fetch(n);return c.ok?{dispatched:!0}:{dispatched:!1,error:`HTTP ${c.status}: ${c.statusText}`}}catch(i){return {dispatched:false,error:i instanceof Error?i.message:String(i)}}if(r.howToRun==="in-browser"){let i=r.whatToRun,u=typeof i=="object"?i.value:k(i).value,d=a.get(u);return d?d(r,o):{dispatched:false,error:`No in-browser handler registered for: ${u}`}}return {dispatched:false,error:`Browser adapter: unsupported dispatch kind (got: ${r.howToRun})`}},resolveBlob(r){if(r.kind==="in-memory"){let u=s.get(r.value);if(u==null)throw new Error(`resolveBlob: in-memory blob not found: ${v(r)}`);return u}let i=R(t).read(r.value);if(i===null)throw new Error(`resolveBlob: blob not found: ${v(r)}`);return i},hashFn:O,genId:()=>globalThis.crypto.randomUUID().replace(/-/g,""),kvStorageForRef:r=>x(k(r).value),publishBoardChangeNotifications(r){if(!e?.notifyChannel||r.length===0)return;F(e.notifyChannel).publish({kind:"notification-batch",notifications:r});},onWarn:e?.onWarn,registerHandler(r,o){a.set(r,o);},writeMemoryBlob(r,o){return s.set(r,o),v({kind:"in-memory",value:r})}}}export{ct as createBrowserBoardPlatformAdapter,lt as createInMemoryNotificationTransport,it as createLocalStorageChatStorage,F as getInMemoryNotificationBus};//# sourceMappingURL=board-live-cards-browser-adapter.js.map
|
|
3
4
|
//# sourceMappingURL=board-live-cards-browser-adapter.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {createRequire}from'module';import'ajv-formats';var
|
|
1
|
+
import {createRequire}from'module';import'ajv-formats';var R=createRequire(import.meta.url);R("./jsonata-sync.cjs");var x=createRequire(import.meta.url);x("./jsonata-sync.cjs");function y(n,o){function e(){return n.readIndex()??{}}function r(t,s,i){let a=String(s||"").split(".").filter(Boolean);if(a.length===0)return i&&typeof i=="object"&&!Array.isArray(i)?i:{value:i};let u={...t},c=u;for(let d=0;d<a.length-1;d++){let l=a[d],g=c[l],m=g&&typeof g=="object"&&!Array.isArray(g)?{...g}:{};c[l]=m,c=m;}return c[a[a.length-1]]=i,u}return {readCard(t){let s=e()[t];return !s||!n.cardExists(s.key)?null:n.readCard(s.key)},readCardKey(t){return e()[t]?.key??null},readAllCards(){let t=[];for(let[s,i]of Object.entries(e())){if(!n.cardExists(i.key))continue;let a=n.readCard(i.key);a?t.push(a):o?.(`[card-store] could not read card "${s}" at key "${i.key}"`);}return t},readChecksumIndex(){let t={};for(let[s,i]of Object.entries(e()))t[s]=i.checksum;return t},changedSince(t){let s=e(),i=[];for(let[a,u]of Object.entries(s))t[a]!==u.checksum&&i.push(a);for(let a of Object.keys(t))s[a]||i.push(a);return i},validateUpsert(t,s){let i=e(),a=i[t],u=Object.entries(i).find(([,c])=>c.key===s);return a&&a.key!==s?{ok:false,error:`Card id "${t}" is already mapped to key "${a.key}", cannot remap to "${s}"`}:u&&u[0]!==t?{ok:false,error:`Key "${s}" is already mapped to card id "${u[0]}", cannot remap to "${t}"`}:{ok:true}},writeCard(t,s,i){let a=e(),u=i??a[t]?.key??n.defaultCardKey(t),c=n.writeCard(u,s);a[t]={key:u,checksum:c,updatedAt:new Date().toISOString()},n.writeIndex(a);},patchCard(t,s,i){let a=e(),u=a[t];if(!u||!n.cardExists(u.key))throw new Error(`card "${t}" not found`);let c=n.readCard(u.key);if(!c||typeof c!="object"||Array.isArray(c))throw new Error(`card "${t}" is not patchable`);let d=r(c,s,i),l=n.writeCard(u.key,d);a[t]={key:u.key,checksum:l,updatedAt:new Date().toISOString()},n.writeIndex(a);},removeCard(t){let s=e();s[t]&&(delete s[t],n.writeIndex(s));},readIndex(){return e()}}}function p(n){if(n==null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return `[${n.map(p).join(",")}]`;let o=n;return `{${Object.keys(o).sort().map(r=>`${JSON.stringify(r)}:${p(o[r])}`).join(",")}}`}function f(n,o){let e=o>>>0;for(let r=0;r<n.length;r++)e^=n.charCodeAt(r),e=Math.imul(e,16777619)>>>0;return e}function _(n){let o=p(n),e=f(o,2166136261),r=f(o,3735928559),t=f(o,19088743),s=f(o,4277009102);return [e,r,t,s].map(i=>i.toString(16).padStart(8,"0")).join("")}function T(n){function o(e){return `${n}:kv:${e}`}return {read(e){let r=globalThis.localStorage.getItem(o(e));if(r===null)return null;try{return JSON.parse(r)}catch{return null}},write(e,r){globalThis.localStorage.setItem(o(e),JSON.stringify(r));},delete(e){globalThis.localStorage.removeItem(o(e));},listKeys(e){let r=o(e??""),t=[];for(let s=0;s<globalThis.localStorage.length;s++){let i=globalThis.localStorage.key(s);i!==null&&i.startsWith(r)&&t.push(i.slice(o("").length));}return t}}}function h(n,o){let e={...n};for(let[r,t]of Object.entries(o))t!==null&&typeof t=="object"&&!Array.isArray(t)&&e[r]!==null&&typeof e[r]=="object"&&!Array.isArray(e[r])?e[r]=h(e[r],t):e[r]=t;return e}function S(n,o,e){if(o.length===0)return n;let[r,...t]=o;if(t.length===0)return {...n,[r]:e};let s=n[r]!==null&&typeof n[r]=="object"&&!Array.isArray(n[r])?n[r]:{};return {...n,[r]:S(s,t,e)}}function A(n){let o=T(n);return {read:e=>o.read(e),get(e,r){let t=o.read(e);if(t===null)return null;let s=t;for(let i of r.split(".").filter(Boolean)){if(s===null||typeof s!="object"||Array.isArray(s))return null;s=s[i]??null;}return s??null},write:(e,r)=>o.write(e,r),delete:e=>o.delete(e),listKeys:e=>o.listKeys(e),shallowMerge(e,r){let t=o.read(e)??{};o.write(e,{...t,...r});},deepMerge(e,r){let t=o.read(e)??{};o.write(e,h(t,r));},patch(e,r,t){let s=o.read(e)??{},i=r.split(".").filter(Boolean);o.write(e,S(s,i,t));}}}function k(n){let o=A(n);return {readIndex(){return o.read("_index")},writeIndex(e){o.write("_index",e);},readCard(e){return o.read(e)},writeCard(e,r){return o.write(e,r),_(r)},cardExists(e){return o.read(e)!==null},defaultCardKey(e){return e}}}function ke(n){let o=k(n),e=y(o);return {getCard(r){return e.readCard(r)},getAllCards(){return e.readAllCards()},upsertCard(r){let t=o.defaultCardKey(r.id);e.writeCard(r.id,r,t);},removeCard(r){e.removeCard(r);}}}export{ke as createBrowserCardStoreApi};//# sourceMappingURL=card-store-browser-api.js.map
|
|
2
2
|
//# sourceMappingURL=card-store-browser-api.js.map
|
|
@@ -94,6 +94,41 @@ interface KVStorage {
|
|
|
94
94
|
*/
|
|
95
95
|
listKeys(prefix?: string): string[];
|
|
96
96
|
}
|
|
97
|
+
interface ScratchStorage extends BlobStorage {
|
|
98
|
+
/**
|
|
99
|
+
* Allocate a new unique key. Does NOT create any underlying object — caller
|
|
100
|
+
* must write to it (e.g. via a spawned child) before it has content.
|
|
101
|
+
* prefix and suffix are sanitized; both are optional.
|
|
102
|
+
*/
|
|
103
|
+
getUniqueKey(prefix?: string, suffix?: string): string;
|
|
104
|
+
/**
|
|
105
|
+
* Allocate a new unique key AND write data at it atomically. Returns the
|
|
106
|
+
* new key. Counts as a write for sweep-trigger purposes.
|
|
107
|
+
*/
|
|
108
|
+
create(data: string, prefix?: string, suffix?: string): string;
|
|
109
|
+
/** Resolve a key to a transport-neutral ref (e.g. for child-process handoff). */
|
|
110
|
+
keyRef(key: string): KindValueRef;
|
|
111
|
+
/** Backend-agnostic config bag (used for retention policy and similar knobs). */
|
|
112
|
+
config: {
|
|
113
|
+
get(k: string): unknown;
|
|
114
|
+
set(k: string, v: unknown): void;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
interface ArchiveFactory {
|
|
118
|
+
/** Open (or create) a named append-only stream rooted inside the archive. */
|
|
119
|
+
stream(name: string): JournalStorage;
|
|
120
|
+
/** Open (or create) a named blob namespace rooted inside the archive. */
|
|
121
|
+
blob(name: string): BlobStorage;
|
|
122
|
+
/** List all stream names present in the archive. */
|
|
123
|
+
listStreams(prefix?: string): string[];
|
|
124
|
+
/** List all blob namespace names present in the archive. */
|
|
125
|
+
listBlobs(prefix?: string): string[];
|
|
126
|
+
/** Backend-agnostic config bag (retention knobs and similar). */
|
|
127
|
+
config: {
|
|
128
|
+
get(k: string): unknown;
|
|
129
|
+
set(k: string, v: unknown): void;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
97
132
|
interface AtomicRelayLock {
|
|
98
133
|
/**
|
|
99
134
|
* Attempt to acquire the lock without blocking.
|
|
@@ -397,4 +432,4 @@ declare function serializeExecutionRef(ref: ExecutionRef): string;
|
|
|
397
432
|
*/
|
|
398
433
|
declare function parseExecutionRef(s: string): ExecutionRef;
|
|
399
434
|
|
|
400
|
-
export { type ArgsMassaging as A, type BlobStorage as B, type ExecutionRef as E, type JournalStorage as J, type KindValueRef as K, type ExecutionResult as a, type KVStorage as b, type
|
|
435
|
+
export { type ArgsMassaging as A, type BlobStorage as B, type ExecutionRef as E, type JournalStorage as J, type KindValueRef as K, type ScratchStorage as S, type ExecutionResult as a, type KVStorage as b, type ArchiveFactory as c, type AtomicRelayLock as d, executionRefFromScriptPath as e, parseRef as f, serializeRef as g, parseExecutionRef as p, serializeExecutionRef as s };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import*as c from'fs';import*as d from'path';import {randomUUID}from'crypto';import'proper-lockfile';import*as
|
|
2
|
-
Usage: ${r}`);return e}function m(n,s){let r=n.indexOf(s);return r!==-1?n[r+1]:void 0}async function T(){let n=[];for await(let s of process.stdin)n.push(Buffer.isBuffer(s)?s:Buffer.from(s));return new Uint8Array(Buffer.concat(n))}var
|
|
3
|
-
`);async function L(n){let s=n[0],r=n.slice(1);if(!s||s==="help"||s==="--help"||s==="-h"){console.error(
|
|
4
|
-
`);return}if(s==="get"){let a=y(r,"--key","artifacts-store get --store-ref <ref> --key <key>"),o=(m(r,"--as")||"bytes").toLowerCase(),f=m(r,"--out"),u=t.get({params:{key:a,as:o}});if(u.status!=="success")throw new Error(u.error||"get failed");if(o==="text"){let
|
|
1
|
+
import*as c from'fs';import*as d from'path';import {randomUUID}from'crypto';import'proper-lockfile';import*as E from'os';import'net';import'url';import'child_process';var w="b64:";function B(n){let s=n.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-n.length%4)%4),r=globalThis.Buffer;if(r)return r.from(s,"base64").toString("utf8");if(typeof atob=="function"){let i=atob(s),e=new Uint8Array(i.length);for(let t=0;t<i.length;t+=1)e[t]=i.charCodeAt(t);return new TextDecoder().decode(e)}throw new Error("No base64 decoder available in this runtime")}function k(n){if(!n.startsWith(w))throw new Error(`Invalid ref format (expected ${w}<base64url(json)>): ${n}`);let s;try{s=JSON.parse(B(n.slice(w.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${n}`)}if(!s||typeof s!="object")throw new Error(`Invalid ref format (expected object payload): ${n}`);let r=s;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${n}`);return {kind:r.kind,value:r.value}}function A(n,s){if(process.platform!=="win32"){c.renameSync(n,s);return}let r=[10,20,40,80,160];for(let i=0;i<=r.length;i++)try{c.renameSync(n,s);return}catch(e){let t=e.code;if((t==="EPERM"||t==="EBUSY")&&i<r.length){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r[i]);continue}throw e}}function v(n){function s(e){return d.join(n,...e.split("/"))}function r(e){return d.relative(n,e).replace(/\\/g,"/")}function i(e,t){if(c.existsSync(e))for(let a of c.readdirSync(e,{withFileTypes:true})){let o=d.join(e,a.name);if(a.isDirectory()){i(o,t);continue}a.isFile()&&t.push(r(o));}}return {read(e){let t=s(e);if(!c.existsSync(t))return null;try{return c.readFileSync(t,"utf-8")}catch{return null}},write(e,t){let a=s(e),o=`${a}.${process.pid}.${randomUUID()}.tmp`;c.mkdirSync(d.dirname(a),{recursive:true}),c.writeFileSync(o,t,"utf-8"),A(o,a);},exists(e){return c.existsSync(s(e))},remove(e){let t=s(e);try{c.existsSync(t)&&c.unlinkSync(t);}catch{}},readBytes(e){let t=s(e);if(!c.existsSync(t))return null;try{return new Uint8Array(c.readFileSync(t))}catch{return null}},writeBytes(e,t){let a=s(e),o=`${a}.${process.pid}.${randomUUID()}.tmp`;c.mkdirSync(d.dirname(a),{recursive:true}),c.writeFileSync(o,Buffer.from(t)),A(o,a);},listKeys(e){let t=[];i(n,t);let a=t.sort();return e?a.filter(o=>o.startsWith(e)):a},stat(e){let t=s(e);if(!c.existsSync(t))return null;try{let a=c.statSync(t);return {key:e,size:Number(a.size||0),updatedAt:new Date(a.mtimeMs).toISOString()}}catch{return null}}}}function C(){return new Date().toISOString()}function R(n){return new TextEncoder().encode(n).byteLength}function $(n){return n?{key:n.key,size:n.size,updatedAt:n.updatedAt,contentType:n.contentType}:null}function F(n){function s(r){let i=n.stat?$(n.stat(r)):null;if(i)return i;if(!n.exists(r))return null;let e=n.read(r);return e===null?{key:r}:{key:r,size:R(e)}}return {exists(r){return n.exists(r)},putText(r,i,e="text/plain; charset=utf-8"){n.write(r,i);let t=s(r)??{key:r};return t.contentType=e,t.updatedAt=t.updatedAt??C(),t.size=t.size??R(i),t},putBytes(r,i,e="application/octet-stream"){if(n.writeBytes)n.writeBytes(r,i);else {let a=JSON.stringify({__kind:"bytes-array",data:[...i]});n.write(r,a);}let t=s(r)??{key:r};return t.contentType=e,t.updatedAt=t.updatedAt??C(),t.size=t.size??i.byteLength,t},getText(r){let i=n.read(r);if(i===null){if(!n.readBytes)return null;let e=n.readBytes(r);return e===null?null:Buffer.from(e).toString("utf-8")}try{let e=JSON.parse(i);if(e&&e.__kind==="bytes-array"&&Array.isArray(e.data))return new TextDecoder("utf-8").decode(new Uint8Array(e.data))}catch{}return i},getBytes(r){if(n.readBytes){let e=n.readBytes(r);if(e!==null)return e}let i=n.read(r);if(i===null)return null;try{let e=JSON.parse(i);if(e&&e.__kind==="bytes-array"&&Array.isArray(e.data))return new Uint8Array(e.data)}catch{}return new TextEncoder().encode(i)},head:s,list(r=""){return n.listKeys(r).map(i=>s(i)??{key:i}).sort((i,e)=>i.key.localeCompare(e.key))},remove(r){n.remove(r);}}}function _(n){function s(e){return {status:"success",data:e}}function r(e){return {status:"fail",error:e}}function i(e){return {status:"error",error:e instanceof Error?e.message:String(e)}}return {list(e){try{let t=e.params?.prefix??"";return s({artifacts:n.list(t)})}catch(t){return i(t)}},head(e){try{let t=e.params?.key;return t?s({artifact:n.head(t)}):r("head requires params.key")}catch(t){return i(t)}},put(e){try{let t=e.params?.key,a=e.params?.contentType;if(!t)return r("put requires params.key");let o=e.body;if(typeof o=="string")return s({artifact:n.putText(t,o,a)});if(o&&typeof o=="object"&&typeof o.text=="string")return s({artifact:n.putText(t,o.text,a)});if(o&&typeof o=="object"&&Array.isArray(o.bytes)){let f=o.bytes,u=new Uint8Array(f.map(l=>Math.max(0,Math.min(255,Number(l)||0))));return s({artifact:n.putBytes(t,u,a)})}return r("put requires body as string, {text}, or {bytes:number[]}")}catch(t){return i(t)}},get(e){try{let t=e.params?.key,a=e.params?.as??"base64";if(!t)return r("get requires params.key");let o=n.head(t);if(!o)return r(`artifact "${t}" not found`);if(a==="text"){let u=n.getText(t);return u===null?r(`artifact "${t}" not found`):s({key:t,contentType:o.contentType,size:o.size,text:u})}let f=n.getBytes(t);return f===null?r(`artifact "${t}" not found`):s({key:t,contentType:o.contentType,size:o.size,bytes:[...f]})}catch(t){return i(t)}},del(e){try{let t=e.params?.key;return t?(n.remove(t),s({ok:!0})):r("del requires params.key")}catch(t){return i(t)}}}}function x(...n){return d.resolve(...n)}d.join(E.tmpdir(),".board-live-cards-git-bash-cache.json");function y(n,s,r){let i=n.indexOf(s),e=i!==-1?n[i+1]:void 0;if(!e)throw new Error(`Missing ${s}
|
|
2
|
+
Usage: ${r}`);return e}function m(n,s){let r=n.indexOf(s);return r!==-1?n[r+1]:void 0}async function T(){let n=[];for await(let s of process.stdin)n.push(Buffer.isBuffer(s)?s:Buffer.from(s));return new Uint8Array(Buffer.concat(n))}var j=["artifacts-store \u2014 generic artifact CRUD on a blob-backed store",""," artifacts-store put --store-ref <ref> --key <key> [--file <path> | --text <text>] [--content-type <mime>]"," artifacts-store get --store-ref <ref> --key <key> [--out <path>] [--as text|bytes]"," artifacts-store head --store-ref <ref> --key <key>"," artifacts-store list --store-ref <ref> [--prefix <prefix>]"," artifacts-store del --store-ref <ref> --key <key>"].join(`
|
|
3
|
+
`);async function L(n){let s=n[0],r=n.slice(1);if(!s||s==="help"||s==="--help"||s==="-h"){console.error(j);return}let i=y(r,"--store-ref",`artifacts-store ${s} --store-ref <b64-ref>`),e=k(i).value,t=_(F(v(e)));if(s==="put"){let a=y(r,"--key","artifacts-store put --store-ref <ref> --key <key>"),o=m(r,"--content-type"),f=m(r,"--file"),u=m(r,"--text"),l;if(f)l={bytes:[...new Uint8Array(c.readFileSync(f))]};else if(typeof u=="string")l={text:u};else if(!process.stdin.isTTY)l={bytes:[...await T()]};else throw new Error("put requires --file, --text, or stdin bytes");let g=t.put({params:{key:a,...o?{contentType:o}:{}},body:l});if(g.status!=="success")throw new Error(g.error||"put failed");process.stdout.write(JSON.stringify(g.data,null,2)+`
|
|
4
|
+
`);return}if(s==="get"){let a=y(r,"--key","artifacts-store get --store-ref <ref> --key <key>"),o=(m(r,"--as")||"bytes").toLowerCase(),f=m(r,"--out"),u=t.get({params:{key:a,as:o}});if(u.status!=="success")throw new Error(u.error||"get failed");if(o==="text"){let g=u.data.text??"";f?c.writeFileSync(f,g,"utf-8"):process.stdout.write(g);return}let l=new Uint8Array(u.data.bytes??[]);f?c.writeFileSync(f,Buffer.from(l)):process.stdout.write(JSON.stringify({...u.data,bytes:void 0,byteLength:l.byteLength},null,2)+`
|
|
5
5
|
`);return}if(s==="head"){let a=y(r,"--key","artifacts-store head --store-ref <ref> --key <key>"),o=t.head({params:{key:a}});if(o.status!=="success")throw new Error(o.error||"head failed");process.stdout.write(JSON.stringify(o.data,null,2)+`
|
|
6
6
|
`);return}if(s==="list"){let a=m(r,"--prefix")||"",o=t.list({params:a?{prefix:a}:{}});if(o.status!=="success")throw new Error(o.error||"list failed");process.stdout.write(JSON.stringify(o.data,null,2)+`
|
|
7
7
|
`);return}if(s==="del"||s==="delete"||s==="rm"){let a=y(r,"--key","artifacts-store del --store-ref <ref> --key <key>"),o=t.del({params:{key:a}});if(o.status!=="success")throw new Error(o.error||"del failed");process.stdout.write(JSON.stringify(o.data,null,2)+`
|
|
8
8
|
`);return}throw new Error(`Unknown command "${s}"
|
|
9
9
|
|
|
10
|
-
${
|
|
10
|
+
${j}`)}var O=process.argv[1]&&x(process.argv[1])===x(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/,"$1"));O&&L(process.argv.slice(2)).catch(n=>{let s=n instanceof Error?n.message:String(n);console.error(s),process.exit(1);});export{L as cli};//# sourceMappingURL=artifacts-store-cli.js.map
|
|
11
11
|
//# sourceMappingURL=artifacts-store-cli.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import*as f from'fs';import*as
|
|
3
|
-
export{
|
|
2
|
+
import*as f from'fs';import*as i from'path';import {fileURLToPath}from'url';import*as y from'os';import'net';import'child_process';import'crypto';function m(...e){return i.resolve(...e)}i.join(y.tmpdir(),".board-live-cards-git-bash-cache.json");var p=i.dirname(fileURLToPath(import.meta.url)),E=i.join(p,"..","..","lib","index.js"),A=i.join(p,"..","..","lib","step-machine-public","index.js"),P=i.join(p,"..","..","lib","batch","index.js"),R=i.join(p,"execution-adapter.js"),{loadStepFlow:$,createStepMachine:C,MemoryStore:B}=await import(g(E).href),{buildStepHandlersForFlow:O}=await import(g(A).href),{batch:J}=await import(g(P).href),{invokeRefSync:M}=await import(g(R).href);function g(e){let n=i.resolve(e).replace(/\\/g,"/");return new URL(`file:///${n.startsWith("/")?n.slice(1):n}`)}async function F(e){let n=I(e);(n.help||e.length===0)&&(T(),process.exit(e.length===0?1:0));let{flowArg:a,itemsArg:r,concurrency:t}=n;if(!a)throw new Error("[batch-runner-cli] Flow path is required.");if(!r)throw new Error("[batch-runner-cli] --items <json-file-or-inline> is required.");let s=w(a),c=i.dirname(s),x=L(r),h=await $(s),l=await J(x,{concurrency:t,processor:async(o,_)=>{let v=O(h,{invoke:(b,S)=>M(U(b),S,{cliDir:c,cwd:c})});return C(h,v,{store:new B}).run(o)},onProgress:o=>{process.stderr.write(`\r[batch] ${o.completed+o.failed}/${o.total} (${o.percent}%) \u2014 ${o.active} active`);}});process.stderr.write("\r"+" ".repeat(80)+"\r"),console.log(JSON.stringify({completed:l.completed,failed:l.failed,total:l.total,durationMs:l.durationMs,items:l.items.map(o=>({index:o.index,status:o.status,durationMs:o.durationMs,...o.status==="completed"?{intent:o.result?.intent,data:o.result?.data}:{error:o.error?.message}}))},null,2)),l.failed>0&&process.exit(1);}function I(e){let n={},a=[],r=false;for(let t=0;t<e.length;t++){let s=e[t];if(s==="-h"||s==="--help"){r=true;continue}if(s==="--items"){let c=e[t+1];if(!c||c.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --items.");n["--items"]=c,t++;continue}if(s==="--concurrency"){let c=e[t+1];if(!c||c.startsWith("--"))throw new Error("[batch-runner-cli] Missing value for --concurrency.");n["--concurrency"]=c,t++;continue}if(s.startsWith("--"))throw new Error(`[batch-runner-cli] Unknown flag: ${s}`);a.push(s);}return {help:r,flowArg:a[0],itemsArg:n["--items"],concurrency:n["--concurrency"]?parseInt(n["--concurrency"],10):5}}function w(e){return i.isAbsolute(e)?e:i.resolve(process.cwd(),e)}function L(e){let n=w(e),a;f.existsSync(n)?a=f.readFileSync(n,"utf-8"):a=e;let r;try{r=JSON.parse(a);}catch(t){let s=t instanceof Error?t.message:String(t);throw new Error(`[batch-runner-cli] Failed to parse items JSON: ${s}`)}if(!Array.isArray(r))throw new Error("[batch-runner-cli] Items must be a JSON array of objects.");for(let t=0;t<r.length;t++)if(!r[t]||typeof r[t]!="object"||Array.isArray(r[t]))throw new Error(`[batch-runner-cli] Item at index ${t} is not a JSON object.`);return r}function U(e){if(!e||typeof e!="object"||typeof e.whatToRun!="string"||!e.whatToRun.startsWith("b64:"))return e;try{let n=e.whatToRun.slice(4),a=n+"=".repeat((4-n.length%4)%4),r=Buffer.from(a.replace(/-/g,"+").replace(/_/g,"/"),"base64").toString("utf8"),t=JSON.parse(r);return !t||typeof t!="object"||typeof t.value!="string"?e:{...e,whatToRun:t}}catch{return e}}function T(){console.error("Usage: batch-runner-cli <step-flow.yaml> --items <items.json> [--concurrency <n>]"),console.error(""),console.error("Run a step-machine flow for each item in a JSON array, with concurrency control."),console.error(""),console.error("Options:"),console.error(" --items <path|json> JSON file or inline JSON array of input objects"),console.error(" --concurrency <n> Max concurrent flows (default: 5)"),console.error(" -h, --help Show this help"),console.error(""),console.error("Example:"),console.error(" batch-runner-cli flow.yaml --items items.json --concurrency 3"),console.error(` batch-runner-cli flow.yaml --items '[{"a":1,"b":2},{"a":3,"b":4}]'`);}var N=process.argv[1]&&m(process.argv[1])===m(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/,"$1"));N&&F(process.argv.slice(2)).catch(e=>{let n=e instanceof Error?e.stack??e.message:String(e);console.error(n),process.exit(1);});
|
|
3
|
+
export{F as cli};//# sourceMappingURL=batch-runner-cli.js.map
|
|
4
4
|
//# sourceMappingURL=batch-runner-cli.js.map
|