pi-render-btw 0.6.15 → 0.6.16
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/CHANGELOG.md +5 -0
- package/extensions/btw-transcript.test.ts +4 -1
- package/extensions/btw.ts +36 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.16 — 2026-09-18
|
|
4
|
+
|
|
5
|
+
- Extract textual tool-result content for readable Tool Output instead of rendering the raw `{ content: [...] }` envelope.
|
|
6
|
+
- Omit duplicated Details content while preserving structured metadata such as duration and diffs.
|
|
7
|
+
|
|
3
8
|
## 0.6.15 — 2026-09-18
|
|
4
9
|
|
|
5
10
|
- Use one local Cc-style Input/Output card renderer for Peek and read-only Tool Output, including stable input key/value rows, rails, error styling, and width-safe synchronous highlighting.
|
|
@@ -542,7 +542,7 @@ describe("BTW transcript message layout", () => {
|
|
|
542
542
|
isError: false,
|
|
543
543
|
input: { path: "full.txt" },
|
|
544
544
|
output: { content: [{ type: "text", text: "full output" }] },
|
|
545
|
-
details: { durationMs: 3 },
|
|
545
|
+
details: { content: [{ type: "text", text: "full output" }], durationMs: 3 },
|
|
546
546
|
diff: "@@ -1 +1 @@\n",
|
|
547
547
|
};
|
|
548
548
|
let dismissed = 0;
|
|
@@ -584,7 +584,10 @@ describe("BTW transcript message layout", () => {
|
|
|
584
584
|
const output = component.render(80).join("\n");
|
|
585
585
|
expect(output).toContain("BTW Tool Output");
|
|
586
586
|
expect(output).toContain("full.txt");
|
|
587
|
+
expect(output).toContain("full output");
|
|
587
588
|
expect(output).toContain("durationMs");
|
|
589
|
+
expect(output).not.toContain('"content"');
|
|
590
|
+
expect(output).not.toContain('"text"');
|
|
588
591
|
expect(output).toContain("Diff:");
|
|
589
592
|
component.handleInput("\x1b");
|
|
590
593
|
expect((component as any).toolPreviewParent).toBeNull();
|
package/extensions/btw.ts
CHANGED
|
@@ -435,8 +435,23 @@ function buildBtwSeedState(
|
|
|
435
435
|
};
|
|
436
436
|
}
|
|
437
437
|
|
|
438
|
+
function extractToolText(value: unknown): string | undefined {
|
|
439
|
+
if (Array.isArray(value)) {
|
|
440
|
+
const text = value
|
|
441
|
+
.filter((item): item is Record<string, unknown> => isRecord(item) && item.type === "text" && typeof item.text === "string")
|
|
442
|
+
.map((item) => item.text as string)
|
|
443
|
+
.join("\n");
|
|
444
|
+
return text || undefined;
|
|
445
|
+
}
|
|
446
|
+
if (!isRecord(value)) return undefined;
|
|
447
|
+
if (Array.isArray(value.content)) {
|
|
448
|
+
return extractToolText(value.content);
|
|
449
|
+
}
|
|
450
|
+
return value.type === "text" && typeof value.text === "string" ? value.text : undefined;
|
|
451
|
+
}
|
|
452
|
+
|
|
438
453
|
function formatToolPreview(value: unknown): string {
|
|
439
|
-
if (value === undefined) {
|
|
454
|
+
if (value === undefined || value === null) {
|
|
440
455
|
return "";
|
|
441
456
|
}
|
|
442
457
|
|
|
@@ -444,8 +459,11 @@ function formatToolPreview(value: unknown): string {
|
|
|
444
459
|
return value;
|
|
445
460
|
}
|
|
446
461
|
|
|
462
|
+
const text = extractToolText(value);
|
|
463
|
+
if (text !== undefined) return text;
|
|
464
|
+
|
|
447
465
|
try {
|
|
448
|
-
const preview = JSON.stringify(value);
|
|
466
|
+
const preview = JSON.stringify(value, null, 2);
|
|
449
467
|
if (!preview || preview === "{}") {
|
|
450
468
|
return "";
|
|
451
469
|
}
|
|
@@ -458,6 +476,20 @@ function formatToolPreview(value: unknown): string {
|
|
|
458
476
|
}
|
|
459
477
|
}
|
|
460
478
|
|
|
479
|
+
function formatToolDetails(value: unknown, output: string): string {
|
|
480
|
+
if (!isRecord(value) || !Array.isArray(value.content)) {
|
|
481
|
+
return formatToolPreview(value);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
const content = extractToolText(value);
|
|
485
|
+
const remaining = Object.fromEntries(
|
|
486
|
+
Object.entries(value).filter(([key]) => key !== "content"),
|
|
487
|
+
);
|
|
488
|
+
const remainingText = formatToolPreview(remaining);
|
|
489
|
+
if (content === output || !remainingText) return remainingText;
|
|
490
|
+
return formatToolPreview(value);
|
|
491
|
+
}
|
|
492
|
+
|
|
461
493
|
function createEmptyTranscriptState(): BtwTranscriptState {
|
|
462
494
|
return {
|
|
463
495
|
entries: [],
|
|
@@ -2114,10 +2146,10 @@ export class BtwOverlayComponent extends Container implements Focusable {
|
|
|
2114
2146
|
const hydrated = { ...block };
|
|
2115
2147
|
const input = formatToolPreview(artifact.input);
|
|
2116
2148
|
const output = formatToolPreview(artifact.output);
|
|
2117
|
-
const details =
|
|
2149
|
+
const details = formatToolDetails(artifact.details, output);
|
|
2118
2150
|
if (input) hydrated.toolInput = input;
|
|
2119
2151
|
if (output) hydrated.toolOutput = output;
|
|
2120
|
-
if (details) {
|
|
2152
|
+
if (details && details.trim() !== output.trim()) {
|
|
2121
2153
|
hydrated.toolOutput = `${hydrated.toolOutput || "(no output)"}\n\nDetails:\n${details}`;
|
|
2122
2154
|
}
|
|
2123
2155
|
if (artifact.diff) {
|
package/package.json
CHANGED