@linxiraos/pi-tui 1.4.7 → 1.4.9
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 +28 -109
- package/README.md +7 -1
- package/dist/types/app-keybindings.d.ts +5 -0
- package/dist/types/charts/table-data.d.ts +4 -2
- package/dist/types/chat/bash-execution.d.ts +4 -1
- package/dist/types/chat/eval-execution.d.ts +2 -0
- package/dist/types/chat/execution-shared.d.ts +14 -8
- package/dist/types/chat/figure-markdown.d.ts +2 -0
- package/dist/types/chat/svg-figure.d.ts +5 -0
- package/dist/types/chat/table-chart.d.ts +2 -0
- package/dist/types/chat/transcript-render-helpers.d.ts +11 -3
- package/dist/types/chrome/dynamic-border.d.ts +6 -0
- package/dist/types/chrome/transcript-status.d.ts +2 -2
- package/dist/types/components/editor.d.ts +15 -6
- package/dist/types/components/image.d.ts +6 -0
- package/dist/types/components/loader.d.ts +2 -0
- package/dist/types/keybinding-matchers.d.ts +7 -0
- package/dist/types/native/describe.d.ts +4 -2
- package/dist/types/native/node.d.ts +2 -3
- package/dist/types/native/overlay.d.ts +42 -2
- package/dist/types/native/state.d.ts +4 -0
- package/dist/types/overlays/btw-history-panel.d.ts +15 -0
- package/dist/types/overlays/btw-history.d.ts +24 -0
- package/dist/types/overlays/btw-inject.d.ts +22 -0
- package/dist/types/overlays/btw-panel.d.ts +7 -0
- package/dist/types/overlays/hook-editor.d.ts +2 -0
- package/dist/types/overlays/jobs-panel.d.ts +4 -0
- package/dist/types/overlays/model-browser.d.ts +1 -1
- package/dist/types/overlays/session-selector.d.ts +11 -2
- package/dist/types/prompt/composer.d.ts +13 -5
- package/dist/types/render/render-utils.d.ts +23 -1
- package/dist/types/status-line/startup.d.ts +0 -15
- package/dist/types/terminal-capabilities.d.ts +1 -1
- package/dist/types/theme/symbols.d.ts +3 -1
- package/dist/types/theme/theme-class.d.ts +1 -0
- package/dist/types/theme/theme.d.ts +1 -1
- package/dist/types/theme/tui-adapters.d.ts +2 -0
- package/dist/types/thinking.d.ts +8 -6
- package/dist/types/tools/ast-grep.d.ts +2 -0
- package/dist/types/tools/eval.d.ts +2 -0
- package/dist/types/tools/find.d.ts +1 -1
- package/dist/types/tools/grouped-file-output.d.ts +100 -19
- package/dist/types/tools/hashline-format.d.ts +5 -0
- package/dist/types/tools/native-view.d.ts +2 -0
- package/dist/types/tools/output-meta.d.ts +27 -0
- package/dist/types/tools/read.d.ts +14 -4
- package/dist/types/tools/task.d.ts +4 -3
- package/dist/types/tools/wait.d.ts +2 -0
- package/dist/types/tui.d.ts +12 -0
- package/dist/types/utils.d.ts +4 -0
- package/package.json +9 -9
- package/src/app-keybindings.d.ts +5 -0
- package/src/app-keybindings.ts +5 -0
- package/src/apps/git/git-tui.ts +10 -17
- package/src/apps/git/sidebar.ts +21 -35
- package/src/apps/ps-top.ts +4 -12
- package/src/charts/chart-plan.ts +0 -29
- package/src/charts/table-data.d.ts +4 -2
- package/src/charts/table-data.ts +55 -6
- package/src/chat/bash-execution.d.ts +4 -1
- package/src/chat/bash-execution.ts +20 -9
- package/src/chat/chat-transcript-builder.ts +5 -2
- package/src/chat/eval-execution.d.ts +2 -0
- package/src/chat/eval-execution.ts +14 -7
- package/src/chat/execution-shared.d.ts +14 -8
- package/src/chat/execution-shared.ts +39 -18
- package/src/chat/figure-markdown.d.ts +2 -0
- package/src/chat/figure-markdown.ts +6 -4
- package/src/chat/read-tool-group.ts +56 -36
- package/src/chat/svg-figure.d.ts +5 -0
- package/src/chat/svg-figure.ts +55 -16
- package/src/chat/table-chart.d.ts +2 -0
- package/src/chat/table-chart.ts +19 -2
- package/src/chat/transcript-render-helpers.d.ts +11 -3
- package/src/chat/transcript-render-helpers.ts +70 -22
- package/src/chrome/dynamic-border.d.ts +6 -0
- package/src/chrome/dynamic-border.ts +28 -2
- package/src/chrome/transcript-status.d.ts +2 -2
- package/src/chrome/transcript-status.ts +5 -3
- package/src/components/editor.d.ts +15 -6
- package/src/components/editor.ts +123 -24
- package/src/components/image.d.ts +6 -0
- package/src/components/image.ts +13 -0
- package/src/components/key-value-list.ts +9 -9
- package/src/components/loader.d.ts +2 -0
- package/src/components/loader.ts +7 -0
- package/src/components/section.ts +1 -9
- package/src/components/table.ts +1 -9
- package/src/keybinding-matchers.d.ts +7 -0
- package/src/keybinding-matchers.ts +13 -0
- package/src/native/backend.ts +7 -3
- package/src/native/describe.d.ts +4 -2
- package/src/native/describe.ts +9 -4
- package/src/native/node.d.ts +2 -3
- package/src/native/node.ts +2 -3
- package/src/native/overlay.d.ts +42 -2
- package/src/native/overlay.ts +124 -16
- package/src/native/state.d.ts +4 -0
- package/src/native/state.ts +25 -5
- package/src/overlays/btw-history-panel.ts +106 -14
- package/src/overlays/btw-history.ts +65 -0
- package/src/overlays/btw-inject.ts +91 -0
- package/src/overlays/btw-panel.ts +53 -12
- package/src/overlays/extensions/extension-dashboard.ts +7 -8
- package/src/overlays/hook-editor.ts +6 -0
- package/src/overlays/jobs-panel.ts +82 -22
- package/src/overlays/login-dialog.ts +8 -26
- package/src/overlays/model-browser.ts +69 -10
- package/src/overlays/session-selector.ts +25 -5
- package/src/overlays/settings-defs.ts +2 -2
- package/src/overlays/tree-selector.ts +83 -27
- package/src/overlays/usage-dashboard.ts +4 -6
- package/src/prompt/composer.ts +17 -5
- package/src/render/code-cell.ts +1 -1
- package/src/render/file-list.ts +4 -7
- package/src/render/render-utils.d.ts +23 -1
- package/src/render/render-utils.ts +38 -6
- package/src/setup/scenes/glyph.ts +1 -1
- package/src/status-line/startup.ts +36 -70
- package/src/terminal-capabilities.d.ts +1 -1
- package/src/terminal-capabilities.ts +5 -0
- package/src/theme/symbols.d.ts +3 -1
- package/src/theme/symbols.ts +16 -9
- package/src/theme/theme-class.d.ts +1 -0
- package/src/theme/theme-class.ts +15 -3
- package/src/theme/theme.d.ts +1 -1
- package/src/theme/theme.ts +1 -0
- package/src/theme/tui-adapters.d.ts +2 -0
- package/src/theme/tui-adapters.ts +8 -3
- package/src/thinking.d.ts +8 -6
- package/src/thinking.ts +17 -11
- package/src/tmux.ts +1 -0
- package/src/tools/agent-tree.ts +13 -11
- package/src/tools/ask.ts +24 -37
- package/src/tools/ast-edit.ts +48 -93
- package/src/tools/ast-grep.d.ts +2 -0
- package/src/tools/ast-grep.ts +31 -67
- package/src/tools/bash.ts +7 -0
- package/src/tools/default-renderer.ts +1 -1
- package/src/tools/edit.ts +50 -43
- package/src/tools/eval.d.ts +2 -0
- package/src/tools/eval.ts +2 -0
- package/src/tools/fetch.ts +2 -1
- package/src/tools/find.d.ts +1 -1
- package/src/tools/find.ts +13 -5
- package/src/tools/github.ts +14 -46
- package/src/tools/glob.ts +2 -1
- package/src/tools/grep.ts +47 -277
- package/src/tools/grouped-file-output.d.ts +100 -19
- package/src/tools/grouped-file-output.ts +414 -103
- package/src/tools/hashline-format.d.ts +5 -0
- package/src/tools/hashline-format.ts +5 -0
- package/src/tools/json-tree.ts +1 -5
- package/src/tools/lsp.ts +210 -32
- package/src/tools/native-view.d.ts +2 -0
- package/src/tools/native-view.ts +11 -5
- package/src/tools/output-meta.d.ts +27 -0
- package/src/tools/output-meta.ts +68 -4
- package/src/tools/proc-render.ts +3 -3
- package/src/tools/read.d.ts +14 -4
- package/src/tools/read.ts +20 -5
- package/src/tools/task.d.ts +4 -3
- package/src/tools/task.ts +41 -81
- package/src/tools/vibe.ts +4 -4
- package/src/tools/wait.d.ts +2 -0
- package/src/tools/wait.ts +8 -5
- package/src/tools/write.ts +17 -27
- package/src/tools/yield.ts +1 -1
- package/src/tui.d.ts +12 -0
- package/src/tui.ts +91 -9
- package/src/utils.d.ts +4 -0
- package/src/utils.ts +10 -0
package/src/native/describe.ts
CHANGED
|
@@ -132,10 +132,15 @@ export function elapsed(age: number, stopped?: boolean): NativeNode {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
136
|
-
*
|
|
135
|
+
* The key names of one key id (`"ctrl+o"` → `["ctrl", "o"]`), as `kbd` and
|
|
136
|
+
* `button` `keys` take them. A literal `+` key survives (`"+"`, `"ctrl++"`).
|
|
137
137
|
*/
|
|
138
|
-
export function
|
|
138
|
+
export function keyNames(key: string): string[] {
|
|
139
139
|
const keys = key === "+" ? ["+"] : key.endsWith("++") ? [...key.slice(0, -2).split("+"), "+"] : key.split("+");
|
|
140
|
-
return
|
|
140
|
+
return keys.filter(part => part.length > 0);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** Keycap for one key id ({@link keyNames}); the terminal draws platform glyphs. */
|
|
144
|
+
export function kbd(key: string, nodeKey?: string): NativeNode {
|
|
145
|
+
return node("kbd", { keys: keyNames(key) }, undefined, nodeKey);
|
|
141
146
|
}
|
package/src/native/node.d.ts
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* reference contract as `render()`). A component without `describe` becomes a
|
|
11
11
|
* `rows` fallback node rendered through `render(cx.cols)`.
|
|
12
12
|
*
|
|
13
|
-
* See `packages/wire/src/tsp.ts` for the wire vocabulary
|
|
14
|
-
* the Tern
|
|
15
|
-
* Stencil repository, https://docs.stencil.so/tern/protocol/) for the spec.
|
|
13
|
+
* See `packages/wire/src/tsp.ts` for the wire vocabulary; the normative spec is
|
|
14
|
+
* the Tern Surface Protocol.
|
|
16
15
|
*/
|
|
17
16
|
import type { TspEvent, TspKind, TspProps, TspScrollBy, TspSpan } from "@linxiraos/pi-wire";
|
|
18
17
|
import type { Component } from "../tui";
|
package/src/native/node.ts
CHANGED
|
@@ -10,9 +10,8 @@
|
|
|
10
10
|
* reference contract as `render()`). A component without `describe` becomes a
|
|
11
11
|
* `rows` fallback node rendered through `render(cx.cols)`.
|
|
12
12
|
*
|
|
13
|
-
* See `packages/wire/src/tsp.ts` for the wire vocabulary
|
|
14
|
-
* the Tern
|
|
15
|
-
* Stencil repository, https://docs.stencil.so/tern/protocol/) for the spec.
|
|
13
|
+
* See `packages/wire/src/tsp.ts` for the wire vocabulary; the normative spec is
|
|
14
|
+
* the Tern Surface Protocol.
|
|
16
15
|
*/
|
|
17
16
|
import type { TspEvent, TspKind, TspProps, TspScrollBy, TspSpan } from "@linxiraos/pi-wire";
|
|
18
17
|
import type { Component } from "../tui";
|
package/src/native/overlay.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Overlay chrome for `describe()`: root cards, key-hint footers,
|
|
3
|
-
* lists and annotation callouts.
|
|
2
|
+
* Overlay chrome for `describe()`: root cards, key-hint footers, buttons and
|
|
3
|
+
* segmented controls, selectable lists and annotation callouts.
|
|
4
4
|
*
|
|
5
5
|
* The overlay frame itself (glass, ring, placement) is the terminal's: the
|
|
6
6
|
* engine wraps every overlay-stack component in an `overlay` node. An overlay
|
|
@@ -53,11 +53,23 @@ export interface ActionButtonOptions {
|
|
|
53
53
|
readonly title?: string;
|
|
54
54
|
/** Target of an `open` action (URL or `file://` path). */
|
|
55
55
|
readonly href?: string;
|
|
56
|
+
/** Why the action can't run now: the button dims and a click sends nothing. */
|
|
57
|
+
readonly disabled?: string;
|
|
58
|
+
/** The button's work is running: a spinner leads the label. */
|
|
59
|
+
readonly busy?: boolean;
|
|
60
|
+
/** Icon beside the label (before it on a `button` node, after it on a row). */
|
|
61
|
+
readonly icon?: string;
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
58
64
|
* A native button (role `zeta.btn`): a label plus an optional keycap. A click
|
|
59
65
|
* sends `act` back as an `action` event (or runs a terminal-local `open`/`copy`),
|
|
60
66
|
* which the component routes to the same code path as the key.
|
|
67
|
+
*
|
|
68
|
+
* A terminal that draws the `button` kind ({@link nativeButtons}) gets one
|
|
69
|
+
* (tone `accent` → variant `primary`, `error` → `danger`, `disabled` with its
|
|
70
|
+
* reason as the tooltip); older ones get the row their stylesheets draw by
|
|
71
|
+
* role. Both keep the role and tone the omp sheets' context rules key on; a
|
|
72
|
+
* disabled button's tone is `muted`.
|
|
61
73
|
*/
|
|
62
74
|
export declare function actionButton(label: string, act: string, options?: ActionButtonOptions): NativeNode;
|
|
63
75
|
/**
|
|
@@ -65,6 +77,34 @@ export declare function actionButton(label: string, act: string, options?: Actio
|
|
|
65
77
|
* `act` (default `close`), which the component routes to its Esc path.
|
|
66
78
|
*/
|
|
67
79
|
export declare function escCloseButton(act?: string, key?: string): NativeNode;
|
|
80
|
+
/** Options of an {@link iconButton}. */
|
|
81
|
+
export interface IconButtonOptions {
|
|
82
|
+
/** Sibling identity key; unkeyed buttons take their position. */
|
|
83
|
+
readonly key?: string;
|
|
84
|
+
/** Accessible name; defaults to the title. */
|
|
85
|
+
readonly aria?: string;
|
|
86
|
+
/** A toggle that is on (role `zeta.app.ibtn.set`). */
|
|
87
|
+
readonly on?: boolean;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A quiet icon-only button (role `zeta.app.ibtn`, the kit's icon button) for an
|
|
91
|
+
* app head or toolbar: a `button` node where the terminal draws one
|
|
92
|
+
* ({@link nativeButtons}), else an `icon` with a click action.
|
|
93
|
+
*/
|
|
94
|
+
export declare function iconButton(name: string, act: string, title: string, options?: IconButtonOptions): NativeNode;
|
|
95
|
+
/**
|
|
96
|
+
* A quiet text button (role `zeta.app.qbtn`, the kit's quiet button) for a
|
|
97
|
+
* section head or toolbar, keyed by its action: a small quiet `button` where
|
|
98
|
+
* the terminal draws one ({@link nativeButtons}), else a row.
|
|
99
|
+
*/
|
|
100
|
+
export declare function quietButton(label: string, act: string, title: string): NativeNode;
|
|
101
|
+
/**
|
|
102
|
+
* A segmented control: `tabs` drawn as a well with a raised thumb on the
|
|
103
|
+
* active tab. A terminal that draws the `button` kind ({@link nativeButtons})
|
|
104
|
+
* draws `variant: "segmented"` too; older ones restyle the tabs by role
|
|
105
|
+
* (`zeta.app.seg`) or parent.
|
|
106
|
+
*/
|
|
107
|
+
export declare function segmentedTabs(p: TspProps<"tabs">, key: string): NativeNode;
|
|
68
108
|
/** A row of {@link actionButton}s (role `zeta.actions`); `null` entries become the spacer that end-aligns what follows. */
|
|
69
109
|
export declare function actionBar(buttons: readonly (NativeNode | null)[], key?: string): NativeNode;
|
|
70
110
|
/** Spans of an annotation callout: a dim `label:` then the note. */
|
package/src/native/overlay.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Overlay chrome for `describe()`: root cards, key-hint footers,
|
|
3
|
-
* lists and annotation callouts.
|
|
2
|
+
* Overlay chrome for `describe()`: root cards, key-hint footers, buttons and
|
|
3
|
+
* segmented controls, selectable lists and annotation callouts.
|
|
4
4
|
*
|
|
5
5
|
* The overlay frame itself (glass, ring, placement) is the terminal's: the
|
|
6
6
|
* engine wraps every overlay-stack component in an `overlay` node. An overlay
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
import type { TspProps, TspSpan, TspText } from "@linxiraos/pi-wire";
|
|
10
10
|
import { formatTooltipKey, type KeyName } from "../key-hint-format";
|
|
11
11
|
import { getKeybindings, type Keybinding } from "../keybindings";
|
|
12
|
-
import { card, kbd, list, node, row, span, text } from "./describe";
|
|
12
|
+
import { card, kbd, keyNames, list, node, row, span, text } from "./describe";
|
|
13
13
|
import type { NativeChild, NativeNode } from "./node";
|
|
14
|
+
import { nativeButtons } from "./state";
|
|
14
15
|
|
|
15
16
|
/** Below this many columns a centered sheet fills the pane instead of floating with margins. */
|
|
16
17
|
export const NARROW_SHEET_COLS = 100;
|
|
@@ -96,29 +97,68 @@ export interface ActionButtonOptions {
|
|
|
96
97
|
readonly title?: string;
|
|
97
98
|
/** Target of an `open` action (URL or `file://` path). */
|
|
98
99
|
readonly href?: string;
|
|
100
|
+
/** Why the action can't run now: the button dims and a click sends nothing. */
|
|
101
|
+
readonly disabled?: string;
|
|
102
|
+
/** The button's work is running: a spinner leads the label. */
|
|
103
|
+
readonly busy?: boolean;
|
|
104
|
+
/** Icon beside the label (before it on a `button` node, after it on a row). */
|
|
105
|
+
readonly icon?: string;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
108
|
/**
|
|
102
109
|
* A native button (role `zeta.btn`): a label plus an optional keycap. A click
|
|
103
110
|
* sends `act` back as an `action` event (or runs a terminal-local `open`/`copy`),
|
|
104
111
|
* which the component routes to the same code path as the key.
|
|
112
|
+
*
|
|
113
|
+
* A terminal that draws the `button` kind ({@link nativeButtons}) gets one
|
|
114
|
+
* (tone `accent` → variant `primary`, `error` → `danger`, `disabled` with its
|
|
115
|
+
* reason as the tooltip); older ones get the row their stylesheets draw by
|
|
116
|
+
* role. Both keep the role and tone the omp sheets' context rules key on; a
|
|
117
|
+
* disabled button's tone is `muted`.
|
|
105
118
|
*/
|
|
106
119
|
export function actionButton(label: string, act: string, options: ActionButtonOptions = {}): NativeNode {
|
|
107
|
-
const
|
|
108
|
-
|
|
120
|
+
const { keys, href, disabled, busy, icon } = options;
|
|
121
|
+
const title = options.title ?? (keys ? `${label} ${formatTooltipKey(keys)}` : label);
|
|
122
|
+
const tone = disabled === undefined ? options.tone : "muted";
|
|
123
|
+
const key = options.key ?? act;
|
|
124
|
+
if (nativeButtons()) {
|
|
125
|
+
return node(
|
|
126
|
+
"button",
|
|
127
|
+
{
|
|
128
|
+
role: "zeta.btn",
|
|
129
|
+
text: label,
|
|
130
|
+
actions: { click: act },
|
|
131
|
+
title,
|
|
132
|
+
...(keys ? { keys: keyNames(keys) } : {}),
|
|
133
|
+
...(icon ? { icon } : {}),
|
|
134
|
+
...(tone === "accent" ? { variant: "primary" } : tone === "error" ? { variant: "danger" } : {}),
|
|
135
|
+
...(tone ? { tone } : {}),
|
|
136
|
+
...(disabled !== undefined ? { disabled: disabled || true } : {}),
|
|
137
|
+
...(busy ? { busy } : {}),
|
|
138
|
+
...(href ? { href } : {}),
|
|
139
|
+
},
|
|
140
|
+
undefined,
|
|
141
|
+
key,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
const children: NativeChild[] = [];
|
|
145
|
+
if (busy) children.push(node("spinner", { style: "dots" }));
|
|
146
|
+
children.push(text(label));
|
|
147
|
+
if (icon) children.push(node("icon", { name: icon }, undefined, "icon"));
|
|
148
|
+
if (keys) children.push(kbd(keys));
|
|
109
149
|
return node(
|
|
110
150
|
"row",
|
|
111
151
|
{
|
|
112
152
|
role: "zeta.btn",
|
|
113
153
|
gap: "xs",
|
|
114
154
|
align: "center",
|
|
115
|
-
actions: { click: act },
|
|
116
|
-
title
|
|
117
|
-
...(
|
|
118
|
-
...(
|
|
155
|
+
...(disabled === undefined ? { actions: { click: act } } : {}),
|
|
156
|
+
title,
|
|
157
|
+
...(tone ? { tone } : {}),
|
|
158
|
+
...(href ? { href } : {}),
|
|
119
159
|
},
|
|
120
160
|
children,
|
|
121
|
-
|
|
161
|
+
key,
|
|
122
162
|
);
|
|
123
163
|
}
|
|
124
164
|
|
|
@@ -127,12 +167,80 @@ export function actionButton(label: string, act: string, options: ActionButtonOp
|
|
|
127
167
|
* `act` (default `close`), which the component routes to its Esc path.
|
|
128
168
|
*/
|
|
129
169
|
export function escCloseButton(act = "close", key = "esc-close"): NativeNode {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
170
|
+
const title = `Close ${formatTooltipKey("escape")}`;
|
|
171
|
+
if (nativeButtons()) {
|
|
172
|
+
return node(
|
|
173
|
+
"button",
|
|
174
|
+
{ role: "zeta.btn", keys: ["escape"], actions: { click: act }, title, aria: "Close" },
|
|
175
|
+
undefined,
|
|
176
|
+
key,
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
return node("row", { role: "zeta.btn", align: "center", actions: { click: act }, title }, [kbd("escape")], key);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Options of an {@link iconButton}. */
|
|
183
|
+
export interface IconButtonOptions {
|
|
184
|
+
/** Sibling identity key; unkeyed buttons take their position. */
|
|
185
|
+
readonly key?: string;
|
|
186
|
+
/** Accessible name; defaults to the title. */
|
|
187
|
+
readonly aria?: string;
|
|
188
|
+
/** A toggle that is on (role `zeta.app.ibtn.set`). */
|
|
189
|
+
readonly on?: boolean;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* A quiet icon-only button (role `zeta.app.ibtn`, the kit's icon button) for an
|
|
194
|
+
* app head or toolbar: a `button` node where the terminal draws one
|
|
195
|
+
* ({@link nativeButtons}), else an `icon` with a click action.
|
|
196
|
+
*/
|
|
197
|
+
export function iconButton(name: string, act: string, title: string, options: IconButtonOptions = {}): NativeNode {
|
|
198
|
+
const role = options.on ? "zeta.app.ibtn.set" : "zeta.app.ibtn";
|
|
199
|
+
const aria = options.aria ?? title;
|
|
200
|
+
if (nativeButtons()) {
|
|
201
|
+
return node(
|
|
202
|
+
"button",
|
|
203
|
+
{
|
|
204
|
+
role,
|
|
205
|
+
variant: "quiet",
|
|
206
|
+
icon: name,
|
|
207
|
+
title,
|
|
208
|
+
aria,
|
|
209
|
+
actions: { click: act },
|
|
210
|
+
...(options.on ? { on: true } : {}),
|
|
211
|
+
},
|
|
212
|
+
undefined,
|
|
213
|
+
options.key,
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
return node("icon", { name, role, title, aria, actions: { click: act } }, undefined, options.key);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* A quiet text button (role `zeta.app.qbtn`, the kit's quiet button) for a
|
|
221
|
+
* section head or toolbar, keyed by its action: a small quiet `button` where
|
|
222
|
+
* the terminal draws one ({@link nativeButtons}), else a row.
|
|
223
|
+
*/
|
|
224
|
+
export function quietButton(label: string, act: string, title: string): NativeNode {
|
|
225
|
+
if (nativeButtons()) {
|
|
226
|
+
return node(
|
|
227
|
+
"button",
|
|
228
|
+
{ role: "zeta.app.qbtn", variant: "quiet", size: "sm", text: label, actions: { click: act }, title },
|
|
229
|
+
undefined,
|
|
230
|
+
act,
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
return node("row", { role: "zeta.app.qbtn", actions: { click: act }, title }, [text(label)], act);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* A segmented control: `tabs` drawn as a well with a raised thumb on the
|
|
238
|
+
* active tab. A terminal that draws the `button` kind ({@link nativeButtons})
|
|
239
|
+
* draws `variant: "segmented"` too; older ones restyle the tabs by role
|
|
240
|
+
* (`zeta.app.seg`) or parent.
|
|
241
|
+
*/
|
|
242
|
+
export function segmentedTabs(p: TspProps<"tabs">, key: string): NativeNode {
|
|
243
|
+
return node("tabs", nativeButtons() ? { ...p, variant: "segmented" } : p, undefined, key);
|
|
136
244
|
}
|
|
137
245
|
|
|
138
246
|
/** A row of {@link actionButton}s (role `zeta.actions`); `null` entries become the spacer that end-aligns what follows. */
|
package/src/native/state.d.ts
CHANGED
|
@@ -2,5 +2,9 @@
|
|
|
2
2
|
export declare function isNativeRendering(): boolean;
|
|
3
3
|
/** Called by the native backend on surface open and close. */
|
|
4
4
|
export declare function setNativeRendering(on: boolean): void;
|
|
5
|
+
/** Whether omp's buttons go out as `button` nodes (see {@link setNativeButtons}). */
|
|
6
|
+
export declare function nativeButtons(): boolean;
|
|
7
|
+
/** Called by the native backend when it adopts a `hello` reply and when it stops. */
|
|
8
|
+
export declare function setNativeButtons(on: boolean): void;
|
|
5
9
|
/** Call `listener` whenever native rendering starts or stops; returns the unsubscribe. */
|
|
6
10
|
export declare function onNativeRenderingChange(listener: (on: boolean) => void): () => void;
|
package/src/native/state.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Process-wide
|
|
2
|
+
* Process-wide native rendering state, set only by the native backend.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Whether a Tern Surface Protocol backend is rendering: components that
|
|
5
|
+
* animate by re-rendering on a timer (spinners, shimmer, thinking frames,
|
|
6
|
+
* countdowns) check it and skip scheduling, because the terminal clocks
|
|
7
|
+
* motion from the described nodes. Set when a surface opens and cleared when
|
|
8
|
+
* it closes.
|
|
8
9
|
*/
|
|
9
10
|
let active = false;
|
|
10
11
|
const listeners = new Set<(on: boolean) => void>();
|
|
@@ -21,6 +22,25 @@ export function setNativeRendering(on: boolean): void {
|
|
|
21
22
|
for (const listener of listeners) listener(on);
|
|
22
23
|
}
|
|
23
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Whether the live terminal draws the `button` kind (its `hello` lists it),
|
|
27
|
+
* and with it `tabs` `variant: "segmented"`. The button builders
|
|
28
|
+
* (`native/overlay.ts`) read it; older Terns get the `row` buttons they style
|
|
29
|
+
* by role. Set only by the native backend from the `hello` it adopts; false
|
|
30
|
+
* while no surface is live.
|
|
31
|
+
*/
|
|
32
|
+
let buttons = false;
|
|
33
|
+
|
|
34
|
+
/** Whether omp's buttons go out as `button` nodes (see {@link setNativeButtons}). */
|
|
35
|
+
export function nativeButtons(): boolean {
|
|
36
|
+
return buttons;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** Called by the native backend when it adopts a `hello` reply and when it stops. */
|
|
40
|
+
export function setNativeButtons(on: boolean): void {
|
|
41
|
+
buttons = on;
|
|
42
|
+
}
|
|
43
|
+
|
|
24
44
|
/** Call `listener` whenever native rendering starts or stops; returns the unsubscribe. */
|
|
25
45
|
export function onNativeRenderingChange(listener: (on: boolean) => void): () => void {
|
|
26
46
|
listeners.add(listener);
|
|
@@ -18,7 +18,10 @@ import {
|
|
|
18
18
|
getBtwLatestTurn,
|
|
19
19
|
getBtwTopicLabel,
|
|
20
20
|
getBtwTurns,
|
|
21
|
+
type BtwInjectParts,
|
|
22
|
+
splitBtwInject,
|
|
21
23
|
} from "./btw-history";
|
|
24
|
+
import { BtwInjectAnswer, type BtwInjectState, describeBtwInjectAnswer } from "./btw-inject";
|
|
22
25
|
import { compactImageMarkers, formatVisionMarker } from "../prompt/composer-attachments";
|
|
23
26
|
import { extractImagePastePathsFromText } from "../prompt/custom-editor";
|
|
24
27
|
import { BracketedPasteHandler } from "../bracketed-paste";
|
|
@@ -29,6 +32,8 @@ import {
|
|
|
29
32
|
matchesSelectPageDown,
|
|
30
33
|
matchesSelectPageUp,
|
|
31
34
|
matchesSelectUp,
|
|
35
|
+
appBtwInjectKey,
|
|
36
|
+
matchesAppBtwInject,
|
|
32
37
|
} from "../keybinding-matchers";
|
|
33
38
|
import type { SpaceHoldHandler } from "../space-hold";
|
|
34
39
|
import { sanitizeErrorLine } from "../chrome/error-block";
|
|
@@ -77,6 +82,25 @@ interface BtwHistoryPanelOptions {
|
|
|
77
82
|
* first. For a host with no inline panel to fall back to (Tern).
|
|
78
83
|
*/
|
|
79
84
|
escapeHides?: boolean;
|
|
85
|
+
/** `btw.inject` hooks, given only while it is on for this view. */
|
|
86
|
+
inject?: BtwHistoryInject;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface BtwHistoryInject {
|
|
90
|
+
/**
|
|
91
|
+
* How a finished turn's closed `<inject>` block shows: apart from its prose while pending or
|
|
92
|
+
* sent, plain text when `undefined`. A streaming turn always shows its block.
|
|
93
|
+
*/
|
|
94
|
+
state: (record: BtwHistoryRecord, turnIndex: number) => BtwInjectState | undefined;
|
|
95
|
+
/** Whether the inject key may send the record's latest block now. */
|
|
96
|
+
canSend: (record: BtwHistoryRecord) => boolean;
|
|
97
|
+
send: (record: BtwHistoryRecord) => void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/** A turn's `<inject>` block as displayed apart from its prose. */
|
|
101
|
+
interface InjectBlock {
|
|
102
|
+
parts: BtwInjectParts;
|
|
103
|
+
state: BtwInjectState;
|
|
80
104
|
}
|
|
81
105
|
|
|
82
106
|
interface FollowUpComposer {
|
|
@@ -95,6 +119,8 @@ interface RenderedTurn {
|
|
|
95
119
|
turn: BtwHistoryTurn;
|
|
96
120
|
question: Markdown;
|
|
97
121
|
answer: Markdown;
|
|
122
|
+
/** How the answer's `<inject>` block showed; `undefined` when it rendered as plain text. */
|
|
123
|
+
block: BtwInjectState | undefined;
|
|
98
124
|
lines: readonly string[];
|
|
99
125
|
width: number;
|
|
100
126
|
}
|
|
@@ -110,6 +136,8 @@ interface BtwHistoryNativeMemo {
|
|
|
110
136
|
followUpPending: boolean;
|
|
111
137
|
canFollowUp: boolean;
|
|
112
138
|
copied: boolean;
|
|
139
|
+
canInject: boolean;
|
|
140
|
+
latestInject: BtwInjectState | undefined;
|
|
113
141
|
scroll: NativeScroll | undefined;
|
|
114
142
|
node: NativeNode;
|
|
115
143
|
}
|
|
@@ -150,6 +178,7 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
150
178
|
#listScroll = 0;
|
|
151
179
|
#listHeight = 1;
|
|
152
180
|
#focused = false;
|
|
181
|
+
#useTerminalCursor = false;
|
|
153
182
|
#composer: FollowUpComposer | undefined;
|
|
154
183
|
readonly #pasteHandler = new BracketedPasteHandler();
|
|
155
184
|
#followUpPending = false;
|
|
@@ -225,6 +254,12 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
225
254
|
this.#focused = value;
|
|
226
255
|
}
|
|
227
256
|
|
|
257
|
+
/** Keep the follow-up input's cursor mode aligned so the hardware cursor (and IME preedit) lands on its caret. */
|
|
258
|
+
setUseTerminalCursor(useTerminalCursor: boolean): void {
|
|
259
|
+
this.#useTerminalCursor = useTerminalCursor;
|
|
260
|
+
this.#composer?.input.setUseTerminalCursor(useTerminalCursor);
|
|
261
|
+
}
|
|
262
|
+
|
|
228
263
|
update(records: readonly BtwHistoryRecord[]): void {
|
|
229
264
|
this.#records = records;
|
|
230
265
|
this.#detailDirty = true;
|
|
@@ -329,6 +364,7 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
329
364
|
const input = new Input();
|
|
330
365
|
input.prompt = theme.fg("accent", "Follow up: ");
|
|
331
366
|
input.placeholder = "Ask about this answer…";
|
|
367
|
+
input.setUseTerminalCursor(this.#useTerminalCursor);
|
|
332
368
|
if (this.#options.spaceHoldKeys !== undefined) input.spaceHold.keys = this.#options.spaceHoldKeys;
|
|
333
369
|
input.spaceHold.handler = this.#options.spaceHold?.(input);
|
|
334
370
|
const composer: FollowUpComposer = {
|
|
@@ -504,6 +540,10 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
504
540
|
if (record && getBtwCopyText(record) !== undefined) this.#options.onCopy(record);
|
|
505
541
|
return;
|
|
506
542
|
}
|
|
543
|
+
if (this.#options.inject && matchesAppBtwInject(data)) {
|
|
544
|
+
this.#sendInject(record);
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
507
547
|
// Legacy terminals deliver Ctrl+/ (and Ctrl+_) as US without Kitty protocol.
|
|
508
548
|
if (
|
|
509
549
|
matchesKey(data, "tab") ||
|
|
@@ -568,6 +608,8 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
568
608
|
const composer = this.#composer;
|
|
569
609
|
const canFollowUp = record !== undefined && this.#canFollowUp(record);
|
|
570
610
|
const copied = record !== undefined && this.#isCopied(record);
|
|
611
|
+
const canInject = record !== undefined && this.#options.inject?.canSend(record) === true;
|
|
612
|
+
const latestInject = record && this.#options.inject?.state(record, getBtwTurns(record).length - 1);
|
|
571
613
|
const memo = this.#native;
|
|
572
614
|
if (
|
|
573
615
|
memo?.records === this.#records &&
|
|
@@ -579,6 +621,8 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
579
621
|
memo.followUpPending === this.#followUpPending &&
|
|
580
622
|
memo.canFollowUp === canFollowUp &&
|
|
581
623
|
memo.copied === copied &&
|
|
624
|
+
memo.canInject === canInject &&
|
|
625
|
+
memo.latestInject === latestInject &&
|
|
582
626
|
memo.scroll === this.#scroll
|
|
583
627
|
) {
|
|
584
628
|
return memo.node;
|
|
@@ -604,7 +648,7 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
604
648
|
} else {
|
|
605
649
|
children.push(this.#describeEmpty());
|
|
606
650
|
}
|
|
607
|
-
children.push(this.#describeActions(record, canFollowUp, copied));
|
|
651
|
+
children.push(this.#describeActions(record, canFollowUp, copied, canInject));
|
|
608
652
|
// The sheet is the frame (`nativeOverlay`); its last row is the pinned footer.
|
|
609
653
|
const described = col(children, { gap: "none" });
|
|
610
654
|
this.#native = {
|
|
@@ -617,6 +661,8 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
617
661
|
followUpPending: this.#followUpPending,
|
|
618
662
|
canFollowUp,
|
|
619
663
|
copied,
|
|
664
|
+
canInject,
|
|
665
|
+
latestInject,
|
|
620
666
|
scroll: this.#scroll,
|
|
621
667
|
node: described,
|
|
622
668
|
};
|
|
@@ -633,6 +679,9 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
633
679
|
case "copy-answer":
|
|
634
680
|
if (record && getBtwCopyText(record) !== undefined) this.#options.onCopy(record);
|
|
635
681
|
break;
|
|
682
|
+
case "inject":
|
|
683
|
+
this.#sendInject(record);
|
|
684
|
+
break;
|
|
636
685
|
case "follow-up":
|
|
637
686
|
if (record) this.openFollowUp(record.id);
|
|
638
687
|
break;
|
|
@@ -690,12 +739,31 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
690
739
|
/** The selected side question as a short document: the asked question titles each answer. */
|
|
691
740
|
#describeThread(record: BtwHistoryRecord): NativeNode {
|
|
692
741
|
const turns = getDisplayTurns(record);
|
|
693
|
-
const children: NativeChild[] = turns.map((turn, index) =>
|
|
742
|
+
const children: NativeChild[] = turns.map((turn, index) =>
|
|
743
|
+
this.#describeTurn(turn, index, `turn-${index}`, this.#injectBlock(record, turn, index)),
|
|
744
|
+
);
|
|
694
745
|
if (this.#composer) children.push(this.#describeComposer(this.#composer));
|
|
695
746
|
return node("col", { role: "zeta.btw.thread" }, children, "thread");
|
|
696
747
|
}
|
|
697
748
|
|
|
698
|
-
#
|
|
749
|
+
#sendInject(record: BtwHistoryRecord | undefined): void {
|
|
750
|
+
const inject = this.#options.inject;
|
|
751
|
+
if (!record || !inject?.canSend(record)) return;
|
|
752
|
+
inject.send(record);
|
|
753
|
+
this.#detailDirty = true;
|
|
754
|
+
this.#options.requestRender();
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
/** The turn's `<inject>` block to show apart from its prose, if any (see {@link BtwHistoryInject.state}). */
|
|
758
|
+
#injectBlock(record: BtwHistoryRecord, turn: BtwHistoryTurn, index: number): InjectBlock | undefined {
|
|
759
|
+
const inject = this.#options.inject;
|
|
760
|
+
const parts = inject ? splitBtwInject(turn.answer) : undefined;
|
|
761
|
+
if (!inject || !parts) return undefined;
|
|
762
|
+
const state = turn.status === "running" ? "pending" : parts.closed ? inject.state(record, index) : undefined;
|
|
763
|
+
return state && { parts, state };
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
#describeTurn(turn: BtwHistoryTurn, index: number, key: string, block: InjectBlock | undefined): NativeNode {
|
|
699
767
|
const meta: TspSpan[] =
|
|
700
768
|
index === 0
|
|
701
769
|
? [span(this.#dateFormat.format(turn.createdAt))]
|
|
@@ -709,11 +777,12 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
709
777
|
];
|
|
710
778
|
// A failed turn with no text says only why it failed.
|
|
711
779
|
if (turn.answer.trim() || !turn.error) {
|
|
712
|
-
const
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
})
|
|
780
|
+
const stream = turn.status === "running";
|
|
781
|
+
const answer = block
|
|
782
|
+
? describeBtwInjectAnswer(block.parts, block.state === "sent", stream)
|
|
783
|
+
: turn.answer.trim()
|
|
784
|
+
? md(sanitizeDisplayText(turn.answer), { stream })
|
|
785
|
+
: text([span(stream ? "Thinking…" : "No answer text.", "dim")], { role: "zeta.btw.pending" });
|
|
717
786
|
children.push(node("col", { role: "zeta.btw.answer" }, [answer], "answer"));
|
|
718
787
|
}
|
|
719
788
|
if (turn.error) {
|
|
@@ -764,7 +833,12 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
764
833
|
* primary action (Follow up, or Send while composing) in the corner. Keys
|
|
765
834
|
* live in the buttons' tooltips.
|
|
766
835
|
*/
|
|
767
|
-
#describeActions(
|
|
836
|
+
#describeActions(
|
|
837
|
+
record: BtwHistoryRecord | undefined,
|
|
838
|
+
canFollowUp: boolean,
|
|
839
|
+
copied: boolean,
|
|
840
|
+
canInject: boolean,
|
|
841
|
+
): NativeNode {
|
|
768
842
|
if (this.#composer) {
|
|
769
843
|
return actionBar([
|
|
770
844
|
null,
|
|
@@ -776,6 +850,7 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
776
850
|
const hides = this.#options.escapeHides === true;
|
|
777
851
|
const buttons: (NativeNode | null)[] = [];
|
|
778
852
|
if (running) buttons.push(actionButton("Stop answer", "stop", { keys: hides ? "x" : "escape" }));
|
|
853
|
+
if (canInject) buttons.push(actionButton("Inject into main", "inject", { keys: appBtwInjectKey() }));
|
|
779
854
|
if (record && getBtwCopyText(record) !== undefined) {
|
|
780
855
|
buttons.push(actionButton(copied ? "Copy again" : "Copy answer", "copy-answer", { keys: "c" }));
|
|
781
856
|
if (copied) buttons.push(text([span("✓ Copied", "success")], { role: "zeta.btw.copied" }));
|
|
@@ -839,7 +914,12 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
839
914
|
});
|
|
840
915
|
}
|
|
841
916
|
|
|
842
|
-
#renderTurn(
|
|
917
|
+
#renderTurn(
|
|
918
|
+
turn: BtwHistoryTurn,
|
|
919
|
+
cached: RenderedTurn | undefined,
|
|
920
|
+
width: number,
|
|
921
|
+
block: InjectBlock | undefined,
|
|
922
|
+
): RenderedTurn {
|
|
843
923
|
const previous = cached?.turn;
|
|
844
924
|
if (
|
|
845
925
|
cached &&
|
|
@@ -848,14 +928,16 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
848
928
|
turn.answer === previous?.answer &&
|
|
849
929
|
turn.status === previous?.status &&
|
|
850
930
|
turn.error === previous?.error &&
|
|
851
|
-
turn.createdAt === previous?.createdAt
|
|
931
|
+
turn.createdAt === previous?.createdAt &&
|
|
932
|
+
block?.state === cached.block
|
|
852
933
|
) {
|
|
853
934
|
return cached;
|
|
854
935
|
}
|
|
855
936
|
const question = cached?.question ?? new Markdown("", 0, 0, getMarkdownTheme());
|
|
856
937
|
const answer = cached?.answer ?? new Markdown("", 0, 0, getMarkdownTheme());
|
|
857
938
|
if (turn.question !== previous?.question) question.setText(sanitizeDisplayText(turn.question));
|
|
858
|
-
|
|
939
|
+
// A block's state can change while the answer stays the same, so the plain text is reset on every miss.
|
|
940
|
+
if (!block) answer.setText(sanitizeDisplayText(turn.answer));
|
|
859
941
|
const status = STATUS[turn.status];
|
|
860
942
|
const lines = [
|
|
861
943
|
...wrapTextWithAnsi(
|
|
@@ -868,7 +950,8 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
868
950
|
"",
|
|
869
951
|
theme.bold(theme.fg("accent", "Answer")),
|
|
870
952
|
];
|
|
871
|
-
if (
|
|
953
|
+
if (block) lines.push(...new BtwInjectAnswer(block.parts, block.state === "sent").render(width));
|
|
954
|
+
else if (turn.answer.trim()) lines.push(...answer.render(width));
|
|
872
955
|
else
|
|
873
956
|
lines.push(
|
|
874
957
|
...wrapTextWithAnsi(
|
|
@@ -890,6 +973,7 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
890
973
|
},
|
|
891
974
|
question,
|
|
892
975
|
answer,
|
|
976
|
+
block: block?.state,
|
|
893
977
|
lines,
|
|
894
978
|
width,
|
|
895
979
|
};
|
|
@@ -907,7 +991,12 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
907
991
|
if (record) {
|
|
908
992
|
const turns = getDisplayTurns(record);
|
|
909
993
|
for (let index = 0; index < turns.length; index++) {
|
|
910
|
-
const cached = this.#renderTurn(
|
|
994
|
+
const cached = this.#renderTurn(
|
|
995
|
+
turns[index]!,
|
|
996
|
+
this.#turns[index],
|
|
997
|
+
inner,
|
|
998
|
+
this.#injectBlock(record, turns[index]!, index),
|
|
999
|
+
);
|
|
911
1000
|
this.#turns[index] = cached;
|
|
912
1001
|
if (index > 0) lines.push("", theme.fg("dim", theme.boxRound.horizontal.repeat(inner)), "");
|
|
913
1002
|
lines.push(...cached.lines);
|
|
@@ -967,6 +1056,9 @@ export class BtwHistoryPanel implements Component, Focusable {
|
|
|
967
1056
|
];
|
|
968
1057
|
if (!composer) {
|
|
969
1058
|
if (record && this.#canFollowUp(record)) actions.push(rawKeyHint(["f", "enter"], "follow up"));
|
|
1059
|
+
const injectKey = appBtwInjectKey();
|
|
1060
|
+
if (injectKey && record && this.#options.inject?.canSend(record))
|
|
1061
|
+
actions.push(rawKeyHint(injectKey, "inject"));
|
|
970
1062
|
if (record && getBtwCopyText(record) !== undefined) {
|
|
971
1063
|
if (this.#isCopied(record))
|
|
972
1064
|
actions.push(theme.fg("success", `✓ copied · ${formatKeyHint("c")} to copy again`));
|