@nanobpm/nano-agent-graph-engine 0.17.1 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -2
- package/dist/cli.js +28 -10
- package/dist/explorer-app.html +30 -30
- package/dist/explorer.html +30 -30
- package/dist/guide.md +1 -1
- package/dist/index.js +7 -1
- package/dist/layout-thread.js +52 -1
- package/dist/typecheck/node_modules/@nanobpm/workflow/dist/declarative.d.ts +7 -8
- package/dist/typecheck/node_modules/@nanobpm/workflow/dist/layout.d.ts +13 -0
- package/dist/typecheck/node_modules/@nanobpm/workflow/dist/nodes/forEach.d.ts +13 -0
- package/dist/typecheck/node_modules/@nanobpm/workflow/package.json +1 -1
- package/package.json +2 -2
- package/skills/agent-graph-authoring/SKILL.md +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nano-agent-graph-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Nano Agent Graph Engine: write durable flows in TypeScript (defineFlow), compile them to BPMN, and run them in a local engine that orchestrates scripts, headless agents, this session and you (user tasks).",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
package/README.md
CHANGED
|
@@ -407,8 +407,9 @@ If no notifications appear on macOS, check System Settings → Notifications for
|
|
|
407
407
|
## Parallelism and fan-out
|
|
408
408
|
|
|
409
409
|
Flows fan out with `w.parallel([...])`, a fixed set of branches, and
|
|
410
|
-
`w.forEach("files", "file", body, { outputCollection, outputElement })`, one branch per
|
|
411
|
-
list item with the results collected in order.
|
|
410
|
+
`w.forEach("files", "file", body, { outputCollection, outputElement, name })`, one branch per
|
|
411
|
+
list item with the results collected in order. A multi-step body is a sub-process, drawn
|
|
412
|
+
expanded with its steps inline (`name` labels it, e.g. "Review & challenge each file"). Both are BPMN parallel gateways and
|
|
412
413
|
multi-instance activities, so the engine joins the branches and continues only when
|
|
413
414
|
all are done, or when `completionCondition` holds.
|
|
414
415
|
|
package/dist/cli.js
CHANGED
|
@@ -549,6 +549,12 @@ var init_forEach = __esm({
|
|
|
549
549
|
}
|
|
550
550
|
node2.completionCondition = compCond;
|
|
551
551
|
}
|
|
552
|
+
if (opts?.name !== void 0) {
|
|
553
|
+
if (typeof opts.name !== "string" || opts.name.trim() === "") {
|
|
554
|
+
throw new Error(`forEach("${itemVar}") name must be a non-empty string`);
|
|
555
|
+
}
|
|
556
|
+
node2.name = opts.name.trim();
|
|
557
|
+
}
|
|
552
558
|
if (node2.outputElement && !node2.outputCollection) {
|
|
553
559
|
throw new Error(`forEach("${itemVar}") outputElement needs an outputCollection to collect into`);
|
|
554
560
|
}
|
|
@@ -565,7 +571,7 @@ var init_forEach = __esm({
|
|
|
565
571
|
return [api2.newEdge(only.name)];
|
|
566
572
|
}
|
|
567
573
|
const subId = `Sub_${api2.nextGw()}`;
|
|
568
|
-
api2.addSubProcess(subId, mi);
|
|
574
|
+
api2.addSubProcess(subId, mi, node2.name);
|
|
569
575
|
api2.connect(incoming, subId);
|
|
570
576
|
api2.pushScope(subId);
|
|
571
577
|
const startId = `${subId}_start`;
|
|
@@ -1088,7 +1094,7 @@ var init_declarative = __esm({
|
|
|
1088
1094
|
addTimerCatchEvent: (node2) => this.addTimerCatchEvent(node2),
|
|
1089
1095
|
addGateway: (id, name2) => this.addGateway(id, name2),
|
|
1090
1096
|
addParallelGateway: (id) => this.addParallelGateway(id),
|
|
1091
|
-
addSubProcess: (id, mi) => this.addSubProcess(id, mi),
|
|
1097
|
+
addSubProcess: (id, mi, name2) => this.addSubProcess(id, mi, name2),
|
|
1092
1098
|
addPlainStart: (id) => this.addPlainStart(id),
|
|
1093
1099
|
addPlainEnd: (id) => this.addPlainEnd(id),
|
|
1094
1100
|
nextGw: () => this.gw++,
|
|
@@ -1220,11 +1226,11 @@ ${props.join("\n")}
|
|
|
1220
1226
|
}
|
|
1221
1227
|
/** An embedded sub-process whose body renders nested in its own scope, with the
|
|
1222
1228
|
* given multi-instance characteristics lifted onto it. */
|
|
1223
|
-
addSubProcess(id, mi) {
|
|
1229
|
+
addSubProcess(id, mi, name2) {
|
|
1224
1230
|
const node2 = {
|
|
1225
1231
|
id,
|
|
1226
1232
|
scope: this.currentScope(),
|
|
1227
|
-
render: (inc, outg) => ` <bpmn:subProcess id="${escapeXml(id)}">
|
|
1233
|
+
render: (inc, outg) => ` <bpmn:subProcess id="${escapeXml(id)}"${name2 ? ` name="${escapeXml(name2)}"` : ""}>
|
|
1228
1234
|
` + incomingOutgoing(inc, outg) + mi + this.renderScope(id) + `
|
|
1229
1235
|
</bpmn:subProcess>`
|
|
1230
1236
|
};
|
|
@@ -29136,6 +29142,7 @@ import fs2 from "node:fs";
|
|
|
29136
29142
|
import path2 from "node:path";
|
|
29137
29143
|
import crypto3 from "node:crypto";
|
|
29138
29144
|
import { Worker } from "node:worker_threads";
|
|
29145
|
+
import { createRequire } from "node:module";
|
|
29139
29146
|
function threadUrl() {
|
|
29140
29147
|
const js = new URL("./layout-thread.js", import.meta.url);
|
|
29141
29148
|
return fs2.existsSync(js) ? js : new URL("./layout-thread.ts", import.meta.url);
|
|
@@ -29161,7 +29168,8 @@ function layoutV2(xml3, file2) {
|
|
|
29161
29168
|
return p2;
|
|
29162
29169
|
}
|
|
29163
29170
|
async function layoutXml(xml3) {
|
|
29164
|
-
const file2 = path2.join(cacheDir(), `${crypto3.createHash("sha256").update(
|
|
29171
|
+
const file2 = path2.join(cacheDir(), `${crypto3.createHash("sha256").update(`${workflowVersion}
|
|
29172
|
+
${xml3}`).digest("hex").slice(0, 32)}.bpmn`);
|
|
29165
29173
|
try {
|
|
29166
29174
|
return fs2.readFileSync(file2, "utf8");
|
|
29167
29175
|
} catch {
|
|
@@ -29187,13 +29195,23 @@ async function layoutXml(xml3) {
|
|
|
29187
29195
|
function layoutFlow(flow) {
|
|
29188
29196
|
return layoutXml(declarativeToBpmn(flow));
|
|
29189
29197
|
}
|
|
29190
|
-
var budgetMs, cacheDir, pending;
|
|
29198
|
+
var workflowVersion, budgetMs, cacheDir, pending;
|
|
29191
29199
|
var init_layout = __esm({
|
|
29192
29200
|
"src/layout.ts"() {
|
|
29193
29201
|
"use strict";
|
|
29194
29202
|
init_dist();
|
|
29195
29203
|
init_dist7();
|
|
29196
29204
|
init_paths();
|
|
29205
|
+
workflowVersion = (() => {
|
|
29206
|
+
if ("0.19.0") return "0.19.0";
|
|
29207
|
+
try {
|
|
29208
|
+
let dir = path2.dirname(createRequire(import.meta.url).resolve("@nanobpm/workflow"));
|
|
29209
|
+
while (!fs2.existsSync(path2.join(dir, "package.json")) && path2.dirname(dir) !== dir) dir = path2.dirname(dir);
|
|
29210
|
+
return JSON.parse(fs2.readFileSync(path2.join(dir, "package.json"), "utf8")).version;
|
|
29211
|
+
} catch {
|
|
29212
|
+
return "unknown";
|
|
29213
|
+
}
|
|
29214
|
+
})();
|
|
29197
29215
|
budgetMs = () => Number(process.env.AGE_LAYOUT_MS ?? 5e3);
|
|
29198
29216
|
cacheDir = () => path2.join(engineDir(), "layout-cache");
|
|
29199
29217
|
pending = /* @__PURE__ */ new Map();
|
|
@@ -31359,11 +31377,11 @@ var init_nanobpmn_engine = __esm({
|
|
|
31359
31377
|
|
|
31360
31378
|
// src/wasm.ts
|
|
31361
31379
|
import fs4 from "node:fs";
|
|
31362
|
-
import { createRequire } from "node:module";
|
|
31380
|
+
import { createRequire as createRequire2 } from "node:module";
|
|
31363
31381
|
function wasmPath() {
|
|
31364
31382
|
const local = new URL("./nanobpmn_engine_bg.wasm", import.meta.url);
|
|
31365
31383
|
if (fs4.existsSync(local)) return local.pathname;
|
|
31366
|
-
const req =
|
|
31384
|
+
const req = createRequire2(import.meta.url);
|
|
31367
31385
|
const pkg = req.resolve("@nanobpm/engine-wasm/readmodel");
|
|
31368
31386
|
return pkg.replace(/nanobpmn_engine\.js$/, "nanobpmn_engine_bg.wasm");
|
|
31369
31387
|
}
|
|
@@ -31527,7 +31545,7 @@ var init_resolve_hook = __esm({
|
|
|
31527
31545
|
// src/typecheck.ts
|
|
31528
31546
|
import fs6 from "node:fs";
|
|
31529
31547
|
import path4 from "node:path";
|
|
31530
|
-
import { createRequire as
|
|
31548
|
+
import { createRequire as createRequire3 } from "node:module";
|
|
31531
31549
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
31532
31550
|
function typecheckKit() {
|
|
31533
31551
|
const here = path4.dirname(fileURLToPath2(import.meta.url));
|
|
@@ -31536,7 +31554,7 @@ function typecheckKit() {
|
|
|
31536
31554
|
return void 0;
|
|
31537
31555
|
}
|
|
31538
31556
|
function loadTs(kit) {
|
|
31539
|
-
return tsCache ??=
|
|
31557
|
+
return tsCache ??= createRequire3(path4.join(kit, "ts.cjs"))("./ts.cjs");
|
|
31540
31558
|
}
|
|
31541
31559
|
function typecheckFlows(files) {
|
|
31542
31560
|
const kit = typecheckKit();
|