@narumitw/pi-btw 0.63.4 → 0.63.5

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/transcript-pager.ts", "../../src/conversation-chrome.ts"],
4
+ "sourcesContent": ["import type { AssistantMessage } from \"@earendil-works/pi-ai\";\nimport {\n AssistantMessageComponent,\n getMarkdownTheme,\n type MarkdownTransformer,\n type Theme,\n UserMessageComponent,\n} from \"@earendil-works/pi-coding-agent\";\nimport {\n type Component,\n CURSOR_MARKER,\n Editor,\n type EditorTheme,\n type Focusable,\n isKeyRelease,\n type Keybindings,\n type KeybindingsManager,\n renderFakeCursor,\n ScrollView,\n Spacer,\n Text,\n type TUI,\n truncateToWidth,\n VStack,\n visibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport {\n type BtwDisplayModel,\n BtwWorkingIndicator,\n type BtwWorkspaceFocus,\n renderConversationFooter,\n renderWorkingBorder,\n} from \"./conversation-chrome.js\";\nimport {\n BtwPasteGuard,\n type BtwShortcuts,\n btwKeyHasReachableInput,\n getBtwHostInputBlockers,\n getBtwKeybindings,\n getBtwShortcuts,\n normalizeBtwKey,\n} from \"./keybindings.js\";\nimport type { BtwThinkingLevel, SideTranscriptItem } from \"./side-thread.js\";\nimport { formatKeyLabel, sanitizeSingleLine } from \"./text.js\";\nimport type { BtwFullscreenLayoutComponent } from \"./workspace-layout.js\";\n\nconst MAX_STEERING_DISPLAY_LINES = 3;\nconst OSC133_MARKERS = [\"\\u001b]133;A\\u0007\", \"\\u001b]133;B\\u0007\", \"\\u001b]133;C\\u0007\"];\n// Pi renders a spacer above the custom component and a two-line built-in footer below it.\nconst RESERVED_APP_LINES = 3;\n\n// Native mouse focus can land directly on this Editor. Route keyboard input\n// through its logical BTW owner without replacing native mouse/cursor handling.\nclass BtwComposer extends Editor {\n constructor(\n tui: TUI,\n theme: EditorTheme,\n private readonly dispatch: (data: string) => void,\n private readonly loader?: BtwWorkingIndicator,\n ) {\n super(tui, theme);\n }\n override handleInput(data: string): void {\n this.dispatch(data);\n }\n handleEditorInput(data: string): void {\n super.handleInput(data);\n }\n override render(width: number): string[] {\n if (width <= 0) return [];\n // Core word wrapping cannot fit a two-cell grapheme into layoutWidth=1.\n // Measure at least two text cells, then clip only the display boundary.\n return super.render(Math.max(3, width)).map((line) => {\n // A wide grapheme cannot fit a one-cell dock. Keep its cursor cell usable.\n if (width <= 2 && line.includes(CURSOR_MARKER))\n return CURSOR_MARKER + renderFakeCursor(\" \") + \" \".repeat(width - 1);\n return truncateToWidth(line, width, \"\");\n });\n }\n protected override renderTopBorder(width: number, hiddenLineCount: number): string {\n if (!this.loader) return super.renderTopBorder(width, hiddenLineCount);\n return (\n renderWorkingBorder(width, hiddenLineCount, this.borderColor, this.loader) ??\n super.renderTopBorder(width, hiddenLineCount)\n );\n }\n}\n\nconst VIEWPORT_ACTIONS = [\n \"tui.altScreen.search\",\n \"tui.altScreen.pageUp\",\n \"tui.altScreen.pageDown\",\n \"tui.altScreen.halfPageUp\",\n \"tui.altScreen.halfPageDown\",\n \"tui.altScreen.lineUp\",\n \"tui.altScreen.lineDown\",\n \"tui.altScreen.previousPrompt\",\n \"tui.altScreen.nextPrompt\",\n \"tui.altScreen.top\",\n \"tui.altScreen.bottom\",\n] as const;\n// Editor's actual order before submit, with no autocomplete provider installed.\nconst BEFORE_SUBMIT = [\n \"tui.input.copy\",\n \"tui.editor.undo\",\n \"tui.input.tab\",\n \"tui.editor.deleteToLineEnd\",\n \"tui.editor.deleteToLineStart\",\n \"tui.editor.deleteWordBackward\",\n \"tui.editor.deleteWordForward\",\n \"tui.editor.deleteCharBackward\",\n \"tui.editor.deleteCharForward\",\n \"tui.editor.yank\",\n \"tui.editor.yankPop\",\n \"tui.editor.historyPrevious\",\n \"tui.editor.historyNext\",\n \"tui.editor.cursorLineStart\",\n \"tui.editor.cursorLineEnd\",\n \"tui.editor.cursorWordLeft\",\n \"tui.editor.cursorWordRight\",\n \"tui.input.newLine\",\n] as const;\n\nfunction usableKeys(keybindings: KeybindingsManager, action: keyof Keybindings, blockers: readonly string[]): string[] {\n return keybindings.getKeys(action).flatMap((candidate) => {\n const key = normalizeBtwKey(candidate);\n return key && btwKeyHasReachableInput(key, blockers) ? [key] : [];\n });\n}\n\nfunction submitHint(tui: TUI, keybindings: KeybindingsManager, verb: string): string {\n const earlier =\n tui.mode === \"fullscreen\" ? VIEWPORT_ACTIONS : ([\"tui.altScreen.pageUp\", \"tui.altScreen.pageDown\"] as const);\n const blockers = [\n ...getBtwHostInputBlockers(tui),\n \"ctrl+c\",\n \"shift+backspace\",\n \"shift+delete\",\n ...[...earlier, ...BEFORE_SUBMIT].flatMap((id) => keybindings.getKeys(id)),\n ];\n const key = usableKeys(keybindings, \"tui.input.submit\", blockers)[0];\n return key ? `${formatKeyLabel(key)} ${verb}` : \"\";\n}\n\nfunction pagingHint(tui: TUI, keybindings: KeybindingsManager): string {\n const actions = [\"tui.altScreen.pageUp\", \"tui.altScreen.pageDown\"] as const;\n const labels = actions.flatMap((action) => {\n const earlier =\n tui.mode === \"fullscreen\"\n ? VIEWPORT_ACTIONS.slice(0, VIEWPORT_ACTIONS.indexOf(action))\n : action === \"tui.altScreen.pageDown\"\n ? ([\"tui.altScreen.pageUp\"] as const)\n : [];\n const blockers = [...getBtwHostInputBlockers(tui), \"ctrl+c\", ...earlier.flatMap((id) => keybindings.getKeys(id))];\n const key = usableKeys(keybindings, action, blockers)[0];\n return key\n ? [\n formatKeyLabel(key)\n .replace(/Pageup$/u, \"PgUp\")\n .replace(/Pagedown$/u, \"PgDn\"),\n ]\n : [];\n });\n return labels.length ? `${labels.join(\"/\")} history` : \"\";\n}\n\nfunction handleFallbackPaging(\n data: string,\n tui: TUI,\n keybindings: KeybindingsManager,\n scrollView: ScrollView,\n): boolean {\n // The native renderer already dispatched these before the focused component.\n if (tui.mode === \"fullscreen\" || isKeyRelease(data)) return false;\n for (const [action, direction] of [\n [\"tui.altScreen.pageUp\", -1],\n [\"tui.altScreen.pageDown\", 1],\n ] as const) {\n if (keybindings.matches(data, action)) {\n scrollView.scrollBy(direction * Math.max(1, scrollView.viewportHeight - 4));\n return true;\n }\n }\n return false;\n}\n\nfunction fittingHint(width: number, variants: readonly string[]): string {\n return variants.find((hint) => visibleWidth(hint) <= Math.max(0, width)) ?? \"\";\n}\n\nfunction compactHints(parts: readonly string[]): string {\n return parts.filter(Boolean).join(\" \u2022 \");\n}\n\nfunction releaseScrollbar(scrollView: ScrollView): void {\n scrollView.setScrollbarActive(false);\n // setScrollbar owns cancellation of its private native hide timer.\n scrollView.setScrollbar(\"hidden\");\n}\n\nfunction thinkingBorder(theme: Theme, level: BtwThinkingLevel | undefined, text: string): string {\n return level && theme.getThinkingBorderColor\n ? theme.getThinkingBorderColor(level)(text)\n : theme.fg(\"borderMuted\", text);\n}\n\n// A temporary fit after manual scrolling must not silently resume following new output.\nclass PreservingScrollView extends ScrollView {\n override updateLayout(contentHeight: number, viewportHeight: number, requestRender: () => void): void {\n const preserveManualPosition = !this.isFollowingEnd;\n super.updateLayout(contentHeight, viewportHeight, requestRender);\n if (preserveManualPosition && this.isFollowingEnd) {\n this.scrollTo(this.scrollTop, { disableFollow: true });\n }\n }\n}\n\nexport type TranscriptPagerAction =\n | { kind: \"submit\"; question: string }\n | { kind: \"bringToMain\"; questionDraft: string }\n | { kind: \"importMainUpdates\"; questionDraft: string }\n | { kind: \"close\" };\n\nexport interface BtwThinkingControl {\n level: BtwThinkingLevel;\n levels: readonly BtwThinkingLevel[];\n keybindings: KeybindingsManager;\n onChange: (level: BtwThinkingLevel) => void;\n}\n\nexport interface BtwAnsweringViewOptions {\n model?: BtwDisplayModel;\n keybindings?: KeybindingsManager;\n markdownTransformers?: readonly MarkdownTransformer[];\n steering?: {\n questions: readonly string[];\n onSubmit: (question: string) => void;\n thinking?: BtwThinkingControl;\n };\n}\n\nexport class BtwTranscriptPager implements BtwFullscreenLayoutComponent, Focusable {\n private workspaceFocus: BtwWorkspaceFocus | undefined;\n private get keybindings(): KeybindingsManager {\n return getBtwKeybindings(this.tui, this.options.keybindings ?? this.options.thinking?.keybindings);\n }\n setWorkspaceFocus(pane: \"side\" | \"main\", shortcutLabel: string | undefined): void {\n this.workspaceFocus = { pane, shortcutLabel: shortcutLabel ? sanitizeSingleLine(shortcutLabel) : undefined };\n this.tui.requestRender();\n }\n private readonly shortcuts: BtwShortcuts;\n private readonly pasteGuard = new BtwPasteGuard();\n private readonly transcriptComponents: Component[];\n private readonly editor: BtwComposer;\n private readonly canBringToMain: boolean;\n private readonly scrollView: ScrollView;\n private readonly layoutRoot: VStack;\n private lastContentLineCount = 0;\n private warning: string | undefined;\n private finished = false;\n private isFocused = false;\n private thinkingLevel: BtwThinkingLevel | undefined;\n\n constructor(\n private readonly tui: TUI,\n private readonly theme: Theme,\n turns: readonly SideTranscriptItem[],\n private readonly onAction: (action: TranscriptPagerAction) => void,\n private readonly options: {\n model?: BtwDisplayModel;\n keybindings?: KeybindingsManager;\n mainUpdates?: () => boolean;\n startAtBottom?: boolean;\n initialQuestion?: string;\n markdownTransformers?: readonly MarkdownTransformer[];\n thinking?: BtwThinkingControl;\n } = {},\n ) {\n this.shortcuts = getBtwShortcuts(tui, this.keybindings);\n this.transcriptComponents = buildTranscriptComponents(turns, this.theme, undefined, options.markdownTransformers);\n this.canBringToMain = turns.some((turn) => turn.kind === \"answered\");\n this.thinkingLevel = options.thinking?.level;\n const editorTheme: EditorTheme = {\n borderColor: (text) => thinkingBorder(this.theme, this.thinkingLevel, text),\n selectList: {\n selectedPrefix: (text) => this.theme.fg(\"accent\", text),\n selectedText: (text) => this.theme.fg(\"accent\", text),\n description: (text) => this.theme.fg(\"muted\", text),\n scrollInfo: (text) => this.theme.fg(\"dim\", text),\n noMatch: (text) => this.theme.fg(\"warning\", text),\n },\n };\n this.editor = new BtwComposer(this.tui, editorTheme, (data) => this.handleInput(data));\n if (options.initialQuestion) this.editor.setText(options.initialQuestion);\n this.editor.onChange = () => {\n this.warning = undefined;\n };\n this.editor.onSubmit = (text) => {\n const question = text.trim();\n if (!question) {\n this.warning = \"Question cannot be empty\";\n return;\n }\n this.finished = true;\n this.onAction({ kind: \"submit\", question });\n };\n const transcript = this.createTranscriptComponent();\n this.scrollView = new PreservingScrollView(transcript, {\n follow: \"end\",\n primary: true,\n scrollbar: \"auto\",\n scrollbarTrackStyle: (text) => this.theme.fg(\"scrollbarTrack\", text),\n scrollbarThumbStyle: (text) => this.theme.fg(\"scrollbarThumb\", text),\n });\n if (!options.startAtBottom) this.scrollView.scrollTo(0, { disableFollow: true });\n const dock = new VStack([\n { component: this.editor, basis: \"auto\", shrink: 1, minSize: 1 },\n { component: this.createFooterComponent(), basis: \"auto\", shrink: 1, minSize: 0 },\n ]);\n this.layoutRoot = new VStack([\n { component: this.scrollView, basis: 0, grow: 1, minSize: 0 },\n { component: dock, basis: \"auto\", shrink: 1, minSize: 1 },\n ]);\n }\n\n get focused(): boolean {\n return this.isFocused;\n }\n\n set focused(value: boolean) {\n this.isFocused = value;\n this.editor.focused = value;\n }\n\n getFullscreenLayout(): Component {\n return this.layoutRoot;\n }\n\n getPrimaryScrollView(): ScrollView {\n return this.scrollView;\n }\n\n render(width: number): string[] {\n if (width <= 0 || this.tui.terminal.rows <= 0) return [];\n const safeWidth = Math.max(1, width);\n const editorLines = this.editor.render(safeWidth);\n const availableRows = Math.max(1, this.tui.terminal.rows - RESERVED_APP_LINES);\n const contentLines = renderTranscriptLines(this.transcriptComponents, safeWidth);\n this.lastContentLineCount = contentLines.length;\n const viewportHeight = Math.max(0, availableRows - editorLines.length - this.renderFooter(safeWidth).length);\n this.scrollView.updateLayout(contentLines.length, viewportHeight, () => this.tui.requestRender());\n\n return fitComposerLayout(\n contentLines.slice(this.scrollView.scrollTop, this.scrollView.scrollTop + viewportHeight),\n this.renderFooter(safeWidth),\n editorLines,\n availableRows,\n ).map((line) => truncateToWidth(line, safeWidth));\n }\n\n handleInput(data: string): void {\n if (this.finished) return;\n if (this.pasteGuard.consume(data)) {\n this.editor.handleEditorInput(data);\n this.tui.requestRender();\n return;\n }\n if (this.shortcuts.matches(data, \"exit\")) {\n this.finished = true;\n this.onAction({ kind: \"close\" });\n return;\n }\n if (this.options.mainUpdates && this.shortcuts.matches(data, \"importMainUpdates\")) {\n this.finished = true;\n this.onAction({ kind: \"importMainUpdates\", questionDraft: this.editor.getExpandedText() });\n return;\n }\n if (this.canBringToMain && this.shortcuts.matches(data, \"bringToMain\")) {\n this.finished = true;\n this.onAction({ kind: \"bringToMain\", questionDraft: this.editor.getExpandedText() });\n return;\n }\n const thinking = this.options.thinking;\n if (thinking && thinking.levels.length > 1 && this.shortcuts.matches(data, \"cycleThinkingLevel\")) {\n const currentIndex = thinking.levels.indexOf(this.thinkingLevel ?? thinking.level);\n const nextLevel = thinking.levels[(currentIndex + 1) % thinking.levels.length];\n if (nextLevel) {\n this.thinkingLevel = nextLevel;\n thinking.onChange(nextLevel);\n this.warning = undefined;\n this.tui.requestRender();\n }\n return;\n }\n if (!handleFallbackPaging(data, this.tui, this.keybindings, this.scrollView)) {\n this.editor.handleEditorInput(data);\n }\n if (!this.finished) this.tui.requestRender();\n }\n\n invalidate(): void {\n this.layoutRoot.invalidate();\n }\n\n dispose(): void {\n releaseScrollbar(this.scrollView);\n if (this.finished) return;\n this.finished = true;\n this.onAction({ kind: \"close\" });\n }\n\n private renderFooter(width: number): string[] {\n return renderConversationFooter(width, this.theme, {\n model: this.options.model,\n thinkingLevel: this.thinkingLevel,\n focus: this.workspaceFocus,\n hint: this.renderHints(width),\n warning: this.warning !== undefined,\n });\n }\n\n private renderHints(width: number): string {\n const exit = this.shortcuts.label(\"exit\");\n const bring = this.canBringToMain && this.shortcuts.keys.bringToMain.length > 0;\n const bringKey = this.shortcuts.label(\"bringToMain\");\n if (this.warning) return fittingHint(width, [`${this.warning} \u2022 ${exit} exit`, `Empty \u2022 ${exit}`, exit]);\n const thinking = this.options.thinking;\n const cycle =\n thinking && thinking.levels.length > 1 && this.shortcuts.keys.cycleThinkingLevel.length\n ? `${this.shortcuts.label(\"cycleThinkingLevel\")} thinking`\n : \"\";\n const importKey =\n this.options.mainUpdates && this.shortcuts.keys.importMainUpdates.length\n ? this.shortcuts.label(\"importMainUpdates\")\n : \"\";\n const newMainUpdates = importKey ? this.options.mainUpdates?.() : false;\n const importHint = importKey ? `${importKey} import main${newMainUpdates ? \" (new)\" : \"\"}` : \"\";\n const compactImportHint = importKey ? `${importKey} import${newMainUpdates ? \" (new)\" : \"\"}` : \"\";\n const submit = submitHint(this.tui, this.keybindings, \"send\");\n const history = this.getMaxScrollOffset() > 0 ? pagingHint(this.tui, this.keybindings) : \"\";\n const switchPane = this.workspaceFocus?.shortcutLabel ? `${this.workspaceFocus.shortcutLabel} switch` : \"\";\n const submitKey = submit.split(\" \")[0] ?? \"\";\n return fittingHint(width, [\n compactHints([\n submit,\n bring ? `${bringKey} bring to main` : \"\",\n `${exit} exit`,\n cycle,\n history,\n switchPane,\n importHint,\n ]),\n ...(compactImportHint\n ? [\n compactHints([submit, bring ? bringKey : \"\", exit, cycle, history, switchPane, compactImportHint]),\n compactHints([submitKey, exit, compactImportHint]),\n ]\n : []),\n compactHints([submit, bring ? bringKey : \"\", exit, cycle, history, switchPane]),\n compactHints([submitKey, bring ? bringKey : \"\", exit, cycle, history.replace(/ history$/u, \"\"), switchPane]),\n compactHints([submitKey, bring ? bringKey : \"\", exit, history.replace(/ history$/u, \"\")]),\n compactHints([submitKey, bring ? bringKey : \"\", exit]),\n compactHints([submitKey, exit]),\n exit,\n ]);\n }\n\n private createTranscriptComponent(): Component {\n return {\n render: (width) => {\n const lines = renderTranscriptLines(this.transcriptComponents, width, true);\n this.lastContentLineCount = lines.length;\n return lines;\n },\n invalidate: () => {\n for (const component of this.transcriptComponents) component.invalidate();\n },\n };\n }\n\n private createFooterComponent(): Component {\n return {\n render: (width) => this.renderFooter(width),\n invalidate() {},\n };\n }\n\n private getMaxScrollOffset(): number {\n return Math.max(0, this.lastContentLineCount - this.scrollView.viewportHeight);\n }\n}\n\nexport class BtwAnsweringView implements BtwFullscreenLayoutComponent, Focusable {\n private workspaceFocus: BtwWorkspaceFocus | undefined;\n private get keybindings(): KeybindingsManager {\n return getBtwKeybindings(this.tui, this.options.keybindings ?? this.options.steering?.thinking?.keybindings);\n }\n setWorkspaceFocus(pane: \"side\" | \"main\", shortcutLabel: string | undefined): void {\n this.workspaceFocus = { pane, shortcutLabel: shortcutLabel ? sanitizeSingleLine(shortcutLabel) : undefined };\n this.tui.requestRender();\n }\n private readonly shortcuts: BtwShortcuts;\n private readonly pasteGuard = new BtwPasteGuard();\n private readonly transcriptComponents: Component[];\n private readonly loader: BtwWorkingIndicator;\n private readonly editor: BtwComposer | undefined;\n private readonly controller = new AbortController();\n private readonly scrollView: ScrollView;\n private readonly layoutRoot: VStack;\n private lastContentLineCount = 0;\n private warning: string | undefined;\n private finished = false;\n private isFocused = false;\n private thinkingLevel: BtwThinkingLevel | undefined;\n\n constructor(\n private readonly tui: TUI,\n private readonly theme: Theme,\n turns: readonly SideTranscriptItem[],\n pendingQuestion: string,\n private readonly onCancel: () => void,\n thinkingLevel?: BtwThinkingLevel,\n private readonly options: BtwAnsweringViewOptions = {},\n ) {\n this.shortcuts = getBtwShortcuts(tui, this.keybindings);\n this.transcriptComponents = buildTranscriptComponents(\n turns,\n this.theme,\n pendingQuestion,\n options.markdownTransformers,\n );\n this.thinkingLevel = options.steering?.thinking?.level ?? thinkingLevel;\n this.loader = new BtwWorkingIndicator(\n this.tui,\n (text) => this.theme.fg(\"accent\", text),\n (text) => this.theme.fg(\"muted\", text),\n \"Answering\u2026\",\n );\n if (options.steering) {\n const editorTheme: EditorTheme = {\n borderColor: (text) => thinkingBorder(this.theme, this.thinkingLevel, text),\n selectList: {\n selectedPrefix: (text) => this.theme.fg(\"accent\", text),\n selectedText: (text) => this.theme.fg(\"accent\", text),\n description: (text) => this.theme.fg(\"muted\", text),\n scrollInfo: (text) => this.theme.fg(\"dim\", text),\n noMatch: (text) => this.theme.fg(\"warning\", text),\n },\n };\n this.editor = new BtwComposer(this.tui, editorTheme, (data) => this.handleInput(data), this.loader);\n this.editor.onChange = () => {\n this.warning = undefined;\n };\n this.editor.onSubmit = (text) => {\n const question = text.trim();\n if (!question) {\n this.warning = \"Question cannot be empty\";\n return;\n }\n options.steering?.onSubmit(question);\n this.warning = undefined;\n };\n }\n const transcript = this.createTranscriptComponent();\n this.scrollView = new PreservingScrollView(transcript, {\n follow: \"end\",\n primary: true,\n scrollbar: \"auto\",\n scrollbarTrackStyle: (text) => this.theme.fg(\"scrollbarTrack\", text),\n scrollbarThumbStyle: (text) => this.theme.fg(\"scrollbarThumb\", text),\n });\n const dock = new VStack([\n {\n component: this.createSteeringComponent(),\n basis: \"auto\",\n shrink: 1,\n minSize: 0,\n maxSize: MAX_STEERING_DISPLAY_LINES,\n },\n { component: this.editor ?? this.createWorkingComponent(), basis: \"auto\", shrink: 1, minSize: 1 },\n { component: this.createFooterComponent(), basis: \"auto\", shrink: 1, minSize: 0 },\n ]);\n this.layoutRoot = new VStack([\n { component: this.scrollView, basis: 0, grow: 1, minSize: 0 },\n { component: dock, basis: \"auto\", shrink: 1, minSize: 1 },\n ]);\n }\n\n get focused(): boolean {\n return this.isFocused;\n }\n\n set focused(value: boolean) {\n this.isFocused = value;\n if (this.editor) this.editor.focused = value;\n }\n\n get signal(): AbortSignal {\n return this.controller.signal;\n }\n\n getFullscreenLayout(): Component {\n return this.layoutRoot;\n }\n\n getPrimaryScrollView(): ScrollView {\n return this.scrollView;\n }\n\n render(width: number): string[] {\n if (width <= 0 || this.tui.terminal.rows <= 0) return [];\n const safeWidth = Math.max(1, width);\n const availableRows = Math.max(1, this.tui.terminal.rows - RESERVED_APP_LINES);\n const editorLines = this.editor?.render(safeWidth) ?? this.renderWorking(safeWidth);\n const contentLines = renderTranscriptLines(this.transcriptComponents, safeWidth);\n this.lastContentLineCount = contentLines.length;\n const footerLines = this.renderFooter(safeWidth);\n const steeringCapacity = Math.max(0, availableRows - editorLines.length - footerLines.length);\n const steeringLines = renderSteeringLines(\n this.options.steering?.questions ?? [],\n safeWidth,\n this.theme,\n Math.min(MAX_STEERING_DISPLAY_LINES, steeringCapacity),\n );\n const viewportHeight = Math.max(0, availableRows - editorLines.length - footerLines.length - steeringLines.length);\n this.scrollView.updateLayout(contentLines.length, viewportHeight, () => this.tui.requestRender());\n\n return fitComposerLayout(\n contentLines.slice(this.scrollView.scrollTop, this.scrollView.scrollTop + viewportHeight),\n this.renderFooter(safeWidth),\n editorLines,\n availableRows,\n steeringLines,\n ).map((line) => truncateToWidth(line, safeWidth));\n }\n\n handleInput(data: string): void {\n if (this.finished) return;\n if (this.pasteGuard.consume(data)) {\n this.editor?.handleEditorInput(data);\n this.tui.requestRender();\n return;\n }\n if (this.shortcuts.matches(data, \"exit\")) {\n this.finished = true;\n this.loader.stop();\n this.controller.abort();\n this.onCancel();\n return;\n }\n const thinking = this.options.steering?.thinking;\n if (thinking && thinking.levels.length > 1 && this.shortcuts.matches(data, \"cycleThinkingLevel\")) {\n const currentIndex = thinking.levels.indexOf(this.thinkingLevel ?? thinking.level);\n const nextLevel = thinking.levels[(currentIndex + 1) % thinking.levels.length];\n if (nextLevel) {\n this.thinkingLevel = nextLevel;\n thinking.onChange(nextLevel);\n this.warning = undefined;\n this.tui.requestRender();\n }\n return;\n }\n if (!handleFallbackPaging(data, this.tui, this.keybindings, this.scrollView)) {\n this.editor?.handleEditorInput(data);\n }\n this.tui.requestRender();\n }\n\n invalidate(): void {\n this.layoutRoot.invalidate();\n }\n\n finish(): void {\n this.finished = true;\n releaseScrollbar(this.scrollView);\n this.loader.stop();\n }\n\n dispose(): void {\n releaseScrollbar(this.scrollView);\n if (this.finished) {\n this.loader.stop();\n this.controller.abort();\n return;\n }\n this.finished = true;\n this.loader.stop();\n this.controller.abort();\n this.onCancel();\n }\n\n private renderFooter(width: number): string[] {\n return renderConversationFooter(width, this.theme, {\n model: this.options.model,\n thinkingLevel: this.thinkingLevel,\n focus: this.workspaceFocus,\n hint: this.renderHints(width),\n warning: this.warning !== undefined,\n });\n }\n\n private renderHints(width: number): string {\n const exit = this.shortcuts.label(\"exit\");\n if (this.warning) return fittingHint(width, [`${this.warning} \u2022 ${exit} cancel`, `Empty \u2022 ${exit}`, exit]);\n const submit = this.editor ? submitHint(this.tui, this.keybindings, \"queue next\") : \"\";\n const thinking = this.options.steering?.thinking;\n const cycle =\n thinking && thinking.levels.length > 1 && this.shortcuts.keys.cycleThinkingLevel.length\n ? `${this.shortcuts.label(\"cycleThinkingLevel\")} thinking`\n : \"\";\n const history = this.getMaxScrollOffset() > 0 ? pagingHint(this.tui, this.keybindings) : \"\";\n const switchPane = this.workspaceFocus?.shortcutLabel ? `${this.workspaceFocus.shortcutLabel} switch` : \"\";\n const submitKey = submit.split(\" \")[0] ?? \"\";\n return fittingHint(width, [\n compactHints([submit, `${exit} cancel`, cycle, history, switchPane]),\n compactHints([submit, exit, cycle, history, switchPane]),\n compactHints([submitKey, exit, cycle, history.replace(/ history$/u, \"\"), switchPane]),\n compactHints([submitKey, exit, history.replace(/ history$/u, \"\")]),\n compactHints([submitKey, exit]),\n exit,\n ]);\n }\n\n private renderWorking(width: number): string[] {\n return [this.loader.renderInBorder(Math.max(0, width))];\n }\n\n private createWorkingComponent(): Component {\n return { render: (width) => this.renderWorking(width), invalidate: () => this.loader.invalidate() };\n }\n\n private createTranscriptComponent(): Component {\n return {\n render: (width) => {\n const lines = renderTranscriptLines(this.transcriptComponents, width, true);\n this.lastContentLineCount = lines.length;\n return lines;\n },\n invalidate: () => {\n for (const component of this.transcriptComponents) component.invalidate();\n },\n };\n }\n\n private createSteeringComponent(): Component {\n return {\n render: (width) =>\n renderSteeringLines(this.options.steering?.questions ?? [], width, this.theme, MAX_STEERING_DISPLAY_LINES),\n invalidate() {},\n };\n }\n\n private createFooterComponent(): Component {\n return {\n render: (width) => this.renderFooter(width),\n invalidate: () => this.loader.invalidate(),\n };\n }\n\n private getMaxScrollOffset(): number {\n return Math.max(0, this.lastContentLineCount - this.scrollView.viewportHeight);\n }\n}\n\nexport function formatSideTranscript(turns: readonly SideTranscriptItem[]): string {\n return turns\n .map((turn) => {\n if (turn.kind === \"mainContext\") return `Main context update\\n\\n${escapeTerminalControls(turn.snapshot.text)}`;\n const question = escapeTerminalControls(turn.question);\n const rawAnswer = escapeTerminalControls(turn.answer);\n const answer = turn.kind === \"error\" ? `Error: ${rawAnswer}` : rawAnswer;\n return `${question}\\n\\n${answer}`;\n })\n .join(\"\\n\\n\");\n}\n\nfunction buildTranscriptComponents(\n turns: readonly SideTranscriptItem[],\n theme: Theme,\n pendingQuestion?: string,\n markdownTransformers: readonly MarkdownTransformer[] = [],\n): Component[] {\n const components = turns.flatMap((turn, index): Component[] => {\n // Pi inserts a spacer before a later user message, outside that message's\n // own Markdown padding. Keep the same separation between side exchanges.\n const preceding = index > 0 ? [new Spacer(1)] : [];\n if (turn.kind === \"mainContext\") {\n const update: Component = {\n render: (width) =>\n new Text(\n theme.fg(\"muted\", `Main context update\\n\\n${escapeTerminalControls(turn.snapshot.text)}`),\n 1,\n 0,\n ).render(width),\n invalidate() {},\n };\n return [...preceding, update];\n }\n const question = new UserMessageComponent(\n escapeTerminalControls(turn.question),\n getMarkdownTheme(),\n 1,\n markdownTransformers,\n );\n if (turn.kind === \"error\") {\n const error: Component = {\n render: (width) =>\n new Text(theme.fg(\"error\", `Error: ${escapeTerminalControls(turn.answer)}`), 1, 0).render(width),\n invalidate() {},\n };\n return [...preceding, question, new Spacer(1), error];\n }\n const response: AssistantMessage = {\n ...turn.response,\n content: [{ type: \"text\", text: escapeTerminalControls(turn.answer) }],\n stopReason: \"stop\",\n errorMessage: undefined,\n };\n return [\n ...preceding,\n question,\n new AssistantMessageComponent(response, true, getMarkdownTheme(), \"\", 1, markdownTransformers),\n ];\n });\n if (pendingQuestion) {\n if (components.length > 0) components.push(new Spacer(1));\n components.push(\n new UserMessageComponent(escapeTerminalControls(pendingQuestion), getMarkdownTheme(), 1, markdownTransformers),\n );\n }\n return components;\n}\n\nfunction renderTranscriptLines(components: readonly Component[], width: number, native = false): string[] {\n return components.flatMap((component) => {\n const lines = component.render(width);\n // Pi adds these exact prefixes outside Markdown. Never trust payload/transformer\n // markers, even when they happen to use the same OSC number.\n const trusted = component instanceof UserMessageComponent || component instanceof AssistantMessageComponent;\n return lines.map((line, index) => {\n let prefix = \"\";\n if (native && trusted) {\n if (index === 0 && line.startsWith(OSC133_MARKERS[0] ?? \"\")) prefix += OSC133_MARKERS[0];\n const end = `${OSC133_MARKERS[1]}${OSC133_MARKERS[2]}`;\n if (index === lines.length - 1 && line.slice(prefix.length).startsWith(end)) prefix += end;\n }\n return prefix + truncateToWidth(stripShellIntegrationMarkers(line), Math.max(0, width), \"\");\n });\n });\n}\n\nfunction fitComposerLayout(\n contentLines: string[],\n footerLines: string[],\n editorLines: string[],\n availableRows: number,\n statusLines: string[] = [],\n): string[] {\n if (availableRows <= 0) return [];\n // Keep the active input first in the row budget, while retaining native\n // conversation order: transcript, pending questions, editor, then footer.\n const editorBudget = Math.min(editorLines.length, availableRows);\n const footerBudget = Math.min(footerLines.length, availableRows - editorBudget);\n const statusBudget = Math.min(statusLines.length, availableRows - editorBudget - footerBudget);\n const transcriptBudget = availableRows - editorBudget - footerBudget - statusBudget;\n return [\n ...contentLines.slice(0, transcriptBudget),\n ...statusLines.slice(0, statusBudget),\n ...fitEditorLines(editorLines, editorBudget),\n ...footerLines.slice(0, footerBudget),\n ];\n}\n\nfunction fitEditorLines(editorLines: string[], budget: number): string[] {\n if (budget <= 0) return [];\n if (editorLines.length <= budget) return editorLines;\n const cursorIndex = editorLines.findIndex((line) => line.includes(CURSOR_MARKER));\n if (cursorIndex < 0) return editorLines.slice(-budget);\n const start = Math.min(cursorIndex, editorLines.length - budget);\n return editorLines.slice(start, start + budget);\n}\n\nfunction renderSteeringLines(questions: readonly string[], width: number, theme: Theme, maxLines: number): string[] {\n if (questions.length === 0 || maxLines <= 0) return [];\n const formatQuestion = (question: string) => sanitizeSingleLine(question) || \"(non-printing message)\";\n if (maxLines === 1 && questions.length > 1) {\n return [\n truncateToWidth(\n theme.fg(\"dim\", ` Steering next (+${questions.length - 1} more): ${formatQuestion(questions[0] ?? \"\")}`),\n width,\n ),\n ];\n }\n const hasOverflow = questions.length > maxLines;\n const questionLimit = hasOverflow ? Math.max(1, maxLines - 1) : maxLines;\n const lines = questions\n .slice(0, questionLimit)\n .map((question) => truncateToWidth(theme.fg(\"dim\", ` Steering next: ${formatQuestion(question)}`), width));\n if (hasOverflow) {\n lines.push(truncateToWidth(theme.fg(\"dim\", ` Steering next: \u2026 +${questions.length - questionLimit} more`), width));\n }\n return lines;\n}\n\nfunction stripShellIntegrationMarkers(line: string): string {\n // biome-ignore lint/suspicious/noControlCharactersInRegex: remove the exact OSC terminal protocol, not printable text.\n return line.replace(/\\u001b\\]133;[^\\u0007\\u001b]*(?:\\u0007|\\u001b\\\\)/gu, \"\");\n}\n\nfunction escapeTerminalControls(text: string): string {\n return [...text]\n .map((character) => {\n if (character === \"\\n\") return character;\n if (character === \"\\t\") return \" \";\n const code = character.charCodeAt(0);\n if (code <= 31 || (code >= 127 && code <= 159)) {\n return `\\\\x${code.toString(16).padStart(2, \"0\")}`;\n }\n return character;\n })\n .join(\"\");\n}\n", "import type { Theme } from \"@earendil-works/pi-coding-agent\";\nimport { Loader, truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport type { BtwThinkingLevel } from \"./side-thread.js\";\nimport { sanitizeSingleLine } from \"./text.js\";\n\n/** Display-only identity, not a model/session runtime or a source of request options. */\nexport interface BtwDisplayModel {\n id: string;\n provider: string;\n}\n\nexport interface BtwWorkspaceFocus {\n pane: \"side\" | \"main\";\n shortcutLabel: string | undefined;\n}\n\n// Pi's status classes are not root exports. Use the public Loader extension\n// points to supply the same border text without importing app-owned handlers.\nexport class BtwWorkingIndicator extends Loader {\n renderInBorder(width: number): string {\n const line = super.render(width + 2)[1] ?? \"\";\n return truncateToWidth(line.startsWith(\" \") ? line.slice(1).trimEnd() : line.trimEnd(), width, \"\");\n }\n\n renderSpinnerInBorder(width: number): string {\n return truncateToWidth(this.getRenderedIndicator(), width, \"\");\n }\n}\n\n/** Native CustomEditor's border geometry, through public Editor/Loader hooks. */\nexport function renderWorkingBorder(\n width: number,\n hiddenLineCount: number,\n borderColor: (text: string) => string,\n status: BtwWorkingIndicator,\n): string | undefined {\n if (width <= 0) return \"\";\n let label = status.renderInBorder(Math.max(1, width - 5));\n let labelWidth = visibleWidth(label);\n if (labelWidth === 0) return undefined;\n const overflow = hiddenLineCount > 0 ? ` \u2191 ${hiddenLineCount} more ` : undefined;\n const overflowWidth = overflow ? visibleWidth(overflow) : 0;\n const overflowStart = Math.floor((width - overflowWidth) / 2);\n const fitsOverflow = () =>\n overflow !== undefined && overflowWidth + 2 <= width && overflowStart - (3 + labelWidth + 1) >= 1;\n if (overflow && !fitsOverflow()) {\n label = status.renderSpinnerInBorder(width);\n labelWidth = visibleWidth(label);\n }\n if (fitsOverflow()) {\n const leftWidth = 3 + labelWidth + 1;\n return (\n borderColor(\"\u2500\u2500 \") +\n label +\n borderColor(\n ` ${\"\u2500\".repeat(overflowStart - leftWidth)}${overflow}${\"\u2500\".repeat(width - overflowStart - overflowWidth)}`,\n )\n );\n }\n if (width >= labelWidth + 5) {\n return borderColor(\"\u2500\u2500 \") + label + borderColor(` ${\"\u2500\".repeat(width - labelWidth - 4)}`);\n }\n label = status.renderSpinnerInBorder(width);\n labelWidth = visibleWidth(label);\n const prefix = Math.min(3, Math.max(0, width - labelWidth));\n return borderColor(\"\u2500\".repeat(prefix)) + label + borderColor(\"\u2500\".repeat(Math.max(0, width - prefix - labelWidth)));\n}\n\nexport function renderConversationFooter(\n width: number,\n theme: Theme,\n options: {\n model?: BtwDisplayModel;\n thinkingLevel?: BtwThinkingLevel;\n focus?: BtwWorkspaceFocus;\n hint: string;\n warning?: boolean;\n },\n): string[] {\n if (width < 3) return [];\n const focus = options.focus ? `${options.focus.pane === \"side\" ? \"BTW\" : \"Main\"} focus` : undefined;\n const left = focus && visibleWidth(`btw \u00B7 ${focus}`) <= width ? `btw \u00B7 ${focus}` : \"btw\";\n const model = options.model ? sanitizeSingleLine(`${options.model.provider}/${options.model.id}`) : \"\";\n const thinking = options.thinkingLevel ? `thinking ${options.thinkingLevel}` : \"\";\n const right = [[model, thinking].filter(Boolean).join(\" \u2022 \"), thinking, model].find(\n (value) => value && visibleWidth(left) + 2 + visibleWidth(value) <= width,\n );\n const identity = right ? `${left}${\" \".repeat(width - visibleWidth(left) - visibleWidth(right))}${right}` : left;\n return [\n theme.fg(\"dim\", identity),\n ...(options.hint ? [theme.fg(options.warning ? \"warning\" : \"muted\", options.hint)] : []),\n ];\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EAGA;AAAA,OACK;AACP;AAAA,EAEE;AAAA,EACA;AAAA,EAGA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA,mBAAAA;AAAA,EACA;AAAA,EACA,gBAAAC;AAAA,OACK;;;ACxBP,SAAS,QAAQ,iBAAiB,oBAAoB;AAiB/C,IAAM,sBAAN,cAAkC,OAAO;AAAA,EAC9C,eAAe,OAAuB;AACpC,UAAM,OAAO,MAAM,OAAO,QAAQ,CAAC,EAAE,CAAC,KAAK;AAC3C,WAAO,gBAAgB,KAAK,WAAW,GAAG,IAAI,KAAK,MAAM,CAAC,EAAE,QAAQ,IAAI,KAAK,QAAQ,GAAG,OAAO,EAAE;AAAA,EACnG;AAAA,EAEA,sBAAsB,OAAuB;AAC3C,WAAO,gBAAgB,KAAK,qBAAqB,GAAG,OAAO,EAAE;AAAA,EAC/D;AACF;AAGO,SAAS,oBACd,OACA,iBACA,aACA,QACoB;AACpB,MAAI,SAAS,EAAG,QAAO;AACvB,MAAI,QAAQ,OAAO,eAAe,KAAK,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