agentweaver 0.1.17 → 0.1.18
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 +104 -23
- package/dist/artifacts.js +41 -0
- package/dist/index.js +252 -27
- package/dist/interactive/controller.js +249 -13
- package/dist/interactive/ink/index.js +2 -2
- package/dist/interactive/state.js +1 -0
- package/dist/interactive/web/index.js +179 -0
- package/dist/interactive/web/protocol.js +154 -0
- package/dist/interactive/web/server.js +575 -0
- package/dist/interactive/web/static/app.js +709 -0
- package/dist/interactive/web/static/index.html +77 -0
- package/dist/interactive/web/static/styles.css +2 -0
- package/dist/interactive/web/static/styles.input.css +469 -0
- package/dist/pipeline/flow-catalog.js +4 -0
- package/dist/pipeline/flow-specs/auto-common-guided.json +313 -0
- package/dist/pipeline/flow-specs/auto-common.json +3 -1
- package/dist/pipeline/flow-specs/design-review/design-review-loop.json +2 -0
- package/dist/pipeline/flow-specs/design-review.json +2 -0
- package/dist/pipeline/flow-specs/implement.json +3 -1
- package/dist/pipeline/flow-specs/plan.json +4 -0
- package/dist/pipeline/flow-specs/playbook-init.json +199 -0
- package/dist/pipeline/flow-specs/review/review-fix.json +3 -1
- package/dist/pipeline/flow-specs/review/review-loop.json +4 -0
- package/dist/pipeline/flow-specs/review/review.json +2 -0
- package/dist/pipeline/node-registry.js +45 -0
- package/dist/pipeline/nodes/flow-run-node.js +13 -1
- package/dist/pipeline/nodes/playbook-ensure-node.js +115 -0
- package/dist/pipeline/nodes/playbook-inventory-node.js +51 -0
- package/dist/pipeline/nodes/playbook-questions-form-node.js +166 -0
- package/dist/pipeline/nodes/playbook-write-node.js +243 -0
- package/dist/pipeline/nodes/project-guidance-node.js +69 -0
- package/dist/pipeline/prompt-registry.js +4 -1
- package/dist/pipeline/prompt-runtime.js +6 -2
- package/dist/pipeline/spec-types.js +19 -0
- package/dist/pipeline/value-resolver.js +39 -1
- package/dist/playbook/practice-candidates.js +12 -0
- package/dist/playbook/repo-inventory.js +208 -0
- package/dist/prompts.js +31 -0
- package/dist/runtime/playbook.js +485 -0
- package/dist/runtime/project-guidance.js +339 -0
- package/dist/structured-artifact-schema-registry.js +8 -0
- package/dist/structured-artifact-schemas.json +235 -0
- package/dist/structured-artifacts.js +7 -1
- package/docs/declarative-workflows.md +565 -0
- package/docs/features.md +77 -0
- package/docs/playbook.md +327 -0
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -1,34 +1,44 @@
|
|
|
1
1
|
# AgentWeaver
|
|
2
2
|
|
|
3
|
-
`AgentWeaver` is a TypeScript/Node.js CLI for
|
|
3
|
+
`AgentWeaver` is a TypeScript/Node.js CLI for engineering durable workflows around coding agents.
|
|
4
4
|
|
|
5
|
-
It is built
|
|
5
|
+
It is built for teams that want agent work to behave less like one-off prompting and more like an inspectable engineering system: explicit workflows, durable artifacts, repeatable review gates, resumable execution, and repository-local guidance that evolves with the codebase.
|
|
6
6
|
|
|
7
7
|
Typical usage looks like:
|
|
8
8
|
|
|
9
9
|
`plan -> implement -> run-go-linter-loop -> run-go-tests-loop -> review -> review-fix`
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Planning-heavy work can use:
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`plan -> design-review -> implement -> review-loop`
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
The important part is not the exact chain. The point is that AgentWeaver lets you model, operate, and evolve the harness around the agent.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
- Fetches GitLab merge request diff and review data into reusable artifacts
|
|
19
|
-
- Runs Codex-, OpenCode-, and process-backed stages through a common pipeline runtime
|
|
20
|
-
- Persists artifacts and compact flow execution state under the current project scope
|
|
21
|
-
- Supports both operator-driven work in a TUI and end-to-end automation flows
|
|
22
|
-
- Resumes interrupted declarative flows when required artifacts and launch profile still match
|
|
17
|
+
## Key Features
|
|
23
18
|
|
|
24
|
-
|
|
19
|
+
See [docs/features.md](docs/features.md) for the expanded feature overview.
|
|
20
|
+
|
|
21
|
+
- **Declarative agent workflows**: flows are JSON specs with phases, steps, prompt bindings, params, expectations, and post-step actions. Workflow design stays declarative while runtime behavior lives in typed nodes and executors.
|
|
22
|
+
- **Repository-local project playbook**: stable project conventions live under `.agentweaver/playbook/` as versioned rules, examples, and templates. Guided flows select relevant guidance before planning, implementation, review, and repair so repeated agent runs inherit the same project knowledge.
|
|
23
|
+
- **Artifact-first execution**: each stage produces structured JSON and human-readable markdown artifacts on disk. Artifacts are the contract between stages, which makes runs inspectable, reviewable, and restartable.
|
|
24
|
+
- **Planning and design-review gates**: planning flows produce design, implementation plan, and QA plan artifacts. `design-review` critiques those artifacts before coding starts, and `auto-common` can iterate through `plan-revise` before implementation.
|
|
25
|
+
- **Review and repair loops**: review flows produce structured findings with severities. Repair flows can select blockers and critical findings, apply targeted fixes, and run follow-up checks.
|
|
26
|
+
- **Resumable automation**: long-running flows persist compact execution state, support resume/continue/restart semantics, and can restart from selected phases when the artifacts and launch profile are compatible.
|
|
27
|
+
- **Multiple execution backends**: Codex, OpenCode, shell/process checks, Jira, GitLab, Git commit, and Telegram notification integrations run through a common executor model.
|
|
28
|
+
- **Interactive TUI and direct CLI**: the same workflow model works in an operator-driven terminal UI, direct CLI commands, and non-interactive automation.
|
|
29
|
+
- **Custom flows**: built-in flows can be extended with global or project-local flow specs without changing AgentWeaver source code.
|
|
30
|
+
- **Plugin SDK**: local plugins can add public-SDK-compatible nodes and executors, with manifest validation, version checks, and documented entrypoint rules.
|
|
31
|
+
- **Operational diagnostics**: `doctor` checks system readiness, executor configuration, flow specs, node versions, and runtime environment shape before workflows fail mid-run.
|
|
32
|
+
|
|
33
|
+
## Why Harness Engineering
|
|
25
34
|
|
|
26
35
|
AgentWeaver is not positioned as a thin wrapper around one agent call. It is meant for harness engineering:
|
|
27
36
|
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
37
|
+
- The workflow is explicit instead of hidden in a long prompt.
|
|
38
|
+
- The intermediate decisions are persisted instead of disappearing in chat history.
|
|
39
|
+
- The agent receives project guidance from the repository instead of relying on memory or copy-pasted instructions.
|
|
40
|
+
- Review, repair, checks, and restart behavior are first-class parts of the workflow.
|
|
41
|
+
- The same model works in local CLI use, interactive operation, and automation.
|
|
32
42
|
|
|
33
43
|
In practice, this means you can treat an agent workflow like an engineered system: versioned, inspectable, repeatable, and debuggable.
|
|
34
44
|
|
|
@@ -40,14 +50,15 @@ In practice, this means you can treat an agent workflow like an engineered syste
|
|
|
40
50
|
- `scope`: isolated workspace key for artifacts and flow state; usually based on Jira task, otherwise derived from git context
|
|
41
51
|
- `artifact`: file produced or consumed by flows, used as the stable contract between stages
|
|
42
52
|
- `flow state`: compact persisted execution metadata used for resume/restart in long-running flows such as `auto-golang`
|
|
53
|
+
- `project playbook`: local `.agentweaver/playbook/` directory with `manifest.yaml`, practices, examples, and templates; the format is described in [docs/playbook.md](docs/playbook.md)
|
|
43
54
|
|
|
44
|
-
##
|
|
55
|
+
## Launch Semantics
|
|
45
56
|
|
|
46
|
-
- `resume`
|
|
47
|
-
- `continue`
|
|
48
|
-
- `restart`
|
|
49
|
-
-
|
|
50
|
-
-
|
|
57
|
+
- `resume` only resumes a genuinely interrupted run and uses the saved execution state without rebuilding already completed steps
|
|
58
|
+
- `continue` is intended for completed iterative cycles and starts the next iteration from the latest valid artifacts without deleting historical artifacts
|
|
59
|
+
- `restart` is treated as a new run: the current active attempt is archived under `.agentweaver/scopes/<scope>/.artifacts/restart-archives/attempt-XXXX`, then a new active attempt is created
|
|
60
|
+
- For ambiguous launches, the operator must choose the action explicitly: by confirmation in interactive mode, or with `--resume`, `--continue`, or `--restart` in non-interactive mode
|
|
61
|
+
- This contract applies to `auto-common`, `auto-simple`, `auto-golang`, `instant-task`, `review-loop`, `run-go-linter-loop`, and `run-go-tests-loop`
|
|
51
62
|
|
|
52
63
|
## Declarative Workflow Model
|
|
53
64
|
|
|
@@ -62,6 +73,8 @@ The center of the system is the declarative flow spec:
|
|
|
62
73
|
|
|
63
74
|
This keeps workflow design in JSON while keeping implementation details in typed runtime code.
|
|
64
75
|
|
|
76
|
+
The full flow-spec reference now lives in [docs/declarative-workflows.md](docs/declarative-workflows.md).
|
|
77
|
+
|
|
65
78
|
## Repository Layout
|
|
66
79
|
|
|
67
80
|
- `src/index.ts` — CLI entrypoint, interactive mode bootstrap, and top-level orchestration
|
|
@@ -109,6 +122,30 @@ There are also built-in nested/helper flows that are loaded declaratively but ar
|
|
|
109
122
|
- `opencode` CLI if you use OpenCode-backed stages
|
|
110
123
|
- access to Jira and/or GitLab when the selected flow needs them
|
|
111
124
|
|
|
125
|
+
## Web UI
|
|
126
|
+
|
|
127
|
+
The `agentweaver web [--no-open] [--host <host>|--listen-all] [<jira-browse-url|jira-issue-key>]` command starts interactive mode through the Web UI. By default, the server binds to `127.0.0.1`, asks the operating system for a random port, and prints the final address as `AgentWeaver Web UI: http://127.0.0.1:<port>/`.
|
|
128
|
+
|
|
129
|
+
To open the Web UI from another machine on a trusted network, configure Web UI credentials first:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
export AGENTWEAVER_WEB_USERNAME=operator
|
|
133
|
+
export AGENTWEAVER_WEB_PASSWORD='choose-a-strong-password'
|
|
134
|
+
agentweaver web --listen-all --no-open
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
External binding requires both `AGENTWEAVER_WEB_USERNAME` and `AGENTWEAVER_WEB_PASSWORD`. This applies to `agentweaver web --listen-all`, `agentweaver web --host 0.0.0.0`, `agentweaver web --host ::`, explicit non-loopback IP addresses such as `192.168.1.10` or `2001:db8::1`, and any hostname other than `localhost`. In this mode, the server listens on the requested interface; connect to the IP address or hostname of the machine running AgentWeaver and the assigned port.
|
|
138
|
+
|
|
139
|
+
The default localhost bindings, including `127.0.0.1`, `::1`, and `localhost`, remain no-auth by default. If Web UI credentials are configured, the same Basic auth check also protects localhost Web UI requests.
|
|
140
|
+
|
|
141
|
+
Web UI authentication uses HTTP Basic auth. Over plain HTTP, use it only on trusted networks because credentials are not encrypted in transit. For untrusted networks, put AgentWeaver behind TLS termination or an equivalent reverse proxy.
|
|
142
|
+
|
|
143
|
+
By default, AgentWeaver tries to open the browser after the server starts successfully and the URL is printed. For CI, tests, and manual smoke checks, use `agentweaver web --no-open` or the `AGENTWEAVER_WEB_NO_OPEN=1` environment variable; the `--no-open` flag is supported only after the `web` command.
|
|
144
|
+
|
|
145
|
+
The Web UI serves the operator console from the same local process, including `/`, `/static/app.js`, and `/static/styles.css`. Live browser interaction uses WebSocket on `/__agentweaver/ws`. Bounded checks can use `GET /__agentweaver/health`, and shutdown is available through `POST /__agentweaver/exit` or `SIGINT`/`SIGTERM`.
|
|
146
|
+
|
|
147
|
+
Web UI state is process-local: it exists only while the AgentWeaver process is running and is not shared with other AgentWeaver processes. The Web UI is intended to match the interactive operator workflow for flow selection, launch confirmation, routing and user-input forms, progress and logs, and interrupt handling.
|
|
148
|
+
|
|
112
149
|
## Installation
|
|
113
150
|
|
|
114
151
|
Local development:
|
|
@@ -295,7 +332,7 @@ Notes:
|
|
|
295
332
|
- `--verbose` streams child process stdout/stderr in direct CLI mode
|
|
296
333
|
- `--prompt <text>` appends extra instructions to the prompt
|
|
297
334
|
- `--scope <name>` is supported by scope-flexible flows such as `implement`, `review`, `review-fix`, `review-loop`, `run-go-tests-loop`, `run-go-linter-loop`, `gitlab-review`, and `gitlab-diff-review`
|
|
298
|
-
- `--md-lang <en|ru>`
|
|
335
|
+
- `--md-lang <en|ru>` applies only to generated workflow markdown artifacts, not repository source files or committed documentation
|
|
299
336
|
- `--force` only affects interactive mode: it skips loading cached summary-pane content on startup so Jira-backed flows that regenerate summary artifacts can repopulate it during the run
|
|
300
337
|
- Jira-backed flows ask for Jira input interactively when it is omitted
|
|
301
338
|
- `task-describe` can also work from manual task description input without Jira
|
|
@@ -336,6 +373,7 @@ Artifacts and flow state are stored under the current project scope. In practice
|
|
|
336
373
|
- Jira-backed runs usually use the Jira issue key as scope
|
|
337
374
|
- non-Jira runs can fall back to a git-derived scope
|
|
338
375
|
- `--scope <name>` lets you override the default for supported commands
|
|
376
|
+
- interactive and web sessions automatically switch the branch-derived scope after the git branch changes, unless the session was started with an explicit Jira argument or `--scope`
|
|
339
377
|
|
|
340
378
|
The runtime uses artifacts as the contract between stages, including markdown outputs and structured JSON files validated against schemas.
|
|
341
379
|
|
|
@@ -427,7 +465,50 @@ Recommended smoke checks:
|
|
|
427
465
|
node dist/index.js --help
|
|
428
466
|
node dist/index.js auto-golang --help-phases
|
|
429
467
|
node dist/index.js auto-common --help-phases
|
|
468
|
+
node dist/index.js auto-common-guided --help-phases
|
|
430
469
|
node dist/index.js plan --dry DEMO-1234
|
|
431
470
|
node dist/index.js implement --dry DEMO-1234
|
|
432
471
|
node dist/index.js review --dry DEMO-1234
|
|
433
472
|
```
|
|
473
|
+
|
|
474
|
+
## Guided Project Guidance
|
|
475
|
+
|
|
476
|
+
The project playbook is AgentWeaver's way to turn project-specific conventions into durable agent context. Instead of repeating the same instructions in every prompt, a repository can keep stable rules, examples, and templates under `.agentweaver/playbook/`. Guided flows validate that material, select the parts relevant to the current task and phase, and pass compact guidance into the model before planning, implementation, review, and repair.
|
|
477
|
+
|
|
478
|
+
Typical playbook content includes:
|
|
479
|
+
|
|
480
|
+
- engineering rules such as required test locations, documentation language, or runtime validation boundaries
|
|
481
|
+
- examples that should be opened only when relevant, instead of pasted into every prompt
|
|
482
|
+
- templates for recurring artifact shapes or implementation notes
|
|
483
|
+
- repository context that should remain visible across tasks without overriding task-specific inputs
|
|
484
|
+
|
|
485
|
+
The guided flow is `auto-common-guided`. It first runs the same Jira fetch and task normalization steps as `auto-common`, then validates `.agentweaver/playbook/manifest.yaml` and generates compact project guidance before the `plan`, `design-review`, `implement`, `review`, and `repair/review-fix` phases. JSON artifacts remain English and machine-readable; workflow markdown artifacts are generated in the workflow-selected language. The markdown language setting does not apply to repository source files, committed documentation, or playbook rules.
|
|
486
|
+
|
|
487
|
+
The guidance is intentionally phase-aware. A rule can apply only to `plan`, `implement`, `review`, or another supported phase; it can also target languages, frameworks, glob patterns, and keywords. AgentWeaver writes both a structured `project-guidance/v1` JSON artifact and a derivative markdown file, then passes their paths into the phase prompt as supplemental project-local context.
|
|
488
|
+
|
|
489
|
+
Initialize or refresh the playbook with:
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
agentweaver playbook-init
|
|
493
|
+
agentweaver playbook-init --accept-playbook-draft
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
Use the guided flow with:
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
agentweaver auto-common-guided --help-phases
|
|
500
|
+
agentweaver auto-common-guided --accept-playbook-draft DEMO-1234
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
The workflow does not read old `playbook.json` or `playbook.md` files as fallbacks. In non-interactive runs, a missing manifest stops the workflow before planning and reports the required action: run `agentweaver playbook-init --accept-playbook-draft` first, or rerun `agentweaver auto-common-guided --accept-playbook-draft <jira>`. The `--accept-playbook-draft` flag explicitly accepts the generated playbook without interactive review and allows AgentWeaver to write the manifest-based layout. An invalid manifest stops the guided phase before the LLM prompt.
|
|
504
|
+
|
|
505
|
+
To inspect whether playbook guidance participated in a run, check the generated artifacts:
|
|
506
|
+
|
|
507
|
+
```bash
|
|
508
|
+
find .agentweaver/scopes -name 'project-guidance-*'
|
|
509
|
+
rg -n "Project Guidance|practice\\." .agentweaver/scopes
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
Keep `.agentweaver/playbook/` in Git even when other AgentWeaver runtime state is ignored. The playbook format and maintenance workflow are documented in [docs/playbook.md](docs/playbook.md).
|
|
513
|
+
|
|
514
|
+
Current limitations: skills integration is not available yet; the playbook generator must rely on repository evidence and clarification answers; guided prompts receive compact context and open full examples only when they are directly relevant to the current phase.
|
package/dist/artifacts.js
CHANGED
|
@@ -163,6 +163,20 @@ export function taskContextFile(taskKey, iteration) {
|
|
|
163
163
|
export function taskContextJsonFile(taskKey, iteration) {
|
|
164
164
|
return versionedJsonArtifactFile(taskKey, "task-context", iteration);
|
|
165
165
|
}
|
|
166
|
+
export function projectGuidanceArtifactStem(phase) {
|
|
167
|
+
switch (phase) {
|
|
168
|
+
case "repair/review-fix":
|
|
169
|
+
return "project-guidance-repair-review-fix";
|
|
170
|
+
default:
|
|
171
|
+
return `project-guidance-${phase}`;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export function projectGuidanceFile(taskKey, phase, iteration) {
|
|
175
|
+
return versionedMarkdownArtifactFile(taskKey, projectGuidanceArtifactStem(phase), iteration);
|
|
176
|
+
}
|
|
177
|
+
export function projectGuidanceJsonFile(taskKey, phase, iteration) {
|
|
178
|
+
return versionedJsonArtifactFile(taskKey, projectGuidanceArtifactStem(phase), iteration);
|
|
179
|
+
}
|
|
166
180
|
export function taskDescribeInputJsonFile(taskKey) {
|
|
167
181
|
return taskArtifactsFile(taskKey, `task-describe-input-${taskKey}.json`);
|
|
168
182
|
}
|
|
@@ -175,6 +189,33 @@ export function gitStatusJsonFile(taskKey) {
|
|
|
175
189
|
export function gitDiffFile(taskKey) {
|
|
176
190
|
return taskWorkspaceFile(taskKey, `git-diff-${taskKey}.txt`);
|
|
177
191
|
}
|
|
192
|
+
export function repoInventoryFile(taskKey) {
|
|
193
|
+
return taskWorkspaceFile(taskKey, `repo-inventory-${taskKey}.md`);
|
|
194
|
+
}
|
|
195
|
+
export function repoInventoryJsonFile(taskKey) {
|
|
196
|
+
return taskArtifactsFile(taskKey, `repo-inventory-${taskKey}.json`);
|
|
197
|
+
}
|
|
198
|
+
export function practiceCandidatesFile(taskKey) {
|
|
199
|
+
return taskWorkspaceFile(taskKey, `practice-candidates-${taskKey}.md`);
|
|
200
|
+
}
|
|
201
|
+
export function practiceCandidatesJsonFile(taskKey) {
|
|
202
|
+
return taskArtifactsFile(taskKey, `practice-candidates-${taskKey}.json`);
|
|
203
|
+
}
|
|
204
|
+
export function playbookQuestionsJsonFile(taskKey) {
|
|
205
|
+
return taskArtifactsFile(taskKey, `playbook-questions-${taskKey}.json`);
|
|
206
|
+
}
|
|
207
|
+
export function playbookAnswersJsonFile(taskKey) {
|
|
208
|
+
return taskArtifactsFile(taskKey, `playbook-answers-${taskKey}.json`);
|
|
209
|
+
}
|
|
210
|
+
export function playbookDraftFile(taskKey) {
|
|
211
|
+
return taskWorkspaceFile(taskKey, `playbook-draft-${taskKey}.md`);
|
|
212
|
+
}
|
|
213
|
+
export function playbookDraftJsonFile(taskKey) {
|
|
214
|
+
return taskArtifactsFile(taskKey, `playbook-draft-${taskKey}.json`);
|
|
215
|
+
}
|
|
216
|
+
export function playbookWriteResultJsonFile(taskKey) {
|
|
217
|
+
return taskArtifactsFile(taskKey, `playbook-write-result-${taskKey}.json`);
|
|
218
|
+
}
|
|
178
219
|
export function gitCommitMessageJsonFile(taskKey) {
|
|
179
220
|
return taskArtifactsFile(taskKey, `git-commit-message-${taskKey}.json`);
|
|
180
221
|
}
|