@ferris1225/pi-subagents 2.3.1 → 4.0.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 +475 -468
- package/agents/cleaner.md +11 -21
- package/agents/{explore.md → explorer.md} +3 -3
- package/agents/reviewer.md +47 -41
- package/agents/worker.md +3 -3
- package/package.json +1 -1
- package/src/announcements.ts +0 -6
- package/src/config.ts +299 -310
- package/src/dispatch.ts +11 -65
- package/src/index.ts +1 -1
- package/src/models.ts +3 -9
- package/src/monitor.ts +1 -1
- package/src/prompt.ts +74 -61
- package/src/runtime.ts +0 -1
- package/src/setup.ts +438 -463
- package/src/thread-lifecycle.ts +4 -12
package/src/thread-lifecycle.ts
CHANGED
|
@@ -69,7 +69,7 @@ function withWorktreeSystemPrompt(agent: AgentConfig): AgentConfig {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export function isWorktreeCapableAgent(agent: AgentConfig): boolean {
|
|
72
|
-
if (agent.name === "
|
|
72
|
+
if (agent.name === "explorer" || agent.name === "reviewer") return false;
|
|
73
73
|
if (agent.name === "worker") return true;
|
|
74
74
|
if (!agent.tools) return true;
|
|
75
75
|
return agent.tools.includes("edit") || agent.tools.includes("write");
|
|
@@ -92,12 +92,11 @@ export function resolveDispatchModelRoute(
|
|
|
92
92
|
agent: AgentConfig,
|
|
93
93
|
config: SubagentsConfig,
|
|
94
94
|
ctx: ExtensionContext,
|
|
95
|
-
vision: boolean,
|
|
96
95
|
): DispatchModelRoute {
|
|
97
96
|
const availableModels = availableModelsInScope(ctx);
|
|
98
97
|
const mainRef = currentModelRef(ctx);
|
|
99
98
|
const route = resolveAgentModelRoute({
|
|
100
|
-
selectedRef:
|
|
99
|
+
selectedRef: config.agentModels[agent.name],
|
|
101
100
|
mainRef,
|
|
102
101
|
declaredDefaultRef: agent.model,
|
|
103
102
|
availableRefs: availableModels.map(modelRef),
|
|
@@ -137,7 +136,6 @@ interface BackgroundDispatcherOptions extends DispatchEnvironment {
|
|
|
137
136
|
parentGroupId: string,
|
|
138
137
|
parentRunId: number,
|
|
139
138
|
executionCwd: string,
|
|
140
|
-
vision?: boolean,
|
|
141
139
|
) => void;
|
|
142
140
|
}
|
|
143
141
|
|
|
@@ -145,7 +143,6 @@ type BackgroundStarter = (
|
|
|
145
143
|
agentName: string,
|
|
146
144
|
task: string,
|
|
147
145
|
cwd: string | undefined,
|
|
148
|
-
vision?: boolean,
|
|
149
146
|
isolation?: IsolationMode,
|
|
150
147
|
) => Promise<SingleResult>;
|
|
151
148
|
|
|
@@ -204,7 +201,6 @@ export function createBackgroundDispatcher(options: BackgroundDispatcherOptions)
|
|
|
204
201
|
agentName: string,
|
|
205
202
|
task: string,
|
|
206
203
|
cwd: string | undefined,
|
|
207
|
-
vision = false,
|
|
208
204
|
isolation: IsolationMode = "shared",
|
|
209
205
|
existingThread?: SubagentThread,
|
|
210
206
|
newObjectiveOnResume = false,
|
|
@@ -253,7 +249,7 @@ export function createBackgroundDispatcher(options: BackgroundDispatcherOptions)
|
|
|
253
249
|
}
|
|
254
250
|
}
|
|
255
251
|
const executionCwd = worktree?.cwd ?? originalCwd;
|
|
256
|
-
const resolvedRoute = resolveDispatchModelRoute(agent, runConfig, runCtx
|
|
252
|
+
const resolvedRoute = resolveDispatchModelRoute(agent, runConfig, runCtx);
|
|
257
253
|
// Isolation is a persistent system-level invariant, not a one-shot task
|
|
258
254
|
// prefix: queued retargets, live retargets, resumes, and main-model
|
|
259
255
|
// handoffs all keep the same worktree boundary.
|
|
@@ -319,7 +315,6 @@ export function createBackgroundDispatcher(options: BackgroundDispatcherOptions)
|
|
|
319
315
|
thread.task = task;
|
|
320
316
|
thread.cwd = originalCwd;
|
|
321
317
|
thread.executionCwd = executionCwd;
|
|
322
|
-
thread.vision = vision;
|
|
323
318
|
thread.thinkingLevel = thinkingLevel;
|
|
324
319
|
thread.isolation = isolation;
|
|
325
320
|
thread.worktree = worktree;
|
|
@@ -343,7 +338,6 @@ export function createBackgroundDispatcher(options: BackgroundDispatcherOptions)
|
|
|
343
338
|
task,
|
|
344
339
|
cwd: originalCwd,
|
|
345
340
|
executionCwd,
|
|
346
|
-
vision,
|
|
347
341
|
thinkingLevel,
|
|
348
342
|
isolation,
|
|
349
343
|
worktree,
|
|
@@ -622,7 +616,6 @@ export function createBackgroundDispatcher(options: BackgroundDispatcherOptions)
|
|
|
622
616
|
thread.agentName,
|
|
623
617
|
nextTask,
|
|
624
618
|
thread.cwd,
|
|
625
|
-
thread.vision,
|
|
626
619
|
thread.isolation,
|
|
627
620
|
thread,
|
|
628
621
|
objective !== undefined,
|
|
@@ -784,7 +777,6 @@ export function createBackgroundDispatcher(options: BackgroundDispatcherOptions)
|
|
|
784
777
|
thread.agentName,
|
|
785
778
|
childTask,
|
|
786
779
|
thread.cwd,
|
|
787
|
-
thread.vision,
|
|
788
780
|
thread.isolation,
|
|
789
781
|
undefined,
|
|
790
782
|
false,
|
|
@@ -926,7 +918,7 @@ export function createBackgroundDispatcher(options: BackgroundDispatcherOptions)
|
|
|
926
918
|
// the same row now represents the chain until it resolves.
|
|
927
919
|
monitor.setStatus(runId, "running");
|
|
928
920
|
monitor.setActivity(runId, "auto-fix chain running");
|
|
929
|
-
startFixLoop(result, `fix-${runId}`, runId, thread.executionCwd
|
|
921
|
+
startFixLoop(result, `fix-${runId}`, runId, thread.executionCwd);
|
|
930
922
|
return;
|
|
931
923
|
}
|
|
932
924
|
// Claim terminal settlement synchronously before the first slow await.
|