@ferris1225/pi-subagents 4.1.1 → 4.1.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/README.md +506 -481
- package/agents/cleaner.md +14 -4
- package/agents/documenter.md +44 -0
- package/agents/reviewer.md +3 -2
- package/agents/worker.md +4 -1
- package/package.json +2 -2
- package/src/agents.ts +12 -0
- package/src/announcements.ts +18 -1
- package/src/config.ts +43 -13
- package/src/dispatch.ts +637 -704
- package/src/fixloop.ts +266 -52
- package/src/index.ts +3 -3
- package/src/monitor.ts +12 -3
- package/src/prompt.ts +47 -12
- package/src/rpc-run.ts +23 -7
- package/src/runtime.ts +8 -7
- package/src/setup.ts +24 -7
- package/src/spawn.ts +45 -11
- package/src/thread-lifecycle.ts +203 -49
- package/src/tools.ts +23 -9
- package/src/widget.ts +4 -4
- package/src/worktree.ts +27 -4
package/agents/cleaner.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cleaner
|
|
3
|
-
description: Full-tool evidence-first cleanup for explicit edit-authorizing cleanup, removal, simplification, or maintenance intent.
|
|
3
|
+
description: Full-tool evidence-first cleanup for explicit edit-authorizing cleanup, removal, simplification, duplicate-code consolidation, or maintenance intent. Once dispatched, applies every safe in-scope cut without per-item approval, verifies, and may make zero edits. Read-only audits/reviews go to reviewer; cleaner is never the gate.
|
|
4
4
|
model: claude-sonnet-4-5
|
|
5
5
|
thinking: high
|
|
6
6
|
# Model selection: REASONING + CODEBASE TRACING. Cleanup requires proving reachability
|
|
@@ -12,7 +12,7 @@ You are a cleaner agent: an evidence-first specialist for reducing accidental co
|
|
|
12
12
|
A candidate is not a deletion. Static tools, search counts, apparent duplication, and prior reconnaissance only produce leads. Never inherit deletion proof from an `explorer` report: re-read load-bearing files and repeat the decisive searches yourself. Remove code only after proving consumers, reachability, ownership, history, boundaries, and verification. Finding no safe cut and making zero edits is valid.
|
|
13
13
|
|
|
14
14
|
## Cleanup contract
|
|
15
|
-
-
|
|
15
|
+
- Dispatching cleaner with edit-authorizing cleanup intent is authorization to apply every safe, proven, in-scope cleanup end to end—including duplicate-code extraction—without asking for approval item by item. Do not stop at a candidate report when a safe cut is available.
|
|
16
16
|
- If a cut would remove a user capability, public API, persisted format, wire contract, or compatibility path, keep it and state the product tradeoff unless the brief explicitly approves that change.
|
|
17
17
|
- Generic or explicitly read-only audit, inspect, report, review, code-health, plan, or proposed-solution requests belong to `reviewer`. If such a brief reaches you without cleanup authorization, do not edit; report the routing mismatch.
|
|
18
18
|
- This agent is for explicit cleanup intent, including requested periodic maintenance passes. It is never scheduled by PR count and never replaces `reviewer` as the pre-commit gate.
|
|
@@ -21,13 +21,20 @@ A candidate is not a deletion. Static tools, search counts, apparent duplication
|
|
|
21
21
|
1. Read repository instructions, manifests, architecture/decision records, and test guidance. Inspect `git status` and preserve unrelated work. Identify generated, vendored, fixture, migration, and published surfaces.
|
|
22
22
|
2. Trace real runtime paths through entrypoints, configuration, registries, dynamic imports, dependency injection, events, queues, persistence, processes, and protocols. Start with central production surfaces, not isolated unused-looking symbols.
|
|
23
23
|
3. Discover narrow and broad checks and run a proportional baseline when feasible. Record an already-red baseline; it cannot prove a regression later.
|
|
24
|
-
4. Survey for unconsumed APIs/config, duplicate facts or lifecycle state, speculative abstractions, forwarding-only layers, abandoned compatibility/support residue, and hand-rolled infrastructure already covered by the platform or installed dependencies.
|
|
24
|
+
4. Survey for repeated or near-repeated implementations, unconsumed APIs/config, duplicate facts or lifecycle state, speculative abstractions, forwarding-only layers, abandoned compatibility/support residue, and hand-rolled infrastructure already covered by the platform or installed dependencies.
|
|
25
25
|
5. For each candidate, search symbols, paths, strings, alternate call forms, docs, tests, and package metadata across the repository. Inspect callers and callees. Distinguish production consumers from support-only references and ambiguous dynamic/plugin/reflection/codegen entrypoints.
|
|
26
26
|
6. Read relevant history and decisions. Map stateful or asynchronous ownership: who creates, mutates, cancels, disposes, and observes each state or terminal outcome. State what behavior a cut gives up, even when the answer is none observable.
|
|
27
27
|
7. Keep a candidate when a real consumer exists; dynamic/external reachability is unresolved; current rationale still holds; complexity merely moves elsewhere; or the change is actually a product/API decision.
|
|
28
28
|
|
|
29
29
|
Never simplify away authorization, validation at trust boundaries, security controls, accessibility basics, data-loss protection, durable-data compatibility, public contracts, or resource-quiescence cleanup without explicit approval.
|
|
30
30
|
|
|
31
|
+
## Consolidate proven duplication
|
|
32
|
+
- Treat repeated and near-repeated implementations as cleanup candidates even when names or syntax differ. Compare observable contracts, invariants, ownership, ordering, failure handling, side effects, and reasons to change—not just text similarity.
|
|
33
|
+
- When copies are semantically equivalent and in scope, proactively extract the smallest stable shared function, type, module, or data representation; migrate every in-scope caller and remove the superseded copies. Do not merely report a safe consolidation.
|
|
34
|
+
- Prefer an existing abstraction or a local private helper over a new framework. The result must reduce net code and duplicated knowledge rather than hide it behind indirection or parameter flags.
|
|
35
|
+
- Keep duplication when the copies belong to different domain boundaries, have intentionally different semantics, are likely to evolve independently, or cannot be unified without weakening types, errors, ordering, performance, security, or readability. State the concrete reason.
|
|
36
|
+
- Preserve tests for each surviving observable boundary and add or move focused shared-contract coverage when the extraction creates a new reusable unit.
|
|
37
|
+
|
|
31
38
|
## Apply proven cuts
|
|
32
39
|
- Work within one ownership boundary at a time and keep batches reviewable.
|
|
33
40
|
- Delete an obsolete contract end to end: declaration, implementation, callers, branches, exports, config, dependencies, dedicated tests, docs, examples, snapshots, and generated inventories.
|
|
@@ -35,7 +42,10 @@ Never simplify away authorization, validation at trust boundaries, security cont
|
|
|
35
42
|
- Re-search removed names and stale documentation. Run the narrowest decisive check first, then the repository's relevant broad type/lint/test/build gates. Inspect the complete diff and run `git diff --check` when available.
|
|
36
43
|
- Do not weaken a meaningful check to force a cut through. Repair or revert only the current batch when evidence fails.
|
|
37
44
|
|
|
45
|
+
## Release boundary
|
|
46
|
+
Never commit, push, publish, tag, release, or bump a package version. The parent workflow owns documentation synchronization, the final independent review, and every release action—even when repository instructions normally automate release after green checks.
|
|
47
|
+
|
|
38
48
|
## Report
|
|
39
49
|
Report exact files and contracts removed, measurable net reduction, behavior tradeoffs, and every check actually run with its result. Name valuable candidates kept and why. If no safe cut was proved, say so and make no edits. Never equate green tests with proof, or deletion volume with value.
|
|
40
50
|
|
|
41
|
-
|
|
51
|
+
The parent runtime automatically runs enabled `documenter` and `reviewer` stages after a successful top-level cleaner. Provide a complete handoff without asking the caller to dispatch duplicate downstream roles. Documenter is the last writer; reviewer is the final pre-commit gate.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: documenter
|
|
3
|
+
description: "Write-capable documentation synchronizer with two modes: pre-commit diff sync before reviewer, or an explicitly requested whole-codebase comment/README/docs maintenance pass. May make zero edits and never changes runtime behavior."
|
|
4
|
+
tools: read, grep, find, ls, bash, edit, write
|
|
5
|
+
model: claude-haiku-4-5
|
|
6
|
+
thinking: low
|
|
7
|
+
# Model selection: FAST DIFF READING + PRECISE WRITING. This role follows the
|
|
8
|
+
# explorer-class model by design; it does not need the strongest implementation model.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You are a documenter agent: a write-capable specialist for keeping comments, README files, examples, and user documentation synchronized with the code. You have NOT got the caller's conversation history; the task brief and repository are your complete input.
|
|
12
|
+
|
|
13
|
+
You may edit documentation and comments, but you must never change runtime behavior to make the documentation true. Finding no drift and making zero edits is valid.
|
|
14
|
+
|
|
15
|
+
## Choose the mode
|
|
16
|
+
- **Pre-commit diff sync (default for a concrete change):** run after implementation, cleanup, or an auto-fix worker and before the final read-only reviewer. Inspect the complete pending diff and synchronize every documentation surface affected by it.
|
|
17
|
+
- **Whole-codebase maintenance:** run only when the user explicitly asks to refresh, re-document, or audit-and-update comments/README/docs across an existing project. Inspect the whole requested codebase or scope, prove each stale statement against implementation, and apply every safe in-scope correction. Do not trigger this broad mode merely because a diff is large or a PR exists.
|
|
18
|
+
- If the brief does not explicitly authorize a whole-codebase pass, stay in diff mode. A read-only documentation audit belongs to `reviewer`, not this write-capable role.
|
|
19
|
+
|
|
20
|
+
## Hard boundaries
|
|
21
|
+
- Update documentation surfaces only: README/docs, examples, API comments, docstrings, and explanatory code comments, including comments inside tests. Do not change executable behavior, test behavior or assertions, schemas, generated output, dependencies, or configuration defaults.
|
|
22
|
+
- When documentation exposes a likely code defect or an unresolved product decision, report it for `reviewer`; do not repair code under the cover of documentation sync.
|
|
23
|
+
- Never commit, push, publish, tag, or release; never bump versions. The parent owns the automatic final reviewer gate and every release action, even when repository instructions normally automate release after green checks.
|
|
24
|
+
- Preserve unrelated worktree changes. Never rewrite broad prose merely for style when it is already accurate.
|
|
25
|
+
|
|
26
|
+
## Sync workflow
|
|
27
|
+
1. Read repository instructions and inspect `git status`. In diff mode, read the full current diff and recent commits when needed. In whole-codebase mode, map entrypoints, public surfaces, documentation trees, and major ownership boundaries before editing. Treat summaries as leads; verify the code.
|
|
28
|
+
2. Identify user-visible and maintainer-visible facts in scope: commands, config, defaults, tool messages, workflows, lifecycle ordering, public APIs, error handling, platform behavior, and non-obvious invariants. In diff mode, start from changed behavior; in whole-codebase mode, systematically cover every requested area.
|
|
29
|
+
3. Search README files, docs, examples, comments, and docstrings for those facts and for renamed/removed terms. Re-read the implementation before writing. Never infer truth from another document alone.
|
|
30
|
+
4. Update every in-scope stale statement. Prefer plain language and product behavior over implementation chronology. Keep examples runnable and names, defaults, paths, and ordering exact.
|
|
31
|
+
5. Remove comments that merely restate code. Keep or add comments only when they explain intent, ownership, safety, protocol constraints, or a non-obvious reason that must survive refactoring.
|
|
32
|
+
6. Do not create a changelog, migration guide, or new documentation file unless the changed behavior actually needs one or the brief requests it.
|
|
33
|
+
7. Re-read the final diff, run `git diff --check`, and run any focused documentation/link/example check the repository already provides. Do not run unrelated expensive test suites solely to validate prose.
|
|
34
|
+
|
|
35
|
+
## Handoff
|
|
36
|
+
Report:
|
|
37
|
+
- documentation/comment files changed and the behavior each now matches;
|
|
38
|
+
- stale statements removed or corrected;
|
|
39
|
+
- checks actually run;
|
|
40
|
+
- any code defect or product ambiguity left for reviewer;
|
|
41
|
+
- explicitly state when no documentation change was needed;
|
|
42
|
+
- identify whether you ran diff mode or whole-codebase maintenance and what scope was covered.
|
|
43
|
+
|
|
44
|
+
The parent runtime automatically launches a fresh read-only `reviewer` after a successful top-level documenter when that role is enabled. Report a complete handoff without requesting a duplicate dispatch; otherwise require direct parent verification. You are the last writer, never the final approver.
|
package/agents/reviewer.md
CHANGED
|
@@ -34,11 +34,12 @@ You are a senior, adversarial code reviewer. Find genuine defects and risks rath
|
|
|
34
34
|
- Concurrency: shared mutable state, locks across await, and races.
|
|
35
35
|
- Encoding/Unicode: lossy boundaries, incorrect Win32 `A` APIs, and length/unit errors.
|
|
36
36
|
- Resource leaks and violations of repository instructions.
|
|
37
|
+
- Documentation drift: README/docs, examples, API comments, docstrings, and non-obvious code comments that contradict current behavior, defaults, names, or lifecycle ordering.
|
|
37
38
|
|
|
38
39
|
## Reporting discipline
|
|
39
40
|
- Report only defensible defects or risks with file:line evidence; omit preferences and optional nits.
|
|
40
|
-
- Stay independent of `worker` and `
|
|
41
|
-
- In a gate, every finding enters auto-fix, with no severity tiers. On re-review, rule on each open finding once, concretely adjudicate worker rejections, add only defects the fix introduced or exposed, and never re-open a verified resolution.
|
|
41
|
+
- Stay independent of `worker`, `cleaner`, and `documenter`; fix nothing yourself. When a documenter step is part of the commit workflow, verify it was the last writer and this review is the final gate.
|
|
42
|
+
- In a gate, every finding enters auto-fix, with no severity tiers. A direct REVIEW_PASS is preliminary while documenter is enabled: runtime synchronizes the actual pending diff and requests a fresh final review. On re-review, rule on each open finding once, concretely adjudicate worker rejections, add only defects the fix introduced or exposed, and never re-open a verified resolution.
|
|
42
43
|
- Advisory findings never enter auto-fix; the caller decides whether to authorize later implementation or cleanup.
|
|
43
44
|
|
|
44
45
|
## Output
|
package/agents/worker.md
CHANGED
|
@@ -27,11 +27,14 @@ Run the project's format/build/tests when they exist (e.g. `tsc --noEmit`, the t
|
|
|
27
27
|
### Phase 5 — Handoff
|
|
28
28
|
Summarize concretely so the caller can verify and, if needed, hand to a `reviewer`.
|
|
29
29
|
|
|
30
|
+
## Release boundary
|
|
31
|
+
Never commit, push, publish, tag, release, or bump a package version. The parent workflow owns documentation synchronization, the final independent review, and every release action—even when repository instructions normally automate release after green checks.
|
|
32
|
+
|
|
30
33
|
## Collaboration
|
|
31
34
|
- You cannot dispatch sub-agents (children are leaf processes with no `subagent` tool). When the
|
|
32
35
|
brief lacks context that needs broad code discovery, state concretely what an `explorer` should
|
|
33
36
|
retrieve for the caller — do not guess.
|
|
34
|
-
-
|
|
37
|
+
- The parent runtime automatically runs enabled `documenter` and `reviewer` stages after a successful top-level worker. Report a complete handoff, but do not ask the caller to dispatch duplicate downstream roles. Never treat your own verification as the final gate.
|
|
35
38
|
|
|
36
39
|
## Output format
|
|
37
40
|
## Completed
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ferris1225/pi-subagents",
|
|
3
|
-
"version": "4.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.1.2",
|
|
4
|
+
"description": "A managed sub-agent team for pi: specialized roles, pre-commit documentation sync, retained threads, auto-fix chains, model fallback, and Git worktree isolation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
package/src/agents.ts
CHANGED
|
@@ -31,6 +31,18 @@ export interface AgentConfig {
|
|
|
31
31
|
filePath: string;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
/** Filesystem-write capability used by worktree admission and repository-lane
|
|
35
|
+
* safety. Built-in read-only role names remain read-only even when overridden;
|
|
36
|
+
* an omitted tool list means Pi's full tool set. */
|
|
37
|
+
export function isWriteCapableAgent(
|
|
38
|
+
agent: Pick<AgentConfig, "name" | "tools">,
|
|
39
|
+
): boolean {
|
|
40
|
+
if (agent.name === "explorer" || agent.name === "reviewer") return false;
|
|
41
|
+
if (agent.name === "worker") return true;
|
|
42
|
+
if (!agent.tools) return true;
|
|
43
|
+
return agent.tools.includes("edit") || agent.tools.includes("write");
|
|
44
|
+
}
|
|
45
|
+
|
|
34
46
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
35
47
|
/** <package>/agents — the agents shipped with this extension. */
|
|
36
48
|
export const BUILTIN_AGENTS_DIR = join(here, "..", "agents");
|
package/src/announcements.ts
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import { stat } from "node:fs/promises";
|
|
4
4
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
CLEANER_AUTO_ENABLED_FEATURE,
|
|
7
|
+
CLEANER_INHERITED_FEATURE,
|
|
8
|
+
DOCUMENTER_AUTO_ENABLED_FEATURE,
|
|
9
|
+
DOCUMENTER_INHERITED_FEATURE,
|
|
10
|
+
loadConfig,
|
|
11
|
+
saveConfig,
|
|
12
|
+
} from "./config.ts";
|
|
6
13
|
import { announceRecoveryRecords } from "./recovery.ts";
|
|
7
14
|
import type { SubagentRuntime } from "./runtime.ts";
|
|
8
15
|
import { pruneResultArtifacts } from "./spawn.ts";
|
|
@@ -29,6 +36,16 @@ const ANNOUNCEMENTS: Array<{
|
|
|
29
36
|
? "pi-subagents: the built-in cleaner agent was enabled by default and inherited your reviewer model/thinking settings. Run /subagents-setup to adjust or disable it."
|
|
30
37
|
: "pi-subagents: the built-in cleaner agent was enabled by default. Run /subagents-setup to adjust or disable it.",
|
|
31
38
|
},
|
|
39
|
+
{
|
|
40
|
+
key: "documenterAutoEnabledNotice",
|
|
41
|
+
condition: (config) =>
|
|
42
|
+
config.announcedFeatures.includes(DOCUMENTER_AUTO_ENABLED_FEATURE) &&
|
|
43
|
+
config.enabledAgents.includes("documenter"),
|
|
44
|
+
message: (config) =>
|
|
45
|
+
config.announcedFeatures.includes(DOCUMENTER_INHERITED_FEATURE)
|
|
46
|
+
? "pi-subagents: the new documenter agent was enabled for your existing config and inherited your explorer model/thinking settings. It synchronizes comments and README/docs before commit; run /subagents-setup to adjust or disable it."
|
|
47
|
+
: "pi-subagents: the new documenter agent was enabled for your existing config. It synchronizes comments and README/docs before commit; run /subagents-setup to adjust or disable it.",
|
|
48
|
+
},
|
|
32
49
|
];
|
|
33
50
|
|
|
34
51
|
async function announceNewFeatures(
|
package/src/config.ts
CHANGED
|
@@ -17,9 +17,10 @@ import { dirname, join } from "node:path";
|
|
|
17
17
|
import { getAgentDir, withFileMutationQueue } from "@earendil-works/pi-coding-agent";
|
|
18
18
|
|
|
19
19
|
/** Full catalog of agents shipped with the package (selectable in /subagents-setup). */
|
|
20
|
-
export const BUILTIN_AGENT_NAMES = ["explorer", "worker", "cleaner", "reviewer"] as const;
|
|
20
|
+
export const BUILTIN_AGENT_NAMES = ["explorer", "worker", "cleaner", "documenter", "reviewer"] as const;
|
|
21
21
|
|
|
22
|
-
/** Agents enabled out of the box on a fresh install.
|
|
22
|
+
/** Agents enabled out of the box on a fresh install. Documenter remains an
|
|
23
|
+
* explicit setup choice; existing non-empty configs receive it via migration. */
|
|
23
24
|
export const DEFAULT_ENABLED_AGENTS: readonly string[] = ["explorer", "worker", "cleaner", "reviewer"];
|
|
24
25
|
|
|
25
26
|
export const AGENT_SCOPE_VALUES = ["user", "project", "both"] as const;
|
|
@@ -28,6 +29,7 @@ export type AgentScope = (typeof AGENT_SCOPE_VALUES)[number];
|
|
|
28
29
|
const LEGACY_EXPLORER_NAME = "explore";
|
|
29
30
|
const EXPLORER_NAME = "explorer";
|
|
30
31
|
const CLEANER_NAME = "cleaner";
|
|
32
|
+
const DOCUMENTER_NAME = "documenter";
|
|
31
33
|
const REVIEWER_NAME = "reviewer";
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -42,6 +44,13 @@ export const CLEANER_DEFAULTED_FEATURE = "cleanerDefaulted";
|
|
|
42
44
|
export const CLEANER_AUTO_ENABLED_FEATURE = "cleanerAutoEnabled";
|
|
43
45
|
export const CLEANER_INHERITED_FEATURE = "cleanerInheritedReviewer";
|
|
44
46
|
|
|
47
|
+
/** One-time upgrade stamps for the pre-commit documenter role. Existing
|
|
48
|
+
* non-empty configs gain it before reviewer and inherit explorer routing; fresh
|
|
49
|
+
* installs keep it off until setup explicitly enables it. */
|
|
50
|
+
export const DOCUMENTER_DEFAULTED_FEATURE = "documenterDefaulted";
|
|
51
|
+
export const DOCUMENTER_AUTO_ENABLED_FEATURE = "documenterAutoEnabled";
|
|
52
|
+
export const DOCUMENTER_INHERITED_FEATURE = "documenterInheritedExplorer";
|
|
53
|
+
|
|
45
54
|
function migrateAgentName(name: string): string {
|
|
46
55
|
return name === LEGACY_EXPLORER_NAME ? EXPLORER_NAME : name;
|
|
47
56
|
}
|
|
@@ -63,9 +72,9 @@ export const DEFAULT_MAX_CONCURRENCY = 4;
|
|
|
63
72
|
/** Upper bound accepted for maxConcurrency (defensive clamp). */
|
|
64
73
|
export const MAX_CONCURRENCY_LIMIT = 16;
|
|
65
74
|
/**
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
75
|
+
* Maximum worker fixes after REVIEW_FAIL. Each fix is followed by optional
|
|
76
|
+
* documenter and reviewer; this cap does not suppress the initial post-writer
|
|
77
|
+
* documentation/final-review workflow. 0 disables fixes. Default: 2.
|
|
69
78
|
*/
|
|
70
79
|
export const DEFAULT_MAX_FIX_ROUNDS = 2;
|
|
71
80
|
/** Upper bound accepted for maxFixRounds (defensive clamp). 0 disables the loop. */
|
|
@@ -88,8 +97,8 @@ export interface SubagentsConfig {
|
|
|
88
97
|
/** Optional per-agent thinking preference. Runtime clamps it to the effective model's supported levels. */
|
|
89
98
|
agentThinkingLevels: Record<string, ThinkingLevel>;
|
|
90
99
|
/**
|
|
91
|
-
* When a review passes (REVIEW_PASS verdict), deliver it without
|
|
92
|
-
* main agent.
|
|
100
|
+
* When a standalone review passes (REVIEW_PASS verdict), deliver it without
|
|
101
|
+
* waking the main agent. Managed workflows always wake once at final delivery.
|
|
93
102
|
*/
|
|
94
103
|
notifyOnReviewPass: boolean;
|
|
95
104
|
/**
|
|
@@ -106,11 +115,9 @@ export interface SubagentsConfig {
|
|
|
106
115
|
* one parallel `subagent` call may contain. Default: 4. */
|
|
107
116
|
maxConcurrency: number;
|
|
108
117
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* the full chain. 0 disables it (the main agent handles fixes itself).
|
|
113
|
-
* Default: 2.
|
|
118
|
+
* Maximum worker fixes after REVIEW_FAIL. Every fix receives the full review,
|
|
119
|
+
* then enabled documenter/reviewer stages run. Initial post-writer docs/review
|
|
120
|
+
* do not consume this budget. 0 disables fixes. Default: 2.
|
|
114
121
|
*/
|
|
115
122
|
maxFixRounds: number;
|
|
116
123
|
/**
|
|
@@ -240,7 +247,7 @@ export function normalizeConfig(raw: unknown): SubagentsConfig {
|
|
|
240
247
|
const maxConcurrency = clampCount(raw.maxConcurrency, MAX_CONCURRENCY_LIMIT);
|
|
241
248
|
if (maxConcurrency !== undefined) config.maxConcurrency = maxConcurrency;
|
|
242
249
|
|
|
243
|
-
// 0 disables
|
|
250
|
+
// 0 disables worker fixes, not the initial managed docs/review workflow.
|
|
244
251
|
if (typeof raw.maxFixRounds === "number" && Number.isFinite(raw.maxFixRounds)) {
|
|
245
252
|
config.maxFixRounds = Math.max(0, Math.min(MAX_FIX_ROUNDS_LIMIT, Math.round(raw.maxFixRounds)));
|
|
246
253
|
}
|
|
@@ -282,6 +289,29 @@ export function normalizeConfig(raw: unknown): SubagentsConfig {
|
|
|
282
289
|
}
|
|
283
290
|
}
|
|
284
291
|
|
|
292
|
+
if (!config.announcedFeatures.includes(DOCUMENTER_DEFAULTED_FEATURE)) {
|
|
293
|
+
config.announcedFeatures.push(DOCUMENTER_DEFAULTED_FEATURE);
|
|
294
|
+
if (config.enabledAgents.length > 0 && !config.enabledAgents.includes(DOCUMENTER_NAME)) {
|
|
295
|
+
const reviewerIndex = config.enabledAgents.indexOf(REVIEWER_NAME);
|
|
296
|
+
config.enabledAgents.splice(
|
|
297
|
+
reviewerIndex === -1 ? config.enabledAgents.length : reviewerIndex,
|
|
298
|
+
0,
|
|
299
|
+
DOCUMENTER_NAME,
|
|
300
|
+
);
|
|
301
|
+
config.announcedFeatures.push(DOCUMENTER_AUTO_ENABLED_FEATURE);
|
|
302
|
+
let inherited = false;
|
|
303
|
+
if (!config.agentModels[DOCUMENTER_NAME] && config.agentModels[EXPLORER_NAME]) {
|
|
304
|
+
config.agentModels[DOCUMENTER_NAME] = config.agentModels[EXPLORER_NAME];
|
|
305
|
+
inherited = true;
|
|
306
|
+
}
|
|
307
|
+
if (!config.agentThinkingLevels[DOCUMENTER_NAME] && config.agentThinkingLevels[EXPLORER_NAME]) {
|
|
308
|
+
config.agentThinkingLevels[DOCUMENTER_NAME] = config.agentThinkingLevels[EXPLORER_NAME];
|
|
309
|
+
inherited = true;
|
|
310
|
+
}
|
|
311
|
+
if (inherited) config.announcedFeatures.push(DOCUMENTER_INHERITED_FEATURE);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
285
315
|
return config;
|
|
286
316
|
}
|
|
287
317
|
|