pi-subagents 0.11.9 → 0.11.11

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
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.11.11] - 2026-03-23
6
+
7
+ ### Changed
8
+ - Updated for pi 0.62.0 compatibility. `Skill.source` replaced with `Skill.sourceInfo` for skill provenance, `Widget` type replaced with `Component`. Bumped devDependencies to `^0.62.0`.
9
+
10
+ ## [0.11.10] - 2026-03-21
11
+
12
+ ### Changed
13
+ - Trimmed tool schema and description to reduce per-turn token cost by ~166 tokens (13%). Removed `maxOutput` from the LLM-facing schema (still accepted internally), shortened `context` and `output` descriptions, removed redundant CHAIN DATA FLOW section from tool description, condensed MANAGEMENT bullet points.
14
+
5
15
  ## [0.11.9] - 2026-03-21
6
16
 
7
17
  ### Fixed
package/index.ts CHANGED
@@ -251,20 +251,15 @@ CHAIN TEMPLATE VARIABLES (use in task strings):
251
251
  • {previous} - Text response from the previous step (empty for first step)
252
252
  • {chain_dir} - Shared directory for chain files (e.g., <tmpdir>/pi-chain-runs/abc123/)
253
253
 
254
- CHAIN DATA FLOW:
255
- 1. Each step's text response automatically becomes {previous} for the next step
256
- 2. Steps can also write files to {chain_dir} (via agent's "output" config)
257
- 3. Later steps can read those files (via agent's "reads" config)
258
-
259
254
  Example: { chain: [{agent:"scout", task:"Analyze {task}"}, {agent:"planner", task:"Plan based on {previous}"}] }
260
255
 
261
- MANAGEMENT (use action field omit agent/task/chain/tasks):
262
- • { action: "list" } - discover available agents and chains
263
- • { action: "get", agent: "name" } - full agent detail with system prompt
264
- • { action: "create", config: { name, description, systemPrompt, ... } } - create agent/chain
265
- • { action: "update", agent: "name", config: { ... } } - modify fields (merge)
266
- • { action: "delete", agent: "name" } - remove definition
267
- • Use chainName instead of agent for chain operations`,
256
+ MANAGEMENT (use action field, omit agent/task/chain/tasks):
257
+ • { action: "list" } - discover agents/chains
258
+ • { action: "get", agent: "name" } - full agent detail
259
+ • { action: "create", config: { name, systemPrompt, ... } }
260
+ • { action: "update", agent: "name", config: { ... } } - merge
261
+ • { action: "delete", agent: "name" }
262
+ • Use chainName for chain operations`,
268
263
  parameters: SubagentParams,
269
264
 
270
265
  execute(id, params, signal, onUpdate, ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagents",
3
- "version": "0.11.9",
3
+ "version": "0.11.11",
4
4
  "description": "Pi extension for delegating tasks to subagents with chains, parallel execution, and TUI clarification",
5
5
  "author": "Nico Bailon",
6
6
  "license": "MIT",
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "devDependencies": {
49
49
  "@marcfargas/pi-test-harness": "^0.5.0",
50
- "@mariozechner/pi-agent-core": "^0.54.0",
51
- "@mariozechner/pi-ai": "^0.54.0",
52
- "@mariozechner/pi-coding-agent": "^0.54.0"
50
+ "@mariozechner/pi-agent-core": "^0.62.0",
51
+ "@mariozechner/pi-ai": "^0.62.0",
52
+ "@mariozechner/pi-coding-agent": "^0.62.0"
53
53
  }
54
54
  }
package/render.ts CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  import type { AgentToolResult } from "@mariozechner/pi-agent-core";
6
6
  import { getMarkdownTheme, type ExtensionContext } from "@mariozechner/pi-coding-agent";
7
- import { Container, Markdown, Spacer, Text, truncateToWidth, visibleWidth, type Widget } from "@mariozechner/pi-tui";
7
+ import { Container, Markdown, Spacer, Text, visibleWidth, type Component } from "@mariozechner/pi-tui";
8
8
  import {
9
9
  type AsyncJobState,
10
10
  type Details,
@@ -179,7 +179,7 @@ export function renderSubagentResult(
179
179
  result: AgentToolResult<Details>,
180
180
  _options: { expanded: boolean },
181
181
  theme: Theme,
182
- ): Widget {
182
+ ): Component {
183
183
  const d = result.details;
184
184
  if (!d || !d.results.length) {
185
185
  const t = result.content[0];
package/schemas.ts CHANGED
@@ -52,13 +52,6 @@ export const ParallelStepSchema = Type.Object({
52
52
  // Note: Using Type.Any() for Google API compatibility (doesn't support anyOf)
53
53
  export const ChainItem = Type.Any({ description: "Chain step: either {agent, task?, ...} for sequential or {parallel: [...]} for concurrent execution" });
54
54
 
55
- export const MaxOutputSchema = Type.Optional(
56
- Type.Object({
57
- bytes: Type.Optional(Type.Number({ description: "Max bytes (default: 204800)" })),
58
- lines: Type.Optional(Type.Number({ description: "Max lines (default: 5000)" })),
59
- }),
60
- );
61
-
62
55
  export const SubagentParams = Type.Object({
63
56
  agent: Type.Optional(Type.String({ description: "Agent name (SINGLE mode) or target for management get/update/delete" })),
64
57
  task: Type.Optional(Type.String({ description: "Task (SINGLE mode)" })),
@@ -78,13 +71,12 @@ export const SubagentParams = Type.Object({
78
71
  chain: Type.Optional(Type.Array(ChainItem, { description: "CHAIN mode: sequential pipeline where each step's response becomes {previous} for the next. Use {task}, {previous}, {chain_dir} in task templates." })),
79
72
  context: Type.Optional(Type.String({
80
73
  enum: ["fresh", "fork"],
81
- description: "Execution context mode: 'fresh' (default) starts clean, 'fork' starts from a real fork of the parent session leaf",
74
+ description: "'fresh' (default) or 'fork' to branch from parent session",
82
75
  })),
83
76
  chainDir: Type.Optional(Type.String({ description: "Persistent directory for chain artifacts. Default: <tmpdir>/pi-chain-runs/ (auto-cleaned after 24h)" })),
84
77
  async: Type.Optional(Type.Boolean({ description: "Run in background (default: false, or per config)" })),
85
78
  agentScope: Type.Optional(Type.String({ description: "Agent discovery scope: 'user', 'project', or 'both' (default: 'both'; project wins on name collisions)" })),
86
79
  cwd: Type.Optional(Type.String()),
87
- maxOutput: MaxOutputSchema,
88
80
  artifacts: Type.Optional(Type.Boolean({ description: "Write debug artifacts (default: true)" })),
89
81
  includeProgress: Type.Optional(Type.Boolean({ description: "Include full progress in result (default: false)" })),
90
82
  share: Type.Optional(Type.Boolean({ description: "Upload session to GitHub Gist for sharing (default: false)" })),
@@ -94,7 +86,7 @@ export const SubagentParams = Type.Object({
94
86
  // Clarification TUI
95
87
  clarify: Type.Optional(Type.Boolean({ description: "Show TUI to preview/edit before execution (default: true for chains, false for single/parallel). Implies sync mode." })),
96
88
  // Solo agent overrides
97
- output: Type.Optional(Type.Any({ description: "Override output file for single agent (string), or false to disable (uses agent default if omitted). Absolute paths are used as-is; relative paths resolve against cwd." })),
89
+ output: Type.Optional(Type.Any({ description: "Output file for single agent (string), or false to disable. Relative paths resolve against cwd." })),
98
90
  skill: Type.Optional(SkillOverride),
99
91
  model: Type.Optional(Type.String({ description: "Override model for single agent (e.g. 'anthropic/claude-sonnet-4')" })),
100
92
  });
package/skills.ts CHANGED
@@ -194,32 +194,24 @@ function buildSkillPaths(cwd: string): string[] {
194
194
  return [...new Set([...defaultSkillPaths, ...packagePaths, ...settingsPaths])];
195
195
  }
196
196
 
197
- function inferSkillSource(rawSource: unknown, filePath: string, cwd: string): SkillSource {
198
- const source = typeof rawSource === "string" ? rawSource : "";
197
+ function inferSkillSource(sourceInfo: { source: string; scope: string }, filePath: string, cwd: string): SkillSource {
198
+ const { scope, source } = sourceInfo;
199
+
200
+ if (scope === "project" && source === "local") return "project";
201
+ if (scope === "user" && source === "local") return "user";
202
+
203
+ // Fallback: infer from file path when sourceInfo isn't specific enough
204
+ // (e.g. scope === "temporary" for skills loaded via explicit skillPaths)
199
205
  const projectRoot = path.resolve(cwd, CONFIG_DIR);
200
206
  const isProjectScoped = isWithinPath(filePath, projectRoot);
207
+ if (isProjectScoped) return "project";
208
+
201
209
  const isUserScoped = isWithinPath(filePath, AGENT_DIR);
210
+ if (isUserScoped) return "user";
211
+
202
212
  const globalRoot = getGlobalNpmRoot();
203
- const isGlobalPackage = globalRoot ? isWithinPath(filePath, globalRoot) : false;
204
-
205
- if (source === "project") return "project";
206
- if (source === "user") return "user";
207
- if (source === "settings") {
208
- if (isProjectScoped) return "project-settings";
209
- if (isUserScoped) return "user-settings";
210
- return "unknown";
211
- }
212
- if (source === "package") {
213
- if (isProjectScoped) return "project-package";
214
- if (isUserScoped || isGlobalPackage) return "user-package";
215
- return "unknown";
216
- }
217
- if (source === "extension") return "extension";
218
- if (source === "builtin") return "builtin";
213
+ if (globalRoot && isWithinPath(filePath, globalRoot)) return "user-package";
219
214
 
220
- if (isProjectScoped) return "project";
221
- if (isUserScoped) return "user";
222
- if (isGlobalPackage) return "user-package";
223
215
  return "unknown";
224
216
  }
225
217
 
@@ -247,7 +239,7 @@ function getCachedSkills(cwd: string): CachedSkillEntry[] {
247
239
  const entry: CachedSkillEntry = {
248
240
  name: skill.name,
249
241
  filePath: skill.filePath,
250
- source: inferSkillSource((skill as { source?: unknown }).source, skill.filePath, cwd),
242
+ source: inferSkillSource(skill.sourceInfo, skill.filePath, cwd),
251
243
  description: skill.description,
252
244
  order: i,
253
245
  };