@linxiraos/pi-tui 1.4.13 → 1.5.1
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 +33 -34
- package/dist/types/chat/messages.d.ts +2 -0
- package/dist/types/chat/spotlight.d.ts +8 -3
- package/dist/types/chat/transcript-render-helpers.d.ts +5 -0
- package/dist/types/components/editor.d.ts +4 -1
- package/dist/types/html-form/data.d.ts +56 -0
- package/dist/types/html-form/dialog.d.ts +51 -0
- package/dist/types/html-form/media.d.ts +28 -0
- package/dist/types/html-form/paginate.d.ts +43 -0
- package/dist/types/html-form/parse.d.ts +99 -0
- package/dist/types/overlays/ask-dialog.d.ts +11 -6
- package/dist/types/overlays/copy-targets.d.ts +8 -6
- package/dist/types/overlays/directory-picker.d.ts +62 -0
- package/dist/types/overlays/hook-editor.d.ts +3 -1
- package/dist/types/overlays/hub-frame.d.ts +2 -0
- package/dist/types/overlays/model-hub.d.ts +2 -0
- package/dist/types/overlays/team-hub.d.ts +150 -0
- package/dist/types/render/row-moves.d.ts +41 -0
- package/dist/types/status-line/component.d.ts +5 -0
- package/dist/types/status-line/host.d.ts +2 -2
- package/dist/types/status-line/schema.d.ts +1 -1
- package/dist/types/status-line/types.d.ts +8 -0
- package/dist/types/tools/ask.d.ts +11 -49
- package/dist/types/tools/autoresearch.d.ts +2 -2
- package/dist/types/tools/eval.d.ts +4 -0
- package/dist/types/tools/grouped-file-output.d.ts +2 -0
- package/dist/types/tools/shell-viz.d.ts +6 -2
- package/dist/types/tools/xd-url.d.ts +6 -0
- package/dist/types/windows-input-mode.d.ts +8 -0
- package/package.json +9 -9
- package/src/charts/table-data.ts +18 -5
- package/src/chat/chat-transcript-builder.ts +27 -10
- package/src/chat/image-loading.ts +55 -0
- package/src/chat/messages.d.ts +2 -0
- package/src/chat/messages.ts +3 -0
- package/src/chat/spotlight.d.ts +8 -3
- package/src/chat/spotlight.ts +23 -11
- package/src/chat/tool-execution.ts +5 -0
- package/src/chat/transcript-render-helpers.d.ts +5 -0
- package/src/chat/transcript-render-helpers.ts +13 -0
- package/src/chrome/transcript-container.ts +1 -1
- package/src/components/editor.d.ts +4 -1
- package/src/components/editor.ts +3 -2
- package/src/components/markdown.ts +70 -12
- package/src/html-form/data.d.ts +56 -0
- package/src/html-form/data.ts +177 -0
- package/src/html-form/dialog.ts +1450 -0
- package/src/html-form/media.ts +105 -0
- package/src/html-form/paginate.ts +99 -0
- package/src/html-form/parse.d.ts +99 -0
- package/src/html-form/parse.ts +568 -0
- package/src/lang-from-path.ts +1 -0
- package/src/latex-block.ts +3 -3
- package/src/latex-to-unicode.ts +18 -5
- package/src/overlays/ask-dialog.ts +69 -52
- package/src/overlays/copy-targets.d.ts +8 -6
- package/src/overlays/copy-targets.ts +25 -46
- package/src/overlays/directory-picker.ts +387 -0
- package/src/overlays/hook-editor.ts +16 -15
- package/src/overlays/hub-frame.ts +8 -1
- package/src/overlays/model-hub.ts +12 -2
- package/src/overlays/spotlight-sheet.ts +18 -18
- package/src/overlays/team-hub.ts +901 -0
- package/src/render/row-moves.d.ts +41 -0
- package/src/render/row-moves.ts +109 -0
- package/src/setup/wizard-overlay.ts +7 -3
- package/src/status-line/component.ts +19 -0
- package/src/status-line/footer.ts +2 -2
- package/src/status-line/host.ts +2 -2
- package/src/status-line/presets.ts +6 -6
- package/src/status-line/schema.ts +2 -1
- package/src/status-line/segments.ts +31 -4
- package/src/status-line/startup.ts +1 -1
- package/src/status-line/types.ts +8 -0
- package/src/stdin-buffer.ts +15 -1
- package/src/terminal-capabilities.ts +12 -3
- package/src/terminal.ts +41 -3
- package/src/tools/ask.d.ts +11 -49
- package/src/tools/ask.ts +201 -606
- package/src/tools/autoresearch.ts +2 -2
- package/src/tools/debug.ts +31 -38
- package/src/tools/eval.d.ts +4 -0
- package/src/tools/eval.ts +4 -0
- package/src/tools/grep.ts +38 -16
- package/src/tools/grouped-file-output.d.ts +2 -0
- package/src/tools/grouped-file-output.ts +5 -0
- package/src/tools/shell-viz-render.ts +37 -6
- package/src/tools/shell-viz.d.ts +6 -2
- package/src/tools/shell-viz.ts +19 -6
- package/src/tools/xd-url.d.ts +6 -0
- package/src/tools/xd-url.ts +19 -1
- package/src/tui.ts +129 -1
- package/src/windows-input-mode.d.ts +8 -0
- package/src/windows-input-mode.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
-
## [1.
|
|
4
|
-
|
|
5
|
-
- Released as part of Zeta 1.4.13.
|
|
6
|
-
|
|
7
|
-
## [9.4.0] - 2026-01-31
|
|
3
|
+
## [1.5.1] - 2026-11-10
|
|
8
4
|
|
|
9
5
|
### Added
|
|
10
6
|
|
|
11
|
-
-
|
|
7
|
+
- `/channels` opens the IM operator surface in the TUI: list configured channels and their live health (`state`, `detail`, `lastError`, `since`, `lastInboundAt`), run `login`/`status`/`logout`/`unbind`, and take a per-channel pairing lock so two processes cannot pair the same account at once. The command is refused on a backend-attached client, where the owning process owns pairing.
|
|
8
|
+
- `/cd` is a session command with a folder-only picker: real Windows volumes (drive type and volume label; A:/B: only when the system reports them) or POSIX mount points from `/proc/mounts`, pinned folders, type-to-filter, keyboard and mouse selection, `Ctrl+P` to pin, and `Ctrl+R` to open `/resume` on the highlighted folder instead of switching to it. A `/cd <path>` argument moves directly like `/move`.
|
|
12
9
|
|
|
13
10
|
### Changed
|
|
14
11
|
|
|
15
|
-
-
|
|
12
|
+
- Large transcript replays on resume now hydrate a bounded window instead of the whole session, so a multi-thousand-entry transcript no longer freezes the TUI before the first frame; scrolling past the window pages the rest in on demand.
|
|
13
|
+
- Starting in the home directory keeps the `~/tmp` (or OS temp) workspace and reports the switch in a startup notice instead of failing silently.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- A `task` batch coalesces spawn progress into at most one cumulative snapshot per 100 ms (matching the subagent HUD cadence), so a wide fan-out no longer rebuilds and deep-sanitizes the transcript card once per spawn report on the TUI thread; terminal spawn snapshots still publish immediately.
|
|
16
18
|
|
|
17
19
|
## [8.4.1] - 2026-01-25
|
|
18
20
|
|
|
@@ -106,6 +108,30 @@
|
|
|
106
108
|
|
|
107
109
|
Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mono](https://github.com/badlogic/pi-mono).
|
|
108
110
|
|
|
111
|
+
## [1.5.0] - 2026-11-09
|
|
112
|
+
|
|
113
|
+
### Added
|
|
114
|
+
|
|
115
|
+
- Added the Team Hub overlay: a database-backed roster of rooms, PMs and engineers with room events, real-member posting, filtering and keyboard navigation.
|
|
116
|
+
- Added the HTML form dialog used by `ask` and extension `ui.formDialog`: paginated terminal forms with keyboard navigation, images and inline SVG, free-text "Other" answers, and partial submission on inactivity timeout.
|
|
117
|
+
- Added undo support to Editor with Ctrl+- hotkey. Undo coalesces consecutive word characters into one unit (fish-style). ([#831](https://github.com/badlogic/pi-mono/pull/831) by [@Perlence](https://github.com/Perlence))
|
|
118
|
+
- Hardware cursor positioning for IME support in `Editor` and `Input` components. The terminal cursor now follows the text cursor position, enabling proper IME candidate window placement for CJK input. ([#719](https://github.com/badlogic/pi-mono/pull/719))
|
|
119
|
+
- `Focusable` interface for components that need hardware cursor positioning. Implement `focused: boolean` and emit `CURSOR_MARKER` in render output when focused.
|
|
120
|
+
- `CURSOR_MARKER` constant and `isFocusable()` type guard exported from the package
|
|
121
|
+
|
|
122
|
+
### Changed
|
|
123
|
+
|
|
124
|
+
- Changed Editor component to use proper box borders with vertical side borders instead of horizontal-only borders
|
|
125
|
+
|
|
126
|
+
### Fixed
|
|
127
|
+
|
|
128
|
+
- Decode Kitty CSI-u printable sequences in the editor so shifted symbol keys (e.g., `@`, `?`) work in terminals that enable Kitty keyboard protocol ([#779](https://github.com/badlogic/pi-mono/pull/779) by [@iamd3vil](https://github.com/iamd3vil))
|
|
129
|
+
- Keyboard shortcuts (Ctrl+C, Ctrl+D, etc.) now work on non-Latin keyboard layouts (Russian, Ukrainian, Bulgarian, etc.) in terminals supporting Kitty keyboard protocol with alternate key reporting ([#718](https://github.com/badlogic/pi-mono/pull/718) by [@dannote](https://github.com/dannote))
|
|
130
|
+
|
|
131
|
+
## [1.4.13] - 2026-11-08
|
|
132
|
+
|
|
133
|
+
- Released as part of Zeta 1.4.13.
|
|
134
|
+
|
|
109
135
|
## [1.4.12] - 2026-11-08
|
|
110
136
|
|
|
111
137
|
- Synced with upstream OMP v18.18.0.
|
|
@@ -119,7 +145,6 @@ Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mon
|
|
|
119
145
|
### Changed
|
|
120
146
|
|
|
121
147
|
- Settings list descriptions now wrap to the available width instead of truncating
|
|
122
|
-
- Changed Editor component to use proper box borders with vertical side borders instead of horizontal-only borders
|
|
123
148
|
|
|
124
149
|
### Fixed
|
|
125
150
|
|
|
@@ -329,32 +354,6 @@ Initial release under @oh-my-pi scope. See previous releases at [badlogic/pi-mon
|
|
|
329
354
|
- 上游 v18.2.5 同步:每击键/每帧渲染浪费削减、billing 摘要重构、stream 状态分段、paint-listener 通知管线。
|
|
330
355
|
- 主题、覆盖层、chat、工具渲染器与 apps 组件自 coding-agent 迁入本包(模块迁移)。
|
|
331
356
|
|
|
332
|
-
## [0.49.1] - 2026-01-18
|
|
333
|
-
|
|
334
|
-
### Added
|
|
335
|
-
|
|
336
|
-
- Added undo support to Editor with Ctrl+- hotkey. Undo coalesces consecutive word characters into one unit (fish-style). ([#831](https://github.com/badlogic/pi-mono/pull/831) by [@Perlence](https://github.com/Perlence))
|
|
337
|
-
|
|
338
|
-
## [0.48.0] - 2026-01-16
|
|
339
|
-
|
|
340
|
-
### Fixed
|
|
341
|
-
|
|
342
|
-
- Decode Kitty CSI-u printable sequences in the editor so shifted symbol keys (e.g., `@`, `?`) work in terminals that enable Kitty keyboard protocol ([#779](https://github.com/badlogic/pi-mono/pull/779) by [@iamd3vil](https://github.com/iamd3vil))
|
|
343
|
-
|
|
344
|
-
## [0.47.0] - 2026-01-16
|
|
345
|
-
|
|
346
|
-
### Added
|
|
347
|
-
|
|
348
|
-
- Hardware cursor positioning for IME support in `Editor` and `Input` components. The terminal cursor now follows the text cursor position, enabling proper IME candidate window placement for CJK input. ([#719](https://github.com/badlogic/pi-mono/pull/719))
|
|
349
|
-
- `Focusable` interface for components that need hardware cursor positioning. Implement `focused: boolean` and emit `CURSOR_MARKER` in render output when focused.
|
|
350
|
-
- `CURSOR_MARKER` constant and `isFocusable()` type guard exported from the package
|
|
351
|
-
|
|
352
|
-
## [0.46.0] - 2026-01-15
|
|
353
|
-
|
|
354
|
-
### Fixed
|
|
355
|
-
|
|
356
|
-
- Keyboard shortcuts (Ctrl+C, Ctrl+D, etc.) now work on non-Latin keyboard layouts (Russian, Ukrainian, Bulgarian, etc.) in terminals supporting Kitty keyboard protocol with alternate key reporting ([#718](https://github.com/badlogic/pi-mono/pull/718) by [@dannote](https://github.com/dannote))
|
|
357
|
-
|
|
358
357
|
## [0.45.6] - 2026-01-13
|
|
359
358
|
|
|
360
359
|
### Added
|
|
@@ -19,6 +19,8 @@ export declare const BACKGROUND_TAN_DISPATCH_MESSAGE_TYPE = "background-tan-disp
|
|
|
19
19
|
export declare const PREWALK_PLAN_MESSAGE_TYPE = "prewalk-plan";
|
|
20
20
|
/** Custom message type for the transient Vibe mode directive. */
|
|
21
21
|
export declare const VIBE_MODE_CONTEXT_MESSAGE_TYPE = "vibe-mode-context";
|
|
22
|
+
/** Custom message type for the transient Lead (PM) mode directive. */
|
|
23
|
+
export declare const LEAD_MODE_CONTEXT_MESSAGE_TYPE = "lead-mode-context";
|
|
22
24
|
/** Fallback type for extension-injected messages that omit a custom type. */
|
|
23
25
|
export declare const DEFAULT_CUSTOM_MESSAGE_TYPE = "custom-message";
|
|
24
26
|
/** Custom message carrying a coding request delegated by the live voice model. */
|
|
@@ -14,8 +14,9 @@ export interface SpotlightOriginal {
|
|
|
14
14
|
/** The file a `read` showed (picks the sheet's grammar). */
|
|
15
15
|
path?: string;
|
|
16
16
|
/**
|
|
17
|
-
* One character per original line, from its first (at most {@link SPOTLIGHT_VIEW_LINES}):
|
|
18
|
-
* `0
|
|
17
|
+
* One character per original line, from its first (at most {@link SPOTLIGHT_VIEW_LINES}): the line's rank among
|
|
18
|
+
* the lines Spotlight scored, `0` (coldest) to `9` (hottest), `-` for a line it never scored. Lines past the end
|
|
19
|
+
* are unscored.
|
|
19
20
|
*/
|
|
20
21
|
heat: string;
|
|
21
22
|
/** Runs of original lines the model was shown verbatim, `[first, last]` 1-based positions in the original. */
|
|
@@ -149,7 +150,11 @@ export interface SpotlightDetails {
|
|
|
149
150
|
export declare function spotlightSaving(spotlight: SpotlightDetails): number;
|
|
150
151
|
/** The trace a result's details carry, or undefined when the experiment did not shape it. */
|
|
151
152
|
export declare function spotlightDetails(details: unknown): SpotlightDetails | undefined;
|
|
152
|
-
/**
|
|
153
|
+
/**
|
|
154
|
+
* The {@link SpotlightOriginal.heat} of per-line scores: each scored line's rank among them in ten steps, ties sharing
|
|
155
|
+
* their mean place. Spotlight's attention is heavy-tailed (a line or two take most of it), so a share of the hottest
|
|
156
|
+
* line would put nearly every line at `0`.
|
|
157
|
+
*/
|
|
153
158
|
export declare function encodeHeat(scores: readonly (number | null)[]): string;
|
|
154
159
|
/** The heat of original line `i` (0-based) in [0, 1], or undefined when Spotlight never scored it. */
|
|
155
160
|
export declare function heatAt(heat: string, i: number): number | undefined;
|
|
@@ -41,6 +41,11 @@ export declare function buildLaunchCompletionBlock(message: CustomOrHookMessage)
|
|
|
41
41
|
* the live expanded-state getter for the cached card.
|
|
42
42
|
*/
|
|
43
43
|
export declare function buildIrcMessageCard(message: CustomOrHookMessage, getExpanded: () => boolean): Component;
|
|
44
|
+
/** Present a consumed parent steer as an IRC card without interpreting its model-facing envelope. */
|
|
45
|
+
export declare function buildParentIrcMessageCard(parentIrc: {
|
|
46
|
+
from: string;
|
|
47
|
+
body: string;
|
|
48
|
+
}, timestamp: number, getExpanded: () => boolean): Component;
|
|
44
49
|
/**
|
|
45
50
|
* Render a `fileMention` message's files as a transcript block of "Read <path>"
|
|
46
51
|
* rows. `indent` sets the left pad: the live chat renders within an outer gutter
|
|
@@ -323,7 +323,10 @@ export declare class Editor implements Component, Focusable {
|
|
|
323
323
|
* Used for command-like autocomplete actions whose typed trigger should not count as the edit being undone.
|
|
324
324
|
*/
|
|
325
325
|
undoPastTransientText(transientText: string): void;
|
|
326
|
-
|
|
326
|
+
/** Replace the buffer; the caret lands at the end unless `cursor: "start"` (multi-row text only). */
|
|
327
|
+
setText(text: string, options?: {
|
|
328
|
+
cursor?: "start" | "end";
|
|
329
|
+
}): void;
|
|
327
330
|
submit(): void;
|
|
328
331
|
/** Insert text at the current cursor position */
|
|
329
332
|
insertText(text: string): void;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Answers of a parsed {@link HtmlForm}: the data shape a submission reports,
|
|
3
|
+
* the defaults a form opens with, and a readable question/answer listing for
|
|
4
|
+
* transcripts and non-interactive hosts.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const form = parseHtmlForm(html);
|
|
8
|
+
* const data = defaultFormData(form); // { db: "sqlite", notes: "" }
|
|
9
|
+
* formAnswers(form, data); // [{ name: "db", question: "Database", answer: "SQLite" }, …]
|
|
10
|
+
*/
|
|
11
|
+
import { type ChoiceField, type FormField, type HtmlForm, type TextField } from "./parse.js";
|
|
12
|
+
/** Submitted value of one control: text, a number for `number`/`range` inputs, or a group's checked values. */
|
|
13
|
+
export type HtmlFormValue = string | number | string[];
|
|
14
|
+
/**
|
|
15
|
+
* Submitted form data by control `name`. Radios, single checkboxes and single
|
|
16
|
+
* selects give their value (omitted when nothing is chosen); checkbox groups
|
|
17
|
+
* and multi-selects give an array; text fields always give their text.
|
|
18
|
+
* Disabled options, unnamed controls and buttons never appear; hidden inputs do.
|
|
19
|
+
*/
|
|
20
|
+
export type HtmlFormData = Record<string, HtmlFormValue>;
|
|
21
|
+
/** One field as a question and its answer, both plain text. */
|
|
22
|
+
export interface FormAnswer {
|
|
23
|
+
name: string;
|
|
24
|
+
question: string;
|
|
25
|
+
answer: string;
|
|
26
|
+
}
|
|
27
|
+
/** Label of the free-text answer the UI adds to radio and checkbox groups ({@link ChoiceField.other}). */
|
|
28
|
+
export declare const OTHER_LABEL = "Other";
|
|
29
|
+
/** Whether a choice field reports an array (checkbox group, multi-select) rather than one value. */
|
|
30
|
+
export declare function isArrayChoice(field: ChoiceField): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Value a choice field contributes given its checked option indices and, when
|
|
33
|
+
* the user chose its "Other" answer, that answer's text: the typed text stands
|
|
34
|
+
* in for a radio's value, or joins a checkbox group's array. Undefined when the
|
|
35
|
+
* field contributes nothing; blank Other text counts as no answer.
|
|
36
|
+
*/
|
|
37
|
+
export declare function choiceValue(field: ChoiceField, checked: ReadonlySet<number>, other?: string): HtmlFormValue | undefined;
|
|
38
|
+
/** Value a text field contributes: a number for non-empty numeric `number`/`range` inputs, else the text. */
|
|
39
|
+
export declare function textValue(field: TextField, text: string): HtmlFormValue;
|
|
40
|
+
/**
|
|
41
|
+
* Why `value` is not an acceptable answer for `field`, or undefined when it is.
|
|
42
|
+
* Enforces `required`, numeric `min`/`max`, `minlength`/`maxlength`, `email`
|
|
43
|
+
* and `url` shapes, and `pattern` (anchored, as HTML does; an invalid pattern
|
|
44
|
+
* is ignored).
|
|
45
|
+
*/
|
|
46
|
+
export declare function fieldError(field: FormField, value: HtmlFormValue | undefined): string | undefined;
|
|
47
|
+
/** Data the form submits untouched: hidden inputs, preselected options and prefilled text. */
|
|
48
|
+
export declare function defaultFormData(form: HtmlForm): HtmlFormData;
|
|
49
|
+
/**
|
|
50
|
+
* The question each field answers: its own label, else the text block right
|
|
51
|
+
* before it (`<p>Which database?</p>` above a radio group), else its section
|
|
52
|
+
* title, else a lone option's label (a single checkbox), else its name.
|
|
53
|
+
*/
|
|
54
|
+
export declare function fieldQuestions(form: HtmlForm): Map<FormField, string>;
|
|
55
|
+
/** Answers of every named field, in form order, with option values shown as their labels. */
|
|
56
|
+
export declare function formAnswers(form: HtmlForm, data: HtmlFormData): FormAnswer[];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type DescribeContext, type NativeNode, type NativeUiEvent } from "../native/node.js";
|
|
2
|
+
import type { AskDialogInputGuard } from "../overlays/ask-dialog.js";
|
|
3
|
+
import type { Component, Focusable } from "../tui.js";
|
|
4
|
+
import { type HtmlFormData } from "./data.js";
|
|
5
|
+
import { type HtmlForm } from "./parse.js";
|
|
6
|
+
/** What the dialog needs from its `TUI`: the terminal's height and a way to ask for a frame. */
|
|
7
|
+
export interface HtmlFormHost {
|
|
8
|
+
readonly terminal: {
|
|
9
|
+
readonly rows: number;
|
|
10
|
+
};
|
|
11
|
+
requestRender(): void;
|
|
12
|
+
}
|
|
13
|
+
/** Host wiring for {@link HtmlFormDialog}. */
|
|
14
|
+
export interface HtmlFormDialogOptions {
|
|
15
|
+
/** Panel title; `Ask` when omitted. */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Sizes the panel and repaints when the countdown ticks or a picture lands. */
|
|
18
|
+
tui?: HtmlFormHost;
|
|
19
|
+
/** Inactivity in ms after which `onTimeout` receives the current values; any input restarts it. */
|
|
20
|
+
timeout?: number;
|
|
21
|
+
onTimeout?(data: HtmlFormData): void;
|
|
22
|
+
/** A composer draft that keeps typing until ↑/↓ hands the keyboard to the form (as the ask dialog). */
|
|
23
|
+
inputGuard?: AskDialogInputGuard;
|
|
24
|
+
/** Directory relative `<img src>` paths resolve against; the process's when omitted. */
|
|
25
|
+
cwd?: string;
|
|
26
|
+
onSubmit(data: HtmlFormData): void;
|
|
27
|
+
onCancel(): void;
|
|
28
|
+
}
|
|
29
|
+
/** Interactive pager over an {@link HtmlForm}; see the module docs for layout and keys. */
|
|
30
|
+
export declare class HtmlFormDialog implements Component, Focusable {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(form: HtmlForm, options: HtmlFormDialogOptions);
|
|
33
|
+
get focused(): boolean;
|
|
34
|
+
set focused(value: boolean);
|
|
35
|
+
setUseTerminalCursor(useTerminalCursor: boolean): void;
|
|
36
|
+
/** Current answers, as submission would report them (without validating). */
|
|
37
|
+
data(): HtmlFormData;
|
|
38
|
+
debugState(): Record<string, unknown>;
|
|
39
|
+
handleInput(data: string): void;
|
|
40
|
+
/** Clicks on option rows and the Submit/Cancel bar of the native description. */
|
|
41
|
+
handleNativeEvent(event: NativeUiEvent): void;
|
|
42
|
+
render(width: number): readonly string[];
|
|
43
|
+
/**
|
|
44
|
+
* The form as one native column: sections with their context, option lists
|
|
45
|
+
* (`select` focuses/picks, a checkbox `select` toggles), the field `Input`s and
|
|
46
|
+
* `Editor`s as their own described children, and a Cancel/Submit bar.
|
|
47
|
+
*/
|
|
48
|
+
describe(_cx: DescribeContext): NativeNode;
|
|
49
|
+
invalidate(): void;
|
|
50
|
+
dispose(): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** An image's bytes and MIME type. */
|
|
2
|
+
export interface FormMedia {
|
|
3
|
+
bytes: Uint8Array;
|
|
4
|
+
mime: string;
|
|
5
|
+
}
|
|
6
|
+
/** Where relative paths resolve, and the abort for in-flight loads. */
|
|
7
|
+
export interface FormMediaOptions {
|
|
8
|
+
cwd: string;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
/** Largest picture a form loads. */
|
|
12
|
+
export declare const MAX_FORM_IMAGE_BYTES: number;
|
|
13
|
+
/**
|
|
14
|
+
* Load an `<img src>`: an `http(s):` URL, a `data:` URI (base64 or URL-encoded),
|
|
15
|
+
* a `file:` URL, or a path (`~/`-relative, absolute, or relative to `cwd`).
|
|
16
|
+
*
|
|
17
|
+
* @throws {Error} the source cannot be read, exceeds {@link MAX_FORM_IMAGE_BYTES},
|
|
18
|
+
* times out, or is not a PNG, JPEG, GIF, WebP or SVG image.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadFormImage(src: string, options: FormMediaOptions): Promise<FormMedia>;
|
|
21
|
+
/**
|
|
22
|
+
* An `<svg>` as standalone media: the SVG namespace added when missing, and a
|
|
23
|
+
* drawing sized only by its `viewBox` given that size as `width`/`height`, since
|
|
24
|
+
* renderers drop a drawing without one.
|
|
25
|
+
*/
|
|
26
|
+
export declare function svgMedia(markup: string): FormMedia;
|
|
27
|
+
/** Whether `media` is an SVG drawing rather than a raster. */
|
|
28
|
+
export declare function isSvgMedia(media: FormMedia): boolean;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits a rendered form body into pages of a fixed row budget.
|
|
3
|
+
*
|
|
4
|
+
* The body arrives as atoms: unbreakable row runs (an option with its wrapped
|
|
5
|
+
* label, a text field with its input, one line of a paragraph). Each atom ranks
|
|
6
|
+
* how good a page break before it is; a page ends at the break that best
|
|
7
|
+
* trades rank against the rows it leaves empty ({@link breakScore}), so a
|
|
8
|
+
* section boundary wins unless it strands most of the page, and a break
|
|
9
|
+
* never lands before a {@link BreakRank.Never} atom (a heading's first line,
|
|
10
|
+
* a block's widow) unless nothing else fits.
|
|
11
|
+
*/
|
|
12
|
+
/** How good a page break before an atom is. */
|
|
13
|
+
export declare const enum BreakRank {
|
|
14
|
+
/** Keep with the previous atom (the line after a heading, an error after its field). */
|
|
15
|
+
Never = 0,
|
|
16
|
+
/** Inside a block: between options of a group, lines of a paragraph. */
|
|
17
|
+
Inside = 1,
|
|
18
|
+
/** Between blocks of one section. */
|
|
19
|
+
Block = 2,
|
|
20
|
+
/** Between sections. */
|
|
21
|
+
Section = 3
|
|
22
|
+
}
|
|
23
|
+
/** One unbreakable run of body rows. */
|
|
24
|
+
export interface PageAtom {
|
|
25
|
+
lines: readonly string[];
|
|
26
|
+
/** Blank rows before this atom; dropped when the atom starts a page. */
|
|
27
|
+
gap: number;
|
|
28
|
+
breakRank: BreakRank;
|
|
29
|
+
/** Title repeated atop a page that starts at this atom (`Database (cont.)`); costs one row. */
|
|
30
|
+
continuation?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Atoms `[start, end)` of one page. */
|
|
33
|
+
export interface Page {
|
|
34
|
+
start: number;
|
|
35
|
+
end: number;
|
|
36
|
+
}
|
|
37
|
+
/** Rows a page uses when it holds atoms `[start, end)`. */
|
|
38
|
+
export declare function pageHeight(atoms: readonly PageAtom[], start: number, end: number): number;
|
|
39
|
+
/**
|
|
40
|
+
* Pack atoms into pages of at most `rows` rows. An atom taller than a page
|
|
41
|
+
* gets a page of its own (the caller clips it). Always returns at least one page.
|
|
42
|
+
*/
|
|
43
|
+
export declare function paginate(atoms: readonly PageAtom[], rows: number): Page[];
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/** Inline emphasis a span keeps from `<code>`, `<strong>`/`<b>` and `<em>`/`<i>`. */
|
|
2
|
+
export type FormSpanStyle = "code" | "strong" | "em";
|
|
3
|
+
/** A run of inline text; `"\n"` inside `text` is a hard line break (`<br>`). */
|
|
4
|
+
export interface FormSpan {
|
|
5
|
+
text: string;
|
|
6
|
+
style?: FormSpanStyle;
|
|
7
|
+
}
|
|
8
|
+
/** One answer of a {@link ChoiceField}. */
|
|
9
|
+
export interface ChoiceOption {
|
|
10
|
+
value: string;
|
|
11
|
+
label: FormSpan[];
|
|
12
|
+
checked: boolean;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** A radio group (`multi: false`), checkbox group (`multi: true`) or `<select>` (`select: true`). */
|
|
16
|
+
export interface ChoiceField {
|
|
17
|
+
kind: "choice";
|
|
18
|
+
name: string;
|
|
19
|
+
multi: boolean;
|
|
20
|
+
/** From a `<select>`: a single select draws as a one-row dropdown instead of option rows. */
|
|
21
|
+
select: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The UI adds a free-text "Other" answer: set for radio and checkbox groups of
|
|
24
|
+
* two or more options that don't already offer one of their own.
|
|
25
|
+
*/
|
|
26
|
+
other: boolean;
|
|
27
|
+
/** The control's own label; empty for radio/checkbox groups, whose question is the surrounding text. */
|
|
28
|
+
label: FormSpan[];
|
|
29
|
+
options: ChoiceOption[];
|
|
30
|
+
required: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** A single-line `<input>` (`multiline: false`) or a `<textarea>`. */
|
|
33
|
+
export interface TextField {
|
|
34
|
+
kind: "text";
|
|
35
|
+
name: string;
|
|
36
|
+
/** The `<input type>` (`text`, `number`, `url`, …); `textarea` for textareas. */
|
|
37
|
+
type: string;
|
|
38
|
+
multiline: boolean;
|
|
39
|
+
label: FormSpan[];
|
|
40
|
+
value: string;
|
|
41
|
+
placeholder: string;
|
|
42
|
+
required: boolean;
|
|
43
|
+
min?: number;
|
|
44
|
+
max?: number;
|
|
45
|
+
pattern?: string;
|
|
46
|
+
minLength?: number;
|
|
47
|
+
maxLength?: number;
|
|
48
|
+
/** Visible rows a textarea asked for (`rows`), 1 for inputs. */
|
|
49
|
+
rows: number;
|
|
50
|
+
}
|
|
51
|
+
/** Any control the user answers. */
|
|
52
|
+
export type FormField = ChoiceField | TextField;
|
|
53
|
+
/** A renderable unit of a section, in document order. */
|
|
54
|
+
export type FormBlock = {
|
|
55
|
+
kind: "text";
|
|
56
|
+
spans: FormSpan[];
|
|
57
|
+
heading: boolean;
|
|
58
|
+
} | {
|
|
59
|
+
kind: "list";
|
|
60
|
+
items: FormSpan[][];
|
|
61
|
+
ordered: boolean;
|
|
62
|
+
} | {
|
|
63
|
+
kind: "pre";
|
|
64
|
+
text: string;
|
|
65
|
+
} | {
|
|
66
|
+
kind: "table";
|
|
67
|
+
rows: FormSpan[][][];
|
|
68
|
+
headerRows: number;
|
|
69
|
+
}
|
|
70
|
+
/** An `<img>`: `src` is an http(s) or `data:` URL, a `file:` URL or a local path (see `media.ts`). */
|
|
71
|
+
| {
|
|
72
|
+
kind: "image";
|
|
73
|
+
src: string;
|
|
74
|
+
alt: string;
|
|
75
|
+
}
|
|
76
|
+
/** An inline `<svg>`, serialized whole. */
|
|
77
|
+
| {
|
|
78
|
+
kind: "svg";
|
|
79
|
+
markup: string;
|
|
80
|
+
alt: string;
|
|
81
|
+
} | {
|
|
82
|
+
kind: "field";
|
|
83
|
+
field: FormField;
|
|
84
|
+
};
|
|
85
|
+
/** A `<fieldset>` (titled by its `<legend>`) or loose content between fieldsets (untitled). */
|
|
86
|
+
export interface FormSection {
|
|
87
|
+
title: FormSpan[];
|
|
88
|
+
blocks: FormBlock[];
|
|
89
|
+
}
|
|
90
|
+
/** A parsed form: what to draw, the fields in document order, and `<input type="hidden">` pairs. */
|
|
91
|
+
export interface HtmlForm {
|
|
92
|
+
sections: FormSection[];
|
|
93
|
+
fields: FormField[];
|
|
94
|
+
hidden: [name: string, value: string][];
|
|
95
|
+
}
|
|
96
|
+
/** Parse agent-written form HTML; content outside the first `<form>` is ignored when one exists. */
|
|
97
|
+
export declare function parseHtmlForm(html: string): HtmlForm;
|
|
98
|
+
/** Plain text of spans, for labels that fall back to a single string. */
|
|
99
|
+
export declare function spansText(spans: readonly FormSpan[]): string;
|
|
@@ -20,6 +20,10 @@ export interface AskDialogPromptValue {
|
|
|
20
20
|
text: string;
|
|
21
21
|
images?: ImageContent[];
|
|
22
22
|
}
|
|
23
|
+
/** A prompt left without submitting: what it still held, offered again when the custom answer reopens. */
|
|
24
|
+
export interface AskDialogPromptDraft {
|
|
25
|
+
draft: AskDialogPromptValue;
|
|
26
|
+
}
|
|
23
27
|
/** Submitted answer to one dialog question. */
|
|
24
28
|
export interface ExtensionAskDialogResultItem {
|
|
25
29
|
id: string;
|
|
@@ -57,9 +61,10 @@ export interface AskDialogPrompt {
|
|
|
57
61
|
interface AskDialogCallbacks {
|
|
58
62
|
onSubmit(result: ExtensionAskDialogSubmitResult): void;
|
|
59
63
|
onCancel(): void;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
/** Resolves the submitted text; on cancel, the editor's draft, or `undefined` when none is kept. */
|
|
65
|
+
onPrompt(prompt: AskDialogPrompt, prefill?: string): Promise<string | AskDialogPromptDraft | undefined>;
|
|
66
|
+
/** Prompt that accepts pasted images; without it, prompts use `onPrompt`. Resolves like `onPrompt`. */
|
|
67
|
+
onImagePrompt?(prompt: AskDialogPrompt, prefill: AskDialogPromptValue | undefined): Promise<AskDialogPromptValue | AskDialogPromptDraft | undefined>;
|
|
63
68
|
}
|
|
64
69
|
/**
|
|
65
70
|
* Routes typing to a composer draft that was in progress when the dialog
|
|
@@ -67,7 +72,7 @@ interface AskDialogCallbacks {
|
|
|
67
72
|
* keys are the explicit hand-off: they release the guard for the rest of the
|
|
68
73
|
* dialog's life and the draft stays parked (intact) beneath it.
|
|
69
74
|
*/
|
|
70
|
-
interface AskDialogInputGuard {
|
|
75
|
+
export interface AskDialogInputGuard {
|
|
71
76
|
isBlocked(): boolean;
|
|
72
77
|
handleInput(keyData: string): void;
|
|
73
78
|
/** Shown after the release keys while the guard holds input. */
|
|
@@ -125,8 +130,8 @@ export declare class AskDialogComponent implements Component {
|
|
|
125
130
|
* Pointer actions: a tab click switches to it; a click on an answer row is
|
|
126
131
|
* Enter on it (Space for a multi-select option, so it toggles; its
|
|
127
132
|
* double-click `activate` is Enter); the action bar's Submit, Note and Skip
|
|
128
|
-
* run what Enter (see {@link #pressEnter} for Other), `n` and Esc run on the highlighted row
|
|
129
|
-
* collapse and restore the dialog.
|
|
133
|
+
* run what Enter (see {@link #pressEnter} for Other), `n` and Esc run on the highlighted row, and a
|
|
134
|
+
* row's menu Note highlights that row and notes it; Hide/Show collapse and restore the dialog.
|
|
130
135
|
*/
|
|
131
136
|
handleNativeEvent(event: NativeUiEvent): void;
|
|
132
137
|
}
|
|
@@ -7,9 +7,9 @@ export interface CodeBlock {
|
|
|
7
7
|
/** Block body with the trailing newline stripped. */
|
|
8
8
|
code: string;
|
|
9
9
|
}
|
|
10
|
-
/** A blockquote block
|
|
10
|
+
/** A blockquote block, as the renderer draws it. */
|
|
11
11
|
export interface QuoteBlock {
|
|
12
|
-
/** Block body with
|
|
12
|
+
/** Block body with the `>` markers removed. */
|
|
13
13
|
text: string;
|
|
14
14
|
}
|
|
15
15
|
/** A drillable block within an assistant message, in document order. */
|
|
@@ -26,10 +26,12 @@ export interface LastCommand {
|
|
|
26
26
|
language: string;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Split assistant markdown into drillable blocks — fenced code and
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
29
|
+
* Split assistant markdown into drillable blocks — fenced code and
|
|
30
|
+
* blockquotes — in document order. Tokenization is the renderer's own
|
|
31
|
+
* ({@link lexDocument}), so fences nested in list items, fence closing rules,
|
|
32
|
+
* list boundaries and lazy quote continuations agree with the screen. Code
|
|
33
|
+
* inside a quote stays part of the quote; indented (non-fenced) code blocks
|
|
34
|
+
* are not offered.
|
|
33
35
|
*/
|
|
34
36
|
export declare function extractBlocks(text: string): MessageBlock[];
|
|
35
37
|
/** Extract fenced code blocks from assistant markdown, in document order. */
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type SgrMouseEvent } from "../index.js";
|
|
2
|
+
import { OverlayPanel } from "../chrome/overlay-box.js";
|
|
3
|
+
import type { DescribeContext, NativeNode, NativeUiEvent } from "../native/node.js";
|
|
4
|
+
/** One directory row the picker can show. */
|
|
5
|
+
export interface DirectoryPickerEntry {
|
|
6
|
+
/** Row label (a folder name, or a volume label for a root row). */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Absolute path the row stands for. */
|
|
9
|
+
path: string;
|
|
10
|
+
/** Detail line under/next to the label: a volume kind, mount source, or path. */
|
|
11
|
+
detail?: string;
|
|
12
|
+
/** Named icon for the row. */
|
|
13
|
+
icon?: string;
|
|
14
|
+
}
|
|
15
|
+
/** What the picker shows at one level. */
|
|
16
|
+
export interface DirectoryPickerListing {
|
|
17
|
+
/** Directory being browsed; `null` on the roots screen (drives / mounts). */
|
|
18
|
+
current: string | null;
|
|
19
|
+
/** Parent directory, or `null` at a filesystem root or the roots screen. */
|
|
20
|
+
parent: string | null;
|
|
21
|
+
/** What the roots screen lists; the title is localized by this component. */
|
|
22
|
+
rootsKind?: "drives" | "mounts";
|
|
23
|
+
/** Volumes or mounts for the roots screen; empty while browsing a directory. */
|
|
24
|
+
roots: DirectoryPickerEntry[];
|
|
25
|
+
/** Pinned directories, always shown first. */
|
|
26
|
+
pins: DirectoryPickerEntry[];
|
|
27
|
+
/** Subdirectories of `current`, folders only. */
|
|
28
|
+
directories: DirectoryPickerEntry[];
|
|
29
|
+
/** Whether `current` itself can become the session directory. */
|
|
30
|
+
selectable: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Host filesystem access; synchronous so a repaint never waits on I/O. */
|
|
33
|
+
export interface DirectoryPickerSource {
|
|
34
|
+
list(directory: string | null): DirectoryPickerListing;
|
|
35
|
+
/** Persist a pin change; resolves to the new pinned state. */
|
|
36
|
+
togglePin(directory: string): Promise<boolean>;
|
|
37
|
+
}
|
|
38
|
+
export interface DirectoryPickerOptions {
|
|
39
|
+
source: DirectoryPickerSource;
|
|
40
|
+
/** Directory that is currently the session workspace. */
|
|
41
|
+
initialPath: string;
|
|
42
|
+
/** Called when the user chooses a directory (Enter, click, or a pin). */
|
|
43
|
+
onSelect: (directory: string) => void;
|
|
44
|
+
/** Secondary action: open resume filtered to this directory's conversations. */
|
|
45
|
+
onResume: (directory: string) => void;
|
|
46
|
+
onCancel: () => void;
|
|
47
|
+
/** Home directory, abbreviated to `~` in breadcrumbs. */
|
|
48
|
+
home?: string;
|
|
49
|
+
}
|
|
50
|
+
export declare class DirectoryPickerOverlay extends OverlayPanel {
|
|
51
|
+
#private;
|
|
52
|
+
constructor(options: DirectoryPickerOptions);
|
|
53
|
+
/** Directories listed at the current level (tests and hosts). */
|
|
54
|
+
get listing(): DirectoryPickerListing;
|
|
55
|
+
get current(): string | null;
|
|
56
|
+
/** Highlighted row's directory, when the row names one. */
|
|
57
|
+
get highlightedPath(): string | undefined;
|
|
58
|
+
describe(cx: DescribeContext): NativeNode | null;
|
|
59
|
+
handleNativeEvent(event: NativeUiEvent): void;
|
|
60
|
+
routeMouse(event: SgrMouseEvent, line: number, col: number): void;
|
|
61
|
+
handleInput(data: string): void;
|
|
62
|
+
}
|
|
@@ -57,7 +57,9 @@ export declare class HookEditorComponent extends OverlayPanel implements Focusab
|
|
|
57
57
|
#private;
|
|
58
58
|
/** Focus state mirrored to the nested editor during rendering. */
|
|
59
59
|
focused: boolean;
|
|
60
|
-
constructor(tui: TUI, title: string, prefill: string | undefined, onSubmit: (value: string, images?: ImageContent[]) => void,
|
|
60
|
+
constructor(tui: TUI, title: string, prefill: string | undefined, onSubmit: (value: string, images?: ImageContent[]) => void,
|
|
61
|
+
/** Receives the text and images left in the editor, so a host can offer them again. */
|
|
62
|
+
onCancel: (draft: string, images?: ImageContent[]) => void, options?: HookEditorOptions);
|
|
61
63
|
/**
|
|
62
64
|
* A sheet in the composer's place: the title (or, answering a question, the question under the
|
|
63
65
|
* prompt's name) over a hairline, the editor, and Open in editor · Cancel · Submit.
|
|
@@ -67,6 +67,8 @@ export declare class HubFrame {
|
|
|
67
67
|
});
|
|
68
68
|
/** Invalidate the composed layout. */
|
|
69
69
|
invalidate(): void;
|
|
70
|
+
/** Replace the frame title after asynchronous data supplies a display name. */
|
|
71
|
+
setTitle(title: string): void;
|
|
70
72
|
/** Measure labels and annotations within this hub's sidebar width bounds. */
|
|
71
73
|
sidebarWidth(entries: readonly SidebarEntry<string>[]): number;
|
|
72
74
|
/** Pan the sidebar within the current viewport's bounds. */
|
|
@@ -54,6 +54,8 @@ export interface ModelHubCallbacks {
|
|
|
54
54
|
onFallbackChainChange?: (role: string, chain: string[]) => void;
|
|
55
55
|
/** Locked provider activation: forward to the /login flow. */
|
|
56
56
|
onLoginRequest?: (providerId: string) => void;
|
|
57
|
+
/** Returns the rebuilt `--models` scope for the hub to list; `undefined` keeps the current one. */
|
|
58
|
+
onCatalogRefreshed?: (providerId?: string) => ReadonlyArray<ScopedModelItem> | undefined | Promise<ReadonlyArray<ScopedModelItem> | undefined>;
|
|
57
59
|
/** Save the current role assignments and default thinking level as a named model preset. */
|
|
58
60
|
onSavePreset?: (name: string) => void;
|
|
59
61
|
/**
|