@songtonyli/dsh-cli 0.1.33 → 0.1.34
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/README.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.md +5 -4
- package/node_modules/@deepseek-ai/dsh-llm-cursor/README.zh.md +5 -4
- package/node_modules/@deepseek-ai/dsh-llm-cursor/lib/index.js +607 -63
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +2 -2
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +35 -22
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +35 -22
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +1077 -205
- package/package.json +1 -1
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/bundle/tui-app/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 97dc4bfc8054fa5738430bd04fb121bd5163bad1
|
|
6
|
+
README.zh.md: 2fc08fafcbf0b6bf1d9a1f6e51ad7ec101cc1558
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Interactive terminal mode for dsh: talk to the agent in your terminal with streamed replies, tool cards, keyboard navigation over the conversation, a full-screen
|
|
2
|
+
description: "Interactive terminal mode for dsh: talk to the agent in your terminal with streamed replies, tool cards, keyboard navigation over the conversation, a full-screen reader that reads one turn at a time, approvals, questions, slash commands, ! shell lines, @-references, attachments, and session switching."
|
|
3
3
|
kind: "package-bundle"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -40,7 +40,7 @@ On quit the app prints `dsh: session <id> saved; resume with: dsh --profile tui
|
|
|
40
40
|
|
|
41
41
|
### The screen
|
|
42
42
|
|
|
43
|
-
The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with
|
|
43
|
+
The header names the session by its title once one is generated or set, with the id beside it. The transcript grows in the terminal's own scrollback: your prompts start with `❯` on a tinted full-width band while colour is on (attachments listed under them), assistant reasoning is dim italic under a `✻ Thinking` header above the Markdown reply, and each tool call is a card with a `◆` glyph coloured by status — yellow while it runs, green once done, red on failure — the bold tool name, the presenter headline in the link blue, a loading row while it runs, and a body folded to `toolPreviewLines` rows. The card appears when the model starts the call; the result rows float out when the tool answers. An `edit` or `write` diff card frames each run of consecutive additions in a green rounded box and each run of removals in a red one, the removed rows above the added ones. A `subagent` or `subagent_*` card draws folded as one row behind the same status-coloured `◆`, dim for a child handed to the background: while it runs, the tool name, the task description, and the requested model and `background` when the call names them; once settled, the description dimmed with `[done]`, `[started]` for a child handed to the background, or `[failed]` at the right edge. `Space` on the marked row, or `Ctrl+O`, unfolds the full card. A nonempty system prompt and each injected context — instructions, catalogs, snapshots, notices, relays, and recalls — draw as a dim `⬡` title over the first `contextPreviewLines` rows of their model-facing text, with each snapshot contribution named above its own rows; an empty system prompt and a compaction replacement are omitted. A tool card and a context block that carry more rows than they draw end on one marker: `… <n> more rows · Space expands` while the conversation's focus holds that block, and `… <n> more rows · Ctrl+O expands` otherwise. Fenced code in a reply, the file rows of a `read` card, the changed rows of an `edit` or `write` diff card — with `+` additions marked green, `-` removals red, and source text behind those signs drawn in the language the file's extension names — and the shell command of a `!` / `!!` draft, a `$ command` user-shell row (its `$` in the accent colour), and a terminal tool card, use syntax colours from a theme the terminal's own background picks, light or dark; the grammar of a language loads on the first block that asks for it, so that block draws plain and is repainted in colour a moment later, and a language with no grammar here, a terminal that reports neither 24-bit nor 256 colours, and `codeHighlight: false` each draw every block plain. Headings, links, list markers, quotes, and inline code share one cool dark-mode scale — a pale cyan, a deeper blue, and dim — so a reply sits beside a highlighted fence without contrasting hues. Streamed reasoning, reply text, and tool arguments are queued as they arrive and drawn a share per frame, about 60 frames per second by default, so a network burst spreads over `streamPaceFrames` frames instead of landing at once, and the queue never holds the model call back. Streamed reply text fades in and every word keeps its own clock: a word enters near the terminal's background color and brightens to the color it settles in over `streamFadeSteps` ticks of `streamFadeStepMs` each, so a fast stream leaves a longer trail of brightening words rather than a darker one. Streamed reasoning and a tool card float out over the same duration: they appear at a lifted color and recede to the dim italic or palette colors they settle in; a card redrawn from persisted history carries no fade, and text that has settled is never dimmed again.
|
|
44
44
|
|
|
45
45
|
Below the transcript sit a spinner while the agent works — its label is `thinking` while the model reasons, `writing` while visible text arrives, or `calling <tool>` while a tool is streamed or still running, plus live `↑` send and `↓` receive tokens for the current model call, as compact `k` / `M` / `B` counts, growing as the stream arrives and settling on the provider usage chunk — any open prompt, a boxed follow-ups list while messages wait, an activity board of the open turn's todos and latest descendant line while either has a row — completed todo content scratched out, at most four todo rows then `+<n> more`, not a focus region, gone on `turn/end` and bind — the editor, the subagent panel, and the footer: a status bar that, unfocused, is one line built from both ends inward. The editor's caret is the terminal's own blinking bar: the app asks for that shape at start, gives your default back on quit, and draws no caret at all while the status bar or the panel holds the keyboard. The model is anchored at the left edge and is never dropped — past 20 columns it falls back to the bare model name, and only a label still too wide for that is ellipsized — and the two keys that leave the input are anchored at the right edge as `Shift+↑ read · Shift+↓ status`, or `Shift+↑ select · Shift+↓ status` while follow-ups wait, narrowing to `Shift+↑↓ nav` and dropped below 40 columns. The key facts fill whatever middle is left, in bar order: effort (`effort default` when the selection leaves reasoning to the model), the running turn's elapsed time, the context window percentage, the todo counts, and the workspace path (shortened with `~` and `…/` when long). Every segment that middle cannot hold folds into a trailing `+N`, together with the segments the unfocused line never draws — the permission preset, token usage (session totals plus the in-flight call), the goal and plan-mode markers from the projection seam, and the count of pending attachments. Compaction and model-request retries appear as notices, the same facts the browser's markers carry.
|
|
46
46
|
|
|
@@ -48,17 +48,17 @@ While the keyboard walks the conversation a framed inspector is docked directly
|
|
|
48
48
|
|
|
49
49
|
The focused block is also marked where it stands, with a two-column gutter that is dim beside the block's other lines and accented beside the focused section's own — or beside the fold marker, when the fold left that section out of the drawn rows entirely — and its content wraps two columns narrower while the mark is drawn. That mark reaches only the lines pi-tui still repaints differentially — the last `rows` lines of the last frame it wrote, a window a taller frame raises and a shorter one never lowers — because changing anything above them would clear the terminal's scrollback. A block that has scrolled past that point keeps no gutter, the inspector heading appends ` · off screen`, and the frame's own rules draw dim instead of accent, so the frame itself reports that the mark cannot be drawn where the block stands. A fade whose rows reach that edge settles them to their final colors in the frame that writes them, so nothing stays dim in the scrollback.
|
|
50
50
|
|
|
51
|
-
`Ctrl+G` from any region, `Enter` on a conversation section, and `/turns` read the conversation full screen. The reader takes the terminal rather than drawing over the conversation: it runs on the terminal's alternate screen, the screen a pager runs on, and the conversation's own screen is held off the terminal for as long as it is up. So it costs the conversation no line, leaves the repaint window where it was, fills the screen on every terminal, and cannot leave a row of itself in your scrollback; closing it restores the conversation exactly as you left it, with whatever landed meanwhile drawn underneath.
|
|
51
|
+
`Ctrl+G` from any region, `Enter` on a conversation section, and `/turns` read the conversation full screen, one turn at a time. The reader takes the terminal rather than drawing over the conversation: it runs on the terminal's alternate screen, the screen a pager runs on, and the conversation's own screen is held off the terminal for as long as it is up. So it costs the conversation no line, leaves the repaint window where it was, fills the screen on every terminal, and cannot leave a row of itself in your scrollback; closing it restores the conversation exactly as you left it, with whatever landed meanwhile drawn underneath. Under a top rule carrying a ` ● READER ` chip and `turn <n> of <total>`, the turn being read takes most of the screen and a narrow turn list sits to its left. The list has one row per turn — `❯` on the turn being read, the turn number, the first line of its prompt, and right-aligned markers, `⬡<n>` injected context blocks, `✻` any reasoning, `¶` any reply, `◆<n>` tool calls — with the sections of the turn being read listed under it, `▸` on the one the reader holds, so any turn's own context is one step away. The turn panel scrolls that turn end to end in the conversation's own glyphs, a blank row between each two sections: the prompt opens it behind `❯` on a shaded band, then `✻ Thinking` dim, `¶ Reply` with Markdown bullets drawn as `•`, a call's `◆` — green once its result landed, yellow while it runs — with the tool name in bold and its headline in the link blue, `⎿ Result` indented under its call with a diff's `+ ` rows green and `- ` rows red on shaded bands, and `⬡` with the label of an injected context. The section the top row belongs to is accented and carries the conversation walk's `┃` gutter on every row, which reads with no color at all. The bands are mixed from the background color the terminal reports, so a terminal that reports none, or draws no color, draws the panel without them. Rows are never folded there: the reader is where the full model-facing text of a system prompt, an injected snapshot, a long reply, or a tool result is read. `Right` opens the selected turn and `Left` goes back to the list; in the list `Up` / `Down` step one section at a time and cross into the turn either side while `PageUp` / `PageDown` step a whole turn, in the turn they scroll one row at a time, and the section the top row belongs to is where the conversation resumes when the reader closes. `/` opens a query line in place of the legend and narrows the list to the turns whose prompt or text matches, with the readout reading `<kept>/<total> turns`; otherwise the legend rule reports `turn 3/12 · row 14/212` at its right, which no width drops. Below `readerMinColumns` the body draws one panel at a time — the list, or the turn `Right` opens from it — and below 24 columns or 8 rows it draws one dim line, `terminal too small for the reader (needs 24×8)`, and answers only `Esc`, `Ctrl+G`, and `Ctrl+C`. It re-reads the conversation on every render, so a streaming reply grows inside it, a landing tool result appears, and a new turn joins the list; a rewrap re-anchors on the section being read rather than on a row number; an approval or a question steps it aside for that prompt's lifetime; and a session switch takes it down with the notice `the transcript changed · reader closed`.
|
|
52
52
|
|
|
53
53
|
Transient key feedback floats as a dim framed line in the top-right corner of the viewport: `press Esc again to stop turn <n>`, `press Ctrl+C again to quit`, and `nothing in the transcript to read yet`. It holds at full strength for `toastMs`, fades out, costs the conversation no row of its own, and takes no keyboard; where the renderer can no longer repaint the top of the viewport it is printed into the conversation instead, which keeps it. Facts worth keeping are notices in the conversation: `stopping the turn…`, `wait for the session switch to finish`, `above the repaint window · opened in the reader`, and every command result.
|
|
54
54
|
|
|
55
|
-
Motion reaches past streamed text, and every effect rides the same fade tick. The keyboard landing on the conversation, the subagent panel, or the status bar lifts that surface's frame, its chip, and the mark it holds for
|
|
55
|
+
Motion reaches past streamed text, and every effect rides the same fade tick. The keyboard landing on the conversation, the subagent panel, or the status bar lifts that surface's frame, its chip, and the mark it holds for twelve ticks of `streamFadeStepMs`; a step of the conversation walk lifts the newly focused gutter for six; and a step along the bar lifts the selected label for eight. A new or status-changed activity-board todo row, and a replaced descendant line, float out on that tick the same way a tool card does; replay and `reducedMotion` draw the settled board. The reader arrives complete on the screen it owns, and what it newly shows floats out on that tick the way a tool card does: opening it and showing another turn float out the whole turn, and stepping the list to another section of the same turn floats out that section, over `streamFadeSteps` ticks; scrolling, live growth, and a rewrap float nothing out. No lift changes how many lines anything draws, and `reducedMotion` — like `NO_COLOR`, a disabled palette, and `TERM=dumb` — turns every one of them off and arms no repaint for them.
|
|
56
56
|
|
|
57
|
-
The subagent panel is drawn while a subagent session under the bound one is resident, or the listing carries a candidate it could not read. Unfocused it is one summary line with the listed count and the first child's key label; focused, its heading counts what it lists and ends on the keys it answers, `↑↓ children · Enter
|
|
57
|
+
The subagent panel is drawn while a subagent session under the bound one is resident, or the listing carries a candidate it could not read. Unfocused it is one summary line with the listed count and the first child's key label; focused, its heading counts what it lists and ends on the keys it answers, `↑↓ children · Enter opens · Tab regions · Esc input`, narrowed to `↑↓ children · Esc input` and then to `Esc input` on a terminal that cannot hold them, and each row gives the child's depth indent, its label or id, its mode (`one-shot` or `continuable`), `resident`, whether its agent is `running` or `idle`, its elapsed time — the open turn's, else the total its settled turns took — and its token usage, as far as this process's own view of that child and the composed projections carry them. Six rows are drawn at most, with `+<n> more · /subagents lists them all` under them; a candidate the listing could not interpret draws as `unreadable: <reason>` and opens nothing, and a failed listing keeps the rows the last good one produced with `listing failed: <reason>` beneath. The panel disappears with its last row. `Enter` or `Right` on a readable row, like `Enter` on a readable `/subagents` row, opens that child as a subagent view: the terminal draws the child session in place of the bound one — its transcript, live stream, conversation walk, inspector, reader, and its own subagent panel — while the session it was entered from stays open. A resident child is read live, and any other is resumed. The entry's detail rows print as notices under `subagent <label> · Ctrl+P or /parent returns to session <id>`, the header ends on `◆ subagent view ›` with one `›` per level entered and `· Ctrl+P returns`, and `Ctrl+P` or `/parent` goes back one level, redrawing the parent from its log as it stands then. `/new`, `/clear`, `/resume`, `/sessions`, and `/fork` refuse while any session in that chain runs a turn, and otherwise release every view with the session they leave; quitting releases every view and saves the root session.
|
|
58
58
|
|
|
59
59
|
### Keys and commands
|
|
60
60
|
|
|
61
|
-
The conversation, input, subagent panel, and status bar form the vertical arrow-key walk: `Down` at the newest section, `Up` on the subagent panel's first row, and `Up` on the status bar with no subagent panel drawn all land at the caret. The follow-ups list sits above the input; `Shift+Up` enters it while it is drawn, and it joins the `Tab` walk. The activity board sits between follow-ups and the input and is not a focus region. While a region other than the editor has the keyboard, `Tab` and `Shift+Tab` walk the regions that are drawn, wrapping at both ends; in the editor, `Tab` takes the offered completion and `Shift+Tab` opens the reasoning-effort picker. A printable key pressed in any of them returns to the input and types there, so a sentence started while reading lands where it was aimed; `Space` in the conversation is the one exception, and folds the marked tool card or context block. `Ctrl+G` and `Ctrl+
|
|
61
|
+
The conversation, input, subagent panel, and status bar form the vertical arrow-key walk: `Down` at the newest section, `Up` on the subagent panel's first row, and `Up` on the status bar with no subagent panel drawn all land at the caret. The follow-ups list sits above the input; `Shift+Up` enters it while it is drawn, and it joins the `Tab` walk. The activity board sits between follow-ups and the input and is not a focus region. While a region other than the editor has the keyboard, `Tab` and `Shift+Tab` walk the regions that are drawn, wrapping at both ends; in the editor, `Tab` takes the offered completion and `Shift+Tab` opens the reasoning-effort picker. A printable key pressed in any of them returns to the input and types there, so a sentence started while reading lands where it was aimed; `Space` in the conversation is the one exception, and folds the marked tool card or context block. `Ctrl+G`, `Ctrl+O`, `Ctrl+T`, `Ctrl+P`, and `Ctrl+L` mean the same thing in every one of those regions, and `Ctrl+C` and `Ctrl+D` return the keyboard to the input before they act. A prompt and the reader own their whole key stream instead, and answer `Ctrl+C` by giving the keyboard back.
|
|
62
62
|
|
|
63
63
|
While the input has the keyboard:
|
|
64
64
|
|
|
@@ -76,6 +76,10 @@ While the input has the keyboard:
|
|
|
76
76
|
| `Shift+Down` | Focus the subagent panel's first row while it is drawn, and the status bar otherwise |
|
|
77
77
|
| `Ctrl+G` | Read the conversation full screen, on its newest section |
|
|
78
78
|
| `Ctrl+O` | Expand or collapse every tool card and context row |
|
|
79
|
+
| `Ctrl+T` | Browse the agent's todo list, the same list `/todos` opens |
|
|
80
|
+
| `Ctrl+P` | Return from a subagent view to the session it was entered from, like `/parent` |
|
|
81
|
+
| `Ctrl+L` | Redraw the whole screen from scratch |
|
|
82
|
+
| `?` | On an empty input, list the commands and keys, like `/help`; inside a draft it is typed |
|
|
79
83
|
| `Esc` | Cancel a running `!`; with a leading `!` draft and no turn running, clear the editor; otherwise arm the stop, and a second press while that line is on screen stops the running turn |
|
|
80
84
|
| `Ctrl+C` | Clear the editor; a second press within 600 ms quits |
|
|
81
85
|
| `Ctrl+D` | Quit when the editor is empty |
|
|
@@ -119,7 +123,7 @@ While the subagent panel has the keyboard:
|
|
|
119
123
|
|---|---|
|
|
120
124
|
| `Up` / `Down` | The previous / next row; `Up` on the first row lands in the input and `Down` on the last row on the status bar |
|
|
121
125
|
| `Shift+Up` / `Shift+Down`, `Home` / `End`, `PageUp` / `PageDown` | The first / last row |
|
|
122
|
-
| `Enter` | Open that child
|
|
126
|
+
| `Enter`, `Right` | Open that child as a subagent view; `Ctrl+P` returns to this session |
|
|
123
127
|
| `Tab` / `Shift+Tab` | The next / previous region that is drawn |
|
|
124
128
|
| `Esc` | Return to the input |
|
|
125
129
|
| Any printable key | Return to the input and type the character at the caret |
|
|
@@ -143,13 +147,15 @@ While the reader is open:
|
|
|
143
147
|
|
|
144
148
|
| Key | Effect |
|
|
145
149
|
|---|---|
|
|
146
|
-
| `Up` / `Down` | In the turn list, the previous / next section, crossing into the turn either side; in the turn, one row up / down |
|
|
150
|
+
| `Up` / `Down`, `k` / `j` | In the turn list, the previous / next section, crossing into the turn either side; in the turn, one row up / down |
|
|
147
151
|
| `PageUp` / `PageDown` | The previous / next turn, or a page of rows with one row of overlap |
|
|
148
|
-
| `
|
|
152
|
+
| `Space` / `b` | In the turn, a page of rows down / up with one row of overlap |
|
|
153
|
+
| `[` / `]` | The previous / next turn, from the list or the turn |
|
|
154
|
+
| `Home` / `End`, `g` / `G` | The first / last section of the conversation, or the first / last row of the turn |
|
|
149
155
|
| `Right`, `Tab`, `Enter` | From the list, read the turn beside it |
|
|
150
156
|
| `Left`, `Tab`, `Shift+Tab` | From the turn, return to the list |
|
|
151
157
|
| `/` | In the list, open the turn filter: printable keys extend the query, `Backspace` drops one character, `Ctrl+U` clears it, `Enter` keeps the narrowed list and closes the line, and `Esc` clears a non-empty query and then closes the line |
|
|
152
|
-
| `Esc` | Close the reader and return to the conversation on the section last read; with the query line open,
|
|
158
|
+
| `Esc`, `q` | Close the reader and return to the conversation on the section last read; with the query line open, `Esc` clears a non-empty query and then closes the line, and `q` extends the query |
|
|
153
159
|
| `Ctrl+G`, `Ctrl+C` | Close the reader and return to the input |
|
|
154
160
|
|
|
155
161
|
Every other key reaching the reader is consumed, and closing it opens the same 750 ms handoff window, so no number of consecutive `Esc` presses reaches the input's stop.
|
|
@@ -160,7 +166,7 @@ Typing `/` at the start of the editor completes the terminal's own commands and
|
|
|
160
166
|
|
|
161
167
|
| Command | Effect |
|
|
162
168
|
|---|---|
|
|
163
|
-
| `/help` | List the commands, and the keys each focus state answers |
|
|
169
|
+
| `/help` | List the commands, and the keys each focus state answers; `?` on an empty input does the same |
|
|
164
170
|
| `/model` | Pick the model (type to filter the rows), then its reasoning effort when the model declares more than one, for the next request; `/model <provider>/<model>` selects directly, `/model save` stores the current selection as the default, and `Ctrl+S` in the model list stores the highlighted model as the default for the next launch without closing the list |
|
|
165
171
|
| `/effort [id]` | With no argument, open the current model's reasoning-effort picker for the next request, the same picker as editor `Shift+Tab`; an id selects directly and `/effort default` restores the provider default |
|
|
166
172
|
| `/permission [preset]` | With no argument, open the permission-preset picker; a preset selects directly |
|
|
@@ -181,7 +187,8 @@ Typing `/` at the start of the editor completes the terminal's own commands and
|
|
|
181
187
|
| `/outline` | The turns of this session with their prompt and reply previews |
|
|
182
188
|
| `/deliverables` | The files the agent presented, grouped by turn |
|
|
183
189
|
| `/changes [turn]` | Browse the files the latest turn changed, or turn `turn`, with their line counts; `Enter` opens one file's turn-start to turn-end comparison |
|
|
184
|
-
| `/subagents` | Browse the subagent sessions under this session; `Enter` opens one
|
|
190
|
+
| `/subagents` | Browse the subagent sessions under this session; `Enter` opens a readable one as a subagent view and an unreadable one's details |
|
|
191
|
+
| `/parent` | Return from a subagent view to the session it was entered from, like `Ctrl+P` |
|
|
185
192
|
| `/settings [ns [path value]]` | List namespaces, show one, or set one field; `/settings reset <ns>` restores defaults |
|
|
186
193
|
| `/plugins` | The composed plugins with enablement and lifecycle phase; `/plugins bundles` lists the profile's bundles, `/plugins enable <id>` and `/plugins disable <id>` switch a plugin entry or a bundle, `/plugins add <spec>` installs a bundle, `/plugins remove <name>` removes one |
|
|
187
194
|
| `/tools` | Expand or collapse every tool card and context row, like `Ctrl+O` |
|
|
@@ -192,7 +199,7 @@ Every other `/name` line goes to the shared command registry, so `/compact`, `/g
|
|
|
192
199
|
|
|
193
200
|
Every picker the terminal opens — `/model`'s model and reasoning-effort lists, the current-model effort list shared by empty `/effort` and editor `Shift+Tab`, the permission-preset list empty `/permission` opens, the persisted-session list shared by `/resume` and `/sessions`, the `/subagents` and `/todos` lists, and the rows `/signin` and `/login` raise — filters its rows as you type: the query matches each row's label and description together, its whitespace- and slash-separated tokens must all match, and the rows are ordered best match first, so `dsk chat` and `deepseek/chat` both find `deepseek/deepseek-chat` and `gpt5` finds `gpt-5`. `Backspace` drops the last character, `Ctrl+U` clears the query, `Esc` clears a non-empty query and cancels the picker once the query is empty, `Up` / `Down` move within the matches, and `Enter` picks the highlighted row. The dim line above the rows reads `type to filter · Enter selects · Esc cancels` while the query is empty and `filter: <query> · <kept>/<total>` afterwards; a query nothing matches draws `no row matches "<query>"` in place of the rows, and the `✓` on the row in force — the row a picker opens on — shows only while the query is empty.
|
|
194
201
|
|
|
195
|
-
`/
|
|
202
|
+
`/todos`, the `todo` status-bar segment, and the unreadable rows of `/subagents` share one list-then-details interaction: the picker lists the entries, `Enter` opens the highlighted entry as a read-only page, `Up` / `Down` and `PageUp` / `PageDown` scroll that page, and `Enter`, `Esc`, or `Left` returns to the list on the entry just read, so walking several entries costs no retyped command; `Esc` at the list returns to the editor. An entry whose details cannot be read says so on its page instead of closing the list.
|
|
196
203
|
|
|
197
204
|
### Subscription sign-in
|
|
198
205
|
|
|
@@ -219,8 +226,9 @@ An approval request draws `Allow <tool>?` with the asker's reason, the logged ca
|
|
|
219
226
|
| `codeHighlight` | `true` | Draw fenced code in a reply, the file rows of `read` and diff tool cards, and shell commands in a `!` / `!!` draft, a `$ command` row, and a terminal tool card, in syntax colours, from a theme the terminal's background picks |
|
|
220
227
|
| `toastMs` | `2000` | How long a transient key-feedback line holds at full strength before it fades out, which is also the window in which a second `Esc` stops the running turn |
|
|
221
228
|
| `liveRefreshMs` | `1000` | Period of the redraw that advances the `turn` segment and the panel's elapsed values and re-reads a stale subagent listing |
|
|
222
|
-
| `streamFadeSteps` | `
|
|
223
|
-
| `streamFadeStepMs` | `
|
|
229
|
+
| `streamFadeSteps` | `24` | How many ticks a fade lasts: reply text fades in, reasoning and tool cards float out, over `streamFadeSteps × streamFadeStepMs` |
|
|
230
|
+
| `streamFadeStepMs` | `16` | One frame: the fade tick, the repaint period while anything is still moving, and the period paced stream text is drawn at; duration is `streamFadeSteps × streamFadeStepMs` |
|
|
231
|
+
| `streamPaceFrames` | `8` | Frames a backlog of streamed reasoning, reply text, or tool arguments takes to reach the screen; `0`, like `reducedMotion`, draws each delta as it arrives |
|
|
224
232
|
| `reducedMotion` | `false` | Draw streamed text, streamed reasoning, tool cards, and the chrome in their settled colors, with no fade, no lift, and no repeating repaint |
|
|
225
233
|
| `openBrowser` | `true` | Hand marked authorization pages to the local default browser |
|
|
226
234
|
|
|
@@ -238,7 +246,7 @@ The runner is a direct driver over the core API carrier, like `dsh-headless`, th
|
|
|
238
246
|
|
|
239
247
|
### Run flow
|
|
240
248
|
|
|
241
|
-
The runner awaits the complete application (`ctx.get('loader')?.await()`) and builds a session host over the core registry with
|
|
249
|
+
The runner awaits the complete application (`ctx.get('loader')?.await()`) and builds a session host over the core registry with four operations: `create` makes one fresh persisted Agent with the shared [`agentDefaultModel`](../../core/agent-default-model/README.md) selection, `resume` takes the Agent write handle first and then observes the live Session through `ctx.sessionQuery` so bind draws every persisted event including resume closers, and `fork` observes the source through `ctx.sessionQuery`, cuts after the chosen (by default the last) `turn/end` up to the next `turn/start`, and creates a seeded Agent with `parentSession` and `isSeeded` metadata, and `observe` opens a subagent session without releasing the bound one — a resident subagent Agent is read live and its release does nothing, and any other session is resumed. Every operation except a resident `observe` installs a `ModelSelectionRef` in the Agent's scoped setup so `/model` changes the next request. The terminal application starts on the session `--resume` or a fresh `create` yields, subscribes to `session/event`, `agent/assistant-stream`, and `agent/status`, answers the `approval/request` and `user-questions/request` waterfalls for the bound Agent only, and switches sessions by binding the next one and disposing the previous handle; while the host opens the next session the editor refuses input, and a quit during that wait releases the session that arrives afterwards. Quitting cancels any running turn, waits for quiescence, flushes the bound Session, disposes its handle, and requests exit 0; a driver failure writes `dsh: <message>` to stderr and requests exit 1. `/resume` and `/sessions` share the persisted-session chooser. Editor `Shift+Tab` dispatches empty `/effort` to open its current-model picker, and editor `Shift+Left` / `Shift+Right` use pi-tui's word navigation. `/login` starts `authorization.begin` with only subscription methods (every method except a key-collecting `api-key` login). A notice the flow marks with `openInBrowser` is handed to the default browser through `dsh-native-command`'s credential-scrubbed helper while the URL stays printed; the handoff is suppressed when `openBrowser` is false, the launch came through SSH, or the host has no desktop, and an opener failure becomes a notice beside the URL rather than a sign-in failure. A nonempty `!` or `!!` line submitted in the editor runs through `ctx.shell` in this process; `!` injects a next-step notice and `!!` stays local.
|
|
242
250
|
|
|
243
251
|
### Rendering model
|
|
244
252
|
|
|
@@ -252,7 +260,7 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
|
|
|
252
260
|
|
|
253
261
|
| File | Role |
|
|
254
262
|
|---|---|
|
|
255
|
-
| [`src/index.ts`](src/index.ts) | The `tui-app` plugin: the session host (create, resume, fork), resume observation, quit flow, exit mapping |
|
|
263
|
+
| [`src/index.ts`](src/index.ts) | The `tui-app` plugin: the session host (create, resume, fork, observe), resume observation, quit flow, exit mapping |
|
|
256
264
|
| [`src/startup.ts`](src/startup.ts) | The `tui-app-startup` provider: prompt positional, `--resume`, `--no-open`, and `--help` |
|
|
257
265
|
| [`src/app.ts`](src/app.ts) | The terminal application: layout, the key router, commands, session binding, seams, log and stream folding, the activity board above the editor, the stop arm, the transient line it mounts, the terminal handover the reader runs on, and prefix-on-submit `!` / `!!` |
|
|
258
266
|
| [`src/keys.ts`](src/keys.ts) | The key model: the focus regions, what one press means in each, the legends they degrade through, the entry keys, the `/help` lines, and the handoff window |
|
|
@@ -271,12 +279,13 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
|
|
|
271
279
|
| [`src/screen.ts`](src/screen.ts) | The main screen with the settle passes between building a frame and writing it, the repaint window each pass is judged against, the per-block repaint floor, and the suspension that holds the conversation off the terminal |
|
|
272
280
|
| [`src/alt-screen.ts`](src/alt-screen.ts) | The terminal's alternate screen: taking it, drawing absolutely addressed rows on it, and giving the conversation's own screen back |
|
|
273
281
|
| [`src/fade.ts`](src/fade.ts) | The streamed-text fade: the wall-clock tail tracker, the block-fade clock and registry, the fade-in ramp, the float-out mix, and the recolor of rendered lines |
|
|
282
|
+
| [`src/pace.ts`](src/pace.ts) | The stream pacer: the ordered queue between the assistant stream and the transcript, drained a backlog share per frame |
|
|
274
283
|
| [`src/motion.ts`](src/motion.ts) | The chrome motion clock and the three-level lift its call sites draw with: the landing, the section step, and the bar walk |
|
|
275
284
|
| [`src/prompts.ts`](src/prompts.ts) | Approval, question, picker, and read-only detail prompts plus the modal queue |
|
|
276
285
|
| [`src/toast.ts`](src/toast.ts) | The transient key-feedback line: its overlay, its clock, and the lines it carries |
|
|
277
286
|
| [`src/transcript.ts`](src/transcript.ts) | Pure text folding of presentation views, usage, and turn-end reasons, the `$ command` span, and the one fold grammar every marker is written in |
|
|
278
|
-
| [`src/diff.ts`](src/diff.ts) | Line diff
|
|
279
|
-
| [`src/style.ts`](src/style.ts) | The palette, including the cool dark-mode heading and link hues a Markdown reply uses, the strikethrough role completed todo content uses, and the derived pi-tui themes |
|
|
287
|
+
| [`src/diff.ts`](src/diff.ts) | Line diff, hunk selection, and the addition and removal marks diff cards box |
|
|
288
|
+
| [`src/style.ts`](src/style.ts) | The palette, including the cool dark-mode heading and link hues a Markdown reply uses, the strikethrough role completed todo content uses, the background band a prompt is drawn on, and the derived pi-tui themes |
|
|
280
289
|
| [`src/highlight.ts`](src/highlight.ts) | Syntax colour for fenced code, file rows, and shell commands: the grammars a block may load, the theme the background picks, and the SGR one token is drawn with |
|
|
281
290
|
| [`src/completion.ts`](src/completion.ts) | Slash-command and `@`-reference completion for the editor |
|
|
282
291
|
| [`src/editor.ts`](src/editor.ts) | The prompt editor's terminal caret, its `Shift+Left` / `Shift+Right` mapping to pi-tui word navigation, and syntax colour on a `!` / `!!` draft |
|
|
@@ -296,6 +305,8 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
|
|
|
296
305
|
| [`tests/editor.spec.ts`](tests/editor.spec.ts) | The terminal caret, `Shift+Left` / `Shift+Right` word navigation, and `!` / `!!` draft colour against pi-tui's editor behavior |
|
|
297
306
|
| [`tests/frame.spec.ts`](tests/frame.spec.ts) | The rules, the chip, the body rows, and the legend a width holds |
|
|
298
307
|
| [`tests/motion.spec.ts`](tests/motion.spec.ts) | The motion clock's levels, its repaint demand, and the lift each level draws |
|
|
308
|
+
| [`tests/pace.spec.ts`](tests/pace.spec.ts) | The pacer's per-frame share, grapheme cuts, arrival order, flush, and clear |
|
|
309
|
+
| [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | Paced reasoning, reply text, and tool arguments in stream order, the flush at stream end and before a logged event, and reduced motion |
|
|
299
310
|
| [`tests/toast.spec.ts`](tests/toast.spec.ts) | The transient line's box, its hold, its fade, and its early settlement |
|
|
300
311
|
| [`tests/reader.spec.ts`](tests/reader.spec.ts) | The reader's geometry, its state machine, its filter, and the rows it returns |
|
|
301
312
|
| [`tests/reader-screen.spec.ts`](tests/reader-screen.spec.ts) | The reader pane: its key map, the screen it fills, its re-anchoring, and its exit |
|
|
@@ -309,6 +320,8 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
|
|
|
309
320
|
| [`tests/context.spec.ts`](tests/context.spec.ts) | Projection of system prompts and injected context into transcript sections |
|
|
310
321
|
| [`tests/index.spec.ts`](tests/index.spec.ts) | Creation, resume paging, fork cut, session switching, quit flow, and failure reporting |
|
|
311
322
|
| [`tests/startup.spec.ts`](tests/startup.spec.ts) | Command-line parsing over a real Loader tree |
|
|
323
|
+
| [`tests/shortcuts.spec.ts`](tests/shortcuts.spec.ts) | `?` on an empty input and inside a draft, `Ctrl+T` from any region, `Ctrl+P` at the root session, and the `Ctrl+L` redraw |
|
|
324
|
+
| [`tests/subagents.spec.ts`](tests/subagents.spec.ts) | The live subagent panel's rows, walk, and listing refresh, and the subagent view it and `/subagents` open, left through `/parent` and `Ctrl+P` and released on a session switch and on quit |
|
|
312
325
|
| [`../../../apps/cli/tests/profiles/tui/tests/keyless-smoke.e2e.ts`](../../../apps/cli/tests/profiles/tui/tests/keyless-smoke.e2e.ts) | The shipped profile through the real launcher with a keyless mock model |
|
|
313
326
|
|
|
314
327
|
### Invariant ownership
|
|
@@ -366,15 +379,15 @@ Append-only conversation growth after the reusable request prefix. The notice do
|
|
|
366
379
|
|
|
367
380
|
These limits describe the terminal surface as shipped; they are not a general CLI comparison or a task backlog.
|
|
368
381
|
|
|
369
|
-
- **One session at a time** — `/resume`, `/sessions`, `/new`, `/clear`, and `/fork` move the terminal between sessions, but only the bound Agent streams; the browser shows several sessions side by side.
|
|
382
|
+
- **One session at a time** — `/resume`, `/sessions`, `/new`, `/clear`, and `/fork` move the terminal between sessions, but only the bound Agent streams, and a subagent view draws one child in place of the session it was entered from; the browser shows several sessions side by side.
|
|
370
383
|
- **Approvals are one-shot** — the prompt offers allow once or reject, matching the approval seam's vocabulary; there is no remembered grant.
|
|
371
|
-
- **Browser-only pages stay in the browser** — workspace and directory pickers, open-in-app links, the trajectory ledger, and per-message like/dislike have no terminal counterpart; `/settings`, `/plugins`, `/subagents`, `/outline`, and the shared `/feedback` cover their facts as text, and subagent
|
|
384
|
+
- **Browser-only pages stay in the browser** — workspace and directory pickers, open-in-app links, the trajectory ledger, and per-message like/dislike have no terminal counterpart; `/settings`, `/plugins`, `/subagents`, `/outline`, and the shared `/feedback` cover their facts as text, and a subagent transcript is read in a subagent view.
|
|
372
385
|
- **Deliverables are named, not opened** — `/deliverables` lists the presented paths and `/changes` shows line comparisons; the browser previews the files.
|
|
373
386
|
- **Terminal scrollback owns history** — the keyboard walks every block and part of the conversation, tool cards and context blocks fold, and the reader's `/` filter narrows this session's turns; searching the text of a turn, and the history of other sessions, belong to the browser surface.
|
|
374
387
|
- **A focused block that scrolled away is marked only in the inspector** — pi-tui repaints differentially just the last `rows` lines of the last frame it wrote and clears the terminal's scrollback to change anything above them, so a block further back gains no gutter, the inspector heading says `off screen`, its frame goes dim, and `Space` on it opens the reader rather than rewriting it; `Ctrl+O` is the one key that does rewrite those lines, and on a conversation taller than the terminal it makes pi-tui redraw in full.
|
|
375
388
|
- **A frame that shrank leaves the top of the viewport out of reach** — the repaint window rises with the tallest frame written so far and never falls, so after read mode closes or the spinner leaves, a transient line is printed into the conversation instead of floating; it recovers as the conversation grows. The reader is unaffected: it draws on the terminal's other screen, where every row is its own.
|
|
376
389
|
- **The conversation is not drawn while the reader is up** — its screen is held off the terminal, so a turn that runs, a tool result that lands, and a notice that is printed are all drawn in one frame when the reader closes. The reader itself shows them as they arrive, because it re-reads the conversation on every drawing.
|
|
377
|
-
- **The reader shows source text** — an assistant reply reads as the Markdown the model wrote, not the rendering the transcript draws, so tables and headings read as their source
|
|
390
|
+
- **The reader shows source text** — an assistant reply reads as the Markdown the model wrote, not the rendering the transcript draws, so tables and headings read as their source; only a list item's leading `-`, `*`, or `+` is drawn as `•`.
|
|
378
391
|
- **The panel lists residency, not the tree** — a child joins it while its session record is resident in this process, so a subagent run by an out-of-process provider, which owns no session here, never appears; `/subagents` remains the way to every durable descendant.
|
|
379
392
|
- **Residency is not work** — the listing's `activity: 'running'` says the child's record is resident, which is what the row's `resident` reports; whether the child is working is the separate `running` / `idle` word beside it, read from that child's Agent in this process.
|
|
380
393
|
- **Rows behind the overflow row are not selectable** — the panel draws at most six rows and `Up` / `Down` leave it at their ends; the children folded into `+<n> more` are reached through `/subagents`, which walks the complete descendant tree.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "dsh 的交互式终端模式:在你的终端里与 agent
|
|
2
|
+
description: "dsh 的交互式终端模式:在你的终端里与 agent(智能体)对话,带流式回复、工具卡片、用键盘浏览对话记录、逐轮次阅读的全屏阅读器、审批、提问、斜杠命令、! 本地命令、@ 引用、附件与会话切换。"
|
|
3
3
|
kind: "package-bundle"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -40,7 +40,7 @@ dsh tui --no-open # print sign-in URLs without opening a
|
|
|
40
40
|
|
|
41
41
|
### 屏幕布局
|
|
42
42
|
|
|
43
|
-
页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以
|
|
43
|
+
页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `❯` 开头,启用颜色时铺在一条通栏的着色背景带上(附件列在其下),assistant 的推理以暗色斜体显示在 `✻ Thinking` 标题之下、Markdown 回复上方,每次工具调用是一张卡片,含按状态着色的 `◆` 符号(运行中为黄色、完成为绿色、失败为红色)、粗体工具名、以链接蓝色显示的呈现器标题、运行中的一行加载标记,以及折叠到 `toolPreviewLines` 行的正文。卡片在模型开始调用时出现;结果行在工具回答后浮出。`edit` 或 `write` diff 卡片把每一段连续新增行框进绿色圆角框、每一段连续删除行框进红色圆角框,删除的旧行在上、新增的新行在下。`subagent` 与 `subagent_*` 卡片折叠时只画一行,行首是同样按状态着色的 `◆`,交给后台的子 agent 则为暗色:运行中显示工具名、任务描述,以及调用指定的模型与 `background`;结束后描述变暗,右端标出 `[done]`,交给后台的子 agent 标 `[started]`,失败标 `[failed]`。在被标记的行上按 `Space`,或按 `Ctrl+O`,即可展开完整卡片。非空的系统提示词与每一条注入的上下文——instructions、catalogs、snapshots、notices、relays 与 recalls——绘制为暗色 `⬡` 标题,其下是面向模型文本的前 `contextPreviewLines` 行,快照的每一份贡献具名写在其自身各行上方;空的系统提示词与压缩替换则省略。承载的行数多于其绘制行数的工具卡片与上下文块,结尾都是同一条标记:该块被对话记录的焦点持有时为 `… <n> more rows · Space expands`,否则为 `… <n> more rows · Ctrl+O expands`。回复中的围栏代码、`read` 卡片的文件行、`edit` 或 `write` diff 卡片的变更行——其中 `+` 新增项标为绿色、`-` 删除项标为红色,符号后的源文本按文件扩展名对应的语言绘制——以及 `!` / `!!` 草稿、用户 shell 的 `$ command` 行(其 `$` 用强调色)与终端工具卡片中的 shell 命令,都使用语法高亮,配色主题由终端自身的背景在明暗之间选定;某种语言的语法会在第一个用到它的代码块出现时才加载,因此该块先以纯文本绘制、随后被重绘为彩色;这里没有对应语法的语言、既不支持 24 位也不支持 256 色的终端,以及 `codeHighlight: false`,都会把每个代码块画成纯文本。标题、链接、列表标记、引用与行内代码共用一套暗色冷色阶——浅青、更深的蓝与暗色——因此回复能挨着高亮围栏,而不靠对比色相。流式推理、回复文字与工具参数到达时先入队,再按帧(默认约每秒 60 帧)分批绘制,因此一次网络突发会分摊到 `streamPaceFrames` 帧里,而不是一次落下,队列也从不拖慢模型调用。流式回复文字会淡入,而且每个词各走各的时钟:一个词以接近终端背景色的亮度出现,并经 `streamFadeSteps` 次、每次 `streamFadeStepMs` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式推理与工具卡片在同一时长内浮出:它们以抬高的颜色出现,再退回到稳定时的暗色斜体或调色板颜色;从持久化历史重绘的卡片不带淡入,已经稳定下来的文字也不会再被调暗。
|
|
44
44
|
|
|
45
45
|
对话记录下方依次是 agent 工作时的旋转指示——其标签在模型推理时为 `thinking`,可见文本到达时为 `writing`,工具正在流出或仍在执行时为 `calling <tool>`,并带着当前这次模型调用的实时 `↑` 发送与 `↓` 接收 token,以紧凑的 `k` / `M` / `B` 计数,随数据流入增长,并在提供方的 usage 块到达后落定——任何打开的提示、有消息等待时的带框 follow-ups 列表、本轮 todo 与最新后代行的 activity board(有行时才绘制;已完成内容划掉,todo 最多四行其后 `+<n> more`,不是焦点区域,在 `turn/end` 与 bind 时消失)、编辑器、子 agent 面板,以及页脚:未聚焦时是一行由两端向内构建的状态栏。编辑器的光标是终端自身的闪烁竖条:应用在启动时请求这一形状,退出时把你的默认形状还回去,而状态栏或面板持有键盘期间完全不绘制光标。模型锚定在左端且永不丢弃——超过 20 列时退回到裸模型名,只有仍然过宽的标签才会被省略号截断——离开编辑器的那两个按键则锚定在右端,写作 `Shift+↑ read · Shift+↓ status`,有 follow-ups 等待时则写作 `Shift+↑ select · Shift+↓ status`,窄到一定程度收缩为 `Shift+↑↓ nav`,不足 40 列时整体丢弃。关键事实填满剩下的中间部分,按状态栏顺序排列:推理强度(选择把推理交给模型时标为 `effort default`)、进行中轮次的已用时间、上下文窗口百分比、todo 计数,以及 workspace 路径(过长时以 `~` 与 `…/` 缩短)。中间部分容纳不下的每个分段都折进末尾的 `+N`,未聚焦行从不绘制的那些分段也一并折入——权限预设、token 用量(会话合计加上进行中的这次调用)、来自投影接缝的目标与计划模式标记,以及待发送附件的数量。压缩与模型请求重试以通知形式出现,与浏览器标记承载的事实相同。
|
|
46
46
|
|
|
@@ -48,17 +48,17 @@ dsh tui --no-open # print sign-in URLs without opening a
|
|
|
48
48
|
|
|
49
49
|
被聚焦的块也会在原地被标记:一条两列宽的标记条,在块的其他行旁为暗色、在被聚焦小节自身的行旁为强调色——若折叠把该小节整个留在了绘出的行之外,强调色便落在那一行折叠标记旁——标记绘制期间该块的内容按窄两列换行。这个标记只能落在 pi-tui 仍以差分方式重绘的行上——也就是它写出的上一帧的最后 `rows` 行,这条边界只会被更高的帧抬高、不会被更矮的帧降低——因为改动其上方的任何一行都会清空终端的回滚区。已经滚过该位置的块不带标记条,检视面板的标题追加 ` · off screen`,其边框线也改画暗色而非强调色,于是边框本身就报告出标记无法画在该块所在之处。淡入中的各行抵达这一边界时,会在写出它们的同一帧内被结算为最终颜色,因此回滚区里不会留下暗色文字。
|
|
50
50
|
|
|
51
|
-
在任一区域按 `Ctrl+G`、在对话记录的某个小节上按 `Enter`,以及 `/turns
|
|
51
|
+
在任一区域按 `Ctrl+G`、在对话记录的某个小节上按 `Enter`,以及 `/turns`,都会整屏读出对话记录,一次读一个轮次。阅读器并不画在对话记录之上,而是接管终端:它运行在终端的备用屏幕(alternate screen,分页器所用的那块屏幕)上,只要它还开着,对话记录自己的屏幕就被挡在终端之外。因此它不占用对话记录的任何一行,让重绘边界保持原位,在任何终端上都铺满整屏,也不可能把自己的任何一行留在你的回滚缓冲里;关闭它会把对话记录原样恢复成你离开时的样子,期间落地的内容则绘制在其下方。在带有 ` ● READER ` 徽标与 `turn <n> of <total>` 的顶边线之下,正在阅读的轮次占据屏幕的大部分,左侧是一列窄的轮次列表。列表每个轮次一行——正在阅读的轮次带 `❯`、轮次编号、其提示的首行,以及右对齐的标记 `⬡<n>` 注入上下文块数、`✻` 有推理、`¶` 有回复、`◆<n>` 工具调用数——并在正在阅读的那个轮次之下列出它的各小节,`▸` 落在阅读器所持的那一个上,因此任何轮次自己的上下文都只有一步之遥。轮次面板用对话记录自己的符号把该轮次从头到尾滚动读出,相邻两个小节之间隔一空行:提示以 `❯` 开头、铺在着色背景带上,其后是暗色的 `✻ Thinking`、Markdown 列表符号画成 `•` 的 `¶ Reply`、工具调用的 `◆`(结果落地后为绿色、运行中为黄色)连同粗体工具名与链接蓝色的标题、缩进在调用之下的 `⎿ Result`(diff 的 `+ ` 行为绿色、`- ` 行为红色,各铺在着色背景带上),以及带注入上下文标签的 `⬡`。顶行所属的小节带强调色,并在每一行带上对话记录走查所用的 `┃` 标记条,无色时也能辨认。背景带由终端报告的背景色混合而成,因此没有报告背景色、或不绘制颜色的终端画出的面板不带背景带。那里的行从不折叠:阅读器正是读取系统提示词、注入快照、长回复或工具结果完整面向模型文本的地方。`Right` 打开被选中的轮次,`Left` 回到轮次列表;在列表中 `Up` / `Down` 每次步进一个小节并跨入相邻的轮次,而 `PageUp` / `PageDown` 步进整个轮次;在轮次面板中它们逐行滚动,而顶行所属的小节就是阅读器关闭后对话记录恢复到的位置。`/` 在按键提示的位置打开一行查询,把轮次列表收窄到提示或文本匹配的轮次,读数写作 `<kept>/<total> turns`;其余时候提示边线在右端报告 `turn 3/12 · row 14/212`,任何宽度都不会丢弃它。列数不足 `readerMinColumns` 时正文一次只画一个面板——轮次列表,或由 `Right` 从中打开的那个轮次——不足 24 列或 8 行时只画一行暗色文字 `terminal too small for the reader (needs 24×8)`,并且只应答 `Esc`、`Ctrl+G` 与 `Ctrl+C`。它在每一帧都重新读取对话记录,因此流式回复会在其中增长、落地的工具结果会出现、新轮次会加入轮次列表;重新换行时它按正在阅读的小节重新锚定,而不是按行号;审批或提问出现时它在该提示存续期间让位;切换会话会让它随通知 `the transcript changed · reader closed` 一同关闭。
|
|
52
52
|
|
|
53
53
|
临时按键反馈以一行暗色带框文字浮在视口右上角:`press Esc again to stop turn <n>`、`press Ctrl+C again to quit` 与 `nothing in the transcript to read yet`。它以全亮度保持 `toastMs`、随后淡出,不占用对话记录自身的任何一行,也不接管键盘;渲染器已无法重绘视口顶部时,它改为打印进对话记录,从而被保留下来。值得留存的事实则是对话记录中的通知:`stopping the turn…`、`wait for the session switch to finish`、`above the repaint window · opened in the reader` 以及每一条命令结果。
|
|
54
54
|
|
|
55
|
-
动效不止于流式文本,而且每种效果都乘着同一个淡入时钟。键盘落到对话记录、子 agent
|
|
55
|
+
动效不止于流式文本,而且每种效果都乘着同一个淡入时钟。键盘落到对话记录、子 agent 面板或状态栏上时,会把该表层的边框、其徽标与它持有的标记抬亮十二拍(每拍一个 `streamFadeStepMs`);对话记录走查中的一步把新聚焦的标记条抬亮六拍;状态栏上的一步把所选标签抬亮八拍。活动板上新出现或状态已变的 todo 行,以及被替换的后代行,也在同一时钟上像工具卡片一样浮出;重放与 `reducedMotion` 则画出已稳定的活动板。阅读器在自己占据的屏幕上一次性完整出现,而它新显示的内容会像工具卡片一样在同一时钟上浮出:打开它与显示另一个轮次时浮出整个轮次,在列表中步进到同一轮次的另一个小节时浮出该小节,历时 `streamFadeSteps` 拍;滚动、实时增长与重新换行都不浮出任何内容。任何抬亮都不改变任何东西绘制的行数,而 `reducedMotion`——与 `NO_COLOR`、被禁用的调色板和 `TERM=dumb` 一样——会把它们全部关闭,并且不为它们安排任何重绘。
|
|
56
56
|
|
|
57
|
-
子 agent 面板在绑定会话之下有常驻的子 agent 会话、或列表中带有无法读取的候选者时绘制。未聚焦时它是一行摘要,含列出的数量与第一个子会话的关键标签;聚焦时其标题统计所列出的条目,并以它所应答的按键 `↑↓ children · Enter
|
|
57
|
+
子 agent 面板在绑定会话之下有常驻的子 agent 会话、或列表中带有无法读取的候选者时绘制。未聚焦时它是一行摘要,含列出的数量与第一个子会话的关键标签;聚焦时其标题统计所列出的条目,并以它所应答的按键 `↑↓ children · Enter opens · Tab regions · Esc input` 结尾,在容纳不下时收缩为 `↑↓ children · Esc input`,再收缩为 `Esc input`;每一行给出该子会话的层级缩进、其标签或 id、其模式(`one-shot` 或 `continuable`)、`resident`、其 agent 处于 `running` 还是 `idle`、其已用时间——进行中轮次的用时,否则是已结束轮次的合计——以及其 token 用量,以本进程对该子会话的可见程度与已组合的投影所能提供的为限。最多绘制六行,其下是 `+<n> more · /subagents lists them all`;列表无法解读的候选者绘制为 `unreadable: <reason>` 且打不开任何页面,读取失败的列表则保留上一次成功读取产生的各行,并在其下写出 `listing failed: <reason>`。面板随其最后一行一同消失。在可读的行上按 `Enter` 或 `Right`,与在可读的 `/subagents` 行上按 `Enter` 一样,会把该子会话作为子 agent 视图打开:终端在已绑定会话的位置绘制子会话——其对话记录、实时流、对话记录走查、检查器、阅读器以及它自己的子 agent 面板——而进入它之前的会话保持打开。常驻的子会话被实时读取,其他子会话则被恢复。条目的详情行作为通知打印在 `subagent <label> · Ctrl+P or /parent returns to session <id>` 之下,页眉以 `◆ subagent view ›`(每进入一层一个 `›`)与 `· Ctrl+P returns` 结尾,`Ctrl+P` 或 `/parent` 返回上一层,并按父会话此刻的日志重绘它。只要这条链中任一会话正在运行轮次,`/new`、`/clear`、`/resume`、`/sessions` 与 `/fork` 都会拒绝,否则它们会随所离开的会话释放每一个视图;退出会释放每一个视图并保存根会话。
|
|
58
58
|
|
|
59
59
|
### 按键与命令
|
|
60
60
|
|
|
61
|
-
对话记录、编辑器、子 agent 面板与状态栏构成垂直方向键走查:在最新小节上按 `Down`、在子 agent 面板第一行上按 `Up`、在没有绘制子 agent 面板时于状态栏上按 `Up`,都会落到光标处。follow-ups 列表位于输入框上方;绘制该列表时,`Shift+Up` 会进入它,它也加入 `Tab` 走查。activity board 位于 follow-ups 与输入之间,不是焦点区域。编辑器以外的区域持有键盘时,`Tab` 与 `Shift+Tab` 走遍已绘制的各区域,并在两端环绕;在编辑器中,`Tab` 采用给出的补全,`Shift+Tab` 打开推理强度选择器。在其中任何一个区域按下可打印键都会回到编辑器并在那里输入,因此在阅读时开始写的句子会落在它所指向的地方;对话记录中的 `Space` 是唯一的例外,它折叠被标记的工具卡片或上下文块。`Ctrl+G` 与 `Ctrl+
|
|
61
|
+
对话记录、编辑器、子 agent 面板与状态栏构成垂直方向键走查:在最新小节上按 `Down`、在子 agent 面板第一行上按 `Up`、在没有绘制子 agent 面板时于状态栏上按 `Up`,都会落到光标处。follow-ups 列表位于输入框上方;绘制该列表时,`Shift+Up` 会进入它,它也加入 `Tab` 走查。activity board 位于 follow-ups 与输入之间,不是焦点区域。编辑器以外的区域持有键盘时,`Tab` 与 `Shift+Tab` 走遍已绘制的各区域,并在两端环绕;在编辑器中,`Tab` 采用给出的补全,`Shift+Tab` 打开推理强度选择器。在其中任何一个区域按下可打印键都会回到编辑器并在那里输入,因此在阅读时开始写的句子会落在它所指向的地方;对话记录中的 `Space` 是唯一的例外,它折叠被标记的工具卡片或上下文块。`Ctrl+G`、`Ctrl+O`、`Ctrl+T`、`Ctrl+P` 与 `Ctrl+L` 在这些区域中含义完全相同,而 `Ctrl+C` 与 `Ctrl+D` 会先把键盘交还编辑器再行动。提示与阅读器则各自持有整条按键流,并以交还键盘的方式应答 `Ctrl+C`。
|
|
62
62
|
|
|
63
63
|
编辑器持有键盘时:
|
|
64
64
|
|
|
@@ -76,6 +76,10 @@ dsh tui --no-open # print sign-in URLs without opening a
|
|
|
76
76
|
| `Shift+Down` | 在子 agent 面板已绘制时放到其第一行,再否则放到状态栏 |
|
|
77
77
|
| `Ctrl+G` | 整屏读出对话记录,停在其最新小节 |
|
|
78
78
|
| `Ctrl+O` | 展开或折叠所有工具卡片与上下文行 |
|
|
79
|
+
| `Ctrl+T` | 浏览 agent 的 todo 列表,与 `/todos` 打开的是同一个列表 |
|
|
80
|
+
| `Ctrl+P` | 从子 agent 视图返回进入它之前的会话,与 `/parent` 相同 |
|
|
81
|
+
| `Ctrl+L` | 从头重绘整个屏幕 |
|
|
82
|
+
| `?` | 输入为空时列出命令与按键,与 `/help` 相同;在草稿中则作为文字输入 |
|
|
79
83
|
| `Esc` | 取消正在运行的 `!`;在没有轮次进行且草稿以 `!` 开头时清空编辑器;否则装填停止,该提示仍在屏幕上时再按一次会停止正在进行的轮次 |
|
|
80
84
|
| `Ctrl+C` | 清空编辑器;600 ms 内再按一次则退出 |
|
|
81
85
|
| `Ctrl+D` | 编辑器为空时退出 |
|
|
@@ -119,7 +123,7 @@ follow-ups 面板持有键盘时:
|
|
|
119
123
|
|---|---|
|
|
120
124
|
| `Up` / `Down` | 上一行 / 下一行;在第一行按 `Up` 落到编辑器,在最后一行按 `Down` 到达状态栏 |
|
|
121
125
|
| `Shift+Up` / `Shift+Down`、`Home` / `End`、`PageUp` / `PageDown` | 第一行 / 最后一行 |
|
|
122
|
-
| `Enter` |
|
|
126
|
+
| `Enter`、`Right` | 把该子会话作为子 agent 视图打开;`Ctrl+P` 返回本会话 |
|
|
123
127
|
| `Tab` / `Shift+Tab` | 已绘制区域中的下一个 / 上一个 |
|
|
124
128
|
| `Esc` | 回到编辑器 |
|
|
125
129
|
| 任何可打印键 | 回到编辑器,并把该字符输入到光标处 |
|
|
@@ -143,13 +147,15 @@ follow-ups 面板持有键盘时:
|
|
|
143
147
|
|
|
144
148
|
| 按键 | 效果 |
|
|
145
149
|
|---|---|
|
|
146
|
-
| `Up` / `Down` | 在轮次列表中是上一个 / 下一个小节,并跨入相邻的轮次;在轮次面板中是上滚 / 下滚一行 |
|
|
150
|
+
| `Up` / `Down`、`k` / `j` | 在轮次列表中是上一个 / 下一个小节,并跨入相邻的轮次;在轮次面板中是上滚 / 下滚一行 |
|
|
147
151
|
| `PageUp` / `PageDown` | 上一个 / 下一个轮次,或翻一页行并重叠一行 |
|
|
148
|
-
| `
|
|
152
|
+
| `Space` / `b` | 在轮次面板中向下 / 向上翻一页行并重叠一行 |
|
|
153
|
+
| `[` / `]` | 在轮次列表或轮次面板中切到上一个 / 下一个轮次 |
|
|
154
|
+
| `Home` / `End`、`g` / `G` | 整个对话的第一个 / 最后一个小节,或该轮次的第一行 / 最后一行 |
|
|
149
155
|
| `Right`、`Tab`、`Enter` | 从轮次列表进入旁边的那个轮次 |
|
|
150
156
|
| `Left`、`Tab`、`Shift+Tab` | 从轮次面板回到轮次列表 |
|
|
151
157
|
| `/` | 在轮次列表中打开轮次过滤:可打印键扩展查询,`Backspace` 删除一个字符,`Ctrl+U` 清空,`Enter` 保留收窄后的列表并关闭该行,`Esc` 先清空非空查询、再关闭该行 |
|
|
152
|
-
| `Esc` |
|
|
158
|
+
| `Esc`、`q` | 关闭阅读器,并回到对话记录上最后阅读的那个小节;查询行打开时,`Esc` 先清空非空查询、再关闭该行,`q` 则扩展查询 |
|
|
153
159
|
| `Ctrl+G`、`Ctrl+C` | 关闭阅读器并回到编辑器 |
|
|
154
160
|
|
|
155
161
|
到达阅读器的其他每个按键都被消费,而关闭它同样打开那 750 ms 的交接窗口,因此连按多少次 `Esc` 都到不了编辑器的停止。
|
|
@@ -160,7 +166,7 @@ follow-ups 面板持有键盘时:
|
|
|
160
166
|
|
|
161
167
|
| 命令 | 效果 |
|
|
162
168
|
|---|---|
|
|
163
|
-
| `/help` |
|
|
169
|
+
| `/help` | 列出命令,以及每个焦点状态所应答的按键;输入为空时按 `?` 效果相同 |
|
|
164
170
|
| `/model` | 为下一次请求选择模型(输入即可过滤行),若模型声明多于一种推理强度则接着选择强度;`/model <provider>/<model>` 直接选择,`/model save` 把当前选择存为默认,在模型列表中按 `Ctrl+S` 则把高亮的模型存为下次启动的默认而不关闭列表 |
|
|
165
171
|
| `/effort [id]` | 不带参数时为下一次请求打开当前模型的推理强度选择器,与编辑器中的 `Shift+Tab` 打开的是同一个;id 直接选择,`/effort default` 恢复提供方默认值 |
|
|
166
172
|
| `/permission [preset]` | 不带参数时打开权限预设选择器;preset 直接选择 |
|
|
@@ -181,7 +187,8 @@ follow-ups 面板持有键盘时:
|
|
|
181
187
|
| `/outline` | 本会话各轮次及其提示与回复预览 |
|
|
182
188
|
| `/deliverables` | agent 交付的文件,按轮次分组 |
|
|
183
189
|
| `/changes [turn]` | 浏览最近一轮(或第 `turn` 轮)改动的文件及其行数;`Enter` 打开某个文件从轮次开始到结束的对比 |
|
|
184
|
-
| `/subagents` | 浏览本会话之下的子 agent 会话;`Enter`
|
|
190
|
+
| `/subagents` | 浏览本会话之下的子 agent 会话;`Enter` 把可读的会话作为子 agent 视图打开,对无法读取的会话则打开其详情 |
|
|
191
|
+
| `/parent` | 从子 agent 视图返回进入它之前的会话,与 `Ctrl+P` 相同 |
|
|
185
192
|
| `/settings [ns [path value]]` | 列出命名空间、显示某一个或设置某个字段;`/settings reset <ns>` 恢复默认 |
|
|
186
193
|
| `/plugins` | 已组合的插件及其启用状态与生命周期阶段;`/plugins bundles` 列出 profile 的组合包,`/plugins enable <id>` 与 `/plugins disable <id>` 切换某个插件条目或组合包,`/plugins add <spec>` 安装组合包,`/plugins remove <name>` 移除组合包 |
|
|
187
194
|
| `/tools` | 像 `Ctrl+O` 一样展开或折叠所有工具卡片与上下文行 |
|
|
@@ -192,7 +199,7 @@ follow-ups 面板持有键盘时:
|
|
|
192
199
|
|
|
193
200
|
终端打开的每个选择器——`/model` 的模型列表与推理强度列表、空参数 `/effort` 与编辑器 `Shift+Tab` 共用的当前模型推理强度列表、空参数 `/permission` 打开的权限预设列表、`/resume` 与 `/sessions` 共用的持久化会话列表、`/subagents` 与 `/todos` 的列表,以及 `/signin` 与 `/login` 引出的各行——都随输入过滤其行:查询同时匹配每行的标签与描述,其以空白与斜杠分隔的各段必须全部匹配,各行按最佳匹配在前排序,因此 `dsk chat` 与 `deepseek/chat` 都能找到 `deepseek/deepseek-chat`,`gpt5` 能找到 `gpt-5`。`Backspace` 删除最后一个字符,`Ctrl+U` 清空查询,`Esc` 在查询非空时清空查询、在查询为空时取消选择器,`Up` / `Down` 在匹配行之间移动,`Enter` 选中高亮行。行上方的暗色行在查询为空时显示 `type to filter · Enter selects · Esc cancels`,此后显示 `filter: <query> · <kept>/<total>`;无任何行匹配的查询会以 `no row matches "<query>"` 取代这些行,而生效行上的 `✓`——也就是选择器打开时定位的那一行——只在查询为空时显示。
|
|
194
201
|
|
|
195
|
-
`/
|
|
202
|
+
`/todos`、状态栏的 `todo` 分段与 `/subagents` 中无法读取的行共用同一套先列表、后详情的交互:选择器列出各条目,`Enter` 把高亮条目作为只读页面打开,`Up` / `Down` 与 `PageUp` / `PageDown` 滚动该页面,`Enter`、`Esc` 或 `Left` 返回列表并停在刚读过的条目上,因此连续查看多个条目无需重新输入命令;在列表上按 `Esc` 返回编辑器。详情无法读取的条目会在其页面上说明原因,而不会关闭列表。
|
|
196
203
|
|
|
197
204
|
### 订阅登录
|
|
198
205
|
|
|
@@ -219,8 +226,9 @@ follow-ups 面板持有键盘时:
|
|
|
219
226
|
| `codeHighlight` | `true` | 以语法高亮绘制回复中的围栏代码、`read` 与 diff 工具卡片的文件行,以及 `!` / `!!` 草稿、`$ command` 行与终端工具卡片中的 shell 命令,配色主题由终端背景选定 |
|
|
220
227
|
| `toastMs` | `2000` | 临时按键提示行以全亮度保持多久后淡出,这同时也是第二次 `Esc` 停止正在进行轮次的窗口 |
|
|
221
228
|
| `liveRefreshMs` | `1000` | 重绘周期:推进 `turn` 分段与面板中的已用时间,并重新读取已过期的子 agent 列表 |
|
|
222
|
-
| `streamFadeSteps` | `
|
|
223
|
-
| `streamFadeStepMs` | `
|
|
229
|
+
| `streamFadeSteps` | `24` | 一次淡入或浮出持续多少拍:回复文字淡入,推理与工具卡片浮出,时长为 `streamFadeSteps × streamFadeStepMs` |
|
|
230
|
+
| `streamFadeStepMs` | `16` | 一帧的时长:淡入或浮出的一拍、仍在变化时的重绘周期,也是逐帧绘制流式文字的周期;总时长为 `streamFadeSteps × streamFadeStepMs` |
|
|
231
|
+
| `streamPaceFrames` | `8` | 积压的流式推理、回复文字或工具参数要经过多少帧才全部上屏;`0` 与 `reducedMotion` 一样,收到即绘制 |
|
|
224
232
|
| `reducedMotion` | `false` | 以稳定颜色绘制流式文本、流式推理、工具卡片与应用自身的边框装饰,不做淡入、不做抬亮,也不重复重绘 |
|
|
225
233
|
| `openBrowser` | `true` | 把被标记的授权页面交给本地默认浏览器 |
|
|
226
234
|
|
|
@@ -238,7 +246,7 @@ runner 与 `dsh-headless` 一样是核心 API 载体之上的直接驱动器,
|
|
|
238
246
|
|
|
239
247
|
### 运行流程
|
|
240
248
|
|
|
241
|
-
runner 等待完整应用就绪(`ctx.get('loader')?.await()
|
|
249
|
+
runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心注册表之上构建含四个操作的会话宿主:`create` 用共享的 [`agentDefaultModel`](../../core/agent-default-model/README.zh.md) 选择创建一个全新的持久化 Agent,`resume` 先拿到 Agent 写句柄,再经 `ctx.sessionQuery` 观察实时 Session,使 bind 画出每条持久化事件(包括恢复时的闭合事件),`fork` 通过 `ctx.sessionQuery` 观察源会话、在所选(默认最后一个)`turn/end` 之后直到下一个 `turn/start` 处切割,并创建带 `parentSession` 与 `isSeeded` 元数据的种子 Agent,`observe` 打开子 agent 会话而不释放已绑定的会话——常驻的子 agent Agent 被实时读取、释放它什么也不做,其他会话则被恢复。除常驻会话的 `observe` 外,每个操作都在 Agent 的作用域 setup 中安装 `ModelSelectionRef`,因此 `/model` 会改变下一次请求。终端应用从 `--resume` 或一次新的 `create` 产生的会话开始,订阅 `session/event`、`agent/assistant-stream` 与 `agent/status`,只为绑定的 Agent 应答 `approval/request` 与 `user-questions/request` waterfall,并通过绑定下一个会话、dispose 先前句柄来切换会话;宿主打开下一个会话期间编辑器拒绝输入,等待期间退出会释放随后到达的会话。退出时取消任何进行中的轮次、等待完全停稳、flush 绑定的会话、dispose 其句柄并请求以 0 退出;驱动器失败会向 stderr 写入 `dsh: <message>` 并请求以 1 退出。`/resume` 与 `/sessions` 共用持久化会话选择器。编辑器中的 `Shift+Tab` 会派发空参数 `/effort` 以打开当前模型的推理强度选择器,而编辑器中的 `Shift+Left` / `Shift+Right` 使用 pi-tui 的词导航。`/login` 只带着订阅方法(除收集密钥的 `api-key` 登录外的每一种方法)启动 `authorization.begin`。flow 用 `openInBrowser` 标记的 notice 会经 `dsh-native-command` 的凭据擦除辅助进程交给默认浏览器,URL 同时保持打印;当 `openBrowser` 为 false、启动经过 SSH 或宿主没有桌面时抑制该交接,打开器失败则成为 URL 旁的一条通知,而非登录失败。编辑器里提交的非空 `!` 或 `!!` 行经本进程的 `ctx.shell` 运行;`!` 注入一条下一步通知,`!!` 只留在本地。
|
|
242
250
|
|
|
243
251
|
### 渲染模型
|
|
244
252
|
|
|
@@ -252,7 +260,7 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
|
|
|
252
260
|
|
|
253
261
|
| 文件 | 职责 |
|
|
254
262
|
|---|---|
|
|
255
|
-
| [`src/index.ts`](src/index.ts) | `tui-app` 插件:会话宿主(创建、恢复、fork
|
|
263
|
+
| [`src/index.ts`](src/index.ts) | `tui-app` 插件:会话宿主(创建、恢复、fork、观察)、恢复观察、退出流程、退出码映射 |
|
|
256
264
|
| [`src/startup.ts`](src/startup.ts) | `tui-app-startup` 提供方:提示位置参数、`--resume`、`--no-open` 与 `--help` |
|
|
257
265
|
| [`src/app.ts`](src/app.ts) | 终端应用:布局、按键路由、命令、会话绑定、接缝、日志与流的折叠、编辑器上方的 activity board、停止装填、它挂载的临时提示行、阅读器所依托的终端交接,以及提交时解析的 `!` / `!!` |
|
|
258
266
|
| [`src/keys.ts`](src/keys.ts) | 按键模型:各焦点区域、一次按键在每个区域中的含义、它们逐级收缩的按键提示、进入用的按键、`/help` 的各行,以及交接窗口 |
|
|
@@ -271,12 +279,13 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
|
|
|
271
279
|
| [`src/screen.ts`](src/screen.ts) | 在构建一帧与写出该帧之间带若干次结算的主屏幕、每次结算所依据的重绘窗口、每个块的重绘下界,以及把对话记录挡在终端之外的挂起 |
|
|
272
280
|
| [`src/alt-screen.ts`](src/alt-screen.ts) | 终端的备用屏幕:接管它、在其上按绝对行址绘制,以及把对话记录自己的屏幕交还 |
|
|
273
281
|
| [`src/fade.ts`](src/fade.ts) | 流式文本淡入与浮出:基于挂钟的尾部追踪器、块时钟与注册表、淡入亮度级别、浮出混合,以及对已渲染行的重新着色 |
|
|
282
|
+
| [`src/pace.ts`](src/pace.ts) | 流式节拍器:助手流与对话记录之间的有序队列,每帧释放积压的一份 |
|
|
274
283
|
| [`src/motion.ts`](src/motion.ts) | 边框装饰的动效时钟与其调用点所绘的三级抬亮:落键、小节步进与状态栏走查 |
|
|
275
284
|
| [`src/prompts.ts`](src/prompts.ts) | 审批、提问、选择器与只读详情提示以及模态队列 |
|
|
276
285
|
| [`src/toast.ts`](src/toast.ts) | 临时按键提示行:其浮层、其时钟,以及它承载的各条文字 |
|
|
277
286
|
| [`src/transcript.ts`](src/transcript.ts) | 呈现视图、用量与轮次结束原因的纯文本折叠、`$ command` 的 span,以及每条标记共用的那一套折叠措辞 |
|
|
278
|
-
| [`src/diff.ts`](src/diff.ts) | diff 卡片的行 diff
|
|
279
|
-
| [`src/style.ts`](src/style.ts) | 调色板(含 Markdown 回复所用的暗色冷色阶标题与链接色、已完成 todo
|
|
287
|
+
| [`src/diff.ts`](src/diff.ts) | diff 卡片的行 diff、hunk 选择,以及卡片加框所依据的新增与删除标记 |
|
|
288
|
+
| [`src/style.ts`](src/style.ts) | 调色板(含 Markdown 回复所用的暗色冷色阶标题与链接色、已完成 todo 内容所用的划线角色、提示所铺的背景带)与派生的 pi-tui 主题 |
|
|
280
289
|
| [`src/highlight.ts`](src/highlight.ts) | 围栏代码、文件行与 shell 命令的语法高亮:某个块可能加载的语法、由背景选定的配色主题,以及一个 token 所用的 SGR |
|
|
281
290
|
| [`src/completion.ts`](src/completion.ts) | 编辑器的斜杠命令与 `@` 引用补全 |
|
|
282
291
|
| [`src/editor.ts`](src/editor.ts) | 提示编辑器的终端光标、把 `Shift+Left` / `Shift+Right` 映射到 pi-tui 词导航的逻辑,以及 `!` / `!!` 草稿上的语法高亮 |
|
|
@@ -296,6 +305,8 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
|
|
|
296
305
|
| [`tests/editor.spec.ts`](tests/editor.spec.ts) | 对照 pi-tui 编辑器行为验证终端光标、`Shift+Left` / `Shift+Right` 词导航,以及 `!` / `!!` 草稿着色 |
|
|
297
306
|
| [`tests/frame.spec.ts`](tests/frame.spec.ts) | 边框线、徽标、正文行,以及某个宽度容纳得下的按键提示 |
|
|
298
307
|
| [`tests/motion.spec.ts`](tests/motion.spec.ts) | 动效时钟的各个级别、它对重绘的要求,以及每一级所绘的抬亮 |
|
|
308
|
+
| [`tests/pace.spec.ts`](tests/pace.spec.ts) | 节拍器的每帧份额、按字素切分、到达顺序、flush 与 clear |
|
|
309
|
+
| [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | 按流顺序分批绘制的推理、回复文字与工具参数,流结束时与已记录事件前的 flush,以及 reducedMotion |
|
|
299
310
|
| [`tests/toast.spec.ts`](tests/toast.spec.ts) | 临时提示行的方框、其保持、其淡出与其提前结算 |
|
|
300
311
|
| [`tests/reader.spec.ts`](tests/reader.spec.ts) | 阅读器的几何布局、其状态机、其过滤,以及它返回的各行 |
|
|
301
312
|
| [`tests/reader-screen.spec.ts`](tests/reader-screen.spec.ts) | 阅读器面板:其按键映射、它铺满的屏幕、其重新锚定与其退出 |
|
|
@@ -309,6 +320,8 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
|
|
|
309
320
|
| [`tests/context.spec.ts`](tests/context.spec.ts) | 把系统提示词与注入上下文投影为对话记录小节 |
|
|
310
321
|
| [`tests/index.spec.ts`](tests/index.spec.ts) | 创建、恢复分页、fork 切割、会话切换、退出流程与失败报告 |
|
|
311
322
|
| [`tests/startup.spec.ts`](tests/startup.spec.ts) | 基于真实 Loader 配置树的命令行解析 |
|
|
323
|
+
| [`tests/shortcuts.spec.ts`](tests/shortcuts.spec.ts) | 空输入与草稿中的 `?`、任一区域的 `Ctrl+T`、根会话上的 `Ctrl+P`,以及 `Ctrl+L` 重绘 |
|
|
324
|
+
| [`tests/subagents.spec.ts`](tests/subagents.spec.ts) | 实时子 agent 面板的各行、走查与列表刷新,以及它与 `/subagents` 打开的子 agent 视图:经 `/parent` 与 `Ctrl+P` 离开,并在会话切换与退出时释放 |
|
|
312
325
|
| [`../../../apps/cli/tests/profiles/tui/tests/keyless-smoke.e2e.ts`](../../../apps/cli/tests/profiles/tui/tests/keyless-smoke.e2e.ts) | 通过真实启动器与免密钥模拟模型运行随附 profile |
|
|
313
326
|
|
|
314
327
|
### 不变量归属
|
|
@@ -366,15 +379,15 @@ The user ran `<command>` in the terminal.
|
|
|
366
379
|
|
|
367
380
|
这些限制描述随发行版交付的终端表层;它们不是一般的 CLI 比较,也不是任务积压。
|
|
368
381
|
|
|
369
|
-
- **同一时间一个会话**——`/resume`、`/sessions`、`/new`、`/clear` 与 `/fork` 在会话间移动终端,但只有绑定的 Agent
|
|
382
|
+
- **同一时间一个会话**——`/resume`、`/sessions`、`/new`、`/clear` 与 `/fork` 在会话间移动终端,但只有绑定的 Agent 流式显示,子 agent 视图也是用一个子会话替换它所来自的会话来绘制;浏览器可并排展示多个会话。
|
|
370
383
|
- **审批为一次性**——提示只提供允许一次或拒绝,与审批接缝的词汇一致;没有记忆的授权。
|
|
371
|
-
- **仅浏览器的页面留在浏览器**——workspace 与目录选择器、在应用中打开的链接、轨迹账本与逐条消息的点赞/点踩没有终端对应物;`/settings`、`/plugins`、`/subagents`、`/outline` 与共享的 `/feedback` 以文本覆盖其事实,子 agent
|
|
384
|
+
- **仅浏览器的页面留在浏览器**——workspace 与目录选择器、在应用中打开的链接、轨迹账本与逐条消息的点赞/点踩没有终端对应物;`/settings`、`/plugins`、`/subagents`、`/outline` 与共享的 `/feedback` 以文本覆盖其事实,子 agent 的对话记录在子 agent 视图中阅读。
|
|
372
385
|
- **交付物只列名、不打开**——`/deliverables` 列出交付路径,`/changes` 显示逐行对比;浏览器会预览这些文件。
|
|
373
386
|
- **历史由终端回滚区持有**——键盘可以走遍对话记录的每个块与每个部分,工具卡片与上下文块可以折叠,阅读器的 `/` 过滤可以收窄本会话的各轮次;搜索一个轮次的文本以及其他会话的历史,属于浏览器表层。
|
|
374
387
|
- **滚走的聚焦块只在检视面板中被标记**——pi-tui 只对它写出的上一帧的最后 `rows` 行做差分重绘,要改动其上方的内容就得清空终端回滚区,因此更靠前的块得不到标记条,检视面板标题写出 `off screen`,其边框转为暗色,在它上面按 `Space` 会打开阅读器而不是重写它;`Ctrl+O` 是唯一仍会重写那些行的按键,在高于终端的对话记录上它会让 pi-tui 整屏重绘。
|
|
375
388
|
- **缩过的帧会让视口顶部脱离可及范围**——重绘窗口随迄今写出的最高一帧上升且不会回落,因此在读取模式关闭或旋转指示离开之后,临时提示行改为打印进对话记录;它会随对话记录增长而恢复。阅读器不受影响:它画在终端的另一块屏幕上,那里的每一行都归它所有。
|
|
376
389
|
- **阅读器开着时不绘制对话记录**——对话记录的屏幕被挡在终端之外,因此期间跑完的轮次、落地的工具结果与打印的通知,都在阅读器关闭时的同一帧里绘出。阅读器自身仍会随它们到达而显示,因为它在每一次绘制时都重新读取对话记录。
|
|
377
|
-
- **阅读器显示的是源文本**——assistant 回复读到的是模型写下的 Markdown
|
|
390
|
+
- **阅读器显示的是源文本**——assistant 回复读到的是模型写下的 Markdown,而不是对话记录绘制出的渲染结果,因此表格与标题以源码形式呈现;只有列表项开头的 `-`、`*` 或 `+` 画成 `•`。
|
|
378
391
|
- **面板列出的是常驻,而不是整棵树**——子会话在其会话记录常驻于本进程期间加入面板,因此由进程外提供方运行、在此没有自己会话的子 agent 永远不会出现;`/subagents` 仍是到达每一个持久后代的途径。
|
|
379
392
|
- **常驻不等于正在工作**——列表的 `activity: 'running'` 表示该子会话的记录常驻,这正是行内 `resident` 所报告的内容;子会话是否在工作则是它旁边单独的 `running` / `idle`,读自本进程中该子会话的 Agent。
|
|
380
393
|
- **溢出行之后的各行不可选中**——面板最多绘制六行,`Up` / `Down` 在其两端会离开面板;被折叠进 `+<n> more` 的子会话通过 `/subagents` 到达,后者遍历完整的后代树。
|