From 14a95b0bd732ff513be7804a1c6feb1304625c99 Mon Sep 17 00:00:00 2001 From: tmustier Date: Mon, 23 Mar 2026 12:41:48 +0000 Subject: [PATCH 1/3] fix: improve tool metadata for recent pi releases --- extensions/teams/leader-teams-tool.ts | 5 +++++ extensions/teams/worker.ts | 5 +++++ package.json | 10 +++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/extensions/teams/leader-teams-tool.ts b/extensions/teams/leader-teams-tool.ts index f8a6471..10f93d8 100644 --- a/extensions/teams/leader-teams-tool.ts +++ b/extensions/teams/leader-teams-tool.ts @@ -191,6 +191,11 @@ export function registerTeamsTool(opts: { "Optional overrides: model='/' and thinking (off|minimal|low|medium|high|xhigh).", "For governance, the user can run /team delegate on (leader restricted to coordination) or /team spawn plan (worker needs plan approval).", ].join(" "), + promptSnippet: "Delegate work across teammates, inspect member status, message workers, and manage team lifecycle/tasks.", + promptGuidelines: [ + "Use this tool when the user wants parallel agent work, worker coordination, or team lifecycle/task management.", + "Prefer member_status before interrupting or reassigning active teammates when the current state is unclear.", + ], parameters: TeamsToolParamsSchema, async execute(_toolCallId, params: TeamsToolParamsType, signal, _onUpdate, ctx): Promise> { diff --git a/extensions/teams/worker.ts b/extensions/teams/worker.ts index db2bda1..188cbfe 100644 --- a/extensions/teams/worker.ts +++ b/extensions/teams/worker.ts @@ -143,6 +143,11 @@ export function runWorker(pi: ExtensionAPI): void { name: "team_message", label: "Team Message", description: "Send a message to a comrade. Use this to coordinate with peers on related tasks. Set urgent=true to interrupt their active turn (use sparingly — only for time-sensitive coordination).", + promptSnippet: "Send a coordination message to another teammate, optionally as an urgent interruption.", + promptGuidelines: [ + "Use this tool for teammate-to-teammate coordination instead of overloading task status fields with freeform messages.", + "Set urgent=true only when the recipient must be interrupted before finishing their current turn.", + ], parameters: TeamMessageToolParamsSchema, async execute( _toolCallId, diff --git a/package.json b/package.json index f5ad746..65d5fef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tmustier/pi-agent-teams", - "version": "0.5.1", + "version": "0.5.2", "description": "Claude Code agent teams style workflow for Pi.", "license": "MIT", "author": "Thomas Mustier", @@ -39,10 +39,10 @@ }, "devDependencies": { "@eslint/js": "^9.39.2", - "@mariozechner/pi-agent-core": "^0.52.8", - "@mariozechner/pi-ai": "^0.52.8", - "@mariozechner/pi-coding-agent": "^0.52.8", - "@mariozechner/pi-tui": "^0.52.8", + "@mariozechner/pi-agent-core": "^0.62.0", + "@mariozechner/pi-ai": "^0.62.0", + "@mariozechner/pi-coding-agent": "^0.62.0", + "@mariozechner/pi-tui": "^0.62.0", "@sinclair/typebox": "^0.34.48", "eslint": "^9.39.2", "tsx": "^4.20.5", From 0971a1b534a4d1937d42dafa6ec630dda8a3f5eb Mon Sep 17 00:00:00 2001 From: tmustier Date: Mon, 23 Mar 2026 12:48:53 +0000 Subject: [PATCH 2/3] fix: let non-interactive team leader sessions exit cleanly --- CHANGELOG.md | 7 +++++++ extensions/teams/leader.ts | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 432875b..cd9d046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.5.2 + +### Fixes + +- **Pi 0.62 metadata compatibility** — updated tool metadata wiring for recent Pi releases so teams tools continue to render the right prompt snippets/guidelines and stay compatible with current core APIs. +- **Non-interactive exit hang** — leader polling timers now call `unref()` so print/json child sessions can exit cleanly instead of hanging after the agent finishes. This fixes subagent and other nested Pi flows that load the teams extension in the background. + ## 0.5.1 ### Features diff --git a/extensions/teams/leader.ts b/extensions/teams/leader.ts index 9834fe3..3900fb3 100644 --- a/extensions/teams/leader.ts +++ b/extensions/teams/leader.ts @@ -750,6 +750,8 @@ export function runLeader(pi: ExtensionAPI): void { refreshInFlight = false; } }, 1000); + // Don't keep non-interactive/child pi processes alive just because leader polling exists. + refreshTimer.unref?.(); inboxTimer = setInterval(async () => { if (isStopping) return; @@ -761,6 +763,7 @@ export function runLeader(pi: ExtensionAPI): void { inboxInFlight = false; } }, 700); + inboxTimer.unref?.(); }); pi.on("session_switch", async (_event, ctx) => { @@ -820,6 +823,7 @@ export function runLeader(pi: ExtensionAPI): void { refreshInFlight = false; } }, 1000); + refreshTimer.unref?.(); inboxTimer = setInterval(async () => { if (isStopping) return; @@ -831,6 +835,7 @@ export function runLeader(pi: ExtensionAPI): void { inboxInFlight = false; } }, 700); + inboxTimer.unref?.(); }); pi.on("session_shutdown", async () => { From 4fa36a5ec679f7acf1e3eba7564a62def25bc8a6 Mon Sep 17 00:00:00 2001 From: tmustier Date: Mon, 23 Mar 2026 12:52:44 +0000 Subject: [PATCH 3/3] test: avoid false failures when pi --version writes elsewhere --- scripts/smoke-test.mts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/smoke-test.mts b/scripts/smoke-test.mts index 4b2e0a4..41cc477 100644 --- a/scripts/smoke-test.mts +++ b/scripts/smoke-test.mts @@ -554,14 +554,18 @@ console.log("\n7. Pi extension loading"); return typeof c === "string" ? c : undefined; })(); + const versionOutput = `${res.stdout ?? ""}${res.stderr ?? ""}`.trim(); + if (errCode === "ENOENT") { console.log(" (skipped) pi CLI not found on PATH"); } else if (errCode === "ETIMEDOUT") { console.log(" (skipped) pi --version timed out"); } else if (res.status !== 0) { console.log(" (skipped) pi --version returned non-zero exit code"); + } else if (versionOutput.length === 0) { + console.log(" (skipped) pi --version produced no output"); } else { - assert((res.stdout ?? "").trim().length > 0, "pi --version works"); + assert(versionOutput.length > 0, "pi --version works"); } }