@arhen/pi-core-subagent 1.3.6 → 1.3.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arhen/pi-core-subagent",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
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
@@ -76,7 +76,8 @@ export default function (pi: ExtensionAPI) {
76
76
  );
77
77
  };
78
78
  pi.registerCommand("subagents", {
79
- description: "List subagent runs. `/subagents peek` opens the browsable pane; `/subagents auto-bg on|off` toggles background-by-default.",
79
+ description:
80
+ "List subagent runs. `/subagents peek` opens the browsable pane; `/subagents auto-bg on|off` toggles background-by-default.",
80
81
  handler: async (args, ctx) => {
81
82
  const arg = String(args ?? "")
82
83
  .trim()
@@ -86,9 +87,15 @@ export default function (pi: ExtensionAPI) {
86
87
  const value = arg.split(/\s+/)[1];
87
88
  if (value === "on" || value === "off") {
88
89
  const next = manager.setAutoBg(value === "on");
89
- ctx.ui.notify(`auto-bg ${next ? "on" : "off"} — subagent calls default to ${next ? "background" : "blocking (inline result)"}.`, "info");
90
+ ctx.ui.notify(
91
+ `auto-bg ${next ? "on" : "off"} — subagent calls default to ${next ? "background" : "blocking (inline result)"}.`,
92
+ "info",
93
+ );
90
94
  } else {
91
- ctx.ui.notify(`auto-bg is ${manager.autoBgOn ? "on" : "off"} — use \`/subagents auto-bg on|off\` to change it.`, "info");
95
+ ctx.ui.notify(
96
+ `auto-bg is ${manager.autoBgOn ? "on" : "off"} — use \`/subagents auto-bg on|off\` to change it.`,
97
+ "info",
98
+ );
92
99
  }
93
100
  return;
94
101
  }
@@ -125,15 +132,16 @@ export default function (pi: ExtensionAPI) {
125
132
  pi.registerTool<typeof SubagentParams, RunDetails>({
126
133
  name: "subagent",
127
134
  label: "Subagent",
128
- // ponytail: this string is billed on every request. One example — the graph one —
129
- // covers ids, needs, write and Verify; the simpler shapes are subsets of it.
135
+ // ponytail: this string is billed on every request. No example block an example
136
+ // biases the model toward one shape; guidelines + JSON schema describe all of them.
130
137
  description:
131
- '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; toggle via `/subagents auto-bg off`); 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" }] })',
138
+ "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; toggle via `/subagents auto-bg off`); set background:false when you need the result inline in this turn. allowIntercom:true lets children talk to you and each other.",
132
139
  promptSnippet: "Define and delegate work to specialized subagents.",
133
140
  promptGuidelines: [
134
141
  "Use subagent when independent review, testing, research, or parallel analysis improves quality.",
135
142
  "Put every sub-task in ONE call: subagent({ tasks: [...] }). Never make multiple parallel subagent calls — one call, one run, N tasks.",
136
143
  "Order comes from `needs`, not from separate calls: give tasks an `id`, list the ids each depends on. Tasks with no unmet needs run in parallel; dependents receive their upstream outputs automatically — do not restate them.",
144
+ "Prefer flat `tasks` (plain parallel) unless a real dependency exists — only add `needs` edges when ordering genuinely matters.",
137
145
  "End each task with a runnable check, e.g. 'Verify: npx tsc --noEmit && bun test'. A subagent's claim of success is not evidence.",
138
146
  "Define each agent yourself: invented name, focused system prompt, and read-only (default) or write:true. Prefer read-only.",
139
147
  "Prefer blocking (background:false) whenever the run's result is something you must wait for before your next step — do not default to background for work you depend on inline. When a background run is active, settle its pending results and task dependencies (await_subagent / subagent_result, then continue dependent work) before starting unrelated work.",
package/src/manager.ts CHANGED
@@ -217,7 +217,9 @@ export class SubagentManager {
217
217
  /** Flip the background-by-default flag; persists to the agent dir. Returns the new value. */
218
218
  setAutoBg(on: boolean): boolean {
219
219
  this.autoBg = on;
220
- void writeFile(join(getAgentDir(), "subagents-config.json"), JSON.stringify({ autoBg: on }, null, 2)).catch(() => {});
220
+ void writeFile(join(getAgentDir(), "subagents-config.json"), JSON.stringify({ autoBg: on }, null, 2)).catch(
221
+ () => {},
222
+ );
221
223
  return on;
222
224
  }
223
225