pi-subagents-lite 1.0.1 → 1.0.2

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": "pi-subagents-lite",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Lightweight sub-agents for pi — spawn specialized agents with isolated sessions, tools, and models.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -17,7 +17,7 @@ import type { AgentConfig } from "./types.js";
17
17
  * `find` and `ls` were removed — they're thin wrappers over bash commands
18
18
  * that add ~180 tokens/turn with no real benefit.
19
19
  */
20
- export const BUILTIN_TOOL_NAMES: string[] = ["read", "bash", "edit", "write", "grep"];
20
+ export const BUILTIN_TOOL_NAMES: string[] = ["read", "bash", "edit", "write", "grep", "find"];
21
21
 
22
22
  /** Unified runtime registry of all agents (defaults + user-defined). */
23
23
  const agents = new Map<string, AgentConfig>();
@@ -7,7 +7,7 @@
7
7
 
8
8
  import type { AgentConfig } from "./types.js";
9
9
 
10
- const READ_ONLY_TOOLS = ["read", "bash", "grep"];
10
+ const READ_ONLY_TOOLS = ["read", "bash", "grep", "find"];
11
11
 
12
12
  export const DEFAULT_AGENTS: Map<string, AgentConfig> = new Map([
13
13
  [
package/src/index.ts CHANGED
@@ -136,6 +136,13 @@ async function loadConfigAndRegisterAgents(ctx: ExtensionContext): Promise<void>
136
136
  // UI helpers — stats card rendering (shared by renderResult and message renderer)
137
137
  // ============================================================================
138
138
 
139
+ /** Format agent display name with optional model: "Agent (mimo-v2.5-pro)" or "Agent". */
140
+ function agentNameLabel(d: Record<string, unknown>, theme: Theme): string {
141
+ const typeName = getDisplayName((d.type as string) || "");
142
+ const modelName = d.modelName as string | undefined;
143
+ return modelName ? `${theme.bold(typeName)} (${modelName})` : theme.bold(typeName);
144
+ }
145
+
139
146
  /** Build the stats line for an agent result card. Used by both renderers. */
140
147
  function buildStatsLine(d: Record<string, unknown>, theme: Theme): string {
141
148
  const parts = buildStatsParts({
@@ -205,8 +212,9 @@ function registerAgentTool(pi: ExtensionAPI): void {
205
212
  const desc = (d?.description as string) || "";
206
213
 
207
214
  if (d && d.turnCount != null) {
215
+ const namePart = agentNameLabel(d, theme);
208
216
  const statsLine = buildStatsLine(d, theme);
209
- let lines = `${icon} ${statsLine}\n ${theme.fg("text", desc)}`;
217
+ let lines = `${icon} ${namePart}·${statsLine}\n ${theme.fg("text", desc)}`;
210
218
  if (expanded && text) {
211
219
  lines += "\n" + text.split("\n").map(l => ` ${l}`).join("\n");
212
220
  }
@@ -265,11 +273,9 @@ export default function (pi: ExtensionAPI) {
265
273
  if (d && d.turnCount != null) {
266
274
  const isError = d.status === "error" || d.status === "aborted" || d.status === "stopped";
267
275
  const icon = isError ? theme.fg("error", "✗") : theme.fg("success", "✓");
268
- const typeName = getDisplayName((d.type as string) || "");
269
- const modelName = d.modelName as string | undefined;
270
276
  const desc = (d.description as string) || "";
271
277
 
272
- const namePart = modelName ? `${theme.bold(typeName)} (${modelName})` : theme.bold(typeName);
278
+ const namePart = agentNameLabel(d, theme);
273
279
  const statsLine = buildStatsLine(d, theme);
274
280
  let headerLine = `${icon} ${namePart}·${statsLine}\n ${theme.fg("text", desc)}`;
275
281
  if ((d.outputFile as string)) {
@@ -283,13 +289,10 @@ export default function (pi: ExtensionAPI) {
283
289
  inner.addChild(new Text(resultLines, 0, 0));
284
290
  }
285
291
  } else {
286
- const typeName = getDisplayName((d?.type as string) || "");
287
- const modelName = d?.modelName as string | undefined;
288
292
  const desc = (d?.description as string) || "";
289
293
  let line = `${theme.fg("success", "✓")}`;
290
- if (typeName) {
291
- const namePart = modelName ? `${theme.bold(typeName)} (${modelName})` : theme.bold(typeName);
292
- line += ` ${namePart}`;
294
+ if (d?.type) {
295
+ line += ` ${agentNameLabel(d, theme)}`;
293
296
  }
294
297
  if (desc) line += `\n ${theme.fg("text", desc)}`;
295
298
  if (d?.outputFile) {
@@ -191,11 +191,8 @@ export async function executeAgentTool(
191
191
  const model = findModelInRegistry(modelStr, ctx.modelRegistry, ctx.model);
192
192
  const modelKey = model ? `${model.provider}/${model.id}` : undefined;
193
193
 
194
- // Determine modelName for invocation (only when different from parent)
195
- const parentModelId = ctx.model ? `${ctx.model.provider}/${ctx.model.id}` : "";
196
- const modelName = (modelKey && modelKey !== parentModelId)
197
- ? parseModelKey(modelKey)?.modelId
198
- : undefined;
194
+ // Determine modelName for invocation (always capture for display)
195
+ const modelName = model?.id;
199
196
 
200
197
  // Resolve thinking: explicit param > agent config (frontmatter) > undefined (inherit)
201
198
  const thinkingLevel = parseThinkingLevel(params.thinking as string | undefined)
@@ -207,7 +204,7 @@ export async function executeAgentTool(
207
204
  maxTurns,
208
205
  thinkingLevel,
209
206
  modelKey,
210
- invocation: modelName ? { modelName } : undefined,
207
+ invocation: { modelName },
211
208
  graceTurns: __config.agent.graceTurns,
212
209
  };
213
210
 
@@ -319,12 +316,10 @@ export async function toolCallListener(
319
316
 
320
317
  if (effectiveModel) {
321
318
  input.model = effectiveModel;
322
- // Inject _modelOverride for renderCall when model differs from parent
323
- if (effectiveModel !== parentModelId) {
324
- const parsed = parseModelKey(effectiveModel);
325
- if (parsed) {
326
- input._modelOverride = parsed.modelId;
327
- }
319
+ // Always inject _modelOverride for renderCall
320
+ const parsed = parseModelKey(effectiveModel);
321
+ if (parsed) {
322
+ input._modelOverride = parsed.modelId;
328
323
  }
329
324
  }
330
325