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:
parent
7faabcb038
commit
113878e83f
@ -41,3 +41,4 @@
|
|||||||
{"timestamp":"2026-04-28T12:01:00.510Z","provider":"llama.cpp","model":"Qwen3.6-35B-A3B-MXFP4_MOE.gguf","turnCount":1,"inputTokens":25,"outputTokens":361,"totalTokens":386,"prefillTokensPerSec":5.99,"generationTokensPerSec":98.55,"combinedTokensPerSec":49.24,"totalDurationMs":7839,"timeToFirstTokenMs":4176,"rawTimestamps":{"ttftMs":4176,"allTtftMs":[4176],"generationDurationMs":3663,"turns":[{"turnId":"turn-0","durationMs":7839,"ttftMs":4176}]}}
|
{"timestamp":"2026-04-28T12:01:00.510Z","provider":"llama.cpp","model":"Qwen3.6-35B-A3B-MXFP4_MOE.gguf","turnCount":1,"inputTokens":25,"outputTokens":361,"totalTokens":386,"prefillTokensPerSec":5.99,"generationTokensPerSec":98.55,"combinedTokensPerSec":49.24,"totalDurationMs":7839,"timeToFirstTokenMs":4176,"rawTimestamps":{"ttftMs":4176,"allTtftMs":[4176],"generationDurationMs":3663,"turns":[{"turnId":"turn-0","durationMs":7839,"ttftMs":4176}]}}
|
||||||
{"timestamp":"2026-04-28T12:02:20.597Z","provider":"llama.cpp","model":"Qwen3.6-35B-A3B-MXFP4_MOE.gguf","turnCount":7,"inputTokens":539,"outputTokens":2934,"totalTokens":3473,"prefillTokensPerSec":696.38,"generationTokensPerSec":60.84,"combinedTokensPerSec":70.88,"totalDurationMs":48998,"timeToFirstTokenMs":774,"rawTimestamps":{"ttftMs":774,"allTtftMs":[774,688],"generationDurationMs":48224,"turns":[{"turnId":"turn-0","durationMs":14900},{"turnId":"turn-1","durationMs":9439},{"turnId":"turn-2","durationMs":8005},{"turnId":"turn-3","durationMs":6527},{"turnId":"turn-4","durationMs":4604,"ttftMs":774},{"turnId":"turn-5","durationMs":3659},{"turnId":"turn-6","durationMs":1864,"ttftMs":688}]}}
|
{"timestamp":"2026-04-28T12:02:20.597Z","provider":"llama.cpp","model":"Qwen3.6-35B-A3B-MXFP4_MOE.gguf","turnCount":7,"inputTokens":539,"outputTokens":2934,"totalTokens":3473,"prefillTokensPerSec":696.38,"generationTokensPerSec":60.84,"combinedTokensPerSec":70.88,"totalDurationMs":48998,"timeToFirstTokenMs":774,"rawTimestamps":{"ttftMs":774,"allTtftMs":[774,688],"generationDurationMs":48224,"turns":[{"turnId":"turn-0","durationMs":14900},{"turnId":"turn-1","durationMs":9439},{"turnId":"turn-2","durationMs":8005},{"turnId":"turn-3","durationMs":6527},{"turnId":"turn-4","durationMs":4604,"ttftMs":774},{"turnId":"turn-5","durationMs":3659},{"turnId":"turn-6","durationMs":1864,"ttftMs":688}]}}
|
||||||
{"timestamp":"2026-04-28T12:03:17.466Z","provider":"llama.cpp","model":"Qwen3.6-35B-A3B-MXFP4_MOE.gguf","turnCount":4,"inputTokens":1021,"outputTokens":811,"totalTokens":1832,"prefillTokensPerSec":1314.03,"generationTokensPerSec":42.63,"combinedTokensPerSec":92.53,"totalDurationMs":19800,"timeToFirstTokenMs":777,"rawTimestamps":{"ttftMs":777,"allTtftMs":[777,773],"generationDurationMs":19023,"turns":[{"turnId":"turn-0","durationMs":2234,"ttftMs":777},{"turnId":"turn-1","durationMs":11707},{"turnId":"turn-2","durationMs":2777},{"turnId":"turn-3","durationMs":3082,"ttftMs":773}]}}
|
{"timestamp":"2026-04-28T12:03:17.466Z","provider":"llama.cpp","model":"Qwen3.6-35B-A3B-MXFP4_MOE.gguf","turnCount":4,"inputTokens":1021,"outputTokens":811,"totalTokens":1832,"prefillTokensPerSec":1314.03,"generationTokensPerSec":42.63,"combinedTokensPerSec":92.53,"totalDurationMs":19800,"timeToFirstTokenMs":777,"rawTimestamps":{"ttftMs":777,"allTtftMs":[777,773],"generationDurationMs":19023,"turns":[{"turnId":"turn-0","durationMs":2234,"ttftMs":777},{"turnId":"turn-1","durationMs":11707},{"turnId":"turn-2","durationMs":2777},{"turnId":"turn-3","durationMs":3082,"ttftMs":773}]}}
|
||||||
|
{"timestamp":"2026-04-28T12:03:41.670Z","provider":"llama.cpp","model":"Qwen3.6-35B-A3B-MXFP4_MOE.gguf","turnCount":3,"inputTokens":262,"outputTokens":161,"totalTokens":423,"prefillTokensPerSec":521.91,"generationTokensPerSec":38.86,"combinedTokensPerSec":91.07,"totalDurationMs":4645,"timeToFirstTokenMs":502,"rawTimestamps":{"ttftMs":502,"allTtftMs":[502],"generationDurationMs":4143,"turns":[{"turnId":"turn-0","durationMs":1661},{"turnId":"turn-1","durationMs":2314},{"turnId":"turn-2","durationMs":670,"ttftMs":502}]}}
|
||||||
|
|||||||
@ -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_NOTIFICATIONS_ENABLED` | `true` | Set to `false` to disable all notifications |
|
||||||
| `PI_NOTIFICATION_AGENT_END` | `true` | Play sound when agent finishes |
|
| `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_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
|
||||||
- **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');"`
|
|
||||||
|
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
|
## Available macOS sounds
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import { existsSync } from "node:fs";
|
|||||||
// Configuration via environment variables
|
// Configuration via environment variables
|
||||||
const enabled = process.env.PI_NOTIFICATIONS_ENABLED !== "false";
|
const enabled = process.env.PI_NOTIFICATIONS_ENABLED !== "false";
|
||||||
const agentEndEnabled = process.env.PI_NOTIFICATION_AGENT_END !== "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";
|
const audioPath = process.env.PI_NOTIFICATION_AUDIO || "/System/Library/Sounds/Glass.aiff";
|
||||||
|
|
||||||
function notify(body: string, subtitle?: string): void {
|
function notify(body: string, subtitle?: string): void {
|
||||||
@ -23,26 +22,15 @@ function notify(body: string, subtitle?: string): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function (pi: ExtensionAPI) {
|
export default function (pi: ExtensionAPI) {
|
||||||
console.log("[pi-notifications] loaded (enabled=" + enabled + ", agentEnd=" + agentEndEnabled + ")");
|
pi.on("session_start", async (_event, _ctx) => {
|
||||||
|
|
||||||
pi.on("session_start", async (_event, ctx) => {
|
|
||||||
if (debug) {
|
|
||||||
ctx.ui.steer("[pi-notifications] session_start — debug mode, skipping actual notification");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
notify("pi-notifications active", "Listening for agent_end");
|
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 (!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))}`);
|
console.log(`[pi-notifications] agent_end: messages=${JSON.stringify(event.messages?.map((m: any) => m.type))}`);
|
||||||
notify("Agent finished", `${event.messages?.length ?? 0} turns`);
|
notify("Agent finished", `${event.messages?.length ?? 0} turns`);
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user