@songtonyli/dsh-cli 0.1.27 → 0.1.29

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.27; `dsh --version`
29
+ Requires Node `^22.19.0 || >=24.0.0`. Version 0.1.29; `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.27 (deepseek-harness 0.1.6-alpha.2)')
21
+ console.log('@songtonyli/dsh-cli 0.1.29 (deepseek-harness 0.1.6-alpha.2)')
22
22
  process.exit(0)
23
23
  }
24
24
 
@@ -16468,7 +16468,7 @@ window.__ModuleLoader__.load({
16468
16468
  });
16469
16469
  //#endregion
16470
16470
  //#region \0dsh-css:/Users/songli/deepseek-harness/packages/client/ui-conversation/src/client/skeleton/TodoPanel.module.css.mjs
16471
- const css = ".UWFBKq_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-specific-tip);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px;flex:none;margin:0 auto;overflow:hidden}.UWFBKq_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.UWFBKq_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.UWFBKq_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.UWFBKq_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.UWFBKq_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.UWFBKq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.UWFBKq_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.UWFBKq_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.UWFBKq_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.UWFBKq_glyphCompleted{color:var(--dsw-alias-state-success-primary)}.UWFBKq_glyphPending{color:var(--dsw-alias-label-caption)}.UWFBKq_glyphProgress{color:var(--dsw-alias-state-business-primary);animation:1s linear infinite UWFBKq_todo-progress-spin}@keyframes UWFBKq_todo-progress-spin{to{transform:rotate(360deg)}}.UWFBKq_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}";
16471
+ const css = ".UWFBKq_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-specific-tip);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px;flex:none;margin:0 auto;overflow:hidden}.UWFBKq_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.UWFBKq_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.UWFBKq_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.UWFBKq_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.UWFBKq_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.UWFBKq_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.UWFBKq_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.UWFBKq_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.UWFBKq_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.UWFBKq_glyphCompleted{color:var(--dsw-alias-state-success-primary)}.UWFBKq_glyphPending{color:var(--dsw-alias-label-caption)}.UWFBKq_glyphProgress{color:var(--dsw-alias-state-business-primary);animation:1s linear infinite UWFBKq_todo-progress-spin}@keyframes UWFBKq_todo-progress-spin{to{transform:rotate(360deg)}}.UWFBKq_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.UWFBKq_contentCompleted{color:var(--dsw-alias-label-tertiary);text-decoration:line-through}";
16472
16472
  const tagId = "@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css";
16473
16473
  if (typeof document !== "undefined" && document.querySelector("style[data-plugin-css=" + JSON.stringify(tagId) + "]") === null) {
16474
16474
  const tag = document.createElement("style");
@@ -16481,6 +16481,7 @@ window.__ModuleLoader__.load({
16481
16481
  "body": "UWFBKq_body",
16482
16482
  "chevron": "UWFBKq_chevron",
16483
16483
  "content": "UWFBKq_content",
16484
+ "contentCompleted": "UWFBKq_contentCompleted",
16484
16485
  "glyph": "UWFBKq_glyph",
16485
16486
  "glyphCompleted": "UWFBKq_glyphCompleted",
16486
16487
  "glyphPending": "UWFBKq_glyphPending",
@@ -16638,7 +16639,7 @@ window.__ModuleLoader__.load({
16638
16639
  "aria-hidden": true,
16639
16640
  children: (0, react_jsx_runtime.jsx)(StatusGlyph, { status: item.status })
16640
16641
  }), (0, react_jsx_runtime.jsx)("span", {
16641
- className: TodoPanel_module_css_default.content,
16642
+ className: clsx(TodoPanel_module_css_default.content, item.status === "completed" && TodoPanel_module_css_default.contentCompleted),
16642
16643
  children: item.content
16643
16644
  })]
16644
16645
  }, item.content))
@@ -160,7 +160,7 @@ window.__ModuleLoader__.load({
160
160
  const SCROLLBAR_LINGER_MS = 2e3;
161
161
  /** Format complete-build metadata for the local brand badge. */
162
162
  function localBuildVersion() {
163
- return `0.1.6-alpha.2-df9469c` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
163
+ return `0.1.6-alpha.2-0c7bf05` + ({}.DSH_CLIENT_GIT_DIRTY === "true" ? "-dirty" : "");
164
164
  }
165
165
  /** Each panel row subscribes only to its own selection state. */
166
166
  function PanelRow({ id, label, wide, usePanelInfo, selectPanel, renderSlot }) {
@@ -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: 7d184af56b51a5a0bf5c162e3a84f66966abb85c
6
- README.zh.md: c591d843f5683f15fc55c0789604b9229a5cdfd1
5
+ README.md: 0ad4a73e8b9ef6b75a40caeae5b9737a6d7fe52b
6
+ README.zh.md: 86d015df48377e05e45686203012b4b8d46b4325
@@ -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
- 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 `›` (attachments listed under them), assistant reasoning is dim above the Markdown reply, and each tool call is a card with a status glyph, the tool name, the presenter headline, and a body folded to `toolPreviewLines` rows. 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, and 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 — 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. 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
+ 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 `›` (attachments listed under them), assistant reasoning is dim above the Markdown reply, and each tool call is a card with a status glyph, the tool name, the presenter headline, and a body folded to `toolPreviewLines` rows. 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, and 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 — 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 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, any open prompt, a framed pending-prompt panel while messages wait, 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`, 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, cumulative token usage, 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, any open prompt, a boxed follow-ups list while messages wait, 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`, 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, cumulative token usage, 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 prefixed with `│ ` and wrapped two 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
 
@@ -58,13 +58,13 @@ The subagent panel is drawn while a subagent session under the bound one is resi
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 queued-prompt panel sits above the input; `Shift+Down` enters it while it is drawn, and it joins the `Tab` walk. 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+O` 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.
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+Down` enters it while it is drawn, and it joins the `Tab` walk. 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+O` 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
 
65
65
  | Key | Effect |
66
66
  |---|---|
67
- | `Enter` | Send the editor text; while a turn runs it waits for the next turn in the framed `QUEUE` panel above the editor until the loop claims it, entering the conversation then |
67
+ | `Enter` | Send the editor text; while a turn runs it waits for the next turn in the boxed follow-ups list above the editor until the loop claims it, entering the conversation then |
68
68
  | `!command` / `!!command` | Run in this terminal; `!` is next-step context the next prompt can read, `!!` stays local |
69
69
  | `Shift+Enter` | Insert a newline |
70
70
  | `Ctrl+S` | While a turn runs, steer the editor text into the running turn's next step |
@@ -73,7 +73,7 @@ While the input has the keyboard:
73
73
  | `Tab` | Take the completion the editor offers |
74
74
  | `Shift+Tab` | Open the current model's reasoning-effort picker for the next request, the same picker as empty `/effort` |
75
75
  | `Shift+Up` | Focus the conversation on the section the walk stopped at; a first entry, and the entry after a session switch, land on the newest section |
76
- | `Shift+Down` | Focus the queued-prompt panel's first row while prompts wait, otherwise the subagent panel's first row while it is drawn, and the status bar otherwise |
76
+ | `Shift+Down` | Focus the follow-ups list's first row while prompts wait, otherwise 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
79
  | `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 |
@@ -82,16 +82,17 @@ While the input has the keyboard:
82
82
 
83
83
  An `Esc` that only handed the keyboard back — leaving a region, closing a page, a picker, or the reader — opens a 750 ms window in which an `Esc` reaching the input does nothing at all, so a habitual double press stops no turn. With no turn running, `Esc` closes the completion list while one is open, clears a draft that starts with `!`, and is silent otherwise. A session with nothing to read yet answers `Shift+Up` and `Ctrl+G` with `nothing in the transcript to read yet` and leaves the keyboard in the input.
84
84
 
85
- While the queued-prompt panel has the keyboard:
85
+ While the follow-ups panel has the keyboard:
86
86
 
87
87
  | Key | Effect |
88
88
  |---|---|
89
- | `Up` / `Down`, `Home` / `End` | Select a pending prompt |
90
- | `S` | Remove the selected prompt from its queue and steer it into the nearest step, waking the Agent |
91
- | `I` | Move the selected prompt to next-step injection without waking the Agent |
92
- | `E` | Remove the selected prompt into the editor; `Enter` sends the revision and `Ctrl+C` restores the original prompt to the next-turn queue |
89
+ | `Up` / `Down`, `Home` / `End` | Select a pending follow-up |
90
+ | `Enter` | Remove the selected follow-up from its queue and steer it into the nearest step, waking the Agent |
91
+ | `S` | The same steer as `Enter` |
92
+ | `I` | Move the selected follow-up to next-step injection without waking the Agent |
93
+ | `E` | Remove the selected follow-up into the editor; `Enter` sends the revision and `Ctrl+C` restores the original prompt to the next-turn queue |
93
94
  | `Tab` / `Shift+Tab` | The next / previous region that is drawn |
94
- | `Esc` | Return to the input |
95
+ | `Esc` | Cancel and return to the input |
95
96
  | Any other printable key | Return to the input and type the character at the caret |
96
97
 
97
98
  While the conversation has the keyboard:
@@ -153,7 +154,7 @@ While the reader is open:
153
154
 
154
155
  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.
155
156
 
156
- Every focused segment expands its most important facts on the second line. `Enter` prints those facts into the transcript for every segment except `todo`, stating what they are and what changes them: the model segment names `/model`, the effort segment names the picker shared by `Shift+Tab` and `/effort`, and the permission segment names its preset, the `turn` segment — drawn as `turn <elapsed>` between the permission and usage segments, and only while a turn runs — gives the turn number, its start time, its elapsed time, and the queued-message counts, while the usage, context, goal, and plan segments print the matching sections of the `/status` report, the workspace segment the full path, and the attachments segment the pending attachments. The `todo` segment expands the counts by status and the item being worked on, or the next pending item when none is in progress, and `Enter` opens the agent's todo list, the same list `/todos` opens.
157
+ Every focused segment expands its most important facts on the second line. `Enter` prints those facts into the transcript for every segment except `todo`, stating what they are and what changes them: the model segment names `/model`, the effort segment names the picker shared by `Shift+Tab` and `/effort`, and the permission segment names its preset and the `/permission` picker, the `turn` segment — drawn as `turn <elapsed>` between the permission and usage segments, and only while a turn runs — gives the turn number, its start time, its elapsed time, and the queued-message counts, while the usage, context, goal, and plan segments print the matching sections of the `/status` report, the workspace segment the full path, and the attachments segment the pending attachments. The `todo` segment expands the counts by status and the item being worked on, or the next pending item when none is in progress, and `Enter` opens the agent's todo list, the same list `/todos` opens.
157
158
 
158
159
  Typing `/` at the start of the editor completes the terminal's own commands and the shared registry's; `@` anywhere completes references. A nonempty `!command` or `!!command` line runs through `ctx.shell` in the session cwd at `danger-full-access`; the transcript shows `$ command` and the output. `!` injects a plugin notice for the next admitted step; `!!` does not. A lone `!` is an ordinary prompt.
159
160
 
@@ -162,6 +163,7 @@ Typing `/` at the start of the editor completes the terminal's own commands and
162
163
  | `/help` | List the commands, and the keys each focus state answers |
163
164
  | `/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 |
164
165
  | `/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
+ | `/permission [preset]` | With no argument, open the permission-preset picker; a preset selects directly |
165
167
  | `/resume` | Open the same persisted-session picker as `/sessions` and resume the selected previous session |
166
168
  | `/sessions` | Open the persisted-session picker and switch to the selected session |
167
169
  | `/new` | Start a new session |
@@ -175,7 +177,7 @@ Typing `/` at the start of the editor completes the terminal's own commands and
175
177
  | `/login` | Sign in with a provider subscription (hides key-collecting logins); `/login <key>` skips the picker |
176
178
  | `/export [dir]` | Write this session's log ZIP (sub-sessions and attachments included) into `dir`, default the workspace |
177
179
  | `/status` | Context window usage and breakdown, token totals with cache hit, session stats, todos, goal, plan mode, and permission |
178
- | `/todos` | Browse the agent's todo list; `Enter` opens one item in full with its status, position, and turns |
180
+ | `/todos` | Browse the agent's todo list; completed rows are scratched out; `Enter` opens one item in full with its status, position, and turns |
179
181
  | `/outline` | The turns of this session with their prompt and reply previews |
180
182
  | `/deliverables` | The files the agent presented, grouped by turn |
181
183
  | `/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 |
@@ -186,9 +188,9 @@ Typing `/` at the start of the editor completes the terminal's own commands and
186
188
  | `/turns` | Read the conversation full screen, turns side by side, like `Ctrl+G` |
187
189
  | `/quit`, `/exit` | Save the session and exit |
188
190
 
189
- Every other `/name` line goes to the shared command registry, so `/compact`, `/permission`, `/goal`, and plugin commands work as they do in the browser.
191
+ Every other `/name` line goes to the shared command registry, so `/compact`, `/goal`, and plugin commands work as they do in the browser.
190
192
 
191
- 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 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.
193
+ 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.
192
194
 
193
195
  `/subagents`, `/todos`, and the `todo` status-bar segment 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.
194
196
 
@@ -236,7 +238,7 @@ The runner is a direct driver over the core API carrier, like `dsh-headless`, th
236
238
 
237
239
  ### Run flow
238
240
 
239
- The runner awaits the complete application (`ctx.get('loader')?.await()`) and builds a session host over the core registry with three operations: `create` makes one fresh persisted Agent with the shared [`agentDefaultModel`](../../core/agent-default-model/README.md) selection, `resume` reads the persisted log in pages through a read handle of `ctx.sessionPersistence` and resumes the Agent through the registry, 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. Every operation 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.
241
+ The runner awaits the complete application (`ctx.get('loader')?.await()`) and builds a session host over the core registry with three 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. Every operation 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.
240
242
 
241
243
  ### Rendering model
242
244
 
@@ -250,15 +252,16 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
250
252
 
251
253
  | File | Role |
252
254
  |---|---|
253
- | [`src/index.ts`](src/index.ts) | The `tui-app` plugin: the session host (create, resume, fork), history read, quit flow, exit mapping |
255
+ | [`src/index.ts`](src/index.ts) | The `tui-app` plugin: the session host (create, resume, fork), resume observation, quit flow, exit mapping |
254
256
  | [`src/startup.ts`](src/startup.ts) | The `tui-app-startup` provider: prompt positional, `--resume`, `--no-open`, and `--help` |
255
257
  | [`src/app.ts`](src/app.ts) | The terminal application: layout, the key router, commands, session binding, seams, log and stream folding, the stop arm, the transient line it mounts, the terminal handover the reader runs on, and prefix-on-submit `!` / `!!` |
256
258
  | [`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 |
257
259
  | [`src/sessions.ts`](src/sessions.ts) | The persisted-session list and picker rows shared by `/resume` and `/sessions` |
258
260
  | [`src/effort.ts`](src/effort.ts) | Reasoning-effort names and picker rows shared by `/model`, `/effort`, and editor `Shift+Tab` |
261
+ | [`src/permission.ts`](src/permission.ts) | Permission-preset names and picker rows for `/permission` |
259
262
  | [`src/attach.ts`](src/attach.ts) | `/attach`: local files into image or file blocks through the attachment store |
260
263
  | [`src/export.ts`](src/export.ts) | `/export`: the session-log ZIP written through the export package's archive helpers |
261
- | [`src/blocks.ts`](src/blocks.ts) | Transcript components: user prompt, assistant reply, tool card, system prompt and injected context, notice; the navigable blocks expose their sections and draw the focus gutter, and the foldable ones carry the marker both fold keys name. Each block keeps the lines it last drew and a reply keeps the coloured fences of its last Markdown parse, so a frame of a settled transcript costs one key comparison per block and a stream delta colours only the fence that changed |
264
+ | [`src/blocks.ts`](src/blocks.ts) | Transcript components: user prompt, assistant reply, tool card, system prompt and injected context, notice; the navigable blocks expose their sections and draw the focus gutter, and the foldable ones carry the marker both fold keys name. Each block keeps the lines it last drew and a reply keeps the coloured fences of its last Markdown parse and re-lexes only the open tail after the last closed fence, so a frame of a settled transcript costs one key comparison per block and a stream delta colours only the fence that changed |
262
265
  | [`src/context.ts`](src/context.ts) | Project logged system prompts and injected user messages into transcript sections |
263
266
  | [`src/navigation.ts`](src/navigation.ts) | The transcript as sections, the cursor that walks them along four axes, the turns those sections group into, and the inspector heading |
264
267
  | [`src/inspector.ts`](src/inspector.ts) | The docked inspector: the framed pane with its mode chip, the section heading, the numbered wrapping parts strip, the folded rows, and its mounted component |
@@ -273,7 +276,7 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
273
276
  | [`src/toast.ts`](src/toast.ts) | The transient key-feedback line: its overlay, its clock, and the lines it carries |
274
277
  | [`src/transcript.ts`](src/transcript.ts) | Pure text folding of presentation views, usage, and turn-end reasons, and the one fold grammar every marker is written in |
275
278
  | [`src/diff.ts`](src/diff.ts) | Line diff and hunk selection for diff cards |
276
- | [`src/style.ts`](src/style.ts) | The palette and the derived pi-tui themes |
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 |
277
280
  | [`src/highlight.ts`](src/highlight.ts) | Syntax colour for fenced code: the grammars a fence may load, the theme the background picks, and the SGR one token is drawn with |
278
281
  | [`src/completion.ts`](src/completion.ts) | Slash-command and `@`-reference completion for the editor |
279
282
  | [`src/editor.ts`](src/editor.ts) | The prompt editor's terminal caret and its `Shift+Left` / `Shift+Right` mapping to pi-tui word navigation |
@@ -281,11 +284,12 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
281
284
  | [`src/status.ts`](src/status.ts) | Projection-seam facts and the sections the `/status` report and the segment details share; compaction and retry notices |
282
285
  | [`src/footer.ts`](src/footer.ts) | The status bar: the ordered segments, each segment's detail rows, the unfocused line built from both ends, and the focused sliding window |
283
286
  | [`src/subagent-panel.ts`](src/subagent-panel.ts) | The live subagent panel: one descendant listing plus sampled live facts become its rows, the unfocused summary line, and the focused listing |
287
+ | [`src/queue-panel.ts`](src/queue-panel.ts) | The follow-ups list: pending-row glyphs, hanging wrap, and the enter-steer legend |
284
288
  | [`src/catalog.ts`](src/catalog.ts) | Rows for `/settings`, `/plugins`, `/subagents`, `/deliverables`, `/changes`, and `/outline`, and the `/plugins` management verbs |
285
- | [`src/todos.ts`](src/todos.ts) | The todo list: the status glyphs, the picker rows, and one item's detail rows |
289
+ | [`src/todos.ts`](src/todos.ts) | The todo list: the status glyphs, the picker rows with completed content scratched out, and one item's detail rows |
286
290
  | [`cordis.patch.yml`](cordis.patch.yml) | The terminal patch over `dsh-base` |
287
291
  | — | No runtime invariant companion is published; the app registers listeners on one Agent and holds no mutable relation another observer could contradict. |
288
- | [`tests/app.spec.ts`](tests/app.spec.ts) | Rendering, keys, commands, the stop arm, the queued-prompt rows above the editor, and both seams over a fake terminal |
292
+ | [`tests/app.spec.ts`](tests/app.spec.ts) | Rendering, keys, commands, the stop arm, the follow-ups rows above the editor, and both seams over a fake terminal |
289
293
  | [`tests/keys.spec.ts`](tests/keys.spec.ts) | What each region claims for a key, the legend steps, and the text one press types |
290
294
  | [`tests/editor.spec.ts`](tests/editor.spec.ts) | The terminal caret and `Shift+Left` / `Shift+Right` word navigation against pi-tui's editor behavior |
291
295
  | [`tests/frame.spec.ts`](tests/frame.spec.ts) | The rules, the chip, the body rows, and the legend a width holds |
@@ -294,9 +298,10 @@ The patch rides over `dsh-base`: it sets the coding persona prefix and cwd suffi
294
298
  | [`tests/reader.spec.ts`](tests/reader.spec.ts) | The reader's geometry, its state machine, its filter, and the rows it returns |
295
299
  | [`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 |
296
300
  | [`tests/alt-screen.spec.ts`](tests/alt-screen.spec.ts) | The alternate screen: its balanced switches, its per-row drawing, and the rows a shorter frame clears |
297
- | [`tests/commands.spec.ts`](tests/commands.spec.ts) | The `/resume` and `/sessions` picker, attachments, queues, skills, sign-in, export, references, the picker shared by `/effort` and `Shift+Tab`, and `Ctrl+S` in the model list over scripted services |
301
+ | [`tests/commands.spec.ts`](tests/commands.spec.ts) | The `/resume` and `/sessions` picker, attachments, queues, skills, sign-in, export, references, the picker shared by `/effort` and `Shift+Tab`, the `/permission` picker, and `Ctrl+S` in the model list over scripted services |
298
302
  | [`tests/shell.spec.ts`](tests/shell.spec.ts) | Prefix-on-submit `!` / `!!` dispatch, next-step inject, Esc cancel, and the missing-shell notice |
299
303
  | [`tests/effort.spec.ts`](tests/effort.spec.ts) | Shared effort names, picker rows, the current-effort hint, and typed argument matching |
304
+ | [`tests/permission.spec.ts`](tests/permission.spec.ts) | Shared permission names, picker rows, the current-preset hint, and typed argument matching |
300
305
  | [`tests/panels.spec.ts`](tests/panels.spec.ts) | Status footer and report, the navigable subagent and todo lists, catalog commands, command hints, and the approval detail |
301
306
  | [`tests/transcript-focus.spec.ts`](tests/transcript-focus.spec.ts) | Walking the conversation, the region stack, the inspector, the reader over a live session with the terminal it takes and gives back, and the in-place gutter inside the repaint window |
302
307
  | [`tests/context.spec.ts`](tests/context.spec.ts) | Projection of system prompts and injected context into transcript sections |
@@ -40,9 +40,9 @@ dsh tui --no-open # print sign-in URLs without opening a
40
40
 
41
41
  ### 屏幕布局
42
42
 
43
- 页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `›` 开头(附件列在其下),assistant 的推理以暗色显示在 Markdown 回复上方,每次工具调用是一张卡片,含状态符号、工具名、呈现器标题,以及折叠到 `toolPreviewLines` 行的正文。非空的系统提示词与每一条注入的上下文——instructions、catalogs、snapshots、notices、relays 与 recalls——绘制为暗色 `⬡` 标题,其下是面向模型文本的前 `contextPreviewLines` 行,快照的每一份贡献具名写在其自身各行上方;空的系统提示词与压缩替换则省略。承载的行数多于其绘制行数的工具卡片与上下文块,结尾都是同一条标记:该块被对话记录的焦点持有时为 `… <n> more rows · Space expands`,否则为 `… <n> more rows · Ctrl+O expands`。回复中的围栏代码、`read` 卡片的文件行,以及 `edit` 或 `write` diff 卡片的变更行——其中 `+` 新增项标为绿色、`-` 删除项标为红色,符号后的源文本按文件扩展名对应的语言绘制——都使用语法高亮,配色主题由终端自身的背景在明暗之间选定;某种语言的语法会在第一个用到它的代码块出现时才加载,因此该块先以纯文本绘制、随后被重绘为彩色;这里没有对应语法的语言、既不支持 24 位也不支持 256 色的终端,以及 `codeHighlight: false`,都会把每个代码块画成纯文本。流式回复文字会淡入,而且每个词各走各的时钟:一个词以接近终端背景色的亮度出现,并经 `streamFadeSteps` 次、每次 `streamFadeStepMs` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式推理与工具卡片在同一时长内浮出:它们以抬高的颜色出现,再退回到稳定时的暗色斜体或调色板颜色;从持久化历史重绘的卡片不带淡入,已经稳定下来的文字也不会再被调暗。
43
+ 页眉在标题生成或设置后以标题命名会话,并在旁边显示 id。对话记录在终端自身的回滚区中增长:你的提示以 `›` 开头(附件列在其下),assistant 的推理以暗色显示在 Markdown 回复上方,每次工具调用是一张卡片,含状态符号、工具名、呈现器标题,以及折叠到 `toolPreviewLines` 行的正文。非空的系统提示词与每一条注入的上下文——instructions、catalogs、snapshots、notices、relays 与 recalls——绘制为暗色 `⬡` 标题,其下是面向模型文本的前 `contextPreviewLines` 行,快照的每一份贡献具名写在其自身各行上方;空的系统提示词与压缩替换则省略。承载的行数多于其绘制行数的工具卡片与上下文块,结尾都是同一条标记:该块被对话记录的焦点持有时为 `… <n> more rows · Space expands`,否则为 `… <n> more rows · Ctrl+O expands`。回复中的围栏代码、`read` 卡片的文件行,以及 `edit` 或 `write` diff 卡片的变更行——其中 `+` 新增项标为绿色、`-` 删除项标为红色,符号后的源文本按文件扩展名对应的语言绘制——都使用语法高亮,配色主题由终端自身的背景在明暗之间选定;某种语言的语法会在第一个用到它的代码块出现时才加载,因此该块先以纯文本绘制、随后被重绘为彩色;这里没有对应语法的语言、既不支持 24 位也不支持 256 色的终端,以及 `codeHighlight: false`,都会把每个代码块画成纯文本。标题、链接、列表标记、引用与行内代码共用一套暗色冷色阶——浅青、更深的蓝与暗色——因此回复能挨着高亮围栏,而不靠对比色相。流式回复文字会淡入,而且每个词各走各的时钟:一个词以接近终端背景色的亮度出现,并经 `streamFadeSteps` 次、每次 `streamFadeStepMs` 提亮到它最终稳定的颜色,因此流得更快只会留下更长的一串正在提亮的词,而不会更暗。流式推理与工具卡片在同一时长内浮出:它们以抬高的颜色出现,再退回到稳定时的暗色斜体或调色板颜色;从持久化历史重绘的卡片不带淡入,已经稳定下来的文字也不会再被调暗。
44
44
 
45
- 对话记录下方依次是 agent 工作时的旋转指示、任何打开的提示、有消息等待时的带框待处理提示面板、编辑器、子 agent 面板,以及页脚:未聚焦时是一行由两端向内构建的状态栏。编辑器的光标是终端自身的闪烁竖条:应用在启动时请求这一形状,退出时把你的默认形状还回去,而状态栏或面板持有键盘期间完全不绘制光标。模型锚定在左端且永不丢弃——超过 20 列时退回到裸模型名,只有仍然过宽的标签才会被省略号截断——离开编辑器的那两个按键则锚定在右端,写作 `Shift+↑ read · Shift+↓ status`,窄到一定程度收缩为 `Shift+↑↓ nav`,不足 40 列时整体丢弃。关键事实填满剩下的中间部分,按状态栏顺序排列:推理强度(选择把推理交给模型时标为 `effort default`)、进行中轮次的已用时间、上下文窗口百分比、todo 计数,以及 workspace 路径(过长时以 `~` 与 `…/` 缩短)。中间部分容纳不下的每个分段都折进末尾的 `+N`,未聚焦行从不绘制的那些分段也一并折入——权限预设、累计 token 用量、来自投影接缝的目标与计划模式标记,以及待发送附件的数量。压缩与模型请求重试以通知形式出现,与浏览器标记承载的事实相同。
45
+ 对话记录下方依次是 agent 工作时的旋转指示、任何打开的提示、有消息等待时的带框 follow-ups 列表、编辑器、子 agent 面板,以及页脚:未聚焦时是一行由两端向内构建的状态栏。编辑器的光标是终端自身的闪烁竖条:应用在启动时请求这一形状,退出时把你的默认形状还回去,而状态栏或面板持有键盘期间完全不绘制光标。模型锚定在左端且永不丢弃——超过 20 列时退回到裸模型名,只有仍然过宽的标签才会被省略号截断——离开编辑器的那两个按键则锚定在右端,写作 `Shift+↑ read · 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
 
@@ -58,13 +58,13 @@ dsh tui --no-open # print sign-in URLs without opening a
58
58
 
59
59
  ### 按键与命令
60
60
 
61
- 对话记录、编辑器、子 agent 面板与状态栏构成垂直方向键走查:在最新小节上按 `Down`、在子 agent 面板第一行上按 `Up`、在没有绘制子 agent 面板时于状态栏上按 `Up`,都会落到光标处。待处理提示面板位于输入框上方;绘制该面板时,`Shift+Down` 会进入它,它也加入 `Tab` 走查。编辑器以外的区域持有键盘时,`Tab` 与 `Shift+Tab` 走遍已绘制的各区域,并在两端环绕;在编辑器中,`Tab` 采用给出的补全,`Shift+Tab` 打开推理强度选择器。在其中任何一个区域按下可打印键都会回到编辑器并在那里输入,因此在阅读时开始写的句子会落在它所指向的地方;对话记录中的 `Space` 是唯一的例外,它折叠被标记的工具卡片或上下文块。`Ctrl+G` 与 `Ctrl+O` 在这些区域中含义完全相同,而 `Ctrl+C` 与 `Ctrl+D` 会先把键盘交还编辑器再行动。提示与阅读器则各自持有整条按键流,并以交还键盘的方式应答 `Ctrl+C`。
61
+ 对话记录、编辑器、子 agent 面板与状态栏构成垂直方向键走查:在最新小节上按 `Down`、在子 agent 面板第一行上按 `Up`、在没有绘制子 agent 面板时于状态栏上按 `Up`,都会落到光标处。follow-ups 列表位于输入框上方;绘制该列表时,`Shift+Down` 会进入它,它也加入 `Tab` 走查。编辑器以外的区域持有键盘时,`Tab` 与 `Shift+Tab` 走遍已绘制的各区域,并在两端环绕;在编辑器中,`Tab` 采用给出的补全,`Shift+Tab` 打开推理强度选择器。在其中任何一个区域按下可打印键都会回到编辑器并在那里输入,因此在阅读时开始写的句子会落在它所指向的地方;对话记录中的 `Space` 是唯一的例外,它折叠被标记的工具卡片或上下文块。`Ctrl+G` 与 `Ctrl+O` 在这些区域中含义完全相同,而 `Ctrl+C` 与 `Ctrl+D` 会先把键盘交还编辑器再行动。提示与阅读器则各自持有整条按键流,并以交还键盘的方式应答 `Ctrl+C`。
62
62
 
63
63
  编辑器持有键盘时:
64
64
 
65
65
  | 按键 | 效果 |
66
66
  |---|---|
67
- | `Enter` | 发送编辑器文本;轮次进行中时它在编辑器上方的带框 `QUEUE` 面板中等待下一轮次,直到循环领取它后才进入对话 |
67
+ | `Enter` | 发送编辑器文本;轮次进行中时它在编辑器上方的带框 follow-ups 列表中等待下一轮次,直到循环领取它后才进入对话 |
68
68
  | `!command` / `!!command` | 在本终端运行;`!` 会作为下一步上下文供下一条提示阅读,`!!` 只留在本地 |
69
69
  | `Shift+Enter` | 插入换行 |
70
70
  | `Ctrl+S` | 轮次进行中时,把编辑器文本引导(steer)进当前轮次的下一步 |
@@ -73,7 +73,7 @@ dsh tui --no-open # print sign-in URLs without opening a
73
73
  | `Tab` | 采用编辑器给出的补全 |
74
74
  | `Shift+Tab` | 打开当前模型的推理强度选择器,从下一次请求生效;与空参数 `/effort` 打开的是同一个选择器 |
75
75
  | `Shift+Up` | 把焦点放到对话记录上、停在走查上次停下的小节;首次进入以及切换会话后的首次进入停在最新小节 |
76
- | `Shift+Down` | 有提示等待时把焦点放到待处理提示面板第一行,否则在子 agent 面板已绘制时放到其第一行,再否则放到状态栏 |
76
+ | `Shift+Down` | 有提示等待时把焦点放到 follow-ups 列表第一行,否则在子 agent 面板已绘制时放到其第一行,再否则放到状态栏 |
77
77
  | `Ctrl+G` | 整屏读出对话记录,停在其最新小节 |
78
78
  | `Ctrl+O` | 展开或折叠所有工具卡片与上下文行 |
79
79
  | `Esc` | 取消正在运行的 `!`;在没有轮次进行且草稿以 `!` 开头时清空编辑器;否则装填停止,该提示仍在屏幕上时再按一次会停止正在进行的轮次 |
@@ -82,16 +82,17 @@ dsh tui --no-open # print sign-in URLs without opening a
82
82
 
83
83
  仅仅交还了键盘的 `Esc`——离开某个区域、关闭页面、选择器或阅读器——会打开一个 750 ms 的窗口,其间到达编辑器的 `Esc` 完全不做任何事,因此习惯性的连按停不掉任何轮次。没有轮次进行时,`Esc` 在补全列表打开时关闭它,清空以 `!` 开头的草稿,其余情况保持沉默。尚无可读内容的会话对 `Shift+Up` 与 `Ctrl+G` 回以 `nothing in the transcript to read yet`,并把键盘留在编辑器。
84
84
 
85
- 待处理提示面板持有键盘时:
85
+ follow-ups 面板持有键盘时:
86
86
 
87
87
  | 按键 | 效果 |
88
88
  |---|---|
89
- | `Up` / `Down`、`Home` / `End` | 选择一条待处理提示 |
90
- | `S` | 从队列移除所选提示,并把它引导进最近的步骤,同时唤醒 Agent |
91
- | `I` | 把所选提示移到下一步骤的注入队列,但不唤醒 Agent |
92
- | `E` | 从队列移除所选提示并放入编辑器;`Enter` 发送修订内容,`Ctrl+C` 把原提示恢复到下一轮次队列 |
89
+ | `Up` / `Down`、`Home` / `End` | 选择一条待处理 follow-up |
90
+ | `Enter` | 从队列移除所选 follow-up,并把它引导进最近的步骤,同时唤醒 Agent |
91
+ | `S` | 与 `Enter` 相同的引导 |
92
+ | `I` | 把所选 follow-up 移到下一步骤的注入队列,但不唤醒 Agent |
93
+ | `E` | 从队列移除所选 follow-up 并放入编辑器;`Enter` 发送修订内容,`Ctrl+C` 把原提示恢复到下一轮次队列 |
93
94
  | `Tab` / `Shift+Tab` | 下一个 / 上一个已绘制区域 |
94
- | `Esc` | 返回输入框 |
95
+ | `Esc` | 取消并返回输入框 |
95
96
  | 任何其他可打印键 | 返回输入框并在光标处输入该字符 |
96
97
 
97
98
  对话记录持有键盘时:
@@ -153,7 +154,7 @@ dsh tui --no-open # print sign-in URLs without opening a
153
154
 
154
155
  到达阅读器的其他每个按键都被消费,而关闭它同样打开那 750 ms 的交接窗口,因此连按多少次 `Esc` 都到不了编辑器的停止。
155
156
 
156
- 每个聚焦的分段都在第二行展开其最重要的事实。除 `todo` 之外,`Enter` 把这些事实打印到对话记录,并指出改变它们的方式:模型分段指出 `/model`,推理强度分段指出 `Shift+Tab` 与 `/effort` 共用的选择器,权限分段指出其预设;`turn` 分段——绘制在权限与用量分段之间、形如 `turn <elapsed>`,且只在轮次进行时出现——给出轮次编号、其开始时间、已用时间与排队消息数量;用量、上下文、目标与计划分段打印 `/status` 报告中对应的小节,workspace 分段显示完整路径,附件分段列出待发送的附件。`todo` 分段展开按状态统计的计数以及正在进行的条目(若无正在进行的条目则为下一条待办),`Enter` 打开 agent 的 todo 列表,与 `/todos` 打开的是同一个列表。
157
+ 每个聚焦的分段都在第二行展开其最重要的事实。除 `todo` 之外,`Enter` 把这些事实打印到对话记录,并指出改变它们的方式:模型分段指出 `/model`,推理强度分段指出 `Shift+Tab` 与 `/effort` 共用的选择器,权限分段指出其预设以及 `/permission` 选择器;`turn` 分段——绘制在权限与用量分段之间、形如 `turn <elapsed>`,且只在轮次进行时出现——给出轮次编号、其开始时间、已用时间与排队消息数量;用量、上下文、目标与计划分段打印 `/status` 报告中对应的小节,workspace 分段显示完整路径,附件分段列出待发送的附件。`todo` 分段展开按状态统计的计数以及正在进行的条目(若无正在进行的条目则为下一条待办),`Enter` 打开 agent 的 todo 列表,与 `/todos` 打开的是同一个列表。
157
158
 
158
159
  在编辑器开头输入 `/` 会补全终端自身的命令与共享注册表的命令;任意位置的 `@` 补全引用。非空的 `!command` 或 `!!command` 行经 `ctx.shell` 在会话 cwd 以 `danger-full-access` 运行;对话记录显示 `$ command` 与输出。`!` 会注入一条插件通知供下一步领取;`!!` 不会。单独的 `!` 仍是普通提示。
159
160
 
@@ -162,6 +163,7 @@ dsh tui --no-open # print sign-in URLs without opening a
162
163
  | `/help` | 列出命令,以及每个焦点状态所应答的按键 |
163
164
  | `/model` | 为下一次请求选择模型(输入即可过滤行),若模型声明多于一种推理强度则接着选择强度;`/model <provider>/<model>` 直接选择,`/model save` 把当前选择存为默认,在模型列表中按 `Ctrl+S` 则把高亮的模型存为下次启动的默认而不关闭列表 |
164
165
  | `/effort [id]` | 不带参数时为下一次请求打开当前模型的推理强度选择器,与编辑器中的 `Shift+Tab` 打开的是同一个;id 直接选择,`/effort default` 恢复提供方默认值 |
166
+ | `/permission [preset]` | 不带参数时打开权限预设选择器;preset 直接选择 |
165
167
  | `/resume` | 打开与 `/sessions` 相同的持久化会话选择器,并恢复选中的先前会话 |
166
168
  | `/sessions` | 打开持久化会话选择器,并切换到选中的会话 |
167
169
  | `/new` | 开始新会话 |
@@ -175,7 +177,7 @@ dsh tui --no-open # print sign-in URLs without opening a
175
177
  | `/login` | 用提供方订阅登录(隐藏仅收集密钥的登录);`/login <key>` 跳过选择器 |
176
178
  | `/export [dir]` | 把本会话的日志 ZIP(含子会话与附件)写入 `dir`,默认 workspace |
177
179
  | `/status` | 上下文窗口用量与构成、含缓存命中的 token 总计、会话统计、todo、目标、计划模式与权限 |
178
- | `/todos` | 浏览 agent 的 todo 列表;`Enter` 完整打开其中一条,含其状态、位置与轮次 |
180
+ | `/todos` | 浏览 agent 的 todo 列表;已完成行会被划掉;`Enter` 完整打开其中一条,含其状态、位置与轮次 |
179
181
  | `/outline` | 本会话各轮次及其提示与回复预览 |
180
182
  | `/deliverables` | agent 交付的文件,按轮次分组 |
181
183
  | `/changes [turn]` | 浏览最近一轮(或第 `turn` 轮)改动的文件及其行数;`Enter` 打开某个文件从轮次开始到结束的对比 |
@@ -186,9 +188,9 @@ dsh tui --no-open # print sign-in URLs without opening a
186
188
  | `/turns` | 像 `Ctrl+G` 一样整屏读出对话记录,各轮次并排 |
187
189
  | `/quit`、`/exit` | 保存会话并退出 |
188
190
 
189
- 其他每条 `/name` 行都交给共享命令注册表,因此 `/compact`、`/permission`、`/goal` 与插件命令的行为和浏览器中一致。
191
+ 其他每条 `/name` 行都交给共享命令注册表,因此 `/compact`、`/goal` 与插件命令的行为和浏览器中一致。
190
192
 
191
- 终端打开的每个选择器——`/model` 的模型列表与推理强度列表、空参数 `/effort` 与编辑器 `Shift+Tab` 共用的当前模型推理强度列表、`/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>"` 取代这些行,而生效行上的 `✓`——也就是选择器打开时定位的那一行——只在查询为空时显示。
193
+ 终端打开的每个选择器——`/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>"` 取代这些行,而生效行上的 `✓`——也就是选择器打开时定位的那一行——只在查询为空时显示。
192
194
 
193
195
  `/subagents`、`/todos` 与状态栏的 `todo` 分段共用同一套先列表、后详情的交互:选择器列出各条目,`Enter` 把高亮条目作为只读页面打开,`Up` / `Down` 与 `PageUp` / `PageDown` 滚动该页面,`Enter`、`Esc` 或 `Left` 返回列表并停在刚读过的条目上,因此连续查看多个条目无需重新输入命令;在列表上按 `Esc` 返回编辑器。详情无法读取的条目会在其页面上说明原因,而不会关闭列表。
194
196
 
@@ -236,7 +238,7 @@ runner 与 `dsh-headless` 一样是核心 API 载体之上的直接驱动器,
236
238
 
237
239
  ### 运行流程
238
240
 
239
- runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心注册表之上构建含三个操作的会话宿主:`create` 用共享的 [`agentDefaultModel`](../../core/agent-default-model/README.zh.md) 选择创建一个全新的持久化 Agent,`resume` 通过 `ctx.sessionPersistence` 的只读句柄分页读取持久化日志并经注册表恢复 Agent,`fork` 通过 `ctx.sessionQuery` 观察源会话、在所选(默认最后一个)`turn/end` 之后直到下一个 `turn/start` 处切割,并创建带 `parentSession` 与 `isSeeded` 元数据的种子 Agent。每个操作都在 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` 运行;`!` 注入一条下一步通知,`!!` 只留在本地。
241
+ 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。每个操作都在 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` 运行;`!` 注入一条下一步通知,`!!` 只留在本地。
240
242
 
241
243
  ### 渲染模型
242
244
 
@@ -250,15 +252,16 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
250
252
 
251
253
  | 文件 | 职责 |
252
254
  |---|---|
253
- | [`src/index.ts`](src/index.ts) | `tui-app` 插件:会话宿主(创建、恢复、fork)、历史读取、退出流程、退出码映射 |
255
+ | [`src/index.ts`](src/index.ts) | `tui-app` 插件:会话宿主(创建、恢复、fork)、恢复观察、退出流程、退出码映射 |
254
256
  | [`src/startup.ts`](src/startup.ts) | `tui-app-startup` 提供方:提示位置参数、`--resume`、`--no-open` 与 `--help` |
255
257
  | [`src/app.ts`](src/app.ts) | 终端应用:布局、按键路由、命令、会话绑定、接缝、日志与流的折叠、停止装填、它挂载的临时提示行、阅读器所依托的终端交接,以及提交时解析的 `!` / `!!` |
256
258
  | [`src/keys.ts`](src/keys.ts) | 按键模型:各焦点区域、一次按键在每个区域中的含义、它们逐级收缩的按键提示、进入用的按键、`/help` 的各行,以及交接窗口 |
257
259
  | [`src/sessions.ts`](src/sessions.ts) | `/resume` 与 `/sessions` 共用的持久化会话列表及选择器行 |
258
260
  | [`src/effort.ts`](src/effort.ts) | `/model`、`/effort` 与编辑器 `Shift+Tab` 共用的推理强度名称及选择器行 |
261
+ | [`src/permission.ts`](src/permission.ts) | `/permission` 的权限预设名称及选择器行 |
259
262
  | [`src/attach.ts`](src/attach.ts) | `/attach`:本地文件经附件存储成为图片或文件块 |
260
263
  | [`src/export.ts`](src/export.ts) | `/export`:通过导出包的归档辅助函数写出会话日志 ZIP |
261
- | [`src/blocks.ts`](src/blocks.ts) | 对话记录组件:用户提示、assistant 回复、工具卡片、系统提示词与注入上下文、通知;可导航的块暴露其各小节并绘制焦点标记条,可折叠的块则承载两个折叠键共用的那条标记。每个块保留上次画出的行,回复还保留上次 Markdown 解析所着色的代码围栏,因此已稳定的对话记录每帧只花每块一次键比较,一次流式增量也只为发生变化的那个围栏着色 |
264
+ | [`src/blocks.ts`](src/blocks.ts) | 对话记录组件:用户提示、assistant 回复、工具卡片、系统提示词与注入上下文、通知;可导航的块暴露其各小节并绘制焦点标记条,可折叠的块则承载两个折叠键共用的那条标记。每个块保留上次画出的行,回复还保留上次 Markdown 解析所着色的代码围栏,并只对最后一个已关闭围栏之后仍打开的尾部重新词法分析,因此已稳定的对话记录每帧只花每块一次键比较,一次流式增量也只为发生变化的那个围栏着色 |
262
265
  | [`src/context.ts`](src/context.ts) | 把已记录的系统提示词与注入的用户消息投影为对话记录小节 |
263
266
  | [`src/navigation.ts`](src/navigation.ts) | 把对话记录看作各个小节、沿四条轴走遍它们的光标、这些小节归入的各轮次,以及检视面板的标题 |
264
267
  | [`src/inspector.ts`](src/inspector.ts) | 停靠的检视面板:带模式徽标的边框面板、小节标题、带编号且会折行的各部分选择行、折叠后的各行,及其挂载的组件 |
@@ -273,7 +276,7 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
273
276
  | [`src/toast.ts`](src/toast.ts) | 临时按键提示行:其浮层、其时钟,以及它承载的各条文字 |
274
277
  | [`src/transcript.ts`](src/transcript.ts) | 呈现视图、用量与轮次结束原因的纯文本折叠,以及每条标记共用的那一套折叠措辞 |
275
278
  | [`src/diff.ts`](src/diff.ts) | diff 卡片的行 diff 与 hunk 选择 |
276
- | [`src/style.ts`](src/style.ts) | 调色板与派生的 pi-tui 主题 |
279
+ | [`src/style.ts`](src/style.ts) | 调色板(含 Markdown 回复所用的暗色冷色阶标题与链接色、已完成 todo 内容所用的划线角色)与派生的 pi-tui 主题 |
277
280
  | [`src/highlight.ts`](src/highlight.ts) | 围栏代码的语法高亮:某个围栏可能加载的语法、由背景选定的配色主题,以及一个 token 所用的 SGR |
278
281
  | [`src/completion.ts`](src/completion.ts) | 编辑器的斜杠命令与 `@` 引用补全 |
279
282
  | [`src/editor.ts`](src/editor.ts) | 提示编辑器的终端光标,以及把 `Shift+Left` / `Shift+Right` 映射到 pi-tui 词导航的逻辑 |
@@ -281,11 +284,12 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
281
284
  | [`src/status.ts`](src/status.ts) | 投影接缝的事实,以及 `/status` 报告与分段详情共享的小节;压缩与重试通知 |
282
285
  | [`src/footer.ts`](src/footer.ts) | 状态栏:有序的各分段、每个分段的详情行、未聚焦时由两端向内构建的一行,以及聚焦时的滑动窗口 |
283
286
  | [`src/subagent-panel.ts`](src/subagent-panel.ts) | 实时子 agent 面板:一次后代列表加上采样到的实时事实构成其各行、未聚焦时的摘要行,以及聚焦时的列表 |
287
+ | [`src/queue-panel.ts`](src/queue-panel.ts) | follow-ups 列表:待处理行符号、悬挂换行与 enter-steer 图例 |
284
288
  | [`src/catalog.ts`](src/catalog.ts) | `/settings`、`/plugins`、`/subagents`、`/deliverables`、`/changes` 与 `/outline` 的行,以及 `/plugins` 的管理动作 |
285
- | [`src/todos.ts`](src/todos.ts) | todo 列表:状态符号、选择器行与单个条目的详情行 |
289
+ | [`src/todos.ts`](src/todos.ts) | todo 列表:状态符号、已完成内容划掉的选择器行与单个条目的详情行 |
286
290
  | [`cordis.patch.yml`](cordis.patch.yml) | 基于 `dsh-base` 的终端 patch |
287
291
  | — | 不发布运行时不变量伴随模块;应用只在一个 Agent 上注册监听器,不持有其他观察者可能与之矛盾的可变关系。 |
288
- | [`tests/app.spec.ts`](tests/app.spec.ts) | 基于伪终端的渲染、按键、命令、停止装填、编辑器上方的排队提示行与两个接缝 |
292
+ | [`tests/app.spec.ts`](tests/app.spec.ts) | 基于伪终端的渲染、按键、命令、停止装填、编辑器上方的 follow-ups 行与两个接缝 |
289
293
  | [`tests/keys.spec.ts`](tests/keys.spec.ts) | 每个区域为一个按键认领什么、按键提示的各级,以及一次按键输入的文字 |
290
294
  | [`tests/editor.spec.ts`](tests/editor.spec.ts) | 对照 pi-tui 编辑器行为验证终端光标与 `Shift+Left` / `Shift+Right` 词导航 |
291
295
  | [`tests/frame.spec.ts`](tests/frame.spec.ts) | 边框线、徽标、正文行,以及某个宽度容纳得下的按键提示 |
@@ -294,9 +298,10 @@ runner 等待完整应用就绪(`ctx.get('loader')?.await()`),并在核心
294
298
  | [`tests/reader.spec.ts`](tests/reader.spec.ts) | 阅读器的几何布局、其状态机、其过滤,以及它返回的各行 |
295
299
  | [`tests/reader-screen.spec.ts`](tests/reader-screen.spec.ts) | 阅读器面板:其按键映射、它铺满的屏幕、其重新锚定与其退出 |
296
300
  | [`tests/alt-screen.spec.ts`](tests/alt-screen.spec.ts) | 备用屏幕:其成对的切换、其逐行绘制,以及更短的一帧所清除的行 |
297
- | [`tests/commands.spec.ts`](tests/commands.spec.ts) | 基于脚本化服务的 `/resume` 与 `/sessions` 选择器、附件、队列、技能、登录、导出、引用、`/effort` 与 `Shift+Tab` 共用的选择器,以及模型列表中的 `Ctrl+S` |
301
+ | [`tests/commands.spec.ts`](tests/commands.spec.ts) | 基于脚本化服务的 `/resume` 与 `/sessions` 选择器、附件、队列、技能、登录、导出、引用、`/effort` 与 `Shift+Tab` 共用的选择器、`/permission` 选择器,以及模型列表中的 `Ctrl+S` |
298
302
  | [`tests/shell.spec.ts`](tests/shell.spec.ts) | 提交时解析的 `!` / `!!` 分发、下一步 inject、Esc 取消,以及缺少 shell 时的通知 |
299
303
  | [`tests/effort.spec.ts`](tests/effort.spec.ts) | 共用的推理强度名称、选择器行、当前强度提示与输入参数匹配 |
304
+ | [`tests/permission.spec.ts`](tests/permission.spec.ts) | 共用的权限名称、选择器行、当前预设提示与输入参数匹配 |
300
305
  | [`tests/panels.spec.ts`](tests/panels.spec.ts) | 状态页脚与报告、可导航的子 agent 与 todo 列表、目录命令、命令提示与审批详情 |
301
306
  | [`tests/transcript-focus.spec.ts`](tests/transcript-focus.spec.ts) | 走遍对话记录、区域序列、检视面板、实时会话上的阅读器连同它接管与交还的终端,以及重绘窗口内的原地标记条 |
302
307
  | [`tests/context.spec.ts`](tests/context.spec.ts) | 把系统提示词与注入上下文投影为对话记录小节 |
@@ -2239,7 +2239,10 @@ const SGR = {
2239
2239
  bold: ["1", "22"],
2240
2240
  italic: ["3", "23"],
2241
2241
  underline: ["4", "24"],
2242
+ strikethrough: ["9", "29"],
2242
2243
  accent: ["36", "39"],
2244
+ heading: ["38;5;117", "39"],
2245
+ link: ["38;5;75", "39"],
2243
2246
  success: ["32", "39"],
2244
2247
  warning: ["33", "39"],
2245
2248
  error: ["31", "39"],
@@ -2260,7 +2263,10 @@ function createPalette(enabled) {
2260
2263
  bold: role("bold"),
2261
2264
  italic: role("italic"),
2262
2265
  underline: role("underline"),
2266
+ strikethrough: role("strikethrough"),
2263
2267
  accent: role("accent"),
2268
+ heading: role("heading"),
2269
+ link: role("link"),
2264
2270
  success: role("success"),
2265
2271
  warning: role("warning"),
2266
2272
  error: role("error"),
@@ -2306,19 +2312,19 @@ function colorEnabled(env, isTty) {
2306
2312
  function markdownTheme(palette, highlight) {
2307
2313
  return {
2308
2314
  highlightCode: (code, lang) => highlight?.lines(code, lang) ?? code.split("\n"),
2309
- heading: (text) => palette.bold(palette.accent(text)),
2310
- link: palette.accent,
2315
+ heading: (text) => palette.bold(palette.heading(text)),
2316
+ link: (text) => palette.underline(palette.link(text)),
2311
2317
  linkUrl: palette.dim,
2312
- code: palette.warning,
2318
+ code: palette.link,
2313
2319
  codeBlock: (text) => text,
2314
2320
  codeBlockBorder: palette.dim,
2315
- quote: palette.italic,
2321
+ quote: (text) => palette.italic(palette.dim(text)),
2316
2322
  quoteBorder: palette.dim,
2317
2323
  hr: palette.dim,
2318
- listBullet: palette.accent,
2324
+ listBullet: palette.heading,
2319
2325
  bold: palette.bold,
2320
2326
  italic: palette.italic,
2321
- strikethrough: palette.dim,
2327
+ strikethrough: palette.strikethrough,
2322
2328
  underline: palette.underline
2323
2329
  };
2324
2330
  }
@@ -2371,10 +2377,11 @@ function editorTheme(palette) {
2371
2377
  * changes per frame - a fade's level, the focus mark's lift - is drawn over
2372
2378
  * those kept lines. Fenced code is the expensive part of a reply, so a reply
2373
2379
  * also keeps the coloured fences of its last Markdown parse
2374
- * ({@link FenceMemo}): a stream delta re-parses the whole message but colours
2375
- * only the fence that changed. `invalidate()` drops all of it, which the
2376
- * application calls on every block when a grammar lands; a new terminal width
2377
- * needs no call, because it misses every key on its own.
2380
+ * ({@link FenceMemo}): a stream delta re-lexes only the open tail after the
2381
+ * last closed fence and colours only the fence that changed. `invalidate()`
2382
+ * drops all of it, which the application calls on every block when a grammar
2383
+ * lands; a new terminal width needs no call, because it misses every key on
2384
+ * its own.
2378
2385
  * @module @deepseek-ai/dsh-tui-app/blocks
2379
2386
  */
2380
2387
  /** Columns the focus gutter takes from the width a block's content wraps at. */
@@ -2464,9 +2471,9 @@ var LastDrawn = class {
2464
2471
  /**
2465
2472
  * The coloured fences of one reply, kept from one Markdown parse to the next.
2466
2473
  *
2467
- * pi-tui's `Markdown` re-parses the whole message whenever its text changes
2468
- * and asks the theme to colour every fence it finds, so a streaming reply
2469
- * that already carries three fences would colour all three on every delta.
2474
+ * pi-tui's `Markdown` re-parses whenever its text changes and asks the theme
2475
+ * to colour every fence it finds, so a streaming reply that already carries
2476
+ * three fences would colour all three on every delta of the open tail.
2470
2477
  * This keeps what the last parse asked for: a fence that is asked for again
2471
2478
  * is answered from memory, and a fence the last parse did not ask for is
2472
2479
  * dropped at the next {@link FenceMemo.settle}, so the memo never holds more
@@ -2703,6 +2710,59 @@ var ContextBlock = class {
2703
2710
  }
2704
2711
  };
2705
2712
  /**
2713
+ * Source through the last closed fenced block, including the newline that
2714
+ * follows the closer when the message still has one. An unclosed fence, or a
2715
+ * reply with no fence, yields an empty prefix so the whole message is lexed.
2716
+ * @param text - the live Markdown source.
2717
+ * @returns the closed prefix, or the empty string.
2718
+ */
2719
+ function closedFencePrefix(text) {
2720
+ let last = 0;
2721
+ let index = 0;
2722
+ let open;
2723
+ while (index <= text.length) {
2724
+ const newline = text.indexOf("\n", index);
2725
+ const end = newline === -1 ? text.length : newline;
2726
+ const line = text.slice(index, end);
2727
+ let indent = 0;
2728
+ while (indent < 3 && line[indent] === " ") indent += 1;
2729
+ const rest = line.slice(indent);
2730
+ const marker = /^(`{3,}|~{3,})/.exec(rest)?.[1];
2731
+ if (marker !== void 0) {
2732
+ const info = rest.slice(marker.length);
2733
+ if (open === void 0) {
2734
+ if (!(marker.startsWith("`") && info.includes("`"))) open = {
2735
+ char: marker[0],
2736
+ length: marker.length
2737
+ };
2738
+ } else if (marker[0] === open.char && marker.length >= open.length && info.trim() === "") {
2739
+ last = newline === -1 ? text.length : newline + 1;
2740
+ open = void 0;
2741
+ }
2742
+ }
2743
+ if (newline === -1) break;
2744
+ index = newline + 1;
2745
+ }
2746
+ return text.slice(0, last);
2747
+ }
2748
+ /**
2749
+ * Stack a closed-fence drawing and the open tail the way one Markdown parse
2750
+ * would: a fence adds a blank line before the next block unless that block
2751
+ * is a blank-line token (the tail then starts with a newline).
2752
+ * @param prefixLines - the cached prefix drawing.
2753
+ * @param tail - the unparsed tail source.
2754
+ * @param tailLines - the tail drawing.
2755
+ * @returns the combined Markdown lines.
2756
+ */
2757
+ function joinFencePrefix(prefixLines, tail, tailLines) {
2758
+ if (tail.startsWith("\n")) return [...prefixLines, ...tailLines];
2759
+ return [
2760
+ ...prefixLines,
2761
+ "",
2762
+ ...tailLines
2763
+ ];
2764
+ }
2765
+ /**
2706
2766
  * An assistant reply: streamed reasoning above streamed Markdown text. The
2707
2767
  * durable `assistant/message` replaces both with the committed content.
2708
2768
  *
@@ -2722,6 +2782,14 @@ var AssistantBlock = class {
2722
2782
  text = "";
2723
2783
  interrupted = false;
2724
2784
  markdown;
2785
+ /** Closed-fence prefix, parsed only when that prefix or the width changes. */
2786
+ prefixMarkdown;
2787
+ /** Last prefix drawing, reused while the closed fences and width hold. */
2788
+ prefixCache;
2789
+ /** Last text handed to {@link AssistantBlock.markdown}, so fade ticks do not re-lex. */
2790
+ appliedTail;
2791
+ /** Last text handed to {@link AssistantBlock.prefixMarkdown}. */
2792
+ appliedPrefix;
2725
2793
  reasoningText;
2726
2794
  fade;
2727
2795
  /** Width of the last render that drew a text tail; absent before the first one. */
@@ -2746,7 +2814,9 @@ var AssistantBlock = class {
2746
2814
  this.turn = turn;
2747
2815
  const palette = theme.palette;
2748
2816
  this.fences = theme.codeHighlight === void 0 ? void 0 : new FenceMemo(theme.codeHighlight);
2749
- this.markdown = new Markdown("", 0, 0, markdownTheme(palette, this.fences));
2817
+ const themeForMarkdown = markdownTheme(palette, this.fences);
2818
+ this.markdown = new Markdown("", 0, 0, themeForMarkdown);
2819
+ this.prefixMarkdown = new Markdown("", 0, 0, themeForMarkdown);
2750
2820
  this.reasoningText = new Text("", 0, 0);
2751
2821
  }
2752
2822
  /**
@@ -2811,7 +2881,6 @@ var AssistantBlock = class {
2811
2881
  appendText(delta) {
2812
2882
  this.text += delta;
2813
2883
  this.revision += 1;
2814
- this.markdown.setText(this.text);
2815
2884
  }
2816
2885
  /**
2817
2886
  * Append streamed reasoning text.
@@ -2835,11 +2904,17 @@ var AssistantBlock = class {
2835
2904
  this.revision += 1;
2836
2905
  this.fade = void 0;
2837
2906
  this.reasoningFade = void 0;
2838
- this.markdown.setText(text);
2907
+ this.prefixCache = void 0;
2908
+ this.appliedPrefix = void 0;
2909
+ this.appliedTail = void 0;
2839
2910
  this.reasoningText.setText(this.theme.palette.dim(this.theme.palette.italic(reasoning.trimEnd())));
2840
2911
  }
2841
2912
  invalidate() {
2842
2913
  this.markdown.invalidate();
2914
+ this.prefixMarkdown.invalidate();
2915
+ this.prefixCache = void 0;
2916
+ this.appliedPrefix = void 0;
2917
+ this.appliedTail = void 0;
2843
2918
  this.reasoningText.invalidate();
2844
2919
  this.fences?.clear();
2845
2920
  this.drawn.clear();
@@ -2915,13 +2990,58 @@ var AssistantBlock = class {
2915
2990
  */
2916
2991
  renderText(width, at) {
2917
2992
  const fade = this.fade;
2918
- const lines = this.markdown.render(width);
2993
+ const lines = this.renderMarkdown(width);
2919
2994
  this.fences?.settle();
2920
2995
  if (fade === void 0) return lines;
2921
2996
  if (this.fadeWidth !== void 0 && this.fadeWidth !== width) fade.flush();
2922
2997
  this.fadeWidth = width;
2923
2998
  return recolorTail(lines, fadingInSpans(fade), fade.style(), this.repaintFloor - at);
2924
2999
  }
3000
+ /**
3001
+ * Lex the open tail and reuse the closed-fence prefix at this width.
3002
+ * @param width - the width the Markdown lays out in.
3003
+ * @returns the Markdown lines, fade not yet applied.
3004
+ */
3005
+ renderMarkdown(width) {
3006
+ const prefix = closedFencePrefix(this.text);
3007
+ if (prefix.length === 0) {
3008
+ this.prefixCache = void 0;
3009
+ this.appliedPrefix = void 0;
3010
+ this.applyMarkdown(this.markdown, this.text, "tail");
3011
+ return this.markdown.render(width);
3012
+ }
3013
+ const tail = this.text.slice(prefix.length);
3014
+ let prefixLines = this.prefixCache;
3015
+ if (prefixLines === void 0 || prefixLines.text !== prefix || prefixLines.width !== width) {
3016
+ this.applyMarkdown(this.prefixMarkdown, prefix, "prefix");
3017
+ prefixLines = {
3018
+ text: prefix,
3019
+ width,
3020
+ lines: this.prefixMarkdown.render(width)
3021
+ };
3022
+ this.prefixCache = prefixLines;
3023
+ }
3024
+ if (tail.trim() === "") return prefixLines.lines;
3025
+ this.applyMarkdown(this.markdown, tail, "tail");
3026
+ return joinFencePrefix(prefixLines.lines, tail, this.markdown.render(width));
3027
+ }
3028
+ /**
3029
+ * Hand `text` to `markdown` only when it differs, so a fade tick does not re-lex.
3030
+ * @param markdown - the prefix or tail instance.
3031
+ * @param text - the source that instance should hold.
3032
+ * @param which - which applied-text slot to update.
3033
+ */
3034
+ applyMarkdown(markdown, text, which) {
3035
+ if (which === "prefix") {
3036
+ if (this.appliedPrefix === text) return;
3037
+ markdown.setText(text);
3038
+ this.appliedPrefix = text;
3039
+ return;
3040
+ }
3041
+ if (this.appliedTail === text) return;
3042
+ markdown.setText(text);
3043
+ this.appliedTail = text;
3044
+ }
2925
3045
  };
2926
3046
  /**
2927
3047
  * A tool call card: status glyph, tool name, headline, then a foldable body.
@@ -3635,6 +3755,54 @@ function matchEffort(reasoning, typed) {
3635
3755
  return wanted === DEFAULT_ARGUMENT ? void 0 : null;
3636
3756
  }
3637
3757
  //#endregion
3758
+ //#region lib/types/permission.js
3759
+ /**
3760
+ * Permission-preset rows and labels shared by `/permission` and the
3761
+ * permission status-bar hint.
3762
+ * @module @deepseek-ai/dsh-tui-app/permission
3763
+ */
3764
+ /**
3765
+ * The display name of one preset.
3766
+ * @param options - the process catalog.
3767
+ * @param preset - the selected preset, including a derived `custom` value.
3768
+ * @returns the catalog label, or the raw id when the catalog no longer lists it.
3769
+ */
3770
+ function permissionName(options, preset) {
3771
+ return options.find((option) => option.value === preset)?.name ?? preset;
3772
+ }
3773
+ /**
3774
+ * Picker rows for the process catalog, in contribution order.
3775
+ * @param options - the selectable presets.
3776
+ * @returns the rows.
3777
+ */
3778
+ function permissionItems(options) {
3779
+ return options.map((option) => ({
3780
+ value: option.value,
3781
+ label: option.name,
3782
+ ...option.description === void 0 ? {} : { description: option.description }
3783
+ }));
3784
+ }
3785
+ /**
3786
+ * The dim row under the picker heading.
3787
+ * @param options - the process catalog.
3788
+ * @param preset - the preset in force.
3789
+ * @returns one row naming the preset in force and how to dismiss the picker.
3790
+ */
3791
+ function permissionHint(options, preset) {
3792
+ return `current: ${permissionName(options, preset)} · Esc keeps it`;
3793
+ }
3794
+ /**
3795
+ * The preset a typed `/permission` argument names. Matching is without case
3796
+ * so a typed id can follow the catalog's own casing.
3797
+ * @param options - the process catalog.
3798
+ * @param typed - the argument, matched against catalog values.
3799
+ * @returns the catalog value, or null when nothing matches.
3800
+ */
3801
+ function matchPermission(options, typed) {
3802
+ const wanted = typed.toLowerCase();
3803
+ return options.find((option) => option.value.toLowerCase() === wanted)?.value ?? null;
3804
+ }
3805
+ //#endregion
3638
3806
  //#region lib/types/export.js
3639
3807
  /**
3640
3808
  * `/export`: the same session-log ZIP the browser downloads, written to a
@@ -3829,9 +3997,9 @@ const HINTS = {
3829
3997
  "Esc input"
3830
3998
  ],
3831
3999
  queue: [
3832
- "↑↓ prompts · S steer · I inject · E edit · Esc input",
3833
- "S steer · I inject · E edit · Esc input",
3834
- "Esc input"
4000
+ "enter steer · ↑ select/edit · esc cancel",
4001
+ "enter steer · esc cancel",
4002
+ "esc cancel"
3835
4003
  ],
3836
4004
  panel: [
3837
4005
  "↑↓ children · Enter details · Tab regions · Esc input",
@@ -3861,7 +4029,7 @@ const FOCUS_REGIONS = [
3861
4029
  const REGION_LABELS = {
3862
4030
  editor: "input",
3863
4031
  transcript: "conversation",
3864
- queue: "queued prompts",
4032
+ queue: "follow-ups",
3865
4033
  panel: "subagent panel",
3866
4034
  bar: "status bar"
3867
4035
  };
@@ -4181,13 +4349,17 @@ function transcriptKey(data) {
4181
4349
  return cycleKey(data) ?? typeKey(data);
4182
4350
  }
4183
4351
  /**
4184
- * What one key means while the pending-prompt panel holds the keyboard.
4352
+ * What one key means while the follow-ups panel holds the keyboard.
4185
4353
  * @param data - the raw key bytes.
4186
4354
  * @returns the action, or undefined for a key the panel consumes without effect.
4187
4355
  */
4188
4356
  function queueKey(data) {
4189
4357
  const move = moveKey(data, QUEUE_MOVES);
4190
4358
  if (move !== void 0) return move;
4359
+ if (matchesKey(data, "enter")) return {
4360
+ kind: "queue",
4361
+ action: "steer"
4362
+ };
4191
4363
  if (data === "s" || data === "S") return {
4192
4364
  kind: "queue",
4193
4365
  action: "steer"
@@ -4846,9 +5018,10 @@ function partLabels(cursor, blocks) {
4846
5018
  /**
4847
5019
  * The agent's todo list as terminal rows: the status glyphs every todo surface
4848
5020
  * of this terminal draws, the picker choices the list offers, and the detail
4849
- * rows one entered item prints. Everything here is pure text work over plain
4850
- * values; the single service touch is one optional read of the `todos` session
4851
- * projection.
5021
+ * rows one entered item prints. Completed picker content can take a paint
5022
+ * function so the list scratches it out. Everything here is pure text work
5023
+ * over plain values; the single service touch is one optional read of the
5024
+ * `todos` session projection.
4852
5025
  * @module @deepseek-ai/dsh-tui-app/todos
4853
5026
  */
4854
5027
  /**
@@ -4891,22 +5064,34 @@ const TODO_STATUSES = [
4891
5064
  "pending"
4892
5065
  ];
4893
5066
  /**
5067
+ * The content a todo row shows: completed items take `paint` so the list can
5068
+ * scratch them out; every other status is the content unchanged.
5069
+ * @param content - the text after any row-length cut.
5070
+ * @param status - the item's status.
5071
+ * @param paint - how completed content is marked.
5072
+ * @returns the painted content, or `content` when the item is not completed or no paint was given.
5073
+ */
5074
+ function paintTodoContent(content, status, paint) {
5075
+ return status === "completed" && paint !== void 0 ? paint(content) : content;
5076
+ }
5077
+ /**
4894
5078
  * The agent's current todo list as picker rows, in write order.
4895
5079
  * @param ctx - plugin context carrying the optional session-projection registry.
4896
5080
  * @param session - the session whose todo list is read.
5081
+ * @param paint - how completed content is marked; omitted leaves it unmarked.
4897
5082
  * @returns one choice per item. Empty in three cases: no projection registry
4898
5083
  * is composed in this profile, the registry has no `todos` unit registered, or
4899
5084
  * the value is `null` — which it is before the first `todo_write` of the
4900
5085
  * current turn, since every `turn/start` clears the list.
4901
5086
  */
4902
- function listTodoChoices(ctx, session) {
5087
+ function listTodoChoices(ctx, session, paint) {
4903
5088
  const projections = ctx.get("sessionProjections");
4904
5089
  if (projections === void 0) return [];
4905
5090
  const items = projections.snapshot(session, ["todos"]).values.todos;
4906
5091
  if (items === void 0 || items === null) return [];
4907
5092
  return items.map((item, index) => ({
4908
5093
  index,
4909
- label: `${TODO_GLYPH[item.status]} ${labelContent(item.content)}`,
5094
+ label: `${TODO_GLYPH[item.status]} ${paintTodoContent(labelContent(item.content), item.status, paint)}`,
4910
5095
  description: describeStatus(item.status),
4911
5096
  status: item.status
4912
5097
  }));
@@ -5391,7 +5576,7 @@ function buildFooterSegments(inputs) {
5391
5576
  segments.push({
5392
5577
  id: "permission",
5393
5578
  label: `permission ${inputs.permission}`,
5394
- detail: printed([...projected.length === 0 ? [`permission: ${inputs.permission}`] : projected, "/permission <preset> changes the sandbox mode and the approval policy"])
5579
+ detail: printed([...projected.length === 0 ? [`permission: ${inputs.permission}`] : projected, "/permission opens the permission list"])
5395
5580
  });
5396
5581
  }
5397
5582
  if (turn !== void 0) segments.push({
@@ -6248,11 +6433,26 @@ var ModalQueue = class {
6248
6433
  //#endregion
6249
6434
  //#region lib/types/queue-panel.js
6250
6435
  /**
6251
- * The pending-prompt panel above the editor. It presents the Agent inbox as a
6252
- * framed, selectable list without mutating the messages it displays.
6436
+ * The follow-up panel above the editor. It presents the Agent inbox as a
6437
+ * boxed pending-prompt list without mutating the messages it displays.
6253
6438
  * @module @deepseek-ai/dsh-tui-app/queue-panel
6254
6439
  */
6255
6440
  /**
6441
+ * The first content line a row shows.
6442
+ * @param content - the message's full text.
6443
+ * @returns the text before the first newline, or all of `content` when it is one line.
6444
+ */
6445
+ function firstLine(content) {
6446
+ const breakAt = content.indexOf("\n");
6447
+ return breakAt === -1 ? content : content.slice(0, breakAt);
6448
+ }
6449
+ /** Pending-row marker; the same glyph the todo list uses for an unstarted item. */
6450
+ const FOLLOW_UP_GLYPH = "○";
6451
+ /** Columns the glyph and its trailing space occupy on the first wrapped line. */
6452
+ const FOLLOW_UP_PREFIX = `${FOLLOW_UP_GLYPH} `;
6453
+ /** Indent that lines up wrapped follow-up text under the first line's content. */
6454
+ const FOLLOW_UP_INDENT = " ";
6455
+ /**
6256
6456
  * Build the panel rows in claim order: next-step input before ordinary turns.
6257
6457
  * Messages whose source is not `user` are omitted: a `!` notice waiting for
6258
6458
  * the next prompt is context, not a prompt the keyboard can steer or edit.
@@ -6264,14 +6464,26 @@ function queuePanelRows(nextStep, nextTurn) {
6264
6464
  const row = (target, message) => ({
6265
6465
  message,
6266
6466
  target,
6267
- text: contentText(message.content).split("\n", 1)[0] ?? ""
6467
+ text: firstLine(contentText(message.content))
6268
6468
  });
6269
6469
  const pending = (target, messages) => messages.filter((message) => message.source.kind === "user").map((message) => row(target, message));
6270
6470
  return [...pending("next-step", nextStep), ...pending("next-turn", nextTurn)];
6271
6471
  }
6272
6472
  /**
6273
- * Render the pending prompts inside a frame. A focused panel accents its held
6274
- * row and names its actions; an unfocused panel names the key that enters it.
6473
+ * One follow-up's text wrapped under the pending glyph, hanging the
6474
+ * continuation so it lines up with the first line's content.
6475
+ * @param text - the row's first content line.
6476
+ * @param room - columns inside the frame.
6477
+ * @param glyph - the pending marker, already styled.
6478
+ * @returns one or more body contents, never wider than `room`.
6479
+ */
6480
+ function followUpLines(text, room, glyph) {
6481
+ return wrapTextWithAnsi(text, Math.max(1, room - visibleWidth(FOLLOW_UP_PREFIX))).map((line, index) => index === 0 ? `${glyph} ${line}` : `${FOLLOW_UP_INDENT}${line}`);
6482
+ }
6483
+ /**
6484
+ * Render the pending prompts as a boxed follow-ups list. A focused panel
6485
+ * accents its held row and names enter, select/edit, and cancel; an unfocused
6486
+ * panel names the key that enters it.
6275
6487
  * @param rows - pending prompts in claim order.
6276
6488
  * @param render - palette, terminal width, and optional selection.
6277
6489
  * @returns panel text, or the empty string when no prompt waits.
@@ -6281,23 +6493,19 @@ function renderQueuePanel(rows, render) {
6281
6493
  const { palette, selected } = render;
6282
6494
  const width = Math.max(1, render.width);
6283
6495
  const tone = selected === void 0 ? "muted" : "focus";
6284
- const title = `${String(rows.length)} pending`;
6285
- const lines = [topRule({
6286
- chip: chip(palette, "QUEUE"),
6287
- title: palette.bold(title),
6496
+ const lines = [tone === "focus" ? palette.accent("follow-ups") : palette.dim("follow-ups"), topRule({
6288
6497
  width,
6289
6498
  palette,
6290
6499
  tone
6291
6500
  })];
6292
6501
  const room = Math.max(1, width - 2);
6293
6502
  for (const [index, row] of rows.entries()) {
6294
- const label = row.target === "next-step" ? "next step" : "next turn";
6295
- const text = `${selected === index ? palette.accent("▸ ") : " "}${palette.dim(`${label} ·`)} ${row.text}`;
6296
- for (const wrapped of wrapTextWithAnsi(text, room)) lines.push(bodyLine(wrapped, width, palette, tone));
6503
+ const glyph = selected === index ? palette.accent(FOLLOW_UP_GLYPH) : FOLLOW_UP_GLYPH;
6504
+ for (const content of followUpLines(row.text, room, glyph)) lines.push(bodyLine(content, width, palette, tone));
6297
6505
  }
6298
- const hints = selected === void 0 ? ["Shift+↓ manages"] : HINTS.queue;
6506
+ const hints = selected === void 0 ? ["shift+↓ select"] : HINTS.queue;
6507
+ lines.push(bodyLine(palette.dim(fitLegend(hints, room)), width, palette, tone));
6299
6508
  lines.push(bottomRule({
6300
- left: palette.dim(fitLegend(hints, ruleRoom(width))),
6301
6509
  width,
6302
6510
  palette,
6303
6511
  tone
@@ -7260,8 +7468,8 @@ function paneIntent(data) {
7260
7468
  * have, correct it when it lands" the rest of this surface uses.
7261
7469
  *
7262
7470
  * Colours come from a shiki theme rather than the palette: a theme
7263
- * distinguishes a keyword from a type from a number, which the nine palette
7264
- * roles cannot, and the transcript is where the model's code is read. The
7471
+ * distinguishes a keyword from a type from a number, which the palette's
7472
+ * structural roles cannot, and the transcript is where the model's code is read. The
7265
7473
  * theme is chosen from the terminal's own background, so a light terminal is
7266
7474
  * not given dark-theme colours, and a terminal that answers neither a colour
7267
7475
  * depth nor a background gets no colour at all.
@@ -8218,6 +8426,11 @@ const LOCAL_COMMANDS = [
8218
8426
  name: "effort",
8219
8427
  description: "Pick the current model's reasoning effort for the next request (/effort <id>, /effort default)"
8220
8428
  },
8429
+ {
8430
+ name: "permission",
8431
+ description: "Pick the permission preset (/permission <preset>)",
8432
+ hint: "<preset>"
8433
+ },
8221
8434
  {
8222
8435
  name: "sessions",
8223
8436
  description: "Switch to another session"
@@ -8315,6 +8528,8 @@ const LOCAL_COMMANDS = [
8315
8528
  description: "Same as /quit"
8316
8529
  }
8317
8530
  ];
8531
+ /** Names the terminal handles before the shared registry, used to hide the matching catalog row. */
8532
+ const LOCAL_COMMAND_NAMES = new Set(LOCAL_COMMANDS.map((command) => command.name));
8318
8533
  /**
8319
8534
  * Whether a sign-in method is a provider subscription rather than a key field.
8320
8535
  * `api-key` is the id a key-collecting login registers under; every other id
@@ -8725,7 +8940,7 @@ var TuiApp = class {
8725
8940
  }
8726
8941
  }
8727
8942
  completableCommands() {
8728
- const shared = this.deps.ctx.get("commands")?.list(this.agent) ?? [];
8943
+ const shared = (this.deps.ctx.get("commands")?.list(this.agent) ?? []).filter((command) => !LOCAL_COMMAND_NAMES.has(command.name));
8729
8944
  return [...LOCAL_COMMANDS, ...shared.map((command) => ({
8730
8945
  name: command.name,
8731
8946
  description: command.description,
@@ -8815,7 +9030,7 @@ var TuiApp = class {
8815
9030
  this.tui.requestRender();
8816
9031
  }
8817
9032
  /**
8818
- * Redraw the queued prompts above the editor from the bound Agent's inbox.
9033
+ * Redraw the follow-ups list above the editor from the bound Agent's inbox.
8819
9034
  * The slot is mounted exactly while a prompt waits, so the editor sits
8820
9035
  * directly under the conversation the rest of the time.
8821
9036
  */
@@ -9121,7 +9336,8 @@ var TuiApp = class {
9121
9336
  */
9122
9337
  async browseTodos() {
9123
9338
  const items = this.statusFacts().todos?.items ?? [];
9124
- const choices = listTodoChoices(this.deps.ctx, this.agent.session);
9339
+ const { palette } = this.deps;
9340
+ const choices = listTodoChoices(this.deps.ctx, this.agent.session, (content) => palette.dim(palette.strikethrough(content)));
9125
9341
  if (choices.length === 0) {
9126
9342
  this.notice("no todos yet");
9127
9343
  return;
@@ -10193,6 +10409,9 @@ var TuiApp = class {
10193
10409
  case "effort":
10194
10410
  await this.runCurrentEffort(argument);
10195
10411
  return;
10412
+ case "permission":
10413
+ await this.choosePermission(argument);
10414
+ return;
10196
10415
  case "sessions":
10197
10416
  case "resume":
10198
10417
  await this.openSessionPicker();
@@ -10529,6 +10748,57 @@ var TuiApp = class {
10529
10748
  this.notice(effort === void 0 ? "effort: provider default from the next request" : `effort ${effort} from the next request`, "success");
10530
10749
  this.refreshFooter();
10531
10750
  }
10751
+ /**
10752
+ * Choose the bound session's permission preset: an empty argument opens
10753
+ * the picker on the preset in force, and anything else names a catalog
10754
+ * value. A pick submits `/permission <preset>` when the shared command
10755
+ * exists, the same write path the browser uses.
10756
+ * @param argument - a catalog value, or empty for the picker.
10757
+ */
10758
+ async choosePermission(argument) {
10759
+ const presets = this.deps.ctx.get("permissionPresets");
10760
+ if (presets === void 0) {
10761
+ this.notice("no permission service is composed", "error");
10762
+ return;
10763
+ }
10764
+ const options = presets.catalog().options;
10765
+ if (argument !== "") {
10766
+ const matched = matchPermission(options, argument);
10767
+ if (matched === null) {
10768
+ const available = options.map((option) => option.value).join(", ");
10769
+ this.notice(available === "" ? `unknown preset "${argument}"` : `unknown preset "${argument}" (available: ${available})`, "error");
10770
+ return;
10771
+ }
10772
+ await this.applyPermission(presets, matched);
10773
+ return;
10774
+ }
10775
+ if (options.length === 0) {
10776
+ this.notice("no selectable permission presets");
10777
+ return;
10778
+ }
10779
+ const current = presets.current(this.agent.session);
10780
+ const picked = await this.showModal(new PickPrompt(this.deps.palette, "Permission preset", permissionItems(options), {
10781
+ body: [permissionHint(options, current)],
10782
+ current
10783
+ }));
10784
+ if (picked === void 0) return;
10785
+ await this.applyPermission(presets, picked.value);
10786
+ }
10787
+ /**
10788
+ * Switch to `name` through the shared `/permission` command when a
10789
+ * registry is composed, otherwise through the permission service.
10790
+ * @param presets - the composed permission service.
10791
+ * @param name - a catalog value.
10792
+ */
10793
+ async applyPermission(presets, name) {
10794
+ if (this.deps.ctx.get("commands") !== void 0) {
10795
+ await this.runSharedCommand(`/permission ${name}`, "permission");
10796
+ return;
10797
+ }
10798
+ presets.set(this.agent.session, name);
10799
+ this.notice(`preset ${name}`, "success");
10800
+ this.refreshFooter();
10801
+ }
10532
10802
  async modelItems() {
10533
10803
  const llm = this.deps.ctx.get("llm");
10534
10804
  if (llm === void 0) return [];
@@ -11367,28 +11637,29 @@ const internals = {
11367
11637
  canOpenUrl: () => canOpenNativePath(),
11368
11638
  openUrl: openNativeUrl
11369
11639
  };
11370
- /** Events read per page when a persisted session is resumed, through the storage handle before the Agent takes the log over. */
11371
- const HISTORY_PAGE = 256;
11372
- /**
11373
- * Read a persisted session's complete event log in pages, so the terminal
11374
- * can draw the earlier conversation before resuming it.
11375
- * @param ctx - plugin context carrying the persistence service.
11376
- * @param id - the session to read.
11377
- * @returns the persisted events in log order.
11378
- */
11379
- async function readHistory(ctx, id) {
11380
- const persistence = ctx.get("sessionPersistence");
11381
- if (persistence === void 0) throw new Error("tui-app: resuming a session needs a composed session persistence provider");
11382
- const handle = await persistence.open(id, "read");
11640
+ /**
11641
+ * Events the terminal binds after the Agent has taken the write handle.
11642
+ * The live Session already includes interrupted-turn closers resume appended.
11643
+ * @param ctx - plugin context carrying the session query engine.
11644
+ * @param id - the session the Agent just resumed.
11645
+ * @returns the persisted events in log order, closers included.
11646
+ * @throws when no query engine is composed.
11647
+ */
11648
+ async function observeBoundHistory(ctx, id) {
11649
+ const env_1 = {
11650
+ stack: [],
11651
+ error: void 0,
11652
+ hasError: false
11653
+ };
11383
11654
  try {
11384
- const events = [];
11385
- for (;;) {
11386
- const page = await handle.read(events.length, HISTORY_PAGE);
11387
- events.push(...page.events);
11388
- if (page.events.length < HISTORY_PAGE) return events;
11389
- }
11655
+ const query = ctx.get("sessionQuery");
11656
+ if (query === void 0) throw new Error("tui-app: resuming a session needs a composed session query engine");
11657
+ return __addDisposableResource(env_1, await query.observeSession(id, { projectionMode: "none" }), false).events;
11658
+ } catch (e_1) {
11659
+ env_1.error = e_1;
11660
+ env_1.hasError = true;
11390
11661
  } finally {
11391
- await handle[Symbol.asyncDispose]();
11662
+ __disposeResources(env_1);
11392
11663
  }
11393
11664
  }
11394
11665
  /**
@@ -11417,7 +11688,7 @@ function coreServices(ctx) {
11417
11688
  * @throws when no query engine is composed or the session has no such completed turn.
11418
11689
  */
11419
11690
  async function forkSeed(ctx, id, turn) {
11420
- const env_1 = {
11691
+ const env_2 = {
11421
11692
  stack: [],
11422
11693
  error: void 0,
11423
11694
  hasError: false
@@ -11425,17 +11696,17 @@ async function forkSeed(ctx, id, turn) {
11425
11696
  try {
11426
11697
  const query = ctx.get("sessionQuery");
11427
11698
  if (query === void 0) throw new Error("forking a session needs a composed session query engine");
11428
- const source = __addDisposableResource(env_1, await query.observeSession(id), false);
11699
+ const source = __addDisposableResource(env_2, await query.observeSession(id), false);
11429
11700
  const boundary = source.events.findLast((event) => event.type === "turn/end" && (turn === void 0 || event.data.turn === turn));
11430
11701
  if (boundary === void 0) throw new Error(turn === void 0 ? `session ${id} has no completed turn to fork from` : `session ${id} has no completed turn ${String(turn)} to fork from`);
11431
11702
  let cut = boundary.seq + 1;
11432
11703
  while (cut < source.events.length && source.events[cut]?.type !== "turn/start") cut += 1;
11433
11704
  return source.events.slice(0, cut);
11434
- } catch (e_1) {
11435
- env_1.error = e_1;
11436
- env_1.hasError = true;
11705
+ } catch (e_2) {
11706
+ env_2.error = e_2;
11707
+ env_2.hasError = true;
11437
11708
  } finally {
11438
- __disposeResources(env_1);
11709
+ __disposeResources(env_2);
11439
11710
  }
11440
11711
  }
11441
11712
  /**
@@ -11489,10 +11760,25 @@ function sessionHost(ctx, core, cwd) {
11489
11760
  }, seed ?? []);
11490
11761
  return {
11491
11762
  create: () => create(void 0, void 0),
11492
- resume: async (id) => bind((_selection, setup) => agents.resume({
11493
- resumeSessionId: id,
11494
- setup
11495
- }), await readHistory(ctx, id)),
11763
+ resume: async (id) => {
11764
+ const selection = {
11765
+ current: void 0,
11766
+ assembled: void 0
11767
+ };
11768
+ const handle = await agents.resume({
11769
+ resumeSessionId: id,
11770
+ setup: (agentCtx) => {
11771
+ installModelSelection(agentCtx, selection);
11772
+ }
11773
+ });
11774
+ await handle.agent.whenIdle();
11775
+ return {
11776
+ agent: handle.agent,
11777
+ selection,
11778
+ history: await observeBoundHistory(ctx, id),
11779
+ dispose: () => handle.dispose()
11780
+ };
11781
+ },
11496
11782
  fork: async (id, turn) => create(await forkSeed(ctx, id, turn), id)
11497
11783
  };
11498
11784
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songtonyli/dsh-cli",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
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",