pi-herdr-agents 1.2.1 → 1.2.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/CHANGELOG.md CHANGED
@@ -7,11 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
9
9
 
10
- ## [v1.2.1](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.2.0...v1.2.1)
10
+ ## [v1.2.2](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.2.1...v1.2.2)
11
+
12
+ ### Commits
13
+
14
+ - fix: hide completion tool from auto-exit children [`e4cad6b`](https://github.com/giuseppecrj/pi-herdr-agents/commit/e4cad6bdbe5d1952f5bb838640493c20ab332dbd)
15
+
16
+ ## [v1.2.1](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.2.0...v1.2.1) - 2026-08-13
11
17
 
12
18
  ### Commits
13
19
 
14
20
  - docs: polish package readme and artwork [`908dd76`](https://github.com/giuseppecrj/pi-herdr-agents/commit/908dd76875c91871b8d91113e6d1633d5112d5b3)
21
+ - chore: release v1.2.1 [`df87f12`](https://github.com/giuseppecrj/pi-herdr-agents/commit/df87f126ec5cad4735c441752471aa8bd724f2e9)
15
22
 
16
23
  ## [v1.2.0](https://github.com/giuseppecrj/pi-herdr-agents/compare/v1.1.0...v1.2.0) - 2026-08-13
17
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-herdr-agents",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Asynchronous Pi subagents and approved review workflows in Herdr, with optional isolated Git worktrees",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -117,6 +117,7 @@ import {
117
117
  persistWorktreeResult,
118
118
  runSubagentScript,
119
119
  writeWorktreeManifest,
120
+ buildSubagentToolAllowlist,
120
121
  type WorktreeHandoff,
121
122
  type WorktreeLaunch,
122
123
  } from "./launch.ts";
@@ -1404,32 +1405,6 @@ function updateWidget() {
1404
1405
  * first positional message so that /skill: args land in messages[1..] and arrive
1405
1406
  * as standalone prompts in the child session.
1406
1407
  */
1407
- const SUBAGENT_CONTROL_TOOLS = ["caller_ping", "subagent_done"] as const;
1408
-
1409
- /**
1410
- * Build the child --tools allowlist.
1411
- *
1412
- * Pi 0.70+ applies --tools to built-in, extension, and custom tools. If a
1413
- * subagent definition restricts tools to e.g. "read,bash,write", the child
1414
- * control tools from subagent-done.ts would otherwise be hidden, leaving a
1415
- * manually resumed or user-touched subagent unable to call subagent_done.
1416
- */
1417
- function buildSubagentToolAllowlist(effectiveTools?: string): string | null {
1418
- const requested = (effectiveTools ?? "")
1419
- .split(",")
1420
- .map((tool) => tool.trim())
1421
- .filter(Boolean);
1422
-
1423
- if (requested.length === 0) return null;
1424
-
1425
- const allow = new Set(requested);
1426
- for (const tool of SUBAGENT_CONTROL_TOOLS) {
1427
- allow.add(tool);
1428
- }
1429
-
1430
- return [...allow].join(",");
1431
- }
1432
-
1433
1408
  function buildPiPromptArgs(params: {
1434
1409
  effectiveSkills?: string;
1435
1410
  taskDelivery: "direct" | "artifact";
@@ -28,7 +28,6 @@ import {
28
28
  type HerdrWorktreeSurface,
29
29
  } from "./terminal.ts";
30
30
 
31
- const SUBAGENT_CONTROL_TOOLS = ["caller_ping", "subagent_done"] as const;
32
31
  const SUBAGENTS_DIR = dirname(fileURLToPath(import.meta.url));
33
32
 
34
33
  type SubagentSessionMode = "standalone" | "lineage-only" | "fork";
@@ -550,7 +549,10 @@ function buildPiCommand(
550
549
  shellQuote(artifacts.systemPromptFile),
551
550
  );
552
551
  }
553
- const toolAllowlist = buildToolAllowlist(request.behavior.tools);
552
+ const toolAllowlist = buildSubagentToolAllowlist(
553
+ request.behavior.tools,
554
+ request.behavior.autoExit,
555
+ );
554
556
  if (toolAllowlist) parts.push("--tools", shellQuote(toolAllowlist));
555
557
  if (!request.handoff) {
556
558
  for (const prompt of buildPromptArgs(
@@ -579,7 +581,9 @@ function buildPiCommand(
579
581
  env.push(`PI_SUBAGENT_NAME=${shellQuote(request.name)}`);
580
582
  if (request.agent)
581
583
  env.push(`PI_SUBAGENT_AGENT=${shellQuote(request.agent)}`);
582
- if (request.behavior.autoExit) env.push("PI_SUBAGENT_AUTO_EXIT=1");
584
+ env.push(
585
+ `PI_SUBAGENT_AUTO_EXIT=${request.behavior.autoExit ? "1" : "0"}`,
586
+ );
583
587
  env.push(`PI_SUBAGENT_SESSION=${shellQuote(artifacts.sessionFile)}`);
584
588
  env.push(`PI_SUBAGENT_ID=${shellQuote(resolved.id)}`);
585
589
  env.push(`PI_SUBAGENT_ACTIVITY_FILE=${shellQuote(artifacts.activityFile)}`);
@@ -678,7 +682,7 @@ async function launchResumedPiSubagent(
678
682
  `PI_SUBAGENT_SESSION=${shellQuote(request.sessionFile)}`,
679
683
  `PI_SUBAGENT_ID=${shellQuote(id)}`,
680
684
  `PI_SUBAGENT_ACTIVITY_FILE=${shellQuote(activityFile)}`,
681
- ...(autoExit ? ["PI_SUBAGENT_AUTO_EXIT=1"] : []),
685
+ `PI_SUBAGENT_AUTO_EXIT=${autoExit ? "1" : "0"}`,
682
686
  ];
683
687
  const command = [
684
688
  ...env,
@@ -722,14 +726,19 @@ async function launchResumedPiSubagent(
722
726
  };
723
727
  }
724
728
 
725
- function buildToolAllowlist(tools?: string): string | null {
729
+ export function buildSubagentToolAllowlist(
730
+ tools?: string,
731
+ autoExit = false,
732
+ ): string | null {
726
733
  const requested = (tools ?? "")
727
734
  .split(",")
728
735
  .map((tool) => tool.trim())
729
736
  .filter(Boolean);
730
737
  if (requested.length === 0) return null;
731
738
  const allow = new Set(requested);
732
- for (const tool of SUBAGENT_CONTROL_TOOLS) allow.add(tool);
739
+ allow.delete("subagent_done");
740
+ allow.add("caller_ping");
741
+ if (!autoExit) allow.add("subagent_done");
733
742
  return [...allow].join(",");
734
743
  }
735
744
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Extension loaded into sub-agents.
3
3
  * - Shows agent identity + available tools as a styled widget above the editor (toggle with Ctrl+J)
4
- * - Provides a `subagent_done` tool for autonomous agents to self-terminate
4
+ * - Provides a `subagent_done` tool for interactive agents to self-terminate
5
5
  */
6
6
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
7
7
  import { Box, Text } from "@earendil-works/pi-tui";
@@ -302,6 +302,8 @@ export default function (pi: ExtensionAPI) {
302
302
  },
303
303
  });
304
304
 
305
+ if (autoExit) return;
306
+
305
307
  pi.registerTool({
306
308
  name: "subagent_done",
307
309
  label: "Subagent Done",