@nanobpm/nano-agent-graph-engine 0.18.1 → 0.18.3
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/dist/cli.js +72 -4
- package/dist/index.js +72 -2
- package/dist/nanobpmn_engine_bg.wasm +0 -0
- package/dist/typecheck/node_modules/@nanobpm/workflow/dist/declarative.d.ts +12 -1
- package/dist/typecheck/node_modules/@nanobpm/workflow/dist/envelope.d.ts +4 -0
- package/dist/typecheck/node_modules/@nanobpm/workflow/dist/index.d.ts +1 -1
- package/dist/typecheck/node_modules/@nanobpm/workflow/dist/types.d.ts +23 -0
- package/dist/typecheck/node_modules/@nanobpm/workflow/package.json +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nano-agent-graph-engine",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
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/dist/cli.js
CHANGED
|
@@ -1042,6 +1042,41 @@ function requireStartAt(timer) {
|
|
|
1042
1042
|
function declarativeToBpmn(flow) {
|
|
1043
1043
|
return new Compiler(flow).compile();
|
|
1044
1044
|
}
|
|
1045
|
+
function jsonSchemaType(f2) {
|
|
1046
|
+
if (f2.list)
|
|
1047
|
+
return "array";
|
|
1048
|
+
switch (f2.type) {
|
|
1049
|
+
case "string":
|
|
1050
|
+
case "datetime":
|
|
1051
|
+
return "string";
|
|
1052
|
+
case "integer":
|
|
1053
|
+
return "integer";
|
|
1054
|
+
case "number":
|
|
1055
|
+
return "number";
|
|
1056
|
+
case "boolean":
|
|
1057
|
+
return "boolean";
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
function toolProps(tool, input2) {
|
|
1061
|
+
const props = [toolProp("name", tool.name), toolProp("purpose", tool.purpose)];
|
|
1062
|
+
if (tool.inputs !== void 0)
|
|
1063
|
+
props.push(toolProp("inputs", tool.inputs));
|
|
1064
|
+
if (tool.whenToUse !== void 0)
|
|
1065
|
+
props.push(toolProp("when_to_use", tool.whenToUse));
|
|
1066
|
+
if (tool.whenNotToUse !== void 0)
|
|
1067
|
+
props.push(toolProp("when_not_to_use", tool.whenNotToUse));
|
|
1068
|
+
if (tool.results !== void 0)
|
|
1069
|
+
props.push(toolProp("results", tool.results));
|
|
1070
|
+
input2?.fields.forEach((f2, idx) => {
|
|
1071
|
+
const i = idx + 1;
|
|
1072
|
+
props.push(toolProp(`input_${i}_name`, f2.name));
|
|
1073
|
+
props.push(toolProp(`input_${i}_type`, jsonSchemaType(f2)));
|
|
1074
|
+
if (f2.description !== void 0)
|
|
1075
|
+
props.push(toolProp(`input_${i}_description`, f2.description));
|
|
1076
|
+
props.push(toolProp(`input_${i}_required`, f2.optional ? "false" : "true"));
|
|
1077
|
+
});
|
|
1078
|
+
return props;
|
|
1079
|
+
}
|
|
1045
1080
|
function incomingOutgoing(inc, outg) {
|
|
1046
1081
|
return inc.map((f2) => ` <bpmn:incoming>${f2}</bpmn:incoming>
|
|
1047
1082
|
`).join("") + outg.map((f2) => ` <bpmn:outgoing>${f2}</bpmn:outgoing>
|
|
@@ -1056,7 +1091,7 @@ function sequenceFlow(e) {
|
|
|
1056
1091
|
}
|
|
1057
1092
|
return ` <bpmn:sequenceFlow id="${e.id}" sourceRef="${e.from}" targetRef="${e.to}"${nm} />`;
|
|
1058
1093
|
}
|
|
1059
|
-
var Compiler, envelopeProp, feel, feelEquals, incomingOnly, outgoingOnly;
|
|
1094
|
+
var Compiler, TOOL_START_MESSAGE_ID, toolProp, envelopeProp, feel, feelEquals, incomingOnly, outgoingOnly;
|
|
1060
1095
|
var init_declarative = __esm({
|
|
1061
1096
|
"node_modules/@nanobpm/workflow/dist/declarative.js"() {
|
|
1062
1097
|
init_xml();
|
|
@@ -1068,6 +1103,9 @@ var init_declarative = __esm({
|
|
|
1068
1103
|
edges = [];
|
|
1069
1104
|
/** envelope name → its fields, deduped for lifting to a single nano:shape. */
|
|
1070
1105
|
envelopes = /* @__PURE__ */ new Map();
|
|
1106
|
+
/** Every `<bpmn:message>` id emitted, recorded by {@link emitMessages} (the
|
|
1107
|
+
* single source) so lifted shape ids can be checked against it. */
|
|
1108
|
+
messageIds = /* @__PURE__ */ new Set();
|
|
1071
1109
|
/** The stack of open sub-process scopes; `.at(-1)` is the current scope (a
|
|
1072
1110
|
* node/edge created now nests inside it). Empty at the top level. */
|
|
1073
1111
|
scopeStack = [];
|
|
@@ -1268,12 +1306,22 @@ ${props.join("\n")}
|
|
|
1268
1306
|
const t = this.flow.startTimer;
|
|
1269
1307
|
const input2 = this.flow.input;
|
|
1270
1308
|
this.recordEnvelope(input2);
|
|
1271
|
-
const
|
|
1309
|
+
const props = [
|
|
1310
|
+
...input2 ? [envelopeProp("in", input2.name)] : [],
|
|
1311
|
+
...this.flow.tool ? toolProps(this.flow.tool, input2) : []
|
|
1312
|
+
];
|
|
1313
|
+
const ext = props.length ? ` <bpmn:extensionElements>
|
|
1272
1314
|
<zeebe:properties>
|
|
1273
|
-
${
|
|
1315
|
+
${props.join("\n")}
|
|
1274
1316
|
</zeebe:properties>
|
|
1275
1317
|
</bpmn:extensionElements>
|
|
1276
1318
|
` : "";
|
|
1319
|
+
if (this.flow.tool) {
|
|
1320
|
+
return ` <bpmn:startEvent id="Start">
|
|
1321
|
+
` + ext + ` ${outgoingOnly(outg)}
|
|
1322
|
+
<bpmn:messageEventDefinition messageRef="${TOOL_START_MESSAGE_ID}" />
|
|
1323
|
+
</bpmn:startEvent>`;
|
|
1324
|
+
}
|
|
1277
1325
|
if (!t) {
|
|
1278
1326
|
if (!ext)
|
|
1279
1327
|
return ` <bpmn:startEvent id="Start">${outgoingOnly(outg)}</bpmn:startEvent>`;
|
|
@@ -1306,6 +1354,7 @@ ${ext} ${outgoingOnly(outg)}
|
|
|
1306
1354
|
this.live = this.edges.filter((e) => e.to !== void 0);
|
|
1307
1355
|
const bodyXml = this.renderScope(void 0);
|
|
1308
1356
|
const messageXml = this.emitMessages();
|
|
1357
|
+
this.assertShapeIdsDisjointFromMessages();
|
|
1309
1358
|
const shapeXml = this.emitShapes();
|
|
1310
1359
|
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
1311
1360
|
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:nano="https://nanobpm.io/schema/shapes/1.0" id="Definitions_${escapeXml(this.flow.id)}" targetNamespace="http://bpmn.io/schema/bpmn">
|
|
@@ -1319,10 +1368,15 @@ ${ext} ${outgoingOnly(outg)}
|
|
|
1319
1368
|
* typed) its payload data envelope. */
|
|
1320
1369
|
emitMessages() {
|
|
1321
1370
|
const msgs = [];
|
|
1371
|
+
if (this.flow.tool) {
|
|
1372
|
+
this.messageIds.add(TOOL_START_MESSAGE_ID);
|
|
1373
|
+
msgs.push(` <bpmn:message id="${TOOL_START_MESSAGE_ID}" name="${escapeXml(messageName(this.flow.id, "Start"))}" />`);
|
|
1374
|
+
}
|
|
1322
1375
|
walkNodes(this.flow.steps, (n) => {
|
|
1323
1376
|
if (n.kind !== "signal")
|
|
1324
1377
|
return;
|
|
1325
1378
|
const msgId = `Msg_${n.name}`;
|
|
1379
|
+
this.messageIds.add(msgId);
|
|
1326
1380
|
const payloadProp = n.payload ? `
|
|
1327
1381
|
<zeebe:properties>
|
|
1328
1382
|
${envelopeProp("in", n.payload.name)}
|
|
@@ -1335,6 +1389,18 @@ ${envelopeProp("in", n.payload.name)}
|
|
|
1335
1389
|
});
|
|
1336
1390
|
return msgs.join("\n");
|
|
1337
1391
|
}
|
|
1392
|
+
/** Every lifted envelope becomes `<nano:shape id=NAME>` and every message a
|
|
1393
|
+
* `<bpmn:message id="Msg_…">` (the tool start message and one per signal step,
|
|
1394
|
+
* anywhere in the tree). Any overlap is a duplicate id → an invalid document,
|
|
1395
|
+
* so check the COLLECTED shape set (step in/out, signal payloads, nested
|
|
1396
|
+
* steps — every envelope source) against the derived message ids, fail-closed. */
|
|
1397
|
+
assertShapeIdsDisjointFromMessages() {
|
|
1398
|
+
for (const name2 of this.envelopes.keys()) {
|
|
1399
|
+
if (this.messageIds.has(name2)) {
|
|
1400
|
+
throw new Error(`envelope "${name2}" collides with the generated <bpmn:message> id in flow "${this.flow.id}" \u2014 rename the envelope`);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1338
1404
|
/** Lift the referenced data envelopes into a `<nano:shapes>` container on the
|
|
1339
1405
|
* process extension elements, so the model carries the typed contracts and is
|
|
1340
1406
|
* ejectable to model-first. */
|
|
@@ -1358,6 +1424,8 @@ ${shapes.join("\n")}
|
|
|
1358
1424
|
</bpmn:extensionElements>`;
|
|
1359
1425
|
}
|
|
1360
1426
|
};
|
|
1427
|
+
TOOL_START_MESSAGE_ID = "Msg_Start";
|
|
1428
|
+
toolProp = (key, value) => ` <zeebe:property name="io.camunda.tool:${key}" value="${escapeXml(value)}" />`;
|
|
1361
1429
|
envelopeProp = (dir, value) => ` <zeebe:property name="io.nanobpm.dataEnvelope.${dir}" value="${escapeXml(value)}" />`;
|
|
1362
1430
|
feel = (expr) => `=${expr}`;
|
|
1363
1431
|
feelEquals = (subject, value) => `=${subject} = "${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
@@ -29203,7 +29271,7 @@ var init_layout = __esm({
|
|
|
29203
29271
|
init_dist7();
|
|
29204
29272
|
init_paths();
|
|
29205
29273
|
workflowVersion = (() => {
|
|
29206
|
-
if ("0.
|
|
29274
|
+
if ("0.20.0") return "0.20.0";
|
|
29207
29275
|
try {
|
|
29208
29276
|
let dir = path2.dirname(createRequire(import.meta.url).resolve("@nanobpm/workflow"));
|
|
29209
29277
|
while (!fs2.existsSync(path2.join(dir, "package.json")) && path2.dirname(dir) !== dir) dir = path2.dirname(dir);
|
package/dist/index.js
CHANGED
|
@@ -910,8 +910,22 @@ function makeBuilder(id, out, ctx, isRoot = false) {
|
|
|
910
910
|
throw new Error(`startOn() must be the first statement in flow "${id}"`);
|
|
911
911
|
if (ctx.startTimer)
|
|
912
912
|
throw new Error(`startOn() may be called only once in flow "${id}"`);
|
|
913
|
+
if (ctx.tool)
|
|
914
|
+
throw new Error(`startOn() cannot be combined with exposeAsTool() in flow "${id}"`);
|
|
913
915
|
ctx.startTimer = t;
|
|
914
916
|
};
|
|
917
|
+
const setTool = (t) => {
|
|
918
|
+
if (!isRoot) {
|
|
919
|
+
throw new Error(`exposeAsTool() is only valid at the top level of flow "${id}" (not inside switch/branch/loop)`);
|
|
920
|
+
}
|
|
921
|
+
if (out.length !== 0)
|
|
922
|
+
throw new Error(`exposeAsTool() must precede every step in flow "${id}"`);
|
|
923
|
+
if (ctx.tool)
|
|
924
|
+
throw new Error(`exposeAsTool() may be called only once in flow "${id}"`);
|
|
925
|
+
if (ctx.startTimer)
|
|
926
|
+
throw new Error(`exposeAsTool() cannot be combined with startOn() in flow "${id}"`);
|
|
927
|
+
ctx.tool = t;
|
|
928
|
+
};
|
|
915
929
|
let builderRef;
|
|
916
930
|
const api = {
|
|
917
931
|
id,
|
|
@@ -935,10 +949,12 @@ function makeBuilder(id, out, ctx, isRoot = false) {
|
|
|
935
949
|
contractEnvelopes(name) {
|
|
936
950
|
return contractEnvelopes(ctx, name);
|
|
937
951
|
},
|
|
938
|
-
setStartTimer
|
|
952
|
+
setStartTimer,
|
|
953
|
+
setTool
|
|
939
954
|
};
|
|
940
955
|
const methods = /* @__PURE__ */ Object.create(null);
|
|
941
956
|
methods.startOn = startOnMethod(api);
|
|
957
|
+
methods.exposeAsTool = exposeAsToolMethod(api);
|
|
942
958
|
for (const [kind, handlers] of eachNodeKind()) {
|
|
943
959
|
if (!handlers.build)
|
|
944
960
|
continue;
|
|
@@ -959,6 +975,7 @@ function makeBuilder(id, out, ctx, isRoot = false) {
|
|
|
959
975
|
}
|
|
960
976
|
var BUILTIN_BUILDER_METHODS = [
|
|
961
977
|
"startOn",
|
|
978
|
+
"exposeAsTool",
|
|
962
979
|
"run",
|
|
963
980
|
"task",
|
|
964
981
|
"signal",
|
|
@@ -1014,6 +1031,31 @@ function startOnMethod(api) {
|
|
|
1014
1031
|
return api.self();
|
|
1015
1032
|
};
|
|
1016
1033
|
}
|
|
1034
|
+
var TOOL_TEXT_KEYS = ["inputs", "whenToUse", "whenNotToUse", "results"];
|
|
1035
|
+
function exposeAsToolMethod(api) {
|
|
1036
|
+
return (opts) => {
|
|
1037
|
+
if (opts === null || typeof opts !== "object") {
|
|
1038
|
+
throw new Error(`exposeAsTool() needs an options object in flow "${api.id}"`);
|
|
1039
|
+
}
|
|
1040
|
+
for (const key of ["name", "purpose"]) {
|
|
1041
|
+
const v = opts[key];
|
|
1042
|
+
if (typeof v !== "string" || v.trim() === "") {
|
|
1043
|
+
throw new Error(`exposeAsTool() needs a non-empty \`${key}\` in flow "${api.id}"`);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
const tool = { name: opts.name.trim(), purpose: opts.purpose };
|
|
1047
|
+
for (const key of TOOL_TEXT_KEYS) {
|
|
1048
|
+
const v = opts[key];
|
|
1049
|
+
if (v === void 0)
|
|
1050
|
+
continue;
|
|
1051
|
+
if (typeof v !== "string")
|
|
1052
|
+
throw new Error(`exposeAsTool() \`${key}\` must be a string in flow "${api.id}"`);
|
|
1053
|
+
tool[key] = v;
|
|
1054
|
+
}
|
|
1055
|
+
api.setTool(tool);
|
|
1056
|
+
return api.self();
|
|
1057
|
+
};
|
|
1058
|
+
}
|
|
1017
1059
|
function defineFlow(id, second, third) {
|
|
1018
1060
|
assertIdent("workflow id", id);
|
|
1019
1061
|
if (typeof second !== "function" && (second === null || typeof second !== "object")) {
|
|
@@ -1040,11 +1082,32 @@ function defineFlow(id, second, third) {
|
|
|
1040
1082
|
const flow = { kind: "declarative", id, steps, handlers };
|
|
1041
1083
|
if (ctx.startTimer)
|
|
1042
1084
|
flow.startTimer = ctx.startTimer;
|
|
1085
|
+
if (ctx.tool)
|
|
1086
|
+
flow.tool = ctx.tool;
|
|
1043
1087
|
const input = startInput(id, contracts);
|
|
1044
1088
|
if (input)
|
|
1045
1089
|
flow.input = input;
|
|
1090
|
+
if (ctx.tool)
|
|
1091
|
+
assertToolExposure(id, input);
|
|
1046
1092
|
return flow;
|
|
1047
1093
|
}
|
|
1094
|
+
function assertToolExposure(id, input) {
|
|
1095
|
+
if (id === TOOL_START_MESSAGE_ID) {
|
|
1096
|
+
throw new Error(`exposeAsTool() in flow "${id}": the flow id "${TOOL_START_MESSAGE_ID}" collides with the generated start message id \u2014 rename the flow`);
|
|
1097
|
+
}
|
|
1098
|
+
if (input === void 0)
|
|
1099
|
+
return;
|
|
1100
|
+
if (input.name === TOOL_START_MESSAGE_ID) {
|
|
1101
|
+
throw new Error(`exposeAsTool() in flow "${id}": the input envelope "${TOOL_START_MESSAGE_ID}" collides with the generated start message id (it lifts to a nano:shape with that id) \u2014 rename the envelope`);
|
|
1102
|
+
}
|
|
1103
|
+
for (const f of input.fields) {
|
|
1104
|
+
if (f.name === TOOL_RESERVED_INPUT_FIELD) {
|
|
1105
|
+
throw new Error(`exposeAsTool() in flow "${id}": the input field "${TOOL_RESERVED_INPUT_FIELD}" is reserved by the MCP tool surface (it is stripped from the process variables), so the field would never reach the flow \u2014 rename it`);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
var TOOL_START_MESSAGE_ID = "Msg_Start";
|
|
1110
|
+
var TOOL_RESERVED_INPUT_FIELD = "businessId";
|
|
1048
1111
|
var feel = (expr) => `=${expr}`;
|
|
1049
1112
|
var feelEquals = (subject, value) => `=${subject} = "${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
1050
1113
|
function incomingOutgoing(inc, outg) {
|
|
@@ -1079,12 +1142,19 @@ function normaliseField(name, spec) {
|
|
|
1079
1142
|
if (!SCALARS.has(raw.type)) {
|
|
1080
1143
|
throw new Error(`envelope field "${name}": unknown type "${raw.type}" (expected one of ${[...SCALARS].join(", ")})`);
|
|
1081
1144
|
}
|
|
1082
|
-
|
|
1145
|
+
const field = {
|
|
1083
1146
|
name,
|
|
1084
1147
|
type: raw.type,
|
|
1085
1148
|
optional: typeof spec === "object" && spec.optional === true,
|
|
1086
1149
|
list: typeof spec === "object" && spec.list === true
|
|
1087
1150
|
};
|
|
1151
|
+
if (typeof spec === "object" && spec.description !== void 0) {
|
|
1152
|
+
if (typeof spec.description !== "string") {
|
|
1153
|
+
throw new Error(`envelope field "${name}": description must be a string`);
|
|
1154
|
+
}
|
|
1155
|
+
field.description = spec.description;
|
|
1156
|
+
}
|
|
1157
|
+
return field;
|
|
1088
1158
|
}
|
|
1089
1159
|
function envelope(name, fields) {
|
|
1090
1160
|
assertIdent("envelope name", name);
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DeclarativeFlow, FlowContracts, FlowNode, JsonObject, NodeEnvelopes, StepHandler, TimerStart } from "./types.js";
|
|
1
|
+
import type { DeclarativeFlow, FlowContracts, FlowNode, JsonObject, NodeEnvelopes, StepHandler, TimerStart, ToolExposure } from "./types.js";
|
|
2
2
|
import type { Envelope } from "./envelope.js";
|
|
3
3
|
import type { HumanIoMapping } from "./io-mapping.js";
|
|
4
4
|
import type { ForEachOpts } from "./nodes/forEach.js";
|
|
@@ -94,6 +94,15 @@ export interface FlowBuilder<C extends object = object> {
|
|
|
94
94
|
} | {
|
|
95
95
|
at: string;
|
|
96
96
|
}): FlowBuilder<C>;
|
|
97
|
+
/**
|
|
98
|
+
* Expose this flow as an MCP tool. The start event renders as a MESSAGE start
|
|
99
|
+
* (MCP tool calls correlate its start message) carrying the Camunda
|
|
100
|
+
* `io.camunda.tool:*` properties, plus Nano's typed `io.camunda.tool:input_N_*`
|
|
101
|
+
* superset DERIVED from the flow's `Start` input envelope (field name, JSON
|
|
102
|
+
* type, `description`, required). Top level only, before any step; exclusive
|
|
103
|
+
* with `startOn`.
|
|
104
|
+
*/
|
|
105
|
+
exposeAsTool(opts: ToolExposure): FlowBuilder<C>;
|
|
97
106
|
/**
|
|
98
107
|
* Make this flow's start event a durable TIMER start rather than an explicit
|
|
99
108
|
* `client.start(...)`. Must be the first statement, at the top level. Pass
|
|
@@ -210,6 +219,8 @@ export interface BuildApi {
|
|
|
210
219
|
} | undefined;
|
|
211
220
|
/** Lift a durable timer start onto the flow (used only by `startOn`). */
|
|
212
221
|
setStartTimer(t: TimerStart): void;
|
|
222
|
+
/** Lift an MCP tool exposure onto the flow (used only by `exposeAsTool`). */
|
|
223
|
+
setTool(t: ToolExposure): void;
|
|
213
224
|
}
|
|
214
225
|
/** A dynamically-assembled builder satisfies `FlowBuilder<C>` once every core
|
|
215
226
|
* built-in method is installed. The check is a runtime type guard (not an `as`
|
|
@@ -9,6 +9,7 @@ export type FieldSpec = ScalarType | {
|
|
|
9
9
|
type: ScalarType;
|
|
10
10
|
optional?: boolean;
|
|
11
11
|
list?: boolean;
|
|
12
|
+
description?: string;
|
|
12
13
|
};
|
|
13
14
|
/** The TS type of a single field spec (applies `list` before `optional`). A spec
|
|
14
15
|
* whose `list` isn't a literal (the widened `FieldSpec` of a plain `Envelope`) may
|
|
@@ -40,6 +41,9 @@ export interface EnvelopeField {
|
|
|
40
41
|
type: ScalarType;
|
|
41
42
|
optional: boolean;
|
|
42
43
|
list: boolean;
|
|
44
|
+
/** Human-readable field doc (e.g. surfaced as an MCP tool input description).
|
|
45
|
+
* Present only when declared. */
|
|
46
|
+
description?: string;
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
45
49
|
* A typed data envelope: a named schema (for the model) plus a phantom TS type
|
|
@@ -11,4 +11,4 @@ export { WorkflowClient, WorkflowError, toBpmn, toDeployableBpmn } from "./clien
|
|
|
11
11
|
export type { WorkflowClientOptions, NanoSdkClient, NanoJobWorker, JobWorkerConfig, ActivatedJob, } from "./client.js";
|
|
12
12
|
export { Worker } from "./worker.js";
|
|
13
13
|
export type { WorkerOptions, ActivityEvent } from "./worker.js";
|
|
14
|
-
export type { Json, JsonObject, Job, StepHandler, DeclarativeFlow, DeclarativeStep, FlowNode, SwitchCase, TimerStart, NodeEnvelopes, StepContract, FlowContracts, ImperativeWorkflow, Orchestration, WorkflowContext, Workflow, DeployResult, StartResult, } from "./types.js";
|
|
14
|
+
export type { Json, JsonObject, Job, StepHandler, DeclarativeFlow, DeclarativeStep, FlowNode, SwitchCase, TimerStart, ToolExposure, NodeEnvelopes, StepContract, FlowContracts, ImperativeWorkflow, Orchestration, WorkflowContext, Workflow, DeployResult, StartResult, } from "./types.js";
|
|
@@ -112,6 +112,29 @@ export interface DeclarativeFlow {
|
|
|
112
112
|
* takes; a host can render a start form from it and check start variables
|
|
113
113
|
* with {@link validateEnvelope}. Absent = untyped start. */
|
|
114
114
|
input?: Envelope;
|
|
115
|
+
/** When set, the flow is exposed as an MCP tool: its start event renders as a
|
|
116
|
+
* MESSAGE start carrying the `io.camunda.tool:*` properties (see
|
|
117
|
+
* {@link ToolExposure}). Set by `w.exposeAsTool(...)`. */
|
|
118
|
+
tool?: ToolExposure;
|
|
119
|
+
}
|
|
120
|
+
/** How a flow is exposed as an MCP tool (`w.exposeAsTool(...)`). Emitted as the
|
|
121
|
+
* Camunda `io.camunda.tool:*` `zeebe:properties` on a message start event (the
|
|
122
|
+
* bindings of the `io.camunda.mcp.start-message` template). The typed
|
|
123
|
+
* `io.camunda.tool:input_N_*` superset is DERIVED from the flow's `Start` input
|
|
124
|
+
* envelope — never restated here. */
|
|
125
|
+
export interface ToolExposure {
|
|
126
|
+
/** The tool name (`io.camunda.tool:name`). */
|
|
127
|
+
name: string;
|
|
128
|
+
/** What the tool does (`io.camunda.tool:purpose`). */
|
|
129
|
+
purpose: string;
|
|
130
|
+
/** Free-text description of the inputs (`io.camunda.tool:inputs`). */
|
|
131
|
+
inputs?: string;
|
|
132
|
+
/** When an agent should call it (`io.camunda.tool:when_to_use`). */
|
|
133
|
+
whenToUse?: string;
|
|
134
|
+
/** When an agent should not call it (`io.camunda.tool:when_not_to_use`). */
|
|
135
|
+
whenNotToUse?: string;
|
|
136
|
+
/** What the tool returns (`io.camunda.tool:results`). */
|
|
137
|
+
results?: string;
|
|
115
138
|
}
|
|
116
139
|
/** The context passed to an imperative orchestration function. */
|
|
117
140
|
export interface WorkflowContext {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanobpm/workflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Code-first durable orchestration for nanobpmn (ADR 0044/0045). Author a durable workflow as a declarative flow — `defineFlow(id, w => { w.run(...); w.signal(...); w.task(...) })` — and the SDK derives the executable BPMN model, the job types, and the message/correlation wiring, then hosts a generic worker. `w.run` is a local step, `w.signal` is a durable human-in-the-loop wait, `w.task` is a step serviced by an external worker. `defineFlow` is the single code-first surface; the imperative `defineWorkflow` replay function is experimental/internal, not a recommended API. No diagram, no task-type wiring, no correlation plumbing authored by hand — and you can optionally auto-generate a diagram (DI) for the derived model with `declarativeToLayoutedBpmn` via the optional `bpmn-auto-layout` peer dependency. Talks to a running nanobpmn gateway through @nanobpm/nano-sdk (the shared engine-transport spine — ADR 0055), which negotiates the Falcon protocol on a Nano server and REST elsewhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nanobpm/nano-agent-graph-engine",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
4
4
|
"description": "Durable BPMN process engine for Claude Code: code-first flows (defineFlow) that orchestrate scripts, Claude Code agents and people.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -61,9 +61,9 @@
|
|
|
61
61
|
"@modelcontextprotocol/ext-apps": "^1.7.5",
|
|
62
62
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
63
63
|
"@nanobpm/agentic": "^0.16.0",
|
|
64
|
-
"@nanobpm/engine-wasm": "^0.
|
|
64
|
+
"@nanobpm/engine-wasm": "^0.12.0",
|
|
65
65
|
"@nanobpm/nano-app-schema": "^0.11.0",
|
|
66
|
-
"@nanobpm/workflow": "^0.
|
|
66
|
+
"@nanobpm/workflow": "^0.20.0",
|
|
67
67
|
"@tailwindcss/cli": "^4.3.5",
|
|
68
68
|
"@tanstack/react-query": "^5.107.1",
|
|
69
69
|
"@types/node": "^26.6.6",
|