@ferris1225/pi-subagents 0.28.0 → 0.31.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 +270 -597
- package/agents/explore.md +1 -0
- package/agents/reviewer.md +1 -0
- package/agents/worker.md +1 -1
- package/package.json +1 -1
- package/src/completion.ts +28 -0
- package/src/config.ts +25 -0
- package/src/dispatch.ts +845 -0
- package/src/format.ts +149 -0
- package/src/index.ts +90 -1386
- package/src/models.ts +13 -0
- package/src/monitor.ts +27 -0
- package/src/prompt.ts +10 -0
- package/src/runtime.ts +145 -0
- package/src/setup.ts +50 -0
- package/src/spawn.ts +189 -68
- package/src/tools.ts +409 -0
- package/src/ui.ts +8 -3
- package/src/widget.ts +182 -0
package/agents/explore.md
CHANGED
|
@@ -20,6 +20,7 @@ You are an explore agent: a fast, read-only reconnaissance specialist. You inves
|
|
|
20
20
|
2. Read KEY SECTIONS, not whole files. After 1-2 greps, read the top match instead of running more greps.
|
|
21
21
|
3. Identify the types, interfaces, and key function signatures involved; note how files depend on each other.
|
|
22
22
|
4. Record exact paths and line ranges so the caller can jump straight in.
|
|
23
|
+
5. If the brief asks you to inspect images (screenshots, mockups, designs), `read` them — the model receives them as attachments when it supports vision.
|
|
23
24
|
|
|
24
25
|
## Thoroughness (infer from the task, default medium)
|
|
25
26
|
- Quick: targeted lookups, key files only.
|
package/agents/reviewer.md
CHANGED
|
@@ -21,6 +21,7 @@ Match the type to the task brief; the hunt checklist below applies to every type
|
|
|
21
21
|
### 1. Code diffs (default)
|
|
22
22
|
1. Run `git diff` and `git status` to see the recent changes. If a specific file set was given, read those files.
|
|
23
23
|
2. Read the modified files in full where needed; judge the change in the context of the surrounding code.
|
|
24
|
+
3. If the brief includes images (UI screenshots, design mockups), `read` them with the read tool and judge the change against them.
|
|
24
25
|
|
|
25
26
|
### 2. Plans
|
|
26
27
|
Validate a proposed plan for feasibility and completeness: missing steps, hidden risks, alignment with the existing architecture, and whether the scope is appropriately bounded.
|
package/agents/worker.md
CHANGED
|
@@ -13,7 +13,7 @@ You are a worker agent with full capabilities, operating in an isolated context
|
|
|
13
13
|
Work in phases. Do not skip planning or verification.
|
|
14
14
|
|
|
15
15
|
### Phase 1 — Context
|
|
16
|
-
Read the brief fully. If it references files, read them before editing. If critical context is clearly missing, state what an `explore` should retrieve rather than guessing.
|
|
16
|
+
Read the brief fully. If it references files, read them before editing. If it references images (screenshots, mockups, designs), `read` them too — the model receives them as attachments when it supports vision. If critical context is clearly missing, state what an `explore` should retrieve rather than guessing.
|
|
17
17
|
|
|
18
18
|
### Phase 2 — Plan
|
|
19
19
|
Inspect existing code and conventions first. Form the smallest coherent root-cause change that satisfies the brief. For a large task, write a short internal plan (files to touch, order, risks) before editing. Do not refactor unrelated code or create docs unless the brief asks.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ferris1225/pi-subagents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "Focused sub-agent delegation for pi: explore / worker / reviewer agents in isolated context, with proactive dispatch injection and per-agent model selection.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/completion.ts
CHANGED
|
@@ -151,3 +151,31 @@ export function completionTriggersTurn(result: SingleResult, notifyOnReviewPass:
|
|
|
151
151
|
reviewVerdict(getResultOutput(result)) === "pass"
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
|
+
|
|
155
|
+
/** Minimal shape of an active run, for the "others still running" footer. Kept
|
|
156
|
+
* decoupled from the monitor's RunView so this stays a pure, easily tested
|
|
157
|
+
* formatter; the caller maps its live runs into this shape. */
|
|
158
|
+
export interface ActiveRunFoot {
|
|
159
|
+
id: number;
|
|
160
|
+
agent: string;
|
|
161
|
+
/** Optional content label (task-derived) shown next to the agent name. */
|
|
162
|
+
label?: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Footer appended to a completion message when OTHER runs are still active, so
|
|
167
|
+
* the main agent does not declare the overall task done prematurely. A result
|
|
168
|
+
* arriving for one run does not mean sibling runs are finished; naming them
|
|
169
|
+
* gives the main agent concrete, in-context awareness to keep waiting.
|
|
170
|
+
*
|
|
171
|
+
* Returns "" when nothing is active (the common, single-run case stays quiet).
|
|
172
|
+
*/
|
|
173
|
+
export function formatActiveRunsFooter(runs: readonly ActiveRunFoot[], maxListed = 4): string {
|
|
174
|
+
if (runs.length === 0) return "";
|
|
175
|
+
const listed = runs.slice(0, maxListed);
|
|
176
|
+
const items = listed
|
|
177
|
+
.map((run) => `#${run.id} ${run.agent}${run.label ? `·${run.label}` : ""}`)
|
|
178
|
+
.join(", ");
|
|
179
|
+
const more = runs.length > listed.length ? `, +${runs.length - listed.length} more` : "";
|
|
180
|
+
return `\n\n⚠ ${runs.length} other run${runs.length === 1 ? "" : "s"} still active: ${items}${more}. Do not conclude the overall task yet — wait for their results (they wake you automatically) or check subagent_status.`;
|
|
181
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -108,6 +108,18 @@ export interface SubagentsConfig {
|
|
|
108
108
|
* model. 0 disables the idle watchdog. Default: 90.
|
|
109
109
|
*/
|
|
110
110
|
idleTimeoutSec: number;
|
|
111
|
+
/**
|
|
112
|
+
* Vision-capable model for tasks flagged `vision: true` (viewing screenshots,
|
|
113
|
+
* mockups, designs). Unset means such tasks fall back to the main session's
|
|
114
|
+
* current model.
|
|
115
|
+
*/
|
|
116
|
+
visionModel?: string;
|
|
117
|
+
/**
|
|
118
|
+
* One-time feature announcements already shown to the user (e.g. "vision
|
|
119
|
+
* model" after an update that introduced it). Persisted so the notice never
|
|
120
|
+
* nags again.
|
|
121
|
+
*/
|
|
122
|
+
announcedFeatures: string[];
|
|
111
123
|
}
|
|
112
124
|
|
|
113
125
|
export const DEFAULT_CONFIG: SubagentsConfig = {
|
|
@@ -122,6 +134,7 @@ export const DEFAULT_CONFIG: SubagentsConfig = {
|
|
|
122
134
|
maxConcurrency: DEFAULT_MAX_CONCURRENCY,
|
|
123
135
|
maxFixRounds: DEFAULT_MAX_FIX_ROUNDS,
|
|
124
136
|
idleTimeoutSec: DEFAULT_IDLE_TIMEOUT_SEC,
|
|
137
|
+
announcedFeatures: [],
|
|
125
138
|
};
|
|
126
139
|
|
|
127
140
|
export function getConfigPath(agentDir: string = getAgentDir()): string {
|
|
@@ -168,6 +181,7 @@ export function normalizeConfig(raw: unknown): SubagentsConfig {
|
|
|
168
181
|
maxConcurrency: DEFAULT_CONFIG.maxConcurrency,
|
|
169
182
|
maxFixRounds: DEFAULT_CONFIG.maxFixRounds,
|
|
170
183
|
idleTimeoutSec: DEFAULT_CONFIG.idleTimeoutSec,
|
|
184
|
+
announcedFeatures: [],
|
|
171
185
|
};
|
|
172
186
|
|
|
173
187
|
if (Array.isArray(raw.enabledAgents)) {
|
|
@@ -240,6 +254,16 @@ export function normalizeConfig(raw: unknown): SubagentsConfig {
|
|
|
240
254
|
config.idleTimeoutSec = Math.max(0, Math.min(IDLE_TIMEOUT_SEC_LIMIT, Math.round(raw.idleTimeoutSec)));
|
|
241
255
|
}
|
|
242
256
|
|
|
257
|
+
if (isModelReference(raw.visionModel)) {
|
|
258
|
+
config.visionModel = (raw.visionModel as string).trim();
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
if (Array.isArray(raw.announcedFeatures)) {
|
|
262
|
+
config.announcedFeatures = raw.announcedFeatures.filter(
|
|
263
|
+
(feature): feature is string => typeof feature === "string" && feature.trim().length > 0,
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
243
267
|
return config;
|
|
244
268
|
}
|
|
245
269
|
|
|
@@ -249,6 +273,7 @@ function defaultConfig(): SubagentsConfig {
|
|
|
249
273
|
enabledAgents: [...DEFAULT_CONFIG.enabledAgents],
|
|
250
274
|
agentModels: {},
|
|
251
275
|
agentThinkingLevels: {},
|
|
276
|
+
announcedFeatures: [],
|
|
252
277
|
};
|
|
253
278
|
}
|
|
254
279
|
|