donsetch 3.5.0 → 3.5.2
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.
- package/package.json +1 -1
- package/pi-extension.ts +12 -5
package/package.json
CHANGED
package/pi-extension.ts
CHANGED
|
@@ -31,6 +31,12 @@ const INIT_TIMEOUT_MS = 10_000;
|
|
|
31
31
|
const CALL_TIMEOUT_MS = 120_000;
|
|
32
32
|
const SHUTDOWN_GRACE_MS = 2_000;
|
|
33
33
|
|
|
34
|
+
// A raw process.stderr.write bypasses pi's TUI paint cycle and
|
|
35
|
+
// corrupts the viewport (worse across parallel agents). Gate it here.
|
|
36
|
+
const DEBUG_MODE =
|
|
37
|
+
(process.env.DONSETCH_DEBUG ?? "").length > 0 ||
|
|
38
|
+
(process.env.DEBUG ?? "").length > 0;
|
|
39
|
+
|
|
34
40
|
// ── TUI rendering note ──
|
|
35
41
|
// Pi's TUI wraps tool calls in its own green (success) / red (failure)
|
|
36
42
|
// highlight. We output PLAIN TEXT only : no ANSI codes at all.
|
|
@@ -165,13 +171,10 @@ function startServer(): Promise<void> {
|
|
|
165
171
|
// - DONSETCH_DEBUG / DEBUG set: forward everything (dev mode)
|
|
166
172
|
// - otherwise only crash/fatal lines survive; the rest is
|
|
167
173
|
// tool-level information the caller already has
|
|
168
|
-
const debugMode =
|
|
169
|
-
(process.env.DONSETCH_DEBUG ?? "").length > 0 ||
|
|
170
|
-
(process.env.DEBUG ?? "").length > 0;
|
|
171
174
|
const FATAL_RE = /fatal|panic|crash|SIGSEGV|abort|OOM|out of memory/i;
|
|
172
175
|
let stderrTail = "";
|
|
173
176
|
proc.stderr?.on("data", (chunk: Buffer) => {
|
|
174
|
-
if (
|
|
177
|
+
if (DEBUG_MODE) {
|
|
175
178
|
process.stderr.write(chunk);
|
|
176
179
|
return;
|
|
177
180
|
}
|
|
@@ -602,7 +605,11 @@ export default function (pi: ExtensionAPI) {
|
|
|
602
605
|
});
|
|
603
606
|
}
|
|
604
607
|
|
|
605
|
-
|
|
608
|
+
// Fires every session_start (unlike the failure paths above), so
|
|
609
|
+
// this one corrupted the viewport on every normal run.
|
|
610
|
+
if (DEBUG_MODE) {
|
|
611
|
+
process.stderr.write(`[donsetch] ${mcpTools.length} tools registered: ${toolNames.join(", ")}\n`);
|
|
612
|
+
}
|
|
606
613
|
});
|
|
607
614
|
|
|
608
615
|
pi.on("session_shutdown", () => {
|