fix(coding-agent): add PR attribution to ctx.shutdown() changelog, fix example comments

This commit is contained in:
Mario Zechner 2026-01-08 03:31:55 +01:00
parent 6845c4b85e
commit baf6fe4b39
2 changed files with 9 additions and 9 deletions

View file

@ -21,7 +21,7 @@
- Extension UI dialogs (`ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`) now support a `timeout` option with live countdown display ([#522](https://github.com/badlogic/pi-mono/pull/522) by [@nicobailon](https://github.com/nicobailon))
- Extensions can now provide custom editor components via `ctx.ui.setEditorComponent()`. See `examples/extensions/modal-editor.ts` and `docs/tui.md` Pattern 7.
- Extension factories can now be async, enabling dynamic imports and lazy-loaded dependencies ([#513](https://github.com/badlogic/pi-mono/pull/513) by [@austinm911](https://github.com/austinm911))
- `ctx.shutdown()` is now available in extension contexts for requesting a graceful shutdown. In interactive mode, shutdown is deferred until the agent becomes idle (after processing all queued steering and follow-up messages). In RPC mode, shutdown is deferred until after completing the current command response. In print mode, shutdown is a no-op as the process exits automatically when prompts complete.
- `ctx.shutdown()` is now available in extension contexts for requesting a graceful shutdown. In interactive mode, shutdown is deferred until the agent becomes idle (after processing all queued steering and follow-up messages). In RPC mode, shutdown is deferred until after completing the current command response. In print mode, shutdown is a no-op as the process exits automatically when prompts complete. ([#542](https://github.com/badlogic/pi-mono/pull/542) by [@kaofelix](https://github.com/kaofelix))
### Fixed

View file

@ -13,7 +13,7 @@ export default function (pi: ExtensionAPI) {
pi.registerCommand("quit", {
description: "Exit pi cleanly",
handler: async (_args, ctx) => {
await ctx.shutdown();
ctx.shutdown();
},
});
@ -25,12 +25,12 @@ export default function (pi: ExtensionAPI) {
parameters: Type.Object({}),
async execute(_toolCallId, _params, _onUpdate, ctx, _signal) {
// Do any final work here...
// Then shutdown
await ctx.shutdown();
// Request graceful shutdown (deferred until agent is idle)
ctx.shutdown();
// This return won't be reached, but required by type
// This return is sent to the LLM before shutdown occurs
return {
content: [{ type: "text", text: "Shutting down..." }],
content: [{ type: "text", text: "Shutdown requested. Exiting after this response." }],
details: {},
};
},
@ -50,12 +50,12 @@ export default function (pi: ExtensionAPI) {
// Example deployment logic
// const result = await pi.exec("npm", ["run", "deploy", params.environment], { signal });
// On success, shutdown
// On success, request graceful shutdown
onUpdate?.({ content: [{ type: "text", text: "Deployment complete, exiting..." }], details: {} });
await ctx.shutdown();
ctx.shutdown();
return {
content: [{ type: "text", text: "Done!" }],
content: [{ type: "text", text: "Done! Shutdown requested." }],
details: { environment: params.environment },
};
},