c8ctl-plugin-nano 1.43.1 → 1.43.2
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/c8ctl-plugin.js +60 -6
- package/package.json +8 -8
package/c8ctl-plugin.js
CHANGED
|
@@ -2588,13 +2588,64 @@ function resolveAutoRestConfig(camunda, env = process.env) {
|
|
|
2588
2588
|
// dot-grammar.
|
|
2589
2589
|
// ---------------------------------------------------------------------------
|
|
2590
2590
|
|
|
2591
|
+
// Legacy (pre-nano-workforce#203) agent-task marker: a service task carried the
|
|
2592
|
+
// agent's prompt in an `io.nanobpm.agentTask.*` `<zeebe:header>` rather than a
|
|
2593
|
+
// `linkName="prompt"` linked resource. The current package detector
|
|
2594
|
+
// (`scanTaskDefinitions`, whose `agentic` flag keys SOLELY off the linked-prompt
|
|
2595
|
+
// side-car) therefore reports `agentic:false` for such tasks. We keep a narrow,
|
|
2596
|
+
// self-contained fallback so `--auto` still discovers agent job types against an
|
|
2597
|
+
// engine still holding a pre-#203 deployment (issue #120 acceptance criterion:
|
|
2598
|
+
// "Legacy header-based BPMN still discovers correctly"). This is a supplement to
|
|
2599
|
+
// — never a replacement for — the package flag: the authoritative task-type /
|
|
2600
|
+
// process derivation still comes from `scanTaskDefinitions`; this only answers
|
|
2601
|
+
// "is this leaf an agent task?" for the legacy shape.
|
|
2602
|
+
//
|
|
2603
|
+
// True when `body` (a service task's inner XML) declares any
|
|
2604
|
+
// `io.nanobpm.agentTask*` `<zeebe:header>` key — the sole such header on a
|
|
2605
|
+
// pre-#203 agent service task. The regex is compiled once (it is called once
|
|
2606
|
+
// per matched `<serviceTask>` during `--auto` scans, so recompiling per call
|
|
2607
|
+
// would allocate needlessly across many deployed definitions).
|
|
2608
|
+
const AGENT_TASK_HEADER_RE = new RegExp(
|
|
2609
|
+
`<(?:\\w+:)?header\\b[^>]*\\bkey\\s*=\\s*(["'])${AGENT_TASK_NS.replace(/[.]/g, '\\.')}(?:\\.[^"']*)?\\1`,
|
|
2610
|
+
'i'
|
|
2611
|
+
);
|
|
2612
|
+
function serviceTaskHasAgentHeader(body) {
|
|
2613
|
+
return AGENT_TASK_HEADER_RE.test(String(body || ''));
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
// The set of service-task element ids in `xml` bearing the legacy agent-task
|
|
2617
|
+
// header. Correlates back to `scanTaskDefinitions` leaves by `elementId`, so a
|
|
2618
|
+
// leaf is treated as legacy-agentic only when it ALSO has a `taskDefinition type`
|
|
2619
|
+
// (the package only yields leaves that do) — matching the issue rule "prompt link
|
|
2620
|
+
// OR legacy header, AND a non-empty task type".
|
|
2621
|
+
function legacyAgentHeaderElementIds(xml) {
|
|
2622
|
+
const ids = new Set();
|
|
2623
|
+
const src = String(xml || '');
|
|
2624
|
+
// Cheap guard: a legacy agent-task header always contains the literal
|
|
2625
|
+
// `io.nanobpm.agentTask` namespace, so a document lacking that substring
|
|
2626
|
+
// cannot match — skip the full `<serviceTask>` walk entirely. This avoids
|
|
2627
|
+
// parsing every deployed definition in `--auto` enrolment loops when none
|
|
2628
|
+
// carry the legacy marker.
|
|
2629
|
+
if (!src.includes(AGENT_TASK_NS)) return ids;
|
|
2630
|
+
const taskRe =
|
|
2631
|
+
/<(?:\w+:)?serviceTask\b[^>]*?\bid\s*=\s*(["'])(.*?)\1[^>]*?>([\s\S]*?)<\/(?:\w+:)?serviceTask>/g;
|
|
2632
|
+
let m;
|
|
2633
|
+
while ((m = taskRe.exec(src)) !== null) {
|
|
2634
|
+
if (serviceTaskHasAgentHeader(m[3])) ids.add(m[2]);
|
|
2635
|
+
}
|
|
2636
|
+
return ids;
|
|
2637
|
+
}
|
|
2638
|
+
|
|
2591
2639
|
// Scan one deployed BPMN document for its *agent* task-definition leaves: the
|
|
2592
2640
|
// subset of `@nanobpm/agentic` `demand.scanTaskDefinitions(xml)` leaves whose
|
|
2593
2641
|
// canonical `agentic` flag is set (i.e. the service task declares a
|
|
2594
|
-
// `linkName="prompt"` linked resource)
|
|
2595
|
-
//
|
|
2596
|
-
//
|
|
2597
|
-
//
|
|
2642
|
+
// `linkName="prompt"` linked resource) OR — for backward compatibility with
|
|
2643
|
+
// pre-#203 deployments — which carry the legacy `io.nanobpm.agentTask` header.
|
|
2644
|
+
// Returns `{ taskType, process }` leaves in first-occurrence order; a task
|
|
2645
|
+
// matched by both signals is the same leaf, so it is emitted once. The published
|
|
2646
|
+
// `scanTaskDefinitions` is INJECTED so this stays a pure, synchronous function;
|
|
2647
|
+
// `readDeployedAgentJobTypes` supplies the real one from the lazily-imported
|
|
2648
|
+
// demand surface (`agentic.mjs`).
|
|
2598
2649
|
function scanAgentTaskLeaves(xml, scanTaskDefinitions) {
|
|
2599
2650
|
if (typeof scanTaskDefinitions !== 'function') {
|
|
2600
2651
|
throw new TypeError(
|
|
@@ -2602,8 +2653,10 @@ function scanAgentTaskLeaves(xml, scanTaskDefinitions) {
|
|
|
2602
2653
|
`(got ${typeof scanTaskDefinitions}); pass demand.scanTaskDefinitions from ./agentic.mjs`
|
|
2603
2654
|
);
|
|
2604
2655
|
}
|
|
2605
|
-
|
|
2606
|
-
|
|
2656
|
+
const src = String(xml || '');
|
|
2657
|
+
const legacyIds = legacyAgentHeaderElementIds(src);
|
|
2658
|
+
return scanTaskDefinitions(src)
|
|
2659
|
+
.filter((leaf) => leaf.agentic || legacyIds.has(leaf.elementId))
|
|
2607
2660
|
.map((leaf) => ({ taskType: leaf.taskType, process: leaf.process }));
|
|
2608
2661
|
}
|
|
2609
2662
|
|
|
@@ -10820,6 +10873,7 @@ export {
|
|
|
10820
10873
|
diffJobTypes,
|
|
10821
10874
|
parseJobTypeFlags,
|
|
10822
10875
|
scanAgentTaskLeaves,
|
|
10876
|
+
serviceTaskHasAgentHeader,
|
|
10823
10877
|
readDeployedAgentJobTypes,
|
|
10824
10878
|
resolveAutoJobTypes,
|
|
10825
10879
|
workAgent,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c8ctl-plugin-nano",
|
|
3
|
-
"version": "1.43.
|
|
3
|
+
"version": "1.43.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "c8ctl plugin to start, inspect, and stop a local Nano BPM (nanobpmn) cluster",
|
|
6
6
|
"main": "c8ctl-plugin.js",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
},
|
|
58
58
|
"optionalDependencies": {
|
|
59
59
|
"node-pty": "^1.0.0",
|
|
60
|
-
"@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.43.
|
|
61
|
-
"@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.43.
|
|
62
|
-
"@nanobpm/c8ctl-plugin-nano-linux-x64": "1.43.
|
|
63
|
-
"@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.43.
|
|
64
|
-
"@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.43.
|
|
65
|
-
"@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.43.
|
|
66
|
-
"@nanobpm/c8ctl-plugin-nano-win32-x64": "1.43.
|
|
60
|
+
"@nanobpm/c8ctl-plugin-nano-darwin-arm64": "1.43.2",
|
|
61
|
+
"@nanobpm/c8ctl-plugin-nano-darwin-x64": "1.43.2",
|
|
62
|
+
"@nanobpm/c8ctl-plugin-nano-linux-x64": "1.43.2",
|
|
63
|
+
"@nanobpm/c8ctl-plugin-nano-linux-arm64": "1.43.2",
|
|
64
|
+
"@nanobpm/c8ctl-plugin-nano-linux-armv7": "1.43.2",
|
|
65
|
+
"@nanobpm/c8ctl-plugin-nano-linux-armv6": "1.43.2",
|
|
66
|
+
"@nanobpm/c8ctl-plugin-nano-win32-x64": "1.43.2"
|
|
67
67
|
}
|
|
68
68
|
}
|