yaml-flow 8.4.9 → 8.4.11
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-client.js +1 -1
- package/browser/board-livecards-localstorage.js +6 -6
- package/cli/bundled/artifacts-store-cli.mjs +12 -0
- package/cli/bundled/batch-runner-cli.mjs +3 -0
- package/cli/bundled/board-live-cards-cli.mjs +29 -0
- package/cli/bundled/card-store-cli.mjs +154 -0
- package/cli/bundled/chat-store-cli.mjs +16 -0
- package/cli/bundled/step-machine-cli.mjs +150 -0
- package/examples/board/demo-shell-with-server.html +2 -2
- package/examples/board/doc.html +2 -2
- package/examples/board-local/demo-shell-localstorage.html +3 -3
- package/lib/board-live-cards-node.cjs +6 -6
- package/lib/board-live-cards-node.js +6 -6
- package/lib/board-live-cards-server-runtime.cjs +3 -3
- package/lib/board-live-cards-server-runtime.js +3 -3
- package/lib/board-worker-adapter.cjs +2 -2
- package/lib/board-worker-adapter.js +2 -2
- package/lib/server-runtime/index.cjs +3 -3
- package/lib/server-runtime/index.js +3 -3
- package/package.json +15 -10
- package/cli/node/artifacts-store-cli.d.ts +0 -8
- package/cli/node/artifacts-store-cli.js +0 -11
- package/cli/node/batch-runner-cli.d.ts +0 -4
- package/cli/node/batch-runner-cli.js +0 -4
- package/cli/node/board-live-cards-cli.d.ts +0 -20
- package/cli/node/board-live-cards-cli.js +0 -21
- package/cli/node/card-store-cli.d.ts +0 -15
- package/cli/node/card-store-cli.js +0 -8
- package/cli/node/chat-store-cli.d.ts +0 -23
- package/cli/node/chat-store-cli.js +0 -8
- package/cli/node/execution-adapter.d.ts +0 -221
- package/cli/node/execution-adapter.js +0 -3
- package/cli/node/fs-board-adapter.d.ts +0 -190
- package/cli/node/fs-board-adapter.js +0 -20
- package/cli/node/source-cli-task-executor.d.ts +0 -1
- package/cli/node/source-cli-task-executor.js +0 -11
- package/cli/node/step-machine-cli.d.ts +0 -63
- package/cli/node/step-machine-cli.js +0 -5
- /package/cli/{node → bundled}/jsonata-sync.cjs +0 -0
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import*as d from'fs';import {createRequire}from'module';import'ajv-formats';import*as g from'path';import {createHash,randomUUID}from'crypto';import'proper-lockfile';import*as O from'os';import'net';import'url';import'child_process';var S="b64:";function N(r){let n=r.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-r.length%4)%4),e=globalThis.Buffer;if(e)return e.from(n,"base64").toString("utf8");if(typeof atob=="function"){let o=atob(n),t=new Uint8Array(o.length);for(let s=0;s<o.length;s+=1)t[s]=o.charCodeAt(s);return new TextDecoder().decode(t)}throw new Error("No base64 decoder available in this runtime")}function R(r){if(!r.startsWith(S))throw new Error(`Invalid ref format (expected ${S}<base64url(json)>): ${r}`);let n;try{n=JSON.parse(N(r.slice(S.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${r}`)}if(!n||typeof n!="object")throw new Error(`Invalid ref format (expected object payload): ${r}`);let e=n;if(typeof e.kind!="string"||typeof e.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${r}`);return {kind:e.kind,value:e.value}}var D=createRequire(import.meta.url);D("./jsonata-sync.cjs");var M=createRequire(import.meta.url);M("./jsonata-sync.cjs");function A(r,n){function e(){return r.readIndex()??{}}function o(t,s,a){let i=String(s||"").split(".").filter(Boolean);if(i.length===0)return a&&typeof a=="object"&&!Array.isArray(a)?a:{value:a};let c={...t},u=c;for(let l=0;l<i.length-1;l++){let f=i[l],p=u[f],b=p&&typeof p=="object"&&!Array.isArray(p)?{...p}:{};u[f]=b,u=b;}return u[i[i.length-1]]=a,c}return {readCard(t){let s=e()[t];return !s||!r.cardExists(s.key)?null:r.readCard(s.key)},readCardKey(t){return e()[t]?.key??null},readAllCards(){let t=[];for(let[s,a]of Object.entries(e())){if(!r.cardExists(a.key))continue;let i=r.readCard(a.key);i?t.push(i):n?.(`[card-store] could not read card "${s}" at key "${a.key}"`);}return t},readChecksumIndex(){let t={};for(let[s,a]of Object.entries(e()))t[s]=a.checksum;return t},changedSince(t){let s=e(),a=[];for(let[i,c]of Object.entries(s))t[i]!==c.checksum&&a.push(i);for(let i of Object.keys(t))s[i]||a.push(i);return a},validateUpsert(t,s){let a=e(),i=a[t],c=Object.entries(a).find(([,u])=>u.key===s);return i&&i.key!==s?{ok:false,error:`Card id "${t}" is already mapped to key "${i.key}", cannot remap to "${s}"`}:c&&c[0]!==t?{ok:false,error:`Key "${s}" is already mapped to card id "${c[0]}", cannot remap to "${t}"`}:{ok:true}},writeCard(t,s,a){let i=e(),c=a??i[t]?.key??r.defaultCardKey(t),u=r.writeCard(c,s);i[t]={key:c,checksum:u,updatedAt:new Date().toISOString()},r.writeIndex(i);},patchCard(t,s,a){let i=e(),c=i[t];if(!c||!r.cardExists(c.key))throw new Error(`card "${t}" not found`);let u=r.readCard(c.key);if(!u||typeof u!="object"||Array.isArray(u))throw new Error(`card "${t}" is not patchable`);let l=o(u,s,a),f=r.writeCard(c.key,l);i[t]={key:c.key,checksum:f,updatedAt:new Date().toISOString()},r.writeIndex(i);},removeCard(t){let s=e(),a=s[t];a&&(r.removeCard(a.key),delete s[t],r.writeIndex(s));},readIndex(){return e()}}}function E(r){function n(t){return {status:"success",data:t}}function e(t){return {status:"fail",error:t}}function o(t){return {status:"error",error:t instanceof Error?t.message:String(t)}}return {get(t){try{let s=t.params?.id;if(s){let a=r.readCard(s);return a?n({cards:[a]}):e(`card "${s}" not found`)}return n({cards:r.readAllCards()})}catch(s){return o(s)}},set(t){try{let s=t.body;if(s==null)return e("set requires a body (card object or array of cards)");let a=Array.isArray(s)?s:[s];for(let i of a){if(typeof i.id!="string")return e("each card must have a string `id` field");r.writeCard(i.id,i);}return n({count:a.length})}catch(s){return o(s)}},del(t){try{let s=t.body?.ids??[],a=t.params?.id,i=a?[...s,a]:s;if(i.length===0)return e("del requires body.ids (string[]) or params.id");for(let c of i)r.removeCard(c);return n({count:i.length})}catch(s){return o(s)}},patch(t){try{let s=t.params?.id,a=t.params?.path;if(!s)return e("patch requires params.id");if(!a)return e("patch requires params.path");let i=t.body,c=i&&Object.prototype.hasOwnProperty.call(i,"value")?i.value:t.body;return r.patchCard(s,a,c),n({count:1})}catch(s){return o(s)}}}}function V(r,n){if(process.platform!=="win32"){d.renameSync(r,n);return}let e=[10,20,40,80,160];for(let o=0;o<=e.length;o++)try{d.renameSync(r,n);return}catch(t){let s=t.code;if((s==="EPERM"||s==="EBUSY")&&o<e.length){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,e[o]);continue}throw t}}function G(r){function n(o){return g.join(r,...o.split("/"))+".json"}function e(o,t,s,a){if(d.existsSync(o))for(let i of d.readdirSync(o,{withFileTypes:true})){let c=t?`${t}/${i.name}`:i.name;if(i.isDirectory()){e(g.join(o,i.name),c,s,a);continue}if(!i.isFile()||!i.name.endsWith(".json"))continue;let u=c.replace(/\.json$/,"");(!s||u.startsWith(s))&&a.push(u);}}return {read(o){let t=n(o);if(!d.existsSync(t))return null;try{return JSON.parse(d.readFileSync(t,"utf-8"))}catch{return null}},write(o,t){let s=n(o),a=`${s}.${process.pid}.${randomUUID()}.tmp`;d.mkdirSync(g.dirname(s),{recursive:true}),d.writeFileSync(a,JSON.stringify(t,null,2),"utf-8"),V(a,s);},delete(o){let t=n(o);try{d.existsSync(t)&&d.unlinkSync(t);}catch{}},listKeys(o){let t=[];return e(r,"",o,t),t.sort()}}}function k(r){if(r==null||typeof r!="object")return JSON.stringify(r);if(Array.isArray(r))return `[${r.map(k).join(",")}]`;let n=r;return `{${Object.keys(n).sort().map(o=>`${JSON.stringify(o)}:${k(n[o])}`).join(",")}}`}function U(r){return createHash("sha256").update(k(r)).digest("hex")}function _(r,n){let e={...r};for(let[o,t]of Object.entries(n))t!==null&&typeof t=="object"&&!Array.isArray(t)&&e[o]!==null&&typeof e[o]=="object"&&!Array.isArray(e[o])?e[o]=_(e[o],t):e[o]=t;return e}function T(r,n,e){if(n.length===0)return r;let[o,...t]=n;if(t.length===0)return {...r,[o]:e};let s=r[o]!==null&&typeof r[o]=="object"&&!Array.isArray(r[o])?r[o]:{};return {...r,[o]:T(s,t,e)}}function H(r){let n=G(r);return {read:e=>n.read(e),get(e,o){let t=n.read(e);if(t===null)return null;let s=t;for(let a of o.split(".").filter(Boolean)){if(s===null||typeof s!="object"||Array.isArray(s))return null;s=s[a]??null;}return s??null},write:(e,o)=>n.write(e,o),delete:e=>n.delete(e),listKeys:e=>n.listKeys(e),shallowMerge(e,o){let t=n.read(e)??{};n.write(e,{...t,...o});},deepMerge(e,o){let t=n.read(e)??{};n.write(e,_(t,o));},patch(e,o,t){let s=n.read(e)??{},a=o.split(".").filter(Boolean);n.write(e,T(s,a,t));}}}function j(r){let n=H(r);return {readIndex(){return n.read("_index")},writeIndex(e){n.write("_index",e);},readCard(e){return n.read(e)},writeCard(e,o){return n.write(e,o),U(o)},removeCard(e){n.delete(e);},cardExists(e){return n.read(e)!==null},defaultCardKey(e){return e}}}function w(...r){return g.resolve(...r)}g.join(O.tmpdir(),".board-live-cards-git-bash-cache.json");function x(r,n,e){let o=r.indexOf(n),t=o!==-1?r[o+1]:void 0;if(!t)throw new Error(`Missing ${n}
|
|
2
|
-
Usage: ${e}`);return t}function h(r,n){let e=r.indexOf(n);return e!==-1?r[e+1]:void 0}function z(r,n){return r.includes(n)}async function I(){let r=[];for await(let n of process.stdin)r.push(Buffer.isBuffer(n)?n:Buffer.from(n));return Buffer.concat(r).toString("utf-8")}var F=["card-store \u2014 JSON/YAML read/write for a board card store",""," card-store get --store-ref <ref> [--id <card-id>] [--yaml]"," Print one card (--id) or all cards."," Default: JSON array. --yaml: YAML multi-doc.",""," card-store set --store-ref <ref> [--ref <jsonfile> | --ref-yaml <yamlfile>] [--yaml]"," Write cards into the store."," --ref <file> JSON file (array or single object)"," --ref-yaml <file> YAML multi-doc file"," --yaml treat stdin as YAML (default stdin format is JSON)"," Each card must contain a string `id` field.",""," card-store del --store-ref <ref> --id <card-id> [--id <card-id> ...]"," Delete one or more cards by ID.",""," card-store patch --store-ref <ref> --id <card-id> --path <dot.path> [--value-json <json>]"," Patch one card field by dot-path assignment."," If --value-json is omitted, stdin is parsed as JSON value."].join(`
|
|
3
|
-
`);async function Y(r){let n=r[0],e=r.slice(1);if(!n||n==="help"||n==="--help"||n==="-h"){console.error(F);return}let o=x(e,"--store-ref",`card-store ${n} --store-ref <b64-ref>`),t=R(o),s=E(A(j(t.value),i=>console.error(`[card-store] ${i}`))),a=z(e,"--yaml");if(n==="get"){let i=h(e,"--id"),c=s.get({params:i?{id:i}:{}});c.status!=="success"&&(console.error(`card-store get: ${c.error}`),process.exit(1));let u=c.data.cards;if(u.length===0)return;if(a){let{stringify:l}=await import('yaml');process.stdout.write(u.map(f=>`---
|
|
4
|
-
${l(f)}`).join(""));}else process.stdout.write(JSON.stringify(u,null,2)+`
|
|
5
|
-
`);return}if(n==="set"){let i=h(e,"--ref"),c=h(e,"--ref-yaml"),u;if(c){let{parseAllDocuments:f}=await import('yaml'),p=d.readFileSync(c,"utf-8");u=$(f(p));}else if(i)u=q(d.readFileSync(i,"utf-8"),i);else {let f=await I();if(f.trim()||(console.error("card-store set: no input (provide --ref, --ref-yaml, or pipe to stdin)"),process.exit(1)),a){let{parseAllDocuments:p}=await import('yaml');u=$(p(f));}else u=q(f,"stdin");}let l=s.set({body:u});l.status!=="success"&&(console.error(`card-store set: ${l.error}`),process.exit(1)),console.error(`card-store set: wrote ${l.data.count} card(s)`);return}if(n==="del"){let i=[];for(let u=0;u<e.length;u++)e[u]==="--id"&&e[u+1]&&i.push(e[++u]);let c=s.del({body:{ids:i}});c.status!=="success"&&(console.error(`card-store del: ${c.error}`),process.exit(1)),console.error(`card-store del: removed ${c.data.count} card(s)`);return}if(n==="patch"){let i=x(e,"--id","card-store patch --store-ref <ref> --id <card-id> --path <dot.path> [--value-json <json>]"),c=x(e,"--path","card-store patch --store-ref <ref> --id <card-id> --path <dot.path> [--value-json <json>]"),u=h(e,"--value-json"),l;try{if(typeof u=="string")l=JSON.parse(u);else {let p=await I();p.trim()||(console.error("card-store patch: provide --value-json or JSON value via stdin"),process.exit(1)),l=JSON.parse(p);}}catch(p){console.error(`card-store patch: JSON parse error: ${p.message}`),process.exit(1);}let f=s.patch({params:{id:i,path:c},body:{value:l}});f.status!=="success"&&(console.error(`card-store patch: ${f.error}`),process.exit(1)),console.error("card-store patch: ok");return}console.error(`card-store: unknown command "${n}"
|
|
6
|
-
|
|
7
|
-
${F}`),process.exit(1);}function $(r){return r.map((n,e)=>(n.errors.length>0&&(console.error(`card-store set: YAML parse error in document ${e+1}: ${n.errors[0]}`),process.exit(1)),n.toJS()))}function q(r,n){let e;try{e=JSON.parse(r);}catch(o){console.error(`card-store set: JSON parse error from ${n}: ${o.message}`),process.exit(1);}if(Array.isArray(e))return e;if(e&&typeof e=="object")return [e];console.error(`card-store set: JSON from ${n} must be an object or an array of objects`),process.exit(1);}var X=process.argv[1]&&w(process.argv[1])===w(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/,"$1"));X&&Y(process.argv.slice(2)).catch(r=>{let n=r instanceof Error?r.message:String(r);console.error(n),process.exit(1);});export{Y as cli};//# sourceMappingURL=card-store-cli.js.map
|
|
8
|
-
//# sourceMappingURL=card-store-cli.js.map
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* chat-store-cli.ts — thin arg-parsing CLI for the chat store public API.
|
|
3
|
-
*
|
|
4
|
-
* All logic lives in chat-store-lib-public.ts.
|
|
5
|
-
* This file only: parses argv, reads JSON from stdin or flags, calls the public API, prints JSON.
|
|
6
|
-
*
|
|
7
|
-
* Usage (all commands read a JSON envelope from stdin unless flags override):
|
|
8
|
-
*
|
|
9
|
-
* chat-store append --store-ref <ref> --card-id <id> --role <role> --text <text> [--files-json <json>]
|
|
10
|
-
* chat-store read-all --store-ref <ref> --card-id <id>
|
|
11
|
-
* chat-store read-after --store-ref <ref> --card-id <id> [--cursor <cursor>]
|
|
12
|
-
* chat-store clear --store-ref <ref> --card-id <id>
|
|
13
|
-
* chat-store set-processing --store-ref <ref> --card-id <id> --active <true|false>
|
|
14
|
-
* chat-store is-processing --store-ref <ref> --card-id <id>
|
|
15
|
-
* chat-store get-config --store-ref <ref> --card-id <id>
|
|
16
|
-
* chat-store set-config --store-ref <ref> --card-id <id> [--system-prompt <text>]
|
|
17
|
-
*
|
|
18
|
-
* Alternative: pass --stdin and pipe a JSON object with { storeRef, cardId, ... command fields } to stdin.
|
|
19
|
-
* The `command` field selects the operation when using stdin-only mode.
|
|
20
|
-
*/
|
|
21
|
-
declare function cli(argv: string[]): Promise<void>;
|
|
22
|
-
|
|
23
|
-
export { cli };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import'child_process';import*as d from'fs';import {existsSync}from'fs';import*as T from'os';import*as y from'path';import {dirname,resolve}from'path';import'net';import {fileURLToPath}from'url';import {randomUUID}from'crypto';import {createRequire}from'module';import'proper-lockfile';import'ajv-formats';var b="b64:";function H(t){let n=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),r=globalThis.Buffer;if(r)return r.from(n,"base64").toString("utf8");if(typeof atob=="function"){let s=atob(n),o=new Uint8Array(s.length);for(let c=0;c<s.length;c+=1)o[c]=s.charCodeAt(c);return new TextDecoder().decode(o)}throw new Error("No base64 decoder available in this runtime")}function k(t){if(!t.startsWith(b))throw new Error(`Invalid ref format (expected ${b}<base64url(json)>): ${t}`);let n;try{n=JSON.parse(H(t.slice(b.length)));}catch{throw new Error(`Invalid ref format (malformed base64url/json): ${t}`)}if(!n||typeof n!="object")throw new Error(`Invalid ref format (expected object payload): ${t}`);let r=n;if(typeof r.kind!="string"||typeof r.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${t}`);return {kind:r.kind,value:r.value}}function C(...t){return y.join(...t)}function v(...t){return y.resolve(...t)}y.join(T.tmpdir(),".board-live-cards-git-bash-cache.json");var _=dirname(fileURLToPath(import.meta.url)),Q=createRequire(import.meta.url);function tt(){let t=resolve(_,"./jsonata-sync.cjs");return existsSync(t)?t:resolve(_,"../../card-compute/jsonata-sync.cjs")}Q(tt());createRequire(import.meta.url);function ot(t,n){if(process.platform!=="win32"){d.renameSync(t,n);return}let r=[10,20,40,80,160];for(let s=0;s<=r.length;s++)try{d.renameSync(t,n);return}catch(o){let c=o.code;if((c==="EPERM"||c==="EBUSY")&&s<r.length){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r[s]);continue}throw o}}function F(t){function n(s){return y.join(t,...s.split("/"))+".json"}function r(s,o,c,i){if(d.existsSync(s))for(let e of d.readdirSync(s,{withFileTypes:true})){let a=o?`${o}/${e.name}`:e.name;if(e.isDirectory()){r(y.join(s,e.name),a,c,i);continue}if(!e.isFile()||!e.name.endsWith(".json"))continue;let u=a.replace(/\.json$/,"");(!c||u.startsWith(c))&&i.push(u);}}return {read(s){let o=n(s);if(!d.existsSync(o))return null;try{return JSON.parse(d.readFileSync(o,"utf-8"))}catch{return null}},write(s,o){let c=n(s),i=`${c}.${process.pid}.${randomUUID()}.tmp`;d.mkdirSync(y.dirname(c),{recursive:true}),d.writeFileSync(i,JSON.stringify(o,null,2),"utf-8"),ot(i,c);},delete(s){let o=n(s);try{d.existsSync(o)&&d.unlinkSync(o);}catch{}},listKeys(s){let o=[];return r(t,"",s,o),o.sort()}}}function P(t){function n(){if(!d.existsSync(t))return [];let r=d.readFileSync(t,"utf-8").trim();return r?r.split(`
|
|
2
|
-
`).filter(Boolean).map(s=>JSON.parse(s)):[]}return {append(r){let s={id:randomUUID(),payload:r};return d.mkdirSync(y.dirname(t),{recursive:true}),d.appendFileSync(t,JSON.stringify(s)+`
|
|
3
|
-
`,"utf-8"),s},readAll(){return n()},readAfter(r){let s=n();if(!r)return {entries:s,newCursor:s.length>0?s[s.length-1].id:null};let o=s.findIndex(i=>i.id===r),c=o===-1?s:s.slice(o+1);return {entries:c,newCursor:c.length>0?c[c.length-1].id:r}},clear(){d.existsSync(t)&&d.truncateSync(t,0);}}}var at=createRequire(import.meta.url);at("./jsonata-sync.cjs");function $(t){return String(t).replace(/[^a-zA-Z0-9_-]/g,"_")}function N(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:[],updated_at:typeof n.updated_at=="string"?n.updated_at:""}}function E(t,n){let r=o=>`chats/${$(o)}/processing`,s=o=>`chats/${$(o)}/config`;return {append(o,c,i,e=[]){return t(o).append({role:c,text:i,files:e,updated_at:new Date().toISOString()}).id},readAll(o){return t(o).readAll().map(N)},readAfter(o,c){let i=t(o).readAfter(c);return {records:i.entries.map(N),cursor:i.newCursor}},clear(o){t(o).clear?.();},setProcessing(o,c){c?n.write(r(o),true):n.delete(r(o));},isProcessing(o){return n.read(r(o))===true},getConfig(o){return n.read(s(o))??{}},setConfig(o,c){let i=n.read(s(o))??{};n.write(s(o),{...i,...c});}}}var pt=createRequire(import.meta.url);pt("./jsonata-sync.cjs");function Ct(t,n){if(!t||!n)return false;let r=String(t).replace(/[\\/]+$/,"").split(/[\\/]+/).filter(Boolean);return r.length>0&&r[r.length-1]===n}function G(t,n={}){let r=n.chatsSubdir??"chats",s=n.kvSubdir??".kv",o=s?[s,"chat"]:["chat"],c=r&&!Ct(t,r)?C(t,r):t,i=F(C(t,...o));return E(e=>{let u=`${String(e).replace(/[^a-zA-Z0-9_-]/g,"_")}.jsonl`,l=C(c,u);return P(l)},i)}function J(t){function n(e){return {status:"success",data:e}}function r(e){return {status:"fail",error:e}}function s(e){return {status:"error",error:e instanceof Error?e.message:String(e)}}function o(e,a="command envelope"){let u=typeof e.cardId=="string"?e.cardId:void 0;if(!e.command)return r(`chat-store: ${a} missing "command"`);if(!u)return r(`chat-store: ${a} missing "cardId"`);if(e.command==="append")return i.append({params:{cardId:u},body:{role:e.role,text:e.text,files:e.files}});if(e.command==="read-all")return i.readAll({params:{cardId:u}});if(e.command==="read-after")return i.readAfter({params:{cardId:u},body:{cursor:e.cursor??null}});if(e.command==="clear")return i.clear({params:{cardId:u}});if(e.command==="set-processing")return i.setProcessing({params:{cardId:u},body:{active:e.active}});if(e.command==="is-processing")return i.isProcessing({params:{cardId:u}});if(e.command==="get-config")return i.getConfig({params:{cardId:u}});if(e.command==="set-config"){let{command:l,cardId:S,...g}=e;return i.setConfig({params:{cardId:u},body:g})}return r(`chat-store: unknown command "${String(e.command)}"`)}function c(e){if(!Array.isArray(e.commands)||e.commands.length===0)return r('chat-store: command envelope must include a non-empty "commands" array');let a=[];for(let u=0;u<e.commands.length;u+=1){let l=e.commands[u];if(!l||typeof l!="object"||Array.isArray(l))return r(`chat-store: command envelope entry ${u} must be an object`);let S={cardId:e.cardId,...l},g=o(S,`command envelope entry ${u}`);if(g.status!=="success")return g;a.push({index:u,command:String(S.command),data:g.data});}return n({results:a})}let i={append(e){try{let a=e.params?.cardId;if(!a)return r("append requires params.cardId");let u=e.body??{},l=typeof u.role=="string"?u.role:"",S=typeof u.text=="string"?u.text:"",g=Array.isArray(u.files)?u.files:[];if(!l)return r("append requires body.role");let U=t.append(a,l,S,g);return n({id:U})}catch(a){return s(a)}},readAll(e){try{let a=e.params?.cardId;return a?n({records:t.readAll(a)}):r("readAll requires params.cardId")}catch(a){return s(a)}},readAfter(e){try{let a=e.params?.cardId;if(!a)return r("readAfter requires params.cardId");let l=(e.body??{}).cursor??null;return n(t.readAfter(a,l))}catch(a){return s(a)}},clear(e){try{let a=e.params?.cardId;return a?(t.clear(a),n({ok:!0})):r("clear requires params.cardId")}catch(a){return s(a)}},setProcessing(e){try{let a=e.params?.cardId;if(!a)return r("setProcessing requires params.cardId");let u=e.body??{};return typeof u.active!="boolean"?r("setProcessing requires body.active (boolean)"):(t.setProcessing(a,u.active),n({ok:!0}))}catch(a){return s(a)}},isProcessing(e){try{let a=e.params?.cardId;return a?n({active:t.isProcessing(a)}):r("isProcessing requires params.cardId")}catch(a){return s(a)}},getConfig(e){try{let a=e.params?.cardId;return a?n({config:t.getConfig(a)}):r("getConfig requires params.cardId")}catch(a){return s(a)}},setConfig(e){try{let a=e.params?.cardId;if(!a)return r("setConfig requires params.cardId");let u=e.body??{};return t.setConfig(a,u),n({ok:!0})}catch(a){return s(a)}},run:o,runBatch:c};return i}function f(t,n,r){let s=t.indexOf(n),o=s!==-1?t[s+1]:void 0;if(!o)throw new Error(`Missing ${n}
|
|
4
|
-
Usage: ${r}`);return o}function w(t,n){let r=t.indexOf(n);return r!==-1?t[r+1]:void 0}async function V(){let t=[];for await(let n of process.stdin)t.push(Buffer.isBuffer(n)?n:Buffer.from(n));return Buffer.concat(t).toString("utf-8")}var A=["chat-store \u2014 chat history and state operations for a board card",""," chat-store append --store-ref <ref> --card-id <id> --role <role> --text <text> [--files-json <json>]"," Append a message. Prints { id } on success.",""," chat-store read-all --store-ref <ref> --card-id <id>"," Print all messages as a JSON array.",""," chat-store read-after --store-ref <ref> --card-id <id> [--cursor <cursor>]"," Print messages after cursor as { records, cursor }.",""," chat-store clear --store-ref <ref> --card-id <id>"," Remove all messages for the card.",""," chat-store set-processing --store-ref <ref> --card-id <id> --active <true|false>"," Set or clear the processing flag.",""," chat-store is-processing --store-ref <ref> --card-id <id>"," Print { active: true|false }.",""," chat-store get-config --store-ref <ref> --card-id <id>"," Print the chat config object.",""," chat-store set-config --store-ref <ref> --card-id <id> [--system-prompt <text>]"," Patch the chat config. Extra fields can be piped as JSON to stdin.",""," Alternatively, use --stdin and pipe a JSON object to stdin:",' { "command": "<cmd>", "storeRef": "<ref>", "cardId": "<id>", ... }'," Or pipe a command envelope with defaults plus sequential commands:",' { "storeRef": "<ref>", "cardId": "<id>", "commands": [{ "command": "append", ... }, { "command": "set-processing", ... }] }'].join(`
|
|
5
|
-
`);function K(t){return J(G(k(t).value))}async function wt(t){if(t[0]==="--stdin"){let i=await V();if(!i.trim()){console.error(A);return}let e;try{e=JSON.parse(i);}catch{console.error("chat-store: stdin is not valid JSON"),process.exit(1);}let a=e.storeRef;a||(console.error('chat-store: stdin envelope missing "storeRef"'),process.exit(1));let u=K(a);if(Array.isArray(e.commands)){p(u.runBatch(vt(e)));return}p(u.run(bt(e)));return}let n=t[0],r=t.slice(1);if(!n||n==="help"||n==="--help"||n==="-h"){console.error(A);return}let s=f(r,"--store-ref",`chat-store ${n} --store-ref <b64-ref> --card-id <id>`),o=w(r,"--card-id"),c=K(s);if(n==="append"){let i=f(r,"--role","chat-store append --store-ref <ref> --card-id <id> --role <role> --text <text>"),e=f(r,"--text","chat-store append --store-ref <ref> --card-id <id> --role <role> --text <text>"),a=w(r,"--files-json"),u=a?JSON.parse(a):[],l=o??f(r,"--card-id","chat-store append --store-ref <ref> --card-id <id> --role <role> --text <text>");p(c.append({params:{cardId:l},body:{role:i,text:e,files:u}}));return}if(n==="read-all"){let i=o??f(r,"--card-id","chat-store read-all --store-ref <ref> --card-id <id>");p(c.readAll({params:{cardId:i}}));return}if(n==="read-after"){let i=o??f(r,"--card-id","chat-store read-after --store-ref <ref> --card-id <id>"),e=w(r,"--cursor")??null;p(c.readAfter({params:{cardId:i},body:{cursor:e}}));return}if(n==="clear"){let i=o??f(r,"--card-id","chat-store clear --store-ref <ref> --card-id <id>");p(c.clear({params:{cardId:i}}));return}if(n==="set-processing"){let i=o??f(r,"--card-id","chat-store set-processing --store-ref <ref> --card-id <id> --active <true|false>"),e=f(r,"--active","chat-store set-processing --store-ref <ref> --card-id <id> --active <true|false>");e!=="true"&&e!=="false"&&(console.error('chat-store set-processing: --active must be "true" or "false"'),process.exit(1)),p(c.setProcessing({params:{cardId:i},body:{active:e==="true"}}));return}if(n==="is-processing"){let i=o??f(r,"--card-id","chat-store is-processing --store-ref <ref> --card-id <id>");p(c.isProcessing({params:{cardId:i}}));return}if(n==="get-config"){let i=o??f(r,"--card-id","chat-store get-config --store-ref <ref> --card-id <id>");p(c.getConfig({params:{cardId:i}}));return}if(n==="set-config"){let i=o??f(r,"--card-id","chat-store set-config --store-ref <ref> --card-id <id>"),e=w(r,"--system-prompt"),a={};if(e!==void 0&&(a.systemPrompt=e),!process.stdin.isTTY){let u=await V();if(u.trim())try{Object.assign(a,JSON.parse(u));}catch{}}p(c.setConfig({params:{cardId:i},body:a}));return}console.error(`chat-store: unknown command "${n}"
|
|
6
|
-
${A}`),process.exit(1);}function bt(t){let{storeRef:n,commands:r,...s}=t;return s}function vt(t){let{storeRef:n,commands:r,cardId:s}=t;return {cardId:typeof s=="string"?s:void 0,commands:Array.isArray(r)?r.map(o=>{if(!o||typeof o!="object"||Array.isArray(o))return o;let{storeRef:c,commands:i,...e}=o;return e}):[]}}function p(t){t.status!=="success"&&(console.error(`chat-store: ${t.status}: ${t.error}`),process.exit(1)),t.data!==void 0&&process.stdout.write(JSON.stringify(t.data,null,2)+`
|
|
7
|
-
`);}var xt=process.argv[1]&&v(process.argv[1])===v(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/,"$1"));xt&&wt(process.argv.slice(2)).catch(t=>{console.error("chat-store:",t instanceof Error?t.message:String(t)),process.exit(1);});export{wt as cli};//# sourceMappingURL=chat-store-cli.js.map
|
|
8
|
-
//# sourceMappingURL=chat-store-cli.js.map
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { E as ExecutionRef, A as ArgsMassaging, K as KindValueRef, a as ExecutionResult } from '../execution-interface-DCFBy4L8.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* cli/common/args-massaging — JSONata-based mapping from logical args to
|
|
5
|
-
* transport-specific shape.
|
|
6
|
-
*
|
|
7
|
-
* `argsMassaging` is a property of `ExecutionRef`, so honoring it is the job
|
|
8
|
-
* of every adapter (Node spawn, HTTP, Azure Function, etc.). This helper is
|
|
9
|
-
* the shared pure-JSONata implementation reused by all adapters.
|
|
10
|
-
*
|
|
11
|
-
* Adapters call this as the first step inside their `invokeRefSync` /
|
|
12
|
-
* `dispatchExecution` implementation, then perform their transport using
|
|
13
|
-
* `cmdArgs` / `body` / `url`.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
interface MassagedArgs {
|
|
17
|
-
/** Resolved argv tail for local transports. */
|
|
18
|
-
cmdArgs?: string[];
|
|
19
|
-
/** Resolved stdin payload for local transports. */
|
|
20
|
-
stdin?: unknown;
|
|
21
|
-
/** Resolved final URL string for http transports. */
|
|
22
|
-
url?: string;
|
|
23
|
-
/** Resolved request headers for http transports. */
|
|
24
|
-
headers?: Record<string, string>;
|
|
25
|
-
/** Resolved request body for http transports. */
|
|
26
|
-
body?: unknown;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* execution-adapter.ts
|
|
31
|
-
*
|
|
32
|
-
* Node.js-specific adapter that resolves an ExecutionRef + logical args
|
|
33
|
-
* into a physical invocation (process spawn, HTTP request, or built-in call).
|
|
34
|
-
*
|
|
35
|
-
* This is the platform layer that pairs with execution-interface.ts (pure types).
|
|
36
|
-
* Import this only from Node contexts — not from browser bundles.
|
|
37
|
-
*
|
|
38
|
-
* ────────────────────────────────────────────────────────────────────────────
|
|
39
|
-
* WELL-KNOWN INVOCATION KINDS
|
|
40
|
-
* ────────────────────────────────────────────────────────────────────────────
|
|
41
|
-
*
|
|
42
|
-
* invokeTaskExecutor(ref, args)
|
|
43
|
-
* Standard task-executor protocol.
|
|
44
|
-
* Logical args: { subcommand, inRef, outRef, errRef?, extra? }
|
|
45
|
-
* Default cmdTemplate (local): ['subcommand', '--in-ref', inRef, '--out-ref', outRef, '--err-ref', errRef]
|
|
46
|
-
* Default body (http): { subcommand, inRef, outRef, errRef }
|
|
47
|
-
*
|
|
48
|
-
* invokeBoardCliCallback(ref, args)
|
|
49
|
-
* Back-channel from a task-executor to the board CLI.
|
|
50
|
-
* Logical args: { command, argv[] }
|
|
51
|
-
* Resolves 'built-in' to the board CLI script alongside cliDir.
|
|
52
|
-
*
|
|
53
|
-
* ────────────────────────────────────────────────────────────────────────────
|
|
54
|
-
* BUILT-IN RESOLUTION
|
|
55
|
-
* ────────────────────────────────────────────────────────────────────────────
|
|
56
|
-
*
|
|
57
|
-
* howToRun: 'built-in' with whatToRun: 'b64:<base64url({"kind":"built-in","value":"source-cli-task-executor"})>'
|
|
58
|
-
* → resolves to node <cliDir>/source-cli-task-executor.js
|
|
59
|
-
*
|
|
60
|
-
* howToRun: 'built-in' with whatToRun: 'b64:<base64url({"kind":"built-in","value":"board-live-cards"})>'
|
|
61
|
-
* → resolves to node <cliDir>/board-live-cards-cli.js (via buildBoardCliInvocation)
|
|
62
|
-
*
|
|
63
|
-
* ────────────────────────────────────────────────────────────────────────────
|
|
64
|
-
* argsMassaging EVALUATION
|
|
65
|
-
* ────────────────────────────────────────────────────────────────────────────
|
|
66
|
-
*
|
|
67
|
-
* Each argsMassaging field is a JSONata expression evaluated against the
|
|
68
|
-
* logical args object merged with { whatToRun } (the address from the ref).
|
|
69
|
-
*
|
|
70
|
-
* If argsMassaging is absent, the adapter uses its default mapping.
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
/** Logical args for invokeTaskExecutor — standard task-executor protocol. */
|
|
74
|
-
interface TaskExecutorArgs {
|
|
75
|
-
/** Subcommand to dispatch: 'run-source-fetch' | 'validate-source-def' | 'describe-capabilities' | ... */
|
|
76
|
-
subcommand: string;
|
|
77
|
-
/** Input ref (b64:<base64url(json)> wire form) pointing to the task payload. */
|
|
78
|
-
inRef?: string;
|
|
79
|
-
/** Output ref (b64:<base64url(json)> wire form) where the executor writes its result. */
|
|
80
|
-
outRef?: string;
|
|
81
|
-
/** Error ref (b64:<base64url(json)> wire form) for structured error output. */
|
|
82
|
-
errRef?: string;
|
|
83
|
-
}
|
|
84
|
-
/** Logical args for invokeBoardCliCallback — back-channel from executor to board. */
|
|
85
|
-
interface BoardCliCallbackArgs {
|
|
86
|
-
/** Board CLI subcommand to invoke (e.g. 'source-data-fetched', 'source-data-fetch-failure'). */
|
|
87
|
-
command: string;
|
|
88
|
-
/** Additional argv strings passed after the command. */
|
|
89
|
-
argv: string[];
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Options passed when constructing an execution adapter.
|
|
93
|
-
* Provides the platform-specific context needed for built-in resolution.
|
|
94
|
-
*/
|
|
95
|
-
interface ExecutionAdapterOptions {
|
|
96
|
-
/**
|
|
97
|
-
* Absolute path to the directory containing the compiled CLI files.
|
|
98
|
-
* Required for resolving 'built-in' refs (e.g. source-cli-task-executor.js,
|
|
99
|
-
* board-live-cards-cli.js).
|
|
100
|
-
*/
|
|
101
|
-
cliDir: string;
|
|
102
|
-
}
|
|
103
|
-
declare function resolveYamlFlowCliPath(cliFileName: string): string;
|
|
104
|
-
declare function resolveWhatToRunValue(whatToRun: string | KindValueRef): string;
|
|
105
|
-
/**
|
|
106
|
-
* Resolve an ExecutionRef to its base { command, baseArgs } for local transports.
|
|
107
|
-
*
|
|
108
|
-
* Exported for callers that need to stay synchronous (e.g. validate-source-def,
|
|
109
|
-
* describe-capabilities) and build their own final argv.
|
|
110
|
-
* Does NOT evaluate argsMassaging — append custom argv after baseArgs.
|
|
111
|
-
*
|
|
112
|
-
* @example
|
|
113
|
-
* const { command, baseArgs } = buildLocalBaseSpec(teRef, cliDir);
|
|
114
|
-
* executor.executeSync(command, [...baseArgs, 'describe-capabilities'], { timeout: 10_000 });
|
|
115
|
-
*/
|
|
116
|
-
declare function buildLocalBaseSpec(ref: ExecutionRef, cliDir: string): {
|
|
117
|
-
command: string;
|
|
118
|
-
baseArgs: string[];
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/** Normalized envelope returned by invokeRefSync. */
|
|
122
|
-
interface InvokeRefResult {
|
|
123
|
-
/** Outcome key — drives transitions in the step machine ('success' | 'failure' | custom). */
|
|
124
|
-
result: string;
|
|
125
|
-
/** Response payload as a record (always object-shaped; raw stdout wrapped under `stdout` if not JSON object). */
|
|
126
|
-
data: Record<string, unknown>;
|
|
127
|
-
/** Optional human-readable error detail. */
|
|
128
|
-
error?: string;
|
|
129
|
-
}
|
|
130
|
-
interface InvokeRefSyncOptions {
|
|
131
|
-
/** Directory used to resolve `built-in` refs (defaults to ref's cwd / process cwd). */
|
|
132
|
-
cliDir?: string;
|
|
133
|
-
/** Working directory for the spawned child (default: process cwd). */
|
|
134
|
-
cwd?: string;
|
|
135
|
-
/** Timeout in milliseconds (default: 30_000). */
|
|
136
|
-
timeoutMs?: number;
|
|
137
|
-
/** Label used in error messages (default: 'invokeRefSync'). */
|
|
138
|
-
label?: string;
|
|
139
|
-
}
|
|
140
|
-
interface InvokeExecutionRefOptions extends InvokeRefSyncOptions {
|
|
141
|
-
/** Extra async transport handlers keyed by `ExecutionRef.howToRun`. */
|
|
142
|
-
transports?: Record<string, TransportInvoker>;
|
|
143
|
-
/** Extra synchronous transport handlers keyed by `ExecutionRef.howToRun`. */
|
|
144
|
-
syncTransports?: Record<string, SyncTransportInvoker>;
|
|
145
|
-
}
|
|
146
|
-
type TransportInvoker = (ref: ExecutionRef, args: Record<string, unknown>, options?: InvokeExecutionRefOptions) => Promise<InvokeRefResult>;
|
|
147
|
-
type SyncTransportInvoker = (ref: ExecutionRef, args: Record<string, unknown>, options?: InvokeExecutionRefOptions) => InvokeRefResult;
|
|
148
|
-
interface CreateExecutionRefInvokerOptions extends InvokeExecutionRefOptions {
|
|
149
|
-
}
|
|
150
|
-
interface ExecutionRefInvoker {
|
|
151
|
-
invoke(ref: ExecutionRef, args: Record<string, unknown>): Promise<InvokeRefResult>;
|
|
152
|
-
invokeSync(ref: ExecutionRef, args: Record<string, unknown>): InvokeRefResult;
|
|
153
|
-
}
|
|
154
|
-
declare function evaluateArgsMassaging(argsMassaging: ArgsMassaging | undefined, args: Record<string, unknown>, label?: string): MassagedArgs;
|
|
155
|
-
declare function invokeExecutionRef(ref: ExecutionRef, args: Record<string, unknown>, options?: InvokeExecutionRefOptions): Promise<InvokeRefResult>;
|
|
156
|
-
declare function invokeExecutionRefSync(ref: ExecutionRef, args: Record<string, unknown>, options?: InvokeExecutionRefOptions): InvokeRefResult;
|
|
157
|
-
declare function createExecutionRefInvoker(options?: CreateExecutionRefInvokerOptions): ExecutionRefInvoker;
|
|
158
|
-
/**
|
|
159
|
-
* Invoke an ExecutionRef synchronously with a request/reply contract.
|
|
160
|
-
*
|
|
161
|
-
* Used by:
|
|
162
|
-
* - step-machine ref steps (each step's handler dispatches through here)
|
|
163
|
-
* - any utility that needs sync request/reply against an ExecutionRef
|
|
164
|
-
*
|
|
165
|
-
* Behavior:
|
|
166
|
-
* 1. Resolve `ref.argsMassaging` against `args` to get cmdArgs / stdin / body.
|
|
167
|
-
* 2. Build the local base spec (node/python/process + script path).
|
|
168
|
-
* 3. Spawn synchronously with `JSON.stringify(stdin ?? args)` on stdin.
|
|
169
|
-
* 4. Map exit code into envelope:
|
|
170
|
-
* exit 0 → { result: 'success', data: parsed-stdout-or-{stdout: raw} }
|
|
171
|
-
* non-0 → { result: 'failure', data: { error: stderr-or-exit-detail } }
|
|
172
|
-
*
|
|
173
|
-
* The framework (engine) never inspects payload shape; it only routes on `result`.
|
|
174
|
-
*/
|
|
175
|
-
declare function invokeRefSync(ref: ExecutionRef, args: Record<string, unknown>, options?: InvokeRefSyncOptions): InvokeRefResult;
|
|
176
|
-
interface ExecutionAdapter {
|
|
177
|
-
/**
|
|
178
|
-
* Invoke a task-executor using the standard protocol.
|
|
179
|
-
* Dispatches based on howToRun; applies argsMassaging if present, otherwise
|
|
180
|
-
* uses the default task-executor protocol (--in-ref / --out-ref / --err-ref).
|
|
181
|
-
*/
|
|
182
|
-
invokeTaskExecutor(ref: ExecutionRef, args: TaskExecutorArgs): Promise<ExecutionResult>;
|
|
183
|
-
/**
|
|
184
|
-
* Invoke the board CLI as a back-channel callback.
|
|
185
|
-
* Used by task-executors to report source-data-fetched / source-data-fetch-failure.
|
|
186
|
-
* Resolves 'built-in::board-live-cards' to the board CLI script alongside cliDir.
|
|
187
|
-
*/
|
|
188
|
-
invokeBoardCliCallback(ref: ExecutionRef, args: BoardCliCallbackArgs): ExecutionResult;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Create an ExecutionAdapter bound to a specific cliDir.
|
|
192
|
-
*
|
|
193
|
-
* @param options.cliDir Absolute path to the compiled CLI directory.
|
|
194
|
-
* Used to resolve 'built-in' refs.
|
|
195
|
-
*/
|
|
196
|
-
declare function createExecutionAdapter(options: ExecutionAdapterOptions): ExecutionAdapter;
|
|
197
|
-
/**
|
|
198
|
-
* Create an ExecutionRef for the built-in source-cli task executor.
|
|
199
|
-
* Resolves to node <cliDir>/source-cli-task-executor.js at runtime.
|
|
200
|
-
*/
|
|
201
|
-
declare function builtInSourceCliExecutorRef(): ExecutionRef;
|
|
202
|
-
/**
|
|
203
|
-
* Create an ExecutionRef for the board CLI callback back-channel.
|
|
204
|
-
* Resolves to node <cliDir>/board-live-cards-cli.js at runtime.
|
|
205
|
-
*/
|
|
206
|
-
declare function builtInBoardCliRef(): ExecutionRef;
|
|
207
|
-
/**
|
|
208
|
-
* Create an ExecutionRef for a local Node.js task executor script.
|
|
209
|
-
*
|
|
210
|
-
* @param scriptPath Absolute path to the executor .js file.
|
|
211
|
-
*/
|
|
212
|
-
declare function localNodeExecutorRef(scriptPath: string): ExecutionRef;
|
|
213
|
-
/**
|
|
214
|
-
* Dispatch a task-executor invocation as a detached background process.
|
|
215
|
-
* Used by the board source-fetch dispatcher — fire-and-forget.
|
|
216
|
-
*
|
|
217
|
-
* For http transports, falls back to synchronous fetch (not truly detached).
|
|
218
|
-
*/
|
|
219
|
-
declare function dispatchTaskExecutorDetached(ref: ExecutionRef, args: TaskExecutorArgs, cliDir: string): void;
|
|
220
|
-
|
|
221
|
-
export { type BoardCliCallbackArgs, type CreateExecutionRefInvokerOptions, type ExecutionAdapter, type ExecutionAdapterOptions, type ExecutionRefInvoker, type InvokeExecutionRefOptions, type InvokeRefResult, type InvokeRefSyncOptions, type SyncTransportInvoker, type TaskExecutorArgs, type TransportInvoker, buildLocalBaseSpec, builtInBoardCliRef, builtInSourceCliExecutorRef, createExecutionAdapter, createExecutionRefInvoker, dispatchTaskExecutorDetached, evaluateArgsMassaging, invokeExecutionRef, invokeExecutionRefSync, invokeRefSync, localNodeExecutorRef, resolveWhatToRunValue, resolveYamlFlowCliPath };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import*as k from'fs';import {existsSync}from'fs';import*as p from'path';import {dirname,resolve}from'path';import {createRequire}from'module';import {spawnSync,execFileSync,spawn,execFile}from'child_process';import {fileURLToPath}from'url';import*as _ from'os';import'net';import'crypto';var C=dirname(fileURLToPath(import.meta.url)),tt=createRequire(import.meta.url);function et(){let t=resolve(C,"./jsonata-sync.cjs");return existsSync(t)?t:resolve(C,"../../card-compute/jsonata-sync.cjs")}var m=tt(et());var E="b64:";function nt(t){let e=new TextEncoder().encode(t),n=globalThis.Buffer,o;if(n)o=n.from(e).toString("base64");else if(typeof btoa=="function"){let r="";for(let s of e)r+=String.fromCharCode(s);o=btoa(r);}else throw new Error("No base64 encoder available in this runtime");return o.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function rt(t){let e=t.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-t.length%4)%4),n=globalThis.Buffer;if(n)return n.from(e,"base64").toString("utf8");if(typeof atob=="function"){let o=atob(e),r=new Uint8Array(o.length);for(let s=0;s<o.length;s+=1)r[s]=o.charCodeAt(s);return new TextDecoder().decode(r)}throw new Error("No base64 decoder available in this runtime")}function w(t){return `${E}${nt(JSON.stringify(t))}`}function O(t){if(!t.startsWith(E))throw new Error(`Invalid ref format (expected ${E}<base64url(json)>): ${t}`);let e;try{e=JSON.parse(rt(t.slice(E.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 n=e;if(typeof n.kind!="string"||typeof n.value!="string")throw new Error(`Invalid ref format (payload must contain string kind/value): ${t}`);return {kind:n.kind,value:n.value}}function at(t){if(typeof t=="object"&&t!==null){let{command:n,args:o=[],...r}=t,s=J(n,o);return {...r,command:s.command,args:s.args}}let e=M(t);if(e.length===0)throw new Error(`Empty command spec: ${JSON.stringify(t)}`);return J(e[0],e.slice(1))}function J(t,e){return /^(node|node\.exe)$/i.test(t)?{command:process.execPath,args:e}:/\.m?js$/i.test(t)?{command:process.execPath,args:[t,...e]}:{command:t,args:e}}function M(t){let e=[],n="",o=null;for(let r of t.trim()){if(o){r===o?o=null:n+=r;continue}if(r==='"'||r==="'"){o=r;continue}if(/\s/.test(r)){n&&(e.push(n),n="");continue}n+=r;}if(o)throw new Error(`Unterminated quote in command: ${t}`);return n&&e.push(n),e}function S(t){return process.platform==="win32"&&/\.(cmd|bat)$/i.test(t)}function T(t,e){let{command:n,args:o=[],cwd:r,env:s,timeoutMs:i}=t;return execFileSync(n,o,{shell:S(n),timeout:i,encoding:e?.encoding??"utf-8",cwd:r,windowsHide:true,env:s?{...process.env,...s}:void 0,input:e?.input})}function ct(t,e){let{command:n,args:o=[],cwd:r,env:s,timeoutMs:i=3e4}=t;execFile(n,o,{shell:S(n),encoding:"utf8",windowsHide:true,timeout:i,maxBuffer:10*1024*1024,cwd:r,env:s?{...process.env,...s}:void 0},(c,u,a)=>e(c??null,u,a));}p.join(_.tmpdir(),".board-live-cards-git-bash-cache.json");function A(t){let{command:e,args:n=[]}=t;if(process.platform==="win32"){spawn(e,n,{detached:true,stdio:"ignore",windowsHide:true,shell:S(e)}).unref();return}spawn(e,n,{detached:true,stdio:"ignore"}).unref();}function j(t,e,n){let o=p.join(t,"board-live-cards-cli.js");if(k.existsSync(o))return {cmd:process.execPath,args:[o,e,...n]};let r=p.join(t,"board-live-cards-cli.ts"),i=[p.join(t,"..","..","..","node_modules","tsx","dist","cli.mjs"),p.join(t,"..","..","node_modules","tsx","dist","cli.mjs"),p.join(t,"..","..","..","node_modules",".bin","tsx"),p.join(t,"..","..","node_modules",".bin","tsx")].find(u=>k.existsSync(u));return k.existsSync(r)&&k.existsSync(i)?{cmd:process.execPath,args:[i,r,e,...n]}:{cmd:process.platform==="win32"?"npx.cmd":"npx",args:["tsx",r,e,...n]}}function H(){return {executeSync(t,e,n){return T({command:t,args:e,cwd:n?.cwd,timeoutMs:n?.timeout,env:n?.env},{encoding:n?.encoding,input:n?.input})},executeAsync(t,e,n){ct({command:t,args:e},n);},resolveInvocation(t,e){let n=at({command:t,args:e});return {cmd:n.command,args:n.args??[]}},splitCommand:M,spawnDetached(t,e){A({command:t,args:e});}}}function v(t){t.registerFunction("fsPathRef",e=>w({kind:"fs-path",value:String(e)}),"<s:s>");}function $(t,e,n){if(!t||typeof t!="object")return {};let o={};if(Array.isArray(t.cmdTemplate)){let r=[];for(let s of t.cmdTemplate)try{let i=m(s);v(i),r.push(String(i.evaluate(e)));}catch(i){let c=i instanceof Error?i.message:String(i);throw new Error(`[${n}] argsMassaging.cmdTemplate failed on "${s}": ${c}`)}o.cmdArgs=r;}if(typeof t.stdinTemplate=="string")try{let r=m(t.stdinTemplate);v(r),o.stdin=r.evaluate(e);}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`[${n}] argsMassaging.stdinTemplate failed: ${s}`)}if(typeof t.urlTemplate=="string")try{let r=m(t.urlTemplate);v(r),o.url=String(r.evaluate(e));}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`[${n}] argsMassaging.urlTemplate failed: ${s}`)}if(typeof t.headerTemplate=="string")try{let r=m(t.headerTemplate);v(r);let s=r.evaluate(e);if(typeof s!="object"||s===null)throw new Error(`headerTemplate must produce an object, got: ${JSON.stringify(s)}`);o.headers=s;}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`[${n}] argsMassaging.headerTemplate failed: ${s}`)}if(typeof t.bodyTemplate=="string")try{let r=m(t.bodyTemplate);v(r),o.body=r.evaluate(e);}catch(r){let s=r instanceof Error?r.message:String(r);throw new Error(`[${n}] argsMassaging.bodyTemplate failed: ${s}`)}return o}var dt=createRequire(import.meta.url);function lt(t){return typeof t=="object"?t:O(t)}function ft(t){let e=p.basename(String(t||"").trim());if(!e)throw new Error(`resolveYamlFlowCliPath: expected non-empty cli file name, got ${JSON.stringify(t)}`);let n=p.dirname(dt.resolve("yaml-flow/package.json")),o=p.join(n,"cli","node",e);if(!k.existsSync(o))throw new Error(`resolveYamlFlowCliPath: could not find ${e} under ${p.join(n,"cli","node")}`);return o}function y(t){let e=lt(t);return e.kind==="yaml-flow-cli"?ft(e.value):e.value}async function gt(t,e){return m(t).evaluate(e)}async function pt(t,e){let n=await gt(t,e);if(typeof n!="string")throw new Error(`argsMassaging expression did not produce a string: ${t} \u2192 ${JSON.stringify(n)}`);return n}function mt(t,e){let n=y(t);switch(n){case "source-cli-task-executor":{let o=p.join(e,"source-cli-task-executor.js");if(k.existsSync(o))return {command:process.execPath,args:[o]};let r=p.join(e,"source-cli-task-executor.ts"),s=p.join(e,"..","..","node_modules","tsx","dist","cli.mjs"),i=p.join(e,"..","..","node_modules",".bin","tsx"),c=k.existsSync(s)?s:i;return k.existsSync(r)&&k.existsSync(c)?{command:process.execPath,args:[c,r]}:{command:process.execPath,args:[o]}}case "board-live-cards":{let{cmd:o,args:r}=j(e,"_",[]);return {command:o,args:r}}default:throw new Error(`resolveBuiltIn: unknown built-in name "${n}". Supported: source-cli-task-executor, board-live-cards`)}}function b(t,e){if(t.howToRun==="built-in"){let{command:o,args:r}=mt(t.whatToRun,e);return {command:o,baseArgs:r}}let n=(typeof t.whatToRun=="object",y(t.whatToRun));switch(t.howToRun){case "local-node":return {command:process.execPath,baseArgs:[n]};case "local-python":return {command:process.platform==="win32"?"python":"python3",baseArgs:[n]};case "local-process":return {command:n,baseArgs:[]};default:throw new Error(`resolveBaseInvocation: howToRun "${t.howToRun}" is not a local transport`)}}function F(t,e){let n=[t.subcommand];return t.inRef&&n.push("--in-ref",t.inRef),t.outRef&&n.push("--out-ref",t.outRef),t.errRef&&n.push("--err-ref",t.errRef),e&&n.push("--extra",Buffer.from(JSON.stringify(e)).toString("base64")),n}function ht(t,e){return {subcommand:t.subcommand,...t.inRef?{inRef:t.inRef}:{},...t.outRef?{outRef:t.outRef}:{},...t.errRef?{errRef:t.errRef}:{},...e?{extra:e}:{}}}function xt(t,e){return b(t,e)}function q(t){let e=t.trim();if(!e)throw new Error("empty stdout");try{return JSON.parse(e)}catch{let n=e.split(/\r?\n/).filter(Boolean),o=n[n.length-1];return JSON.parse(o)}}function K(t,e){return {...e,whatToRun:y(t.whatToRun),...t.extra?{extra:t.extra}:{}}}function U(t,e,n="invokeExecutionRef"){return $(t,e,n)}function G(t){return t&&typeof t=="object"&&!Array.isArray(t)&&typeof t.result=="string"&&t.data&&typeof t.data=="object"&&!Array.isArray(t.data)?t:{result:"success",data:t&&typeof t=="object"&&!Array.isArray(t)?t:{stdout:t}}}function R(t){return {result:"failure",data:{error:t}}}function x(t,e,n){let o=n?.label??"invokeExecutionRefSync",r=n?.cliDir??n?.cwd??process.cwd(),s;try{s=U(t.argsMassaging,K(t,e),o);}catch(d){let f=d instanceof Error?d.message:String(d);return R(f)}let i;try{i=xt(t,r);}catch(d){let f=d instanceof Error?d.message:String(d);return R(`[${o}] ref resolution failed: ${f}`)}let c=[...i.baseArgs,...s.cmdArgs??[]],u=JSON.stringify(s.stdin??e),a=H(),l;try{l=a.executeSync(i.command,c,{timeout:n?.timeoutMs??3e4,encoding:"utf-8",cwd:n?.cwd,input:u});}catch(d){let f=d,D=(f.stderr?String(f.stderr):"").trim(),W=typeof f.status=="number"?f.status:"unknown",P=D||f.message;return R(`[${o}] ref exited with status ${W}${P?`: ${P}`:""}`)}try{return G(q(l))}catch{return {result:"success",data:{stdout:l.trim()}}}}async function L(t,e,n){let o=n?.label??"invokeExecutionRef",r;try{r=U(t.argsMassaging,K(t,e),o);}catch(a){let l=a instanceof Error?a.message:String(a);return R(l)}let s=y(t.whatToRun),i=r.headers?{"Content-Type":"application/json",...r.headers}:{"Content-Type":"application/json"},c=r.url??s,u;if(t.howToRun==="http:get"){let a=r.body&&typeof r.body=="object"&&!Array.isArray(r.body)?r.body:e,l=new URLSearchParams(Object.entries(a).filter(([,d])=>d!=null).map(([d,f])=>[d,String(f)]));l.size>0&&(c=`${c}${c.includes("?")?"&":"?"}${l.toString()}`);}else u=JSON.stringify(r.body??e);try{let a=await fetch(c,{method:t.howToRun==="http:get"?"GET":"POST",headers:i,body:u});if(!a.ok){let d=await a.text().catch(()=>"");return R(`[${o}] HTTP ${a.status}${d?`: ${d}`:""}`)}let l=await a.text();if(!l.trim())return {result:"success",data:{}};try{return G(q(l))}catch{return {result:"success",data:{stdout:l.trim()}}}}catch(a){let l=a instanceof Error?a.message:String(a);return R(`[${o}] ${l}`)}}var Rt={"local-node":async(t,e,n)=>x(t,e,n),"local-python":async(t,e,n)=>x(t,e,n),"local-process":async(t,e,n)=>x(t,e,n),"built-in":async(t,e,n)=>x(t,e,n),"http:post":L,"http:get":L},yt={"local-node":x,"local-python":x,"local-process":x,"built-in":x};async function wt(t,e,n){let o=n?.transports?.[t.howToRun]??Rt[t.howToRun];return o?o(t,e,n):R(`[${n?.label??"invokeExecutionRef"}] unsupported howToRun: ${t.howToRun}`)}function V(t,e,n){let o=n?.syncTransports?.[t.howToRun]??yt[t.howToRun];return o?o(t,e,n):R(`[${n?.label??"invokeExecutionRefSync"}] unsupported sync howToRun: ${t.howToRun}`)}function Vt(t){return {invoke(e,n){return wt(e,n,t)},invokeSync(e,n){return V(e,n,t)}}}function zt(t,e,n){return V(t,e,n)}function Dt(t){let{cliDir:e}=t;return {async invokeTaskExecutor(n,o){if(n.howToRun==="http:post"||n.howToRun==="http:get")return z(n,o);let{command:s,baseArgs:i}=b(n,e),c;if(n.argsMassaging?.cmdTemplate){let a={...o,whatToRun:y(n.whatToRun)};c=await Promise.all(n.argsMassaging.cmdTemplate.map(d=>pt(d,a)));}else c=F(o,n.extra);let u=[...i,...c];try{return T({command:s,args:u}),{status:"success"}}catch(a){return {status:"error",error:a instanceof Error?a.message:String(a)}}},invokeBoardCliCallback(n,o){let r,s;if(n.howToRun==="built-in"){let c=j(e,o.command,o.argv),u=spawnSync(c.cmd,c.args,{encoding:"utf-8",windowsHide:true});return u.status!==0?{status:"error",error:`board CLI exited ${u.status}: ${u.stderr?.trim()}`}:{status:"success"}}({command:r,baseArgs:s}=b(n,e));let i=spawnSync(r,[...s,o.command,...o.argv],{encoding:"utf-8",windowsHide:true});return i.status!==0?{status:"error",error:`board CLI exited ${i.status}: ${i.stderr?.trim()}`}:{status:"success"}}}}async function z(t,e){let n={...e,whatToRun:y(t.whatToRun)},o=$(t.argsMassaging,n,"_invokeTaskExecutorHttp"),r=o.url??y(t.whatToRun),s=o.body?o.body:ht(e,t.extra),i={"Content-Type":"application/json"},c=o.headers?{...i,...o.headers}:i,u=await fetch(r,{method:t.howToRun==="http:get"?"GET":"POST",headers:c,body:JSON.stringify(s)});if(!u.ok){let l=await u.text().catch(()=>"");return {status:"error",error:`HTTP ${u.status}: ${l}`}}let a=await u.json().catch(()=>null);return a&&typeof a.status=="string"?a:{status:"success"}}function Wt(){return {meta:"task-executor",howToRun:"built-in",whatToRun:w({kind:"built-in",value:"source-cli-task-executor"})}}function Xt(){return {meta:"board-live-cards",howToRun:"built-in",whatToRun:w({kind:"built-in",value:"board-live-cards"})}}function Yt(t){return {meta:"task-executor",howToRun:"local-node",whatToRun:w({kind:"fs-path",value:t})}}function Qt(t,e,n){if(t.howToRun==="http:post"||t.howToRun==="http:get"){z(t,e).catch(c=>{console.error(`[dispatchTaskExecutorDetached] HTTP dispatch failed: ${c.message}`);});return}let{command:r,baseArgs:s}=b(t,n),i=F(e,t.extra);A({command:r,args:[...s,...i]});}
|
|
2
|
-
export{xt as buildLocalBaseSpec,Xt as builtInBoardCliRef,Wt as builtInSourceCliExecutorRef,Dt as createExecutionAdapter,Vt as createExecutionRefInvoker,Qt as dispatchTaskExecutorDetached,U as evaluateArgsMassaging,wt as invokeExecutionRef,V as invokeExecutionRefSync,zt as invokeRefSync,Yt as localNodeExecutorRef,y as resolveWhatToRunValue,ft as resolveYamlFlowCliPath};//# sourceMappingURL=execution-adapter.js.map
|
|
3
|
-
//# sourceMappingURL=execution-adapter.js.map
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { B as BlobStorage, K as KindValueRef } from '../execution-interface-DCFBy4L8.js';
|
|
2
|
-
export { E as ExecutionRef, e as executionRefFromScriptPath, p as parseExecutionRef, f as parseRef, s as serializeExecutionRef, g as serializeRef } from '../execution-interface-DCFBy4L8.js';
|
|
3
|
-
import { a as CommandInput, b as CommandResult, C as ChatStorage, c as BoardNonCorePlatformAdapter, B as BoardPlatformAdapter, I as InvocationAdapter } from '../types-BbQ75HLf.js';
|
|
4
|
-
export { d as BoardLiveCardsNonCorePublic, e as BoardLiveCardsPublic, f as ChatConfig, g as ChatRecord, D as DescribeEnvelope, h as createBoardLiveCardsNonCorePublic, i as createBoardLiveCardsPublic, j as createChatStorage, k as createInMemoryChatStorage } from '../types-BbQ75HLf.js';
|
|
5
|
-
import { C as CardAdminStore, L as LiveCard } from '../board-live-cards-lib-COi4bSpk.js';
|
|
6
|
-
export { a as BOARD_GRAPH_KEY, E as EMPTY_CONFIG, S as SNAPSHOT_SCHEMA_VERSION_V1, c as createCardStore } from '../board-live-cards-lib-COi4bSpk.js';
|
|
7
|
-
export { CreateExecutionRefInvokerOptions, ExecutionRefInvoker, InvokeExecutionRefOptions, InvokeRefResult, SyncTransportInvoker, TransportInvoker, buildLocalBaseSpec, createExecutionRefInvoker, evaluateArgsMassaging, invokeExecutionRef, invokeExecutionRefSync, invokeRefSync, resolveWhatToRunValue, resolveYamlFlowCliPath } from './execution-adapter.js';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* artifacts-store-lib.ts
|
|
11
|
-
*
|
|
12
|
-
* Backend-neutral artifact store built on BlobStorage.
|
|
13
|
-
* Supports text + binary content, CRUD, listing, and lightweight metadata.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
interface ArtifactInfo {
|
|
17
|
-
key: string;
|
|
18
|
-
size?: number;
|
|
19
|
-
updatedAt?: string;
|
|
20
|
-
contentType?: string;
|
|
21
|
-
}
|
|
22
|
-
interface ArtifactsStore {
|
|
23
|
-
exists(key: string): boolean;
|
|
24
|
-
putText(key: string, content: string, contentType?: string): ArtifactInfo;
|
|
25
|
-
putBytes(key: string, content: Uint8Array, contentType?: string): ArtifactInfo;
|
|
26
|
-
getText(key: string): string | null;
|
|
27
|
-
getBytes(key: string): Uint8Array | null;
|
|
28
|
-
head(key: string): ArtifactInfo | null;
|
|
29
|
-
list(prefix?: string): ArtifactInfo[];
|
|
30
|
-
remove(key: string): void;
|
|
31
|
-
}
|
|
32
|
-
interface FileArtifactsStore {
|
|
33
|
-
nextSerial(cardPrefix: string, seedNames?: string[]): number;
|
|
34
|
-
buildStoredName(displayName: string, serial: number, opts?: {
|
|
35
|
-
maxLen?: number;
|
|
36
|
-
}): string;
|
|
37
|
-
allocateStoredName(cardPrefix: string, displayName: string, opts?: {
|
|
38
|
-
seedNames?: string[];
|
|
39
|
-
maxLen?: number;
|
|
40
|
-
}): string;
|
|
41
|
-
}
|
|
42
|
-
interface CardFileMetadata {
|
|
43
|
-
name: string;
|
|
44
|
-
stored_name: string;
|
|
45
|
-
size: number | null;
|
|
46
|
-
mime_type: string | null;
|
|
47
|
-
uploaded_at: string | null;
|
|
48
|
-
chat: boolean;
|
|
49
|
-
}
|
|
50
|
-
type CardFileLookupResult = {
|
|
51
|
-
ok: true;
|
|
52
|
-
file: CardFileMetadata;
|
|
53
|
-
} | {
|
|
54
|
-
ok: false;
|
|
55
|
-
reason: 'index_out_of_range' | 'missing_stored_name' | 'stale_reference';
|
|
56
|
-
};
|
|
57
|
-
interface CardFileMetadataStore {
|
|
58
|
-
read(cardData: unknown): CardFileMetadata[];
|
|
59
|
-
normalizeIncoming(payloadFiles: unknown, defaultUploadedAt?: string): CardFileMetadata[];
|
|
60
|
-
merge(cardData: Record<string, unknown>, incoming: CardFileMetadata[]): CardFileMetadata[];
|
|
61
|
-
resolve(cardData: unknown, index: number, expectedStoredName?: string | null): CardFileLookupResult;
|
|
62
|
-
}
|
|
63
|
-
declare function createArtifactsStore(blob: BlobStorage): ArtifactsStore;
|
|
64
|
-
declare function createFileArtifactsStore(store: ArtifactsStore): FileArtifactsStore;
|
|
65
|
-
declare function createCardFileMetadataStore(): CardFileMetadataStore;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* card-store-lib-public.ts
|
|
69
|
-
*
|
|
70
|
-
* Platform-free public API for card store read/write operations.
|
|
71
|
-
*
|
|
72
|
-
* Follows the same CommandInput / CommandResult convention as
|
|
73
|
-
* board-live-cards-public.ts. No platform code here — inject a
|
|
74
|
-
* CardAdminStore built from your platform adapter.
|
|
75
|
-
*
|
|
76
|
-
* Usage:
|
|
77
|
-
* import { createCardStorePublic } from './card-store-lib-public.js';
|
|
78
|
-
* import { createCardStore } from './board-live-cards-lib.js';
|
|
79
|
-
* import { createFsCardStorageAdapter } from '../node/storage-fs-adapters.js';
|
|
80
|
-
*
|
|
81
|
-
* const store = createCardStorePublic(
|
|
82
|
-
* createCardStore(createFsCardStorageAdapter(dir))
|
|
83
|
-
* );
|
|
84
|
-
* const result = store.set({ body: card }); // write one card
|
|
85
|
-
* const result = store.set({ body: [c1, c2] }); // write many
|
|
86
|
-
* const result = store.get({ params: { id: 'x' } });
|
|
87
|
-
* const result = store.del({ body: { ids: ['x', 'y'] } });
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
interface CardStorePublic {
|
|
91
|
-
/** Read one card (params.id) or all cards. */
|
|
92
|
-
get(input: CommandInput): CommandResult<{
|
|
93
|
-
cards: LiveCard[];
|
|
94
|
-
}>;
|
|
95
|
-
/**
|
|
96
|
-
* Write cards into the store.
|
|
97
|
-
* body: single card object { id, ... } or an array of card objects.
|
|
98
|
-
*/
|
|
99
|
-
set(input: CommandInput): CommandResult<{
|
|
100
|
-
count: number;
|
|
101
|
-
}>;
|
|
102
|
-
/**
|
|
103
|
-
* Delete cards by ID.
|
|
104
|
-
* body.ids: string[] — delete several cards at once
|
|
105
|
-
* params.id: string — delete a single card (alternative, can combine with body.ids)
|
|
106
|
-
*/
|
|
107
|
-
del(input: CommandInput): CommandResult<{
|
|
108
|
-
count: number;
|
|
109
|
-
}>;
|
|
110
|
-
/**
|
|
111
|
-
* Patch one card using dot-path assignment.
|
|
112
|
-
* params.id: string
|
|
113
|
-
* params.path: dot path (e.g. "card_data.form.name")
|
|
114
|
-
* body.value: value to assign (or body itself if value is omitted)
|
|
115
|
-
*/
|
|
116
|
-
patch(input: CommandInput): CommandResult<{
|
|
117
|
-
count: number;
|
|
118
|
-
}>;
|
|
119
|
-
}
|
|
120
|
-
declare function createCardStorePublic(store: CardAdminStore): CardStorePublic;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* artifacts-store-lib-public.ts
|
|
124
|
-
*
|
|
125
|
-
* Public API wrapper for ArtifactsStore, following CommandInput/CommandResult.
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
interface ArtifactsStorePublic {
|
|
129
|
-
list(input: CommandInput): CommandResult<{
|
|
130
|
-
artifacts: ArtifactInfo[];
|
|
131
|
-
}>;
|
|
132
|
-
head(input: CommandInput): CommandResult<{
|
|
133
|
-
artifact: ArtifactInfo | null;
|
|
134
|
-
}>;
|
|
135
|
-
put(input: CommandInput): CommandResult<{
|
|
136
|
-
artifact: ArtifactInfo;
|
|
137
|
-
}>;
|
|
138
|
-
get(input: CommandInput): CommandResult<{
|
|
139
|
-
key: string;
|
|
140
|
-
contentType?: string;
|
|
141
|
-
size?: number;
|
|
142
|
-
text?: string;
|
|
143
|
-
bytes?: number[];
|
|
144
|
-
}>;
|
|
145
|
-
del(input: CommandInput): CommandResult<{
|
|
146
|
-
ok: true;
|
|
147
|
-
}>;
|
|
148
|
-
}
|
|
149
|
-
declare function createArtifactsStorePublic(store: ArtifactsStore): ArtifactsStorePublic;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Creates an InvocationAdapter backed by Node.js `spawn`/`spawnSync`.
|
|
153
|
-
*
|
|
154
|
-
* Supports howToRun: 'local-node'
|
|
155
|
-
* → spawns the script as a detached Node.js child process (fire-and-forget).
|
|
156
|
-
*
|
|
157
|
-
* Pass to createSingleBoardServerRuntime / createMultiBoardServerRuntime as
|
|
158
|
-
* the `invocationAdapter` option. This is the reference Node.js implementation;
|
|
159
|
-
* replace with your own for Azure Functions, Lambda, etc.
|
|
160
|
-
*/
|
|
161
|
-
declare function createNodeSpawnInvocationAdapter(): InvocationAdapter;
|
|
162
|
-
type FsBoardAdapterOpts = {
|
|
163
|
-
onWarn?: (msg: string) => void;
|
|
164
|
-
suppressSpawn?: boolean;
|
|
165
|
-
notifyChannel?: string;
|
|
166
|
-
};
|
|
167
|
-
type FsBoardNonCoreAdapterOpts = {
|
|
168
|
-
onWarn?: (msg: string) => void;
|
|
169
|
-
};
|
|
170
|
-
declare function createFsBoardPlatformAdapter(baseRef: KindValueRef, cliDirOrOpts?: string | FsBoardAdapterOpts, maybeOpts?: FsBoardAdapterOpts): BoardPlatformAdapter;
|
|
171
|
-
declare function createFsBoardNonCorePlatformAdapter(baseRef: KindValueRef, cliDirOrOpts?: string | FsBoardNonCoreAdapterOpts, maybeOpts?: FsBoardNonCoreAdapterOpts): BoardNonCorePlatformAdapter;
|
|
172
|
-
interface FsBoardChatStorageOptions {
|
|
173
|
-
/** Subdirectory under boardDir for per-card jsonl files. Default: 'chats'. Pass '' to write directly under boardDir. */
|
|
174
|
-
chatsSubdir?: string;
|
|
175
|
-
/** Subdirectory under boardDir for chat KV (processing flags + config). Default: '.kv'. Pass '' to root at boardDir. */
|
|
176
|
-
kvSubdir?: string;
|
|
177
|
-
}
|
|
178
|
-
declare function createFsBoardChatStorage(boardDir: string, opts?: FsBoardChatStorageOptions): ChatStorage;
|
|
179
|
-
interface FsBoardFileArtifactsStoreOptions {
|
|
180
|
-
/** Subdirectory under baseDir for file uploads. Default: 'files'. Pass '' to root at baseDir. */
|
|
181
|
-
filesSubdir?: string;
|
|
182
|
-
}
|
|
183
|
-
declare function createFsBoardFileArtifactsStore(baseDir: string, opts?: FsBoardFileArtifactsStoreOptions): ArtifactsStore;
|
|
184
|
-
/**
|
|
185
|
-
* Extract the serialized board ref from a source token (which has a `br` field).
|
|
186
|
-
* Returns null for callback tokens (which don't carry a board ref).
|
|
187
|
-
*/
|
|
188
|
-
declare function decodeBoardRefFromToken(token: string): string | null;
|
|
189
|
-
|
|
190
|
-
export { BoardNonCorePlatformAdapter, BoardPlatformAdapter, ChatStorage, CommandInput, CommandResult, type FsBoardChatStorageOptions, type FsBoardFileArtifactsStoreOptions, InvocationAdapter, KindValueRef, LiveCard, createArtifactsStore, createArtifactsStorePublic, createCardFileMetadataStore, createCardStorePublic, createFileArtifactsStore, createFsBoardChatStorage, createFsBoardFileArtifactsStore, createFsBoardNonCorePlatformAdapter, createFsBoardPlatformAdapter, createNodeSpawnInvocationAdapter, decodeBoardRefFromToken };
|