@arhen/pi-core-subagent 1.3.4 → 1.3.5

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 CHANGED
@@ -5,6 +5,15 @@
5
5
  [![license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6
6
  [![pi extension](https://img.shields.io/badge/pi-extension-7c3aed)](https://github.com/earendil-works/pi)
7
7
 
8
+ ## Install
9
+
10
+ Requires the [pi coding agent](https://github.com/earendil-works/pi) — install it first: `npm install -g @earendil-works/pi-coding-agent`.
11
+
12
+ ```sh
13
+ pi install npm:@arhen/pi-core-subagent
14
+ # or locally: pi install /path/to/pi-subagents
15
+ ```
16
+
8
17
  Minimalist pi extension: **fast in-process subagents** with single / parallel / graph modes, background runs, cancellation, intercom (child↔leader) and an agent↔agent mailbox.
9
18
 
10
19
  Built for one job: delegate work to isolated subagents **without bloating the parent context**.
@@ -72,13 +81,6 @@ flowchart TB
72
81
 
73
82
  The dotted arrows are the whole point: a child may burn 200k tokens reading files, and the leader receives only its final answer.
74
83
 
75
- ## Install
76
-
77
- ```sh
78
- pi install npm:@arhen/pi-core-subagent
79
- # or locally: pi install /path/to/pi-subagents
80
- ```
81
-
82
84
  ## Usage — the leader invents the agents
83
85
 
84
86
  Define agents inline per call — never creates or reads agent files. Model resolution: explicit `provider/model-id` (or bare id) via the pi model registry → agent-file `model` → the parent's current model → settings default.
@@ -219,14 +221,13 @@ flowchart LR
219
221
 
220
222
  And the rule that keeps this from becoming ceremony: **zero `needs` anywhere = plain parallel.** No waves, no gates, no graph vocabulary imposed on flat work.
221
223
 
222
- Background + intercom:
224
+ Background (default) + intercom — the run returns a runId immediately; you stay steerable while it works:
223
225
 
224
226
  ```json
225
227
  {
226
228
  "agent": "auditor",
227
229
  "prompt": "You audit dependencies.",
228
230
  "task": "Audit package.json for outdated deps",
229
- "background": true,
230
231
  "allowIntercom": true
231
232
  }
232
233
  ```
@@ -235,7 +236,7 @@ Background + intercom:
235
236
 
236
237
  | Tool | Purpose |
237
238
  |---|---|
238
- | `subagent` | single / `tasks` (parallel or graph via `needs`) / `chain` (`{previous}`); `background:true` fire-and-forget; `allowIntercom:true` enables child talk tools; `notifyPerTask: true` wakes you as each task completes (background runs only; default off) |
239
+ | `subagent` | single / `tasks` (parallel or graph via `needs`) / `chain` (`{previous}`); background is the default (`background:false` for inline result in this turn); `allowIntercom:true` enables child talk tools; `notifyPerTask` (default true) wakes you as each task completes (background runs only) |
239
240
  | `subagent_status` | live per-task snapshot (non-blocking), including each child's session file path |
240
241
  | `subagent_result` | full output of a run or one task |
241
242
  | `await_subagent` | block until a run finishes (optional `timeoutMs`) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arhen/pi-core-subagent",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "type": "module",
5
5
  "description": "pi extension: fast in-process subagents with a dependency-graph scheduler (needs edges gate tasks and carry upstream output into dependent prompts), plus background runs, intercom and agent-to-agent mailbox. Leader defines agents inline.",
6
6
  "license": "MIT",
package/src/index.ts CHANGED
@@ -120,7 +120,7 @@ export default function (pi: ExtensionAPI) {
120
120
  // ponytail: this string is billed on every request. One example — the graph one —
121
121
  // covers ids, needs, write and Verify; the simpler shapes are subsets of it.
122
122
  description:
123
- 'Run isolated subagents (own context, own session). You invent each agent: name, optional system prompt, toolset (read-only default, write:true to edit). Use `agent`+`task` for one, `tasks` for many. `needs` declares dependency edges: a task waits for its needs and receives their outputs prepended to its prompt. background:true returns immediately; allowIntercom:true lets children talk to you and each other.\n\nsubagent({ tasks: [{ id: "api", agent: "api-mapper", task: "Map API routes" }, { id: "db", agent: "db-mapper", task: "Map DB schema" }, { id: "doc", agent: "writer", needs: ["api", "db"], write: true, task: "Write ARCHITECTURE.md. Verify: test -s ARCHITECTURE.md" }] })',
123
+ 'Run isolated subagents (own context, own session). You invent each agent: name, optional system prompt, toolset (read-only default, write:true to edit). Use `agent`+`task` for one, `tasks` for many. `needs` declares dependency edges: a task waits for its needs and receives their outputs prepended to its prompt. background is the default (returns a runId immediately); set background:false when you need the result inline in this turn. allowIntercom:true lets children talk to you and each other.\n\nsubagent({ tasks: [{ id: "api", agent: "api-mapper", task: "Map API routes" }, { id: "db", agent: "db-mapper", task: "Map DB schema" }, { id: "doc", agent: "writer", needs: ["api", "db"], write: true, task: "Write ARCHITECTURE.md. Verify: test -s ARCHITECTURE.md" }] })',
124
124
  promptSnippet: "Define and delegate work to specialized subagents.",
125
125
  promptGuidelines: [
126
126
  "Use subagent when independent review, testing, research, or parallel analysis improves quality.",
package/src/manager.ts CHANGED
@@ -798,9 +798,9 @@ export class SubagentManager {
798
798
  id: newId("run"),
799
799
  mode,
800
800
  status: "queued",
801
- background: Boolean(params.background),
801
+ background: params.background ?? true,
802
802
  allowIntercom: Boolean(params.allowIntercom),
803
- notifyPerTask: params.notifyPerTask ?? false,
803
+ notifyPerTask: params.notifyPerTask ?? true,
804
804
  createdAt: Date.now(),
805
805
  concurrency: Math.max(1, Math.min(params.concurrency ?? DEFAULT_CONCURRENCY, MAX_CONCURRENCY)),
806
806
  tasks: inputs.map((input, index) => ({
package/src/schemas.ts CHANGED
@@ -55,12 +55,17 @@ export const SubagentParams = Type.Object({
55
55
  }),
56
56
  ),
57
57
  background: Type.Optional(
58
- Type.Boolean({ description: "Fire-and-forget: return immediately with a runId; you'll be notified on completion" }),
58
+ Type.Boolean({
59
+ description:
60
+ "Fire-and-forget: return immediately with a runId; you'll be notified on completion. Default true — set false when you need the result inline in this turn.",
61
+ default: true,
62
+ }),
59
63
  ),
60
64
  notifyPerTask: Type.Optional(
61
65
  Type.Boolean({
62
66
  description:
63
- "Wake you (queued follow-up turn) as each task completes — background runs only, since blocking runs can't be woken mid-tool. Default false.",
67
+ "Wake you (queued follow-up turn) as each task completes — background runs only, since blocking runs can't be woken mid-tool. Default true.",
68
+ default: true,
64
69
  }),
65
70
  ),
66
71
  allowIntercom: Type.Optional(