@nodetool-ai/execution 0.8.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/README.md +129 -0
- package/dist/.nodetool-build-stamp +1 -0
- package/dist/app-debug/app-spec.d.ts +94 -0
- package/dist/app-debug/app-spec.d.ts.map +1 -0
- package/dist/app-debug/app-spec.js +710 -0
- package/dist/app-debug/app-spec.js.map +1 -0
- package/dist/app-debug/application-target.d.ts +53 -0
- package/dist/app-debug/application-target.d.ts.map +1 -0
- package/dist/app-debug/application-target.js +126 -0
- package/dist/app-debug/application-target.js.map +1 -0
- package/dist/app-debug/bundle-target.d.ts +21 -0
- package/dist/app-debug/bundle-target.d.ts.map +1 -0
- package/dist/app-debug/bundle-target.js +51 -0
- package/dist/app-debug/bundle-target.js.map +1 -0
- package/dist/app-debug/graph-shape.d.ts +14 -0
- package/dist/app-debug/graph-shape.d.ts.map +1 -0
- package/dist/app-debug/graph-shape.js +23 -0
- package/dist/app-debug/graph-shape.js.map +1 -0
- package/dist/app-debug/index.d.ts +26 -0
- package/dist/app-debug/index.d.ts.map +1 -0
- package/dist/app-debug/index.js +19 -0
- package/dist/app-debug/index.js.map +1 -0
- package/dist/app-debug/markdown.d.ts +6 -0
- package/dist/app-debug/markdown.d.ts.map +1 -0
- package/dist/app-debug/markdown.js +133 -0
- package/dist/app-debug/markdown.js.map +1 -0
- package/dist/app-debug/runtime.d.ts +267 -0
- package/dist/app-debug/runtime.d.ts.map +1 -0
- package/dist/app-debug/runtime.js +633 -0
- package/dist/app-debug/runtime.js.map +1 -0
- package/dist/app-debug/script-operation.d.ts +58 -0
- package/dist/app-debug/script-operation.d.ts.map +1 -0
- package/dist/app-debug/script-operation.js +44 -0
- package/dist/app-debug/script-operation.js.map +1 -0
- package/dist/app-debug/simulate.d.ts +85 -0
- package/dist/app-debug/simulate.d.ts.map +1 -0
- package/dist/app-debug/simulate.js +991 -0
- package/dist/app-debug/simulate.js.map +1 -0
- package/dist/app-debug/summarize.d.ts +64 -0
- package/dist/app-debug/summarize.d.ts.map +1 -0
- package/dist/app-debug/summarize.js +65 -0
- package/dist/app-debug/summarize.js.map +1 -0
- package/dist/app-debug/types.d.ts +343 -0
- package/dist/app-debug/types.d.ts.map +1 -0
- package/dist/app-debug/types.js +2 -0
- package/dist/app-debug/types.js.map +1 -0
- package/dist/cost-ledger.d.ts +147 -0
- package/dist/cost-ledger.d.ts.map +1 -0
- package/dist/cost-ledger.js +288 -0
- package/dist/cost-ledger.js.map +1 -0
- package/dist/debug/collector.d.ts +28 -0
- package/dist/debug/collector.d.ts.map +1 -0
- package/dist/debug/collector.js +284 -0
- package/dist/debug/collector.js.map +1 -0
- package/dist/debug/index.d.ts +15 -0
- package/dist/debug/index.d.ts.map +1 -0
- package/dist/debug/index.js +16 -0
- package/dist/debug/index.js.map +1 -0
- package/dist/debug/types.d.ts +179 -0
- package/dist/debug/types.d.ts.map +1 -0
- package/dist/debug/types.js +11 -0
- package/dist/debug/types.js.map +1 -0
- package/dist/debug/verdict.d.ts +27 -0
- package/dist/debug/verdict.d.ts.map +1 -0
- package/dist/debug/verdict.js +51 -0
- package/dist/debug/verdict.js.map +1 -0
- package/dist/executor-resolver.d.ts +13 -0
- package/dist/executor-resolver.d.ts.map +1 -0
- package/dist/executor-resolver.js +13 -0
- package/dist/executor-resolver.js.map +1 -0
- package/dist/fal-output-decoder.d.ts +36 -0
- package/dist/fal-output-decoder.d.ts.map +1 -0
- package/dist/fal-output-decoder.js +129 -0
- package/dist/fal-output-decoder.js.map +1 -0
- package/dist/generation-lifecycle.d.ts +54 -0
- package/dist/generation-lifecycle.d.ts.map +1 -0
- package/dist/generation-lifecycle.js +431 -0
- package/dist/generation-lifecycle.js.map +1 -0
- package/dist/generation-recovery-worker.d.ts +100 -0
- package/dist/generation-recovery-worker.d.ts.map +1 -0
- package/dist/generation-recovery-worker.js +995 -0
- package/dist/generation-recovery-worker.js.map +1 -0
- package/dist/generation-tracker.d.ts +83 -0
- package/dist/generation-tracker.d.ts.map +1 -0
- package/dist/generation-tracker.js +436 -0
- package/dist/generation-tracker.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/js-script-debug/index.d.ts +13 -0
- package/dist/js-script-debug/index.d.ts.map +1 -0
- package/dist/js-script-debug/index.js +12 -0
- package/dist/js-script-debug/index.js.map +1 -0
- package/dist/js-script-debug/markdown.d.ts +6 -0
- package/dist/js-script-debug/markdown.d.ts.map +1 -0
- package/dist/js-script-debug/markdown.js +62 -0
- package/dist/js-script-debug/markdown.js.map +1 -0
- package/dist/js-script-debug/outputs.d.ts +20 -0
- package/dist/js-script-debug/outputs.d.ts.map +1 -0
- package/dist/js-script-debug/outputs.js +30 -0
- package/dist/js-script-debug/outputs.js.map +1 -0
- package/dist/js-script-debug/report.d.ts +15 -0
- package/dist/js-script-debug/report.d.ts.map +1 -0
- package/dist/js-script-debug/report.js +90 -0
- package/dist/js-script-debug/report.js.map +1 -0
- package/dist/js-script-debug/types.d.ts +63 -0
- package/dist/js-script-debug/types.d.ts.map +1 -0
- package/dist/js-script-debug/types.js +10 -0
- package/dist/js-script-debug/types.js.map +1 -0
- package/dist/js-script-debug/validate.d.ts +38 -0
- package/dist/js-script-debug/validate.d.ts.map +1 -0
- package/dist/js-script-debug/validate.js +137 -0
- package/dist/js-script-debug/validate.js.map +1 -0
- package/dist/message-stream.d.ts +33 -0
- package/dist/message-stream.d.ts.map +1 -0
- package/dist/message-stream.js +58 -0
- package/dist/message-stream.js.map +1 -0
- package/dist/normalize-graph.d.ts +13 -0
- package/dist/normalize-graph.d.ts.map +1 -0
- package/dist/normalize-graph.js +63 -0
- package/dist/normalize-graph.js.map +1 -0
- package/dist/output-names.d.ts +13 -0
- package/dist/output-names.d.ts.map +1 -0
- package/dist/output-names.js +13 -0
- package/dist/output-names.js.map +1 -0
- package/dist/predicates.d.ts +6 -0
- package/dist/predicates.d.ts.map +1 -0
- package/dist/predicates.js +6 -0
- package/dist/predicates.js.map +1 -0
- package/dist/preflight.d.ts +87 -0
- package/dist/preflight.d.ts.map +1 -0
- package/dist/preflight.js +139 -0
- package/dist/preflight.js.map +1 -0
- package/dist/provider-secret-key.d.ts +3 -0
- package/dist/provider-secret-key.d.ts.map +1 -0
- package/dist/provider-secret-key.js +7 -0
- package/dist/provider-secret-key.js.map +1 -0
- package/dist/service/app-debug-service.d.ts +78 -0
- package/dist/service/app-debug-service.d.ts.map +1 -0
- package/dist/service/app-debug-service.js +201 -0
- package/dist/service/app-debug-service.js.map +1 -0
- package/dist/service/app-run-server.d.ts +28 -0
- package/dist/service/app-run-server.d.ts.map +1 -0
- package/dist/service/app-run-server.js +104 -0
- package/dist/service/app-run-server.js.map +1 -0
- package/dist/service/debug-sessions.d.ts +158 -0
- package/dist/service/debug-sessions.d.ts.map +1 -0
- package/dist/service/debug-sessions.js +358 -0
- package/dist/service/debug-sessions.js.map +1 -0
- package/dist/service/index.d.ts +22 -0
- package/dist/service/index.d.ts.map +1 -0
- package/dist/service/index.js +17 -0
- package/dist/service/index.js.map +1 -0
- package/dist/service/job-progress.d.ts +40 -0
- package/dist/service/job-progress.d.ts.map +1 -0
- package/dist/service/job-progress.js +53 -0
- package/dist/service/job-progress.js.map +1 -0
- package/dist/service/workflow-run.d.ts +279 -0
- package/dist/service/workflow-run.d.ts.map +1 -0
- package/dist/service/workflow-run.js +598 -0
- package/dist/service/workflow-run.js.map +1 -0
- package/dist/service/workflow-workspace.d.ts +89 -0
- package/dist/service/workflow-workspace.d.ts.map +1 -0
- package/dist/service/workflow-workspace.js +160 -0
- package/dist/service/workflow-workspace.js.map +1 -0
- package/dist/session.d.ts +62 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +353 -0
- package/dist/session.js.map +1 -0
- package/dist/sketch-debug/index.d.ts +11 -0
- package/dist/sketch-debug/index.d.ts.map +1 -0
- package/dist/sketch-debug/index.js +10 -0
- package/dist/sketch-debug/index.js.map +1 -0
- package/dist/sketch-debug/markdown.d.ts +6 -0
- package/dist/sketch-debug/markdown.d.ts.map +1 -0
- package/dist/sketch-debug/markdown.js +93 -0
- package/dist/sketch-debug/markdown.js.map +1 -0
- package/dist/sketch-debug/report.d.ts +15 -0
- package/dist/sketch-debug/report.d.ts.map +1 -0
- package/dist/sketch-debug/report.js +98 -0
- package/dist/sketch-debug/report.js.map +1 -0
- package/dist/sketch-debug/types.d.ts +62 -0
- package/dist/sketch-debug/types.d.ts.map +1 -0
- package/dist/sketch-debug/types.js +10 -0
- package/dist/sketch-debug/types.js.map +1 -0
- package/dist/sketch-debug/validate.d.ts +14 -0
- package/dist/sketch-debug/validate.d.ts.map +1 -0
- package/dist/sketch-debug/validate.js +478 -0
- package/dist/sketch-debug/validate.js.map +1 -0
- package/dist/supervisor.d.ts +45 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +97 -0
- package/dist/supervisor.js.map +1 -0
- package/dist/timeline-debug/index.d.ts +11 -0
- package/dist/timeline-debug/index.d.ts.map +1 -0
- package/dist/timeline-debug/index.js +10 -0
- package/dist/timeline-debug/index.js.map +1 -0
- package/dist/timeline-debug/legibility.d.ts +23 -0
- package/dist/timeline-debug/legibility.d.ts.map +1 -0
- package/dist/timeline-debug/legibility.js +240 -0
- package/dist/timeline-debug/legibility.js.map +1 -0
- package/dist/timeline-debug/markdown.d.ts +6 -0
- package/dist/timeline-debug/markdown.d.ts.map +1 -0
- package/dist/timeline-debug/markdown.js +103 -0
- package/dist/timeline-debug/markdown.js.map +1 -0
- package/dist/timeline-debug/motion.d.ts +20 -0
- package/dist/timeline-debug/motion.d.ts.map +1 -0
- package/dist/timeline-debug/motion.js +362 -0
- package/dist/timeline-debug/motion.js.map +1 -0
- package/dist/timeline-debug/report.d.ts +16 -0
- package/dist/timeline-debug/report.d.ts.map +1 -0
- package/dist/timeline-debug/report.js +100 -0
- package/dist/timeline-debug/report.js.map +1 -0
- package/dist/timeline-debug/showcase.d.ts +7 -0
- package/dist/timeline-debug/showcase.d.ts.map +1 -0
- package/dist/timeline-debug/showcase.js +347 -0
- package/dist/timeline-debug/showcase.js.map +1 -0
- package/dist/timeline-debug/types.d.ts +64 -0
- package/dist/timeline-debug/types.d.ts.map +1 -0
- package/dist/timeline-debug/types.js +10 -0
- package/dist/timeline-debug/types.js.map +1 -0
- package/dist/timeline-debug/validate.d.ts +24 -0
- package/dist/timeline-debug/validate.d.ts.map +1 -0
- package/dist/timeline-debug/validate.js +1432 -0
- package/dist/timeline-debug/validate.js.map +1 -0
- package/dist/types.d.ts +211 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +103 -0
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { isNumber, isObjectLike, isString } from "../predicates.js";
|
|
2
|
+
/**
|
|
3
|
+
* The deciders a `supervisor_decision` may name. Written as a total record so
|
|
4
|
+
* a new value in the protocol enum fails this file rather than slipping
|
|
5
|
+
* through as an unrecognized string.
|
|
6
|
+
*/
|
|
7
|
+
const DECIDED_BY = {
|
|
8
|
+
agent: true,
|
|
9
|
+
sticky: true,
|
|
10
|
+
bounds: true,
|
|
11
|
+
default: true,
|
|
12
|
+
kernel: true
|
|
13
|
+
};
|
|
14
|
+
const MAX_STRING_PREVIEW = 2000;
|
|
15
|
+
const MAX_ARRAY_PREVIEW = 50;
|
|
16
|
+
/** Fields that commonly carry base64 / data-URI payloads worth collapsing. */
|
|
17
|
+
const BLOB_KEYS = new Set(["data", "uri", "b64_json", "base64"]);
|
|
18
|
+
const BLOB_KEEP = 64;
|
|
19
|
+
export function previewValue(value, maxLen = MAX_STRING_PREVIEW) {
|
|
20
|
+
if (isString(value)) {
|
|
21
|
+
return value.length > maxLen
|
|
22
|
+
? `${value.slice(0, maxLen)}…[${value.length} chars]`
|
|
23
|
+
: value;
|
|
24
|
+
}
|
|
25
|
+
if (value instanceof Uint8Array) {
|
|
26
|
+
return `<binary ${value.byteLength} bytes>`;
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
const head = value
|
|
30
|
+
.slice(0, MAX_ARRAY_PREVIEW)
|
|
31
|
+
.map((v) => previewValue(v, maxLen));
|
|
32
|
+
return value.length > MAX_ARRAY_PREVIEW
|
|
33
|
+
? [...head, `…[${value.length - MAX_ARRAY_PREVIEW} more]`]
|
|
34
|
+
: head;
|
|
35
|
+
}
|
|
36
|
+
if (isObjectLike(value)) {
|
|
37
|
+
const out = {};
|
|
38
|
+
for (const [k, v] of Object.entries(value)) {
|
|
39
|
+
if (BLOB_KEYS.has(k) && isString(v) && v.length > 256) {
|
|
40
|
+
out[k] = `${v.slice(0, BLOB_KEEP)}…[${v.length} chars]`;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
out[k] = previewValue(v, maxLen);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
// SAFETY: strings, binary, arrays and objects are handled above; what is
|
|
49
|
+
// left is a JSON scalar the report can carry as it stands.
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
function emptyNode(nodeId) {
|
|
53
|
+
return {
|
|
54
|
+
nodeId,
|
|
55
|
+
nodeType: null,
|
|
56
|
+
nodeName: null,
|
|
57
|
+
status: "pending",
|
|
58
|
+
error: null,
|
|
59
|
+
outputs: [],
|
|
60
|
+
cost: null
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Reduce a processing-message stream into a structured execution summary.
|
|
65
|
+
*
|
|
66
|
+
* Accepts loosely-typed messages (the browser harness decodes JSON into bags of
|
|
67
|
+
* unknown fields) and reads only the fields each `type` is known to carry.
|
|
68
|
+
*/
|
|
69
|
+
export function collectExecutionSummary(messages) {
|
|
70
|
+
const nodes = new Map();
|
|
71
|
+
const logs = [];
|
|
72
|
+
const edges = new Map();
|
|
73
|
+
const llmCalls = [];
|
|
74
|
+
const outputs = [];
|
|
75
|
+
const interventions = [];
|
|
76
|
+
let status = "unknown";
|
|
77
|
+
let error = null;
|
|
78
|
+
const node = (id) => {
|
|
79
|
+
let n = nodes.get(id);
|
|
80
|
+
if (!n) {
|
|
81
|
+
n = emptyNode(id);
|
|
82
|
+
nodes.set(id, n);
|
|
83
|
+
}
|
|
84
|
+
return n;
|
|
85
|
+
};
|
|
86
|
+
const str = (v) => (isString(v) ? v : null);
|
|
87
|
+
const num = (v) => (isNumber(v) ? v : null);
|
|
88
|
+
for (const raw of messages) {
|
|
89
|
+
const msg = raw;
|
|
90
|
+
switch (msg.type) {
|
|
91
|
+
case "job_update": {
|
|
92
|
+
status = str(msg.status) ?? status;
|
|
93
|
+
const e = str(msg.error);
|
|
94
|
+
if (e)
|
|
95
|
+
error = e;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case "node_update": {
|
|
99
|
+
const id = str(msg.node_id);
|
|
100
|
+
if (!id)
|
|
101
|
+
break;
|
|
102
|
+
const n = node(id);
|
|
103
|
+
n.nodeType = str(msg.node_type) ?? n.nodeType;
|
|
104
|
+
n.nodeName = str(msg.node_name) ?? n.nodeName;
|
|
105
|
+
const s = str(msg.status);
|
|
106
|
+
if (s)
|
|
107
|
+
n.status = s;
|
|
108
|
+
// A node_update can carry a stale/empty error field while completing —
|
|
109
|
+
// only record an error when the status itself says so.
|
|
110
|
+
if (s === "error" || s === "failed") {
|
|
111
|
+
n.error = str(msg.error) || s;
|
|
112
|
+
}
|
|
113
|
+
const cost = msg.provider_cost;
|
|
114
|
+
if (isObjectLike(cost)) {
|
|
115
|
+
n.cost = {
|
|
116
|
+
provider: str(cost.provider) ?? "",
|
|
117
|
+
amount: num(cost.amount) ?? 0,
|
|
118
|
+
unit: str(cost.unit) ?? "",
|
|
119
|
+
currency: str(cost.currency)
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
case "generation_complete": {
|
|
125
|
+
const id = str(msg.node_id);
|
|
126
|
+
if (!id)
|
|
127
|
+
break;
|
|
128
|
+
const n = node(id);
|
|
129
|
+
n.nodeType = str(msg.node_type) ?? n.nodeType;
|
|
130
|
+
n.nodeName = str(msg.node_name) ?? n.nodeName;
|
|
131
|
+
const out = msg.outputs ?? {};
|
|
132
|
+
for (const [name, v] of Object.entries(out)) {
|
|
133
|
+
n.outputs.push({
|
|
134
|
+
outputName: name,
|
|
135
|
+
outputType: typeof v,
|
|
136
|
+
value: previewValue(v)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "output_update": {
|
|
142
|
+
const id = str(msg.node_id) ?? undefined;
|
|
143
|
+
const o = {
|
|
144
|
+
nodeId: id,
|
|
145
|
+
outputName: str(msg.output_name) ?? "output",
|
|
146
|
+
outputType: str(msg.output_type) ?? typeof msg.value,
|
|
147
|
+
value: previewValue(msg.value)
|
|
148
|
+
};
|
|
149
|
+
outputs.push(o);
|
|
150
|
+
if (id) {
|
|
151
|
+
const n = node(id);
|
|
152
|
+
n.nodeName = str(msg.node_name) ?? n.nodeName;
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case "node_progress": {
|
|
157
|
+
const id = str(msg.node_id);
|
|
158
|
+
if (!id)
|
|
159
|
+
break;
|
|
160
|
+
node(id).progress = {
|
|
161
|
+
progress: num(msg.progress) ?? 0,
|
|
162
|
+
total: num(msg.total) ?? 0
|
|
163
|
+
};
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case "edge_update": {
|
|
167
|
+
const id = str(msg.edge_id);
|
|
168
|
+
if (!id)
|
|
169
|
+
break;
|
|
170
|
+
edges.set(id, {
|
|
171
|
+
edgeId: id,
|
|
172
|
+
status: str(msg.status) ?? "",
|
|
173
|
+
counter: num(msg.counter)
|
|
174
|
+
});
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case "log_update": {
|
|
178
|
+
logs.push({
|
|
179
|
+
nodeId: str(msg.node_id),
|
|
180
|
+
nodeName: str(msg.node_name),
|
|
181
|
+
severity: str(msg.severity) ?? "info",
|
|
182
|
+
content: str(msg.content) ?? ""
|
|
183
|
+
});
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
case "error": {
|
|
187
|
+
const message = str(msg.message) ?? "unknown error";
|
|
188
|
+
if (!error)
|
|
189
|
+
error = message;
|
|
190
|
+
logs.push({ nodeId: null, severity: "error", content: message });
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
case "supervisor_decision": {
|
|
194
|
+
const intervention = readIntervention(msg);
|
|
195
|
+
if (intervention)
|
|
196
|
+
interventions.push(intervention);
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case "llm_call": {
|
|
200
|
+
llmCalls.push({
|
|
201
|
+
nodeId: str(msg.node_id) ?? "",
|
|
202
|
+
provider: str(msg.provider) ?? "",
|
|
203
|
+
model: str(msg.model) ?? "",
|
|
204
|
+
tokensInput: num(msg.tokens_input),
|
|
205
|
+
tokensOutput: num(msg.tokens_output),
|
|
206
|
+
cost: num(msg.cost),
|
|
207
|
+
durationMs: num(msg.duration_ms) ?? 0,
|
|
208
|
+
error: str(msg.error)
|
|
209
|
+
});
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
default:
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const nodeList = [...nodes.values()];
|
|
217
|
+
const errored = nodeList.filter((n) => n.error);
|
|
218
|
+
const errors = errored.map((n) => ({
|
|
219
|
+
nodeId: n.nodeId,
|
|
220
|
+
nodeType: n.nodeType,
|
|
221
|
+
message: n.error
|
|
222
|
+
}));
|
|
223
|
+
if (error && !errors.some((e) => e.message === error)) {
|
|
224
|
+
errors.unshift({ nodeId: null, nodeType: null, message: error });
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
status,
|
|
228
|
+
error,
|
|
229
|
+
nodes: nodeList,
|
|
230
|
+
logs,
|
|
231
|
+
edges: [...edges.values()],
|
|
232
|
+
llmCalls,
|
|
233
|
+
outputs,
|
|
234
|
+
interventions,
|
|
235
|
+
counts: {
|
|
236
|
+
nodes: nodeList.length,
|
|
237
|
+
completed: nodeList.filter((n) => n.status === "completed").length,
|
|
238
|
+
errored: errored.length,
|
|
239
|
+
logs: logs.length,
|
|
240
|
+
outputs: outputs.length,
|
|
241
|
+
llmCalls: llmCalls.length,
|
|
242
|
+
interventions: interventions.length
|
|
243
|
+
},
|
|
244
|
+
errors
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Read a `supervisor_decision` message as an `Intervention`.
|
|
249
|
+
*
|
|
250
|
+
* Structural rather than schema-validated: this module stays free of runtime
|
|
251
|
+
* imports (the browser harness feeds it decoded JSON bags), so it checks the
|
|
252
|
+
* fields the record is keyed on and drops anything else. A message the kernel
|
|
253
|
+
* emitted always passes.
|
|
254
|
+
*/
|
|
255
|
+
function readIntervention(msg) {
|
|
256
|
+
const escalation = msg.escalation;
|
|
257
|
+
const verdict = msg.verdict;
|
|
258
|
+
if (!isObjectLike(escalation))
|
|
259
|
+
return null;
|
|
260
|
+
if (!isObjectLike(verdict))
|
|
261
|
+
return null;
|
|
262
|
+
if (!isString(verdict.action))
|
|
263
|
+
return null;
|
|
264
|
+
const decidedBy = msg.decided_by;
|
|
265
|
+
// `decided_by` is required by the message schema, and only `"agent"` means a
|
|
266
|
+
// model was involved. Guessing it would misreport who decided — and inflate
|
|
267
|
+
// the agent-decision count the cost rollup reads — so an unrecognized value
|
|
268
|
+
// drops the record rather than defaulting.
|
|
269
|
+
if (!isString(decidedBy))
|
|
270
|
+
return null;
|
|
271
|
+
if (!Object.prototype.hasOwnProperty.call(DECIDED_BY, decidedBy))
|
|
272
|
+
return null;
|
|
273
|
+
const cost = msg.cost;
|
|
274
|
+
const intervention = {
|
|
275
|
+
escalation: escalation,
|
|
276
|
+
verdict: verdict,
|
|
277
|
+
decidedBy: decidedBy
|
|
278
|
+
};
|
|
279
|
+
if (isNumber(cost)) {
|
|
280
|
+
intervention.costUsd = cost;
|
|
281
|
+
}
|
|
282
|
+
return intervention;
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/debug/collector.ts"],"names":[],"mappings":"AAiBA,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,QAAQ,EACT,MAAM,kBAAkB,CAAC;AAK1B;;;;GAIG;AACH,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE,IAAI;IACX,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;IACZ,OAAO,EAAE,IAAI;IACb,MAAM,EAAE,IAAI;CACqC,CAAC;AAEpD,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAC7B,8EAA8E;AAC9E,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;AACjE,MAAM,SAAS,GAAG,EAAE,CAAC;AAiBrB,MAAM,UAAU,YAAY,CAC1B,KAAc,EACd,MAAM,GAAW,kBAAkB;IAEnC,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM;YAC1B,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,KAAK,CAAC,MAAM,SAAS;YACrD,CAAC,CAAC,KAAK,CAAC;IACZ,CAAC;IACD,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;QAChC,OAAO,WAAW,KAAK,CAAC,UAAU,SAAS,CAAC;IAC9C,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,M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;;GAOG;AACH,SAAS,gBAAgB,CAAC,GAA4B;IACpD,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IAClC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC5B,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3C,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,CAAC,QAAQ,CAAE,OAAgC,CAAC,MAAM,CAAC;QAAE,OAAO,IAAI,CAAC;IACrE,MAAM,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC;IACjC,6EAA6E;IAC7E,4EAA4E;IAC5E,4EAA4E;IAC5E,2CAA2C;IAC3C,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9E,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;IAEtB,MAAM,YAAY,GAAuB;QACvC,UAAU,EAAE,UAAwC;QACpD,OAAO,EAAE,OAAkC;QAC3C,SAAS,EAAE,SAAsC;KAClD,CAAC;IACF,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug surface: one execution-summary vocabulary and one triage pass for
|
|
3
|
+
* every host that reports on a workflow run — the CLI debug harness, the HTTP
|
|
4
|
+
* debug endpoint, and the agent-facing `debug_workflow` tool.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately free of runtime dependencies (only `import type` crosses the
|
|
7
|
+
* package boundary), so a host can pull the reducer in without booting a
|
|
8
|
+
* session.
|
|
9
|
+
*/
|
|
10
|
+
export { collectExecutionSummary, previewValue } from "./collector.js";
|
|
11
|
+
export { INTERVENTION_MARK, formatInterventionLine, formatSupervisedSummary, summarizeInterventions } from "../supervisor.js";
|
|
12
|
+
export type { SupervisedRunSummary } from "../supervisor.js";
|
|
13
|
+
export { buildRunVerdict, collectInterventionWarnings, collectRunIssues, describeErrors } from "./verdict.js";
|
|
14
|
+
export type { DebugError, DebugGraph, DebugTargetInfo, DebugVerdict, EdgeDebug, ExecutionSummary, LlmCallDebug, LogEntry, NodeDebug, NodeOutput, RunVerdict, ServerRunReport, TraceSummary } from "./types.js";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/debug/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAIvE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,EACf,YAAY,EACb,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Debug surface: one execution-summary vocabulary and one triage pass for
|
|
3
|
+
* every host that reports on a workflow run — the CLI debug harness, the HTTP
|
|
4
|
+
* debug endpoint, and the agent-facing `debug_workflow` tool.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately free of runtime dependencies (only `import type` crosses the
|
|
7
|
+
* package boundary), so a host can pull the reducer in without booting a
|
|
8
|
+
* session.
|
|
9
|
+
*/
|
|
10
|
+
export { collectExecutionSummary, previewValue } from "./collector.js";
|
|
11
|
+
// Intervention reporting lives one level up (it is not debug-only) but is
|
|
12
|
+
// re-exported here so a host on this dependency-free subpath can print a
|
|
13
|
+
// supervised run without pulling the session facade's runtime deps.
|
|
14
|
+
export { INTERVENTION_MARK, formatInterventionLine, formatSupervisedSummary, summarizeInterventions } from "../supervisor.js";
|
|
15
|
+
export { buildRunVerdict, collectInterventionWarnings, collectRunIssues, describeErrors } from "./verdict.js";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/debug/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvE,0EAA0E;AAC1E,yEAAyE;AACzE,oEAAoE;AACpE,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,eAAe,EACf,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACf,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared debug-summary types.
|
|
3
|
+
*
|
|
4
|
+
* One vocabulary for "what happened in this run", used by every surface that
|
|
5
|
+
* reports on a workflow execution: the CLI debug harness, the HTTP debug
|
|
6
|
+
* endpoint the MCP `debug_workflow` tool calls, and the app-debug harness.
|
|
7
|
+
* They used to live in the CLI alone, so the agent-facing tool reported a
|
|
8
|
+
* different, thinner shape than the CLI did for the same run.
|
|
9
|
+
*/
|
|
10
|
+
import type { Intervention } from "@nodetool-ai/protocol";
|
|
11
|
+
import type { SupervisedRunSummary } from "../supervisor.js";
|
|
12
|
+
/** A single value emitted by a node (output_update / generation_complete). */
|
|
13
|
+
export interface NodeOutput {
|
|
14
|
+
nodeId?: string;
|
|
15
|
+
outputName: string;
|
|
16
|
+
outputType: string;
|
|
17
|
+
/** Preview-safe value: long strings + base64 blobs are truncated. */
|
|
18
|
+
value: unknown;
|
|
19
|
+
}
|
|
20
|
+
/** Per-node distilled execution state. */
|
|
21
|
+
export interface NodeDebug {
|
|
22
|
+
nodeId: string;
|
|
23
|
+
nodeType: string | null;
|
|
24
|
+
nodeName: string | null;
|
|
25
|
+
/** Last status seen for the node (pending | running | completed | error …). */
|
|
26
|
+
status: string;
|
|
27
|
+
error: string | null;
|
|
28
|
+
outputs: NodeOutput[];
|
|
29
|
+
progress?: {
|
|
30
|
+
progress: number;
|
|
31
|
+
total: number;
|
|
32
|
+
};
|
|
33
|
+
cost?: {
|
|
34
|
+
provider: string;
|
|
35
|
+
amount: number;
|
|
36
|
+
unit: string;
|
|
37
|
+
currency: string | null;
|
|
38
|
+
} | null;
|
|
39
|
+
}
|
|
40
|
+
export interface LogEntry {
|
|
41
|
+
nodeId: string | null;
|
|
42
|
+
nodeName?: string | null;
|
|
43
|
+
severity: string;
|
|
44
|
+
content: string;
|
|
45
|
+
}
|
|
46
|
+
export interface EdgeDebug {
|
|
47
|
+
edgeId: string;
|
|
48
|
+
status: string;
|
|
49
|
+
counter: number | null;
|
|
50
|
+
}
|
|
51
|
+
export interface LlmCallDebug {
|
|
52
|
+
nodeId: string;
|
|
53
|
+
provider: string;
|
|
54
|
+
model: string;
|
|
55
|
+
tokensInput: number | null;
|
|
56
|
+
tokensOutput: number | null;
|
|
57
|
+
cost: number | null;
|
|
58
|
+
durationMs: number;
|
|
59
|
+
error: string | null;
|
|
60
|
+
}
|
|
61
|
+
/** A collated error for quick triage. */
|
|
62
|
+
export interface DebugError {
|
|
63
|
+
nodeId: string | null;
|
|
64
|
+
nodeType?: string | null;
|
|
65
|
+
message: string;
|
|
66
|
+
}
|
|
67
|
+
/** Everything distilled from a run's processing-message stream. */
|
|
68
|
+
export interface ExecutionSummary {
|
|
69
|
+
/** Final job status (completed | failed | cancelled | …). */
|
|
70
|
+
status: string;
|
|
71
|
+
error: string | null;
|
|
72
|
+
nodes: NodeDebug[];
|
|
73
|
+
logs: LogEntry[];
|
|
74
|
+
edges: EdgeDebug[];
|
|
75
|
+
llmCalls: LlmCallDebug[];
|
|
76
|
+
/** Workflow-level outputs (Output / Preview nodes). */
|
|
77
|
+
outputs: NodeOutput[];
|
|
78
|
+
/**
|
|
79
|
+
* Supervisor decisions, in decision order — empty on an unsupervised run.
|
|
80
|
+
* Folded from `supervisor_decision` messages, so it is the same record the
|
|
81
|
+
* kernel puts on `RunResult.interventions`.
|
|
82
|
+
*/
|
|
83
|
+
interventions: Intervention[];
|
|
84
|
+
counts: {
|
|
85
|
+
nodes: number;
|
|
86
|
+
completed: number;
|
|
87
|
+
errored: number;
|
|
88
|
+
logs: number;
|
|
89
|
+
outputs: number;
|
|
90
|
+
llmCalls: number;
|
|
91
|
+
interventions: number;
|
|
92
|
+
};
|
|
93
|
+
errors: DebugError[];
|
|
94
|
+
}
|
|
95
|
+
/** Pass/fail plus the ordered, actionable issues behind it. */
|
|
96
|
+
export interface RunVerdict {
|
|
97
|
+
ok: boolean;
|
|
98
|
+
headline: string;
|
|
99
|
+
issues: string[];
|
|
100
|
+
}
|
|
101
|
+
/** A workflow graph in kernel/runner shape (properties, not data). */
|
|
102
|
+
export interface DebugGraph {
|
|
103
|
+
nodes: Array<Record<string, unknown>>;
|
|
104
|
+
edges: Array<Record<string, unknown>>;
|
|
105
|
+
}
|
|
106
|
+
/** How the workflow target was provided and what it resolved to. */
|
|
107
|
+
export interface DebugTargetInfo {
|
|
108
|
+
/** Original CLI argument (id, path/to/file.json, or path/to/file.ts). */
|
|
109
|
+
ref: string;
|
|
110
|
+
/**
|
|
111
|
+
* How `ref` was interpreted. `application` and `bundle` only occur for app
|
|
112
|
+
* targets: an application row read from the database, and an
|
|
113
|
+
* `ApplicationBundle` JSON file.
|
|
114
|
+
*/
|
|
115
|
+
source: "id" | "json" | "dsl" | "application" | "bundle";
|
|
116
|
+
/** Workflow id when known (DB id, or `id`/`workflow_id` field in a file). */
|
|
117
|
+
workflowId: string | null;
|
|
118
|
+
nodeCount: number;
|
|
119
|
+
edgeCount: number;
|
|
120
|
+
}
|
|
121
|
+
/** Rolled-up OpenTelemetry spans for the run. */
|
|
122
|
+
export interface TraceSummary {
|
|
123
|
+
spanCount: number;
|
|
124
|
+
/** Wall-clock span over all spans (max end − min start), ms. */
|
|
125
|
+
totalDurationMs: number | null;
|
|
126
|
+
tokens: {
|
|
127
|
+
input: number;
|
|
128
|
+
output: number;
|
|
129
|
+
total: number;
|
|
130
|
+
};
|
|
131
|
+
costUsd: number;
|
|
132
|
+
/** Count + total self-time by span name (llm.chat, node.process, …). */
|
|
133
|
+
byName: Record<string, {
|
|
134
|
+
count: number;
|
|
135
|
+
totalDurationMs: number;
|
|
136
|
+
}>;
|
|
137
|
+
/** Slowest spans, descending. */
|
|
138
|
+
slowest: Array<{
|
|
139
|
+
name: string;
|
|
140
|
+
durationMs: number;
|
|
141
|
+
status: string;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
export interface ServerRunReport {
|
|
145
|
+
surface: "server";
|
|
146
|
+
/** True when the job reached the `completed` status. */
|
|
147
|
+
ok: boolean;
|
|
148
|
+
status: string;
|
|
149
|
+
error: string | null;
|
|
150
|
+
durationMs: number;
|
|
151
|
+
summary: ExecutionSummary;
|
|
152
|
+
trace: TraceSummary | null;
|
|
153
|
+
/** Bundle-relative path to the raw messages JSONL. */
|
|
154
|
+
messagesFile?: string;
|
|
155
|
+
/** Bundle-relative path to the raw trace JSONL. */
|
|
156
|
+
traceFile?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Present only on a supervised run: who supervised it and the rollup of what
|
|
159
|
+
* they decided. The decisions themselves are `summary.interventions`.
|
|
160
|
+
*/
|
|
161
|
+
supervised?: {
|
|
162
|
+
provider: string;
|
|
163
|
+
model: string;
|
|
164
|
+
summary: SupervisedRunSummary;
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
/** A verdict that can also carry non-fatal observations. */
|
|
168
|
+
export interface DebugVerdict {
|
|
169
|
+
ok: boolean;
|
|
170
|
+
headline: string;
|
|
171
|
+
/** Human-readable problems found, ordered most-actionable first. */
|
|
172
|
+
issues: string[];
|
|
173
|
+
/**
|
|
174
|
+
* Things worth looking at that are not failures — a run cannot decide them
|
|
175
|
+
* either way. Unlike `issues`, these do not clear `ok`.
|
|
176
|
+
*/
|
|
177
|
+
warnings?: string[];
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/debug/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE7D,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,0CAA0C;AAC1C,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CA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|
+
* Shared debug-summary types.
|
|
3
|
+
*
|
|
4
|
+
* One vocabulary for "what happened in this run", used by every surface that
|
|
5
|
+
* reports on a workflow execution: the CLI debug harness, the HTTP debug
|
|
6
|
+
* endpoint the MCP `debug_workflow` tool calls, and the app-debug harness.
|
|
7
|
+
* They used to live in the CLI alone, so the agent-facing tool reported a
|
|
8
|
+
* different, thinner shape than the CLI did for the same run.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/debug/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns one run's execution summary into a pass/fail verdict plus the ordered
|
|
3
|
+
* issues behind it. Shared so the CLI harness and the HTTP debug endpoint
|
|
4
|
+
* (which the agent-facing `debug_workflow` tool calls) triage a run the same
|
|
5
|
+
* way instead of each host inventing its own idea of "clean".
|
|
6
|
+
*/
|
|
7
|
+
import type { DebugError, ExecutionSummary, RunVerdict } from "./types.js";
|
|
8
|
+
export declare function describeErrors(prefix: string, errors: ReadonlyArray<DebugError>, limit?: number): string[];
|
|
9
|
+
/** Issues found in a single surface's run, in triage order. */
|
|
10
|
+
export declare function collectRunIssues(prefix: string, summary: ExecutionSummary, outcome: {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
status: string;
|
|
13
|
+
error?: string | null;
|
|
14
|
+
}): string[];
|
|
15
|
+
/**
|
|
16
|
+
* What supervision decided, as things worth reading but not failures — a
|
|
17
|
+
* skipped invocation leaves the run `completed` with less output than the
|
|
18
|
+
* graph promised, which no status field says out loud.
|
|
19
|
+
*/
|
|
20
|
+
export declare function collectInterventionWarnings(prefix: string, summary: ExecutionSummary, limit?: number): string[];
|
|
21
|
+
/** Verdict for a single-surface run. */
|
|
22
|
+
export declare function buildRunVerdict(summary: ExecutionSummary, outcome: {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
status: string;
|
|
25
|
+
error?: string | null;
|
|
26
|
+
}, surface?: string): RunVerdict;
|
|
27
|
+
//# sourceMappingURL=verdict.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdict.d.ts","sourceRoot":"","sources":["../../src/debug/verdict.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE3E,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EACjC,KAAK,SAAI,GACR,MAAM,EAAE,CAKV;AAED,+DAA+D;AAC/D,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAC9D,MAAM,EAAE,CAcV;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,EACzB,KAAK,SAAI,GACR,MAAM,EAAE,CAaV;AAED,wCAAwC;AACxC,wBAAgB,eAAe,CAC7B,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAC/D,OAAO,SAAa,GACnB,UAAU,CAUZ"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function describeErrors(prefix, errors, limit = 5) {
|
|
2
|
+
return errors.slice(0, limit).map((e) => {
|
|
3
|
+
const where = e.nodeType ?? e.nodeId ?? "workflow";
|
|
4
|
+
return `${prefix} ${where}: ${e.message.replace(/\s+/g, " ").slice(0, 200)}`;
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
/** Issues found in a single surface's run, in triage order. */
|
|
8
|
+
export function collectRunIssues(prefix, summary, outcome) {
|
|
9
|
+
const issues = [];
|
|
10
|
+
if (!outcome.ok) {
|
|
11
|
+
issues.push(`${prefix} run ended ${outcome.status}${outcome.error ? `: ${outcome.error}` : ""}`);
|
|
12
|
+
}
|
|
13
|
+
issues.push(...describeErrors(`${prefix} node`, summary.errors));
|
|
14
|
+
for (const call of summary.llmCalls) {
|
|
15
|
+
if (call.error) {
|
|
16
|
+
issues.push(`${prefix} LLM ${call.provider}/${call.model}: ${call.error}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return issues;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* What supervision decided, as things worth reading but not failures — a
|
|
23
|
+
* skipped invocation leaves the run `completed` with less output than the
|
|
24
|
+
* graph promised, which no status field says out loud.
|
|
25
|
+
*/
|
|
26
|
+
export function collectInterventionWarnings(prefix, summary, limit = 5) {
|
|
27
|
+
if (summary.interventions.length === 0)
|
|
28
|
+
return [];
|
|
29
|
+
const warnings = summary.interventions
|
|
30
|
+
.slice(0, limit)
|
|
31
|
+
.map((i) => `${prefix} supervisor ${i.verdict.action} on ${i.escalation.nodeId}` +
|
|
32
|
+
`${i.escalation.invocationKey ? ` [${i.escalation.invocationKey}]` : ""}` +
|
|
33
|
+
`: ${i.escalation.detail.replace(/\s+/g, " ").slice(0, 200)}`);
|
|
34
|
+
const rest = summary.interventions.length - warnings.length;
|
|
35
|
+
if (rest > 0)
|
|
36
|
+
warnings.push(`${prefix} …${rest} more supervisor decision(s)`);
|
|
37
|
+
return warnings;
|
|
38
|
+
}
|
|
39
|
+
/** Verdict for a single-surface run. */
|
|
40
|
+
export function buildRunVerdict(summary, outcome, surface = "Workflow") {
|
|
41
|
+
const issues = collectRunIssues(surface, summary, outcome);
|
|
42
|
+
const ok = outcome.ok && issues.length === 0;
|
|
43
|
+
return {
|
|
44
|
+
ok,
|
|
45
|
+
headline: ok
|
|
46
|
+
? `Workflow ran clean (${outcome.status}).`
|
|
47
|
+
: `Workflow has issues — ${issues[0] ?? "unknown failure"}`,
|
|
48
|
+
issues
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=verdict.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verdict.js","sourceRoot":"","sources":["../../src/debug/verdict.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,cAAc,CAC5B,MAAc,EACd,MAAiC,EACjC,KAAK,GAAG,CAAC;IAET,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,IAAI,UAAU,CAAC;QACnD,OAAO,GAAG,MAAM,IAAI,KAAK,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IAC/E,CAAC,CAAC,CAAC;AACL,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,OAAyB,EACzB,OAA+D;IAE/D,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,CACT,GAAG,MAAM,cAAc,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACpF,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,GAAG,MAAM,OAAO,EAA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,wCAAwC;AACxC,MAAM,UAAU,eAAe,CAC7B,OAAyB,EACzB,OAA+D,EAC/D,OAAO,GAAG,UAAU;IAEpB,MAAM,MAAM,GAAG,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAC7C,OAAO;QACL,EAAE;QACF,QAAQ,EAAE,EAAE;YACV,CAAC,CAAC,uBAAuB,OAAO,CAAC,MAAM,IAAI;YAC3C,CAAC,CAAC,yBAAyB,MAAM,CAAC,CAAC,CAAC,IAAI,iBAAiB,EAAE;QAC7D,MAAM;KACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The three-branch executor resolver: registry → Python bridge → throw.
|
|
3
|
+
* Copy-pasted, before this package, in `packages/cli/src/nodetool.ts`,
|
|
4
|
+
* `packages/cli/src/debug/server-runner.ts`, and
|
|
5
|
+
* `packages/websocket/src/headless-job-runner.ts`. See the package README's
|
|
6
|
+
* inventory table (row "Executor resolution").
|
|
7
|
+
*/
|
|
8
|
+
import type { NodeExecutor } from "@nodetool-ai/kernel";
|
|
9
|
+
import type { NodeRegistry } from "@nodetool-ai/node-sdk";
|
|
10
|
+
import { type PythonBridgeBase } from "@nodetool-ai/runtime";
|
|
11
|
+
import type { NodeDescriptor } from "@nodetool-ai/protocol";
|
|
12
|
+
export declare function createExecutorResolver(registry: NodeRegistry, bridge: PythonBridgeBase | null): (node: NodeDescriptor) => NodeExecutor;
|
|
13
|
+
//# sourceMappingURL=executor-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executor-resolver.d.ts","sourceRoot":"","sources":["../src/executor-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,YAAY,EACtB,MAAM,EAAE,gBAAgB,GAAG,IAAI,GAC9B,CAAC,IAAI,EAAE,cAAc,KAAK,YAAY,CASxC"}
|