@bermudi/pi-delegate 0.1.12 → 0.1.13
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/manual.ts +9 -6
- package/package.json +1 -1
- package/schema.ts +2 -2
package/manual.ts
CHANGED
|
@@ -120,6 +120,8 @@ export function getSubagentManualMarkdown(
|
|
|
120
120
|
"",
|
|
121
121
|
"Each task entry may also carry an optional `id` — a caller-provided per-dispatch correlation key. Duplicate `id` values in the same call are rejected; when omitted, tasks are identified by array index, agent, and prompt.",
|
|
122
122
|
"",
|
|
123
|
+
"Vocabulary, since 'agent' does double duty elsewhere: a **task** is one job; an **agent** is a named profile — a saved bundle of system prompt, tools, workspace, and model policy — that a task references by `agent` name; a **subagent** is the live session that executes one task. Agents are templates, not processes; nothing runs until a task dispatches.",
|
|
124
|
+
"",
|
|
123
125
|
"Subagents cannot call `delegate` recursively. Their tool activity runs at `cwd`, while Pi stores the runtime session transcript in its own session directory outside that `cwd`.",
|
|
124
126
|
"",
|
|
125
127
|
"## Touched Files (best-effort)",
|
|
@@ -142,7 +144,7 @@ export function getSubagentManualMarkdown(
|
|
|
142
144
|
"",
|
|
143
145
|
agentList,
|
|
144
146
|
"",
|
|
145
|
-
"Custom agents are defined either inline in a task (using `systemPrompt`, `tools`, and `thinking`) or persisted as Markdown files in `.pi/agents/*.md` (project-local), `~/.pi/agent/agents/` (global), and `.claude/agents/` (interchange with Claude Code).
|
|
147
|
+
"Custom agents are profiles, defined either inline in a task (using `systemPrompt`, `tools`, and `thinking`) or persisted as Markdown files in `.pi/agents/*.md` (project-local), `~/.pi/agent/agents/` (global), and `.claude/agents/` (interchange with Claude Code). Inline definitions let the parent model shape the subagent it needs on each call. Each Markdown file is one profile with YAML frontmatter:",
|
|
146
148
|
"",
|
|
147
149
|
"```markdown",
|
|
148
150
|
"---",
|
|
@@ -165,26 +167,26 @@ export function getSubagentManualMarkdown(
|
|
|
165
167
|
"## Session Reuse",
|
|
166
168
|
"",
|
|
167
169
|
"When `sessionId` is set, the subagent is kept alive in a pool for the duration of the pi session.",
|
|
168
|
-
"Subsequent calls with the same `sessionId` continue the conversation — the
|
|
170
|
+
"Subsequent calls with the same `sessionId` continue the conversation — the session retains prior context.",
|
|
169
171
|
"",
|
|
170
172
|
"```ts",
|
|
171
173
|
"// First call — creates and runs an inline custom agent",
|
|
172
174
|
'delegate({ tasks: [{ prompt: "Investigate the auth module", systemPrompt: "You are a focused investigator. Map files and dependencies.", tools: ["read", "grep", "find", "ls"], sessionId: "auth-research" }] })',
|
|
173
175
|
"",
|
|
174
|
-
"// Second call — continues the same
|
|
176
|
+
"// Second call — continues the same subagent",
|
|
175
177
|
'delegate({ tasks: [{ prompt: "Now check the tests for that module", sessionId: "auth-research" }] })',
|
|
176
178
|
"",
|
|
177
179
|
"// Clean up when done",
|
|
178
180
|
'delegate({ tasks: [{ sessionId: "auth-research", sessionAction: "close" }] })',
|
|
179
181
|
"```",
|
|
180
182
|
"",
|
|
181
|
-
'Pooled
|
|
183
|
+
'Pooled sessions remain live until `sessionAction: "close"` or parent Pi session shutdown.',
|
|
182
184
|
"",
|
|
183
185
|
"## Resuming Previous Sessions",
|
|
184
186
|
"",
|
|
185
187
|
"Use `resumeFrom` to continue a failed or interrupted subagent from where it left off.",
|
|
186
188
|
"Pass the exact absolute path to the session `.jsonl` file copied from delegate retry output. Do not invent placeholder values or use it as a ticket ID; async resume is supported.",
|
|
187
|
-
"The
|
|
189
|
+
"The subagent gets the full conversation history and the new `prompt` continues naturally.",
|
|
188
190
|
"",
|
|
189
191
|
"```ts",
|
|
190
192
|
"// Copy this exact path from the failed delegate result; do not invent it.",
|
|
@@ -193,7 +195,7 @@ export function getSubagentManualMarkdown(
|
|
|
193
195
|
" resumeFrom: exactRetrySessionFile }] })",
|
|
194
196
|
"```",
|
|
195
197
|
"",
|
|
196
|
-
"Combine with `sessionId` to resume AND pool the
|
|
198
|
+
"Combine with `sessionId` to resume AND pool the subagent for further multi-turn use:",
|
|
197
199
|
"",
|
|
198
200
|
"```ts",
|
|
199
201
|
'delegate({ tasks: [{ prompt: "Continue the investigation",',
|
|
@@ -238,6 +240,7 @@ export function getSubagentManualMarkdown(
|
|
|
238
240
|
"- `*` means read/write/edit/bash, not every tool. `grep`, `find`, and `ls` are valid explicit tools and are the `ro` preset.",
|
|
239
241
|
'- `tasks` is an array. The tool recovers common stringified calls for compatibility, but canonical calls use `{ tasks: [{ prompt: "..." }] }`.',
|
|
240
242
|
'- Use `agent: "default"` for the parent\'s live model/thinking/native tools/base prompt. Built-ins are `default`, `scout`, `coder`, and `reviewer`; omitting `agent` creates an ad-hoc task.',
|
|
243
|
+
"- Omit `thinking` for named agents unless the user asks or the task clearly needs escalation — task-level `thinking` overrides every configured tier (`agentOverrides`, `agentOverridesByParentModel`, Markdown frontmatter, `:level` model suffix), so a casual value silently defeats the configured budget. Ad-hoc tasks default to the parent's thinking.",
|
|
241
244
|
"- An ad-hoc task with no `tools` uses `*`; a named custom task uses its profile; a profile with no tools uses `*`.",
|
|
242
245
|
"- Subagents inherit all skills discovered in their `cwd` (via AgentSession's resource loader). Per-task skill filtering is not supported — curate the cwd's skill set instead.",
|
|
243
246
|
`- Sync \`delegate\` runs at most ${getMaxConcurrent()} tasks at once (the rest queue, not fail). Use \`async: true\` to move work to the background.`,
|
package/package.json
CHANGED
package/schema.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const delegateTaskSchema = Type.Object({
|
|
|
42
42
|
agent: Type.Optional(
|
|
43
43
|
Type.String({
|
|
44
44
|
description:
|
|
45
|
-
"Built-ins: default, scout, coder, reviewer.
|
|
45
|
+
"Agent profile name. Built-ins: default, scout, coder, reviewer. Omit for ad-hoc.",
|
|
46
46
|
}),
|
|
47
47
|
),
|
|
48
48
|
cwd: Type.Optional(
|
|
@@ -77,7 +77,7 @@ export const delegateTaskSchema = Type.Object({
|
|
|
77
77
|
thinking: Type.Optional(
|
|
78
78
|
StringEnum(VALID_THINKING_LEVELS, {
|
|
79
79
|
description:
|
|
80
|
-
"
|
|
80
|
+
"off/minimal/low/medium/high/xhigh/max. Omit for agents — it overrides delegate.json tiers; default inherits.",
|
|
81
81
|
}),
|
|
82
82
|
),
|
|
83
83
|
sessionId: Type.Optional(
|