@xmoon76/dsh-pi-tui 0.3.6 → 0.4.0-alpha.2

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.en.md CHANGED
@@ -10,12 +10,24 @@ A Pi-style terminal frontend for [DeepSeek Harness](https://github.com/deepseek-
10
10
  `dsh-pi-tui` is installed as an independent dsh bundle inside a profile. It provides terminal interaction for streaming conversations, tool calls, session management, subagents, history search, shell commands, approvals, and settings. Models, tools, Sessions, permissions, Skills, Plan, Goal, and Subagent runtime behavior are still provided by DeepSeek Harness.
11
11
 
12
12
  ```sh
13
- dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui
13
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@next
14
14
  dsh --profile pi-tui
15
15
  ```
16
16
 
17
17
  ![dsh-pi-tui](docs/dsh-pi-tui.png)
18
18
 
19
+ ## DSH compatibility and source validation
20
+
21
+ The published package declares the lower-bound-only DSH peer contract `>=0.1.2-alpha.4`. Source validation does not change that contract or vendor DSH into this repository.
22
+
23
+ When the target DSH version is not yet available from npm, validate against the official checkout pinned by commit SHA:
24
+
25
+ ```sh
26
+ pnpm compat:dsh:source -- --dsh-dir "$HOME/project/deepseek-harness"
27
+ ```
28
+
29
+ CI uses Source Mode for `next` and npm Mode for `main` and every tag. The source lane validates the complete official DSH tarball family, TUI presets, and the old-runtime boundary; the published `pi2dsh` ecosystem check is explicitly marked skipped until a compatible published combination exists. See [`docs/dsh-compatibility.md`](docs/dsh-compatibility.md) for the full workflow.
30
+
19
31
  ## Features
20
32
 
21
33
  ### Conversation and tools
@@ -103,10 +115,17 @@ The browser distinguishes:
103
115
 
104
116
  Completed one-shot Subagents remain available for persisted Transcript inspection.
105
117
 
106
- A direct `continuable` Child can be opened in an interactive viewer and sent follow-up messages directly. The Child has its own Transcript, Draft, and runtime state, without modifying the main Session input.
118
+ A direct `continuable` Child can be opened in an interactive viewer and sent follow-up messages directly (through DSH's official `subagents.prompt()` human channel — queued in order as the Child's own next turn, with user provenance). The Child has its own Transcript, Draft, and runtime state, without modifying the main Session input.
107
119
 
108
120
  Deeper nested Subagents are read-only by default.
109
121
 
122
+ The official subagent model selection (the DSH `subagent-model-selection`
123
+ setting) can be toggled and its allowlist maintained in `/settings`: once
124
+ enabled, a NEW session's official `subagent` tool may pick the child
125
+ provider/model per call (bounded by the allowlist). The setting is sampled at
126
+ session composition and never rewrites the tools of an already-running
127
+ session.
128
+
110
129
  ### Shell
111
130
 
112
131
  The editor supports two Shell modes:
@@ -171,134 +190,25 @@ Slash Commands registered by other plugins through `ctx.commands` are discovered
171
190
 
172
191
  ### Footer customization
173
192
 
174
- The status line is a **composable surface** — no plugin or shell needed
175
- for the common cases.
176
-
177
- `/settings` → Status line (or the `footer` key in the `dsh-pi-tui`
178
- settings document) selects the preset:
179
-
180
- | Value | Meaning |
181
- |---|---|
182
- | `default` (legacy `full`) | the classic two-row footer (status + stats) |
183
- | `compact` | the status row only (stats line hidden) |
184
- | `custom` | a versioned `footerLayout` (see below) |
185
- | `command` | a user-configured command renders the status surface (see below) |
186
-
187
- The first three values are selectable in the `/settings` panel; `command`
188
- is NOT in the panel — it can only be enabled through the USER-layer
189
- settings document (`footer: "command"` + `footerCommand`). The `/settings`
190
- Status line row offers exactly `default / compact / custom`.
191
-
192
- `/footer` is a hierarchical interactive configurator: pick a row first
193
- (Row Selector), then edit that row's items — `↑/↓` walks every item of
194
- the row in order (Left/Right are visual grouping only), `←/→` moves an
195
- item across sides, `Space` removes it, `A` opens a searchable Add Picker
196
- (filtered by label / id / description, with the highlighted item's
197
- description below), `M` enters Move Mode to reorder, and `Enter` opens
198
- the Item Editor (Style candidates previewed with the item's real render;
199
- semantic tones; Advanced edits prefix / suffix / importance with a
200
- one-keystroke Reset). The preview is composed by the real footer engine
201
- and — with the contextual help — pinned to the top of the panel; it never
202
- scrolls away at any terminal size. `S` on the Row Selector saves
203
- (persisted); `Esc` walks back page by page and closes on the first page
204
- without touching the active layout. With dirty changes, `Esc` first offers
205
- Save & Exit, Discard & Exit, or Keep Editing; saving waits for the settings
206
- write to succeed. Usable before any session exists.
207
-
208
- The Add Picker also offers `+ Create Custom Text` for user-defined static text items. Their text, default semantic tone, display name, and deletion are editable; definitions are read and persisted only from the USER layer. The definition tone is separate from the placement Tone, and the item can otherwise be shown/hidden, moved, and reordered like any other footer item.
209
-
210
- `footerLayout` is a nested settings object (schemaVersion 1, 1–2 rows,
211
- left/right zones, a separator, finite formatters, semantic tones,
212
- prefix/suffix, importance). The `/footer` configurator builds it
213
- interactively; the YAML shape is:
193
+ `/footer` is the interactive Footer editor. You can combine builtin status items, change their side and order, choose a Style and Tone, edit Prefix/Suffix and Importance, and create your own Footer items.
214
194
 
215
- ```yaml
216
- footer: custom
217
- footerLayout:
218
- schemaVersion: 1
219
- rows:
220
- - left:
221
- - id: agent-preset
222
- format: compact
223
- - id: model
224
- - id: project
225
- - id: context
226
- format: full
227
- - id: cache-hit
228
- - id: token-usage
229
- format: io
230
- - id: performance
231
- format: speed
232
- - id: version
233
- format: tui
234
- right:
235
- - id: focus-mode
236
- separator:
237
- text: " │ "
238
- tone: textDim
239
- ```
195
+ Four item sources are supported:
240
196
 
241
- Builtin format choices are finite and use the existing `format` field (no
242
- second style schema): Model `badge` / `plain` / `compact`; Permission preset
243
- `badge` / `plain` / `compact`; Plan state `badge` / `plain`; Working directory
244
- `short` / `basename` / `full`; Git branch `plain` / `label`; Context `bar` /
245
- `percent` / `full`; Token usage `io` / `total` / `compact`; Cache hit `full` /
246
- `compact`; Performance `full` / `speed` / `latency` measures average time
247
- to first token; Turns/steps `both` / `turns` / `steps`; Version keeps `tui` / `dsh` /
248
- `both`. Omitting `format` continues to use each item's legacy default.
249
-
250
- Builtin item ids: `agent-preset`, `model`, `reasoning`,
251
- `permission-preset`, `sandbox-mode`, `approval-policy`, `plan-state`,
252
- `focus-mode`, `focused-seat`, `view-scope`, `cwd`, `project`,
253
- `git-branch`, `run-state`, `queue`, `tasks`, `agents`, `todo`,
254
- `context`, `cache-hit`, `token-usage`, `performance`, `turns-steps`,
255
- `stats-line`, `version`, `ext:*` (the legacy extension segments).
256
- An invalid `footerLayout` warns once and falls back to the default — the
257
- TUI always starts.
258
-
259
- `footer: command` hands the Status Surface to a user-configured command
260
- (Claude/Kimi style): the current status snapshot is serialized to JSON on
261
- the command's stdin (schemaVersion 1 — no secrets, no credentials, no
262
- prompts), and the command's stdout (sanitized: SGR colors and OSC 8
263
- hyperlinks only) renders the status surface. The Host's instruction
264
- surface (e.g. the Ctrl+C exit hint) always survives on top.
197
+ - **Builtin Item** — Model, Context, Token, Tasks, Git branch, and other built-in status facts;
198
+ - **Custom Text** — a user-created static text item;
199
+ - **Custom Command Item** — a user-created dynamic command output that can be composed with other items;
200
+ - **Extension Item** — a Footer item contributed by a plugin through the Stable Extension API.
265
201
 
266
- ```yaml
267
- footer: command
268
- footerCommand:
269
- schemaVersion: 1
270
- command: "~/.config/dsh/statusline.sh"
271
- timeoutMs: 300 # default 300, max 1000
272
- refreshIntervalMs: 1000 # min 1000
273
- maxRows: 1 # 1..2
274
- ```
202
+ On narrow terminals, builtins with compact forms shorten before lower-importance content is dropped. Runtime compaction never rewrites the Style you saved.
203
+
204
+ A `/footer` Custom Command Item is different from `footer: command`: the former is one dynamic item that can sit next to Model, Context, and other items; the latter hands the whole Footer status surface to one user command.
275
205
 
276
- **Security:** the command is executed ONLY when it lives in the USER
277
- layer of your settings document. A repository/project-supplied
278
- `footerCommand` is never executed — command mode is disabled and the
279
- native layout applies. The command refreshes periodically according to
280
- `refreshIntervalMs` and renders at most two rows; failures (empty output,
281
- non-zero exit, timeout) fall back to the native layout automatically.
282
-
283
- ### Extension footer items
284
-
285
- Plugins can contribute **configurable footer items** through the Stable
286
- extension API (`@xmoon76/dsh-pi-tui/extensions`): register a
287
- `FooterItemContribution` on the `chrome.footer.item` slot — a label and a
288
- plain-data `segment` (styled spans; the host strips any terminal control
289
- sequence, plugins never style the terminal). Users show/hide, reorder and
290
- zone-place the item in `/footer` exactly like a builtin item. Feature-detect
291
- the `slot.chrome.footer.item` capability before registering (it is
292
- advertised before any surface exists). The item's config identity is the
293
- canonical key `ext:<owner>/<id>` where the owner is the plugin's stable
294
- name — **stable across HMR**: a layout referencing an unloaded plugin's
295
- item keeps the reference and recovers automatically when the plugin
296
- reloads. An npm-scoped plugin name (`@scope/name`) is legal: its `/` is
297
- percent-encoded via `encodeURIComponent` in the key
298
- (`ext:%40scope%2Fname/<id>`); the id itself must
299
- not contain `/`. The legacy `chrome.footer.status` slot is unchanged: its
300
- segments aggregate into the single `ext:*` item. Full author guide:
301
- [docs/extension-api.md](docs/extension-api.md).
206
+ For the full `/footer` workflow, Custom Text / Command items, YAML reference, security model, and troubleshooting, see:
207
+
208
+ - [Footer customization guide](docs/footer-customization.md)
209
+ - [Extension API for plugin authors](docs/extension-api.md)
210
+
211
+ `/statusline` is an alias of `/footer`.
302
212
 
303
213
  ## Common keys
304
214
 
@@ -405,14 +315,55 @@ dsh-pi-tui:
405
315
  * DeepSeek Harness
406
316
  * Node.js `^22.19.0 || >=24`
407
317
 
408
- The project currently follows the DeepSeek Harness `0.1.1-rc.x` release line.
318
+ ### DSH/TUI version pairing (important)
319
+
320
+ | TUI package line | Matching DSH line | Notes |
321
+ |---|---|---|
322
+ | `0.4.x-alpha` (`@next`) | `>=0.1.2-alpha.4` | Current prerelease; each release validates its concrete DSH family |
323
+ | `0.4.0-alpha.2` (published) | `>=0.1.2-alpha.4` | Previous 0.4 prerelease; its releases validated the alpha.4/alpha.5 family |
324
+ | `0.4.0-alpha.1` (published) | `>=0.1.2-alpha.2` | Earlier 0.4 prerelease; accepts the alpha.2/alpha.3 runtime |
325
+ | `0.3.x` (`@0.3`) | `0.1.1-rc.2` | Legacy runtime line |
326
+
327
+ Do not mix the lines: DSH 0.1.1 is outside the 0.4 peer window and the
328
+ normal incompatible-runtime boundary will fail. The startup row prints upgrade
329
+ and rollback guidance when concurrent Loader ordering allows it, but that
330
+ friendly notice is best-effort rather than a startup-order guarantee. If you
331
+ keep DSH 0.1.1, use the 0.3 TUI line; if you keep the alpha.2/alpha.3
332
+ baseline, use `@xmoon76/dsh-pi-tui@0.4.0-alpha.1`. For the current 0.4
333
+ prerelease, install DSH first and then add the TUI to a profile:
334
+
335
+ ```sh
336
+ npm install -g @deepseek-ai/dsh@0.1.2-alpha.5
337
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@next
338
+ dsh --profile pi-tui
339
+ ```
340
+
341
+ If you need to keep the legacy DSH runtime:
342
+
343
+ ```sh
344
+ npm install -g @deepseek-ai/dsh@0.1.1-rc.2
345
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@0.3
346
+ dsh --profile pi-tui
347
+ ```
348
+
349
+ The current 0.4 line declares `>=0.1.2-alpha.4`; each release validates
350
+ its concrete DSH family. Running only `npm install -g @xmoon76/dsh-pi-tui` does
351
+ not install the plugin into a DSH profile; the `dsh plugin` command is still
352
+ required.
353
+
354
+ New agent sessions use the official roster's selected preset id. A custom DSH
355
+ preset literally named `code` is valid and remains `code` when it exists in the
356
+ current roster. Old persisted `code` defaults/session values fall back to `ptc`
357
+ only after the roster proves that no custom `code` preset exists.
409
358
 
410
359
  ### npm
411
360
 
412
- Using a dedicated `pi-tui` profile is recommended:
361
+ Using a dedicated `pi-tui` profile is recommended. Once a stable 0.4 release
362
+ exists, use the matching stable TUI channel (`@latest`); use `@next` for the
363
+ prerelease channel:
413
364
 
414
365
  ```sh
415
- dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui
366
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@next
416
367
  dsh --profile pi-tui
417
368
  ```
418
369
 
@@ -422,6 +373,15 @@ Resume an existing Session:
422
373
  dsh --profile pi-tui --session <session-id>
423
374
  ```
424
375
 
376
+ ### Source Mode (validation only)
377
+
378
+ Source Mode is only for `next` CI and local compatibility validation. It reads the full commit pin in `test/compat/dsh-source.json`, builds the official DSH tarball family, installs it through temporary pnpm overrides, and removes the temporary state afterward. Do not write DSH source paths, `file:` dependencies, or workspace symlinks into a published package.
379
+
380
+ ```sh
381
+ pnpm compat:dsh:source -- --dsh-dir "$HOME/project/deepseek-harness"
382
+ pnpm compat:dsh:npm
383
+ ```
384
+
425
385
  The published package already contains the Pi TUI fork required at runtime. No separate internal TUI package needs to be installed.
426
386
 
427
387
  ### Update
package/README.md CHANGED
@@ -10,12 +10,24 @@
10
10
  `dsh-pi-tui` 作为独立的 dsh bundle 安装到 profile 中,提供流式对话、工具调用、会话管理、Subagent、历史搜索、Shell、审批与设置等终端交互。模型、工具、Session、权限、Skills、Plan、Goal、Subagent 等运行时能力仍由 DeepSeek Harness 提供。
11
11
 
12
12
  ```sh
13
- dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui
13
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@next
14
14
  dsh --profile pi-tui
15
15
  ```
16
16
 
17
17
  ![dsh-pi-tui](docs/dsh-pi-tui.png)
18
18
 
19
+ ## DSH 兼容性与源码验证
20
+
21
+ 发布包通过 `package.json` peer contract 使用 DSH `>=0.1.2-alpha.4`;源码验证不会修改这个发布契约,也不会把 DSH vendor 进本仓库。
22
+
23
+ 当目标 DSH 版本尚未发布到 npm 时,可以用固定 commit 的官方源码包做本地验证:
24
+
25
+ ```sh
26
+ pnpm compat:dsh:source -- --dsh-dir "$HOME/project/deepseek-harness"
27
+ ```
28
+
29
+ CI 中 `next` 使用 Source Mode,`main` 和所有 tag 使用 npm Mode。源码 lane 会验证完整的官方 DSH tarball family、TUI 预设和旧 runtime 边界;依赖已发布 `pi2dsh` 的生态检查会明确标记为 skipped。详细流程见 [`docs/dsh-compatibility.md`](docs/dsh-compatibility.md)。
30
+
19
31
  ## 功能
20
32
 
21
33
  ### 对话与工具
@@ -82,7 +94,7 @@ Rewind 会从选中的历史 User Turn 创建新的 Child Session,并把对应
82
94
 
83
95
  ### Subagent 与后台任务
84
96
 
85
- `/tasks` 提供当前 Session 的任务浏览器。
97
+ `/tasks` 打开完整 Task Center(当前 Session 的所有后台工作);Footer 的 `↓` 直接打开轻量 Quick Tasks(只看正在运行的工作)。
86
98
 
87
99
  Subagent 按完整 lineage 显示,包括嵌套创建的 descendant:
88
100
 
@@ -101,12 +113,19 @@ main
101
113
  * nested descendant
102
114
  * 后台 Job
103
115
 
116
+ 两个视图共享同一份运行时状态:`A` 切换 Active / All scope,`Tab` 切换类型过滤,`/` 进入搜索,`S`(确认后)停止所选任务,`N` / `Shift+N` 在运行中的任务间跳转,Quick 内 `T` 或底部 "View all" 行进入完整 Task Center,`Esc` 逐层返回。
117
+
104
118
  已经结束的 one-shot Subagent 仍可以打开并查看持久化 Transcript。
105
119
 
106
- 对于当前 Session 的直接 `continuable` Child,可以进入交互式 Viewer,并直接向该 Subagent 发送后续消息。Child 使用自己的 Transcript、Draft 和运行状态,不会修改主 Session 的输入。
120
+ 对于当前 Session 的直接 `continuable` Child,可以进入交互式 Viewer,并直接向该 Subagent 发送后续消息(走 DSH 官方 `subagents.prompt()` 人类输入通道——按顺序排队为 Child 自己的下一个 turn,并保留 user 来源)。Child 使用自己的 Transcript、Draft 和运行状态,不会修改主 Session 的输入。
107
121
 
108
122
  更深层的 nested Subagent 默认以只读方式查看。
109
123
 
124
+ 官方 Subagent 模型选择(DSH `subagent-model-selection` 设置)可在 `/settings`
125
+ 中开关并维护 allowlist:开启后**新建** Session 的官方 `subagent` 工具可以按调用
126
+ 选择子 Agent 的 provider/model(受 allowlist 限制)。设置在 Session 组合时采样,
127
+ 不会改写已在运行的 Session 的工具。
128
+
110
129
  ### Shell
111
130
 
112
131
  编辑器支持两种 Shell 模式:
@@ -170,118 +189,25 @@ TUI 使用 DSH 提供的模型和设置服务。
170
189
 
171
190
  ### Footer 自定义
172
191
 
173
- 状态行是一个**可组合表面**——常见场景无需插件或 shell。
192
+ `/footer` 提供交互式 Footer 编辑器。你可以组合内置状态条目,调整左右位置、顺序、Style、Tone、Prefix/Suffix 和 Importance,也可以创建自己的 Footer 条目。
174
193
 
175
- `/settings` → Status line(或 `dsh-pi-tui` 设置文档中的 `footer` 键)
176
- 选择预设:
194
+ 支持四类条目:
177
195
 
178
- | 值 | 含义 |
179
- |---|---|
180
- | `default`(旧名 `full`) | 经典两行 Footer(状态 + 统计) |
181
- | `compact` | 仅状态行(隐藏统计行) |
182
- | `custom` | 版本化 `footerLayout`(见下) |
183
- | `command` | 用户配置的命令渲染状态表面(见下) |
196
+ - **Builtin Item**:Model、Context、Token、Tasks、Git branch 等内置状态;
197
+ - **Custom Text**:用户创建的固定文本;
198
+ - **Custom Command Item**:用户创建的动态命令输出,可和其他条目一起排列;
199
+ - **Extension Item**:插件通过 Stable Extension API 提供的 Footer 条目。
184
200
 
185
- 前三个值可在 `/settings` 面板选择;`command` **不在面板中**——它只能
186
- 通过 USER 层设置文档(`footer: "command"` + `footerCommand`)启用,
187
- `/settings` 的 Status line 行只有 `default / compact / custom` 三个选项。
201
+ 在窄终端中,支持 compact 的内置条目会先自动缩短;空间仍不足时再按 Importance 隐藏低优先级内容。运行时 compact 不会修改你保存的 Style。
188
202
 
189
- `/footer` 是层级式交互配置器:先选行(Row Selector),再编辑该行的
190
- 条目——`↑/↓` 在整行条目间顺序移动(Left/Right 只是视觉分组),
191
- `←/→` 左右换侧,`Space` 移除,`A` 打开可搜索的 Add Picker(按
192
- label / id / 描述过滤,选中项下方显示描述),`M` 进入 Move Mode
193
- 排序,`Enter` 打开 Item Editor(Style 候选以条目的真实渲染作示例;
194
- Tone 语义色;Advanced 编辑 prefix / suffix / importance 并可一键
195
- Reset)。预览由真实 Footer 引擎合成,与 contextual help 一起固定在
196
- 面板顶部,任何终端尺寸下都不会随列表滚动消失。Row Selector 页 `S`
197
- 保存(持久化),`Esc` 逐页返回、在首页关闭且不影响当前生效布局。存在未保存改动时,
198
- `Esc` 会先显示 Save & Exit、Discard & Exit 或 Keep Editing;保存会等待设置写入成功。
199
- 无会话时也可使用。
203
+ `/footer` 的 Custom Command Item 和 `footer: command` 是两种不同能力:前者只是一个可以与 Model、Context 等混排的动态条目;后者把整个 Footer 状态表面交给一个用户命令。
200
204
 
201
- Add Picker 的末尾还可以选择 `+ Create Custom Text`,创建用户自定义的静态文本条目。创建后可编辑文本、默认语义色、显示名称,也可以删除;条目定义只从 USER 层读取并持久化。定义 Tone 与布局中的放置 Tone 分开,条目仍可在 `/footer` 中显示/隐藏、移动和排序。
205
+ 完整的 `/footer` 使用方法、Custom Text / Command、YAML 配置、安全模型和排错说明见:
202
206
 
203
- `footerLayout` 是嵌套设置对象(schemaVersion 1,1–2 行,左/右区域,
204
- 分隔符,有限 formatter,语义 tone,prefix/suffix,importance)。
205
- `/footer` 配置器可交互地构建它;YAML 形状如下:
207
+ - [Footer 自定义完整指南](docs/footer-customization.md)
208
+ - [Extension API(插件作者)](docs/extension-api.md)
206
209
 
207
- ```yaml
208
- footer: custom
209
- footerLayout:
210
- schemaVersion: 1
211
- rows:
212
- - left:
213
- - id: agent-preset
214
- format: compact
215
- - id: model
216
- - id: project
217
- - id: context
218
- format: full
219
- - id: cache-hit
220
- - id: token-usage
221
- format: io
222
- - id: performance
223
- format: speed
224
- - id: version
225
- format: tui
226
- right:
227
- - id: focus-mode
228
- separator:
229
- text: " │ "
230
- tone: textDim
231
- ```
232
-
233
- 内置 format 是有限集合,继续使用现有的 `format` 字段(不新增第二套
234
- style schema):Model 为 `badge` / `plain` / `compact`;Permission preset
235
- 为 `badge` / `plain` / `compact`;Plan state 为 `badge` / `plain`;Working
236
- directory 为 `short` / `basename` / `full`;Git branch 为 `plain` / `label`;
237
- Context 为 `bar` / `percent` / `full`;Token usage 为 `io` / `total` /
238
- `compact`;Cache hit 为 `full` / `compact`;Performance 为 `full` / `speed` /
239
- `latency`(平均首 token 时间);Turns/steps 为 `both` / `turns` / `steps`;
240
- Version 保留 `tui` / `dsh` / `both`。省略 `format` 时仍使用各条目的旧默认值。
241
-
242
- 内置条目 id:`agent-preset`、`model`、`reasoning`、
243
- `permission-preset`、`sandbox-mode`、`approval-policy`、`plan-state`、
244
- `focus-mode`、`focused-seat`、`view-scope`、`cwd`、`project`、
245
- `git-branch`、`run-state`、`queue`、`tasks`、`agents`、`todo`、
246
- `context`、`cache-hit`、`token-usage`、`performance`、`turns-steps`、
247
- `stats-line`、`version`、`ext:*`(旧扩展段)。非法的 `footerLayout`
248
- 会警告一次并回退到默认布局——TUI 始终能启动。
249
-
250
- `footer: command` 把状态表面交给用户配置的命令(Claude/Kimi 风格):
251
- 当前状态快照以 JSON 序列化到命令的 stdin(schemaVersion 1——不含
252
- secret、凭据、提示词),命令的 stdout(经过净化:仅保留 SGR 颜色与
253
- OSC 8 超链接)渲染状态表面。Host 的指令表面(如 Ctrl+C 退出提示)
254
- 始终叠加在最上层。
255
-
256
- ```yaml
257
- footer: command
258
- footerCommand:
259
- schemaVersion: 1
260
- command: "~/.config/dsh/statusline.sh"
261
- timeoutMs: 300 # 默认 300,最大 1000
262
- refreshIntervalMs: 1000 # 最小 1000
263
- maxRows: 1 # 1..2
264
- ```
265
-
266
- **安全:** 只有当命令位于你的设置文档的 USER 层时才会被执行。
267
- 仓库/项目提供的 `footerCommand` 永远不会被执行——命令模式被禁用并
268
- 回退到原生布局。命令按 `refreshIntervalMs` 周期刷新,每次最多输出 2 行;失败(空输出、非零退出、超时)自动回退到原生布局。
269
-
270
- ### 扩展 Footer 条目
271
-
272
- 插件可以通过 Stable 扩展 API(`@xmoon76/dsh-pi-tui/extensions`)贡献
273
- **可配置的 Footer 条目**:在 `chrome.footer.item` 槽位注册一个
274
- `FooterItemContribution`——包含 label 与纯数据 `segment`(带样式的
275
- span;Host 会剥离任何终端控制序列,插件永远不能直接给终端上样式)。
276
- 用户可在 `/footer` 中像内置条目一样开关、排序、左右放置。注册前请
277
- 先 feature-detect `slot.chrome.footer.item` 能力(该能力在任何 surface
278
- 存在之前就已声明)。条目的配置身份是规范键 `ext:<owner>/<id>`,其中
279
- owner 是插件的稳定名称——**跨 HMR 稳定**:引用已卸载插件条目的布局
280
- 保留引用,插件重载后自动恢复。npm scoped 插件名(`@scope/name`)合法:
281
- 其 `/` 在键中按 `encodeURIComponent` 百分号编码(`ext:%40scope%2Fname/<id>`);
282
- id 本身不得包含 `/`。旧的 `chrome.footer.status` 槽位不变:
283
- 其 segment 聚合为单一的 `ext:*` 条目。完整作者指南:
284
- [docs/extension-api.md](docs/extension-api.md)。
210
+ `/statusline` 是 `/footer` 的别名。
285
211
 
286
212
  ## 常用按键
287
213
 
@@ -378,14 +304,52 @@ dsh-pi-tui:
378
304
  * DeepSeek Harness
379
305
  * Node.js `^22.19.0 || >=24`
380
306
 
381
- 项目当前跟随 DeepSeek Harness `0.1.1-rc.x` 版本线开发。
307
+ ### DSH 与 TUI 版本对应(重要)
308
+
309
+ | TUI 包版本 | 对应 DSH 版本 | 说明 |
310
+ |---|---|---|
311
+ | `0.4.x-alpha`(`@next`) | `>=0.1.2-alpha.4` | 当前预发布线;按每个发布版本的具体 DSH family 验证 |
312
+ | `0.4.0-alpha.2`(已发布) | `>=0.1.2-alpha.4` | 上一条 0.4 预发布线;其发布版本按 alpha.4/alpha.5 family 验证 |
313
+ | `0.4.0-alpha.1`(已发布) | `>=0.1.2-alpha.2` | 更早的 0.4 预发布线;接受 alpha.2/alpha.3 运行时 |
314
+ | `0.3.x`(`@0.3`) | `0.1.1-rc.2` | 旧运行时兼容线 |
315
+
316
+ 不要把两条线混装:DSH 0.1.1 不在 0.4 的 peer 支持范围内,运行时会在
317
+ 正常的不兼容边界以非零状态失败。启动行会在 Loader 并发挂载顺序允许时打印
318
+ 升级和回退提示,但该友好提示是 best-effort,不是启动顺序保证;保留 DSH
319
+ 0.1.1 时请使用 0.3,保留 alpha.2/alpha.3 时请使用
320
+ `@xmoon76/dsh-pi-tui@0.4.0-alpha.1`。当前 0.4 预发布线的推荐安装顺序如下
321
+ (先装 DSH,再把 TUI 装入 profile):
322
+
323
+ ```sh
324
+ npm install -g @deepseek-ai/dsh@0.1.2-alpha.5
325
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@next
326
+ dsh --profile pi-tui
327
+ ```
328
+
329
+ 如果需要保留旧 DSH:
330
+
331
+ ```sh
332
+ npm install -g @deepseek-ai/dsh@0.1.1-rc.2
333
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@0.3
334
+ dsh --profile pi-tui
335
+ ```
336
+
337
+ `0.4` 当前线的声明支持范围是 `>=0.1.2-alpha.4`;每个发布版本都会验证
338
+ 具体的 DSH family。仅执行 `npm install -g @xmoon76/dsh-pi-tui` 不会把插件安装进
339
+ DSH profile,实际使用仍应执行上面的 `dsh plugin` 命令。
340
+
341
+ 新的 Agent preset 使用当前 roster 中选定的 id。DSH 允许合法的自定义
342
+ `code` preset;只要当前 roster 存在它,显式输入和持久化状态都会保留 `code`。
343
+ 旧数据中省略请求的 `code` default/session 值只有在确认 roster 不含 `code` 后
344
+ 才会回退到 `ptc`。
382
345
 
383
346
  ### npm
384
347
 
385
- 推荐使用单独的 `pi-tui` profile:
348
+ 推荐使用单独的 `pi-tui` profile。稳定版发布后,使用与 DSH 版本匹配的
349
+ TUI channel(稳定版用 `@latest`,预发布版用 `@next`):
386
350
 
387
351
  ```sh
388
- dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui
352
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@next
389
353
  dsh --profile pi-tui
390
354
  ```
391
355
 
@@ -395,6 +359,15 @@ dsh --profile pi-tui
395
359
  dsh --profile pi-tui --session <session-id>
396
360
  ```
397
361
 
362
+ ### Source Mode(仅验证)
363
+
364
+ Source Mode 只用于 `next` 的 CI 和本地兼容性验证,不是发布或用户安装方式。它从 `test/compat/dsh-source.json` 的完整 commit SHA 构建官方 DSH tarball family,通过临时 pnpm overrides 安装,并在完成后清理临时状态。不要把 DSH 源码路径、`file:` 依赖或 workspace symlink 写入发布 package。
365
+
366
+ ```sh
367
+ pnpm compat:dsh:source -- --dsh-dir "$HOME/project/deepseek-harness"
368
+ pnpm compat:dsh:npm
369
+ ```
370
+
398
371
  安装包已经包含运行所需的 Pi TUI fork,不需要额外安装内部的 TUI package。
399
372
 
400
373
  ### 更新
package/cordis.patch.yml CHANGED
@@ -42,24 +42,27 @@
42
42
  - id: authorization
43
43
  name: '@deepseek-ai/dsh-authorization'
44
44
 
45
- # The agent-preset roster. The SHIPPED root is an assembly fact of this
46
- # bundle: the four presets (standard/code/minimal/cordis) travel with the
47
- # package under config/agent-presets and carry `system` trust. The
48
- # expression reads the root from the startup service, so it resolves only
49
- # after `tuiStartup` exists — the web bundle's `webserver` row pattern
50
- # (no `!!js` at boot time, no HMR race). The writable root is
51
- # `dsh-agent-presets`' own default (`includeUserRoot`):
52
- # `$DSH_HOME/.agent-presets`, where a person authors their own presets.
45
+ # Consume DSH 0.1.2's official shipped presets directly. The upstream
46
+ # service defaults includeShippedRoot/includeUserRoot to true, so this
47
+ # bundle deliberately owns no duplicate standard/ptc/minimal/cordis root.
48
+ # The legacy persisted id `code` is normalized at the data boundary to
49
+ # `ptc`; it is not another preset row.
53
50
  - id: agent-presets
54
51
  name: '@deepseek-ai/dsh-agent-presets'
55
- inject: [tuiStartup]
56
52
  config:
57
53
  default: standard
58
- roots:
59
- - path: !!js ctx.tuiStartup.shippedPresetRoot
60
- trust: system
61
54
 
62
- # Host-plane TypeScript runtime: the `code` preset's `tool-presentation`
55
+ # The official standard preset composes its `subagent` tool with
56
+ # `modelSelectionSettings: true`, which injects this Host-owned setting
57
+ # service — the row is required for the standard composition to mount.
58
+ # Mounting the service ALONE enables nothing: it only owns the
59
+ # `subagent-model-selection` settings section (default enabled=false,
60
+ # empty allowlist). Each NEW session samples that section at
61
+ # composition; the TUI exposes the toggle + allowlist in /settings.
62
+ - id: subagent-model-selection-settings
63
+ name: '@deepseek-ai/dsh-tool-subagent/model-selection-settings'
64
+
65
+ # Host-plane TypeScript runtime: the `ptc` preset's `tool-presentation`
63
66
  # row waits for `codeRuntime` and fails the preset at mount without it
64
67
  # (same host row the web bundle inserts).
65
68
  - id: code-runtime
@@ -85,10 +88,12 @@
85
88
  #
86
89
  # Rows that STAY on the host plane (not listed): `tools` (registry), `shell-env`
87
90
  # (publishes the DSH env the model's shell sees), `subagent` + its spawn/fork
88
- # backends (process singletons), `tool-subagent-report` (host singleton), the
89
- # goal/jobs/compaction services and their commands, `permission`, `approval`,
90
- # `sandbox*`, `fs-observation-policy`, `spill*`, `timeout-policy`,
91
- # `repeat-tool-reminder`, `session-*`, `token-meter`.
91
+ # backends (process singletons), `subagent-model-selection-settings`, the
92
+ # goal/jobs/compaction services and
93
+ # their host infrastructure, `permission`, `approval`, `sandbox*`,
94
+ # `fs-observation-policy`, `spill*`, `timeout-policy`, `repeat-tool-reminder`,
95
+ # `session-*`, `token-meter`. `command-goal` is disabled below and reintroduced
96
+ # only by presets that own that command in their scoped composition.
92
97
 
93
98
  - id: tool-bash
94
99
  disabled: true
@@ -114,6 +119,9 @@
114
119
  - id: tool-skill
115
120
  disabled: true
116
121
 
122
+ - id: command-goal
123
+ disabled: true
124
+
117
125
  - id: tool-goal
118
126
  disabled: true
119
127
 
package/dist/builtins.mjs CHANGED
@@ -1,5 +1,5 @@
1
+ import { H as PI_TUI_EXTENSIONS_SERVICE, L as dshVersion } from "./src-zkySYmLZ.mjs";
1
2
  import { TUI_STARTUP_SERVICE } from "./startup.mjs";
2
- import { I as dshVersion, V as PI_TUI_EXTENSIONS_SERVICE } from "./src-Bk66X6NR.mjs";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  //#region src/builtins.ts