@oh-my-pi/pi-tui 18.11.3 → 18.12.0
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 +22 -83
- package/README.md +36 -0
- package/dist/types/render/hanging-wrap.d.ts +2 -0
- package/dist/types/render/render-utils.d.ts +9 -1
- package/dist/types/status-line/types.d.ts +3 -0
- package/dist/types/terminal-capabilities.d.ts +8 -1
- package/dist/types/terminal-multiplexer.d.ts +6 -0
- package/dist/types/theme/theme.d.ts +11 -0
- package/dist/types/tools/ast-edit.d.ts +2 -2
- package/dist/types/tools/ast-grep.d.ts +2 -2
- package/dist/types/tools/edit.d.ts +2 -0
- package/dist/types/tools/find.d.ts +14 -4
- package/dist/types/tools/glob.d.ts +3 -3
- package/dist/types/tools/grep.d.ts +2 -2
- package/dist/types/tools/read.d.ts +13 -5
- package/dist/types/tools/write.d.ts +2 -0
- package/package.json +9 -9
- package/src/chat/assistant-message.ts +3 -1
- package/src/chat/read-tool-group.ts +17 -9
- package/src/chat/tool-execution.ts +23 -6
- package/src/components/image.ts +31 -14
- package/src/render/hanging-wrap.ts +28 -1
- package/src/render/render-utils.ts +16 -2
- package/src/status-line/component.ts +1 -0
- package/src/status-line/segments.ts +4 -3
- package/src/status-line/types.ts +1 -0
- package/src/terminal-capabilities.ts +26 -2
- package/src/terminal-multiplexer.ts +14 -0
- package/src/terminal.ts +11 -2
- package/src/theme/theme.ts +46 -14
- package/src/tmux.ts +7 -1
- package/src/tools/ast-edit.ts +28 -4
- package/src/tools/ast-grep.ts +24 -4
- package/src/tools/debug.ts +2 -1
- package/src/tools/default-renderer.ts +3 -2
- package/src/tools/edit.ts +77 -16
- package/src/tools/find.ts +65 -15
- package/src/tools/glob.ts +51 -17
- package/src/tools/grep.ts +94 -11
- package/src/tools/lsp.ts +23 -18
- package/src/tools/mcp.ts +2 -2
- package/src/tools/read.ts +52 -22
- package/src/tools/task.ts +9 -7
- package/src/tools/web-search.ts +2 -1
- package/src/tools/write.ts +17 -5
- package/src/tools/yield.ts +2 -2
- package/src/tui.ts +36 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [18.12.0] - 2026-10-17
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- `FindStats.errors` is replaced by `failed` (judge requests that failed) and `unanswered` (unusable answers), and `FindToolDetails` requires a `coverage` status; the find renderer shows `N/M requests failed` ([#15744](https://github.com/can1357/oh-my-pi/issues/15744))
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Added `pi.showProfile` to `StatusLineSegmentOptions`: `false` keeps the `pi` segment's bare glyph under a named profile, in the rendered bar and in `describe` ([#16063](https://github.com/can1357/oh-my-pi/pull/16063) by [@shgew](https://github.com/shgew))
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Fixed sessions run inside tmux silently falling back to the terminal's true-color profile when the client terminal-type probe answered slowly on a loaded machine ([#16020](https://github.com/can1357/oh-my-pi/pull/16020) by [@CharleoYang](https://github.com/CharleoYang))
|
|
18
|
+
- Fixed the `read` result notice printing the absolute resolved path, so a file under the home directory reads `Resolved path: ~/notes.txt` instead of `/home/you/notes.txt` ([#16055](https://github.com/can1357/oh-my-pi/pull/16055) by [@adi-IL](https://github.com/adi-IL)).
|
|
19
|
+
- Fixed grep/read previews and other tool cards passing raw escape sequences from file contents to the terminal, which could switch it to the alternate screen with mouse reporting on, live and again on every resume ([#15963](https://github.com/can1357/oh-my-pi/issues/15963))
|
|
20
|
+
- Fixed a final status-line render after shutdown scheduling another usage refresh ([#15845](https://github.com/can1357/oh-my-pi/issues/15845)).
|
|
21
|
+
- Fixed Ctrl+O on LSP status and other plain LSP responses still clipping every row at 80 columns; expanded rows now wrap to show the full text ([#15824](https://github.com/can1357/oh-my-pi/issues/15824))
|
|
22
|
+
- Fixed Ctrl+O leaving long rows clipped in expanded LSP, debug, MCP, web search fallback, yield, task and custom-tool results; expanded rows now wrap to show the full text, expanded LSP references list every location, and the LSP expand hint no longer appears when nothing is hidden ([#15824](https://github.com/can1357/oh-my-pi/issues/15824))
|
|
23
|
+
- Fixed jagged text and disappearing translucent details in SIXEL images, including re-encoding when the terminal reports a changed background color ([#15891](https://github.com/can1357/oh-my-pi/pull/15891) by [@Bouska](https://github.com/Bouska)).
|
|
24
|
+
- Fixed stale SIXEL backgrounds after terminal restarts, native appearance changes, and failed TSP handshakes, including background changes during the handshake, fixed themes, missing or invalid startup themes, or identical light/dark mappings ([#15891](https://github.com/can1357/oh-my-pi/pull/15891) by [@Bouska](https://github.com/Bouska)).
|
|
25
|
+
|
|
5
26
|
## [18.11.3] - 2026-10-16
|
|
6
27
|
|
|
7
28
|
### Added
|
|
@@ -2501,86 +2522,4 @@
|
|
|
2501
2522
|
- Added `getIndentationNoescape` wrapper that uses `process.cwd()` as the project root for relative file paths
|
|
2502
2523
|
- Re-export `getDefaultTabWidth`, `getIndentation`, and `setDefaultTabWidth` from `@oh-my-pi/pi-utils`; native text helpers still receive tab width via wrappers that read the JS default
|
|
2503
2524
|
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
### Added
|
|
2507
|
-
|
|
2508
|
-
- Support for optional SearchDb parameter in CombinedAutocompleteProvider constructor for improved fuzzy search performance
|
|
2509
|
-
- Fuzzy matching filter for autocomplete suggestions to improve relevance of results
|
|
2510
|
-
|
|
2511
|
-
### Changed
|
|
2512
|
-
|
|
2513
|
-
- Fuzzy discovery now applies fuzzy matching filter to results for improved relevance of autocomplete suggestions
|
|
2514
|
-
- Autocomplete fuzzy discovery now accepts optional SearchDb instance for faster searches
|
|
2515
|
-
|
|
2516
|
-
## [13.16.0] - 2026-03-27
|
|
2517
|
-
|
|
2518
|
-
### Changed
|
|
2519
|
-
|
|
2520
|
-
- Updated tab replacement in editor text sanitization to respect configured tab width setting
|
|
2521
|
-
|
|
2522
|
-
## [13.15.0] - 2026-03-23
|
|
2523
|
-
|
|
2524
|
-
### Added
|
|
2525
|
-
|
|
2526
|
-
- Added `renderInlineMarkdown()` function to render inline markdown (bold, italic, code, links, strikethrough) to styled strings
|
|
2527
|
-
|
|
2528
|
-
### Fixed
|
|
2529
|
-
|
|
2530
|
-
- Fixed editor consuming user-rebound copy keys, preventing custom keybindings from working in the editor
|
|
2531
|
-
|
|
2532
|
-
## [13.14.1] - 2026-03-21
|
|
2533
|
-
|
|
2534
|
-
### Added
|
|
2535
|
-
|
|
2536
|
-
- Added Ctrl+_ as an additional default shortcut for undo
|
|
2537
|
-
|
|
2538
|
-
### Fixed
|
|
2539
|
-
|
|
2540
|
-
- Ensured undo functionality respects user-configured keybindings
|
|
2541
|
-
|
|
2542
|
-
## [13.12.0] - 2026-03-14
|
|
2543
|
-
|
|
2544
|
-
### Added
|
|
2545
|
-
|
|
2546
|
-
- Added `moveToMessageStart()` and `moveToMessageEnd()` methods to move cursor to the beginning and end of the entire message
|
|
2547
|
-
|
|
2548
|
-
### Fixed
|
|
2549
|
-
|
|
2550
|
-
- Fixed autocomplete to preserve `./` prefix when completing relative file and directory paths
|
|
2551
|
-
- Fixed paste marker expansion to handle special regex replacement tokens ($1, $2, $&, $$, $`, $') literally in pasted content
|
|
2552
|
-
|
|
2553
|
-
## [13.11.0] - 2026-03-12
|
|
2554
|
-
|
|
2555
|
-
### Fixed
|
|
2556
|
-
|
|
2557
|
-
- Fixed OSC 11 background color detection to correctly handle partial escape sequences that arrive mid-buffer, preventing user input from being swallowed
|
|
2558
|
-
- Fixed race condition where overlapping OSC 11 queries would be incorrectly cancelled by DA1 sentinels from previous queries
|
|
2559
|
-
|
|
2560
|
-
## [13.7.5] - 2026-03-04
|
|
2561
|
-
|
|
2562
|
-
### Changed
|
|
2563
|
-
|
|
2564
|
-
- Extracted word navigation logic into reusable `moveWordLeft` and `moveWordRight` utility functions for consistent cursor movement across components
|
|
2565
|
-
|
|
2566
|
-
## [13.6.2] - 2026-03-03
|
|
2567
|
-
|
|
2568
|
-
### Fixed
|
|
2569
|
-
|
|
2570
|
-
- Fixed cursor positioning when content shrinks to empty without clearOnShrink enabled
|
|
2571
|
-
|
|
2572
|
-
## [13.5.4] - 2026-03-01
|
|
2573
|
-
|
|
2574
|
-
### Fixed
|
|
2575
|
-
|
|
2576
|
-
- Fixed viewport repaint scrollback accounting during resize oscillation to avoid double-scrolling on height shrink and added exact-row scrollback assertions in overlay regression coverage ([#228](https://github.com/can1357/oh-my-pi/issues/228), [#234](https://github.com/can1357/oh-my-pi/issues/234))
|
|
2577
|
-
|
|
2578
|
-
## [13.5.3] - 2026-03-01
|
|
2579
|
-
|
|
2580
|
-
### Fixed
|
|
2581
|
-
|
|
2582
|
-
- Fixed append rendering logic to correctly handle offscreen header changes during content overflow growth, preserving scroll history integrity
|
|
2583
|
-
- Fixed visible tail line updates when appending new content during viewport overflow conditions
|
|
2584
|
-
- Fixed cursor positioning instability when appending content under external cursor relocation by using absolute screen addressing instead of relative cursor movement
|
|
2585
|
-
|
|
2586
|
-
Older entries are archived in [packages/tui/CHANGELOG.md@20c388be2131](https://github.com/can1357/oh-my-pi/blob/20c388be2131e06f731a8759ec3ab6121d6ada1c/packages/tui/CHANGELOG.md).
|
|
2525
|
+
Older entries are archived in [packages/tui/CHANGELOG.md@691b3d448f3d](https://github.com/can1357/oh-my-pi/blob/691b3d448f3da1f99010854dea4a562395fd190d/packages/tui/CHANGELOG.md).
|
package/README.md
CHANGED
|
@@ -38,6 +38,42 @@ tui.addChild(editor);
|
|
|
38
38
|
tui.start();
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
## SIXEL transparency and terminal backgrounds
|
|
42
|
+
|
|
43
|
+
SIXEL has binary transparency, not fractional alpha. omp blends partially
|
|
44
|
+
transparent image pixels against the terminal's reported OSC 11 background
|
|
45
|
+
before quantization, preserving antialiased text and translucent details.
|
|
46
|
+
Images with alpha are resized in premultiplied form before background compositing
|
|
47
|
+
to prevent dark fringes and hidden-color bleed along scaled transparent edges.
|
|
48
|
+
Fully transparent pixels stay transparent. Kitty and iTerm2 retain their
|
|
49
|
+
existing image paths.
|
|
50
|
+
|
|
51
|
+
When a new OSC 11 report changes the background RGB, SIXEL images are
|
|
52
|
+
re-encoded even if the terminal stays dark or stays light. Terminals supporting
|
|
53
|
+
Mode 2031 trigger this automatically. Otherwise, press Ctrl+L to refresh the
|
|
54
|
+
background after changing it. This introduces no periodic polling.
|
|
55
|
+
Direct terminals replay transcript history using the existing theme-change
|
|
56
|
+
repaint policy; multiplexers repaint the viewport without clearing their native
|
|
57
|
+
scrollback.
|
|
58
|
+
|
|
59
|
+
Cached RGB is cleared when terminal ownership starts or ends, so a restarted
|
|
60
|
+
session without an OSC 11 response cannot inherit the previous terminal's RGB.
|
|
61
|
+
If the terminal cannot report its RGB, or an active multiplexer marks background
|
|
62
|
+
queries as unreliable on the current platform, omp approximates the background
|
|
63
|
+
with black for detected dark appearance or white for light. Untrusted reports
|
|
64
|
+
do not override the existing appearance fallback. Exact edge-color matching is
|
|
65
|
+
not guaranteed with that fallback, transparent terminal windows, or graphics
|
|
66
|
+
overlapping a differently colored background.
|
|
67
|
+
|
|
68
|
+
On known-broken background-query paths, such as macOS inside Zellij, native
|
|
69
|
+
appearance changes also repaint SIXEL images when using a fixed theme or
|
|
70
|
+
identical light/dark theme mappings. `COLORFGBG` still takes precedence over the
|
|
71
|
+
native fallback; reports that leave the effective background unchanged do not
|
|
72
|
+
trigger a repaint.
|
|
73
|
+
|
|
74
|
+
If native TSP negotiation fails, the row renderer resumes these SIXEL refreshes.
|
|
75
|
+
Expecting native support alone does not disable repainting after the failure.
|
|
76
|
+
|
|
41
77
|
## Core API
|
|
42
78
|
|
|
43
79
|
### TUI
|
|
@@ -3,3 +3,5 @@ import type { Theme } from "../theme/theme.js";
|
|
|
3
3
|
export declare function wrapPrefixedLine(prefix: string, continuationPrefix: string, content: string, width: number): string[];
|
|
4
4
|
/** Preserve a tree connector's ancestor guides while hanging a long node beneath its label. */
|
|
5
5
|
export declare function wrapTreeLine(line: string, width: number, theme: Theme): string[] | undefined;
|
|
6
|
+
/** Hang a tree row beneath its connector, or a connector-less detail row beneath its guide rails. */
|
|
7
|
+
export declare function wrapGuidedLine(line: string, width: number, theme: Theme): string[];
|
|
@@ -105,14 +105,22 @@ export declare function cappedHeadLines(lines: readonly string[], max: number):
|
|
|
105
105
|
};
|
|
106
106
|
/** Get the first nonblank preview lines, trimmed and width-capped. */
|
|
107
107
|
export declare function getPreviewLines(text: string, maxLines: number, maxLineLen: number, ellipsis?: Ellipsis): string[];
|
|
108
|
+
/** Collapse a possibly multi-line string into one line; whitespace runs (tabs included) become one space. */
|
|
109
|
+
export declare function flattenLine(text: string): string;
|
|
108
110
|
/**
|
|
109
111
|
* Collapse a possibly multi-line string into a single line, then truncate it to
|
|
110
112
|
* `maxWidth` display cells. {@link truncateToWidth} alone caps width but
|
|
111
113
|
* newlines are zero-width, so multi-line content (markdown briefs, tool args,
|
|
112
114
|
* provider errors) would otherwise spill a single status row across several
|
|
113
|
-
* visual lines.
|
|
115
|
+
* visual lines.
|
|
114
116
|
*/
|
|
115
117
|
export declare function previewLine(text: string, maxWidth: number, ellipsis?: Ellipsis): string;
|
|
118
|
+
/**
|
|
119
|
+
* Clip a result row to `maxWidth` only while collapsed. Expanded rows stay whole
|
|
120
|
+
* so the frame wraps them: the expand key ({@link formatExpandHint}) must reveal
|
|
121
|
+
* text, not re-clip it.
|
|
122
|
+
*/
|
|
123
|
+
export declare function clipCollapsed(text: string, maxWidth: number, expanded: boolean | undefined): string;
|
|
116
124
|
/**
|
|
117
125
|
* Extract domain from URL, stripping www. prefix.
|
|
118
126
|
*/
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import type { HangulCompatibilityJamoWidth } from "./utils.js";
|
|
2
2
|
export * from "./terminal-multiplexer.js";
|
|
3
3
|
export { wrapTmuxPassthrough } from "./tmux.js";
|
|
4
|
+
/**
|
|
5
|
+
* Trusted terminal background when reported; otherwise black for detected dark
|
|
6
|
+
* appearance or white for detected light appearance, using theme auto-detection.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTerminalBackgroundColor(): number;
|
|
9
|
+
/** Store an OSC 11 background, or reset to appearance detection (also for tests). */
|
|
10
|
+
export declare function setTerminalBackgroundColor(color: number | undefined): void;
|
|
4
11
|
export declare enum ImageProtocol {
|
|
5
12
|
Kitty = "\u001B_G",
|
|
6
13
|
Iterm2 = "\u001B]1337;File=",
|
|
@@ -393,7 +400,7 @@ export declare function getImageDimensions(base64Data: string, mimeType: string)
|
|
|
393
400
|
* thread; `null` when the encode fails. For output that cannot wait for an
|
|
394
401
|
* off-thread encode.
|
|
395
402
|
*/
|
|
396
|
-
export declare function encodeSixelNow(base64Data: string, widthPx: number, heightPx: number): string | null;
|
|
403
|
+
export declare function encodeSixelNow(base64Data: string, widthPx: number, heightPx: number, backgroundRgb?: number): string | null;
|
|
397
404
|
export declare function renderImage(base64Data: string, imageDimensions: ImageDimensions, options?: ImageRenderOptions): {
|
|
398
405
|
sequence?: string;
|
|
399
406
|
lines?: string[];
|
|
@@ -101,6 +101,12 @@ export declare function hasTerminalMultiplexerSession(multiplexer: TerminalMulti
|
|
|
101
101
|
* order. Nested sessions all appear; TERM is not consulted.
|
|
102
102
|
*/
|
|
103
103
|
export declare function terminalMultiplexerSessions(env?: NodeJS.ProcessEnv): TerminalMultiplexerModule<TerminalMultiplexer>[];
|
|
104
|
+
/**
|
|
105
|
+
* Whether OSC 11 background replies are trusted on this platform. Any active
|
|
106
|
+
* session with `backgroundQueryBrokenOn` matching the platform makes the entire
|
|
107
|
+
* path untrusted; TERM-only classification does not identify an active session.
|
|
108
|
+
*/
|
|
109
|
+
export declare function isTerminalBackgroundQueryTrusted(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): boolean;
|
|
104
110
|
/**
|
|
105
111
|
* The multiplexer TERM names, whether or not its session markers survived.
|
|
106
112
|
* This is classification's TERM fallback; session markers are not consulted.
|
|
@@ -7,6 +7,17 @@ export { isValidThemeColor, type ThemeBg, type ThemeColor } from "./schema.js";
|
|
|
7
7
|
export { getAvailableSymbolPresets, isValidSymbolPreset, type SpinnerType, type SymbolKey, type SymbolPreset, } from "./symbols.js";
|
|
8
8
|
export { Theme } from "./theme-class.js";
|
|
9
9
|
export { createHighlightStream, getEditorTheme, getMarkdownTheme, getMarkdownThemeWithLinkTargets, getSelectListTheme, getSettingsListTheme, getSymbolTheme, highlightCode, setMarkdownMermaidRendering, warmHighlighter, } from "./tui-adapters.js";
|
|
10
|
+
/**
|
|
11
|
+
* Subscribe to native fallback appearance changes independently of theme changes.
|
|
12
|
+
* Consumers must re-check the effective background: COLORFGBG can override it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function onTerminalBackgroundFallbackChange(callback: () => void): () => void;
|
|
15
|
+
/**
|
|
16
|
+
* Detect appearance from trusted OSC 11 reports, then COLORFGBG, then native
|
|
17
|
+
* macOS appearance only on known-broken multiplexer background-query paths.
|
|
18
|
+
* Defaults to dark when none of those signals is available.
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectTerminalBackground(): "dark" | "light";
|
|
10
21
|
/** Active theme; imports remain live across initialization, previews, and theme switches. */
|
|
11
22
|
export declare var theme: Theme;
|
|
12
23
|
type ThemeBinding = (value: Theme) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Component } from "../tui.js";
|
|
2
2
|
import type { Theme } from "../theme/theme.js";
|
|
3
3
|
import type { OutputMeta } from "./output-meta.js";
|
|
4
|
-
import type { NativeToolView, RenderResultOptions } from "./renderer.js";
|
|
4
|
+
import type { NativeToolView, RenderResultContextOptions, RenderResultOptions } from "./renderer.js";
|
|
5
5
|
/** Display metadata returned by ast-edit. */
|
|
6
6
|
export interface AstEditToolDetails {
|
|
7
7
|
totalReplacements: number;
|
|
@@ -47,7 +47,7 @@ export declare const astEditToolRenderer: {
|
|
|
47
47
|
}>;
|
|
48
48
|
details?: AstEditToolDetails;
|
|
49
49
|
isError?: boolean;
|
|
50
|
-
}, options:
|
|
50
|
+
}, options: RenderResultContextOptions, uiTheme: Theme, args?: AstEditRenderArgs): Component;
|
|
51
51
|
describeCall(args: AstEditRenderArgs): NativeToolView;
|
|
52
52
|
describeResult(result: {
|
|
53
53
|
content: Array<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Component } from "../tui.js";
|
|
2
2
|
import type { Theme } from "../theme/theme.js";
|
|
3
3
|
import type { OutputMeta } from "./output-meta.js";
|
|
4
|
-
import type { NativeToolView, RenderResultOptions } from "./renderer.js";
|
|
4
|
+
import type { NativeToolView, RenderResultContextOptions, RenderResultOptions } from "./renderer.js";
|
|
5
5
|
/** Display metadata returned by ast-grep. */
|
|
6
6
|
export interface AstGrepToolDetails {
|
|
7
7
|
matchCount: number;
|
|
@@ -46,7 +46,7 @@ export declare const astGrepToolRenderer: {
|
|
|
46
46
|
}>;
|
|
47
47
|
details?: AstGrepToolDetails;
|
|
48
48
|
isError?: boolean;
|
|
49
|
-
}, options:
|
|
49
|
+
}, options: RenderResultContextOptions, uiTheme: Theme, args?: AstGrepRenderArgs): Component;
|
|
50
50
|
describeCall(args: AstGrepRenderArgs): NativeToolView;
|
|
51
51
|
describeResult(result: {
|
|
52
52
|
content: Array<{
|
|
@@ -133,6 +133,8 @@ export interface EditRenderContext {
|
|
|
133
133
|
renderDiff?: (diffText: string, options?: {
|
|
134
134
|
filePath?: string;
|
|
135
135
|
}) => string;
|
|
136
|
+
/** Unsanitized result metadata, used only for filesystem link targets. */
|
|
137
|
+
rawDetails?: unknown;
|
|
136
138
|
}
|
|
137
139
|
/** Render replacement text until a computed diff preview is available. */
|
|
138
140
|
export declare function renderStreamingFallback(editMode: EditMode, args: unknown, theme: Theme): string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Theme } from "../theme/theme.js";
|
|
2
2
|
import type { Component } from "../tui.js";
|
|
3
3
|
import type { OutputMeta } from "./output-meta.js";
|
|
4
|
-
import type { NativeToolView, RenderResultOptions } from "./renderer.js";
|
|
4
|
+
import type { NativeToolView, RenderResultContextOptions, RenderResultOptions } from "./renderer.js";
|
|
5
5
|
/** A verified line range with its yes-probability and a one-line preview. */
|
|
6
6
|
export interface FindRange {
|
|
7
7
|
start: number;
|
|
@@ -22,12 +22,21 @@ export interface FindHit {
|
|
|
22
22
|
linesSeen: number;
|
|
23
23
|
truncated: boolean;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* How much of a search the judge actually covered. `unavailable`: every judge
|
|
27
|
+
* request failed, so an empty result is not evidence of absence. `partial`:
|
|
28
|
+
* some requests failed. `complete`: none failed (or none were needed).
|
|
29
|
+
*/
|
|
30
|
+
export type FindCoverage = "complete" | "partial" | "unavailable";
|
|
25
31
|
/** Search accounting reported alongside the hits. */
|
|
26
32
|
export interface FindStats {
|
|
27
33
|
/** Eligible files under the root. */
|
|
28
34
|
listed: number;
|
|
29
35
|
requests: number;
|
|
30
|
-
|
|
36
|
+
/** Judge requests that failed outright; decides {@link FindCoverage}. */
|
|
37
|
+
failed: number;
|
|
38
|
+
/** Questions a successful response left without a usable answer. */
|
|
39
|
+
unanswered: number;
|
|
31
40
|
/** Entries judged by name. */
|
|
32
41
|
judged: number;
|
|
33
42
|
/** Files whose content was read and sent. */
|
|
@@ -51,6 +60,7 @@ export interface FindToolDetails {
|
|
|
51
60
|
/** Verified-passage probability at or above which a file is a hit. */
|
|
52
61
|
threshold: number;
|
|
53
62
|
hits: FindHit[];
|
|
63
|
+
coverage: FindCoverage;
|
|
54
64
|
stats: FindStats;
|
|
55
65
|
elapsedMs: number;
|
|
56
66
|
/** Session cwd; hit paths are relative to it. */
|
|
@@ -74,7 +84,7 @@ export declare const findToolRenderer: {
|
|
|
74
84
|
}>;
|
|
75
85
|
details?: FindToolDetails;
|
|
76
86
|
isError?: boolean;
|
|
77
|
-
}, options:
|
|
87
|
+
}, options: RenderResultContextOptions, uiTheme: Theme, args?: FindRenderArgs): Component;
|
|
78
88
|
describeCall(args: FindRenderArgs): NativeToolView;
|
|
79
89
|
/**
|
|
80
90
|
* Inline (§7.3 find): `Find “query” 2 hits · 8 files`, then per hit its
|
|
@@ -88,7 +98,7 @@ export declare const findToolRenderer: {
|
|
|
88
98
|
}>;
|
|
89
99
|
details?: FindToolDetails;
|
|
90
100
|
isError?: boolean;
|
|
91
|
-
}, options:
|
|
101
|
+
}, options: RenderResultContextOptions, args?: FindRenderArgs): NativeToolView;
|
|
92
102
|
mergeCallAndResult: true;
|
|
93
103
|
animatedPendingPreview: true;
|
|
94
104
|
animatedPartialResult: true;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from "../tui.js";
|
|
2
|
-
import type { NativeToolView, RenderResultOptions } from "./renderer.js";
|
|
2
|
+
import type { NativeToolView, RenderResultContextOptions, RenderResultOptions } from "./renderer.js";
|
|
3
3
|
import { type Theme } from "../theme/theme.js";
|
|
4
4
|
import type { OutputMeta } from "./output-meta.js";
|
|
5
5
|
import type { TruncationResult } from "./streaming-output.js";
|
|
@@ -42,7 +42,7 @@ export declare const globToolRenderer: {
|
|
|
42
42
|
}>;
|
|
43
43
|
details?: GlobToolDetails;
|
|
44
44
|
isError?: boolean;
|
|
45
|
-
}, options:
|
|
45
|
+
}, options: RenderResultContextOptions, uiTheme: Theme, args?: GlobRenderArgs): Component;
|
|
46
46
|
describeCall(args: GlobRenderArgs): NativeToolView;
|
|
47
47
|
/**
|
|
48
48
|
* Inline (§7.3 glob): `Glob “pattern” 5 files`, then the files as rows
|
|
@@ -55,7 +55,7 @@ export declare const globToolRenderer: {
|
|
|
55
55
|
}>;
|
|
56
56
|
details?: GlobToolDetails;
|
|
57
57
|
isError?: boolean;
|
|
58
|
-
},
|
|
58
|
+
}, options: RenderResultContextOptions, args?: GlobRenderArgs): NativeToolView;
|
|
59
59
|
mergeCallAndResult: true;
|
|
60
60
|
};
|
|
61
61
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Component } from "../tui.js";
|
|
2
|
-
import type { NativeToolView, RenderResultOptions } from "./renderer.js";
|
|
2
|
+
import type { NativeToolView, RenderResultContextOptions, RenderResultOptions } from "./renderer.js";
|
|
3
3
|
import { type Theme } from "../theme/theme.js";
|
|
4
4
|
import type { OutputMeta } from "./output-meta.js";
|
|
5
5
|
import type { TruncationResult } from "./streaming-output.js";
|
|
@@ -58,7 +58,7 @@ export declare const grepToolRenderer: {
|
|
|
58
58
|
}>;
|
|
59
59
|
details?: GrepToolDetails;
|
|
60
60
|
isError?: boolean;
|
|
61
|
-
}, options:
|
|
61
|
+
}, options: RenderResultContextOptions, uiTheme: Theme, args?: GrepRenderArgs): Component;
|
|
62
62
|
describeCall(args: GrepRenderArgs): NativeToolView;
|
|
63
63
|
/**
|
|
64
64
|
* Inline (§7.3 grep): `Grep “pattern” 5 matches · 2 files in src`, then
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SummaryResult } from "@oh-my-pi/pi-natives";
|
|
2
2
|
import type { Component } from "../tui.js";
|
|
3
|
-
import type { NativeToolView, RenderResultOptions, ToolActivityContext, ToolActivitySummary } from "./renderer.js";
|
|
3
|
+
import type { RenderResultContextOptions, NativeToolView, RenderResultOptions, ToolActivityContext, ToolActivitySummary } from "./renderer.js";
|
|
4
4
|
import type { NativeNode } from "../native/node.js";
|
|
5
5
|
import type { Theme } from "../theme/theme.js";
|
|
6
6
|
import type { OutputMeta } from "./output-meta.js";
|
|
@@ -40,6 +40,11 @@ export interface ReadToolDetails {
|
|
|
40
40
|
fileSize?: number;
|
|
41
41
|
/** Full source line count when the read reached EOF and the count is exact. */
|
|
42
42
|
totalLines?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Whether the text's rows carry line-number prefixes (`N:` hashline, `N|` line numbers). Set where a
|
|
45
|
+
* file read is formatted; a raw read sets `false`. Snapcompact reads it to tell a `12:` prefix from content.
|
|
46
|
+
*/
|
|
47
|
+
rowPrefixes?: boolean;
|
|
43
48
|
/** Raw text + start line for user-visible TUI rendering, set when content is text-like.
|
|
44
49
|
* Mirrors the same lines the model receives but without hashline/line-number prefixes,
|
|
45
50
|
* so the TUI can render the file content with its own gutter without re-parsing the formatted text. */
|
|
@@ -55,7 +60,10 @@ export interface ReadToolDetails {
|
|
|
55
60
|
};
|
|
56
61
|
/** Number of unresolved git conflicts surfaced by this read (TUI uses for inline `⚠ N` badge). */
|
|
57
62
|
conflictCount?: number;
|
|
58
|
-
/**
|
|
63
|
+
/**
|
|
64
|
+
* Paths recovered from a delimited read argument. The TUI renders one call as multiple read rows; snapcompact
|
|
65
|
+
* keeps such a composite result as text.
|
|
66
|
+
*/
|
|
59
67
|
displayReadTargets?: string[];
|
|
60
68
|
/**
|
|
61
69
|
* Resolved filesystem link target for each {@link displayReadTargets} entry, aligned by index; `null` when a
|
|
@@ -113,7 +121,7 @@ export declare function pendingFileLinkPath(inputPath: string): string;
|
|
|
113
121
|
* target when the structured `resolvedPath` isn't set (the common plain-file and
|
|
114
122
|
* image reads only record the path in `meta.source`). URL/internal sources are
|
|
115
123
|
* not fs paths, so only `type: "path"` qualifies. */
|
|
116
|
-
export declare function readSourceFsPath(details:
|
|
124
|
+
export declare function readSourceFsPath(details: unknown): string | undefined;
|
|
117
125
|
/**
|
|
118
126
|
* Whether a read result renders as a Markdown preview rather than numbered source:
|
|
119
127
|
* the read tool tagged it `text/markdown` (`read.renderMarkdown`, or a protocol
|
|
@@ -140,7 +148,7 @@ export declare const readToolRenderer: {
|
|
|
140
148
|
}>;
|
|
141
149
|
details?: ReadToolDetails;
|
|
142
150
|
isError?: boolean;
|
|
143
|
-
}, options:
|
|
151
|
+
}, options: RenderResultContextOptions, uiTheme: Theme, args?: ReadRenderArgs): Component;
|
|
144
152
|
describeCall(args: ReadRenderArgs): NativeToolView;
|
|
145
153
|
/**
|
|
146
154
|
* Inline (§7.3 read): the head names the file and range; the content
|
|
@@ -154,7 +162,7 @@ export declare const readToolRenderer: {
|
|
|
154
162
|
}>;
|
|
155
163
|
details?: ReadToolDetails;
|
|
156
164
|
isError?: boolean;
|
|
157
|
-
}, options:
|
|
165
|
+
}, options: RenderResultContextOptions, args?: ReadRenderArgs): NativeToolView;
|
|
158
166
|
mergeCallAndResult: true;
|
|
159
167
|
};
|
|
160
168
|
/** Inclusive line range describing one elided span in a structural summary. */
|
|
@@ -73,6 +73,8 @@ interface WriteStreamingPreviewStateCarrier {
|
|
|
73
73
|
/** Render context for the write tool: resolves an `xd://`-mounted tool so its live renderer drives device dispatch previews. */
|
|
74
74
|
export interface WriteRenderContext {
|
|
75
75
|
resolveXdevMounted?: (name: string) => XdevMountedRenderer | undefined;
|
|
76
|
+
/** Original result metadata used only for filesystem link targets. */
|
|
77
|
+
rawDetails?: unknown;
|
|
76
78
|
}
|
|
77
79
|
/** Render file writes and delegated tool-device calls. */
|
|
78
80
|
export declare const writeToolRenderer: {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-tui",
|
|
4
|
-
"version": "18.
|
|
4
|
+
"version": "18.12.0",
|
|
5
5
|
"description": "Terminal User Interface library with differential rendering for efficient text-based applications",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": {
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"gen:glyphs": "bun scripts/gen-glyphs.ts"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@oh-my-pi/omptype": "18.
|
|
45
|
-
"@oh-my-pi/pi-agent-core": "18.
|
|
46
|
-
"@oh-my-pi/pi-ai": "18.
|
|
47
|
-
"@oh-my-pi/pi-catalog": "18.
|
|
48
|
-
"@oh-my-pi/pi-natives": "18.
|
|
49
|
-
"@oh-my-pi/pi-utils": "18.
|
|
50
|
-
"@oh-my-pi/pi-wire": "18.
|
|
51
|
-
"@oh-my-pi/snapcompact": "18.
|
|
44
|
+
"@oh-my-pi/omptype": "18.12.0",
|
|
45
|
+
"@oh-my-pi/pi-agent-core": "18.12.0",
|
|
46
|
+
"@oh-my-pi/pi-ai": "18.12.0",
|
|
47
|
+
"@oh-my-pi/pi-catalog": "18.12.0",
|
|
48
|
+
"@oh-my-pi/pi-natives": "18.12.0",
|
|
49
|
+
"@oh-my-pi/pi-utils": "18.12.0",
|
|
50
|
+
"@oh-my-pi/pi-wire": "18.12.0",
|
|
51
|
+
"@oh-my-pi/snapcompact": "18.12.0"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"kitty-vt-wasm": "^0.2.0"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AssistantMessage, ImageContent, TextContent } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import { presentNarrationAsAnswer } from "@oh-my-pi/pi-ai/utils/narration";
|
|
2
3
|
import { type Component, Container } from "../tui";
|
|
3
4
|
import { Image, type ImageBudget } from "../components/image";
|
|
4
5
|
import { ImageProtocol, TERMINAL } from "../terminal-capabilities";
|
|
@@ -1803,7 +1804,8 @@ export class AssistantMessageComponent extends Container {
|
|
|
1803
1804
|
this.#lastUpdateTransient = opts?.transient === true;
|
|
1804
1805
|
// Everything below renders the display form; #lastMessage keeps the
|
|
1805
1806
|
// verbatim message so re-renders re-derive the reaction deterministically.
|
|
1806
|
-
|
|
1807
|
+
// Narration the provider returned as thinking renders as answer text.
|
|
1808
|
+
message = this.#displayMessage(presentNarrationAsAnswer(message), this.#lastUpdateTransient);
|
|
1807
1809
|
this.#displayedMessage = message;
|
|
1808
1810
|
|
|
1809
1811
|
// Streaming-speed gauge: only a live, in-flight render of the single
|
|
@@ -22,7 +22,7 @@ import { canonicalizeMessage } from "./thinking-display";
|
|
|
22
22
|
import { internalUrlSchemeSpec, splitUrlScheme } from "../tools/url-scheme-host";
|
|
23
23
|
import type { ToolExecutionHandle } from "./tool-execution";
|
|
24
24
|
import { formatUsageRow } from "../overlays/usage-row";
|
|
25
|
-
import { formatCount } from "@oh-my-pi/pi-utils";
|
|
25
|
+
import { formatCount, sanitizeText, sanitizeTextDeep } from "@oh-my-pi/pi-utils";
|
|
26
26
|
import type { TspCardStatus, TspSpan, TspText } from "@oh-my-pi/pi-wire";
|
|
27
27
|
import type { NativeToolHead } from "../tools/renderer";
|
|
28
28
|
import { card, code, keyed, md, node, span, text, withHidden } from "../native/describe";
|
|
@@ -188,9 +188,12 @@ const READ_STATUS_RANK: Record<ReadEntry["status"], number> = {
|
|
|
188
188
|
error: 3,
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
function getDisplayReadTargets(
|
|
191
|
+
function getDisplayReadTargets(
|
|
192
|
+
details: ReadToolDetails | undefined,
|
|
193
|
+
rawDetails: ReadToolDetails | undefined,
|
|
194
|
+
): ReadDisplayPathSpec[] | undefined {
|
|
192
195
|
if (!Array.isArray(details?.displayReadTargets)) return undefined;
|
|
193
|
-
const links = Array.isArray(
|
|
196
|
+
const links = Array.isArray(rawDetails?.displayReadTargetLinks) ? rawDetails.displayReadTargetLinks : undefined;
|
|
194
197
|
const targets: ReadDisplayPathSpec[] = [];
|
|
195
198
|
details.displayReadTargets.forEach((raw, index) => {
|
|
196
199
|
if (typeof raw !== "string") return;
|
|
@@ -437,12 +440,14 @@ export class ReadToolGroupComponent extends Container implements ToolExecutionHa
|
|
|
437
440
|
if (!toolCallId) return;
|
|
438
441
|
const rawPath =
|
|
439
442
|
typeof args.file_path === "string" ? args.file_path : typeof args.path === "string" ? args.path : "";
|
|
443
|
+
const displayPath = sanitizeText(rawPath);
|
|
440
444
|
const entry: ReadEntry = this.#entries.get(toolCallId) ?? {
|
|
441
445
|
toolCallId,
|
|
442
|
-
path:
|
|
446
|
+
path: displayPath,
|
|
443
447
|
status: "pending",
|
|
444
448
|
};
|
|
445
|
-
entry.path =
|
|
449
|
+
entry.path = displayPath;
|
|
450
|
+
entry.linkPath = path.isAbsolute(rawPath) ? rawPath : undefined;
|
|
446
451
|
entry.raw = args.raw === true;
|
|
447
452
|
this.#entries.set(toolCallId, entry);
|
|
448
453
|
this.#updateDisplay();
|
|
@@ -484,12 +489,15 @@ export class ReadToolGroupComponent extends Container implements ToolExecutionHa
|
|
|
484
489
|
if (!entry) return;
|
|
485
490
|
if (isPartial) return;
|
|
486
491
|
this.#blockVersion++;
|
|
487
|
-
|
|
492
|
+
// `details` can contain raw file text and filesystem paths. Keep the
|
|
493
|
+
// latter for links while only the sanitized copy supplies display labels.
|
|
494
|
+
const rawDetails = result.details as ReadToolDetails | undefined;
|
|
495
|
+
const details = sanitizeTextDeep(rawDetails) as ReadToolDetails | undefined;
|
|
488
496
|
const suffixResolution = getSuffixResolution(details);
|
|
489
|
-
const displayPaths = getDisplayReadTargets(details);
|
|
490
|
-
entry.linkPath = readResultLinkPath(
|
|
497
|
+
const displayPaths = getDisplayReadTargets(details, rawDetails);
|
|
498
|
+
entry.linkPath = readResultLinkPath(rawDetails) ?? entry.linkPath;
|
|
491
499
|
if (suffixResolution) {
|
|
492
|
-
entry.path = displayPathWithSuffixResolution(entry.path, suffixResolution);
|
|
500
|
+
entry.path = sanitizeText(displayPathWithSuffixResolution(entry.path, suffixResolution));
|
|
493
501
|
entry.correctedFrom = suffixResolution.from;
|
|
494
502
|
entry.displayPaths = undefined;
|
|
495
503
|
} else {
|