@aragon-agent/cli 0.6.7 → 0.6.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 +27 -0
- package/README.md +107 -77
- package/dist/agent/controller.d.ts +11 -7
- package/dist/agent/controller.js +35 -48
- package/dist/agent/headless.d.ts +2 -1
- package/dist/agent/prompt-options.d.ts +15 -0
- package/dist/agent/prompt-options.js +1 -0
- package/dist/agent/reducer.d.ts +7 -113
- package/dist/agent/reducer.js +0 -62
- package/dist/cli.js +111 -182
- package/dist/commands/builtins.js +3 -1
- package/dist/commands/perf.d.ts +32 -2
- package/dist/commands/perf.js +32 -2
- package/dist/commands/registry.d.ts +4 -5
- package/dist/config/env.js +0 -130
- package/dist/config/load.d.ts +0 -2
- package/dist/config/load.js +2 -31
- package/dist/config/schema.d.ts +1 -14
- package/dist/config/schema.js +0 -1
- package/dist/config/store.js +2 -0
- package/dist/input/interrupt-gesture.d.ts +18 -0
- package/dist/input/interrupt-gesture.js +19 -0
- package/dist/input/pointer-router.d.ts +11 -0
- package/dist/input/pointer-router.js +14 -0
- package/dist/logging/install.d.ts +2 -2
- package/dist/logging/install.js +2 -2
- package/dist/todo/follow-through.d.ts +0 -4
- package/dist/todo/follow-through.js +0 -4
- package/dist/todo/limits.d.ts +0 -10
- package/dist/todo/limits.js +0 -10
- package/dist/todo/prompt.d.ts +0 -15
- package/dist/todo/store.d.ts +8 -13
- package/dist/todo/store.js +13 -14
- package/dist/todo/types.d.ts +2 -1
- package/dist/ui/ActivityLine.d.ts +26 -34
- package/dist/ui/ActivityLine.js +30 -19
- package/dist/ui/App.d.ts +3 -41
- package/dist/ui/App.js +223 -247
- package/dist/ui/BottomStatusRow.d.ts +1 -3
- package/dist/ui/BottomStatusRow.js +4 -8
- package/dist/ui/Composer.d.ts +38 -5
- package/dist/ui/Composer.js +45 -23
- package/dist/ui/Header.d.ts +2 -16
- package/dist/ui/Header.js +3 -18
- package/dist/ui/Logo.d.ts +1 -17
- package/dist/ui/Logo.js +0 -16
- package/dist/ui/ModeChip.d.ts +7 -18
- package/dist/ui/ModeChip.js +9 -0
- package/dist/ui/PromptCaret.d.ts +11 -0
- package/dist/ui/PromptCaret.js +31 -0
- package/dist/ui/PromptInput.d.ts +10 -33
- package/dist/ui/PromptInput.js +37 -20
- package/dist/ui/StatusBar.d.ts +1 -11
- package/dist/ui/StatusBar.js +14 -8
- package/dist/ui/ToastStack.d.ts +2 -18
- package/dist/ui/ToastStack.js +4 -11
- package/dist/ui/Transcript.d.ts +5 -71
- package/dist/ui/Transcript.js +10 -199
- package/dist/ui/composer-rows.js +50 -9
- package/dist/ui/entries/AssistantEntry.d.ts +0 -23
- package/dist/ui/entries/AssistantEntry.js +3 -4
- package/dist/ui/entries/DiffView.d.ts +1 -7
- package/dist/ui/entries/DiffView.js +2 -2
- package/dist/ui/entries/ToolCard.d.ts +0 -6
- package/dist/ui/entries/ToolCard.js +4 -13
- package/dist/ui/frame-differ.d.ts +13 -0
- package/dist/ui/frame-differ.js +37 -24
- package/dist/ui/frame-observer.d.ts +17 -0
- package/dist/ui/frame-observer.js +81 -0
- package/dist/ui/frame-parser.d.ts +7 -0
- package/dist/ui/frame-parser.js +18 -0
- package/dist/ui/ink-runtime.d.ts +1 -0
- package/dist/ui/ink-runtime.js +21 -0
- package/dist/ui/layout/AppShell.d.ts +4 -58
- package/dist/ui/layout/AppShell.js +3 -6
- package/dist/ui/layout/OverlayFrame.d.ts +1 -25
- package/dist/ui/layout/OverlayFrame.js +0 -24
- package/dist/ui/layout/ScrollIndicator.d.ts +4 -3
- package/dist/ui/layout/ScrollIndicator.js +4 -4
- package/dist/ui/layout/ScrollViewport.d.ts +16 -66
- package/dist/ui/layout/ScrollViewport.js +195 -185
- package/dist/ui/layout/budget.d.ts +3 -51
- package/dist/ui/layout/budget.js +4 -53
- package/dist/ui/layout/document-layout.d.ts +13 -0
- package/dist/ui/layout/document-layout.js +11 -0
- package/dist/ui/layout/follow-state.d.ts +1 -0
- package/dist/ui/layout/follow-state.js +1 -3
- package/dist/ui/layout/frame.d.ts +0 -22
- package/dist/ui/layout/frame.js +0 -36
- package/dist/ui/layout/scroll-indicator.d.ts +1 -1
- package/dist/ui/layout/scroll-indicator.js +3 -2
- package/dist/ui/layout/scrollbar-geometry.d.ts +17 -0
- package/dist/ui/layout/scrollbar-geometry.js +13 -0
- package/dist/ui/layout/todo-layout.d.ts +2 -3
- package/dist/ui/layout/todo-layout.js +9 -9
- package/dist/ui/layout/viewport-geometry.d.ts +2 -1
- package/dist/ui/layout/viewport-geometry.js +2 -1
- package/dist/ui/layout/virtual-window.d.ts +1 -0
- package/dist/ui/layout/virtual-window.js +1 -1
- package/dist/ui/live-clamp.d.ts +1 -29
- package/dist/ui/live-clamp.js +1 -29
- package/dist/ui/overlays/HelpOverlay.js +6 -2
- package/dist/ui/run-status-row.d.ts +61 -0
- package/dist/ui/run-status-row.js +70 -0
- package/dist/ui/screen.d.ts +1 -1
- package/dist/ui/screen.js +4 -6
- package/dist/ui/scrollbar-controller.d.ts +30 -0
- package/dist/ui/scrollbar-controller.js +124 -0
- package/dist/ui/transcript-text.d.ts +0 -8
- package/dist/ui/transcript-text.js +0 -8
- package/dist/ui/use-startup-notices.d.ts +1 -57
- package/dist/ui/use-startup-notices.js +3 -54
- package/dist/ui/use-wheel-routing.d.ts +3 -1
- package/dist/ui/use-wheel-routing.js +6 -0
- package/package.json +2 -2
- package/dist/ui/TodoStrip.d.ts +0 -36
- package/dist/ui/TodoStrip.js +0 -32
|
@@ -40,53 +40,7 @@ export declare const MOUSE_NOTICE_VERSION = 1;
|
|
|
40
40
|
* that offered only `/plan`, recorded back when this was a boolean.
|
|
41
41
|
*/
|
|
42
42
|
export declare const VT_INPUT_NOTICE_VERSION = 1;
|
|
43
|
-
|
|
44
|
-
* The `shift-tab-and-mouse-wheel-dead-on-some-terminals` notice (F1'). Shown at
|
|
45
|
-
* most once per `VT_INPUT_NOTICE_VERSION`, and only on a Windows console that
|
|
46
|
-
* cannot deliver either input — see `ui/win-vt-input.ts` for why that is a
|
|
47
|
-
* property of the Node version rather than of the terminal.
|
|
48
|
-
*
|
|
49
|
-
* IT NAMES WHAT THE KEY DOES NOW, not merely that it is unavailable, and that
|
|
50
|
-
* is the load-bearing half of the text. `Shift+Tab` on these machines is not
|
|
51
|
-
* inert: the modifier is lost inside libuv, so Ink sees an ordinary `Tab` and
|
|
52
|
-
* the `/` palette or an `@` popup completes its selection over the user's
|
|
53
|
-
* draft. A user told only "this key does not work" keeps pressing it and keeps
|
|
54
|
-
* losing text without ever connecting the two.
|
|
55
|
-
*
|
|
56
|
-
* THE FALLBACK KEY COMES BEFORE `/plan` IN BOTH BRANCHES, and it is named from
|
|
57
|
-
* `MODE_TOGGLE_KEYS` rather than spelled out, so the four consumers of that
|
|
58
|
-
* constant cannot drift apart. This notice is the last one of them to be wired
|
|
59
|
-
* up, and it is also the only channel that reaches the affected user without
|
|
60
|
-
* being asked to: the composer hint does not exist at all in inline mode and is
|
|
61
|
-
* switched off by a short terminal or `hints: false` in full-screen, and
|
|
62
|
-
* `/help` has to be typed by someone whose current belief is "the key does
|
|
63
|
-
* nothing" rather than "I should read the help". Ordering follows cost — one
|
|
64
|
-
* keystroke before four and a return.
|
|
65
|
-
*
|
|
66
|
-
* `Shift+Up` / `Shift+Down` is the scroll workaround named here because it is
|
|
67
|
-
* the only one PROVEN to survive: both Node versions emit `\x1b[1;2A` for it,
|
|
68
|
-
* byte for byte, in the probe data. `PgUp` / `PgDn` is expected to work too but
|
|
69
|
-
* was never injected, so it is left out rather than promised.
|
|
70
|
-
*
|
|
71
|
-
* THE WHEEL HALF IS FULL-SCREEN ONLY, and dropping it inline is not a detail.
|
|
72
|
-
* `Shift+Tab` is broken in both modes — the modifier dies inside libuv, well
|
|
73
|
-
* below anything this app chooses — but the wheel is only ours to lose in
|
|
74
|
-
* full-screen: inline never asks the console to report it (`mode` is a conjunct
|
|
75
|
-
* of `cli.tsx::wantMouse`), so the wheel goes on scrolling the terminal's own
|
|
76
|
-
* scrollback exactly as it always has. And `Shift+Up` / `Shift+Down` are handled
|
|
77
|
-
* inside `App`'s `if (fullscreen)` branch, so recommending them inline names a
|
|
78
|
-
* key that does nothing. Telling an inline user their working wheel is dead and
|
|
79
|
-
* then handing them an inert workaround is the same failure this notice exists
|
|
80
|
-
* to end — advice about a mode that is not running — merely pointed the other
|
|
81
|
-
* way.
|
|
82
|
-
*
|
|
83
|
-
* EXPORTED FOR ITS TEST, unlike the two notices above it. Asserting this text
|
|
84
|
-
* through a rendered frame does not work: the transcript wraps a notice at two
|
|
85
|
-
* columns wider than it displays it, so any phrase landing on a wrap boundary
|
|
86
|
-
* loses a character or two on the way to `lastFrame()` and the assertion fails
|
|
87
|
-
* for a reason that has nothing to do with the text.
|
|
88
|
-
*/
|
|
89
|
-
export declare function vtInputDeadNotice(nodeVersion: string, fullscreen: boolean): string;
|
|
43
|
+
export declare function vtInputDeadNotice(nodeVersion: string): string;
|
|
90
44
|
/**
|
|
91
45
|
* `{ requested, resolved }` when the raise happened, `undefined` otherwise —
|
|
92
46
|
* i.e. `cfg.transcriptRetainRequested` and `cfg.transcriptRetain`.
|
|
@@ -132,16 +86,6 @@ export interface MouseNoticeOptions {
|
|
|
132
86
|
export interface VtInputNoticeOptions {
|
|
133
87
|
/** `process.versions.node`, quoted back so the user can act on it. */
|
|
134
88
|
nodeVersion: string;
|
|
135
|
-
/**
|
|
136
|
-
* Whether this run owns the alternate screen, i.e. `App`'s own `fullscreen`.
|
|
137
|
-
*
|
|
138
|
-
* Selects which half of the text applies: inline keeps the wheel and loses the
|
|
139
|
-
* full-screen scroll keys, so it is told about `Shift+Tab` and nothing else
|
|
140
|
-
* (see `vtInputDeadNotice`). Taken from the caller rather than re-derived here
|
|
141
|
-
* for the same reason the version is — one source, no chance of the notice and
|
|
142
|
-
* the renderer disagreeing about which mode is running.
|
|
143
|
-
*/
|
|
144
|
-
fullscreen: boolean;
|
|
145
89
|
/**
|
|
146
90
|
* Record that `VT_INPUT_NOTICE_VERSION` was shown (`state.json`). Called once,
|
|
147
91
|
* after dispatch — and it must write that constant, not `true`: the gate
|
|
@@ -80,61 +80,11 @@ function retainRaisedNotice(requested, resolved) {
|
|
|
80
80
|
* that offered only `/plan`, recorded back when this was a boolean.
|
|
81
81
|
*/
|
|
82
82
|
export const VT_INPUT_NOTICE_VERSION = 1;
|
|
83
|
-
|
|
84
|
-
* The `shift-tab-and-mouse-wheel-dead-on-some-terminals` notice (F1'). Shown at
|
|
85
|
-
* most once per `VT_INPUT_NOTICE_VERSION`, and only on a Windows console that
|
|
86
|
-
* cannot deliver either input — see `ui/win-vt-input.ts` for why that is a
|
|
87
|
-
* property of the Node version rather than of the terminal.
|
|
88
|
-
*
|
|
89
|
-
* IT NAMES WHAT THE KEY DOES NOW, not merely that it is unavailable, and that
|
|
90
|
-
* is the load-bearing half of the text. `Shift+Tab` on these machines is not
|
|
91
|
-
* inert: the modifier is lost inside libuv, so Ink sees an ordinary `Tab` and
|
|
92
|
-
* the `/` palette or an `@` popup completes its selection over the user's
|
|
93
|
-
* draft. A user told only "this key does not work" keeps pressing it and keeps
|
|
94
|
-
* losing text without ever connecting the two.
|
|
95
|
-
*
|
|
96
|
-
* THE FALLBACK KEY COMES BEFORE `/plan` IN BOTH BRANCHES, and it is named from
|
|
97
|
-
* `MODE_TOGGLE_KEYS` rather than spelled out, so the four consumers of that
|
|
98
|
-
* constant cannot drift apart. This notice is the last one of them to be wired
|
|
99
|
-
* up, and it is also the only channel that reaches the affected user without
|
|
100
|
-
* being asked to: the composer hint does not exist at all in inline mode and is
|
|
101
|
-
* switched off by a short terminal or `hints: false` in full-screen, and
|
|
102
|
-
* `/help` has to be typed by someone whose current belief is "the key does
|
|
103
|
-
* nothing" rather than "I should read the help". Ordering follows cost — one
|
|
104
|
-
* keystroke before four and a return.
|
|
105
|
-
*
|
|
106
|
-
* `Shift+Up` / `Shift+Down` is the scroll workaround named here because it is
|
|
107
|
-
* the only one PROVEN to survive: both Node versions emit `\x1b[1;2A` for it,
|
|
108
|
-
* byte for byte, in the probe data. `PgUp` / `PgDn` is expected to work too but
|
|
109
|
-
* was never injected, so it is left out rather than promised.
|
|
110
|
-
*
|
|
111
|
-
* THE WHEEL HALF IS FULL-SCREEN ONLY, and dropping it inline is not a detail.
|
|
112
|
-
* `Shift+Tab` is broken in both modes — the modifier dies inside libuv, well
|
|
113
|
-
* below anything this app chooses — but the wheel is only ours to lose in
|
|
114
|
-
* full-screen: inline never asks the console to report it (`mode` is a conjunct
|
|
115
|
-
* of `cli.tsx::wantMouse`), so the wheel goes on scrolling the terminal's own
|
|
116
|
-
* scrollback exactly as it always has. And `Shift+Up` / `Shift+Down` are handled
|
|
117
|
-
* inside `App`'s `if (fullscreen)` branch, so recommending them inline names a
|
|
118
|
-
* key that does nothing. Telling an inline user their working wheel is dead and
|
|
119
|
-
* then handing them an inert workaround is the same failure this notice exists
|
|
120
|
-
* to end — advice about a mode that is not running — merely pointed the other
|
|
121
|
-
* way.
|
|
122
|
-
*
|
|
123
|
-
* EXPORTED FOR ITS TEST, unlike the two notices above it. Asserting this text
|
|
124
|
-
* through a rendered frame does not work: the transcript wraps a notice at two
|
|
125
|
-
* columns wider than it displays it, so any phrase landing on a wrap boundary
|
|
126
|
-
* loses a character or two on the way to `lastFrame()` and the assertion fails
|
|
127
|
-
* for a reason that has nothing to do with the text.
|
|
128
|
-
*/
|
|
129
|
-
export function vtInputDeadNotice(nodeVersion, fullscreen) {
|
|
83
|
+
export function vtInputDeadNotice(nodeVersion) {
|
|
130
84
|
const cause = `Node ${nodeVersion} on Windows does not turn on the console's VT input mode, so `;
|
|
131
85
|
const cost = 'it will not switch mode, and with the / palette or an @ popup open it completes that ' +
|
|
132
86
|
'instead, overwriting your draft. ';
|
|
133
87
|
const toggle = `Press ${MODE_TOGGLE_KEYS.fallback} to switch mode instead (or /plan)`;
|
|
134
|
-
if (!fullscreen) {
|
|
135
|
-
return (`${cause}Shift+Tab never arrives: it comes through as a PLAIN TAB - ${cost}` +
|
|
136
|
-
`${toggle}. Node 22.17.0+ (or 24.2.0+) restores it.`);
|
|
137
|
-
}
|
|
138
88
|
return (`${cause}two keys never arrive: the wheel sends nothing at all, and Shift+Tab arrives ` +
|
|
139
89
|
`as a PLAIN TAB - ${cost}${toggle}, and Shift+Up / Shift+Down to scroll. ` +
|
|
140
90
|
'Node 22.17.0+ (or 24.2.0+) restores both.');
|
|
@@ -199,7 +149,6 @@ export function useStartupNotices(dispatch, mouseNotice, retainNotice, vtInputNo
|
|
|
199
149
|
const vtNoticeRef = useRef(vtInputNotice);
|
|
200
150
|
vtNoticeRef.current = vtInputNotice;
|
|
201
151
|
const vtNodeVersion = vtInputNotice?.nodeVersion;
|
|
202
|
-
const vtFullscreen = vtInputNotice?.fullscreen ?? false;
|
|
203
152
|
const vtNoticeShown = useRef(false);
|
|
204
153
|
useEffect(() => {
|
|
205
154
|
if (vtNodeVersion === undefined || vtNoticeShown.current)
|
|
@@ -210,10 +159,10 @@ export function useStartupNotices(dispatch, mouseNotice, retainNotice, vtInputNo
|
|
|
210
159
|
dispatch({
|
|
211
160
|
type: 'notice',
|
|
212
161
|
level: 'warn',
|
|
213
|
-
text: vtInputDeadNotice(vtNodeVersion
|
|
162
|
+
text: vtInputDeadNotice(vtNodeVersion),
|
|
214
163
|
});
|
|
215
164
|
vtNoticeRef.current?.onSeen();
|
|
216
|
-
}, [vtNodeVersion,
|
|
165
|
+
}, [vtNodeVersion, dispatch]);
|
|
217
166
|
// A `warn` notice rather than a toast: it is about a value the user typed, so
|
|
218
167
|
// it belongs in the transcript where it can be scrolled back to, not in a row
|
|
219
168
|
// that expires. DEPENDS ON THE TWO SCALARS, never on the options object —
|
|
@@ -30,7 +30,9 @@ import type { ScrollIntent } from './layout/scroll.js';
|
|
|
30
30
|
*/
|
|
31
31
|
export declare const OVERLAY_PAGE = 8;
|
|
32
32
|
export interface WheelRoutingOptions {
|
|
33
|
-
|
|
33
|
+
isPointerCaptured?: () => boolean;
|
|
34
|
+
isActive?: () => boolean;
|
|
35
|
+
/** Absent when mouse support is off, or on a non-TTY. */
|
|
34
36
|
mouseSource?: MouseSource;
|
|
35
37
|
/** Read at EVENT time for the routing branch, and again at FLUSH time (P1-3). */
|
|
36
38
|
getOverlay: () => Overlay | null;
|
|
@@ -61,6 +61,8 @@ export function useWheelRouting(options) {
|
|
|
61
61
|
accumulator.current = null;
|
|
62
62
|
if (!pending)
|
|
63
63
|
return;
|
|
64
|
+
if (optionsRef.current.isPointerCaptured?.() || optionsRef.current.isActive?.() === false)
|
|
65
|
+
return;
|
|
64
66
|
// P1-3: THE DECISION BELONGS AT FLUSH TIME, not at event time, because the
|
|
65
67
|
// event-time decision is the one that goes stale. `App` swaps
|
|
66
68
|
// `ScrollViewport` out for an overlay, and 16 ms is more than wide enough
|
|
@@ -93,6 +95,10 @@ export function useWheelRouting(options) {
|
|
|
93
95
|
if (event.kind !== 'wheel')
|
|
94
96
|
return;
|
|
95
97
|
const current = optionsRef.current;
|
|
98
|
+
if (current.isPointerCaptured?.() || current.isActive?.() === false) {
|
|
99
|
+
clearCoalescer();
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
96
102
|
const overlay = current.getOverlay();
|
|
97
103
|
// THE OVERLAY BRANCH IS EVALUATED FIRST AND RETURNS FOR EVERY OVERLAY IT
|
|
98
104
|
// RECOGNIZES — the same two ordering rules the keyboard handler follows,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aragon-agent/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.9",
|
|
4
4
|
"description": "AragonAgent CLI — a Claude-Code / Codex-style interactive terminal UI (TUI) on top of the @aragon-agent/core engine. Installable and runnable via npm / npx.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AragonAgent contributors",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"prepublishOnly": "npm run build"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@aragon-agent/core": "^0.2.
|
|
59
|
+
"@aragon-agent/core": "^0.2.21",
|
|
60
60
|
"chalk": "^5.6.2",
|
|
61
61
|
"cli-highlight": "^2.0.0",
|
|
62
62
|
"commander": "^12.1.0",
|
package/dist/ui/TodoStrip.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TodoStrip — the inline-mode plan surface (todo-plan-followthrough §3.7 / W2).
|
|
3
|
-
*
|
|
4
|
-
* ASCII ONLY: every glyph comes from `pickGlyphs`; a literal here bypasses the
|
|
5
|
-
* capability probe and shows mojibake on a legacy console. This file is inside
|
|
6
|
-
* the glyph scanner's scope because it is under `ui/`, NOT because of the
|
|
7
|
-
* `todo/` clause (C-4) — moving it would not move the guard rail with it.
|
|
8
|
-
*
|
|
9
|
-
* WHY A STRIP AND NOT THE RAIL. `decideRenderMode` picks inline for every pipe,
|
|
10
|
-
* every `CI=1`, every `TERM=dumb` and every terminal under 12 rows, and inline
|
|
11
|
-
* has no fixed frame to hang a column off (round 1's non-goal 4). Before this,
|
|
12
|
-
* such a session had the tool and a `todo 3/7` counter in the status bar, and no
|
|
13
|
-
* way at all to see WHICH step was running (OQ-1).
|
|
14
|
-
*
|
|
15
|
-
* WHY NOT IN THE STATUS BAR. The bar's left cluster is `flexShrink={0}` and its
|
|
16
|
-
* own comment records what happens when the row over-subscribes: Ink drops a
|
|
17
|
-
* character from EACH cluster and it renders `idl` / `? hel`. A variable-length
|
|
18
|
-
* step title cannot go there (C-7), which is what forces this into its own row.
|
|
19
|
-
*
|
|
20
|
-
* EXACTLY ONE RENDERED ROW, ALWAYS (AC-29). A strip that wrapped would push the
|
|
21
|
-
* composer down by an unpredictable number of rows on every keystroke, which is
|
|
22
|
-
* the worst possible behaviour for the mode with no frame to absorb it — hence
|
|
23
|
-
* `wrap="truncate"` inside a `flexGrow`/`flexShrink` box and no exceptions.
|
|
24
|
-
*/
|
|
25
|
-
import React from 'react';
|
|
26
|
-
import type { Theme } from './theme.js';
|
|
27
|
-
import type { TermCapabilities } from './capabilities.js';
|
|
28
|
-
import type { TodoSnapshot } from '../todo/types.js';
|
|
29
|
-
export interface TodoStripProps {
|
|
30
|
-
snapshot: TodoSnapshot;
|
|
31
|
-
/** Full terminal width; the strip spans the row in inline mode. */
|
|
32
|
-
cols: number;
|
|
33
|
-
theme: Theme;
|
|
34
|
-
caps: TermCapabilities;
|
|
35
|
-
}
|
|
36
|
-
export declare function TodoStrip({ snapshot, cols, theme, caps }: TodoStripProps): React.ReactElement;
|
package/dist/ui/TodoStrip.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from 'ink';
|
|
3
|
-
import { pickGlyphs } from './glyphs.js';
|
|
4
|
-
import { TODO_LIMITS } from '../todo/limits.js';
|
|
5
|
-
import { todoAnchorIndex } from '../todo/panel-rows.js';
|
|
6
|
-
export function TodoStrip({ snapshot, cols, theme, caps }) {
|
|
7
|
-
const glyphs = pickGlyphs(caps);
|
|
8
|
-
// THE SAME FUNCTION THE RAIL USES (R-9 / AC-30). Two surfaces that each decide
|
|
9
|
-
// for themselves which step is "current" is two surfaces that disagree, and
|
|
10
|
-
// this one is on screen in exactly the mode where the rail is not, so the
|
|
11
|
-
// disagreement would never be seen side by side and never be reported.
|
|
12
|
-
const anchor = todoAnchorIndex(snapshot.items);
|
|
13
|
-
const item = snapshot.items[anchor];
|
|
14
|
-
const active = item?.status === 'in_progress';
|
|
15
|
-
// `activeForm` while in progress, `content` otherwise — `TodoPanel`'s rule.
|
|
16
|
-
const label = item ? (active ? item.activeForm : item.content) : '';
|
|
17
|
-
// The same degradation the status bar already applies, so the two counters can
|
|
18
|
-
// never disagree about how much room they need.
|
|
19
|
-
const counter = cols >= TODO_LIMITS.statusCompactCols
|
|
20
|
-
? `todo ${snapshot.doneCount}/${snapshot.total}`
|
|
21
|
-
: `[${snapshot.doneCount}/${snapshot.total}]`;
|
|
22
|
-
const showDone = snapshot.doneCount > 0 && cols >= TODO_LIMITS.stripDoneCols;
|
|
23
|
-
return (
|
|
24
|
-
// `width` IS LOAD-BEARING, exactly as it is on `TodoPanel` and for a related
|
|
25
|
-
// reason. Inline mode has no fixed frame, so nothing upstream constrains
|
|
26
|
-
// this row: without an explicit width the flexible middle cell is sized by
|
|
27
|
-
// whatever the parent offers, and a long item overflows the terminal and
|
|
28
|
-
// WRAPS — the one thing this component exists not to do. Pinning it here
|
|
29
|
-
// makes the truncation deterministic and self-contained rather than a
|
|
30
|
-
// property of the tree above.
|
|
31
|
-
_jsxs(Box, { flexDirection: "row", width: cols, overflow: "hidden", children: [_jsx(Box, { flexShrink: 0, children: _jsx(Text, { wrap: "truncate", color: theme.accent, children: counter }) }), _jsx(Box, { flexShrink: 0, children: _jsxs(Text, { wrap: "truncate", color: theme.muted, children: [' ', glyphs.arrowRight, ' '] }) }), _jsx(Box, { flexGrow: 1, flexShrink: 1, overflow: "hidden", children: _jsx(Text, { wrap: "truncate", color: active ? theme.primary : theme.muted, bold: active, children: label }) }), showDone && (_jsx(Box, { flexShrink: 0, children: _jsxs(Text, { wrap: "truncate", color: theme.muted, children: [' ', "+", snapshot.doneCount, " done"] }) }))] }));
|
|
32
|
-
}
|