@tintinweb/pi-subagents 0.6.2 → 0.6.3

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/CHANGELOG.md CHANGED
@@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.6.3] - 2026-04-28
11
+
12
+ ### Fixed
13
+ - **`run_in_background: true` (and `inherit_context`, `isolated`) silently ignored on default agents** ([#37](https://github.com/tintinweb/pi-subagents/issues/37) — thanks [@kylesnowschwartz](https://github.com/kylesnowschwartz) for the diagnosis). The three built-in defaults (`general-purpose`, `Explore`, `Plan`) baked `runInBackground: false`, `inheritContext: false`, and `isolated: false` into their configs. `resolveAgentInvocationConfig` uses `agentConfig?.field ?? params.field ?? false`, and `??` only falls through on `null`/`undefined` — so an explicit `false` from the agent config silently won over the caller's `true`. Calling `Agent({ subagent_type: "general-purpose", run_in_background: true })` returned the result inline instead of backgrounding, blocking the parent UI for the agent's full runtime. Fix drops the three lines from each default (and from the unreachable defensive fallback in `agent-runner.ts`) — the type already declared each as `field?: boolean` with JSDoc *"undefined = caller decides"*, so the runtime now matches the documented contract. **Behavior:** custom agents that explicitly set these fields in frontmatter still lock as before (the v0.5.1 "frontmatter is authoritative" guarantee is preserved); the fix only stops *defaults* from spuriously claiming an opinion on callsite-strategy fields they don't actually have. The unreachable fallback now spreads `DEFAULT_AGENTS.get("general-purpose")` instead of duplicating the config inline, so future drift is impossible.
14
+
10
15
  ## [0.6.2] - 2026-04-28
11
16
 
12
17
  ### Fixed
@@ -374,6 +379,7 @@ Initial release.
374
379
  - **Thinking level** — per-agent extended thinking control
375
380
  - **`/agent` and `/agents` commands**
376
381
 
382
+ [0.6.3]: https://github.com/tintinweb/pi-subagents/compare/v0.6.2...v0.6.3
377
383
  [0.6.2]: https://github.com/tintinweb/pi-subagents/compare/v0.6.1...v0.6.2
378
384
  [0.6.1]: https://github.com/tintinweb/pi-subagents/compare/v0.6.0...v0.6.1
379
385
  [0.6.0]: https://github.com/tintinweb/pi-subagents/compare/v0.5.2...v0.6.0
@@ -4,6 +4,7 @@
4
4
  import { createAgentSession, DefaultResourceLoader, getAgentDir, SessionManager, SettingsManager, } from "@mariozechner/pi-coding-agent";
5
5
  import { getAgentConfig, getConfig, getMemoryToolNames, getReadOnlyMemoryToolNames, getToolNamesForType } from "./agent-types.js";
6
6
  import { buildParentContext, extractText } from "./context.js";
7
+ import { DEFAULT_AGENTS } from "./default-agents.js";
7
8
  import { detectEnv } from "./env.js";
8
9
  import { buildMemoryBlock, buildReadOnlyMemoryBlock } from "./memory.js";
9
10
  import { buildAgentPrompt } from "./prompts.js";
@@ -139,19 +140,12 @@ export async function runAgent(ctx, type, prompt, options) {
139
140
  systemPrompt = buildAgentPrompt(agentConfig, effectiveCwd, env, parentSystemPrompt, extras);
140
141
  }
141
142
  else {
142
- // Unknown type fallback: general-purpose (defensive — unreachable in practice
143
- // since index.ts resolves unknown types to "general-purpose" before calling runAgent)
144
- systemPrompt = buildAgentPrompt({
145
- name: type,
146
- description: "General-purpose agent",
147
- systemPrompt: "",
148
- promptMode: "append",
149
- extensions: true,
150
- skills: true,
151
- inheritContext: false,
152
- runInBackground: false,
153
- isolated: false,
154
- }, effectiveCwd, env, parentSystemPrompt, extras);
143
+ // Unknown type fallback: spread the canonical general-purpose config (defensive —
144
+ // unreachable in practice since index.ts resolves unknown types before calling runAgent).
145
+ const fallback = DEFAULT_AGENTS.get("general-purpose");
146
+ if (!fallback)
147
+ throw new Error(`No fallback config available for unknown type "${type}"`);
148
+ systemPrompt = buildAgentPrompt({ ...fallback, name: type }, effectiveCwd, env, parentSystemPrompt, extras);
155
149
  }
156
150
  // When skills is string[], we've already preloaded them into the prompt.
157
151
  // Still pass noSkills: true since we don't need the skill loader to load them again.
@@ -12,13 +12,12 @@ export const DEFAULT_AGENTS = new Map([
12
12
  displayName: "Agent",
13
13
  description: "General-purpose agent for complex, multi-step tasks",
14
14
  // builtinToolNames omitted — means "all available tools" (resolved at lookup time)
15
+ // inheritContext / runInBackground / isolated omitted — strategy fields, callers decide per-call.
16
+ // Setting them to false would lock callsite intent (see resolveAgentInvocationConfig in invocation-config.ts).
15
17
  extensions: true,
16
18
  skills: true,
17
19
  systemPrompt: "",
18
20
  promptMode: "append",
19
- inheritContext: false,
20
- runInBackground: false,
21
- isolated: false,
22
21
  isDefault: true,
23
22
  },
24
23
  ],
@@ -61,9 +60,6 @@ Use Bash ONLY for read-only operations: ls, git status, git log, git diff, find,
61
60
  - Do not use emojis
62
61
  - Be thorough and precise`,
63
62
  promptMode: "replace",
64
- inheritContext: false,
65
- runInBackground: false,
66
- isolated: false,
67
63
  isDefault: true,
68
64
  },
69
65
  ],
@@ -117,9 +113,6 @@ You are STRICTLY PROHIBITED from:
117
113
  List 3-5 files most critical for implementing this plan:
118
114
  - /absolute/path/to/file.ts - [Brief reason]`,
119
115
  promptMode: "replace",
120
- inheritContext: false,
121
- runInBackground: false,
122
- isolated: false,
123
116
  isDefault: true,
124
117
  },
125
118
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tintinweb/pi-subagents",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "A pi extension extension that brings smart Claude Code-style autonomous sub-agents to pi.",
5
5
  "author": "tintinweb",
6
6
  "license": "MIT",
@@ -16,6 +16,7 @@ import {
16
16
  } from "@mariozechner/pi-coding-agent";
17
17
  import { getAgentConfig, getConfig, getMemoryToolNames, getReadOnlyMemoryToolNames, getToolNamesForType } from "./agent-types.js";
18
18
  import { buildParentContext, extractText } from "./context.js";
19
+ import { DEFAULT_AGENTS } from "./default-agents.js";
19
20
  import { detectEnv } from "./env.js";
20
21
  import { buildMemoryBlock, buildReadOnlyMemoryBlock } from "./memory.js";
21
22
  import { buildAgentPrompt, type PromptExtras } from "./prompts.js";
@@ -212,19 +213,11 @@ export async function runAgent(
212
213
  if (agentConfig) {
213
214
  systemPrompt = buildAgentPrompt(agentConfig, effectiveCwd, env, parentSystemPrompt, extras);
214
215
  } else {
215
- // Unknown type fallback: general-purpose (defensive — unreachable in practice
216
- // since index.ts resolves unknown types to "general-purpose" before calling runAgent)
217
- systemPrompt = buildAgentPrompt({
218
- name: type,
219
- description: "General-purpose agent",
220
- systemPrompt: "",
221
- promptMode: "append",
222
- extensions: true,
223
- skills: true,
224
- inheritContext: false,
225
- runInBackground: false,
226
- isolated: false,
227
- }, effectiveCwd, env, parentSystemPrompt, extras);
216
+ // Unknown type fallback: spread the canonical general-purpose config (defensive —
217
+ // unreachable in practice since index.ts resolves unknown types before calling runAgent).
218
+ const fallback = DEFAULT_AGENTS.get("general-purpose");
219
+ if (!fallback) throw new Error(`No fallback config available for unknown type "${type}"`);
220
+ systemPrompt = buildAgentPrompt({ ...fallback, name: type }, effectiveCwd, env, parentSystemPrompt, extras);
228
221
  }
229
222
 
230
223
  // When skills is string[], we've already preloaded them into the prompt.
@@ -16,13 +16,12 @@ export const DEFAULT_AGENTS: Map<string, AgentConfig> = new Map([
16
16
  displayName: "Agent",
17
17
  description: "General-purpose agent for complex, multi-step tasks",
18
18
  // builtinToolNames omitted — means "all available tools" (resolved at lookup time)
19
+ // inheritContext / runInBackground / isolated omitted — strategy fields, callers decide per-call.
20
+ // Setting them to false would lock callsite intent (see resolveAgentInvocationConfig in invocation-config.ts).
19
21
  extensions: true,
20
22
  skills: true,
21
23
  systemPrompt: "",
22
24
  promptMode: "append",
23
- inheritContext: false,
24
- runInBackground: false,
25
- isolated: false,
26
25
  isDefault: true,
27
26
  },
28
27
  ],
@@ -65,9 +64,6 @@ Use Bash ONLY for read-only operations: ls, git status, git log, git diff, find,
65
64
  - Do not use emojis
66
65
  - Be thorough and precise`,
67
66
  promptMode: "replace",
68
- inheritContext: false,
69
- runInBackground: false,
70
- isolated: false,
71
67
  isDefault: true,
72
68
  },
73
69
  ],
@@ -121,9 +117,6 @@ You are STRICTLY PROHIBITED from:
121
117
  List 3-5 files most critical for implementing this plan:
122
118
  - /absolute/path/to/file.ts - [Brief reason]`,
123
119
  promptMode: "replace",
124
- inheritContext: false,
125
- runInBackground: false,
126
- isolated: false,
127
120
  isDefault: true,
128
121
  },
129
122
  ],