@linxiraos/pi-tui 1.4.4 → 1.4.6

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.
Files changed (116) hide show
  1. package/CHANGELOG.md +29 -27
  2. package/dist/types/app-keybindings.d.ts +5 -0
  3. package/dist/types/chrome/context-map.d.ts +15 -0
  4. package/dist/types/chrome/context-presentation.d.ts +48 -0
  5. package/dist/types/chrome/context-view-model.d.ts +77 -0
  6. package/dist/types/components/image.d.ts +20 -0
  7. package/dist/types/components/loader.d.ts +1 -1
  8. package/dist/types/native/blobs.d.ts +9 -0
  9. package/dist/types/overlays/advisor-config.d.ts +6 -0
  10. package/dist/types/overlays/agent-hub-projection.d.ts +3 -1
  11. package/dist/types/overlays/ask-dialog.d.ts +12 -3
  12. package/dist/types/overlays/btw-history-panel.d.ts +16 -2
  13. package/dist/types/overlays/btw-history.d.ts +7 -0
  14. package/dist/types/overlays/btw-panel.d.ts +2 -0
  15. package/dist/types/overlays/context-viewer-format.d.ts +42 -0
  16. package/dist/types/overlays/context-viewer-overview.d.ts +70 -0
  17. package/dist/types/overlays/context-viewer.d.ts +25 -0
  18. package/dist/types/overlays/hook-input.d.ts +1 -0
  19. package/dist/types/overlays/mcp-add-wizard.d.ts +2 -0
  20. package/dist/types/overlays/pause-screen.d.ts +13 -3
  21. package/dist/types/overlays/running-subagent-badge.d.ts +7 -1
  22. package/dist/types/prompt/macos-spelling.d.ts +2 -2
  23. package/dist/types/render/hyperlink.d.ts +15 -2
  24. package/dist/types/render/output-pane.d.ts +1 -1
  25. package/dist/types/render/render-utils.d.ts +7 -1
  26. package/dist/types/status-line/component.d.ts +2 -2
  27. package/dist/types/status-line/context-usage.d.ts +15 -30
  28. package/dist/types/terminal-capabilities.d.ts +7 -0
  29. package/dist/types/theme/symbols.d.ts +1 -1
  30. package/dist/types/tools/ask.d.ts +4 -0
  31. package/dist/types/tools/edit.d.ts +3 -1
  32. package/dist/types/tools/fetch.d.ts +1 -0
  33. package/dist/types/tools/github.d.ts +3 -0
  34. package/dist/types/tools/grouped-file-output.d.ts +2 -0
  35. package/dist/types/tools/mcp.d.ts +3 -3
  36. package/dist/types/tools/read.d.ts +3 -0
  37. package/dist/types/tools/wait.d.ts +16 -2
  38. package/dist/types/tui.d.ts +2 -0
  39. package/dist/types/vim.d.ts +39 -0
  40. package/package.json +9 -9
  41. package/src/app-keybindings.d.ts +5 -0
  42. package/src/app-keybindings.ts +5 -0
  43. package/src/chat/bash-execution.ts +7 -1
  44. package/src/chat/read-tool-group.ts +1 -2
  45. package/src/chat/skill-message.ts +2 -6
  46. package/src/chrome/context-map.ts +62 -0
  47. package/src/chrome/context-presentation.ts +26 -0
  48. package/src/chrome/context-view-model.ts +73 -0
  49. package/src/chrome/transcript-container.ts +89 -59
  50. package/src/components/editor.ts +455 -13
  51. package/src/components/image.d.ts +20 -0
  52. package/src/components/image.ts +83 -18
  53. package/src/components/loader.d.ts +1 -1
  54. package/src/components/loader.ts +1 -1
  55. package/src/components/markdown.ts +109 -7
  56. package/src/hotkeys-markdown.ts +1 -0
  57. package/src/native/blobs.d.ts +9 -0
  58. package/src/native/blobs.ts +3 -2
  59. package/src/overlays/advisor-config.ts +9 -2
  60. package/src/overlays/agent-hub-projection.d.ts +3 -1
  61. package/src/overlays/agent-hub-projection.ts +6 -5
  62. package/src/overlays/agent-hub.ts +51 -42
  63. package/src/overlays/ask-dialog.ts +125 -35
  64. package/src/overlays/btw-history-panel.ts +124 -12
  65. package/src/overlays/btw-history.ts +11 -0
  66. package/src/overlays/btw-panel.ts +8 -4
  67. package/src/overlays/context-viewer-format.ts +145 -0
  68. package/src/overlays/context-viewer-overview.ts +381 -0
  69. package/src/overlays/context-viewer.ts +728 -0
  70. package/src/overlays/hook-input.ts +2 -0
  71. package/src/overlays/mcp-add-wizard.ts +5 -0
  72. package/src/overlays/pause-screen.ts +166 -33
  73. package/src/overlays/running-subagent-badge.ts +12 -1
  74. package/src/overlays/settings-defs.ts +1 -0
  75. package/src/overlays/usage-dashboard.ts +15 -2
  76. package/src/prompt/macos-spelling.ts +24 -15
  77. package/src/render/hyperlink.d.ts +15 -2
  78. package/src/render/hyperlink.ts +41 -18
  79. package/src/render/output-pane.d.ts +1 -1
  80. package/src/render/output-pane.ts +60 -17
  81. package/src/render/render-utils.d.ts +7 -1
  82. package/src/render/render-utils.ts +11 -2
  83. package/src/setup/scenes/sign-in.ts +6 -0
  84. package/src/status-line/component.ts +6 -4
  85. package/src/status-line/context-usage.ts +56 -582
  86. package/src/terminal-capabilities.d.ts +7 -0
  87. package/src/terminal-capabilities.ts +10 -0
  88. package/src/theme/symbols.d.ts +1 -1
  89. package/src/theme/symbols.ts +16 -0
  90. package/src/tools/ask.d.ts +4 -0
  91. package/src/tools/ask.ts +4 -0
  92. package/src/tools/ast-grep.ts +3 -2
  93. package/src/tools/bash.ts +5 -23
  94. package/src/tools/edit.d.ts +3 -1
  95. package/src/tools/edit.ts +8 -4
  96. package/src/tools/fetch.d.ts +1 -0
  97. package/src/tools/fetch.ts +1 -0
  98. package/src/tools/find.ts +3 -10
  99. package/src/tools/github.d.ts +3 -0
  100. package/src/tools/github.ts +23 -3
  101. package/src/tools/glob.ts +4 -3
  102. package/src/tools/grep.ts +3 -4
  103. package/src/tools/grouped-file-output.d.ts +2 -0
  104. package/src/tools/grouped-file-output.ts +8 -2
  105. package/src/tools/mcp.d.ts +3 -3
  106. package/src/tools/mcp.ts +27 -9
  107. package/src/tools/native-view.ts +2 -2
  108. package/src/tools/read.d.ts +3 -0
  109. package/src/tools/read.ts +3 -1
  110. package/src/tools/vibe.ts +14 -3
  111. package/src/tools/wait.d.ts +16 -2
  112. package/src/tools/wait.ts +16 -2
  113. package/src/tui.d.ts +2 -0
  114. package/src/tui.ts +59 -19
  115. package/src/vim.d.ts +39 -0
  116. package/src/vim.ts +313 -22
package/CHANGELOG.md CHANGED
@@ -1,8 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [1.4.4] - 2026-10-26
3
+ ## [1.4.6] - 2026-10-28
4
4
 
5
- - Released as part of Zeta 1.4.4; no package-specific user-visible changes.
5
+ ### Added
6
+
7
+ - Tools settings now show a SiYuan group for the API switch, URL, and token.
6
8
 
7
9
  ## [9.5.0] - 2026-02-01
8
10
 
@@ -39,10 +41,6 @@
39
41
  - Added mermaid diagram rendering engine (renderMermaidToPng) with mmdc CLI integration
40
42
  - Added terminal graphics encoding (iTerm2/Kitty) for mermaid diagrams with automatic width scaling
41
43
 
42
- ### Changed
43
-
44
- - Updated TypeScript configuration for better publish-time configuration handling with tsconfig.publish.json
45
-
46
44
  ### Fixed
47
45
 
48
46
  - Fixed crash when terminal becomes unavailable (EIO errors) by exiting gracefully instead of throwing
@@ -64,11 +62,6 @@
64
62
  - Added configurable editor padding via `editorPaddingX` theme option
65
63
  - Added `setMaxHeight()` method to limit editor height with scrolling
66
64
  - Added Emacs-style kill ring for text deletion operations
67
- - Added `Alt+D` keybinding to delete words forward
68
- - Added `Ctrl+Y` keybinding to yank from kill ring
69
- - Added `waitForRender()` method to await pending renders
70
- - Added Focusable interface and hardware cursor marker support for IME positioning
71
- - Added support for shifted symbol keys in keybindings
72
65
 
73
66
  ### Changed
74
67
 
@@ -181,17 +174,9 @@
181
174
 
182
175
  Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mono](https://github.com/badlogic/pi-mono).
183
176
 
184
- ## [1.4.3] - 2026-10-25
185
-
186
- - Released as part of Zeta 1.4.3; no package-specific user-visible changes.
177
+ ## [1.4.5] - 2026-10-28
187
178
 
188
- ## [1.4.2] - 2026-10-24
189
-
190
- - Version alignment with the 1.4.2 release line (no behavioral changes).
191
-
192
- ## [1.4.1] - 2026-10-23
193
-
194
- - An attached TUI renders the backend's builtin-command output (`command_output`) in its status line and keeps client-only commands, pickers and mirrored switches local
179
+ - Synced with upstream OMP v18.13.2: `/context` is now a context viewer (overview + detail); the legacy grid renderer is gone.
195
180
 
196
181
  ### Breaking Changes
197
182
 
@@ -201,6 +186,11 @@ Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mon
201
186
 
202
187
  ### Added
203
188
 
189
+ - Added `Alt+D` keybinding to delete words forward
190
+ - Added `Ctrl+Y` keybinding to yank from kill ring
191
+ - Added `waitForRender()` method to await pending renders
192
+ - Added Focusable interface and hardware cursor marker support for IME positioning
193
+ - Added support for shifted symbol keys in keybindings
204
194
  - Added `symbols` property to `EditorTheme`, `MarkdownTheme`, and `SelectListTheme` interfaces for component-level symbol customization
205
195
  - Overlay compositing via `TUI.showOverlay()` and `TUI.hideOverlay()` for `ctx.ui.custom()` with `{ overlay: true }`
206
196
  - Kitty keyboard protocol flag 2 support for key release events (`isKeyRelease()`, `isKeyRepeat()`, `KeyEventType`)
@@ -261,9 +251,11 @@ Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mon
261
251
  - `SettingsListOptions` with `enableSearch` for fuzzy filtering in `SettingsList` ([#643](https://github.com/badlogic/pi-mono/pull/643) by [@ninlds](https://github.com/ninlds))
262
252
  - `Editor.insertTextAtCursor(text)` method for programmatic text insertion ([#419](https://github.com/badlogic/pi-mono/issues/419))
263
253
  - `EditorKeybindingsManager` for configurable editor keybindings. Components now use `matchesKey()` and keybindings manager instead of individual `isXxx()` functions. ([#405](https://github.com/badlogic/pi-mono/pull/405) by [@hjanuschka](https://github.com/hjanuschka))
254
+ - Symbol key support in keybinding system: `SymbolKey` type with 32 symbol keys, `Key` constants (e.g., `Key.backtick`, `Key.comma`), updated `matchesKey()` and `parseKey()` to handle symbol input ([#450](https://github.com/badlogic/pi-mono/pull/450) by [@kaofelix](https://github.com/kaofelix))
264
255
 
265
256
  ### Changed
266
257
 
258
+ - Updated TypeScript configuration for better publish-time configuration handling with tsconfig.publish.json
267
259
  - `UserMessageComponent`'s native hover toolbar (`zeta.user.tools`) leads with Copy and Rewind icon buttons (`copy`, `rewind`) instead of text labels, then a dot and the time, like the turn usage footer
268
260
  - `ContextUsageView`'s native body (on terminals with `meter`) leads with the tokens used and the room left before auto-compaction, then one stacked bar ticked at the threshold, the breakdown as rows (`zeta.context.cat`, `.cat.free`, `.cat.buffer`: swatch, name, tokens, share; the exact count in the row's `title`) and the snapcompact estimate as labelled rows (`zeta.context.snap`); the blocks meter and legend `kv` are gone, and `contextUsageHead` no longer repeats the window size
269
261
  - `AskDialogComponent`'s native root is `zeta.editor.ask` (collapsed: `zeta.editor.ask.hidden`, the countdown, the question as `zeta.ask.summary`, Skip and Show): a chosen answer is the `accent`-toned row (a check also carries the check icon) instead of the highlighted one; multi-select Other… is `zeta.ask.other.check`; the question tabs check answered questions and say their keys in the strip's `title`; the countdown moves from the head to the action bar beside Hide; the preview is `zeta.ask.preview`; the Review tab leads with `zeta.ask.notice` and lists answers (`zeta.ask.answers`) by question name with inline code mono and no `(Recommended)` suffix; option descriptions run inline code mono, notes ride the row's detail as `em`; Submit/Next's tooltip names only Enter (and Space on a multi-select)
@@ -365,6 +357,22 @@ Older entries are archived in [packages/tui/CHANGELOG.md@58141d4e5fa8](https://g
365
357
  - Removed `visibleWidth` benchmark file in favor of Kitty sequence benchmarking
366
358
  - Removed `truncateToWidth`, `sliceWithWidth`, and `extractSegments` functions from public API (now re-exported directly from @linxiraos/pi-natives)
367
359
 
360
+ ## [1.4.4] - 2026-10-26
361
+
362
+ - Released as part of Zeta 1.4.4; no package-specific user-visible changes.
363
+
364
+ ## [1.4.3] - 2026-10-25
365
+
366
+ - Released as part of Zeta 1.4.3; no package-specific user-visible changes.
367
+
368
+ ## [1.4.2] - 2026-10-24
369
+
370
+ - Version alignment with the 1.4.2 release line (no behavioral changes).
371
+
372
+ ## [1.4.1] - 2026-10-23
373
+
374
+ - An attached TUI renders the backend's builtin-command output (`command_output`) in its status line and keeps client-only commands, pickers and mirrored switches local
375
+
368
376
  ## [1.4.0] - 2026-10-21
369
377
 
370
378
  - Added a `zetawork` terminal id that resolves to the Kitty image protocol from the environment alone, so images render in the desktop app's own terminal
@@ -643,12 +651,6 @@ Older entries are archived in [packages/tui/CHANGELOG.md@58141d4e5fa8](https://g
643
651
 
644
652
  - Crash when pasting text with trailing whitespace exceeding terminal width through Markdown rendering ([#457](https://github.com/badlogic/pi-mono/pull/457) by [@robinwander](https://github.com/robinwander))
645
653
 
646
- ## [0.34.1] - 2026-01-04
647
-
648
- ### Added
649
-
650
- - Symbol key support in keybinding system: `SymbolKey` type with 32 symbol keys, `Key` constants (e.g., `Key.backtick`, `Key.comma`), updated `matchesKey()` and `parseKey()` to handle symbol input ([#450](https://github.com/badlogic/pi-mono/pull/450) by [@kaofelix](https://github.com/kaofelix))
651
-
652
654
  ## [0.31.1] - 2026-01-02
653
655
 
654
656
  Older entries are archived in [packages/tui/CHANGELOG.md@fa14205f838f](https://github.com/can1357/oh-my-pi/blob/fa14205f838f282fcea048c64fca74026789a492/packages/tui/CHANGELOG.md).
@@ -20,6 +20,7 @@ interface AppKeybindings {
20
20
  "app.ask.hide": true;
21
21
  "app.approval.approve": true;
22
22
  "app.editor.external": true;
23
+ "app.local.open": true;
23
24
  "app.message.followUp": true;
24
25
  "app.retry": true;
25
26
  "app.message.dequeue": true;
@@ -252,6 +253,10 @@ export declare const KEYBINDINGS: {
252
253
  readonly defaultKeys: "ctrl+g";
253
254
  readonly description: "Open external editor";
254
255
  };
256
+ readonly "app.local.open": {
257
+ readonly defaultKeys: "alt+g";
258
+ readonly description: "Open a local:// file in external editor";
259
+ };
255
260
  readonly "app.message.followUp": {
256
261
  readonly defaultKeys: ["ctrl+q", "ctrl+enter"];
257
262
  readonly description: "Send follow-up message";
@@ -0,0 +1,15 @@
1
+ /** Pure occupancy calculations for contiguous token segments, independent of themes and renderers. */
2
+ export interface ContextMapSegment<T> {
3
+ readonly id: T;
4
+ readonly tokens: number;
5
+ }
6
+ export interface ContextMapCell<T> {
7
+ readonly id: T;
8
+ readonly full: boolean;
9
+ }
10
+ /**
11
+ * Lays `segments` out in order over a `columns` × `rows` grid representing `windowTokens`; each cell takes the
12
+ * segment covering most of it and is `full` at 70% coverage or more. Returns `[]` when the window or grid
13
+ * size is unusable, and omits cells no segment touches.
14
+ */
15
+ export declare function planContextMap<T>(segments: readonly ContextMapSegment<T>[], windowTokens: number, columns: number, rows: number): ContextMapCell<T>[];
@@ -0,0 +1,48 @@
1
+ import type { ContextCategoryId } from "./context-view-model.js";
2
+ export declare const CONTEXT_PRESENTATION: {
3
+ readonly "system-prompt": {
4
+ readonly color: "accent";
5
+ readonly symbol: "context.content";
6
+ };
7
+ readonly skills: {
8
+ readonly color: "success";
9
+ readonly symbol: "context.content";
10
+ };
11
+ readonly "built-in-tools": {
12
+ readonly color: "warning";
13
+ readonly symbol: "context.content";
14
+ };
15
+ readonly "custom-tools": {
16
+ readonly color: "customMessageLabel";
17
+ readonly symbol: "context.content";
18
+ };
19
+ readonly "user-messages": {
20
+ readonly color: "accent";
21
+ readonly symbol: "context.messages";
22
+ };
23
+ readonly "assistant-messages": {
24
+ readonly color: "userMessageText";
25
+ readonly symbol: "context.messages";
26
+ };
27
+ readonly "assistant-thinking": {
28
+ readonly color: "customMessageLabel";
29
+ readonly symbol: "context.content";
30
+ };
31
+ readonly "tool-calls": {
32
+ readonly color: "warning";
33
+ readonly symbol: "context.content";
34
+ };
35
+ readonly "tool-output": {
36
+ readonly color: "muted";
37
+ readonly symbol: "context.messages";
38
+ };
39
+ readonly buffer: {
40
+ readonly color: "warning";
41
+ readonly symbol: "context.buffer";
42
+ };
43
+ readonly free: {
44
+ readonly color: "dim";
45
+ readonly symbol: "context.free";
46
+ };
47
+ };
48
+ export type ContextPresentationId = ContextCategoryId | "buffer" | "free";
@@ -0,0 +1,77 @@
1
+ /** Context snapshot shapes shared by the session snapshot builder and the context viewer. */
2
+ import type { ContextBreakdown } from "../status-line/context-usage.js";
3
+ interface ContextCategoryDescriptor {
4
+ readonly id: string;
5
+ readonly label: string;
6
+ /** Overview row label when the Overview weight differs from the category's content. */
7
+ readonly overviewLabel?: string;
8
+ /** Listed with its weight but never opened. */
9
+ readonly openable?: false;
10
+ }
11
+ /** Context categories in display order. */
12
+ export declare const CONTEXT_CATEGORIES: readonly [{
13
+ readonly id: "system-prompt";
14
+ readonly label: "System Prompt";
15
+ readonly overviewLabel: "System Prompt (excluding Skills)";
16
+ }, {
17
+ readonly id: "skills";
18
+ readonly label: "Skills";
19
+ readonly openable: false;
20
+ }, {
21
+ readonly id: "built-in-tools";
22
+ readonly label: "Built-in Tools";
23
+ }, {
24
+ readonly id: "custom-tools";
25
+ readonly label: "Custom Tools";
26
+ }, {
27
+ readonly id: "user-messages";
28
+ readonly label: "User / Developer Messages";
29
+ }, {
30
+ readonly id: "assistant-messages";
31
+ readonly label: "Assistant Messages";
32
+ }, {
33
+ readonly id: "assistant-thinking";
34
+ readonly label: "Assistant Thinking";
35
+ }, {
36
+ readonly id: "tool-calls";
37
+ readonly label: "Tool Calls";
38
+ }, {
39
+ readonly id: "tool-output";
40
+ readonly label: "Tool Output";
41
+ }];
42
+ export type ContextCategoryId = (typeof CONTEXT_CATEGORIES)[number]["id"];
43
+ /** Descriptor of a category id: its label, optional Overview label, and whether it can be opened. */
44
+ export declare function contextCategoryDescriptor(id: ContextCategoryId): ContextCategoryDescriptor;
45
+ export interface ContextThinkingGroup {
46
+ readonly id: string;
47
+ readonly label: string;
48
+ readonly tokens: number;
49
+ readonly interrupted?: boolean;
50
+ }
51
+ export interface ContextViewEntry {
52
+ readonly id: string;
53
+ readonly label: string;
54
+ readonly text: string;
55
+ /** Aggregation weight for the unscaled replay estimate; shared blocks contribute through their group. */
56
+ readonly tokens: number;
57
+ readonly interrupted?: boolean;
58
+ readonly thinkingGroup?: ContextThinkingGroup;
59
+ readonly path?: string;
60
+ readonly info?: string;
61
+ readonly timestamp?: number;
62
+ readonly callId?: string;
63
+ }
64
+ export interface ContextViewCategory {
65
+ id: ContextCategoryId;
66
+ key?: string;
67
+ label: string;
68
+ /** Overview attribution weight, not reported usage; may differ from the entry sum (e.g. Skills subtraction). */
69
+ tokens: number;
70
+ entries: ContextViewEntry[];
71
+ children?: ContextViewCategory[];
72
+ }
73
+ export interface ContextViewData {
74
+ readonly breakdown: ContextBreakdown;
75
+ readonly categories: readonly ContextViewCategory[];
76
+ }
77
+ export {};
@@ -31,6 +31,21 @@ export interface ImageOptions {
31
31
  * synchronously instead of committing its reserved blank rows.
32
32
  */
33
33
  export declare function renderForScrollback<T>(render: () => T): T;
34
+ /**
35
+ * Run `render` to measure rows outside display order — a newest-first height
36
+ * walk, say. {@link ImageBudget} derives demotion from the order images are
37
+ * observed in, so a budgeted {@link Image} inside this scope claims no display
38
+ * slot: it replays the decision its slot in the surface's last full pass
39
+ * implies. `images` reports whether any budgeted image was observed; the caller
40
+ * MUST render every such block it lays out again, outside this scope and in
41
+ * display order, or its images keep no slot in the pass.
42
+ */
43
+ export declare function measureRender<T>(render: () => T): {
44
+ value: T;
45
+ images: boolean;
46
+ demoted: boolean;
47
+ unresolved: boolean;
48
+ };
34
49
  /** Widest an {@link Image} rendered at `width` columns draws; callers sizing a raster for it (`SvgFigure`) match it. */
35
50
  export declare function imageMaxColumns(width: number): number;
36
51
  /** Default count of inline images kept as live graphics before older ones fall back to text. */
@@ -118,6 +133,11 @@ export declare class ImageBudget {
118
133
  * During a `stable` pass ({@link beginPass}) the call order and visible subset
119
134
  * are not authoritative, so the decision is the surface's committed
120
135
  * on-terminal split, keyed by id — order- and partiality-independent.
136
+ *
137
+ * Inside {@link measureRender} the call claims no slot: it answers what the
138
+ * image's slot in the last full pass implies under the planned threshold,
139
+ * which is what the display-order render that follows will decide once the
140
+ * split has converged.
121
141
  */
122
142
  observe(imageId: number): boolean;
123
143
  /**
@@ -75,6 +75,6 @@ export declare class Loader extends Text {
75
75
  * session title). Re-evaluated every paint; dropped when the row leaves
76
76
  * less than a two-cell gap. */
77
77
  setTrailer(trailer: (() => string | undefined) | undefined): void;
78
- setMessage(message: string): void;
78
+ setMessage(message: string | (() => string)): void;
79
79
  }
80
80
  export {};
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Content-addressed binary blobs (images) for `image` nodes.
3
+ *
4
+ * `describe()` registers the bytes and puts the returned id in `image.p.blob`;
5
+ * the native backend delivers each referenced blob once per terminal
6
+ * connection (asking the terminal first which it holds, or through its blob
7
+ * cache), else uploads it with verb `b` before the frame that first
8
+ * references it.
9
+ */
1
10
  import type { TspProps } from "@linxiraos/pi-wire";
2
11
  import type { NativeChild, NativeNode } from "./node.js";
3
12
  export interface NativeBlob {
@@ -22,8 +22,10 @@ import { type ModelBrowserSource } from "./model-browser.js";
22
22
  import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node.js";
23
23
  export declare const ADVISOR_REVIEW_MODES: readonly ["turn", "agent-end"];
24
24
  export declare const ADVISOR_SYNC_BACKLOG_MODES: readonly ["off", "1", "3", "5", "strict"];
25
+ export declare const ADVISOR_SESSION_SCOPES: readonly ["main", "subagent", "all"];
25
26
  export type AdvisorReviewMode = (typeof ADVISOR_REVIEW_MODES)[number];
26
27
  export type AdvisorSyncBacklog = (typeof ADVISOR_SYNC_BACKLOG_MODES)[number];
28
+ export type AdvisorSessionScope = (typeof ADVISOR_SESSION_SCOPES)[number];
27
29
  /** One advisor declared in `WATCHDOG.yml`; its instructions specialize the shared baseline. */
28
30
  export interface AdvisorConfig {
29
31
  name: string;
@@ -39,6 +41,10 @@ export interface AdvisorConfig {
39
41
  reviewMode?: AdvisorReviewMode;
40
42
  reviewInterval?: number;
41
43
  syncBacklog?: AdvisorSyncBacklog;
44
+ /** Which session kinds this advisor attaches to (`main`, `subagent`, or `all`; defaults to `all`). */
45
+ scope?: AdvisorSessionScope;
46
+ /** Whether primary assistant thinking blocks are included in updates sent to this advisor (defaults to `true`). */
47
+ includeReasoning?: boolean;
42
48
  }
43
49
  /** Which level a `WATCHDOG.yml` lives at: the project root or the user agent dir. */
44
50
  export type AdvisorConfigScope = "project" | "user";
@@ -44,5 +44,7 @@ export declare function aggregateMetrics<TRecord extends AgentRecordLike>(args:
44
44
  hasFallbackLiveSessions: boolean;
45
45
  };
46
46
  /** Parent-before-child projection preserving initial subtree rank and prepending new siblings. */
47
- export declare function projectAgentTree<TRecord extends AgentRecordLike>(refs: readonly TRecord[], rosterRank: ReadonlyMap<TRecord, number> | undefined): AgentTreeProjection<TRecord>;
47
+ export declare function projectAgentTree<TRecord extends AgentRecordLike>(refs: readonly TRecord[],
48
+ /** Rows spawned while the hub is open; such a child never lifts its parent's group. */
49
+ spawnedWhileOpen?: (ref: TRecord) => boolean): AgentTreeProjection<TRecord>;
48
50
  export {};
@@ -31,6 +31,8 @@ export interface ExtensionAskDialogResultItem {
31
31
  customInputImages?: ImageContent[];
32
32
  note?: string;
33
33
  noteImages?: ImageContent[];
34
+ /** Label of the option the note is on; unset when it is on the custom answer. */
35
+ noteOption?: string;
34
36
  timedOut?: boolean;
35
37
  }
36
38
  /** Answers submitted from the dialog. */
@@ -59,14 +61,21 @@ interface AskDialogCallbacks {
59
61
  /** Prompt that accepts pasted images; without it, prompts use `onPrompt`. */
60
62
  onImagePrompt?(prompt: AskDialogPrompt, prefill: AskDialogPromptValue | undefined): Promise<AskDialogPromptValue | undefined>;
61
63
  }
64
+ /**
65
+ * Routes typing to a composer draft that was in progress when the dialog
66
+ * opened, so in-flight keystrokes never answer by accident. The up/down select
67
+ * keys are the explicit hand-off: they release the guard for the rest of the
68
+ * dialog's life and the draft stays parked (intact) beneath it.
69
+ */
62
70
  interface AskDialogInputGuard {
63
71
  isBlocked(): boolean;
64
72
  handleInput(keyData: string): void;
73
+ /** Shown after the release keys while the guard holds input. */
65
74
  hint: string;
66
75
  /** Mirror the guard's blocked state onto the proxied draft surface each
67
76
  * render, so a draft that owns input shows a visible insertion cursor even
68
- * though this dialog holds TUI focus. */
69
- syncPresentation?(): void;
77
+ * though this dialog holds TUI focus, and drops it once the dialog takes over. */
78
+ syncPresentation?(blocked: boolean): void;
70
79
  }
71
80
  interface AskDialogOptions {
72
81
  timeout?: number;
@@ -116,7 +125,7 @@ export declare class AskDialogComponent implements Component {
116
125
  * Pointer actions: a tab click switches to it; a click on an answer row is
117
126
  * Enter on it (Space for a multi-select option, so it toggles; its
118
127
  * double-click `activate` is Enter); the action bar's Submit, Note and Skip
119
- * run exactly what Enter, `n` and Esc run on the highlighted row; Hide/Show
128
+ * run what Enter (see {@link #pressEnter} for Other), `n` and Esc run on the highlighted row; Hide/Show
120
129
  * collapse and restore the dialog.
121
130
  */
122
131
  handleNativeEvent(event: NativeUiEvent): void;
@@ -1,3 +1,4 @@
1
+ import type { ImageContent } from "@linxiraos/pi-ai";
1
2
  import { type Component, type Focusable, Input } from "../index.js";
2
3
  import { type BtwHistoryRecord } from "./btw-history.js";
3
4
  import type { SpaceHoldHandler } from "../space-hold.js";
@@ -9,7 +10,11 @@ interface BtwHistoryPanelOptions {
9
10
  onCopy: (record: BtwHistoryRecord) => void;
10
11
  onCancel: (record: BtwHistoryRecord) => void;
11
12
  canFollowUp?: (record: BtwHistoryRecord) => boolean;
12
- onFollowUp?: (record: BtwHistoryRecord, question: string, signal: AbortSignal) => Promise<boolean>;
13
+ onFollowUp?: (record: BtwHistoryRecord, question: string, signal: AbortSignal, images?: ImageContent[]) => Promise<boolean>;
14
+ /** Read a clipboard image into the follow-up (an empty paste, as terminals send for one). */
15
+ onPasteImage?: () => Promise<unknown>;
16
+ /** Attach an image file whose path was pasted or dropped into the follow-up. */
17
+ onPasteImagePath?: (path: string) => Promise<void>;
13
18
  /** Configured push-to-talk keys for a follow-up composer. */
14
19
  spaceHoldKeys?: readonly KeyId[];
15
20
  spaceHold?: (input: Input) => SpaceHoldHandler;
@@ -37,7 +42,16 @@ export declare class BtwHistoryPanel implements Component, Focusable {
37
42
  showRecord(recordId: string): void;
38
43
  /** Only an active follow-up composer can claim its configured push-to-talk keys. */
39
44
  capturesInput(data: string): boolean;
40
- /** Enhanced clipboard pastes belong only to the active composer. */
45
+ /** False while a follow-up is sent: it already took its images, and the composer clears after. */
46
+ get acceptsImages(): boolean;
47
+ /** Attach an image to the follow-up; returns its `[Image #N, WxH]` marker to paste. */
48
+ attachImage(image: ImageContent, dims?: {
49
+ width: number;
50
+ height: number;
51
+ }): string | undefined;
52
+ /** Reserve ordered delivery for an image paste. Completion delivers its marker once, or releases on undefined. */
53
+ beginPaste(): (text: string | undefined) => boolean;
54
+ /** Enhanced clipboard pastes belong only to the active composer, behind any image still loading. */
41
55
  pasteText(text: string): void;
42
56
  handleInput(data: string): void;
43
57
  /** A large glass sheet (the list beside the reader), palette-sized while there is nothing to list. */
@@ -1,5 +1,8 @@
1
+ import type { ImageContent } from "@linxiraos/pi-ai";
1
2
  export interface BtwHistoryTurn {
2
3
  question: string;
4
+ /** Images attached to the question, sent again with it on later follow-ups. */
5
+ images?: readonly ImageContent[];
3
6
  answer: string;
4
7
  status: "running" | "complete" | "cancelled" | "error" | "interrupted";
5
8
  createdAt: number;
@@ -9,8 +12,12 @@ export interface BtwHistoryTurn {
9
12
  export interface BtwHistoryRecord extends BtwHistoryTurn {
10
13
  id: string;
11
14
  leafId: string | null;
15
+ /** Display heading for the topic, e.g. `/sitrep`; `question` keeps the full text sent to the model. */
16
+ title?: string;
12
17
  followUps?: readonly BtwHistoryTurn[];
13
18
  }
19
+ /** The topic's display heading: its title, else the opening question. */
20
+ export declare function getBtwTopicLabel(record: BtwHistoryRecord): string;
14
21
  export declare function getBtwLatestTurn(record: BtwHistoryRecord): BtwHistoryTurn;
15
22
  export declare function getBtwTurns(record: BtwHistoryRecord): readonly BtwHistoryTurn[];
16
23
  /** Copy the most recent nonblank answer, preserving its original whitespace. */
@@ -3,6 +3,8 @@ import { OverlayPanel } from "../chrome/overlay-box.js";
3
3
  import type { NativeNode } from "../native/node.js";
4
4
  interface BtwPanelComponentOptions {
5
5
  question: string;
6
+ /** Heading shown instead of `/btw <question>`, e.g. `/sitrep the migration` for a side command. */
7
+ title?: string;
6
8
  tui: TUI;
7
9
  canBranch?: () => boolean;
8
10
  canFollowUp?: () => boolean;
@@ -0,0 +1,42 @@
1
+ import type { TspSpan } from "@linxiraos/pi-wire";
2
+ import type { ContextCategoryId, ContextThinkingGroup, ContextViewEntry } from "../chrome/context-view-model.js";
3
+ /** Normalized newlines, control characters removed, tabs expanded. */
4
+ export declare function safeContent(value: string): string;
5
+ /** {@link safeContent} with embedded home paths shortened, for labels and metadata. */
6
+ export declare function safeText(value: string): string;
7
+ /** {@link safeText} collapsed to one row. */
8
+ export declare function safeLine(value: string): string;
9
+ /** Token label of an entry or group: `—` for a grouped entry, `N/A · Interrupted`, else `N token(s)` (unscaled estimate). */
10
+ export declare function tokenEstimate(item: ContextViewEntry | ContextThinkingGroup): string;
11
+ /** `[label] N tokens` as ANSI. */
12
+ export declare function entryHeaderLine(entry: ContextViewEntry, category: ContextCategoryId): string;
13
+ /** `[label] N tokens` as spans. */
14
+ export declare function entryHeaderSpans(entry: ContextViewEntry, category: ContextCategoryId): TspSpan[];
15
+ /** Heading for a shared thinking group: label plus its token estimate. */
16
+ export declare function groupHeaderLine(group: ContextThinkingGroup, category: ContextCategoryId): string;
17
+ /** Truncation marker under a preview; the selected preview also advertises the open key. */
18
+ export declare function previewHint(selected: boolean): string;
19
+ /**
20
+ * Metadata rows: info and path, call id, timestamp. The full-content view also
21
+ * lists the thinking group, which previews show as a shared heading instead.
22
+ */
23
+ export declare function entryMetadata(entry: ContextViewEntry, options: {
24
+ hour12: boolean | undefined;
25
+ withGroup: boolean;
26
+ }): string[];
27
+ /** Preview row budget for a list of `height` rows: room for the entry heading, hint, and group heading. */
28
+ export declare function previewRows(entry: ContextViewEntry, height: number): number;
29
+ export interface EntryPreviewOptions {
30
+ /** Wrap width of preview rows. */
31
+ readonly width: number;
32
+ /** Maximum preview rows. */
33
+ readonly rows: number;
34
+ /** Viewport width; bounds the source read to `sourceWidth × rows × 2` characters before sanitizing and wrapping. */
35
+ readonly sourceWidth: number;
36
+ readonly hour12: boolean | undefined;
37
+ }
38
+ /** Dim metadata rows, then the indented body, cut to `rows`; `complete` is false when anything was omitted. */
39
+ export declare function entryPreview(entry: ContextViewEntry, options: EntryPreviewOptions): {
40
+ lines: string[];
41
+ complete: boolean;
42
+ };
@@ -0,0 +1,70 @@
1
+ import type { TspSpan } from "@linxiraos/pi-wire";
2
+ import type { ContextBreakdown } from "../status-line/context-usage.js";
3
+ import { type ContextMapCell } from "../chrome/context-map.js";
4
+ import { type ContextPresentationId } from "../chrome/context-presentation.js";
5
+ import type { NativeNode } from "../native/node.js";
6
+ import type { ThemeColor } from "../theme/index.js";
7
+ import { type ContextViewCategory, type ContextViewData } from "../chrome/context-view-model.js";
8
+ /** Columns between the map and the legend. */
9
+ export declare const MAP_LEGEND_GAP = 3;
10
+ export interface OverviewRow {
11
+ readonly key: string;
12
+ readonly id: ContextPresentationId;
13
+ readonly label: string;
14
+ /** Attributed usage; undefined when the weights cannot scale current usage. */
15
+ readonly tokens: number | undefined;
16
+ /** Category opened on confirm; undefined rows are listed but not selectable. */
17
+ readonly category?: ContextViewCategory;
18
+ readonly child?: boolean;
19
+ /** Right-aligned token column. */
20
+ readonly tokenColumn: string;
21
+ /** Right-aligned share column, including its leading separator. */
22
+ readonly shareColumn: string;
23
+ }
24
+ export interface MapGeometry {
25
+ readonly columns: number;
26
+ readonly rows: number;
27
+ readonly cellWidth: number;
28
+ readonly gap: string;
29
+ readonly width: number;
30
+ }
31
+ /**
32
+ * Attribute current usage to categories by weight, then each category's share to its children.
33
+ * Attributed values are not entry sums: entries keep their unscaled content/replay estimates.
34
+ * Undefined when the top-level weights cannot scale; unscalable children stay unattributed.
35
+ */
36
+ export declare function allocateUsage(categories: readonly ContextViewCategory[], usage: number): Map<ContextViewCategory, number> | undefined;
37
+ /** Overview row label for a category: its Overview-specific label when the weight differs from its content. */
38
+ export declare function overviewLabel(category: ContextViewCategory): string;
39
+ /** Category and child rows, then buffer and free space, with aligned token and share columns. */
40
+ export declare function buildOverviewRows(data: ContextViewData, allocation: ReadonlyMap<ContextViewCategory, number> | undefined): OverviewRow[];
41
+ /** ANSI legend row: cursor, swatch, label padded to `width`, token and share columns. */
42
+ export declare function legendLine(row: OverviewRow, selected: boolean, width: number): string;
43
+ /** Native legend item; `meterGlyphs` swaps map glyphs for the meter's bar glyphs. */
44
+ export declare function legendItem(row: OverviewRow, selected: boolean, meterGlyphs: boolean, window: number): NativeNode;
45
+ /** Map size beside a legend in a `width` × `height` body; undefined when either would not fit. */
46
+ export declare function mapGeometry(width: number, height: number): MapGeometry | undefined;
47
+ /** Map cells per row, in window order: categories, free space, then buffer. */
48
+ export declare function planMapRows(data: ContextViewData, allocation: ReadonlyMap<ContextViewCategory, number>, geometry: MapGeometry): ContextMapCell<ContextPresentationId>[][];
49
+ /** ANSI map row; partially filled cells are dim. */
50
+ export declare function mapRowLine(cells: readonly ContextMapCell<ContextPresentationId>[], geometry: MapGeometry): string;
51
+ /** Native map row; partially filled cells are dim. */
52
+ export declare function mapRowSpans(cells: readonly ContextMapCell<ContextPresentationId>[], geometry: MapGeometry): TspSpan[];
53
+ /** Snapcompact savings lines of the Overview; empty when no snapcompact setting is on. */
54
+ export declare function contextSnapcompactLines(breakdown: ContextBreakdown): string[];
55
+ interface ContextMeterData extends Pick<ContextBreakdown, "contextWindow" | "usedTokens" | "freeTokens" | "autoCompactBufferTokens" | "thresholdTokens"> {
56
+ categories: readonly {
57
+ label: string;
58
+ tokens: number;
59
+ color: ThemeColor;
60
+ }[];
61
+ }
62
+ /** Shared usage and compaction labels for ANSI and native context views. */
63
+ export declare function contextUsageSummary(breakdown: Pick<ContextBreakdown, "contextWindow" | "usedTokens" | "freeTokens" | "thresholdTokens">): {
64
+ used: string;
65
+ detail: string;
66
+ room: string;
67
+ };
68
+ /** Native usage summary and stacked bar; callers provide the category list. */
69
+ export declare function describeContextMeter(breakdown: ContextMeterData): [NativeNode, NativeNode];
70
+ export {};
@@ -0,0 +1,25 @@
1
+ import type { ContextViewData } from "../chrome/context-view-model.js";
2
+ import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node.js";
3
+ import type { Component } from "../tui.js";
4
+ /**
5
+ * Read-only context snapshot with three states: Overview → category previews → full entry content.
6
+ * Navigation state is shared; `render` (ANSI) and `describe` (native) each draw every state,
7
+ * via `#render<State>` and `#describe<State>` respectively.
8
+ */
9
+ export declare class ContextViewer implements Component {
10
+ #private;
11
+ constructor(data: ContextViewData, options: {
12
+ onClose: () => void;
13
+ requestRender: () => void;
14
+ getRows: () => number;
15
+ });
16
+ invalidate(): void;
17
+ dispose(): void;
18
+ get nativeOverlay(): NonNullable<Component["nativeOverlay"]>;
19
+ /** Capture only handled navigation keys; the focus path consumes other modal input. */
20
+ capturesInput(data: string): boolean;
21
+ handleInput(data: string): void;
22
+ handleNativeEvent(event: NativeUiEvent): void;
23
+ render(width: number): readonly string[];
24
+ describe(cx: DescribeContext): NativeNode;
25
+ }
@@ -8,6 +8,7 @@ export interface HookInputOptions {
8
8
  tui?: TUI;
9
9
  timeout?: number;
10
10
  onTimeout?: () => void;
11
+ secret?: boolean;
11
12
  }
12
13
  export declare class HookInputComponent extends OverlayPanel {
13
14
  #private;
@@ -94,6 +94,8 @@ export declare class MCPAddWizard extends OverlayPanel {
94
94
  * arrows and pressing Enter; the footer's buttons run what their keys run.
95
95
  */
96
96
  handleNativeEvent(event: NativeUiEvent): void;
97
+ /** Route enhanced clipboard text into the active wizard field, never the hidden chat editor. */
98
+ pasteText(text: string): void;
97
99
  handleInput(keyData: string): void;
98
100
  }
99
101
  export {};