@deathbeam/pi-delegate 0.0.21 → 0.0.22
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 +7 -8
- package/agents/explore.md +0 -1
- package/agents/general.md +0 -1
- package/agents/researcher.md +0 -1
- package/agents/reviewer.md +0 -1
- package/agents.ts +17 -13
- package/index.ts +5 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,18 +20,18 @@ Optional `delegate` settings live in `~/.pi/agent/settings.json` or `.pi/setting
|
|
|
20
20
|
"delegate": {
|
|
21
21
|
"agentDirs": ["./.pi/agents"],
|
|
22
22
|
"models": {
|
|
23
|
-
"cheap":
|
|
24
|
-
"balanced": "anthropic/claude-sonnet-
|
|
25
|
-
"strong": "anthropic/claude-opus-
|
|
23
|
+
"cheap": "anthropic/claude-haiku-5-5:low",
|
|
24
|
+
"balanced": "anthropic/claude-sonnet-5-5:high",
|
|
25
|
+
"strong": "anthropic/claude-opus-5-5:high"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
Relative `agentDirs` resolve against the project cwd, later same-name definitions win. Project `models` override global
|
|
32
|
-
tiers (`cheap`, `balanced`, `strong`); a tier is a `provider/model` string
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
tiers (`cheap`, `balanced`, `strong`); a tier is a `provider/model` string with an optional `:<thinking>` suffix, as in
|
|
33
|
+
pi's `--model`. An unset tier makes the child use the current session model. Thinking resolves from the agent's
|
|
34
|
+
`model` suffix first, then the tier suffix, then the session level.
|
|
35
35
|
|
|
36
36
|
Agents are Markdown files with frontmatter, the body becomes the child's system prompt:
|
|
37
37
|
|
|
@@ -41,13 +41,12 @@ name: scout
|
|
|
41
41
|
description: Explore the codebase
|
|
42
42
|
tools: read, grep
|
|
43
43
|
model: cheap
|
|
44
|
-
thinking: low
|
|
45
44
|
---
|
|
46
45
|
|
|
47
46
|
Explore the codebase and report relevant paths.
|
|
48
47
|
```
|
|
49
48
|
|
|
50
|
-
Omit `tools` to inherit active tools. `model` can also be an explicit `provider/model`. The model sees the agent list from
|
|
49
|
+
Omit `tools` to inherit active tools. `model` can also be an explicit `provider/model[:thinking]`. The model sees the agent list from
|
|
51
50
|
when the extension loaded, so run `/reload` after adding agents or changing their descriptions.
|
|
52
51
|
|
|
53
52
|
The main session is prompted to act as an orchestrator. When it makes 5, 10, 20, … direct exploration calls (`read`,
|
package/agents/explore.md
CHANGED
|
@@ -3,7 +3,6 @@ name: explore
|
|
|
3
3
|
description: "Read-only codebase search: finds files, callers, and data flow. Use it for anything beyond one targeted search and before editing unfamiliar code; launch several in parallel for separate areas."
|
|
4
4
|
tools: read, grep, find, ls
|
|
5
5
|
model: cheap
|
|
6
|
-
thinking: low
|
|
7
6
|
---
|
|
8
7
|
|
|
9
8
|
You are a read-only codebase exploration agent with an isolated context.
|
package/agents/general.md
CHANGED
|
@@ -3,7 +3,6 @@ name: general
|
|
|
3
3
|
description: Multi-step work in its own context; can inspect, edit, run commands, and validate. Use it for implementation, debugging loops (reproduce, fix, verify), repetitive edits across many files, and test or build runs whose output you need only summarized.
|
|
4
4
|
tools: read, grep, find, ls, bash, edit, write
|
|
5
5
|
model: balanced
|
|
6
|
-
thinking: high
|
|
7
6
|
---
|
|
8
7
|
|
|
9
8
|
You are a delegated coding agent with an isolated context.
|
package/agents/researcher.md
CHANGED
|
@@ -3,7 +3,6 @@ name: researcher
|
|
|
3
3
|
description: Web research with cited sources. Use it whenever the answer needs external docs, versions, or current facts, instead of searching and fetching pages yourself.
|
|
4
4
|
tools: read, web_search, web_fetch
|
|
5
5
|
model: balanced
|
|
6
|
-
thinking: medium
|
|
7
6
|
---
|
|
8
7
|
|
|
9
8
|
You are a focused web research agent with an isolated context.
|
package/agents/reviewer.md
CHANGED
|
@@ -3,7 +3,6 @@ name: reviewer
|
|
|
3
3
|
description: Independent review of a diff, plan, or finished change. Use it before claiming non-trivial work is done.
|
|
4
4
|
tools: read, grep, find, ls, bash
|
|
5
5
|
model: strong
|
|
6
|
-
thinking: high
|
|
7
6
|
---
|
|
8
7
|
|
|
9
8
|
You are a skeptical code reviewer with an isolated context.
|
package/agents.ts
CHANGED
|
@@ -10,7 +10,6 @@ type AgentFile = {
|
|
|
10
10
|
description: string;
|
|
11
11
|
tools?: string[];
|
|
12
12
|
model?: string;
|
|
13
|
-
thinking?: string;
|
|
14
13
|
prompt: string;
|
|
15
14
|
};
|
|
16
15
|
|
|
@@ -70,7 +69,6 @@ function loadAgents(dir: string): AgentFile[] {
|
|
|
70
69
|
description: frontmatter.description,
|
|
71
70
|
tools: stringList(frontmatter.tools),
|
|
72
71
|
model: typeof frontmatter.model === "string" ? frontmatter.model : undefined,
|
|
73
|
-
thinking: typeof frontmatter.thinking === "string" ? frontmatter.thinking : undefined,
|
|
74
72
|
prompt: body.trim(),
|
|
75
73
|
});
|
|
76
74
|
} catch {
|
|
@@ -91,21 +89,27 @@ export function discoverAgents(cwd: string, configuredDirs: unknown): AgentFile[
|
|
|
91
89
|
return [...agents.values()];
|
|
92
90
|
}
|
|
93
91
|
|
|
92
|
+
// Same `:<thinking>` suffix pi's --model takes; only known levels split, so ids like `llama3:8b` stay whole.
|
|
93
|
+
function splitThinking(value: string): { model: string; thinking?: string } {
|
|
94
|
+
const match = /^(.*):(off|minimal|low|medium|high|xhigh|max)$/.exec(value);
|
|
95
|
+
return match ? { model: match[1], thinking: match[2] } : { model: value };
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Precedence: requested `:<thinking>` suffix, then the tier suffix, then the session level.
|
|
94
99
|
export function resolveModel(
|
|
95
100
|
value: string | undefined,
|
|
96
101
|
models: Record<string, unknown>,
|
|
97
|
-
|
|
102
|
+
ctx: Pick<ExtensionContext, "model" | "thinkingLevel">,
|
|
98
103
|
): { model?: string; thinking?: string } {
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return { model: current ? `${current.provider}/${current.id}` : undefined };
|
|
104
|
+
const split = splitThinking(value ?? "");
|
|
105
|
+
const thinking = split.thinking ?? ctx.thinkingLevel;
|
|
106
|
+
if (split.model && !MODEL_TIERS.has(split.model)) return { model: split.model, thinking };
|
|
107
|
+
const configured = models[split.model];
|
|
108
|
+
if (typeof configured === "string" && configured) {
|
|
109
|
+
const tier = splitThinking(configured);
|
|
110
|
+
return { model: tier.model, thinking: split.thinking ?? tier.thinking ?? ctx.thinkingLevel };
|
|
111
|
+
}
|
|
112
|
+
return { model: ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : undefined, thinking };
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
export function contextWindowFor(ctx: ExtensionContext, model: string | undefined): number | undefined {
|
package/index.ts
CHANGED
|
@@ -307,7 +307,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
307
307
|
Type.String({ description: "Self-contained brief; the delegate cannot see this conversation." }),
|
|
308
308
|
),
|
|
309
309
|
model: Type.Optional(
|
|
310
|
-
Type.String({
|
|
310
|
+
Type.String({
|
|
311
|
+
description:
|
|
312
|
+
"Model tier (cheap, balanced, strong) or an explicit provider/model, with an optional :<thinking> suffix.",
|
|
313
|
+
}),
|
|
311
314
|
),
|
|
312
315
|
resume: Type.Optional(
|
|
313
316
|
Type.String({
|
|
@@ -337,16 +340,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
337
340
|
const names = agents.map((candidate) => candidate.name).join(", ") || "(none)";
|
|
338
341
|
throw new Error(`Unknown agent "${prior?.agent ?? params.agent}". Available agents: ${names}.`);
|
|
339
342
|
}
|
|
340
|
-
const { model, thinking
|
|
341
|
-
params.model ?? agent.model,
|
|
342
|
-
config.models ?? {},
|
|
343
|
-
ctx.model,
|
|
344
|
-
);
|
|
343
|
+
const { model, thinking } = resolveModel(params.model ?? agent.model, config.models ?? {}, ctx);
|
|
345
344
|
if (!model) throw new Error(`No model found for "${agent.name}".`);
|
|
346
345
|
const tools = (agent.tools?.length ? agent.tools : pi.getActiveTools()).filter(
|
|
347
346
|
(tool) => !DELEGATION_TOOLS.has(tool),
|
|
348
347
|
);
|
|
349
|
-
const thinking = agent.thinking ?? tierThinking ?? ctx.thinkingLevel;
|
|
350
348
|
const displayModel = thinking ? `${model}:${thinking}` : model;
|
|
351
349
|
const job: DelegateJob = {
|
|
352
350
|
// A resumed job keeps its id: the pinned child session id reopens the old transcript.
|