chore(pi-notifications): remove debug mode and console.log noise
- Remove PI_NOTIFICATION_DEBUG env var and steer signal logic - Remove console.log on extension load - Keep only: session_start notification + agent_end beep - Clean README without debug references
This commit is contained in:
@@ -13,12 +13,15 @@ Plays a sound when the agent finishes a turn, so you can step away and get alert
|
||||
| `PI_NOTIFICATIONS_ENABLED` | `true` | Set to `false` to disable all notifications |
|
||||
| `PI_NOTIFICATION_AGENT_END` | `true` | Play sound when agent finishes |
|
||||
| `PI_NOTIFICATION_AUDIO` | `/System/Library/Sounds/Glass.aiff` | Path to audio file (.aiff/.wav/.mp3) |
|
||||
| `PI_NOTIFICATION_DEBUG` | `false` | Show visible steer signal instead of playing sound |
|
||||
|
||||
## Debugging
|
||||
|
||||
- **`PI_NOTIFICATION_DEBUG=true`** — emits a steer message in the TUI instead of playing sound (great for loop testing)
|
||||
- **Standalone tester:** `node --input-type=module -e "import {createJiti} from './node_modules/.pnpm/@mariozechner+jiti@2.6.5/node_modules/@mariozechner/jiti/lib/jiti.mjs'; const jiti = createJiti(); await jiti.import('./packages/pi-notifications/src/test-notify.ts');"`
|
||||
## Standalone tester
|
||||
|
||||
Verify audio playback:
|
||||
|
||||
```bash
|
||||
node --input-type=module -e "import {createJiti} from './node_modules/.pnpm/@mariozechner+jiti@2.6.5/node_modules/@mariozechner/jiti/lib/jiti.mjs'; const jiti = createJiti(); await jiti.import('./packages/pi-notifications/src/test-notify.ts');"
|
||||
```
|
||||
|
||||
## Available macOS sounds
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { existsSync } from "node:fs";
|
||||
// Configuration via environment variables
|
||||
const enabled = process.env.PI_NOTIFICATIONS_ENABLED !== "false";
|
||||
const agentEndEnabled = process.env.PI_NOTIFICATION_AGENT_END !== "false";
|
||||
const debug = process.env.PI_NOTIFICATION_DEBUG === "true";
|
||||
const audioPath = process.env.PI_NOTIFICATION_AUDIO || "/System/Library/Sounds/Glass.aiff";
|
||||
|
||||
function notify(body: string, subtitle?: string): void {
|
||||
@@ -23,26 +22,15 @@ function notify(body: string, subtitle?: string): void {
|
||||
}
|
||||
|
||||
export default function (pi: ExtensionAPI) {
|
||||
console.log("[pi-notifications] loaded (enabled=" + enabled + ", agentEnd=" + agentEndEnabled + ")");
|
||||
|
||||
pi.on("session_start", async (_event, ctx) => {
|
||||
if (debug) {
|
||||
ctx.ui.steer("[pi-notifications] session_start — debug mode, skipping actual notification");
|
||||
return;
|
||||
}
|
||||
pi.on("session_start", async (_event, _ctx) => {
|
||||
if (enabled) {
|
||||
notify("pi-notifications active", "Listening for agent_end");
|
||||
}
|
||||
});
|
||||
|
||||
pi.on("agent_end", async (event, ctx) => {
|
||||
pi.on("agent_end", async (event, _ctx) => {
|
||||
if (!agentEndEnabled) return;
|
||||
|
||||
if (debug) {
|
||||
ctx.ui.steer(`[pi-notifications] agent_end — debug mode, skipping actual notification (${event.messages?.length ?? 0} messages)`);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`[pi-notifications] agent_end: messages=${JSON.stringify(event.messages?.map((m: any) => m.type))}`);
|
||||
notify("Agent finished", `${event.messages?.length ?? 0} turns`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user