agentweaver 0.1.15 → 0.1.16
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 +26 -9
- package/dist/artifact-manifest.js +219 -0
- package/dist/artifacts.js +15 -0
- package/dist/doctor/checks/env-diagnostics.js +25 -0
- package/dist/doctor/checks/flow-readiness.js +15 -18
- package/dist/flow-state.js +75 -15
- package/dist/index.js +391 -175
- package/dist/interactive/blessed-session.js +361 -0
- package/dist/interactive/controller.js +1293 -0
- package/dist/interactive/create-interactive-session.js +5 -0
- package/dist/interactive/ink/index.js +576 -0
- package/dist/interactive/progress.js +245 -0
- package/dist/interactive/selectors.js +14 -0
- package/dist/interactive/session.js +1 -0
- package/dist/interactive/state.js +34 -0
- package/dist/interactive/tree.js +155 -0
- package/dist/interactive/types.js +1 -0
- package/dist/interactive/view-model.js +1 -0
- package/dist/interactive-ui.js +159 -194
- package/dist/pipeline/context.js +1 -0
- package/dist/pipeline/declarative-flow-runner.js +212 -6
- package/dist/pipeline/declarative-flows.js +27 -0
- package/dist/pipeline/execution-routing-config.js +15 -0
- package/dist/pipeline/flow-catalog.js +19 -3
- package/dist/pipeline/flow-run-resume.js +29 -0
- package/dist/pipeline/flow-specs/auto-common.json +89 -360
- package/dist/pipeline/flow-specs/auto-golang.json +58 -363
- package/dist/pipeline/flow-specs/auto-simple.json +141 -0
- package/dist/pipeline/flow-specs/bugz/bug-analyze.json +2 -0
- package/dist/pipeline/flow-specs/bugz/bug-fix.json +1 -0
- package/dist/pipeline/flow-specs/design-review/design-review-loop.json +304 -0
- package/dist/pipeline/flow-specs/design-review.json +10 -0
- package/dist/pipeline/flow-specs/gitlab/gitlab-diff-review.json +11 -0
- package/dist/pipeline/flow-specs/gitlab/gitlab-review.json +2 -0
- package/dist/pipeline/flow-specs/gitlab/mr-description.json +1 -0
- package/dist/pipeline/flow-specs/go/run-go-linter-loop.json +2 -0
- package/dist/pipeline/flow-specs/go/run-go-tests-loop.json +2 -0
- package/dist/pipeline/flow-specs/implement.json +13 -6
- package/dist/pipeline/flow-specs/instant-task.json +177 -0
- package/dist/pipeline/flow-specs/normalize-task-source.json +311 -0
- package/dist/pipeline/flow-specs/plan-revise.json +7 -1
- package/dist/pipeline/flow-specs/plan.json +48 -70
- package/dist/pipeline/flow-specs/review/review-fix.json +24 -4
- package/dist/pipeline/flow-specs/review/review-loop.json +351 -45
- package/dist/pipeline/flow-specs/review/review-project-loop.json +590 -0
- package/dist/pipeline/flow-specs/review/review-project.json +12 -0
- package/dist/pipeline/flow-specs/review/review.json +37 -31
- package/dist/pipeline/flow-specs/task-describe.json +2 -0
- package/dist/pipeline/flow-specs/task-source/jira-fetch.json +70 -0
- package/dist/pipeline/flow-specs/task-source/manual-input.json +216 -0
- package/dist/pipeline/node-registry.js +41 -1
- package/dist/pipeline/node-runner.js +3 -2
- package/dist/pipeline/nodes/build-review-fix-prompt-node.js +5 -1
- package/dist/pipeline/nodes/clear-ready-to-merge-node.js +11 -0
- package/dist/pipeline/nodes/commit-message-form-node.js +8 -0
- package/dist/pipeline/nodes/design-review-verdict-node.js +36 -0
- package/dist/pipeline/nodes/ensure-summary-json-node.js +13 -2
- package/dist/pipeline/nodes/fetch-gitlab-diff-node.js +19 -2
- package/dist/pipeline/nodes/fetch-gitlab-review-node.js +19 -2
- package/dist/pipeline/nodes/flow-run-node.js +226 -7
- package/dist/pipeline/nodes/git-commit-form-node.js +8 -0
- package/dist/pipeline/nodes/gitlab-review-artifacts-node.js +19 -2
- package/dist/pipeline/nodes/jira-fetch-node.js +50 -4
- package/dist/pipeline/nodes/llm-prompt-node.js +32 -12
- package/dist/pipeline/nodes/planning-bundle-node.js +10 -0
- package/dist/pipeline/nodes/review-verdict-node.js +86 -0
- package/dist/pipeline/nodes/select-files-form-node.js +8 -0
- package/dist/pipeline/nodes/structured-summary-node.js +24 -0
- package/dist/pipeline/nodes/user-input-node.js +38 -3
- package/dist/pipeline/nodes/write-selection-file-node.js +20 -4
- package/dist/pipeline/prompt-registry.js +3 -1
- package/dist/pipeline/prompt-runtime.js +4 -1
- package/dist/pipeline/review-iteration.js +26 -0
- package/dist/pipeline/spec-compiler.js +2 -0
- package/dist/pipeline/spec-types.js +3 -0
- package/dist/pipeline/spec-validator.js +14 -0
- package/dist/pipeline/value-resolver.js +74 -1
- package/dist/prompts.js +36 -14
- package/dist/review-severity.js +45 -0
- package/dist/runtime/artifact-registry.js +402 -0
- package/dist/runtime/design-review-input-contract.js +17 -16
- package/dist/runtime/env-loader.js +3 -0
- package/dist/runtime/execution-routing-store.js +134 -0
- package/dist/runtime/execution-routing.js +227 -0
- package/dist/runtime/interactive-execution-routing.js +462 -0
- package/dist/runtime/plan-revise-input-contract.js +35 -32
- package/dist/runtime/planning-bundle.js +123 -0
- package/dist/runtime/ready-to-merge.js +22 -1
- package/dist/runtime/review-input-contract.js +100 -0
- package/dist/structured-artifact-schema-registry.js +9 -0
- package/dist/structured-artifact-schemas.json +140 -1
- package/dist/structured-artifacts.js +77 -6
- package/dist/user-input.js +70 -3
- package/package.json +6 -3
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import blessed from "neo-blessed";
|
|
2
|
+
import { InteractiveSessionController } from "./controller.js";
|
|
3
|
+
export function appendBlessedLogText(currentText, lines) {
|
|
4
|
+
if (lines.length === 0) {
|
|
5
|
+
return currentText;
|
|
6
|
+
}
|
|
7
|
+
const appendedText = lines.join("\n");
|
|
8
|
+
return currentText.length === 0 ? appendedText : `${currentText}\n${appendedText}`;
|
|
9
|
+
}
|
|
10
|
+
export class BlessedInteractiveSession {
|
|
11
|
+
controller;
|
|
12
|
+
screen;
|
|
13
|
+
header;
|
|
14
|
+
progress;
|
|
15
|
+
flowList;
|
|
16
|
+
description;
|
|
17
|
+
status;
|
|
18
|
+
summary;
|
|
19
|
+
log;
|
|
20
|
+
footer;
|
|
21
|
+
help;
|
|
22
|
+
confirm;
|
|
23
|
+
form;
|
|
24
|
+
unsubscribe;
|
|
25
|
+
renderScheduled = false;
|
|
26
|
+
renderedLogText = "";
|
|
27
|
+
logSyncNeeded = true;
|
|
28
|
+
constructor(options) {
|
|
29
|
+
this.controller = new InteractiveSessionController(options);
|
|
30
|
+
this.screen = blessed.screen({
|
|
31
|
+
smartCSR: true,
|
|
32
|
+
fullUnicode: true,
|
|
33
|
+
title: `AgentWeaver ${options.scopeKey}`,
|
|
34
|
+
dockBorders: true,
|
|
35
|
+
autoPadding: false,
|
|
36
|
+
});
|
|
37
|
+
this.header = blessed.box({
|
|
38
|
+
parent: this.screen,
|
|
39
|
+
top: 0,
|
|
40
|
+
left: 0,
|
|
41
|
+
width: "100%",
|
|
42
|
+
height: 3,
|
|
43
|
+
border: "line",
|
|
44
|
+
padding: { left: 1, right: 1 },
|
|
45
|
+
style: {
|
|
46
|
+
border: { fg: "green" },
|
|
47
|
+
fg: "white",
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
this.progress = blessed.box({
|
|
51
|
+
parent: this.screen,
|
|
52
|
+
top: 3,
|
|
53
|
+
left: 0,
|
|
54
|
+
width: "34%",
|
|
55
|
+
height: "50%-4",
|
|
56
|
+
label: " Current Flow ",
|
|
57
|
+
border: "line",
|
|
58
|
+
padding: { left: 1, right: 1 },
|
|
59
|
+
scrollable: true,
|
|
60
|
+
alwaysScroll: true,
|
|
61
|
+
style: {
|
|
62
|
+
border: { fg: "green" },
|
|
63
|
+
fg: "white",
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
this.flowList = blessed.list({
|
|
67
|
+
parent: this.screen,
|
|
68
|
+
top: "50%-1",
|
|
69
|
+
left: 0,
|
|
70
|
+
width: "34%",
|
|
71
|
+
bottom: 14,
|
|
72
|
+
label: " Flows ",
|
|
73
|
+
border: "line",
|
|
74
|
+
padding: { left: 1, right: 1 },
|
|
75
|
+
mouse: true,
|
|
76
|
+
style: {
|
|
77
|
+
border: { fg: "cyan" },
|
|
78
|
+
fg: "white",
|
|
79
|
+
selected: {
|
|
80
|
+
fg: "black",
|
|
81
|
+
bg: "green",
|
|
82
|
+
bold: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
this.description = blessed.box({
|
|
87
|
+
parent: this.screen,
|
|
88
|
+
bottom: 6,
|
|
89
|
+
left: 0,
|
|
90
|
+
width: "34%",
|
|
91
|
+
height: 8,
|
|
92
|
+
label: " Flow Description ",
|
|
93
|
+
border: "line",
|
|
94
|
+
padding: { left: 1, right: 1 },
|
|
95
|
+
scrollable: true,
|
|
96
|
+
alwaysScroll: true,
|
|
97
|
+
style: {
|
|
98
|
+
border: { fg: "magenta" },
|
|
99
|
+
fg: "white",
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
this.status = blessed.box({
|
|
103
|
+
parent: this.screen,
|
|
104
|
+
bottom: 1,
|
|
105
|
+
left: 0,
|
|
106
|
+
width: "34%",
|
|
107
|
+
height: 5,
|
|
108
|
+
label: " Status ",
|
|
109
|
+
border: "line",
|
|
110
|
+
padding: { left: 1, right: 1 },
|
|
111
|
+
style: {
|
|
112
|
+
border: { fg: "green" },
|
|
113
|
+
fg: "white",
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
this.summary = blessed.box({
|
|
117
|
+
parent: this.screen,
|
|
118
|
+
top: 3,
|
|
119
|
+
left: "34%",
|
|
120
|
+
width: "66%",
|
|
121
|
+
height: 16,
|
|
122
|
+
label: " Task Summary ",
|
|
123
|
+
border: "line",
|
|
124
|
+
padding: { left: 1, right: 1 },
|
|
125
|
+
scrollable: true,
|
|
126
|
+
alwaysScroll: true,
|
|
127
|
+
style: {
|
|
128
|
+
border: { fg: "green" },
|
|
129
|
+
fg: "white",
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
this.log = blessed.box({
|
|
133
|
+
parent: this.screen,
|
|
134
|
+
top: 19,
|
|
135
|
+
bottom: 1,
|
|
136
|
+
left: "34%",
|
|
137
|
+
width: "66%",
|
|
138
|
+
label: " Activity ",
|
|
139
|
+
border: "line",
|
|
140
|
+
padding: { left: 1, right: 1 },
|
|
141
|
+
scrollable: true,
|
|
142
|
+
alwaysScroll: true,
|
|
143
|
+
mouse: true,
|
|
144
|
+
style: {
|
|
145
|
+
border: { fg: "yellow" },
|
|
146
|
+
fg: "white",
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
this.footer = blessed.box({
|
|
150
|
+
parent: this.screen,
|
|
151
|
+
bottom: 0,
|
|
152
|
+
left: 0,
|
|
153
|
+
width: "100%",
|
|
154
|
+
height: 1,
|
|
155
|
+
style: { fg: "gray" },
|
|
156
|
+
});
|
|
157
|
+
this.help = blessed.box({
|
|
158
|
+
parent: this.screen,
|
|
159
|
+
top: "center",
|
|
160
|
+
left: "center",
|
|
161
|
+
width: "64%",
|
|
162
|
+
height: "52%",
|
|
163
|
+
hidden: true,
|
|
164
|
+
label: " Help ",
|
|
165
|
+
border: "line",
|
|
166
|
+
padding: { left: 1, right: 1 },
|
|
167
|
+
scrollable: true,
|
|
168
|
+
alwaysScroll: true,
|
|
169
|
+
style: {
|
|
170
|
+
border: { fg: "magenta" },
|
|
171
|
+
bg: "black",
|
|
172
|
+
fg: "white",
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
this.confirm = blessed.box({
|
|
176
|
+
parent: this.screen,
|
|
177
|
+
top: "center",
|
|
178
|
+
left: "center",
|
|
179
|
+
width: 48,
|
|
180
|
+
height: 9,
|
|
181
|
+
hidden: true,
|
|
182
|
+
label: " Confirm ",
|
|
183
|
+
border: "line",
|
|
184
|
+
padding: { left: 1, right: 1, top: 1, bottom: 1 },
|
|
185
|
+
style: {
|
|
186
|
+
border: { fg: "yellow" },
|
|
187
|
+
fg: "white",
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
this.form = blessed.box({
|
|
191
|
+
parent: this.screen,
|
|
192
|
+
top: "center",
|
|
193
|
+
left: "center",
|
|
194
|
+
width: "72%",
|
|
195
|
+
height: "68%",
|
|
196
|
+
hidden: true,
|
|
197
|
+
label: " User Input ",
|
|
198
|
+
border: "line",
|
|
199
|
+
padding: { left: 1, right: 1, top: 1, bottom: 1 },
|
|
200
|
+
scrollable: true,
|
|
201
|
+
alwaysScroll: true,
|
|
202
|
+
style: {
|
|
203
|
+
border: { fg: "magenta" },
|
|
204
|
+
bg: "black",
|
|
205
|
+
fg: "white",
|
|
206
|
+
},
|
|
207
|
+
});
|
|
208
|
+
this.screen.on("keypress", (ch, key) => {
|
|
209
|
+
void this.controller.handleKeypress(ch, key);
|
|
210
|
+
});
|
|
211
|
+
this.screen.on("resize", () => {
|
|
212
|
+
this.requestRender();
|
|
213
|
+
});
|
|
214
|
+
this.flowList.on("select item", (_item, index) => {
|
|
215
|
+
this.controller.selectFlowIndex(index);
|
|
216
|
+
});
|
|
217
|
+
this.unsubscribe = this.controller.subscribe((event) => {
|
|
218
|
+
if (event.type === "log") {
|
|
219
|
+
this.appendLogLines(event.appendedLines);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (event.syncLog) {
|
|
223
|
+
this.logSyncNeeded = true;
|
|
224
|
+
}
|
|
225
|
+
this.requestRender();
|
|
226
|
+
});
|
|
227
|
+
this.requestRender();
|
|
228
|
+
}
|
|
229
|
+
mount() {
|
|
230
|
+
this.controller.mount();
|
|
231
|
+
this.requestRender();
|
|
232
|
+
}
|
|
233
|
+
destroy() {
|
|
234
|
+
this.unsubscribe();
|
|
235
|
+
this.controller.destroy();
|
|
236
|
+
this.screen.destroy();
|
|
237
|
+
}
|
|
238
|
+
requestUserInput(form) {
|
|
239
|
+
return this.controller.requestUserInput(form);
|
|
240
|
+
}
|
|
241
|
+
setSummary(markdown) {
|
|
242
|
+
this.controller.setSummary(markdown);
|
|
243
|
+
}
|
|
244
|
+
clearSummary() {
|
|
245
|
+
this.controller.clearSummary();
|
|
246
|
+
}
|
|
247
|
+
setScope(scopeKey, jiraIssueKey) {
|
|
248
|
+
this.controller.setScope(scopeKey, jiraIssueKey);
|
|
249
|
+
}
|
|
250
|
+
appendLog(text) {
|
|
251
|
+
this.controller.appendLog(text);
|
|
252
|
+
}
|
|
253
|
+
setFlowFailed(flowId) {
|
|
254
|
+
this.controller.setFlowFailed(flowId);
|
|
255
|
+
}
|
|
256
|
+
interruptActiveForm(message) {
|
|
257
|
+
this.controller.interruptActiveForm(message);
|
|
258
|
+
}
|
|
259
|
+
applyRightPaneLayout(summaryVisible) {
|
|
260
|
+
if (summaryVisible) {
|
|
261
|
+
this.summary.show();
|
|
262
|
+
this.summary.top = 3;
|
|
263
|
+
this.summary.height = 16;
|
|
264
|
+
this.log.top = 19;
|
|
265
|
+
this.log.bottom = 1;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
this.summary.hide();
|
|
269
|
+
this.log.top = 3;
|
|
270
|
+
this.log.bottom = 1;
|
|
271
|
+
}
|
|
272
|
+
render() {
|
|
273
|
+
const viewModel = this.controller.getViewModel();
|
|
274
|
+
this.screen.title = viewModel.title;
|
|
275
|
+
this.applyRightPaneLayout(viewModel.summaryVisible);
|
|
276
|
+
this.header.setContent(viewModel.header);
|
|
277
|
+
this.footer.setContent(` ${viewModel.footer} `);
|
|
278
|
+
this.flowList.setLabel(` ${viewModel.flowListTitle} `);
|
|
279
|
+
this.flowList.setItems(viewModel.flowItems.map((item) => item.label));
|
|
280
|
+
this.flowList.select(viewModel.selectedFlowIndex);
|
|
281
|
+
this.progress.setLabel(` ${viewModel.progressTitle} `);
|
|
282
|
+
this.progress.setContent(viewModel.progressText);
|
|
283
|
+
this.progress.setScroll(viewModel.progressScrollOffset);
|
|
284
|
+
this.description.setContent(viewModel.descriptionText);
|
|
285
|
+
this.status.setContent(viewModel.statusText);
|
|
286
|
+
this.summary.setLabel(` ${viewModel.summaryTitle} `);
|
|
287
|
+
this.summary.setContent(viewModel.summaryText);
|
|
288
|
+
this.summary.setScroll(viewModel.summaryScrollOffset);
|
|
289
|
+
this.log.setLabel(` ${viewModel.logTitle} `);
|
|
290
|
+
if (this.logSyncNeeded) {
|
|
291
|
+
this.log.setContent(viewModel.logText);
|
|
292
|
+
this.renderedLogText = viewModel.logText;
|
|
293
|
+
this.logSyncNeeded = false;
|
|
294
|
+
}
|
|
295
|
+
this.log.setScroll(viewModel.logScrollOffset);
|
|
296
|
+
if (viewModel.helpVisible) {
|
|
297
|
+
this.help.setContent(viewModel.helpText);
|
|
298
|
+
this.help.setScroll(viewModel.helpScrollOffset);
|
|
299
|
+
this.help.show();
|
|
300
|
+
this.help.setFront();
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
this.help.hide();
|
|
304
|
+
}
|
|
305
|
+
if (viewModel.confirmText) {
|
|
306
|
+
const lines = viewModel.confirmText.split("\n");
|
|
307
|
+
const width = Math.max(48, ...lines.map((line) => line.length + 4));
|
|
308
|
+
const height = Math.max(8, lines.length + 4);
|
|
309
|
+
this.confirm.width = width;
|
|
310
|
+
this.confirm.height = height;
|
|
311
|
+
this.confirm.setContent(viewModel.confirmText);
|
|
312
|
+
this.confirm.show();
|
|
313
|
+
this.confirm.setFront();
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
this.confirm.hide();
|
|
317
|
+
}
|
|
318
|
+
if (viewModel.form) {
|
|
319
|
+
this.form.setLabel(` ${viewModel.form.title} `);
|
|
320
|
+
this.form.setContent(viewModel.form.content);
|
|
321
|
+
this.form.setScroll(0);
|
|
322
|
+
this.form.show();
|
|
323
|
+
this.form.setFront();
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
this.form.hide();
|
|
327
|
+
}
|
|
328
|
+
if (viewModel.form) {
|
|
329
|
+
this.form.focus();
|
|
330
|
+
}
|
|
331
|
+
else if (viewModel.confirmText) {
|
|
332
|
+
this.confirm.focus();
|
|
333
|
+
}
|
|
334
|
+
else if (viewModel.helpVisible) {
|
|
335
|
+
this.help.focus();
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
this.flowList.focus();
|
|
339
|
+
}
|
|
340
|
+
this.screen.render();
|
|
341
|
+
}
|
|
342
|
+
appendLogLines(lines) {
|
|
343
|
+
if (lines.length === 0) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
this.renderedLogText = appendBlessedLogText(this.renderedLogText, lines);
|
|
347
|
+
this.log.setContent(this.renderedLogText);
|
|
348
|
+
this.log.setScrollPerc(100);
|
|
349
|
+
this.requestRender();
|
|
350
|
+
}
|
|
351
|
+
requestRender() {
|
|
352
|
+
if (this.renderScheduled) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
this.renderScheduled = true;
|
|
356
|
+
setImmediate(() => {
|
|
357
|
+
this.renderScheduled = false;
|
|
358
|
+
this.render();
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|