@aiwayds/dsh-tui-pi 1.2.1 → 1.2.3

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
@@ -12,142 +12,47 @@ https://github.com/user-attachments/assets/6a7e00bb-1fd0-4bc5-9070-457f1e9fa54d
12
12
 
13
13
  ## ✨ Features
14
14
 
15
- > Each item links to its section below — one line for what it gives you.
16
-
17
- - [**Footer — live session overview**](#footer) — provider/model, context pressure and the session cache-hit rate at a glance, always in view.
18
- - [**Think & tool panels**](#think-and-tool-panels) — reasoning and tool activity stay out of the transcript, so the conversation reads clean.
19
- - [**Subagents**](#subagents) — every running subagent gets a status line; watch and steer it live.
20
- - [**Ask User Question**](#ask-user-question) — the model can pause and ask you structured questions, answered without leaving the TUI.
21
- - [**Feishu integration demo**](#feishu-integration-demo) — dsh-tui-pi on the desktop and Feishu/Lark on the phone driving (and answering for) the same dsh session.
22
- - [**Dynamic context pruning (DCP)**](#dynamic-context-pruning-dcp) — context stays within limits automatically, with zero LLM calls.
23
- - [**Persistent context**](#persistent-context) — your ground rules ride along on every request, hot-applied with no restart.
24
- - [**Model profiles & favorites**](#model-profiles-and-favorites) — switch a whole model setup per project and keep the picker small.
25
- - [**Sessions & resume**](#sessions-and-resume) — sessions stay tidy automatically and resume in a few keystrokes.
26
- - [**Themes**](#themes) — GitHub light/dark palettes, hot-switchable; `auto` follows your terminal.
27
- - [**Search, selection & images**](#search-selection-and-images) — `Ctrl+Shift+F` over the whole transcript, drag-select copies to the OS clipboard, attachments from web/Feishu render inline, LaTeX replies draw as Unicode math.
15
+ > Each item links to its own doc under [`docs/features/`](docs/features/) — one line here, the details (and demo videos) there.
28
16
 
29
- ---
30
-
31
- ## Footer
32
-
33
- Every number that matters for a session — provider/model route, thinking level, context use, message and tool counts, plus a live clock sits in one powerline bar pinned at the bottom, with the editor's top border showing your cwd and git branch. You see cost pressure (context %, cache-hit %) and activity without ever leaving the terminal.
34
-
35
- ```
36
- dsh volc-ark-plan deepseek-v4-flash high 48.7k/1.0M(4.6%) CH85.4% 15 msgs 11 tools 00:02:13
37
- ```
38
-
39
- **Cache-hit (`CHxx%`)** is the session's cache-hit rate the share of the session's total billed input traffic that was served from the prompt cache. It is cumulative over the whole session (a provider/model switch does not reset it) and appears only once the session has actually billed any cached tokens. (Layout: [ARCHITECTURE.md](ARCHITECTURE.md).)
40
-
41
- ---
42
-
43
- ## Think and tool panels
44
-
45
- Live reasoning and tool calls render as fixed panels pinned **above the chat input** instead of scrolling into the transcript, so the conversation thread stays readable. Panels appear only while something is active, and their height is configurable (`dsh-tui.panelHeight`: `1` line, `5`/`7`/`10` boxed rows, or `all`).
46
-
47
- ---
48
-
49
- ## Subagents
50
-
51
- Running subagents show as compact one-line status rows below the editor — name, context use, rounds, elapsed — so delegation is visible without opening anything. `Ctrl+G` (or `/subagents`) opens a live transcript viewer; press `Enter` inside it to steer a child with a message. The `● Todos` panel keeps your task tree pinned above the input. Caps (`maxAgents`, `maxRounds`, configured via `/agents` → `l`) keep runaway delegation in check.
52
-
53
- ---
54
-
55
- ## Ask User Question
56
-
57
- While mid-turn, the model can pause and ask you structured questions via the `ask_user_question` tool; the answering side is a docked panel above the input — no window juggling. One question at a time with tabs for the rest, `Ctrl+T` folds the panel away, double-`Esc` declines. Free text, multi-select, a multi-question review page, bracketed-paste and right-click / `Ctrl+Shift+C` system-clipboard paste are all supported.
58
-
59
- See the ask-question flow in action:
60
-
61
- https://github.com/user-attachments/assets/aa36be36-a508-4f53-ba85-efe0394dab11
17
+ - [**Footer — live session overview**](docs/features/footer.md) — provider/model, context pressure and the session cache-hit rate at a glance, always in view.
18
+ - [**Think & tool panels**](docs/features/think-tool-panels.md) — reasoning and tool activity stay out of the transcript, so the conversation reads clean.
19
+ - [**Subagents**](docs/features/subagents.md) — every running subagent gets a status line; watch and steer it live.
20
+ - [**Ask User Question**](docs/features/ask-user-question.md) — the model can pause and ask you structured questions, answered without leaving the TUI.
21
+ - [**Feishu integration**](docs/features/feishu-demo.md)dsh-tui-pi on the desktop and Feishu/Lark on the phone driving (and answering for) the same dsh session.
22
+ - [**Dynamic context pruning (DCP)**](docs/features/dcp.md) — context stays within limits automatically, with zero LLM calls.
23
+ - [**Persistent context**](docs/features/persistent-context.md) — your ground rules ride along on every request, hot-applied with no restart.
24
+ - [**Model profiles & favorites**](docs/features/model-profiles.md) switch a whole model setup per project and keep the picker small.
25
+ - [**Sessions & resume**](docs/features/sessions-resume.md) — sessions stay tidy automatically and resume in a few keystrokes; a cross-process writer guard keeps the log single-writer.
26
+ - [**Themes**](docs/features/themes.md) — GitHub light/dark palettes, hot-switchable; `auto` follows your terminal.
27
+ - [**Search, selection & images**](docs/features/search-selection-images.md)`Ctrl+Shift+F` over the whole transcript, drag-select copies to the OS clipboard, attachments from web/Feishu render inline, LaTeX replies draw as Unicode math.
28
+ - [**Slash commands**](docs/features/slash-commands.md) — `/model`, `/resume`, `/btw`, `/profile-switch`, … plus everything dsh-native.
29
+ - [**Startup plugin tree**](docs/features/startup-tree.md) — every profile plugin with its installed npm version, printed at launch.
62
30
 
63
31
  ---
64
32
 
65
- ## Feishu integration demo
66
-
67
- dsh-tui-pi on the desktop and Feishu/Lark on the phone driving (and answering for) the same dsh session:
68
-
69
- https://github.com/user-attachments/assets/177e8839-523b-487e-b3d1-6d725cd8aba5
70
-
71
- https://github.com/user-attachments/assets/c0d7092f-deda-4443-b75a-2bc93bd30d86
72
-
73
- Demos courtesy of the [dsh-feishu Demos issue](https://github.com/fan56/dsh-feishu/issues/1).
74
-
75
- ---
76
-
77
- ## Dynamic context pruning (DCP)
78
-
79
- Context stays within the model window automatically: [dsh-dcp](https://github.com/fan56/dsh-dcp) compacts the session **without calling an LLM to summarize**. Mount it once and it runs transparently — the footer's context segment follows the shrink, and inside a subagent each committed compaction shows as a `🧹` notice in the viewer.
33
+ ## Install and launch
80
34
 
81
35
  ```sh
82
- dsh plugin --profile tui add @aiwayds/dsh-dcp
36
+ dsh plugin --profile tui add @aiwayds/dsh-tui-pi
37
+ dsh plugin --profile tui add @aiwayds/dsh-subagent-registry # optional
38
+ dsh plugin --profile tui add @aiwayds/dsh-dcp # optional
39
+ dsh --profile tui # launch (or: dsh-tui-pi)
83
40
  ```
84
41
 
85
- ---
86
-
87
- ## Persistent context
88
-
89
- `$DSH_HOME/APPEND_SYSTEM.md` (default `~/.dsh/APPEND_SYSTEM.md`, pi convention) is appended to the **main agent's** system prompt and hot-applied — edit the file and the next request sees it, no restart. The TUI seeds it from a template on first run, keeps its marked todo-lifecycle section idempotent, and never overwrites your content. Subagents are deliberately left untouched.
90
-
91
- ---
92
-
93
- ## Model profiles and favorites
94
-
95
- `/profile-switch` swaps a whole setup — default model, thinking level and every subagent's model — in one pick; `p` pins a profile to the current directory so every new session in that tree loads it. `/model` favorites and hidden lists keep the picker small. Manage profiles with `/profile-cfg` (roster, edit, save-current, rename, delete).
96
-
97
- ---
98
-
99
- ## Sessions and resume
100
-
101
- `/resume` restores any recent session in a few keystrokes (ordered by last update), `/new` starts fresh, `/export` writes the session log as JSONL (`~/Downloads/dsh-session-<id>.jsonl`). A startup janitor (`dsh-tui.retention.*`) prunes old session logs so the store never grows without bound; the resume picker shows only the working set (`dsh-tui.resume.*`). Both are configurable in `~/.dsh/settings.yaml` with env overrides.
102
-
103
- ---
104
-
105
- ## Themes
106
-
107
- GitHub light/dark palettes, hot-switched with `/theme`; `auto` detects your terminal and follows live light/dark switches. `DSH_TUI_THEME=light|dark` pins a scheme, `DSH_TUI_TRANSPARENT=1` makes the canvas see-through, `DSH_TUI_MOUSE=buttons|all|off` tunes mouse tracking.
108
-
109
- ---
110
-
111
- ## Search, selection and images
42
+ Everything that used to need manual patching — the canvas background, the `@deepseek-ai` module closure, the compaction backend — now happens automatically. Upgrade an existing profile after a release:
112
43
 
113
- - **Transcript search** — `Ctrl+Shift+F` opens an input overlay over the transcript; `Enter`/`Ctrl+G` and `Shift+Enter`/`Ctrl+Shift+G` walk the matches, `Esc` closes. While it is open the search owns the keys, so your Esc/Ctrl+C gestures stay untouched.
114
- - **Selection copy** — drag to select anywhere in the transcript; releasing copies through the OS clipboard (`pbcopy` / `wl-copy` / `xclip` / `xsel` / `clip`, with OSC 52 riding along for terminals that honor it). `DSH_TUI_COPY_ON_SELECT=0` keeps selection visual-only. Mouse tracking is still tuned by `DSH_TUI_MOUSE` (default `buttons`: clicks, wheel, drag-selection and scrollbar dragging, no idle-motion noise).
115
- - **Images from other surfaces** — messages sent with attachments from the web UI or Feishu render inline in the transcript: a real bitmap on Kitty / Ghostty / WezTerm (kitty graphics) and iTerm2, a clickable filename fallback elsewhere, and a muted "unavailable" note if the stored attachment fails verification. Session resume re-renders past images too.
116
- - **LaTeX in replies** — `$e^{i\pi}+1=0$` and `$$\int_0^1 x\,dx$$` render as terminal-friendly Unicode math (`e^(iπ)+1 = 0`, `∫₀¹ x dx`). Quirk inherited from upstream: a literal `$$` pair in prose is treated as display math.
44
+ ```sh
45
+ node scripts/dev-upgrade.mjs # latest
46
+ node scripts/dev-upgrade.mjs 1.0.5 --dry-run # preview the plan first
47
+ ```
117
48
 
118
49
  ---
119
50
 
120
- ## Slash commands
51
+ ## Companion plugins
121
52
 
122
- | Command | What it does |
123
- |---|---|
124
- | `/model` | Two-stage provider/model picker + thinking level; `f` favorite, `h` hide, `/` filter (persisted). |
125
- | `/think` | Reasoning-effort picker (`Off`/`High`/`Max`). |
126
- | `/session` | Read-only info: id, cwd, model, token usage, event count. |
127
- | `/resume` | Pick a persisted session (newest first), validate its log, restore it. |
128
- | `/new` | Detach the current session; the next prompt opens a fresh one. |
129
- | `/btw` | By-the-way side question while the main task runs — one tool-less model call over a recent-conversation snapshot, streamed into a temporary overlay. Never kept in the session; idle main line refuses it; `--model provider/model` overrides the route; bare `/btw` reopens the last answer (`DSH_TUI_BTW_CONTEXT_MESSAGES` sizes the snapshot). |
130
- | `/settings` | Text-based settings browser (namespaces, schema walk, secrets masked). |
131
- | `/export` | Write the current session log as JSONL. |
132
- | `/permission` | Permission-preset picker (read-only / workspace-write / danger-full-access). |
133
- | `/theme` | Color-scheme picker (`auto`/`light`/`dark`), applies immediately. |
134
- | `/preset` | Agent-preset picker; `<name>` switches directly, `next` cycles (same as `Tab`). |
135
- | `/profile-switch` | Apply a model profile to the live selection, the persisted default and the agent files; `p` pins the cwd. |
136
- | `/profile-cfg` | Manage profiles: edit default model / think / per-agent models, `s` save current, `n` new, `r` rename, `d` delete. |
137
- | `/agents` | Manage agent markdown files + subagent limits (`maxAgents`, `maxRounds`). |
138
- | `/subagents` | Pick a running/recent subagent and watch its live transcript; `Enter` steers it. |
139
- | `/skills` | Manage user skills (installed and available). |
140
- | `/reload` | Hot-reload the plugin from source after `pnpm build`. |
141
- | `/login` | Log in to a provider (or `/login openai`); **Custom provider…** adds any OpenAI/Anthropic-compatible gateway. |
142
- | `/logout` | Remove a provider's stored key and profile. |
143
- | `/hotkeys` | Keybinding browser and live editor. |
144
-
145
- Model-list auto-sync for hand-declared (baseURL) providers is no longer a
146
- built-in command: the separate `@aiwayds/dsh-model-sync` plugin (a default
147
- dependency of this package) keeps those routes' model lists up to date on its
148
- own schedule.
149
-
150
- Anything else falls through to the model as an ordinary prompt; dsh-native commands (`plan`, `compact`, `feedback`, `goal`, …) work unchanged.
53
+ - [@aiwayds/dsh-ask-router](https://www.npmjs.com/package/@aiwayds/dsh-ask-router) ships as a default dependency; fans every `ask_user_question` out to all answering surfaces (TUI panel, Feishu card) and the first answer wins. List it in the profile's `bundles` before the UI bundles to activate.
54
+ - [@aiwayds/dsh-feishu](https://github.com/fan56/dsh-feishu) — optional; drives the same dsh session from Feishu/Lark on your phone ([demo](docs/features/feishu-demo.md)).
55
+ - [@aiwayds/dsh-mcp-adapter](https://github.com/fan56/dsh-mcp-adapter) optional; folds MCP tool schemas out of every prompt and adds the `/mcp` command ([demo](docs/features/mcp-adapter.md)).
151
56
 
152
57
  ---
153
58
 
@@ -189,31 +94,6 @@ Other knobs: `dsh-tui.panelHeight` (think/tool panel height), `dsh-tui.iconSet`
189
94
 
190
95
  ---
191
96
 
192
- ## Install and launch
193
-
194
- ```sh
195
- dsh plugin --profile tui add @aiwayds/dsh-tui-pi
196
- dsh plugin --profile tui add @aiwayds/dsh-subagent-registry # optional
197
- dsh plugin --profile tui add @aiwayds/dsh-dcp # optional
198
- dsh --profile tui # launch (or: dsh-tui-pi)
199
- ```
200
-
201
- Everything that used to need manual patching — the canvas background, the `@deepseek-ai` module closure, the compaction backend — now happens automatically. Upgrade an existing profile after a release:
202
-
203
- ```sh
204
- node scripts/dev-upgrade.mjs # latest
205
- node scripts/dev-upgrade.mjs 1.0.5 --dry-run # preview the plan first
206
- ```
207
-
208
- ---
209
-
210
- ## Companion plugins
211
-
212
- - [@aiwayds/dsh-ask-router](https://www.npmjs.com/package/@aiwayds/dsh-ask-router) — ships as a default dependency; fans every `ask_user_question` out to all answering surfaces (TUI panel, Feishu card) and the first answer wins. List it in the profile's `bundles` before the UI bundles to activate.
213
- - [@aiwayds/dsh-feishu](https://github.com/fan56/dsh-feishu) — optional; drives the same dsh session from Feishu/Lark on your phone, including an ask-user card surface. Install into the same profile for phone-side participation.
214
-
215
- ---
216
-
217
97
  ## Development
218
98
 
219
99
  ```sh
@@ -228,6 +108,7 @@ pnpm test # unit tests, node --test against lib/ (pretest builds; 1020 tests
228
108
 
229
109
  ## Documentation
230
110
 
111
+ - [docs/features/](docs/features/) — one doc per feature, with demo videos.
231
112
  - [ARCHITECTURE.md](ARCHITECTURE.md) — full design: process model, layers, data flow.
232
113
  - [HANDOFF.md](HANDOFF.md) — session history and current state (Chinese).
233
114
  - [CHANGELOG.md](CHANGELOG.md) — release history.
@@ -238,4 +119,4 @@ pnpm test # unit tests, node --test against lib/ (pretest builds; 1020 tests
238
119
 
239
120
  ## Credits
240
121
 
241
- The [Ask User Question](#ask-user-question) interaction is inspired by [juicesharp/rpiv-ask-user-question](https://github.com/juicesharp/rpiv-ask-user-question) (adapted to this TUI's docked-panel and dsh `userQuestions` provider architecture; all code here is original).
122
+ The [Ask User Question](docs/features/ask-user-question.md) interaction is inspired by [juicesharp/rpiv-ask-user-question](https://github.com/juicesharp/rpiv-ask-user-question) (adapted to this TUI's docked-panel and dsh `userQuestions` provider architecture; all code here is original).
package/README.zh-CN.md CHANGED
@@ -12,131 +12,47 @@ https://github.com/user-attachments/assets/6a7e00bb-1fd0-4bc5-9070-457f1e9fa54d
12
12
 
13
13
  ## ✨ 功能亮点
14
14
 
15
- > 每一项都链接到下文对应小节——一句话讲清楚它能给你什么。
16
-
17
- - [**Footer——会话实时总览**](#footer-状态栏) — provider/model、上下文压力与会话缓存命中率一眼看清,始终在视线内。
18
- - [**Think 与 Tool 面板**](#think-与-tool-面板) — 推理和工具活动不进对话记录,对话读起来干净清爽。
19
- - [**Subagents 子代理**](#subagents-子代理) — 每个运行中的 subagent 都有一行状态;实时观看并操控它。
20
- - [**Ask User Question**](#ask-user-question-向用户提问) — 模型可以暂停下来向你提结构化问题,无需离开 TUI 即可作答。
21
- - [**飞书集成演示**](#飞书集成演示) — 桌面上的 dsh-tui-pi 与手机上的飞书/Lark 驱动(并代答)同一个 dsh session。
22
- - [**Dynamic context pruning (DCP)**](#dynamic-context-pruning-dcp) — 上下文自动保持在限制内,零 LLM 调用。
23
- - [**Persistent context 持久上下文**](#persistent-context-持久上下文) — 你的基本规则随每次请求生效,热应用无需重启。
24
- - [**模型 profile 与收藏**](#模型-profile-与收藏) — 按项目整体切换一套模型配置,并让选择器保持精简。
25
- - [**Sessions 会话与恢复**](#sessions-会话与恢复) — 会话自动保持整洁,几次按键即可恢复。
26
- - [**Themes 主题**](#themes-主题) — GitHub 明/暗配色,热切换;`auto` 跟随你的终端。
15
+ > 每一项对应 [`docs/features/`](docs/features/) 下的一篇独立文档(英文),内附演示视频。
27
16
 
28
- ---
29
-
30
- ## Footer 状态栏
31
-
32
- 一个 session 所有关键数字——provider/model 路由、推理等级、上下文占用、消息与工具计数,外加实时时钟——都收在钉于屏幕底部的同一条 powerline 状态栏里,编辑器顶部边框则显示你的工作目录和 git 分支。不用离开终端,就能看到成本压力(context %、cache-hit %)和实时活动。
33
-
34
- ```
35
- dsh ▸ volc-ark-plan deepseek-v4-flash ▸ high ▸ 48.7k/1.0M(4.6%) ⚡ CH85.4% ▸ 15 msgs ▸ 11 tools 00:02:13
36
- ```
37
-
38
- **Cache-hit(`CHxx%`)** 是会话的缓存命中率——会话全部计费输入流量中由 prompt 缓存供给的占比。它按整个 session 累计(切换 provider/model 不会重置),并且只有会话实际计费过缓存 token 后才会显示。(布局见 [ARCHITECTURE.md](ARCHITECTURE.md)。)
39
-
40
- ---
41
-
42
- ## Think 与 Tool 面板
43
-
44
- 实时推理和工具调用渲染为**钉在聊天输入框上方**的固定面板,而不是滚进对话记录,因此对话线程始终可读。面板只在有活动时才出现,高度可配置(`dsh-tui.panelHeight`:`1` 行,`5`/`7`/`10` 行带边框,或 `all`)。
45
-
46
- ---
47
-
48
- ## Subagents 子代理
49
-
50
- 运行中的 subagent 以紧凑的单行状态显示在编辑器下方——名称、上下文占用、rounds、已耗时——不用打开任何东西就能看到委派情况。`Ctrl+G`(或 `/subagents`)打开实时 transcript 查看器;在查看器内按 `Enter` 即可给子代理发消息 steer。`● Todos` 面板把你的任务树钉在输入框上方。上限(`maxAgents`、`maxRounds`,经 `/agents` → `l` 配置)防止委派失控。
17
+ - [**Footer 状态栏**](docs/features/footer.md) —— provider/model、上下文压力、会话缓存命中率,始终在视野里。
18
+ - [**Think 与 Tool 面板**](docs/features/think-tool-panels.md) —— 推理与工具活动不进 transcript,对话保持干净。
19
+ - [**Subagents 子代理**](docs/features/subagents.md) —— 每个运行中的子代理一行状态;实时观看并 steer。
20
+ - [**Ask User Question 向用户提问**](docs/features/ask-user-question.md) —— 模型可暂停并提问结构化问题,不用离开 TUI。
21
+ - [**飞书集成**](docs/features/feishu-demo.md) —— 桌面端 dsh-tui-pi + 手机端飞书/Lark 驱动同一个 dsh session。
22
+ - [**动态上下文修剪(DCP)**](docs/features/dcp.md) —— 上下文自动保持在窗口内,零 LLM 调用。
23
+ - [**持久上下文**](docs/features/persistent-context.md) —— 你的基本规则随每个请求生效,热应用无需重启。
24
+ - [**模型 profile 与收藏**](docs/features/model-profiles.md) —— 按项目切换整套模型配置,选择器保持精简。
25
+ - [**Sessions 会话与恢复**](docs/features/sessions-resume.md) —— 会话自动保持整洁、几次按键恢复;跨进程写者守卫保证日志单写者。
26
+ - [**Themes 主题**](docs/features/themes.md) —— GitHub 明/暗配色热切换;`auto` 跟随终端。
27
+ - [**搜索、选择与图片**](docs/features/search-selection-images.md) —— `Ctrl+Shift+F` 全文搜索、划选复制到系统剪贴板、web/飞书附件内联渲染、LaTeX Unicode 数学。
28
+ - [**斜杠命令**](docs/features/slash-commands.md) —— `/model`、`/resume`、`/btw`、`/profile-switch`……外加全部 dsh 原生命令。
29
+ - [**启动插件树**](docs/features/startup-tree.md) —— 启动即打印每个 profile 插件及其安装的 npm 版本。
51
30
 
52
31
  ---
53
32
 
54
- ## Ask User Question 向用户提问
55
-
56
- 模型在一轮回答进行到一半时可以暂停,通过 `ask_user_question` 工具向你提结构化问题;应答侧是停靠在输入框上方的面板——不用来回切换窗口。一次一个问题,其余收进标签页;`Ctrl+T` 把面板折叠起来,双击 `Esc` 拒绝作答。自由文本、多选、多问题确认页、bracket-paste,以及右键 / `Ctrl+Shift+C` 从系统剪贴板粘贴,全都支持。
57
-
58
- 看看 ask-question 流程的实际效果:
59
-
60
- https://github.com/user-attachments/assets/aa36be36-a508-4f53-ba85-efe0394dab11
61
-
62
- ---
63
-
64
- ## 飞书集成演示
65
-
66
- 桌面上的 dsh-tui-pi 与手机上的飞书/Lark 驱动(并代答)同一个 dsh session:
67
-
68
- https://github.com/user-attachments/assets/177e8839-523b-487e-b3d1-6d725cd8aba5
69
-
70
- https://github.com/user-attachments/assets/c0d7092f-deda-4443-b75a-2bc93bd30d86
71
-
72
- 演示来自 [dsh-feishu Demos issue](https://github.com/fan56/dsh-feishu/issues/1)。
73
-
74
- ---
75
-
76
- ## Dynamic context pruning (DCP)
77
-
78
- 上下文自动保持在模型窗口内:[dsh-dcp](https://github.com/fan56/dsh-dcp) 压缩 session **无需调用 LLM 做摘要**。挂载一次即透明运行——footer 的 context 段随压缩回落;在 subagent 内部,每次提交的压缩都会在查看器中以 `🧹` 提示显示。
33
+ ## 安装与启用
79
34
 
80
35
  ```sh
81
- dsh plugin --profile tui add @aiwayds/dsh-dcp
36
+ dsh plugin --profile tui add @aiwayds/dsh-tui-pi
37
+ dsh plugin --profile tui add @aiwayds/dsh-subagent-registry # optional
38
+ dsh plugin --profile tui add @aiwayds/dsh-dcp # optional
39
+ dsh --profile tui # 启动(或:dsh-tui-pi)
82
40
  ```
83
41
 
84
- ---
85
-
86
- ## Persistent context 持久上下文
87
-
88
- `$DSH_HOME/APPEND_SYSTEM.md`(默认 `~/.dsh/APPEND_SYSTEM.md`,pi 约定)会追加到**主 agent** 的 system prompt 末尾并热应用——编辑文件后下一条请求就能看到,无需重启。TUI 首次运行时从模板播种该文件,幂等维护其带标记的 todo-lifecycle 段,并且绝不覆盖你的内容。子代理被刻意排除在外。
89
-
90
- ---
91
-
92
- ## 模型 profile 与收藏
93
-
94
- `/profile-switch` 一次选择切换整套配置——默认模型、推理等级、以及每个 subagent 的模型;`p` 把某个 profile 钉到当前目录,该目录树下的每个新 session 都会加载它。`/model` 的收藏与隐藏列表让选择器保持精简。用 `/profile-cfg` 管理 profile(名录、编辑、保存当前、重命名、删除)。
95
-
96
- ---
97
-
98
- ## Sessions 会话与恢复
99
-
100
- `/resume` 用几次按键恢复任意最近的 session(按最后更新排序),`/new` 开启新会话,`/export` 把会话日志写成 JSONL(`~/Downloads/dsh-session-<id>.jsonl`)。启动清理器(`dsh-tui.retention.*`)修剪旧的会话日志,存储不会无界增长;resume 选择器只显示工作集(`dsh-tui.resume.*`)。两者都可在 `~/.dsh/settings.yaml` 配置,并带环境变量覆盖。
101
-
102
- ---
103
-
104
- ## Themes 主题
42
+ 过去需要手工 patch 的一切——画布背景、`@deepseek-ai` 模块闭包、compaction 后端——现在都自动完成。发版后升级现有 profile:
105
43
 
106
- GitHub 明/暗配色,`/theme` 热切换;`auto` 检测你的终端并跟随实时的明/暗切换。`DSH_TUI_THEME=light|dark` 钉选一套配色,`DSH_TUI_TRANSPARENT=1` 让画布透出终端背景,`DSH_TUI_MOUSE=buttons|all|off` 调节鼠标追踪。
44
+ ```sh
45
+ node scripts/dev-upgrade.mjs # 最新版
46
+ node scripts/dev-upgrade.mjs 1.0.5 --dry-run # 先预览执行计划
47
+ ```
107
48
 
108
49
  ---
109
50
 
110
- ## 斜杠命令
51
+ ## Companion plugins 伴生插件
111
52
 
112
- | 命令 | 功能 |
113
- |---|---|
114
- | `/model` | 两阶段 provider/model 选择器 + 推理等级;`f` 收藏、`h` 隐藏、`/` 过滤(持久化)。 |
115
- | `/think` | 推理强度选择器(`Off`/`High`/`Max`)。 |
116
- | `/session` | 只读信息:id、cwd、model、token 用量、事件数。 |
117
- | `/resume` | 选择持久化的 session(新的在前),校验日志后恢复。 |
118
- | `/new` | 分离当前 session;下一条 prompt 开启新会话。 |
119
- | `/btw` | 主线任务运行中的「顺带一问」——一次无工具的单次模型调用(带最近对话快照),答案流式呈现在临时浮层里。不进会话记录;主线空闲时拒绝使用;`--model provider/model` 临时换路由;空参 `/btw` 回看上一条问答(`DSH_TUI_BTW_CONTEXT_MESSAGES` 控制快照条数)。 |
120
- | `/settings` | 文本式设置浏览器(命名空间、schema 遍历、密钥脱敏)。 |
121
- | `/export` | 把当前会话日志写成 JSONL。 |
122
- | `/permission` | 权限预设选择器(read-only / workspace-write / danger-full-access)。 |
123
- | `/theme` | 配色选择器(`auto`/`light`/`dark`),立即生效。 |
124
- | `/preset` | agent preset 选择器;`<name>` 直接切换,`next` 循环(同 `Tab`)。 |
125
- | `/profile-switch` | 把模型 profile 应用到当前选择、持久化默认值和 agent 文件;`p` 钉住当前目录。 |
126
- | `/profile-cfg` | 管理 profile:编辑默认模型 / think / 各 agent 模型,`s` 保存当前,`n` 新建,`r` 重命名,`d` 删除。 |
127
- | `/agents` | 管理 agent markdown 文件 + subagent 上限(`maxAgents`、`maxRounds`)。 |
128
- | `/subagents` | 选择运行中/最近的 subagent 并观看其实时 transcript;`Enter` steer。 |
129
- | `/skills` | 管理用户 skills(已安装与可用)。 |
130
- | `/reload` | `pnpm build` 后从源码热重载插件。 |
131
- | `/login` | 登录 provider(或 `/login openai`);**Custom provider…** 添加任意 OpenAI/Anthropic 兼容网关。 |
132
- | `/logout` | 删除 provider 的已存 key 与 profile。 |
133
- | `/hotkeys` | 快捷键浏览器与实时编辑器。 |
134
-
135
- 手工声明(baseURL)provider 的模型列表自动同步不再是内置命令:由独立的
136
- `@aiwayds/dsh-model-sync` 插件(本包的默认依赖)按自己的节奏保持这些路由的
137
- 模型列表最新。
138
-
139
- 其余内容作为普通 prompt 落给模型;dsh 原生命令(`plan`、`compact`、`feedback`、`goal`……)原样可用。
53
+ - [@aiwayds/dsh-ask-router](https://www.npmjs.com/package/@aiwayds/dsh-ask-router) —— 作为默认依赖附带;把每个 `ask_user_question` 扇出到所有应答面(TUI 面板、飞书卡片),第一个答案获胜。把它加进 profile 的 `bundles`,放在任何 UI bundle 之前即可激活。
54
+ - [@aiwayds/dsh-feishu](https://github.com/fan56/dsh-feishu) —— 可选;用手机上的飞书/Lark 驱动同一个 dsh session([演示](docs/features/feishu-demo.md))。
55
+ - [@aiwayds/dsh-mcp-adapter](https://github.com/fan56/dsh-mcp-adapter) —— 可选;把 MCP 工具 schema 折出每个请求,并提供 `/mcp` 命令([演示](docs/features/mcp-adapter.md))。
140
56
 
141
57
  ---
142
58
 
@@ -151,6 +67,7 @@ GitHub 明/暗配色,`/theme` 热切换;`auto` 检测你的终端并跟随
151
67
  | `Ctrl+L` | 打开 model/think 选择器 |
152
68
  | `Ctrl+G` | 打开 subagent 选择器(查看器内 `Enter` 打开 steer) |
153
69
  | `Ctrl+O` | 待发消息队列(`s` 立即 steer · `d` 移除) |
70
+ | `Ctrl+Shift+F` | 全文搜索(`Enter`/`Ctrl+G` 下一个 · `Shift+Enter`/`Ctrl+Shift+G` 上一个 · `Esc` 关闭) |
154
71
  | `Tab` | 循环切换 agent preset |
155
72
  | `↑` / `↓` | 浏览已提交消息历史 |
156
73
 
@@ -177,31 +94,6 @@ dsh-tui:
177
94
 
178
95
  ---
179
96
 
180
- ## 安装与启用
181
-
182
- ```sh
183
- dsh plugin --profile tui add @aiwayds/dsh-tui-pi
184
- dsh plugin --profile tui add @aiwayds/dsh-subagent-registry # optional
185
- dsh plugin --profile tui add @aiwayds/dsh-dcp # optional
186
- dsh --profile tui # 启动(或:dsh-tui-pi)
187
- ```
188
-
189
- 过去需要手工 patch 的一切——画布背景、`@deepseek-ai` 模块闭包、compaction 后端——现在都自动完成。发版后升级现有 profile:
190
-
191
- ```sh
192
- node scripts/dev-upgrade.mjs # 最新版
193
- node scripts/dev-upgrade.mjs 1.0.4 --dry-run # 先预览执行计划
194
- ```
195
-
196
- ---
197
-
198
- ## Companion plugins 伴生插件
199
-
200
- - [@aiwayds/dsh-ask-router](https://www.npmjs.com/package/@aiwayds/dsh-ask-router) —— 作为默认依赖附带;把每个 `ask_user_question` 扇出到所有应答面(TUI 面板、飞书卡片),第一个答案获胜。把它加进 profile 的 `bundles`,放在任何 UI bundle 之前即可激活。
201
- - [@aiwayds/dsh-feishu](https://github.com/fan56/dsh-feishu) —— 可选;用手机上的飞书/Lark 驱动同一个 dsh session,包括 ask-user 卡片面。想手机侧参与就装进同一个 profile。
202
-
203
- ---
204
-
205
97
  ## 开发
206
98
 
207
99
  ```sh
@@ -216,6 +108,7 @@ pnpm test # 单元测试,node --test 对 lib/ 执行(pretest 构建;55
216
108
 
217
109
  ## 文档索引
218
110
 
111
+ - [docs/features/](docs/features/) —— 每个功能一篇独立文档,附演示视频(英文)。
219
112
  - [ARCHITECTURE.md](ARCHITECTURE.md) —— 完整设计:进程模型、分层、数据流。
220
113
  - [HANDOFF.md](HANDOFF.md) —— 会话历史与当前状态(中文)。
221
114
  - [CHANGELOG.md](CHANGELOG.md) —— 发布历史。
@@ -226,4 +119,4 @@ pnpm test # 单元测试,node --test 对 lib/ 执行(pretest 构建;55
226
119
 
227
120
  ## 致谢
228
121
 
229
- [Ask User Question](#ask-user-question-向用户提问) 交互的灵感来自 [juicesharp/rpiv-ask-user-question](https://github.com/juicesharp/rpiv-ask-user-question)(改编自本 TUI 的停靠面板与 dsh `userQuestions` provider 架构;这里的全部代码均为原创)。
122
+ [Ask User Question](docs/features/ask-user-question.md) 交互的灵感来自 [juicesharp/rpiv-ask-user-question](https://github.com/juicesharp/rpiv-ask-user-question)(改编自本 TUI 的停靠面板与 dsh `userQuestions` provider 架构;这里的全部代码均为原创)。
Binary file
package/cordis.patch.yml CHANGED
@@ -14,20 +14,9 @@
14
14
  # the bundle to be wired into the model-facing tool catalog. Without this
15
15
  # insert, the `ask_user_question` tool never registers with the model and
16
16
  # the user-questions seam has no visible surface in this profile.
17
- #
18
- # dsh-model-sync is mounted here: it is a default dependency of this package
19
- # and handles the automatic sync of the built-in routes' model lists — no TUI
20
- # command involved. It ships its own bundle patch
21
- # (@aiwayds/dsh-model-sync/cordis.patch.yml); the dependency only puts its
22
- # package in the profile's node_modules so the patch has something to mount.
23
- # Do NOT also list @aiwayds/dsh-model-sync in a profile's bundles: mounting
24
- # it here too would duplicate the entry id and crash the loader — remove it
25
- # from the profile's bundles instead.
26
17
 
27
18
  - insert:
28
19
  - id: tui-pi
29
20
  name: '@aiwayds/dsh-tui-pi'
30
21
  - id: tool-ask-user
31
22
  name: '@deepseek-ai/dsh-tool-ask-user'
32
- - id: dsh-model-sync
33
- name: '@aiwayds/dsh-model-sync'
package/lib/index.js CHANGED
@@ -953,17 +953,17 @@ export function apply(ctx) {
953
953
  }), 'dsh-tui-pi: /preset');
954
954
  // /profile-switch + /profile-cfg: user model profiles — named snapshots
955
955
  // of the whole model configuration (default model + think level, every
956
- // subagent's model/thinking) that switch in one step between contexts
957
- // like work and personal. `/profile-switch` applies one;
958
- // `/profile-cfg` configures them (edit fields, save current, rename,
959
- // review). Storage lives at $DSH_HOME/model-profiles.json, agent
960
- // overrides in ~/.dsh/agents/*.md.
956
+ // subagent's model/thinking). Switching is WORKSPACE-SCOPED: Enter
957
+ // applies the profile to the live session + agent markdown and binds the
958
+ // current directory tree (.dsh-profile) so NEW sessions here start on
959
+ // it other trees keep their own binding, or the global default.
960
+ // Storage lives at $DSH_HOME/model-profiles.json.
961
961
  const profileDeps = {
962
962
  getSelection: () => bridge.getSelection(),
963
963
  setSelection: selection => bridge.setSelection(selection),
964
964
  };
965
965
  const profileHandler = async () => {
966
- const summary = await openProfileSwitcher(ctx, ui.tui, ui.theme, profileDeps, refocusEditor);
966
+ const summary = await openProfileSwitcher(ui.tui, ui.theme, profileDeps, refocusEditor);
967
967
  ui.requestRender();
968
968
  return summary === undefined
969
969
  ? { kind: 'success', text: 'Profile unchanged.' }
@@ -972,7 +972,7 @@ export function apply(ctx) {
972
972
  commands.registerLocal('profile-switch', profileHandler);
973
973
  ctx.effect(() => ctx.commands.register({
974
974
  name: 'profile-switch',
975
- description: 'Switch the model profile (default model, subagent models, think levels)',
975
+ description: 'Switch the model profile for this workspace (default model, subagent models, think levels)',
976
976
  handler: invocation => profileHandler(invocation.rawInput, invocation.signal),
977
977
  }), 'dsh-tui-pi: /profile-switch');
978
978
  const profilesHandler = async (rawInput) => {