yaml-flow 8.4.10 → 8.4.12
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 +1 -1
- 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 +7 -7
- package/lib/board-live-cards-node.js +7 -7
- package/lib/board-worker-adapter.cjs +2 -2
- package/lib/board-worker-adapter.js +2 -2
- 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,4 +1,4 @@
|
|
|
1
|
-
'use strict';var a=require('fs'),
|
|
1
|
+
'use strict';var a=require('fs'),s=require('path'),module$1=require('module'),child_process=require('child_process');var _documentCurrentScript=typeof document!=='undefined'?document.currentScript:null;function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var a__namespace=/*#__PURE__*/_interopNamespace(a);var s__namespace=/*#__PURE__*/_interopNamespace(s);var x=module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('board-worker-adapter.cjs', document.baseURI).href)));function R(t){if(!t.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${t}`);let n=t.slice(4),o=n.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-n.length%4)%4),e;try{e=JSON.parse(Buffer.from(o,"base64").toString("utf8"));}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 r=e;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 h(t){return `b64:${Buffer.from(JSON.stringify(t),"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}`}function b(){return {read(t){if(!a__namespace.existsSync(t))return null;try{return a__namespace.readFileSync(t,"utf-8")}catch{return null}},write(t,n){a__namespace.mkdirSync(s__namespace.dirname(t),{recursive:true}),a__namespace.writeFileSync(t,n,"utf-8");}}}function S(t){if(t.kind==="fs-path")return b();throw new Error(`Unsupported storage kind: "${t.kind}". Supported kinds: fs-path`)}function d(t){let n=R(t);if(n.kind==="yaml-flow-cli"){let o=s__namespace.basename(n.value.trim());if(!o)throw new Error(`Invalid yaml-flow-cli ref: expected non-empty cli file name, got ${JSON.stringify(n.value)}`);let e=s__namespace.dirname(x.resolve("yaml-flow/package.json")),r=o.replace(/\.[^.]+$/,""),i=s__namespace.join(e,"cli","bundled",`${r}.mjs`);if(a__namespace.existsSync(i))return i;let l=s__namespace.join(e,"cli","node",o);if(a__namespace.existsSync(l))return l;throw new Error(`Invalid yaml-flow-cli ref: could not find ${o} under cli/bundled or cli/node in ${e}`)}return n.value}function g(t){let n=t.extra?.notifyChannel;return typeof n=="string"&&n.length>0?n:void 0}function w(t){if(!t.endsWith(".ts"))return {cmd:process.execPath,args:[t]};let n=s__namespace.dirname(t),o=[];for(let r=1;r<=5;r++){let i=s__namespace.join(n,...Array(r).fill(".."),"node_modules");o.push(s__namespace.join(i,"tsx","dist","cli.mjs")),o.push(s__namespace.join(i,".bin","tsx"));}let e=o.find(r=>a__namespace.existsSync(r));return e?{cmd:process.execPath,args:[e,t]}:{cmd:"npx",args:["tsx",t]}}function $(t,n){let{token:o,via:e}=t;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let r=d(e.whatToRun),{cmd:i,args:l}=w(r),u=g(e),f=[...l,"source-data-fetched","--ref",h(n),"--token",o,...u?["--notify-channel",u]:[]],c=child_process.spawnSync(i,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportComplete: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let r=d(e.whatToRun),i=JSON.stringify({status:"complete",ref:h(n),token:o});m(r,i);return}throw new Error(`reportComplete: unsupported via.howToRun "${e.howToRun}"`)}function T(t,n){let{token:o,via:e}=t;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let r=d(e.whatToRun),{cmd:i,args:l}=w(r),u=g(e),f=[...l,"source-data-fetch-failure","--token",o,"--reason",n,...u?["--notify-channel",u]:[]],c=child_process.spawnSync(i,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportFailed: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let r=d(e.whatToRun),i=JSON.stringify({status:"failed",reason:n,token:o});m(r,i);return}throw new Error(`reportFailed: unsupported via.howToRun "${e.howToRun}"`)}function m(t,n){let o=`
|
|
2
2
|
const {request} = require(new URL('${t}').protocol === 'https:' ? 'https' : 'http');
|
|
3
3
|
const h = ${JSON.stringify({"Content-Type":"application/json","Content-Length":Buffer.byteLength(n)})};
|
|
4
4
|
const u = new URL('${t}');
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
req.on('error', e => { process.stderr.write(e.message); process.exit(1); });
|
|
7
7
|
req.write(${JSON.stringify(n)});
|
|
8
8
|
req.end();
|
|
9
|
-
`,e=child_process.spawnSync(process.execPath,["-e",o],{encoding:"utf-8",windowsHide:true});if(e.status!==0)throw new Error(`http-post failed: ${e.stderr?.trim()}`)}exports.blobStorageForRef=S;exports.parseRef=
|
|
9
|
+
`,e=child_process.spawnSync(process.execPath,["-e",o],{encoding:"utf-8",windowsHide:true});if(e.status!==0)throw new Error(`http-post failed: ${e.stderr?.trim()}`)}exports.blobStorageForRef=S;exports.parseRef=R;exports.reportComplete=$;exports.reportFailed=T;exports.serializeRef=h;//# sourceMappingURL=board-worker-adapter.cjs.map
|
|
10
10
|
//# sourceMappingURL=board-worker-adapter.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import*as a from'fs';import*as
|
|
1
|
+
import*as a from'fs';import*as s from'path';import {createRequire}from'module';import {spawnSync}from'child_process';var x=createRequire(import.meta.url);function R(t){if(!t.startsWith("b64:"))throw new Error(`Invalid ref format (expected b64:<base64url(json)>): ${t}`);let n=t.slice(4),o=n.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-n.length%4)%4),e;try{e=JSON.parse(Buffer.from(o,"base64").toString("utf8"));}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 r=e;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 h(t){return `b64:${Buffer.from(JSON.stringify(t),"utf8").toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}`}function b(){return {read(t){if(!a.existsSync(t))return null;try{return a.readFileSync(t,"utf-8")}catch{return null}},write(t,n){a.mkdirSync(s.dirname(t),{recursive:true}),a.writeFileSync(t,n,"utf-8");}}}function S(t){if(t.kind==="fs-path")return b();throw new Error(`Unsupported storage kind: "${t.kind}". Supported kinds: fs-path`)}function d(t){let n=R(t);if(n.kind==="yaml-flow-cli"){let o=s.basename(n.value.trim());if(!o)throw new Error(`Invalid yaml-flow-cli ref: expected non-empty cli file name, got ${JSON.stringify(n.value)}`);let e=s.dirname(x.resolve("yaml-flow/package.json")),r=o.replace(/\.[^.]+$/,""),i=s.join(e,"cli","bundled",`${r}.mjs`);if(a.existsSync(i))return i;let l=s.join(e,"cli","node",o);if(a.existsSync(l))return l;throw new Error(`Invalid yaml-flow-cli ref: could not find ${o} under cli/bundled or cli/node in ${e}`)}return n.value}function g(t){let n=t.extra?.notifyChannel;return typeof n=="string"&&n.length>0?n:void 0}function w(t){if(!t.endsWith(".ts"))return {cmd:process.execPath,args:[t]};let n=s.dirname(t),o=[];for(let r=1;r<=5;r++){let i=s.join(n,...Array(r).fill(".."),"node_modules");o.push(s.join(i,"tsx","dist","cli.mjs")),o.push(s.join(i,".bin","tsx"));}let e=o.find(r=>a.existsSync(r));return e?{cmd:process.execPath,args:[e,t]}:{cmd:"npx",args:["tsx",t]}}function $(t,n){let{token:o,via:e}=t;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let r=d(e.whatToRun),{cmd:i,args:l}=w(r),u=g(e),f=[...l,"source-data-fetched","--ref",h(n),"--token",o,...u?["--notify-channel",u]:[]],c=spawnSync(i,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportComplete: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let r=d(e.whatToRun),i=JSON.stringify({status:"complete",ref:h(n),token:o});m(r,i);return}throw new Error(`reportComplete: unsupported via.howToRun "${e.howToRun}"`)}function T(t,n){let{token:o,via:e}=t;if(e.howToRun==="local-node"||e.howToRun==="local-process"){let r=d(e.whatToRun),{cmd:i,args:l}=w(r),u=g(e),f=[...l,"source-data-fetch-failure","--token",o,"--reason",n,...u?["--notify-channel",u]:[]],c=spawnSync(i,f,{encoding:"utf-8",windowsHide:true});if(c.status!==0)throw new Error(`reportFailed: board CLI exited ${c.status}: ${c.stderr?.trim()}`);return}if(e.howToRun==="http:post"){let r=d(e.whatToRun),i=JSON.stringify({status:"failed",reason:n,token:o});m(r,i);return}throw new Error(`reportFailed: unsupported via.howToRun "${e.howToRun}"`)}function m(t,n){let o=`
|
|
2
2
|
const {request} = require(new URL('${t}').protocol === 'https:' ? 'https' : 'http');
|
|
3
3
|
const h = ${JSON.stringify({"Content-Type":"application/json","Content-Length":Buffer.byteLength(n)})};
|
|
4
4
|
const u = new URL('${t}');
|
|
@@ -6,5 +6,5 @@ import*as a from'fs';import*as i from'path';import {createRequire}from'module';i
|
|
|
6
6
|
req.on('error', e => { process.stderr.write(e.message); process.exit(1); });
|
|
7
7
|
req.write(${JSON.stringify(n)});
|
|
8
8
|
req.end();
|
|
9
|
-
`,e=spawnSync(process.execPath,["-e",o],{encoding:"utf-8",windowsHide:true});if(e.status!==0)throw new Error(`http-post failed: ${e.stderr?.trim()}`)}export{S as blobStorageForRef,
|
|
9
|
+
`,e=spawnSync(process.execPath,["-e",o],{encoding:"utf-8",windowsHide:true});if(e.status!==0)throw new Error(`http-post failed: ${e.stderr?.trim()}`)}export{S as blobStorageForRef,R as parseRef,$ as reportComplete,T as reportFailed,h as serializeRef};//# sourceMappingURL=board-worker-adapter.js.map
|
|
10
10
|
//# sourceMappingURL=board-worker-adapter.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yaml-flow",
|
|
3
|
-
"version": "8.4.
|
|
3
|
+
"version": "8.4.12",
|
|
4
4
|
"description": "Unified workflow engine: step-machine (sequential) + event-graph (stateless DAG) with pluggable storage",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
"module": "./lib/board-live-cards-public.js",
|
|
10
10
|
"types": "./lib/board-live-cards-public.d.ts",
|
|
11
11
|
"bin": {
|
|
12
|
-
"board-live-cards-cli": "./cli/
|
|
13
|
-
"card-store": "./cli/
|
|
14
|
-
"artifacts-store": "./cli/
|
|
15
|
-
"chat-store": "./cli/
|
|
16
|
-
"step-machine-cli": "./cli/
|
|
17
|
-
"batch-runner-cli": "./cli/
|
|
12
|
+
"board-live-cards-cli": "./cli/bundled/board-live-cards-cli.mjs",
|
|
13
|
+
"card-store": "./cli/bundled/card-store-cli.mjs",
|
|
14
|
+
"artifacts-store": "./cli/bundled/artifacts-store-cli.mjs",
|
|
15
|
+
"chat-store": "./cli/bundled/chat-store-cli.mjs",
|
|
16
|
+
"step-machine-cli": "./cli/bundled/step-machine-cli.mjs",
|
|
17
|
+
"batch-runner-cli": "./cli/bundled/batch-runner-cli.mjs"
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"import": "./lib/board-live-cards-server-runtime.js",
|
|
68
68
|
"require": "./lib/board-live-cards-server-runtime.cjs"
|
|
69
69
|
},
|
|
70
|
+
"./cli-bundled/*": "./cli/bundled/*",
|
|
70
71
|
"./package.json": "./package.json"
|
|
71
72
|
},
|
|
72
73
|
"browser": {
|
|
@@ -75,6 +76,7 @@
|
|
|
75
76
|
"files": [
|
|
76
77
|
"lib",
|
|
77
78
|
"cli",
|
|
79
|
+
"!cli/node/**",
|
|
78
80
|
"examples",
|
|
79
81
|
"schema",
|
|
80
82
|
"browser",
|
|
@@ -91,14 +93,16 @@
|
|
|
91
93
|
"!examples/**/cards/**/files/**"
|
|
92
94
|
],
|
|
93
95
|
"scripts": {
|
|
94
|
-
"build": "npm run -s build:lib && npm run -s build:cli && npm run -s build:public-examples",
|
|
96
|
+
"build": "npm run -s build:lib && npm run -s build:cli && npm run -s build:cli-bundled && npm run -s build:public-examples",
|
|
95
97
|
"build:lib": "tsup --config tsup.config.ts",
|
|
96
98
|
"build:cli": "tsup --config tsup.cli.config.ts",
|
|
99
|
+
"build:cli-bundled": "node scripts/build-cli-bundled.mjs",
|
|
97
100
|
"build:public-examples": "node scripts/generate-public-examples.mjs",
|
|
98
101
|
"build:browser": "tsup --config tsup.browser.config.ts && node scripts/generate-browser-integrity.mjs",
|
|
99
102
|
"check:bundle-budget": "node scripts/check-bundle-budgets.mjs",
|
|
100
103
|
"check:browser-bundle": "node scripts/check-browser-bundle-safety.mjs",
|
|
101
|
-
"
|
|
104
|
+
"check:minified": "node scripts/check-minified.mjs",
|
|
105
|
+
"release:gate": "npm run -s build && npm run -s build:browser && npm run -s test:run && npm run -s test:e2e && npm run -s check:bundle-budget && npm run -s check:browser-bundle && npm run -s check:minified",
|
|
102
106
|
"standalone": "echo standalone is canonical; no assembly step required",
|
|
103
107
|
"pycli:install": "python -m pip install -r py-standalone/requirements.txt",
|
|
104
108
|
"pycli:install:venv": "c:/Users/sreenaga/ADO/ai-tool-evolver/.venv/Scripts/python.exe -m pip install -r py-standalone/requirements.txt",
|
|
@@ -114,11 +118,12 @@
|
|
|
114
118
|
"validate:cards": "tsx scripts/validate-live-cards.ts",
|
|
115
119
|
"lint": "eslint src/",
|
|
116
120
|
"typecheck": "tsc --noEmit",
|
|
117
|
-
"prepublishOnly": "npm run build && npm run build:browser && npm run build:public-examples && npm run check:bundle-budget && npm run check:browser-bundle"
|
|
121
|
+
"prepublishOnly": "npm run build && npm run build:browser && npm run build:public-examples && npm run check:bundle-budget && npm run check:browser-bundle && npm run check:minified"
|
|
118
122
|
},
|
|
119
123
|
"devDependencies": {
|
|
120
124
|
"@types/node": "^20.10.0",
|
|
121
125
|
"@types/proper-lockfile": "^4.1.4",
|
|
126
|
+
"esbuild": "^0.27.0",
|
|
122
127
|
"jsdom": "^24.0.0",
|
|
123
128
|
"tsup": "^8.0.0",
|
|
124
129
|
"tsx": "^4.21.0",
|
|
@@ -1,11 +0,0 @@
|
|
|
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 M(){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 M()]};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
|
-
`);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
|
-
`);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
|
-
`);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
|
-
`);return}throw new Error(`Unknown command "${s}"
|
|
9
|
-
|
|
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
|
-
//# sourceMappingURL=artifacts-store-cli.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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:C,createStepMachine:$,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 C(s),l=await J(x,{concurrency:t,processor:async(o,_)=>{let b=O(h,{invoke:(v,S)=>M(U(v),S,{cliDir:c,cwd:c})});return $(h,b,{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
|
-
//# sourceMappingURL=batch-runner-cli.js.map
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* board-live-cards-example-cli.ts
|
|
4
|
-
*
|
|
5
|
-
* Thin arg-parse CLI for the board-live-cards public API.
|
|
6
|
-
*
|
|
7
|
-
* This file contains ONLY:
|
|
8
|
-
* 1. Arg parsing helpers
|
|
9
|
-
* 2. A `cli()` function that maps argv → public-API calls
|
|
10
|
-
* 3. A main-invocation guard
|
|
11
|
-
*
|
|
12
|
-
* All logic lives in board-live-cards-public.ts (platform-free) and
|
|
13
|
-
* fs-board-adapter.ts (Node/FS platform adapters).
|
|
14
|
-
*
|
|
15
|
-
* Imports are limited to ./fs-board-adapter.js and ./process-runner.js —
|
|
16
|
-
* no direct imports from ../common/*.
|
|
17
|
-
*/
|
|
18
|
-
declare function cli(argv: string[]): Promise<void>;
|
|
19
|
-
|
|
20
|
-
export { cli };
|