@d3ara1n/pi-subagent 3.1.0 → 3.2.0
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 +6 -4
- package/package.json +1 -1
- package/src/roles.ts +9 -2
package/README.md
CHANGED
|
@@ -41,13 +41,13 @@ Observations on how main models behave with this plugin, one family per subsecti
|
|
|
41
41
|
| Role | Model Role | Timeout | Tools | Can Delegate To | Description |
|
|
42
42
|
|------|-----------|---------|-------|-----------------|-------------|
|
|
43
43
|
| `explorer` | fast | 900s | read, find, grep, bash | — | Fast code exploration incl. git history inspection (read-only) |
|
|
44
|
-
| `reviewer` | heavy | 3600s | read, bash, grep, find |
|
|
44
|
+
| `reviewer` | heavy | 3600s | read, bash, grep, find, subagent_delegate | explorer, researcher | Deep code review, runs git/tests for evidence (read-only); delegates exploration & web verification |
|
|
45
45
|
| `worker` | default | 2400s | all (no whitelist) | explorer, researcher | Implementation — the only role that can modify files; full tool access (web, MCP, everything) |
|
|
46
|
-
| `researcher` | fast | 2400s | web_search, fetch_content, source_check, get_search_content, read, bash, edit, write,
|
|
46
|
+
| `researcher` | fast | 2400s | web_search, fetch_content, source_check, get_search_content, read, bash, edit, write, subagent_delegate | explorer | Web research + GitHub repo analysis; writes artifacts only inside its temp dir |
|
|
47
47
|
|
|
48
48
|
**Web tool naming**: `researcher`'s web tools use the community-standard names (`web_search`, `fetch_content`, `source_check`, `get_search_content`) shared by the most popular Pi web extensions — [pi-web-access](https://github.com/nicobailon/pi-web-access), `pi-web-tools`, `pi-browse`, and others. Install any of those and the researcher gets web access out of the box. If your web extension uses different tool names (e.g. `websearch`/`webfetch`) or you renamed the tools via a `toolNames` config, override `researcher.tools` in `agentOverrides` to match.
|
|
49
49
|
|
|
50
|
-
**Nested delegation**: `worker` and `researcher` can spawn their own subagents. This keeps the
|
|
50
|
+
**Nested delegation**: `worker`, `reviewer`, and `researcher` can spawn their own subagents. This keeps the caller's context clean — a worker can explore unfamiliar code via an `explorer` subagent without returning intermediate results, and a reviewer can verify third-party library behavior via a `researcher` subagent without leaving the diff.
|
|
51
51
|
|
|
52
52
|
**Parallel execution**: To run multiple subagents concurrently, emit multiple `subagent_delegate` calls in a single turn. Pi's framework executes them in parallel automatically, with each subagent getting its own TUI progress display.
|
|
53
53
|
|
|
@@ -134,6 +134,8 @@ Timeouts are defined per role. Built-in defaults are `explorer: 900`, `reviewer:
|
|
|
134
134
|
|
|
135
135
|
Override, disable, or add subagent roles via `agentOverrides`. Built-in and custom roles are treated equally — all descriptions, examples, and decision triggers feed into the LLM's prompt dynamically.
|
|
136
136
|
|
|
137
|
+
The built-in roles are defined in [`src/roles.ts`](src/roles.ts) — read them as reference templates when overriding. Each entry shows the exact shape and wording of every field (`role`, `description`, `examples`, `decisionTrigger`, `tools`/`subagentRoles`, `systemPrompt`, `timeout`, `fallbackRole`), so you can copy the built-in closest to what you want, paste it under `agentOverrides`, and adjust from a known-good starting point rather than writing a role from scratch.
|
|
138
|
+
|
|
137
139
|
```json
|
|
138
140
|
{
|
|
139
141
|
"subagent": {
|
|
@@ -172,7 +174,7 @@ Override, disable, or add subagent roles via `agentOverrides`. Built-in and cust
|
|
|
172
174
|
|
|
173
175
|
Configuring both on the same role is an error — the role is skipped with an error notification at session start.
|
|
174
176
|
|
|
175
|
-
**Optional fields:** `subagentRoles` (roles this role can spawn via delegate), `timeout` (per-role active-time timeout in seconds; unset or `0` is unlimited, negative values normalize to `0`), `maxTurns` / `maxCost` (per-role budget overrides; unset uses the top-level `maxTurns` / `maxCost` setting, `0` is unlimited, negative values normalize to `0`), `fallbackRole` (backup pi-model-roles role the whole run is retried on after a provider error; unset means no retry — see [Fallback observability](#fallback-observability)).
|
|
177
|
+
**Optional fields:** `subagentRoles` (roles this role can spawn via delegate; absent means any available role, mirroring the `tools` default — declare it explicitly when a restricted role grants `subagent_delegate`), `timeout` (per-role active-time timeout in seconds; unset or `0` is unlimited, negative values normalize to `0`), `maxTurns` / `maxCost` (per-role budget overrides; unset uses the top-level `maxTurns` / `maxCost` setting, `0` is unlimited, negative values normalize to `0`), `fallbackRole` (backup pi-model-roles role the whole run is retried on after a provider error; unset means no retry — see [Fallback observability](#fallback-observability)).
|
|
176
178
|
|
|
177
179
|
Invalid custom roles (missing required fields) are skipped with an error notification at session start.
|
|
178
180
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d3ara1n/pi-subagent",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Role-based subagent orchestration for pi — delegates tasks to specialized pi child processes with configurable model roles",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/roles.ts
CHANGED
|
@@ -40,17 +40,24 @@ export const BUILTIN_ROLES: Record<string, SubagentRole> = {
|
|
|
40
40
|
fallbackRole: "default",
|
|
41
41
|
timeout: 3600,
|
|
42
42
|
description:
|
|
43
|
-
"READ-ONLY code review & analysis — audit code, assess architecture, review diffs, run tests for evidence. Reports findings and suggested fixes but never implements them.",
|
|
43
|
+
"READ-ONLY code review & analysis — audit code, assess architecture, review diffs, run tests for evidence. Reports findings and suggested fixes but never implements them. Can delegate to explorer/researcher.",
|
|
44
44
|
examples: [
|
|
45
45
|
"Review the error handling in src/api/ for security issues",
|
|
46
46
|
"Audit this PR diff for performance regressions",
|
|
47
47
|
],
|
|
48
48
|
decisionTrigger: "Task audits or reviews code quality?",
|
|
49
|
-
tools: ["read", "bash", "grep", "find"],
|
|
49
|
+
tools: ["read", "bash", "grep", "find", "subagent_delegate"],
|
|
50
|
+
subagentRoles: ["explorer", "researcher"],
|
|
50
51
|
systemPrompt: [
|
|
51
52
|
"Senior code reviewer. READ-ONLY — you must NOT modify any file.",
|
|
52
53
|
"If the task asks you to fix or implement, do NOT do it: report findings and suggested fixes, and state that implementation is out of scope for this role.",
|
|
53
54
|
"Run only read-only commands (git diff/log/show, test runs). Never use sed, tee, echo >, or any write command.",
|
|
55
|
+
"",
|
|
56
|
+
"## Delegation",
|
|
57
|
+
"You have a `subagent_delegate` tool — spend it to keep your review context focused:",
|
|
58
|
+
"- subagent_delegate(role=explorer) to map unfamiliar code touched by the change under review",
|
|
59
|
+
"- subagent_delegate(role=researcher) to verify third-party library APIs/versions against official docs",
|
|
60
|
+
"Don't delegate the review itself — reading and judging the code is your job.",
|
|
54
61
|
"Provide evidence-backed findings with file:line references.",
|
|
55
62
|
"",
|
|
56
63
|
"Output format (prioritize critical issues first):",
|