@songtonyli/dsh-cli 0.1.46 → 0.1.47

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 CHANGED
@@ -26,7 +26,7 @@ workspace and no build step. Native packages that ship one build per platform
26
26
  ripgrep, the PTY backend's addons, sharp, koffi, and the Landlock launcher — are
27
27
  ordinary optional dependencies, so npm resolves the right one for your machine.
28
28
 
29
- Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.46; `dsh --version`
29
+ Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.47; `dsh --version`
30
30
  also reports the harness build the package was assembled from.
31
31
 
32
32
  ## License
package/bin/dsh.mjs CHANGED
@@ -18,7 +18,7 @@ const argv = process.argv.slice(2)
18
18
  // version this package publishes. Reporting only one of the two would make an
19
19
  // ordinary `npm install @songtonyli/dsh-cli@x` look like it installed something else.
20
20
  if (argv.length === 1 && (argv[0] === '--version' || argv[0] === '-V')) {
21
- console.log('@songtonyli/dsh-cli 0.1.46 (deepseek-harness 0.1.7-rc.2)')
21
+ console.log('@songtonyli/dsh-cli 0.1.47 (deepseek-harness 0.1.7-rc.2)')
22
22
  process.exit(0)
23
23
  }
24
24
 
@@ -48,8 +48,8 @@
48
48
  "micromark-util-sanitize-uri": "^2.0.1",
49
49
  "simple-icons": "16.31.0",
50
50
  "@deepseek-ai/dsh-client-store": "0.1.7-rc.2",
51
- "@deepseek-ai/dsh-util-code-language": "0.1.7-rc.2",
52
51
  "@deepseek-ai/dsh-util-workspace-path": "0.1.7-rc.2",
52
+ "@deepseek-ai/dsh-util-code-language": "0.1.7-rc.2",
53
53
  "@deepseek-ai/cordis": "~4.0.4"
54
54
  },
55
55
  "files": [
@@ -167,7 +167,7 @@ window.__ModuleLoader__.load({
167
167
  const SCROLLBAR_LINGER_MS = 2e3;
168
168
  /** Format complete-build metadata for the local brand badge. */
169
169
  function localBuildVersion() {
170
- return `0.1.7-rc.2-641e6a1` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
170
+ return `0.1.7-rc.2-2020eb7` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
171
171
  }
172
172
  /** Each panel row subscribes only to its own selection state. */
173
173
  function PanelRow({ id, label, wide, usePanelInfo, selectPanel, renderSlot }) {
@@ -40,9 +40,9 @@ On quit the app prints `dsh: session <id> saved; resume with: dsh --profile tui
40
40
 
41
41
  ### The screen
42
42
 
43
- Every frame is drawn one column in from each edge of the terminal, so no line of the conversation or of the docked chrome touches either side. 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 violet — without the tool name a presenter repeated, so `Read src/app.ts` draws as `read src/app.ts`, and for a shell card the call's own summary, never the command, which the card draws once as its `$` row — a loading row while it runs, and a body folded to `toolPreviewLines` rows. The card appears when the model starts the call, its header first and its rows unrolling beneath it over about `toolRevealFrames` frames; the result rows unroll and float out the same way when the tool answers. An `edit` or `write` diff card fills each added row edge to edge with a green background and each removed row with a red one, the removed rows above the added ones, and paints the `+` and `-` in their own lighter colour so each sign reads against the fill rather than in it; a wrapped row carries the fill on without a second sign; once the tool applied the change, the applied hunks replace the diff the call carried and lead every row with its file line number, the new file's for added and unchanged rows and the old file's for removed rows. 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 and list markers use warm orange, links and inline code use violet, and quotes stay dim. 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.
43
+ Every frame is drawn one column in from each edge of the terminal, so no line of the conversation or of the docked chrome touches either side. 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), and a prompt steered or injected into a turn that already had a model step draws dim on a darker band so it recedes behind the turn it joined, assistant reasoning is dim italic under a `✻ Thinking` header above the Markdown reply, and each tool call is a card with a status glyph — a yellow braille spinner while it runs, a green `◆` once done, a red `◆` on failure — the bold tool name, the presenter headline in violet — without the tool name a presenter repeated, so `Read src/app.ts` draws as `read src/app.ts`, and for a shell card the call's own summary, never the command, which the card draws once as its `$` row — a loading row while it runs, and a body folded to `toolPreviewLines` rows. The card appears when the model starts the call, its header first and its rows unrolling beneath it over about `toolRevealFrames` frames; the result rows unroll and float out the same way when the tool answers. An `edit` or `write` diff card fills each added row edge to edge with a green background and each removed row with a red one, the removed rows above the added ones, and paints the `+` and `-` in their own lighter colour so each sign reads against the fill rather than in it; a wrapped row carries the fill on without a second sign; once the tool applied the change, the applied hunks replace the diff the call carried and lead every row with its file line number, the new file's for added and unchanged rows and the old file's for removed rows. A `subagent` or `subagent_*` card draws folded as one row behind the same status glyph, spinning while it runs and a 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 and list markers use warm orange, links and inline code use violet, and quotes stay dim. 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
- 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 and status glyphs colored green, yellow, or cyan, 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 and entry keys are colored; live turn, context, and todo facts use yellow, violet, and green. 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.
45
+ Below the transcript sit a spinner while the agent works — its label, with a bright highlight sweeping across it, 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 and status glyphs colored green, yellow, or cyan, the in-progress one a spinner, 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 and entry keys are colored; live turn, context, and todo facts use yellow, violet, and green. 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
 
47
47
  While the keyboard walks the conversation a framed inspector is docked directly above the editor, and the frame is the mode: it is drawn exactly while the conversation holds the keyboard. Its top rule carries an inverse ` ● READ ` chip and the focused section's heading — the section's position among the navigable blocks, the turn it belongs to, and what the section is — as in `╭ ● READ ─ 3/12 · turn 2 · bash git status · result ─╮`. Under it the block's parts draw as a numbered wrapping strip like `← 1 call · [2 result] →` when the block has more than one, the held label bracketed as well as accented so the selection is legible with no color at all; then the section's own source rows, each closed by a `│ ` border on both sides and wrapped four columns narrower, folded at `focusPreviewLines` for every section kind — a system prompt and an injected context included — with `… <n> more rows · Ctrl+G reads it` under them. The bottom rule carries the keys the conversation answers, `↑↓ sections · ←→ parts · Space folds · Ctrl+G reader · Esc input`, narrowed to `↑↓ ←→ · Space folds · Esc input` and then to `Esc input` as the terminal loses columns.
48
48
 
@@ -52,7 +52,7 @@ The focused block is also marked where it stands, with a two-column gutter that
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 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.
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. Running tool cards, folded subagent rows, and the in-progress todo cycle braille spinner frames on their own 80 ms tick, armed only while one of them is drawn; a card whose header has scrolled above the part of the screen the renderer can repaint draws the static `◆` from then on. 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
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`, a shaded line directly above the input reads `◆ subagent view · main › <label> · Ctrl+P back to <parent>` for as long as the view is open, whatever the transcript has scrolled to, 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
 
@@ -70,7 +70,7 @@ While the input has the keyboard:
70
70
  | `!command` / `!!command` | Run in this terminal; `!` is next-step context the next prompt can read, `!!` stays local |
71
71
  | `Shift+Enter` | Insert a newline |
72
72
  | `Ctrl+S` | While a turn runs, steer the editor text into the running turn's next step |
73
- | `Up` / `Down` | Recall earlier prompts |
73
+ | `Up` / `Down` | Recall earlier prompts; while follow-ups wait, `Up` on an empty input removes the newest follow-up into the editor, the same revision as `E` in the follow-ups panel |
74
74
  | `Shift+Left` / `Shift+Right` | Move one word left / right with pi-tui's editor navigation; from the end of `I want to do`, `Shift+Left` lands before `do` |
75
75
  | `Tab` | Take the completion the editor offers |
76
76
  | `Shift+Tab` | Open the current model's reasoning-effort picker for the next request, the same picker as empty `/effort` |
@@ -233,7 +233,7 @@ An approval request draws `Allow <tool>?` with the asker's reason, the logged ca
233
233
  | `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` |
234
234
  | `streamPaceFrames` | `8` | Frames a backlog of streamed reply text or tool arguments takes to reach the screen. Thinking still queued when its block ends, or when reply text or a tool call starts, is drawn at once; `0`, like `reducedMotion`, draws each delta as it arrives |
235
235
  | `toolRevealFrames` | `6` | Frames the rows of a tool card take to unroll when the card appears or its result lands, a share of the hidden rows per frame. Unfolding a card, and a card whose unrolling rows are above the part of the screen the renderer can repaint, draw every row at once; `0`, like `reducedMotion`, draws every row at once |
236
- | `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 |
236
+ | `reducedMotion` | `false` | Draw streamed text, streamed reasoning, tool cards, and the chrome in their settled colors, with no fade, no lift, no spinner glyph or shimmer, and no repeating repaint |
237
237
  | `openBrowser` | `true` | Hand marked authorization pages to the local default browser |
238
238
  | `btwTools` | `read`, `read_image`, `glob`, `grep`, `web_search`, `web_fetch`, the `session_*` query tools, `skill`, the MCP resource readers, `ask_user_question` | Global tools a `/btw` side agent may call; names this composition does not register are skipped |
239
239
  | `btwSandboxedTools` | `bash`, `pwsh` | Command tools a `/btw` side agent may call only when the command executor confines commands; they run in the `read-only` sandbox mode |
@@ -290,11 +290,12 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
290
290
  | [`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 |
291
291
  | [`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; and the row reveal that unrolls a tool card the same way |
292
292
  | [`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 |
293
+ | [`src/spinner.ts`](src/spinner.ts) | The braille spinner frames running glyphs cycle through and the shimmer the working spinner's label carries |
293
294
  | [`src/prompts.ts`](src/prompts.ts) | Approval, question, picker, and read-only detail prompts plus the modal queue |
294
295
  | [`src/toast.ts`](src/toast.ts) | The transient key-feedback line: its overlay, its clock, and the lines it carries |
295
296
  | [`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 |
296
297
  | [`src/diff.ts`](src/diff.ts) | Line diff, hunk selection, and the addition and removal marks diff cards box |
297
- | [`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, the green and red fills and sign colours of a diff card's changed rows, and the derived pi-tui themes |
298
+ | [`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 darker one a steered or injected prompt is drawn on, the green and red fills and sign colours of a diff card's changed rows, and the derived pi-tui themes |
298
299
  | [`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 |
299
300
  | [`src/completion.ts`](src/completion.ts) | Slash-command and `@`-reference completion for the editor |
300
301
  | [`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 |
@@ -315,6 +316,7 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
315
316
  | [`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 |
316
317
  | [`tests/frame.spec.ts`](tests/frame.spec.ts) | The rules, the chip, the body rows, and the legend a width holds |
317
318
  | [`tests/motion.spec.ts`](tests/motion.spec.ts) | The motion clock's levels, its repaint demand, and the lift each level draws |
319
+ | [`tests/spinner.spec.ts`](tests/spinner.spec.ts) | Spinner frame steps and the shimmer's sweep, rest, and disabled-palette output |
318
320
  | [`tests/pace.spec.ts`](tests/pace.spec.ts) | The pacer's per-frame share, grapheme cuts, arrival order, flush, per-channel flush, and clear, and the row reveal's per-frame share, settle, and clamp |
319
321
  | [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | Paced reply text and tool arguments in stream order, thinking drawn when its block ends, the flush at stream end and before a logged event, reduced motion, and tool cards unrolling on the frame tick |
320
322
  | [`tests/view-banner.spec.ts`](tests/view-banner.spec.ts) | The subagent-view line's trail, back target, width, and absence at the main session |
@@ -40,9 +40,9 @@ dsh tui --no-open # print sign-in URLs without opening a
40
40
 
41
41
  ### 屏幕布局
42
42
 
43
- 每一帧都从终端左右两边各内缩一列绘制,因此对话记录与停靠的界面组件都不会有任何一行贴到两侧边缘。页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `❯` 开头,启用颜色时铺在一条通栏的着色背景带上(附件列在其下),assistant 的推理以暗色斜体显示在 `✻ Thinking` 标题之下、Markdown 回复上方,每次工具调用是一张卡片,含按状态着色的 `◆` 符号(运行中为黄色、完成为绿色、失败为红色)、粗体工具名、以紫色显示的呈现器标题(去掉呈现器重复写出的工具名,因此 `Read src/app.ts` 画成 `read src/app.ts`;shell 卡片取该次调用自身的摘要,绝不取命令,命令只由卡片的 `$` 行绘制一次)、运行中的一行加载标记,以及折叠到 `toolPreviewLines` 行的正文。卡片在模型开始调用时出现,先画标题,其下各行在约 `toolRevealFrames` 帧内逐行展开;工具回答后,结果行也以同样方式展开并浮出。`edit` 或 `write` diff 卡片把每一新增行整行铺满绿色背景、每一删除行整行铺满红色背景,删除的旧行在上、新增的新行在下,并把 `+` 与 `-` 画成各自更亮的颜色,使符号从填充色中读得出来;折行续行只延续填充色,不再画第二个符号;工具应用变更后,已应用的 hunk 取代调用时携带的 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` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式推理与工具卡片在同一时长内浮出:它们以抬高的颜色出现,再退回到稳定时的暗色斜体或调色板颜色;从持久化历史重绘的卡片不带淡入,已经稳定下来的文字也不会再被调暗。
43
+ 每一帧都从终端左右两边各内缩一列绘制,因此对话记录与停靠的界面组件都不会有任何一行贴到两侧边缘。页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `❯` 开头,启用颜色时铺在一条通栏的着色背景带上(附件列在其下),而在已有模型步骤的轮次中被引导或注入的提示以暗色文字铺在更深的背景带上,退到它所加入的轮次之后,assistant 的推理以暗色斜体显示在 `✻ Thinking` 标题之下、Markdown 回复上方,每次工具调用是一张卡片,含状态符号(运行中为黄色的盲文旋转指示、完成为绿色 `◆`、失败为红色 `◆`)、粗体工具名、以紫色显示的呈现器标题(去掉呈现器重复写出的工具名,因此 `Read src/app.ts` 画成 `read src/app.ts`;shell 卡片取该次调用自身的摘要,绝不取命令,命令只由卡片的 `$` 行绘制一次)、运行中的一行加载标记,以及折叠到 `toolPreviewLines` 行的正文。卡片在模型开始调用时出现,先画标题,其下各行在约 `toolRevealFrames` 帧内逐行展开;工具回答后,结果行也以同样方式展开并浮出。`edit` 或 `write` diff 卡片把每一新增行整行铺满绿色背景、每一删除行整行铺满红色背景,删除的旧行在上、新增的新行在下,并把 `+` 与 `-` 画成各自更亮的颜色,使符号从填充色中读得出来;折行续行只延续填充色,不再画第二个符号;工具应用变更后,已应用的 hunk 取代调用时携带的 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
- 对话记录下方依次是 agent 工作时的旋转指示——其标签在模型推理时为 `thinking`,可见文本到达时为 `writing`,工具正在流出或仍在执行时为 `calling <tool>`,并带着当前这次模型调用的实时 `↑` 发送与 `↓` 接收 token,以紧凑的 `k` / `M` / `B` 计数,随数据流入增长,并在提供方的 usage 块到达后落定——任何打开的提示、有消息等待时的带框 follow-ups 列表、本轮 todo 与最新后代行的 activity board(有行时才绘制;已完成内容划掉,状态符号以绿色、黄色或青色显示,todo 最多四行其后 `+<n> more`,不是焦点区域,在 `turn/end` 与 bind 时消失)、编辑器、子 agent 面板,以及页脚:未聚焦时是一行由两端向内构建的状态栏。编辑器的光标是终端自身的闪烁竖条:应用在启动时请求这一形状,退出时把你的默认形状还回去,而状态栏或面板持有键盘期间完全不绘制光标。模型与入口按键带有颜色;进行中的轮次、上下文与 todo 信息分别使用黄色、紫色与绿色。模型锚定在左端且永不丢弃——超过 20 列时退回到裸模型名,只有仍然过宽的标签才会被省略号截断——离开编辑器的那两个按键则锚定在右端,写作 `Shift+↑ read · Shift+↓ status`,有 follow-ups 等待时则写作 `Shift+↑ select · Shift+↓ status`,窄到一定程度收缩为 `Shift+↑↓ nav`,不足 40 列时整体丢弃。关键事实填满剩下的中间部分,按状态栏顺序排列:推理强度(选择把推理交给模型时标为 `effort default`)、进行中轮次的已用时间、上下文窗口百分比、todo 计数,以及 workspace 路径(过长时以 `~` 与 `…/` 缩短)。中间部分容纳不下的每个分段都折进末尾的 `+N`,未聚焦行从不绘制的那些分段也一并折入——权限预设、token 用量(会话合计加上进行中的这次调用)、来自投影接缝的目标与计划模式标记,以及待发送附件的数量。压缩与模型请求重试以通知形式出现,与浏览器标记承载的事实相同。
45
+ 对话记录下方依次是 agent 工作时的旋转指示——其标签带着一道扫过的高亮,在模型推理时为 `thinking`,可见文本到达时为 `writing`,工具正在流出或仍在执行时为 `calling <tool>`,并带着当前这次模型调用的实时 `↑` 发送与 `↓` 接收 token,以紧凑的 `k` / `M` / `B` 计数,随数据流入增长,并在提供方的 usage 块到达后落定——任何打开的提示、有消息等待时的带框 follow-ups 列表、本轮 todo 与最新后代行的 activity board(有行时才绘制;已完成内容划掉,状态符号以绿色、黄色或青色显示,进行中的那一项为旋转指示,todo 最多四行其后 `+<n> more`,不是焦点区域,在 `turn/end` 与 bind 时消失)、编辑器、子 agent 面板,以及页脚:未聚焦时是一行由两端向内构建的状态栏。编辑器的光标是终端自身的闪烁竖条:应用在启动时请求这一形状,退出时把你的默认形状还回去,而状态栏或面板持有键盘期间完全不绘制光标。模型与入口按键带有颜色;进行中的轮次、上下文与 todo 信息分别使用黄色、紫色与绿色。模型锚定在左端且永不丢弃——超过 20 列时退回到裸模型名,只有仍然过宽的标签才会被省略号截断——离开编辑器的那两个按键则锚定在右端,写作 `Shift+↑ read · Shift+↓ status`,有 follow-ups 等待时则写作 `Shift+↑ select · Shift+↓ status`,窄到一定程度收缩为 `Shift+↑↓ nav`,不足 40 列时整体丢弃。关键事实填满剩下的中间部分,按状态栏顺序排列:推理强度(选择把推理交给模型时标为 `effort default`)、进行中轮次的已用时间、上下文窗口百分比、todo 计数,以及 workspace 路径(过长时以 `~` 与 `…/` 缩短)。中间部分容纳不下的每个分段都折进末尾的 `+N`,未聚焦行从不绘制的那些分段也一并折入——权限预设、token 用量(会话合计加上进行中的这次调用)、来自投影接缝的目标与计划模式标记,以及待发送附件的数量。压缩与模型请求重试以通知形式出现,与浏览器标记承载的事实相同。
46
46
 
47
47
  键盘在对话记录中移动时,编辑器正上方停靠着一个带边框的检视面板,边框即模式:它恰好在对话记录持有键盘时绘制。其顶边线带有一个反白的 ` ● READ ` 徽标与当前聚焦小节的标题——该小节在可导航块中的位置、所属轮次,以及这是哪一种小节——例如 `╭ ● READ ─ 3/12 · turn 2 · bash git status · result ─╮`。其下在块含多个部分时,把这些部分绘制成形如 `← 1 call · [2 result] →` 的带编号、会折行的选择行,被持有的标签除强调色外还加上方括号,因此完全无颜色时选择仍然可读;再往下是该小节自身的源文本行,每行左右两侧都由 `│ ` 边框闭合并按窄四列换行,对每一种小节——含系统提示词与注入的上下文——都折叠到 `focusPreviewLines` 行,其下写出 `… <n> more rows · Ctrl+G reads it`。底边线列出对话记录所应答的按键 `↑↓ sections · ←→ parts · Space folds · Ctrl+G reader · Esc input`,随着终端列数减少收缩为 `↑↓ ←→ · Space folds · Esc input`,再收缩为 `Esc input`。
48
48
 
@@ -52,7 +52,7 @@ dsh tui --no-open # print sign-in URLs without opening a
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 面板或状态栏上时,会把该表层的边框、其徽标与它持有的标记抬亮十二拍(每拍一个 `streamFadeStepMs`);对话记录走查中的一步把新聚焦的标记条抬亮六拍;状态栏上的一步把所选标签抬亮八拍。活动板上新出现或状态已变的 todo 行,以及被替换的后代行,也在同一时钟上像工具卡片一样浮出;重放与 `reducedMotion` 则画出已稳定的活动板。阅读器在自己占据的屏幕上一次性完整出现,而它新显示的内容会像工具卡片一样在同一时钟上浮出:打开它与显示另一个轮次时浮出整个轮次,在列表中步进到同一轮次的另一个小节时浮出该小节,历时 `streamFadeSteps` 拍;滚动、实时增长与重新换行都不浮出任何内容。任何抬亮都不改变任何东西绘制的行数,而 `reducedMotion`——与 `NO_COLOR`、被禁用的调色板和 `TERM=dumb` 一样——会把它们全部关闭,并且不为它们安排任何重绘。
55
+ 动效不止于流式文本,而且每种效果都乘着同一个淡入时钟。键盘落到对话记录、子 agent 面板或状态栏上时,会把该表层的边框、其徽标与它持有的标记抬亮十二拍(每拍一个 `streamFadeStepMs`);对话记录走查中的一步把新聚焦的标记条抬亮六拍;状态栏上的一步把所选标签抬亮八拍。活动板上新出现或状态已变的 todo 行,以及被替换的后代行,也在同一时钟上像工具卡片一样浮出;重放与 `reducedMotion` 则画出已稳定的活动板。运行中的工具卡片、折叠的子 agent 行与进行中的 todo 在各自的 80 ms 时钟上轮播盲文旋转帧,该时钟只在其中之一被绘制时才启动;标题行已滚动到渲染器可重绘区域之上的卡片自此画出静态的 `◆`。阅读器在自己占据的屏幕上一次性完整出现,而它新显示的内容会像工具卡片一样在同一时钟上浮出:打开它与显示另一个轮次时浮出整个轮次,在列表中步进到同一轮次的另一个小节时浮出该小节,历时 `streamFadeSteps` 拍;滚动、实时增长与重新换行都不浮出任何内容。任何抬亮都不改变任何东西绘制的行数,而 `reducedMotion`——与 `NO_COLOR`、被禁用的调色板和 `TERM=dumb` 一样——会把它们全部关闭,并且不为它们安排任何重绘。
56
56
 
57
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` 结尾,只要视图打开,输入框正上方就有一条着色行写着 `◆ subagent view · main › <label> · Ctrl+P back to <parent>`,无论对话记录滚动到哪里,`Ctrl+P` 或 `/parent` 返回上一层,并按父会话此刻的日志重绘它。只要这条链中任一会话正在运行轮次,`/new`、`/clear`、`/resume`、`/sessions` 与 `/fork` 都会拒绝,否则它们会随所离开的会话释放每一个视图;退出会释放每一个视图并保存根会话。
58
58
 
@@ -70,7 +70,7 @@ dsh tui --no-open # print sign-in URLs without opening a
70
70
  | `!command` / `!!command` | 在本终端运行;`!` 会作为下一步上下文供下一条提示阅读,`!!` 只留在本地 |
71
71
  | `Shift+Enter` | 插入换行 |
72
72
  | `Ctrl+S` | 轮次进行中时,把编辑器文本引导(steer)进当前轮次的下一步 |
73
- | `Up` / `Down` | 调出先前的提示 |
73
+ | `Up` / `Down` | 调出先前的提示;有 follow-ups 等待时,在空输入上按 `Up` 会把最新的 follow-up 从队列移入编辑器,与 follow-ups 面板中的 `E` 是同一种修订 |
74
74
  | `Shift+Left` / `Shift+Right` | 用 pi-tui 的编辑器导航向左 / 右移动一个词;在 `I want to do` 末尾按 `Shift+Left` 会落在 `do` 之前 |
75
75
  | `Tab` | 采用编辑器给出的补全 |
76
76
  | `Shift+Tab` | 打开当前模型的推理强度选择器,从下一次请求生效;与空参数 `/effort` 打开的是同一个选择器 |
@@ -233,7 +233,7 @@ follow-ups 面板持有键盘时:
233
233
  | `streamFadeStepMs` | `16` | 一帧的时长:淡入或浮出的一拍、仍在变化时的重绘周期,也是逐帧绘制流式文字的周期;总时长为 `streamFadeSteps × streamFadeStepMs` |
234
234
  | `streamPaceFrames` | `8` | 积压的流式回复文字或工具参数要经过多少帧才全部上屏。思考块结束时,或回复文字或工具调用开始时,仍在队列中的思考立即画出;`0` 与 `reducedMotion` 一样,收到即绘制 |
235
235
  | `toolRevealFrames` | `6` | 工具卡片出现或其结果落下时,其各行展开所用的帧数,每帧展开隐藏行的一份。展开卡片,以及正在展开的行已位于渲染器可重绘范围之上的卡片,都会一次画出所有行;`0` 与 `reducedMotion` 一样,一次画出所有行 |
236
- | `reducedMotion` | `false` | 以稳定颜色绘制流式文本、流式推理、工具卡片与应用自身的边框装饰,不做淡入、不做抬亮,也不重复重绘 |
236
+ | `reducedMotion` | `false` | 以稳定颜色绘制流式文本、流式推理、工具卡片与应用自身的边框装饰,不做淡入、不做抬亮、没有旋转符号或扫光,也不重复重绘 |
237
237
  | `openBrowser` | `true` | 把被标记的授权页面交给本地默认浏览器 |
238
238
  | `btwTools` | `read`、`read_image`、`glob`、`grep`、`web_search`、`web_fetch`、`session_*` 查询工具、`skill`、MCP 资源读取工具、`ask_user_question` | `/btw` 旁路 agent 可以调用的全局工具;本组合未注册的名称会被跳过 |
239
239
  | `btwSandboxedTools` | `bash`、`pwsh` | 仅当命令执行器会约束命令时 `/btw` 旁路 agent 才可调用的命令工具;它们在 `read-only` 沙箱模式下运行 |
@@ -290,11 +290,12 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
290
290
  | [`src/fade.ts`](src/fade.ts) | 流式文本淡入与浮出:基于挂钟的尾部追踪器、块时钟与注册表、淡入亮度级别、浮出混合,以及对已渲染行的重新着色 |
291
291
  | [`src/pace.ts`](src/pace.ts) | 流式节拍器:助手流与对话记录之间的有序队列,每帧释放积压的一份;以及以同样方式展开工具卡片的逐行展开器 |
292
292
  | [`src/motion.ts`](src/motion.ts) | 边框装饰的动效时钟与其调用点所绘的三级抬亮:落键、小节步进与状态栏走查 |
293
+ | [`src/spinner.ts`](src/spinner.ts) | 运行中符号轮播的盲文旋转帧,以及工作旋转指示标签所带的扫光 |
293
294
  | [`src/prompts.ts`](src/prompts.ts) | 审批、提问、选择器与只读详情提示以及模态队列 |
294
295
  | [`src/toast.ts`](src/toast.ts) | 临时按键提示行:其浮层、其时钟,以及它承载的各条文字 |
295
296
  | [`src/transcript.ts`](src/transcript.ts) | 呈现视图、用量与轮次结束原因的纯文本折叠、`$ command` 的 span,以及每条标记共用的那一套折叠措辞 |
296
297
  | [`src/diff.ts`](src/diff.ts) | diff 卡片的行 diff、hunk 选择,以及卡片加框所依据的新增与删除标记 |
297
- | [`src/style.ts`](src/style.ts) | 调色板(含 Markdown 回复所用的暗色冷色阶标题与链接色、已完成 todo 内容所用的划线角色、提示所铺的背景带、diff 卡片变更行的绿色与红色填充及符号颜色)与派生的 pi-tui 主题 |
298
+ | [`src/style.ts`](src/style.ts) | 调色板(含 Markdown 回复所用的暗色冷色阶标题与链接色、已完成 todo 内容所用的划线角色、提示所铺的背景带与被引导或注入的提示所铺的更深背景带、diff 卡片变更行的绿色与红色填充及符号颜色)与派生的 pi-tui 主题 |
298
299
  | [`src/highlight.ts`](src/highlight.ts) | 围栏代码、文件行与 shell 命令的语法高亮:某个块可能加载的语法、由背景选定的配色主题,以及一个 token 所用的 SGR |
299
300
  | [`src/completion.ts`](src/completion.ts) | 编辑器的斜杠命令与 `@` 引用补全 |
300
301
  | [`src/editor.ts`](src/editor.ts) | 提示编辑器的终端光标、把 `Shift+Left` / `Shift+Right` 映射到 pi-tui 词导航的逻辑,以及 `!` / `!!` 草稿上的语法高亮 |
@@ -315,6 +316,7 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
315
316
  | [`tests/editor.spec.ts`](tests/editor.spec.ts) | 对照 pi-tui 编辑器行为验证终端光标、`Shift+Left` / `Shift+Right` 词导航,以及 `!` / `!!` 草稿着色 |
316
317
  | [`tests/frame.spec.ts`](tests/frame.spec.ts) | 边框线、徽标、正文行,以及某个宽度容纳得下的按键提示 |
317
318
  | [`tests/motion.spec.ts`](tests/motion.spec.ts) | 动效时钟的各个级别、它对重绘的要求,以及每一级所绘的抬亮 |
319
+ | [`tests/spinner.spec.ts`](tests/spinner.spec.ts) | 旋转帧的步进,以及扫光的扫过、停顿与调色板禁用时的输出 |
318
320
  | [`tests/pace.spec.ts`](tests/pace.spec.ts) | 节拍器的每帧份额、按字素切分、到达顺序、flush、按通道 flush 与 clear,以及逐行展开器的每帧份额、settle 与 clamp |
319
321
  | [`tests/stream-pace.spec.ts`](tests/stream-pace.spec.ts) | 按流顺序分批绘制的回复文字与工具参数,思考块结束时画出思考,流结束时与已记录事件前的 flush,reducedMotion,以及在帧节拍上展开的工具卡片 |
320
322
  | [`tests/view-banner.spec.ts`](tests/view-banner.spec.ts) | 子 agent 视图行的路径、返回目标、宽度,以及在主会话时不绘制 |
@@ -2732,6 +2732,7 @@ const SGR = {
2732
2732
  error: ["31", "39"],
2733
2733
  inverse: ["7", "27"],
2734
2734
  band: ["48;5;236", "49"],
2735
+ injectedBand: ["48;5;234", "49"],
2735
2736
  addedBand: ["48;5;22", "49"],
2736
2737
  removedBand: ["48;5;52", "49"],
2737
2738
  addedSign: ["38;5;120", "39"],
@@ -2761,6 +2762,7 @@ function createPalette(enabled) {
2761
2762
  error: role("error"),
2762
2763
  inverse: role("inverse"),
2763
2764
  band: role("band"),
2765
+ injectedBand: role("injectedBand"),
2764
2766
  addedBand: role("addedBand"),
2765
2767
  removedBand: role("removedBand"),
2766
2768
  addedSign: role("addedSign"),
@@ -2785,15 +2787,16 @@ function paintDiffRows(rows, source, palette) {
2785
2787
  });
2786
2788
  }
2787
2789
  /**
2788
- * Lay one row on the {@link Palette.band} tint across the full width.
2790
+ * Lay one row on a background tint across the full width.
2789
2791
  * @param palette - the active palette.
2790
2792
  * @param row - the styled row, at most `width` columns.
2791
2793
  * @param width - the columns the band spans.
2794
+ * @param band - the tint; {@link Palette.band} by default.
2792
2795
  * @returns the row padded to `width` under the tint; the row unchanged, with
2793
2796
  * no padding, when the palette is disabled.
2794
2797
  */
2795
- function bandRow(palette, row, width) {
2796
- return palette.enabled ? palette.band(`${row}${" ".repeat(Math.max(0, width - visibleWidth(row)))}`) : row;
2798
+ function bandRow(palette, row, width, band = palette.band) {
2799
+ return palette.enabled ? band(`${row}${" ".repeat(Math.max(0, width - visibleWidth(row)))}`) : row;
2797
2800
  }
2798
2801
  /**
2799
2802
  * The `+` or `-` of a changed row, painted apart from the tint the row is
@@ -3135,13 +3138,17 @@ var UserShellBlock = class {
3135
3138
  }
3136
3139
  };
3137
3140
  /**
3138
- * A prompt the user submitted, drawn with a leading {@link USER_GLYPH} on the
3139
- * palette's background band, which spans every row of the prompt.
3141
+ * A prompt the user submitted, drawn with a leading {@link USER_GLYPH} on a
3142
+ * background band that spans every row of the prompt: the palette's band and
3143
+ * bold text for a prompt that opened its turn, and the darker
3144
+ * {@link Palette.injectedBand} with dim text for one steered or injected into
3145
+ * a running turn, so it recedes behind the turn it joined.
3140
3146
  */
3141
3147
  var UserBlock = class {
3142
3148
  theme;
3143
3149
  text;
3144
3150
  turn;
3151
+ kind;
3145
3152
  navigable = true;
3146
3153
  blockKind = "user";
3147
3154
  /** The section drawn as focused; absent while the keyboard is elsewhere. */
@@ -3150,10 +3157,11 @@ var UserBlock = class {
3150
3157
  highlightLevel = 0;
3151
3158
  /** The wrapped prompt, by width and whether the gutter narrowed it. */
3152
3159
  drawn = new LastDrawn();
3153
- constructor(theme, text, turn) {
3160
+ constructor(theme, text, turn, kind = "prompt") {
3154
3161
  this.theme = theme;
3155
3162
  this.text = text;
3156
3163
  this.turn = turn;
3164
+ this.kind = kind;
3157
3165
  }
3158
3166
  /**
3159
3167
  * The prompt as one navigable section.
@@ -3180,7 +3188,9 @@ var UserBlock = class {
3180
3188
  const palette = this.theme.palette;
3181
3189
  const { marked, content: inner } = focusFrame(width, this.highlight);
3182
3190
  const lines = this.drawn.get(`${String(width)}:${String(marked)}`, () => {
3183
- return ["", ...wrapTextWithAnsi(this.text, Math.max(1, inner - 2)).map((line, index) => bandRow(palette, `${palette.accent(index === 0 ? USER_GLYPH : " ")} ${palette.bold(line)}`, inner))];
3191
+ const body = wrapTextWithAnsi(this.text, Math.max(1, inner - 2));
3192
+ if (this.kind === "injected") return ["", ...body.map((line, index) => bandRow(palette, palette.dim(`${index === 0 ? USER_GLYPH : " "} ${line}`), inner, palette.injectedBand))];
3193
+ return ["", ...body.map((line, index) => bandRow(palette, `${palette.accent(index === 0 ? USER_GLYPH : " ")} ${palette.bold(line)}`, inner))];
3184
3194
  });
3185
3195
  return marked ? withGutter(palette, lines, () => true, this.highlightLevel) : lines;
3186
3196
  }
@@ -3673,8 +3683,11 @@ var AssistantBlock = class {
3673
3683
  * The card arrives in two pieces, and each floats out on its own: the header
3674
3684
  * and the call rows when the model starts the call (a stream delta, or the
3675
3685
  * logged `tool/call`), the result rows when the tool answers. While it runs
3676
- * the body carries {@link TOOL_RUNNING_ROW} in place of a result. A card
3677
- * rebuilt from history carries neither fade.
3686
+ * the body carries {@link TOOL_RUNNING_ROW} in place of a result, and a card
3687
+ * given a spinner ({@link ToolBlock.setSpinner}) cycles its glyph until the
3688
+ * result lands or its header leaves the renderer's repaint window, then draws
3689
+ * the static glyph. A card rebuilt from history carries neither fade nor
3690
+ * spinner.
3678
3691
  */
3679
3692
  var ToolBlock = class {
3680
3693
  theme;
@@ -3693,6 +3706,8 @@ var ToolBlock = class {
3693
3706
  expanded = false;
3694
3707
  fade;
3695
3708
  resultFade;
3709
+ /** The glyph a running card draws right now; absent draws {@link TOOL_GLYPH}. */
3710
+ spinner;
3696
3711
  /** First line of this card either fade may still recolor. */
3697
3712
  repaintFloor = 0;
3698
3713
  /** The section drawn as focused; absent while the keyboard is elsewhere. */
@@ -3797,14 +3812,34 @@ var ToolBlock = class {
3797
3812
  this.resultFade = fade;
3798
3813
  }
3799
3814
  /**
3815
+ * Cycle the header glyph while the card runs.
3816
+ * @param frame - the glyph to draw at the moment of a render.
3817
+ */
3818
+ setSpinner(frame) {
3819
+ this.spinner = frame;
3820
+ }
3821
+ /**
3822
+ * Whether a render right now may draw a different glyph than the last one.
3823
+ * @returns true while the card runs with a spinner its header can still show.
3824
+ */
3825
+ spinning() {
3826
+ return this.spinner !== void 0 && this.status === "running";
3827
+ }
3828
+ /**
3800
3829
  * Hand the rows the renderer can no longer repaint back to the colors this
3801
3830
  * card drew them in, so a fade that is still moving never rewrites them.
3802
3831
  * @param floor - this card's own first repaintable line; the application
3803
3832
  * raises it as the frame grows and never lowers it.
3804
- * @returns whether the floor took rows away from a fade that is drawing
3805
- * right now, and so whether the frame differs from the one just built.
3833
+ * @returns whether the floor took rows away from a fade or a spinner that
3834
+ * is drawing right now, and so whether the frame differs from the one just
3835
+ * built.
3806
3836
  */
3807
3837
  setRepaintFloor(floor) {
3838
+ if (this.spinning() && floor > 1) {
3839
+ this.spinner = void 0;
3840
+ this.repaintFloor = Math.max(this.repaintFloor, floor);
3841
+ return true;
3842
+ }
3808
3843
  const reveal = this.reveal;
3809
3844
  if (reveal !== void 0 && reveal.shown() < this.rows && floor > 1 + reveal.shown()) {
3810
3845
  reveal.settle();
@@ -3885,7 +3920,7 @@ var ToolBlock = class {
3885
3920
  const palette = this.theme.palette;
3886
3921
  const { marked, content: outer } = focusFrame(width, this.highlight);
3887
3922
  const layout = this.drawn.get(`${String(width)}:${String(marked)}:${String(this.expanded)}:${this.status}:${String(this.revision)}`, () => this.layout(outer, marked));
3888
- const call = faded(layout.call, this.fade, this.repaintFloor - 1);
3923
+ const call = faded(this.spun(layout.call), this.fade, this.repaintFloor - 1);
3889
3924
  const result = faded(layout.result, this.resultFade, this.repaintFloor - 1 - layout.call.length);
3890
3925
  const full = call === layout.call && result === layout.result ? layout.lines : [
3891
3926
  "",
@@ -3970,6 +4005,22 @@ var ToolBlock = class {
3970
4005
  };
3971
4006
  }
3972
4007
  /**
4008
+ * The call rows with the header's running glyph replaced by the spinner's
4009
+ * current frame. The kept layout draws the static glyph, so a spinner frame
4010
+ * rewrites one prefix instead of laying the card out again.
4011
+ * @param call - the header and call rows as the kept layout draws them.
4012
+ * @returns `call` itself when nothing spins, or a copy with the frame drawn.
4013
+ */
4014
+ spun(call) {
4015
+ if (this.spinner === void 0 || !this.spinning()) return call;
4016
+ const palette = this.theme.palette;
4017
+ const settled = palette.warning(TOOL_GLYPH);
4018
+ const [header, ...rows] = call;
4019
+ /* v8 ignore next -- a running card's header and subagent row both open on the warning glyph */
4020
+ if (header?.startsWith(settled) !== true) return call;
4021
+ return [`${palette.warning(this.spinner())}${header.slice(settled.length)}`, ...rows];
4022
+ }
4023
+ /**
3973
4024
  * The colour of this card's status glyph.
3974
4025
  * @returns warning while running, success once done, error once failed.
3975
4026
  */
@@ -4042,6 +4093,81 @@ function floatingOutSpans(fade) {
4042
4093
  return fade.spans().filter((span) => span.age < fade.steps);
4043
4094
  }
4044
4095
  //#endregion
4096
+ //#region lib/types/spinner.js
4097
+ /**
4098
+ * Working indicators: the braille frames a running tool card, a folded
4099
+ * subagent row, and an in-progress todo cycle through in place of their static
4100
+ * glyph, and the shimmer the working spinner's activity word carries.
4101
+ *
4102
+ * Pure. Both read a wall-clock instant the caller passes in, so every surface
4103
+ * drawing at the same moment draws the same frame, and the application owns
4104
+ * the tick that redraws them.
4105
+ * @module @deepseek-ai/dsh-tui-app/spinner
4106
+ */
4107
+ /**
4108
+ * The frames a running glyph cycles through: the braille frames pi-tui's
4109
+ * working spinner draws, each one column wide like the glyph it replaces.
4110
+ */
4111
+ const SPINNER_FRAMES = [
4112
+ "⠋",
4113
+ "⠙",
4114
+ "⠹",
4115
+ "⠸",
4116
+ "⠼",
4117
+ "⠴",
4118
+ "⠦",
4119
+ "⠧",
4120
+ "⠇",
4121
+ "⠏"
4122
+ ];
4123
+ /** Blank steps between two shimmer passes, so the sweep pauses past the word's end. */
4124
+ const SHIMMER_GAP = 6;
4125
+ /**
4126
+ * The spinner frame drawn at one instant.
4127
+ * @param now - the current time in milliseconds.
4128
+ * @returns one frame of {@link SPINNER_FRAMES}.
4129
+ */
4130
+ function spinnerFrame(now) {
4131
+ /* v8 ignore next -- the modulo keeps the index inside the frame list */
4132
+ return SPINNER_FRAMES[Math.floor(now / 80) % SPINNER_FRAMES.length] ?? SPINNER_FRAMES[0];
4133
+ }
4134
+ /**
4135
+ * Draw `text` dim with a bright highlight sweeping across it, one character
4136
+ * per {@link SPINNER_MS}: the character under the sweep is bold, its
4137
+ * neighbours are drawn at the plain foreground, and the sweep rests for
4138
+ * {@link SHIMMER_GAP} steps past the end before starting again.
4139
+ * @param palette - the palette the sweep is drawn with; a disabled palette returns `text` unchanged.
4140
+ * @param text - the plain text to draw.
4141
+ * @param now - the current time in milliseconds.
4142
+ * @returns the styled text, the same visible width as `text`.
4143
+ */
4144
+ function shimmer(palette, text, now) {
4145
+ const chars = Array.from(new Intl.Segmenter().segment(text), (part) => part.segment);
4146
+ const at = Math.floor(now / 80) % (chars.length + SHIMMER_GAP);
4147
+ const tone = (index) => {
4148
+ const distance = Math.abs(index - at);
4149
+ return distance === 0 ? "bright" : distance === 1 ? "plain" : "dim";
4150
+ };
4151
+ let out = "";
4152
+ let run = "";
4153
+ let current;
4154
+ const flush = () => {
4155
+ if (current === void 0 || run === "") return;
4156
+ out += current === "bright" ? palette.bold(run) : current === "plain" ? run : palette.dim(run);
4157
+ run = "";
4158
+ };
4159
+ for (const [index, char] of chars.entries()) {
4160
+ const next = tone(index);
4161
+ if (next !== current) {
4162
+ flush();
4163
+ current = next;
4164
+ }
4165
+ run += char;
4166
+ }
4167
+ flush();
4168
+ return out;
4169
+ }
4170
+ //#endregion
4045
4171
  //#region lib/types/completion.js
4046
4172
  /**
4047
4173
  * Editor completion: `/` at the start of the message opens the command list,
@@ -5331,9 +5457,9 @@ const HINTS = {
5331
5457
  "Esc input"
5332
5458
  ],
5333
5459
  queue: [
5334
- "enter steer · ↑ select/edit · esc cancel",
5335
- "enter steer · esc cancel",
5336
- "esc cancel"
5460
+ "↑↓ select · Enter steer · E edit · I inject · Esc input",
5461
+ "↑↓ · Enter steer · E edit · Esc input",
5462
+ "Esc input"
5337
5463
  ],
5338
5464
  panel: [
5339
5465
  "↑↓ children · Enter opens · Tab regions · Esc input",
@@ -5372,10 +5498,11 @@ const ENTRY_KEYS = "Shift+↑ read · Shift+↓ status";
5372
5498
  /** The same pair while follow-ups wait: Shift+↑ selects one instead of reading. */
5373
5499
  const QUEUE_ENTRY_KEYS = "Shift+↑ select · Shift+↓ status";
5374
5500
  /**
5375
- * The key the unfocused follow-ups list names. Shift+↑ is the direction out
5376
- * of the input toward whatever sits above it.
5501
+ * The keys the unfocused follow-ups list names: ↑ on an empty input revises
5502
+ * the newest follow-up, and Shift+↑ is the direction out of the input toward
5503
+ * whatever sits above it.
5377
5504
  */
5378
- const QUEUE_ENTRY_HINT = "shift+↑ select";
5505
+ const QUEUE_ENTRY_HINT = "↑ edit · Shift+↑ select";
5379
5506
  /**
5380
5507
  * The entry keys the unfocused status bar reserves before any fact is placed,
5381
5508
  * in declared degradation steps. Both directions are named: reaching the
@@ -5412,7 +5539,7 @@ const KEY_LINES = {
5412
5539
  "@ completes paths and sessions · / completes commands · Tab takes one",
5413
5540
  "!cmd runs here · the next prompt can read it · !!cmd stays local",
5414
5541
  `${ENTRY_KEYS} · Ctrl+G reader`,
5415
- "Shift+↑ selects follow-ups while they wait",
5542
+ "While follow-ups wait: ↑ on an empty input edits the newest · Shift+↑ selects one",
5416
5543
  "Ctrl+O folds every tool card and context row",
5417
5544
  "Ctrl+T todos · Ctrl+P parent session · Ctrl+L redraw · ? keys",
5418
5545
  "Esc arms the stop · Esc again stops the turn",
@@ -5463,11 +5590,13 @@ function resolveKey(region, data) {
5463
5590
  * What one key means while the editor holds the keyboard. Shift+Up and
5464
5591
  * Shift+Down leave along the stack: the application lands on the first
5465
5592
  * drawn region in that direction — follow-ups or the conversation above,
5466
- * the subagent panel or the status bar below.
5593
+ * the subagent panel or the status bar below. `Up` is offered to the newest
5594
+ * follow-up first, and reaches the editor's history when none is taken.
5467
5595
  * @param data - the raw key bytes.
5468
5596
  * @returns the action, or undefined for every key pi-tui's editor owns.
5469
5597
  */
5470
5598
  function editorKey(data) {
5599
+ if (matchesKey(data, "up")) return { kind: "edit-latest" };
5471
5600
  if (matchesKey(data, "shift+up")) return {
5472
5601
  kind: "leave",
5473
5602
  direction: "up"
@@ -7850,8 +7979,17 @@ function activityTurnEndStatus(reason) {
7850
7979
  return turnEndNotice(reason) ?? "done";
7851
7980
  }
7852
7981
  /**
7853
- * Render the board. Todo rows lead with status-colored glyphs; completed
7854
- * content is dim and scratched out. A list past the cap ends on `+<n> more`.
7982
+ * Whether one board draw holds a row the spinner animates.
7983
+ * @param view - the rows one draw produced.
7984
+ * @returns true while an in-progress todo is drawn.
7985
+ */
7986
+ function activityBoardSpins(view) {
7987
+ return view.todos.some((row) => row.status === "in_progress");
7988
+ }
7989
+ /**
7990
+ * Render the board. Todo rows lead with status-colored glyphs, an in-progress
7991
+ * one with the spinner frame when one is given; completed content is dim and
7992
+ * scratched out. A list past the cap ends on `+<n> more`.
7855
7993
  * The descendant line is last. An empty view returns the empty string so the
7856
7994
  * slot can unmount.
7857
7995
  * @param view - the rows one draw produced.
@@ -7864,7 +8002,8 @@ function renderActivityBoard(view, render) {
7864
8002
  for (const row of view.todos) {
7865
8003
  const content = paintTodoContent(row.content, row.status, (text) => palette.dim(palette.strikethrough(text)));
7866
8004
  const paint = row.status === "completed" ? palette.success : row.status === "in_progress" ? palette.warning : palette.accent;
7867
- lines.push(fadedLine(`${paint(TODO_GLYPH[row.status])} ${content}`, render.todoFades?.get(row.content)));
8005
+ const glyph = row.status === "in_progress" && render.spinner !== void 0 ? render.spinner : TODO_GLYPH[row.status];
8006
+ lines.push(fadedLine(`${paint(glyph)} ${content}`, render.todoFades?.get(row.content)));
7868
8007
  }
7869
8008
  if (view.hidden > 0) lines.push(palette.dim(`+${String(view.hidden)} more`));
7870
8009
  if (view.subagent !== void 0) lines.push(fadedLine(palette.dim(view.subagent), render.subagentFade));
@@ -10623,6 +10762,18 @@ var TuiApp = class {
10623
10762
  pacer;
10624
10763
  /** Tool cards whose rows are still unrolling; each drops out once its reveal caught up. */
10625
10764
  reveals = /* @__PURE__ */ new Set();
10765
+ /** Running tool cards whose glyph spins; each drops out once it stops spinning. */
10766
+ spinners = /* @__PURE__ */ new Set();
10767
+ /** Whether the activity board last drew an in-progress todo on the spinner. */
10768
+ boardSpins = false;
10769
+ /**
10770
+ * Whether the open turn has committed an assistant message, after which a
10771
+ * user prompt reaching the log was steered or injected rather than opening
10772
+ * the turn.
10773
+ */
10774
+ turnStepped = false;
10775
+ /** Disposer of the spinner tick while it is armed. */
10776
+ spinTicker;
10626
10777
  /**
10627
10778
  * The chrome motions running right now. It is consulted whatever the
10628
10779
  * terminal draws, because a transient line has to come down again even on a
@@ -10727,7 +10878,7 @@ var TuiApp = class {
10727
10878
  palette,
10728
10879
  previewLines: deps.focusPreviewLines
10729
10880
  });
10730
- this.loader = new Loader(this.tui, palette.accent, palette.dim, "thinking");
10881
+ this.loader = new Loader(this.tui, palette.accent, (message) => this.paintLoaderMessage(message), "thinking");
10731
10882
  this.loader.stop();
10732
10883
  this.editor = new BarCursorEditor(this.tui, editorTheme(palette), { paddingX: 1 });
10733
10884
  this.editor.shellPaint = {
@@ -10894,6 +11045,7 @@ var TuiApp = class {
10894
11045
  this.stopped = true;
10895
11046
  this.updateTicker();
10896
11047
  this.updateFadeTicker();
11048
+ this.updateSpinTicker();
10897
11049
  this.cancelPickers();
10898
11050
  for (const dispose of this.disposers.splice(0)) dispose();
10899
11051
  this.modals.withdrawActive();
@@ -10934,10 +11086,13 @@ var TuiApp = class {
10934
11086
  this.submittedIds.clear();
10935
11087
  this.todoTurns.clear();
10936
11088
  this.turn = 0;
11089
+ this.turnStepped = false;
10937
11090
  this.sawSystemPrompt = false;
10938
11091
  this.turnStartedAt = void 0;
10939
11092
  this.pacer?.clear();
10940
11093
  this.reveals.clear();
11094
+ this.spinners.clear();
11095
+ this.updateSpinTicker();
10941
11096
  this.streaming = void 0;
10942
11097
  this.endFade();
10943
11098
  this.blockFades.clear();
@@ -11262,14 +11417,18 @@ var TuiApp = class {
11262
11417
  * the rest of the time.
11263
11418
  */
11264
11419
  refreshActivityBoard() {
11265
- const text = renderActivityBoard(activityBoardView({
11420
+ const view = activityBoardView({
11266
11421
  todos: this.activityTodos,
11267
11422
  ...this.activitySubagent === void 0 ? {} : { subagent: this.activitySubagent }
11268
- }), {
11423
+ });
11424
+ this.boardSpins = !this.deps.reducedMotion && activityBoardSpins(view);
11425
+ const text = renderActivityBoard(view, {
11269
11426
  palette: this.deps.palette,
11270
11427
  todoFades: this.activityTodoFades,
11271
- ...this.activitySubagentFade === void 0 ? {} : { subagentFade: this.activitySubagentFade }
11428
+ ...this.activitySubagentFade === void 0 ? {} : { subagentFade: this.activitySubagentFade },
11429
+ ...this.boardSpins ? { spinner: spinnerFrame(this.deps.now()) } : {}
11272
11430
  });
11431
+ this.updateSpinTicker();
11273
11432
  const mounted = this.activitySlot.children.length > 0;
11274
11433
  if (text === "") {
11275
11434
  if (mounted) this.activitySlot.removeChild(this.activity);
@@ -11959,6 +12118,13 @@ var TuiApp = class {
11959
12118
  case "queue":
11960
12119
  this.actOnQueuedPrompt(action.action);
11961
12120
  return { consume: true };
12121
+ case "edit-latest": {
12122
+ const latest = this.queueView.at(-1);
12123
+ if (latest === void 0 || this.queueDraft !== void 0 || this.editor.getText() !== "") return void 0;
12124
+ this.queueSelection = latest.message.id;
12125
+ this.actOnQueuedPrompt("edit");
12126
+ return { consume: true };
12127
+ }
11962
12128
  case "effort":
11963
12129
  if (this.switching) {
11964
12130
  this.notice(SESSION_SWITCH_WAIT, "error");
@@ -13604,6 +13770,45 @@ var TuiApp = class {
13604
13770
  this.trackReveal(block);
13605
13771
  }
13606
13772
  /**
13773
+ * Spin a new card's glyph until its result lands. A card drawn from a
13774
+ * replayed log, and every card under reduced motion, draws the static glyph.
13775
+ * @param block - the card that was just mounted.
13776
+ */
13777
+ spinBlock(block) {
13778
+ if (this.replaying || this.deps.reducedMotion) return;
13779
+ block.setSpinner(() => spinnerFrame(this.deps.now()));
13780
+ this.spinners.add(block);
13781
+ this.updateSpinTicker();
13782
+ }
13783
+ /**
13784
+ * Arm the spinner tick while a card or an in-progress todo spins and disarm
13785
+ * it otherwise, so a session with nothing running runs no spinner timer.
13786
+ * Exactly one runs at a time, and a stopped app runs none.
13787
+ */
13788
+ updateSpinTicker() {
13789
+ if (!this.stopped && (this.spinners.size > 0 || this.boardSpins)) {
13790
+ this.spinTicker ??= this.deps.tick(() => {
13791
+ this.onSpinTick();
13792
+ }, 80);
13793
+ return;
13794
+ }
13795
+ const ticker = this.spinTicker;
13796
+ if (ticker === void 0) return;
13797
+ this.spinTicker = void 0;
13798
+ ticker();
13799
+ }
13800
+ /**
13801
+ * One spinner period: drop the cards that stopped spinning, then redraw the
13802
+ * rest. The board's text is built when something changes it, so it is
13803
+ * built again here on its next frame.
13804
+ */
13805
+ onSpinTick() {
13806
+ for (const block of this.spinners) if (!block.spinning()) this.spinners.delete(block);
13807
+ if (this.boardSpins) this.refreshActivityBoard();
13808
+ else if (this.spinners.size > 0) this.tui.requestRender();
13809
+ this.updateSpinTicker();
13810
+ }
13811
+ /**
13607
13812
  * Keep a card on the frame tick while it has rows to unroll, which a call
13608
13813
  * or a result that makes it grow gives it again.
13609
13814
  * @param block - the card that just changed.
@@ -13751,7 +13956,7 @@ var TuiApp = class {
13751
13956
  part: section.cursor.part,
13752
13957
  level: this.markLift()
13753
13958
  } : void 0;
13754
- const fades = this.fadesMoving();
13959
+ const fades = this.fadesMoving() || this.spinners.size > 0;
13755
13960
  if (!fades && wanted === void 0 && this.highlighted === void 0) return false;
13756
13961
  let start = this.header.render(width).length;
13757
13962
  let wantedStart;
@@ -13876,6 +14081,7 @@ var TuiApp = class {
13876
14081
  case "turn/start":
13877
14082
  this.turn = event.data.turn;
13878
14083
  this.turnStartedAt = event.time;
14084
+ this.turnStepped = false;
13879
14085
  this.clearActivityBoard();
13880
14086
  this.updateTicker();
13881
14087
  this.refreshFooter();
@@ -13895,6 +14101,7 @@ var TuiApp = class {
13895
14101
  const text = message.content.filter((block) => block.type === "text").map((block) => block.text).join("");
13896
14102
  const reasoning = message.content.filter((block) => block.type === "reasoning").map((block) => block.text).join("");
13897
14103
  this.streamingBlock().commit(text, reasoning, interrupted === true);
14104
+ this.turnStepped = true;
13898
14105
  this.streaming = void 0;
13899
14106
  this.endFade();
13900
14107
  this.clearLiveUsage();
@@ -13917,6 +14124,8 @@ var TuiApp = class {
13917
14124
  const isError = result.isError === true;
13918
14125
  const body = toolResultBody(this.presentResult(block.name, this.toolArguments.get(result.toolCallId), result.content, isError, event.data.meta), result.content);
13919
14126
  block.setResult(body.lines, isError, body.code, body.diff);
14127
+ this.spinners.delete(block);
14128
+ this.updateSpinTicker();
13920
14129
  this.fadeBlock((fade) => {
13921
14130
  block.setResultFade(fade);
13922
14131
  });
@@ -13989,7 +14198,8 @@ var TuiApp = class {
13989
14198
  const source = message.source;
13990
14199
  if (source.kind === "user") {
13991
14200
  const attachments = message.content.filter((block) => block.type !== "text").map((block) => `[${block.type}]`);
13992
- this.chat.addChild(new UserBlock(this.theme, [contentText(message.content), ...attachments].filter((part) => part !== "").join("\n"), this.turn));
14201
+ const text = [contentText(message.content), ...attachments].filter((part) => part !== "").join("\n");
14202
+ this.chat.addChild(new UserBlock(this.theme, text, this.turn, this.turnStepped ? "injected" : "prompt"));
13993
14203
  return;
13994
14204
  }
13995
14205
  const view = injectedContextView(source, message.content);
@@ -14106,6 +14316,20 @@ var TuiApp = class {
14106
14316
  this.refreshLoader();
14107
14317
  this.refreshFooter();
14108
14318
  }
14319
+ /**
14320
+ * Paint the working spinner's message on each of its frames: the activity
14321
+ * word carries the shimmer, and the live ↑↓ suffix stays dim. Under reduced
14322
+ * motion the whole message is dim.
14323
+ * @param message - the loader's message, the activity word first.
14324
+ * @returns the styled message.
14325
+ */
14326
+ paintLoaderMessage(message) {
14327
+ const palette = this.deps.palette;
14328
+ const activity = this.loaderActivity;
14329
+ if (this.deps.reducedMotion || !message.startsWith(activity)) return palette.dim(message);
14330
+ const rest = message.slice(activity.length);
14331
+ return `${shimmer(palette, activity, this.deps.now())}${rest === "" ? "" : palette.dim(rest)}`;
14332
+ }
14109
14333
  /** Draw the spinner label plus the current call's ↑send ↓receive suffix. */
14110
14334
  refreshLoader() {
14111
14335
  const suffix = formatLiveUsage(this.liveUsage);
@@ -14180,6 +14404,7 @@ var TuiApp = class {
14180
14404
  block.setFade(fade);
14181
14405
  });
14182
14406
  this.revealBlock(block);
14407
+ this.spinBlock(block);
14183
14408
  if (source === "stream") this.unconfirmedTools.set(callId, block);
14184
14409
  }
14185
14410
  /**
@@ -14191,6 +14416,7 @@ var TuiApp = class {
14191
14416
  for (const [callId, block] of this.unconfirmedTools) {
14192
14417
  this.chat.removeChild(block);
14193
14418
  this.reveals.delete(block);
14419
+ this.spinners.delete(block);
14194
14420
  this.toolBlocks.delete(callId);
14195
14421
  this.toolArguments.delete(callId);
14196
14422
  this.toolStreamArgs.delete(callId);
@@ -14198,6 +14424,7 @@ var TuiApp = class {
14198
14424
  }
14199
14425
  this.unconfirmedTools.clear();
14200
14426
  this.updateFadeTicker();
14427
+ this.updateSpinTicker();
14201
14428
  this.syncLoaderFromPendingTools();
14202
14429
  return true;
14203
14430
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songtonyli/dsh-cli",
3
- "version": "0.1.46",
3
+ "version": "0.1.47",
4
4
  "description": "The dsh terminal agent: an interactive TUI over the DeepSeek Harness, with its whole Node runtime bundled in one install.",
5
5
  "license": "MIT",
6
6
  "type": "module",