feat(pi): harden subagent lifecycle

This commit is contained in:
2026-08-01 14:13:44 -04:00
parent 63da676b5a
commit 289ea1344c
4 changed files with 236 additions and 13 deletions

View File

@@ -104,6 +104,13 @@ export default function subagents(pi: ExtensionAPI) {
},
});
pi.registerCommand("subagent-cancel", {
description: "Cancel a running subagent by id",
handler: async (args, ctx) => {
ctx.ui.notify(JSON.stringify(await getSupervisor(ctx).cancel(args.trim()), null, 2), "info");
},
});
pi.on("session_shutdown", async () => {
await supervisor?.shutdown();
supervisor = undefined;