pi-agent-extensions 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
1
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
2
2
  import { BOLLYWOOD_MESSAGES, CONTEXT_MESSAGES, PI_TIPS, WHIMSICAL_VERBS, GOODBYE_MESSAGES } from "./messages.js";
3
3
 
4
4
  type WhimsyMode = 'chaos' | 'classic' | 'bollywood' | 'geek';
@@ -86,30 +86,14 @@ export default function (pi: ExtensionAPI) {
86
86
  });
87
87
 
88
88
  // Register /exit and /bye
89
- const performExit = (ctx: ExtensionContext) => {
90
- // 1. Try official shutdown
91
- ctx.shutdown();
92
-
93
- // 2. Set a watchdog to force exit if graceful shutdown hangs
94
- setTimeout(() => {
95
- // Force manual cleanup in case Pi didn't get to it
96
- if (process.stdin.isTTY) {
97
- process.stdin.setRawMode(false);
98
- }
99
- // Reset cursor, disable mouse tracking, restore buffer
100
- process.stdout.write('\x1b[?25h\x1b[?1000l\x1b[?1002l\x1b[?1015l\x1b[?1006l\x1b[?1049l');
101
-
102
- // Force kill
103
- process.exit(0);
104
- }, 200);
105
- };
106
-
107
89
  pi.registerCommand("exit", {
108
90
  description: "Exit Pi with a whimsical goodbye",
109
91
  handler: async (_args, ctx) => {
110
92
  const msg = GOODBYE_MESSAGES[Math.floor(Math.random() * GOODBYE_MESSAGES.length)];
111
- console.log(`\nšŸ‘‹ ${msg}\n`);
112
- performExit(ctx);
93
+ if (ctx.hasUI) {
94
+ ctx.ui.notify(`šŸ‘‹ ${msg}`, "info");
95
+ }
96
+ ctx.shutdown();
113
97
  },
114
98
  });
115
99
 
@@ -117,8 +101,10 @@ export default function (pi: ExtensionAPI) {
117
101
  description: "Exit Pi with a whimsical goodbye (alias)",
118
102
  handler: async (_args, ctx) => {
119
103
  const msg = GOODBYE_MESSAGES[Math.floor(Math.random() * GOODBYE_MESSAGES.length)];
120
- console.log(`\nšŸ‘‹ ${msg}\n`);
121
- performExit(ctx);
104
+ if (ctx.hasUI) {
105
+ ctx.ui.notify(`šŸ‘‹ ${msg}`, "info");
106
+ }
107
+ ctx.shutdown();
122
108
  },
123
109
  });
124
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-extensions",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Collection of extensions for pi coding agent",
5
5
  "type": "module",
6
6
  "repository": {