working-message-test.ts 904 B

12345678910111213141516171819202122232425
  1. /**
  2. * Working Message Persistence Test
  3. *
  4. * Sets a custom working message and indicator on session start so you can
  5. * verify they survive across loader recreations (e.g. between agent turns).
  6. *
  7. * Usage:
  8. * pi --extension examples/extensions/working-message-test.ts
  9. *
  10. * Then send a few messages in interactive mode. The working message should
  11. * stay "Working... (custom)" with a brown dot indicator every time the
  12. * loader appears, not revert to the default gray "Working...".
  13. */
  14. import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
  15. const CUSTOM_MESSAGE = "\x1b[38;2;155;86;63mWorking... (custom)\x1b[39m";
  16. const CUSTOM_INDICATOR = { frames: ["\x1b[38;2;155;86;63m●\x1b[39m"] };
  17. export default function (pi: ExtensionAPI) {
  18. pi.on("session_start", async (_event, ctx) => {
  19. ctx.ui.setWorkingMessage(CUSTOM_MESSAGE);
  20. ctx.ui.setWorkingIndicator(CUSTOM_INDICATOR);
  21. });
  22. }