donsetch 2.2.2 → 2.2.4
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 +15 -16
package/package.json
CHANGED
package/pi-extension.ts
CHANGED
|
@@ -31,16 +31,13 @@ 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
|
-
// ──
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
// ANSI
|
|
38
|
-
//
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const C_DIM = "\x1b[38;2;130;130;140m";
|
|
42
|
-
const C_CREAM = "\x1b[38;2;240;230;210m";
|
|
43
|
-
const RESET = "\x1b[0m";
|
|
34
|
+
// ── TUI rendering note ──
|
|
35
|
+
// Pi's TUI wraps tool calls in its own green (success) / red (failure)
|
|
36
|
+
// highlight. We output PLAIN TEXT only — no ANSI color codes. Any
|
|
37
|
+
// ANSI we emit (especially RESET) breaks pi's overlay mid-line,
|
|
38
|
+
// causing text to fall outside the green/red highlight and show
|
|
39
|
+
// with the TUI background color instead. Plain text = pi colors
|
|
40
|
+
// the whole thing uniformly.
|
|
44
41
|
|
|
45
42
|
// ── Tool icons ──
|
|
46
43
|
const ICONS: Record<string, string> = {
|
|
@@ -432,21 +429,22 @@ export default function (pi: ExtensionAPI) {
|
|
|
432
429
|
} else if (args?.query) {
|
|
433
430
|
key = truncateToWidth(`"${args.query}"`, 50, "\u2026");
|
|
434
431
|
}
|
|
432
|
+
// Plain text only — no ANSI codes. Pi wraps tool calls
|
|
433
|
+
// in its own green (success) / red (failure) highlight.
|
|
434
|
+
// Any ANSI we emit breaks pi's overlay mid-line.
|
|
435
435
|
return new Text(
|
|
436
|
-
`${
|
|
436
|
+
`${icon} ${toolName} ${key}`,
|
|
437
437
|
0, 0
|
|
438
438
|
);
|
|
439
439
|
},
|
|
440
440
|
|
|
441
441
|
renderResult(result: any, opts: any, _theme: any) {
|
|
442
442
|
if (opts?.isPartial) {
|
|
443
|
-
return new Text(`${
|
|
443
|
+
return new Text(`${toolName} working…`, 0, 0);
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
const isErr = result?.isError || result?.details?.isError;
|
|
447
447
|
const d = result?.details ?? {};
|
|
448
|
-
const glyph = isErr ? "\u2717" : "\u2713";
|
|
449
|
-
const glyphColor = isErr ? C_RED : C_AMBER;
|
|
450
448
|
|
|
451
449
|
// Build metadata string per tool
|
|
452
450
|
let meta = "";
|
|
@@ -477,9 +475,10 @@ export default function (pi: ExtensionAPI) {
|
|
|
477
475
|
line2 = d.preview;
|
|
478
476
|
}
|
|
479
477
|
|
|
480
|
-
|
|
478
|
+
// Plain text only — no ANSI. Pi handles all coloring.
|
|
479
|
+
const line1 = `${toolName} \u00B7 ${meta}`;
|
|
481
480
|
const output = line2
|
|
482
|
-
? `${line1}\n ${
|
|
481
|
+
? `${line1}\n ${line2}`
|
|
483
482
|
: line1;
|
|
484
483
|
|
|
485
484
|
return new Text(output, 0, 0);
|