fix(coding-agent): persist custom working message across loader recreation

Replace transient pendingWorkingMessage with a persistent workingMessage
field on InteractiveMode, matching the workingIndicatorOptions pattern.
New loaders now use this.workingMessage || this.defaultWorkingMessage
instead of always falling back to the default.

Also add working-message-test.ts extension example.

closes #3566
This commit is contained in:
Mario Zechner
2026-04-22 22:24:32 +02:00
parent 876a197b19
commit cc76e73c05
3 changed files with 33 additions and 13 deletions

View File

@@ -0,0 +1,25 @@
/**
* Working Message Persistence Test
*
* Sets a custom working message and indicator on session start so you can
* verify they survive across loader recreations (e.g. between agent turns).
*
* Usage:
* pi --extension examples/extensions/working-message-test.ts
*
* Then send a few messages in interactive mode. The working message should
* stay "Working... (custom)" with a brown dot indicator every time the
* loader appears, not revert to the default gray "Working...".
*/
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
const CUSTOM_MESSAGE = "\x1b[38;2;155;86;63mWorking... (custom)\x1b[39m";
const CUSTOM_INDICATOR = { frames: ["\x1b[38;2;155;86;63m●\x1b[39m"] };
export default function (pi: ExtensionAPI) {
pi.on("session_start", async (_event, ctx) => {
ctx.ui.setWorkingMessage(CUSTOM_MESSAGE);
ctx.ui.setWorkingIndicator(CUSTOM_INDICATOR);
});
}