pi-fabric 0.92.12 → 0.92.14
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/dist/ui/border-status-editor.d.ts +22 -0
- package/dist/ui/border-status-editor.d.ts.map +1 -0
- package/dist/ui/conversation.d.ts +3 -0
- package/dist/ui/conversation.d.ts.map +1 -1
- package/dist/ui/conversation.js +89 -24
- package/dist/ui/conversation.js.map +4 -4
- package/docs/certification.md +1 -1
- package/docs/provider-component-calculus.md +1 -1
- package/package.json +5 -5
- package/skillsets/python/fabric-schema/SKILL.md +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Editor, Loader, type LoaderIndicatorOptions, type TUI } from "@earendil-works/pi-tui";
|
|
2
|
+
/** Streaming status rendered inside an editor's top border. Mirrors Pi's
|
|
3
|
+
* `WorkingStatusIndicator`: braille frames at 80 ms, plus the same
|
|
4
|
+
* `renderInBorder` projections `CustomEditor` uses to place them. */
|
|
5
|
+
export declare class BorderWorkingIndicator extends Loader {
|
|
6
|
+
constructor(ui: TUI, colorFn: (text: string) => string, message?: string, indicator?: LoaderIndicatorOptions);
|
|
7
|
+
renderInBorder(width: number): string;
|
|
8
|
+
renderSpinnerInBorder(width: number): string;
|
|
9
|
+
}
|
|
10
|
+
/** Editor that carries the streaming status in its top border, the way Pi's
|
|
11
|
+
* `CustomEditor` does when `embedWorkingStatus` is on. Pi's host owns the
|
|
12
|
+
* default editor and opts in there; the Fabric preview owns this editor, so it
|
|
13
|
+
* opts in by construction. Placement rules (full status, spinner-only when it
|
|
14
|
+
* cannot fit, and the `↑ N more` scroll label) match Pi's border exactly, and
|
|
15
|
+
* the status is painted with the editor's own border color — the thinking-level
|
|
16
|
+
* color, as Pi's embedded indicator is. */
|
|
17
|
+
export declare class BorderStatusEditor extends Editor {
|
|
18
|
+
private workingStatusIndicator;
|
|
19
|
+
setWorkingStatusIndicator(indicator: BorderWorkingIndicator | undefined): void;
|
|
20
|
+
protected renderTopBorder(width: number, hiddenLineCount: number): string;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=border-status-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"border-status-editor.d.ts","sourceRoot":"","sources":["../../src/ui/border-status-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,MAAM,EAGN,KAAK,sBAAsB,EAC3B,KAAK,GAAG,EACT,MAAM,wBAAwB,CAAC;AAEhC;;sEAEsE;AACtE,qBAAa,sBAAuB,SAAQ,MAAM;gBACpC,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,OAAO,SAAY,EAAE,SAAS,CAAC,EAAE,sBAAsB;IAM/G,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAKrC,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAG7C;AAED;;;;;;4CAM4C;AAC5C,qBAAa,kBAAmB,SAAQ,MAAM;IAC5C,OAAO,CAAC,sBAAsB,CAAqC;IAEnE,yBAAyB,CAAC,SAAS,EAAE,sBAAsB,GAAG,SAAS,GAAG,IAAI;cAI3D,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;CAmCnF"}
|
|
@@ -157,6 +157,9 @@ export declare class FabricConversationView implements Component, Focusable {
|
|
|
157
157
|
private observe;
|
|
158
158
|
private selectedTargetIsWorking;
|
|
159
159
|
private syncWorkingIndicator;
|
|
160
|
+
/** Every editor instance that can be mounted (composer, suspended queue-row
|
|
161
|
+
* composer) carries the live indicator, and nothing keeps a stale one. */
|
|
162
|
+
private attachWorkingIndicator;
|
|
160
163
|
private stopWorkingIndicator;
|
|
161
164
|
invalidate(): void;
|
|
162
165
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/ui/conversation.ts"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CAAC,YAAY;IA4BpB,OAAO,CAAC,eAAe;IAgBvB,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,UAAU;IA0BlB,OAAO,CAAC,WAAW;CAyCpB"}
|
package/dist/ui/conversation.js
CHANGED
|
@@ -25,18 +25,70 @@ import "../chunks/chunk-OKOHRXGF.js";
|
|
|
25
25
|
// src/ui/conversation.ts
|
|
26
26
|
import {
|
|
27
27
|
CURSOR_MARKER,
|
|
28
|
-
Editor,
|
|
29
28
|
fuzzyFilter,
|
|
30
29
|
getKeybindings as getKeybindings2,
|
|
31
30
|
Input,
|
|
32
31
|
Key as Key2,
|
|
33
|
-
Loader,
|
|
34
32
|
Text,
|
|
35
33
|
matchesKey as matchesKey2,
|
|
36
|
-
truncateToWidth as
|
|
37
|
-
visibleWidth as
|
|
34
|
+
truncateToWidth as truncateToWidth3,
|
|
35
|
+
visibleWidth as visibleWidth3
|
|
38
36
|
} from "@earendil-works/pi-tui";
|
|
39
37
|
|
|
38
|
+
// src/ui/border-status-editor.ts
|
|
39
|
+
import {
|
|
40
|
+
Editor,
|
|
41
|
+
Loader,
|
|
42
|
+
truncateToWidth,
|
|
43
|
+
visibleWidth
|
|
44
|
+
} from "@earendil-works/pi-tui";
|
|
45
|
+
var BorderWorkingIndicator = class extends Loader {
|
|
46
|
+
constructor(ui, colorFn, message = "Working", indicator) {
|
|
47
|
+
super(ui, colorFn, colorFn, message, indicator);
|
|
48
|
+
}
|
|
49
|
+
renderInBorder(width) {
|
|
50
|
+
const line = this.render(width + 2)[1] ?? "";
|
|
51
|
+
return truncateToWidth(line.startsWith(" ") ? line.slice(1).trimEnd() : line.trimEnd(), width, "");
|
|
52
|
+
}
|
|
53
|
+
renderSpinnerInBorder(width) {
|
|
54
|
+
return truncateToWidth(this.getRenderedIndicator(), width, "");
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var BorderStatusEditor = class extends Editor {
|
|
58
|
+
workingStatusIndicator;
|
|
59
|
+
setWorkingStatusIndicator(indicator) {
|
|
60
|
+
this.workingStatusIndicator = indicator;
|
|
61
|
+
}
|
|
62
|
+
renderTopBorder(width, hiddenLineCount) {
|
|
63
|
+
const indicator = this.workingStatusIndicator;
|
|
64
|
+
if (!indicator || width <= 0) return super.renderTopBorder(width, hiddenLineCount);
|
|
65
|
+
let status = indicator.renderInBorder(Math.max(1, width - 5));
|
|
66
|
+
let statusWidth = visibleWidth(status);
|
|
67
|
+
if (statusWidth === 0) return super.renderTopBorder(width, hiddenLineCount);
|
|
68
|
+
const overflowLabel = hiddenLineCount > 0 ? ` \u2191 ${hiddenLineCount} more ` : void 0;
|
|
69
|
+
const overflowLabelWidth = overflowLabel ? visibleWidth(overflowLabel) : 0;
|
|
70
|
+
const overflowStart = Math.floor((width - overflowLabelWidth) / 2);
|
|
71
|
+
const canFitOverflow = () => overflowLabel !== void 0 && overflowLabelWidth + 2 <= width && overflowStart - (3 + statusWidth + 1) >= 1;
|
|
72
|
+
if (overflowLabel && !canFitOverflow()) {
|
|
73
|
+
status = indicator.renderSpinnerInBorder(width);
|
|
74
|
+
statusWidth = visibleWidth(status);
|
|
75
|
+
}
|
|
76
|
+
if (canFitOverflow()) {
|
|
77
|
+
const leftBlockWidth = 3 + statusWidth + 1;
|
|
78
|
+
return this.borderColor("\u2500\u2500 ") + status + this.borderColor(
|
|
79
|
+
` ${"\u2500".repeat(overflowStart - leftBlockWidth)}${overflowLabel}${"\u2500".repeat(width - overflowStart - overflowLabelWidth)}`
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
if (width >= statusWidth + 5) {
|
|
83
|
+
return this.borderColor("\u2500\u2500 ") + status + this.borderColor(` ${"\u2500".repeat(width - statusWidth - 4)}`);
|
|
84
|
+
}
|
|
85
|
+
status = indicator.renderSpinnerInBorder(width);
|
|
86
|
+
statusWidth = visibleWidth(status);
|
|
87
|
+
const prefixWidth = Math.min(3, Math.max(0, width - statusWidth));
|
|
88
|
+
return this.borderColor("\u2500".repeat(prefixWidth)) + status + this.borderColor("\u2500".repeat(Math.max(0, width - prefixWidth - statusWidth)));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
40
92
|
// src/ui/conversation-render.ts
|
|
41
93
|
import { wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
42
94
|
var DEFAULT_IMAGE_WIDTH_CELLS = 60;
|
|
@@ -598,7 +650,7 @@ var safeRender = (component, width, fallback) => {
|
|
|
598
650
|
};
|
|
599
651
|
|
|
600
652
|
// src/ui/conversation-selection.ts
|
|
601
|
-
import { sliceByColumn, stripTerminalSequences, visibleWidth } from "@earendil-works/pi-tui";
|
|
653
|
+
import { sliceByColumn, stripTerminalSequences, visibleWidth as visibleWidth2 } from "@earendil-works/pi-tui";
|
|
602
654
|
var graphemes = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
603
655
|
var ConversationTextSelection = class {
|
|
604
656
|
source;
|
|
@@ -631,7 +683,7 @@ var ConversationTextSelection = class {
|
|
|
631
683
|
row = Math.max(0, Math.min(this.source.length - 1, row));
|
|
632
684
|
let boundary = 0;
|
|
633
685
|
for (const { segment } of graphemes.segment(stripTerminalSequences(this.source[row] ?? ""))) {
|
|
634
|
-
const next = boundary +
|
|
686
|
+
const next = boundary + visibleWidth2(segment);
|
|
635
687
|
if (next > col) break;
|
|
636
688
|
boundary = next;
|
|
637
689
|
}
|
|
@@ -650,7 +702,7 @@ var ConversationTextSelection = class {
|
|
|
650
702
|
for (let row = bounds.start.row; row <= bounds.end.row; row++) {
|
|
651
703
|
const line = this.source[row] ?? "";
|
|
652
704
|
const start = row === bounds.start.row ? bounds.start.col : 0;
|
|
653
|
-
const end = row === bounds.end.row ? bounds.end.col :
|
|
705
|
+
const end = row === bounds.end.row ? bounds.end.col : visibleWidth2(line);
|
|
654
706
|
lines.push(stripTerminalSequences(sliceByColumn(line, start, end - start, true)).trimEnd());
|
|
655
707
|
}
|
|
656
708
|
return lines.join("\n") || void 0;
|
|
@@ -659,7 +711,7 @@ var ConversationTextSelection = class {
|
|
|
659
711
|
const bounds = this.bounds();
|
|
660
712
|
if (!bounds || row < bounds.start.row || row > bounds.end.row) return line;
|
|
661
713
|
if (/\x1b(?:_G|\]1337;File=|P)/.test(line)) return line;
|
|
662
|
-
const width =
|
|
714
|
+
const width = visibleWidth2(line);
|
|
663
715
|
const start = row === bounds.start.row ? bounds.start.col : 0;
|
|
664
716
|
const end = row === bounds.end.row ? bounds.end.col : width;
|
|
665
717
|
if (end <= start) return line;
|
|
@@ -734,7 +786,7 @@ import {
|
|
|
734
786
|
Key,
|
|
735
787
|
getKeybindings,
|
|
736
788
|
matchesKey,
|
|
737
|
-
truncateToWidth
|
|
789
|
+
truncateToWidth as truncateToWidth2
|
|
738
790
|
} from "@earendil-works/pi-tui";
|
|
739
791
|
var QUEUE_STEER_CONVERSATION_QUEUE_REQUEST_EVENT = "queue-steer:conversation-queue:request:v1";
|
|
740
792
|
var DEQUEUE_FALLBACK = "alt+up";
|
|
@@ -1197,7 +1249,7 @@ function createConversationQueue(options) {
|
|
|
1197
1249
|
theme
|
|
1198
1250
|
);
|
|
1199
1251
|
const lines2 = widget.render(width);
|
|
1200
|
-
if (dispatched.length > 0) lines2.push(theme.fg("dim",
|
|
1252
|
+
if (dispatched.length > 0) lines2.push(theme.fg("dim", truncateToWidth2("Sent rows await child delivery; they cannot be edited locally.", width, "")));
|
|
1201
1253
|
return lines2;
|
|
1202
1254
|
}
|
|
1203
1255
|
const lines = [""];
|
|
@@ -1209,11 +1261,11 @@ function createConversationQueue(options) {
|
|
|
1209
1261
|
const note = row.removed ? " \xB7 removed on save" : row.paused ? " \xB7 paused" : "";
|
|
1210
1262
|
const color = row.state === "dispatched" ? "dim" : bridge ? bridge.laneColor(row.lane) : "dim";
|
|
1211
1263
|
lines.push(
|
|
1212
|
-
` ${theme.fg(color,
|
|
1264
|
+
` ${theme.fg(color, truncateToWidth2(`${marker}${label}: ${row.text.replace(/\n/g, " ")}${note}`, innerWidth, "\u2026"))} `
|
|
1213
1265
|
);
|
|
1214
1266
|
}
|
|
1215
1267
|
const hint = queue.length > 0 ? `\u21B3 ${dequeueHint} to edit queued messages` : "\u21B3 Waiting for child delivery";
|
|
1216
|
-
lines.push(` ${theme.fg("dim",
|
|
1268
|
+
lines.push(` ${theme.fg("dim", truncateToWidth2(hint, innerWidth, "\u2026"))} `);
|
|
1217
1269
|
return lines;
|
|
1218
1270
|
},
|
|
1219
1271
|
handleInput(data) {
|
|
@@ -1661,9 +1713,10 @@ var FabricConversationView = class {
|
|
|
1661
1713
|
const editorTui = Object.create(this.tui, { requestRender: { value: () => {
|
|
1662
1714
|
if (!this.disposed && this.editor === editor) this.tui.requestRender();
|
|
1663
1715
|
} } });
|
|
1664
|
-
const editor = new
|
|
1716
|
+
const editor = new BorderStatusEditor(editorTui, conversationEditorTheme(this.theme, () => this.currentTarget()?.thinking), {
|
|
1665
1717
|
paddingX: this.options.appearance?.editorPaddingX ?? 0
|
|
1666
1718
|
});
|
|
1719
|
+
editor.setWorkingStatusIndicator(this.working);
|
|
1667
1720
|
editor.focused = this.focusState && this.mode === "conversation";
|
|
1668
1721
|
if (!withHistory) return editor;
|
|
1669
1722
|
editor.setAutocompleteProvider(conversationCommandCompletion(() => !this.disposed && this.editor === editor && this.mode === "conversation" && !this.state.queues.get(this.currentId ?? "")?.editingActive));
|
|
@@ -1727,6 +1780,7 @@ var FabricConversationView = class {
|
|
|
1727
1780
|
this.editor = this.suspendedEditor;
|
|
1728
1781
|
this.suspendedEditor = void 0;
|
|
1729
1782
|
this.editor.focused = this.focusState && this.mode === "conversation";
|
|
1783
|
+
this.attachWorkingIndicator();
|
|
1730
1784
|
restoredText = this.currentId ? this.state.view(this.currentId).draft : text;
|
|
1731
1785
|
}
|
|
1732
1786
|
this.editor?.setText(restoredText);
|
|
@@ -1836,9 +1890,11 @@ var FabricConversationView = class {
|
|
|
1836
1890
|
let queueLines = queue?.render(width) ?? [];
|
|
1837
1891
|
let editorLines = this.mode === "conversation" && !(queue?.editingActive && queue.mode === "extension") ? this.renderEditorLines(width) : [];
|
|
1838
1892
|
const editorBudget = Math.min(editorLines.length, Math.max(1, rows - (rows >= 6 ? 3 : 0)));
|
|
1893
|
+
let editorShowsTopBorder = editorLines.length > 0;
|
|
1839
1894
|
if (editorLines.length > editorBudget) {
|
|
1840
1895
|
const cursor = Math.max(0, editorLines.findIndex((line) => line.includes(CURSOR_MARKER)));
|
|
1841
1896
|
const start = Math.max(0, Math.min(cursor - Math.floor(editorBudget / 2), editorLines.length - editorBudget));
|
|
1897
|
+
editorShowsTopBorder = start === 0;
|
|
1842
1898
|
editorLines = editorLines.slice(start, start + editorBudget);
|
|
1843
1899
|
}
|
|
1844
1900
|
let remaining = rows - editorLines.length;
|
|
@@ -1865,7 +1921,7 @@ var FabricConversationView = class {
|
|
|
1865
1921
|
remaining -= queueLines.length;
|
|
1866
1922
|
this.editorTop = rows - editorLines.length - footer.length - hints.length;
|
|
1867
1923
|
this.editorHeight = editorLines.length;
|
|
1868
|
-
const body = remaining <= 0 ? [] : this.mode === "picker" ? this.pickerLines(width, remaining) : this.windowBody(transcriptLines, remaining, this.transcriptTail(width, remaining));
|
|
1924
|
+
const body = remaining <= 0 ? [] : this.mode === "picker" ? this.pickerLines(width, remaining) : this.windowBody(transcriptLines, remaining, this.transcriptTail(width, remaining, editorShowsTopBorder));
|
|
1869
1925
|
this.bodyTop = head.length;
|
|
1870
1926
|
const scroll = this.currentId ? this.state.view(this.currentId).scroll : 0;
|
|
1871
1927
|
this.bodyHeight = this.mode === "conversation" ? Math.max(0, Math.min(remaining, this.lastBody.length - scroll)) : 0;
|
|
@@ -1873,7 +1929,7 @@ var FabricConversationView = class {
|
|
|
1873
1929
|
for (let row = 0; row < this.bodyHeight; row++) body[row] = this.textSelection.highlight(body[row], scroll + row, this.theme);
|
|
1874
1930
|
}
|
|
1875
1931
|
while (body.length < remaining) body.push("");
|
|
1876
|
-
return [...head, ...body.slice(0, remaining), ...queueLines, ...editorLines, ...footer, ...hints].slice(0, rows).map((line) =>
|
|
1932
|
+
return [...head, ...body.slice(0, remaining), ...queueLines, ...editorLines, ...footer, ...hints].slice(0, rows).map((line) => visibleWidth3(line) <= width ? line : truncateToWidth3(line, width, ""));
|
|
1877
1933
|
}
|
|
1878
1934
|
/** Observe files without rendering native history; true means a visible change
|
|
1879
1935
|
* or a live animation still needs the normal TUI render path. */
|
|
@@ -1931,14 +1987,23 @@ var FabricConversationView = class {
|
|
|
1931
1987
|
this.stopWorkingIndicator();
|
|
1932
1988
|
const id = this.currentId;
|
|
1933
1989
|
this.workingTargetId = id;
|
|
1934
|
-
|
|
1990
|
+
const color = (text) => this.editor?.borderColor(text) ?? this.theme.fg("borderMuted", text);
|
|
1991
|
+
this.working = new BorderWorkingIndicator({ requestRender: () => {
|
|
1935
1992
|
if (!this.disposed && this.mode === "conversation" && this.currentId === id) this.tui.requestRender();
|
|
1936
|
-
} },
|
|
1993
|
+
} }, color, "Working");
|
|
1994
|
+
this.attachWorkingIndicator();
|
|
1995
|
+
}
|
|
1996
|
+
/** Every editor instance that can be mounted (composer, suspended queue-row
|
|
1997
|
+
* composer) carries the live indicator, and nothing keeps a stale one. */
|
|
1998
|
+
attachWorkingIndicator() {
|
|
1999
|
+
this.editor?.setWorkingStatusIndicator(this.working);
|
|
2000
|
+
this.suspendedEditor?.setWorkingStatusIndicator(this.working);
|
|
1937
2001
|
}
|
|
1938
2002
|
stopWorkingIndicator() {
|
|
1939
2003
|
this.working?.stop();
|
|
1940
2004
|
this.working = void 0;
|
|
1941
2005
|
this.workingTargetId = void 0;
|
|
2006
|
+
this.attachWorkingIndicator();
|
|
1942
2007
|
}
|
|
1943
2008
|
invalidate() {
|
|
1944
2009
|
this.working?.invalidate();
|
|
@@ -2629,7 +2694,7 @@ var FabricConversationView = class {
|
|
|
2629
2694
|
const main = this.mainTarget();
|
|
2630
2695
|
if (main) chain.push(main);
|
|
2631
2696
|
}
|
|
2632
|
-
if (chain.length === 0) return
|
|
2697
|
+
if (chain.length === 0) return truncateToWidth3(this.theme.fg("dim", "Fabric"), width, "");
|
|
2633
2698
|
const last = chain[chain.length - 1];
|
|
2634
2699
|
const parts = chain.map((target, index) => {
|
|
2635
2700
|
const isCurrent = target.id === this.currentId;
|
|
@@ -2637,14 +2702,14 @@ var FabricConversationView = class {
|
|
|
2637
2702
|
const styled = isCurrent ? this.theme.fg("accent", name) : this.theme.fg("muted", name);
|
|
2638
2703
|
return last && index === chain.length - 1 && this.isUnread(last) ? `${styled} \u25CF` : styled;
|
|
2639
2704
|
});
|
|
2640
|
-
return
|
|
2705
|
+
return truncateToWidth3(parts.join(this.theme.fg("dim", " > ")), width, "");
|
|
2641
2706
|
}
|
|
2642
2707
|
currentFeedbackLine(width) {
|
|
2643
2708
|
if (this.mode === "picker") return void 0;
|
|
2644
2709
|
if (!this.feedback) return void 0;
|
|
2645
2710
|
if (Date.now() - this.feedback.at > FEEDBACK_TTL_MS) return void 0;
|
|
2646
2711
|
const color = this.feedback.kind === "error" ? "error" : "accent";
|
|
2647
|
-
return
|
|
2712
|
+
return truncateToWidth3(this.theme.fg(color, this.feedback.text), width, "");
|
|
2648
2713
|
}
|
|
2649
2714
|
hintsLine(width) {
|
|
2650
2715
|
const followUpKeys = this.bindingHint("app.message.followUp", "alt+enter");
|
|
@@ -2662,7 +2727,7 @@ var FabricConversationView = class {
|
|
|
2662
2727
|
"close"
|
|
2663
2728
|
];
|
|
2664
2729
|
const full = [...hints, this.theme.fg("dim", toolsKeys), "tools"].join(" ");
|
|
2665
|
-
return
|
|
2730
|
+
return truncateToWidth3(full, width, "");
|
|
2666
2731
|
}
|
|
2667
2732
|
renderEditorLines(innerWidth) {
|
|
2668
2733
|
const editor = this.editor;
|
|
@@ -2716,7 +2781,7 @@ var FabricConversationView = class {
|
|
|
2716
2781
|
codePreviewSettings: this.options.codePreviewSettings
|
|
2717
2782
|
});
|
|
2718
2783
|
}
|
|
2719
|
-
transcriptTail(width, budget) {
|
|
2784
|
+
transcriptTail(width, budget, editorVisible) {
|
|
2720
2785
|
if (this.commandNotification && this.commandNotification.epoch !== this.state.epoch) this.clearCommandNotification();
|
|
2721
2786
|
const notification = this.commandNotification;
|
|
2722
2787
|
if (this.observedTranscript?.hasNewer && !notification) return [];
|
|
@@ -2725,7 +2790,7 @@ var FabricConversationView = class {
|
|
|
2725
2790
|
const reserved = 1 + notification.pendingResult.render(width).length;
|
|
2726
2791
|
while (tail.length < reserved) tail.push("");
|
|
2727
2792
|
}
|
|
2728
|
-
if (!this.observedTranscript?.hasNewer) tail.push(...this.working?.render(width) ?? []);
|
|
2793
|
+
if (!editorVisible && !this.observedTranscript?.hasNewer) tail.push(...this.working?.render(width) ?? []);
|
|
2729
2794
|
if (budget > 1) tail.push("");
|
|
2730
2795
|
return tail;
|
|
2731
2796
|
}
|
|
@@ -2776,7 +2841,7 @@ var FabricConversationView = class {
|
|
|
2776
2841
|
const unread = this.isUnread(row.target) ? this.theme.fg("accent", " \u25CF") : "";
|
|
2777
2842
|
const label = isMainTarget(row.target) ? "Main (native session)" : `${safeText(row.target.name)} ${this.theme.fg("muted", `(${row.target.kind} \xB7 ${row.target.status})`)}`;
|
|
2778
2843
|
lines.push(
|
|
2779
|
-
|
|
2844
|
+
truncateToWidth3(
|
|
2780
2845
|
`${indent}${marker}${selected ? this.theme.fg("accent", label) : label}${unread}`,
|
|
2781
2846
|
innerWidth,
|
|
2782
2847
|
""
|