@xmoon76/dsh-pi-tui 0.3.4 → 0.3.5

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 ADDED
@@ -0,0 +1,648 @@
1
+ # dsh-pi-tui
2
+
3
+ [简体中文](README.md) | English
4
+
5
+ [![npm](https://img.shields.io/npm/v/@xmoon76/dsh-pi-tui.svg)](https://www.npmjs.com/package/@xmoon76/dsh-pi-tui)
6
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
+
8
+ A Pi-style terminal frontend for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness).
9
+
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
+
12
+ ```sh
13
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui
14
+ dsh --profile pi-tui
15
+ ```
16
+
17
+ ![dsh-pi-tui](docs/dsh-pi-tui.png)
18
+
19
+ ## Features
20
+
21
+ ### Conversation and tools
22
+
23
+ * Streaming Markdown output
24
+ * Collapsible Thinking blocks
25
+ * Tool Call cards with running / success / failure state
26
+ * Collapsible Tool / System details
27
+ * Full-text Transcript search
28
+ * Folding for long Session history
29
+ * Context, token, model, and runtime status
30
+ * Approval and `ask_user_question` dialogs
31
+ * Plan Review
32
+ * Todo / Goal status
33
+ * Human-readable terminal window titles
34
+ * No duplicate ghost Tool Cards after compaction / pruning
35
+
36
+ `Ctrl+O` controls Tool and System details — and in fullscreen Focus it bulk-expands the recent Thought roots or collapses them all. `Alt+T` controls Thinking separately.
37
+
38
+ ### Focus Mode
39
+
40
+ `/focus` groups the current turn's Thinking, Tool Calls, and intermediate replies into a live Thought block.
41
+
42
+ The full process can still be expanded when needed. In fullscreen Focus, Thought roots can be expanded/collapsed in bulk or opened with an individual card click, and the viewport survives switches and resizes. Disabling Focus restores the normal Transcript projection. Focus only changes presentation; it does not modify Session events.
43
+
44
+ ### Sessions
45
+
46
+ Supports persisted DSH Sessions, including:
47
+
48
+ * Creating and resuming Sessions
49
+ * Session switching
50
+ * Renaming
51
+ * Forking
52
+ * Rewind
53
+ * Session lineage
54
+ * Transcript export
55
+
56
+ Use:
57
+
58
+ ```text
59
+ /sessions
60
+ /fork
61
+ /rewind
62
+ ```
63
+
64
+ When the Agent is idle and the editor is empty, pressing `Esc` twice quickly also opens Rewind.
65
+
66
+ Rewind creates a new Child Session from a selected historical User Turn and restores that Prompt into the editor. The original Session is left unchanged.
67
+
68
+ ### Input history
69
+
70
+ `Ctrl+R` opens input history search.
71
+
72
+ Three scopes are available:
73
+
74
+ * Current session
75
+ * Current directory
76
+ * All directories
77
+
78
+ History results include the Prompt, working directory, timestamp, and Session information. Selecting an entry restores it to the editor without submitting it.
79
+
80
+ Regular `↑` / `↓` history recall is still available for recent input.
81
+
82
+ ### Subagents and background tasks
83
+
84
+ `/tasks` opens the task browser for the current Session.
85
+
86
+ Subagents are shown using their complete lineage, including nested descendants:
87
+
88
+ ```text
89
+ main
90
+ ├─ subagent A
91
+ │ └─ subagent B
92
+ └─ subagent C
93
+ ```
94
+
95
+ The browser distinguishes:
96
+
97
+ * `continuable`
98
+ * `one-shot`
99
+ * running / inactive
100
+ * nested descendants
101
+ * background Jobs
102
+
103
+ Completed one-shot Subagents remain available for persisted Transcript inspection.
104
+
105
+ 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.
106
+
107
+ Deeper nested Subagents are read-only by default.
108
+
109
+ ### Shell
110
+
111
+ The editor supports two Shell modes:
112
+
113
+ ```text
114
+ ! git status
115
+ ```
116
+
117
+ Runs a local command and submits its output into the current Session.
118
+
119
+ ```text
120
+ !! git status
121
+ ```
122
+
123
+ Runs the command locally only. Its output is not added to model context.
124
+
125
+ `!` / `!!` are editor modes rather than plain text prefixes. The prompt and completion behavior switch together with the active mode.
126
+
127
+ Shell cards show a bounded output preview by default. `Ctrl+O` expands the retained output — except in fullscreen Focus, where Ctrl+O owns the Thought roots and the shell cards keep their folded state.
128
+
129
+ ### File references and images
130
+
131
+ Typing `@` opens workspace file search and completion:
132
+
133
+ ```text
134
+ @src/index.ts
135
+ @"path with spaces/file.ts"
136
+ ```
137
+
138
+ Resolvable relative paths are canonicalized before submission.
139
+
140
+ Clipboard images can be added with `Ctrl+V` and persisted through the DSH Attachment service.
141
+
142
+ ### Models and runtime settings
143
+
144
+ The TUI uses DSH model and settings services.
145
+
146
+ Common entry points:
147
+
148
+ ```text
149
+ /model
150
+ /settings
151
+ /login
152
+ /permission
153
+ /plan
154
+ /goal
155
+ /compact
156
+ /footer
157
+ /statusline
158
+ ```
159
+
160
+ Model selection, Reasoning Effort, permission presets, Plan, and Goal all keep the corresponding DSH runtime semantics.
161
+
162
+ The `Icon style` option in `/settings` switches the TUI's structural icons:
163
+ `Emoji` (default, colorful), `Symbols` (compact single-cell terminal
164
+ symbols), or `Minimal` (decorative icons hidden; only status/interaction
165
+ markers remain). Switching applies immediately and persists.
166
+
167
+ Slash Commands registered by other plugins through `ctx.commands` are discovered automatically.
168
+
169
+ ### Footer customization
170
+
171
+ The status line is a **composable surface** — no plugin or shell needed
172
+ for the common cases.
173
+
174
+ `/settings` → Status line (or the `footer` key in the `dsh-pi-tui`
175
+ settings document) selects the preset:
176
+
177
+ | Value | Meaning |
178
+ |---|---|
179
+ | `default` (legacy `full`) | the classic two-row footer (status + stats) |
180
+ | `compact` | the status row only (stats line hidden) |
181
+ | `custom` | a versioned `footerLayout` (see below) |
182
+ | `command` | a user-configured command renders the status surface (see below) |
183
+
184
+ The first three values are selectable in the `/settings` panel; `command`
185
+ is NOT in the panel — it can only be enabled through the USER-layer
186
+ settings document (`footer: "command"` + `footerCommand`). The `/settings`
187
+ Status line row offers exactly `default / compact / custom`.
188
+
189
+ `/footer` is a hierarchical interactive configurator: pick a row first
190
+ (Row Selector), then edit that row's items — `↑/↓` walks every item of
191
+ the row in order (Left/Right are visual grouping only), `←/→` moves an
192
+ item across sides, `Space` removes it, `A` opens a searchable Add Picker
193
+ (filtered by label / id / description, with the highlighted item's
194
+ description below), `M` enters Move Mode to reorder, and `Enter` opens
195
+ the Item Editor (Style candidates previewed with the item's real render;
196
+ semantic tones; Advanced edits prefix / suffix / importance with a
197
+ one-keystroke Reset). The preview is composed by the real footer engine
198
+ and — with the contextual help — pinned to the top of the panel; it never
199
+ scrolls away at any terminal size. `S` on the Row Selector saves
200
+ (persisted); `Esc` walks back page by page and closes on the first page
201
+ without touching the active layout. Usable before any session exists.
202
+
203
+ 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.
204
+
205
+ `footerLayout` is a nested settings object (schemaVersion 1, 1–2 rows,
206
+ left/right zones, a separator, finite formatters, semantic tones,
207
+ prefix/suffix, importance). The `/footer` configurator builds it
208
+ interactively; the YAML shape is:
209
+
210
+ ```yaml
211
+ footer: custom
212
+ footerLayout:
213
+ schemaVersion: 1
214
+ rows:
215
+ - left:
216
+ - id: agent-preset
217
+ format: compact
218
+ - id: model
219
+ - id: project
220
+ - id: context
221
+ format: full
222
+ - id: cache-hit
223
+ - id: token-usage
224
+ format: io
225
+ - id: performance
226
+ format: speed
227
+ - id: version
228
+ format: tui
229
+ right:
230
+ - id: focus-mode
231
+ separator:
232
+ text: " │ "
233
+ tone: textDim
234
+ ```
235
+
236
+ Builtin format choices are finite and use the existing `format` field (no
237
+ second style schema): Model `badge` / `plain` / `compact`; Permission preset
238
+ `badge` / `plain` / `compact`; Plan state `badge` / `plain`; Working directory
239
+ `short` / `basename` / `full`; Git branch `plain` / `label`; Context `bar` /
240
+ `percent` / `full`; Token usage `io` / `total` / `compact`; Cache hit `full` /
241
+ `compact`; Performance `full` / `speed` / `latency` measures average time
242
+ to first token; Turns/steps `both` / `turns` / `steps`; Version keeps `tui` / `dsh` /
243
+ `both`. Omitting `format` continues to use each item's legacy default.
244
+
245
+ Builtin item ids: `agent-preset`, `model`, `reasoning`,
246
+ `permission-preset`, `sandbox-mode`, `approval-policy`, `plan-state`,
247
+ `focus-mode`, `focused-seat`, `view-scope`, `cwd`, `project`,
248
+ `git-branch`, `run-state`, `queue`, `tasks`, `agents`, `todo`,
249
+ `context`, `cache-hit`, `token-usage`, `performance`, `turns-steps`,
250
+ `stats-line`, `version`, `ext:*` (the legacy extension segments).
251
+ An invalid `footerLayout` warns once and falls back to the default — the
252
+ TUI always starts.
253
+
254
+ `footer: command` hands the Status Surface to a user-configured command
255
+ (Claude/Kimi style): the current status snapshot is serialized to JSON on
256
+ the command's stdin (schemaVersion 1 — no secrets, no credentials, no
257
+ prompts), and the command's stdout (sanitized: SGR colors and OSC 8
258
+ hyperlinks only) renders the status surface. The Host's instruction
259
+ surface (e.g. the Ctrl+C exit hint) always survives on top.
260
+
261
+ ```yaml
262
+ footer: command
263
+ footerCommand:
264
+ schemaVersion: 1
265
+ command: "~/.config/dsh/statusline.sh"
266
+ timeoutMs: 300 # default 300, max 1000
267
+ refreshIntervalMs: 1000 # min 1000
268
+ maxRows: 1 # 1..2
269
+ ```
270
+
271
+ **Security:** the command is executed ONLY when it lives in the USER
272
+ layer of your settings document. A repository/project-supplied
273
+ `footerCommand` is never executed — command mode is disabled and the
274
+ native layout applies. The command refreshes periodically according to
275
+ `refreshIntervalMs` and renders at most two rows; failures (empty output,
276
+ non-zero exit, timeout) fall back to the native layout automatically.
277
+
278
+ ### Extension footer items
279
+
280
+ Plugins can contribute **configurable footer items** through the Stable
281
+ extension API (`@xmoon76/dsh-pi-tui/extensions`): register a
282
+ `FooterItemContribution` on the `chrome.footer.item` slot — a label and a
283
+ plain-data `segment` (styled spans; the host strips any terminal control
284
+ sequence, plugins never style the terminal). Users show/hide, reorder and
285
+ zone-place the item in `/footer` exactly like a builtin item. Feature-detect
286
+ the `slot.chrome.footer.item` capability before registering (it is
287
+ advertised before any surface exists). The item's config identity is the
288
+ canonical key `ext:<owner>/<id>` where the owner is the plugin's stable
289
+ name — **stable across HMR**: a layout referencing an unloaded plugin's
290
+ item keeps the reference and recovers automatically when the plugin
291
+ reloads. An npm-scoped plugin name (`@scope/name`) is legal: its `/` is
292
+ percent-encoded via `encodeURIComponent` in the key
293
+ (`ext:%40scope%2Fname/<id>`); the id itself must
294
+ not contain `/`. The legacy `chrome.footer.status` slot is unchanged: its
295
+ segments aggregate into the single `ext:*` item. Full author guide:
296
+ [docs/extension-api.md](docs/extension-api.md).
297
+
298
+ ## Common keys
299
+
300
+ | Key | Action |
301
+ | ------------- | --------------------------------------------------- |
302
+ | `Enter` | Submit input |
303
+ | `Ctrl+Enter` | Queue the draft while the agent is busy (the opposite of Enter while busy) |
304
+ | `Shift+Enter` | Insert newline |
305
+ | `Esc` | Cancel current interaction / interrupt running work |
306
+ | `Esc Esc` | Open Rewind while idle |
307
+ | `Ctrl+C` | Interrupt / clear current input |
308
+ | `Ctrl+D` | Quit the TUI (like `/exit`) |
309
+ | `Ctrl+S` | Steer queued messages and the draft into the running turn |
310
+ | `Ctrl+T` | Toggle the todo panel |
311
+ | `Ctrl+R` | Search input history |
312
+ | `Ctrl+F` | Search Transcript |
313
+ | `Ctrl+O` | Expand / collapse Tool and System details; in fullscreen Focus, bulk-toggle the Thought roots |
314
+ | `Alt+T` | Expand / collapse Thinking |
315
+ | `Ctrl+G` | Edit current input in `$VISUAL`/`$EDITOR` |
316
+ | `Ctrl+V` | Paste image |
317
+ | `Tab` | Autocomplete slash commands and file paths |
318
+ | `@` | File completion |
319
+ | `!` | Enter Shell mode |
320
+ | `!!` | Enter local-only Shell mode |
321
+
322
+ Use `/help` inside the TUI for the current command and keybinding list. The table above shows the defaults; after customization, `/help` and `/keybindings` show the effective keys.
323
+
324
+ ### Customizing keybindings
325
+
326
+ Host shortcuts are semantic actions (`app.*`) resolved through a
327
+ context-aware keymap — the UI (footer hints, `/help`, `/keybindings`)
328
+ always shows the EFFECTIVE keys, so a remap updates every hint. Configure
329
+ them in the `dsh-pi-tui` settings namespace; apply with `/keybindings
330
+ reload` (explicit — a settings edit takes effect after the reload, no
331
+ restart):
332
+
333
+ ```yaml
334
+ dsh-pi-tui:
335
+ keybindings:
336
+ app.input.steer: ctrl+s # one key
337
+ app.permission.cycle: [shift+tab, ctrl+shift+p] # several keys
338
+ app.history.search: ctrl+r
339
+ app.transcript.toggleThinking: false # disable the action's keys
340
+ leader: ctrl+x # M6: leader sequences
341
+ bindings:
342
+ app.tasks.open: <leader>t
343
+ ```
344
+
345
+ - A plain printable key can never be bound to a Host action (it would
346
+ swallow typing); a bad entry is a warning, never a startup failure
347
+ (fail-soft).
348
+ - Any user declaration REPLACES the action's builtin default keys:
349
+ `app.input.steer: ctrl+x` makes Ctrl+X steer and Ctrl+S stop steering;
350
+ a leader-only `app.todo.toggle: <leader>t` makes Leader T the only
351
+ toggle trigger (Ctrl+T stops); `['ctrl+z', '<leader>s']` keeps both
352
+ USER triggers; `false` removes every trigger of the action. Leader
353
+ completions that the effective editor-owned submit key would consume (for
354
+ example, `<leader>enter`) are rejected instead of being advertised as dead
355
+ sequences.
356
+ - `DSH_PI_TUI_SAFE_KEYBINDINGS=1` ignores all user overrides (builtin
357
+ defaults only). The whole `/keybindings` editor is read-only while safe mode
358
+ is active, so it cannot save a configuration that is only checked after safe
359
+ mode is disabled.
360
+ - In the editor, untouched default bindings that are still effective are
361
+ selectable. `Add shortcut` materializes those surviving defaults plus the new
362
+ key; shadowed definition defaults remain reference-only, and replacing or
363
+ removing one surviving default preserves its siblings. Once an action has a
364
+ user declaration, that declaration still replaces the builtin set as
365
+ described above.
366
+ - `/help` remains the key-first, read-only help surface; `/keybindings` is the
367
+ action-first, editable Keyboard Shortcuts Editor: it groups actions by
368
+ category, searches action IDs/descriptions/current keys/default keys, and
369
+ marks customized, conflict, Unbound, Disabled, and fixed states. A standalone Leader key row also configures the global leader key.
370
+ - `/settings` has one `Keyboard shortcuts` launcher that opens the same editor
371
+ and persistence controller as `/keybindings`.
372
+ - The recorder reads a real terminal key, parses it with `parseKey`, and stores
373
+ the canonical `KeyId`; known dead, typing-swallowing, terminal-ambiguous, and
374
+ conflicting shortcuts are rejected before saving. Ordinary recording cancels
375
+ on `Esc`; the direct Host interrupt recorder uses a short double-press window:
376
+ one `Esc` cancels and two `Esc` press events assign physical Escape. Key
377
+ repeats/releases do not count, and there is no single-letter shortcut;
378
+ physical Escape remains reserved for Host lifecycle paths.
379
+ - Conditional affordances are labeled separately in the editor (for example,
380
+ `Down (conditional)` for the empty-editor task browser) instead of appearing
381
+ as ordinary configured shortcuts.
382
+ - `/keybindings conflicts` lists conflicts (same key + overlapping scope + same
383
+ priority — never silent last-write-wins); `/keybindings reload` re-reads the
384
+ settings (fail-soft: a bad entry is diagnosed and skipped, a throwing read
385
+ is an error notice — never a crash; the keymap keeps the last-known-good
386
+ configuration); `/keybindings reset` clears the overrides through the
387
+ settings service and rebuilds the running keymap immediately.
388
+ - The subagent viewer blocks PARENT actions by action id, so a remapped
389
+ parent shortcut stays blocked inside the viewer.
390
+ - Conditional affordances are ADDITIVE: binding `app.tasks.open: ctrl+x`
391
+ ADDS a trigger — the empty-editor `↓` task-browser affordance still
392
+ works; only `false` removes every trigger of an action.
393
+
394
+
395
+ ## Installation
396
+
397
+ ### Requirements
398
+
399
+ * DeepSeek Harness
400
+ * Node.js `^22.19.0 || >=24`
401
+
402
+ The project currently follows the DeepSeek Harness `0.1.1-rc.x` release line.
403
+
404
+ ### npm
405
+
406
+ Using a dedicated `pi-tui` profile is recommended:
407
+
408
+ ```sh
409
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui
410
+ dsh --profile pi-tui
411
+ ```
412
+
413
+ Resume an existing Session:
414
+
415
+ ```sh
416
+ dsh --profile pi-tui --session <session-id>
417
+ ```
418
+
419
+ The published package already contains the Pi TUI fork required at runtime. No separate internal TUI package needs to be installed.
420
+
421
+ ### Update
422
+
423
+ ```sh
424
+ dsh plugin --profile pi-tui -- update @xmoon76/dsh-pi-tui
425
+ ```
426
+
427
+ List installed plugins:
428
+
429
+ ```sh
430
+ dsh plugin --profile pi-tui -- list
431
+ ```
432
+
433
+ Remove:
434
+
435
+ ```sh
436
+ dsh plugin --profile pi-tui -- remove @xmoon76/dsh-pi-tui
437
+ ```
438
+
439
+ ## Running from source
440
+
441
+ ```sh
442
+ git clone https://github.com/XMoon/dsh-pi-tui
443
+ cd dsh-pi-tui
444
+
445
+ pnpm install
446
+ pnpm build
447
+ ```
448
+
449
+ Install using `file:`:
450
+
451
+ ```sh
452
+ dsh plugin --profile pi-tui -- add @xmoon76/dsh-pi-tui@file:$PWD
453
+ ```
454
+
455
+ `file:` copies the current build output at install time. After changing source, rebuild and add the package again.
456
+
457
+ For continuous development, use `link:`:
458
+
459
+ ```sh
460
+ dsh plugin --profile pi-tui-dev -- add @xmoon76/dsh-pi-tui@link:$PWD
461
+ dsh --profile pi-tui-dev
462
+ ```
463
+
464
+ After that, rebuilding is enough:
465
+
466
+ ```sh
467
+ pnpm build
468
+ ```
469
+
470
+ The development profile continues to point at the working tree.
471
+
472
+ ## DeepSeek Harness integration
473
+
474
+ `dsh-pi-tui` implements the terminal interaction layer only.
475
+
476
+ The following capabilities are provided by DeepSeek Harness:
477
+
478
+ * Agent Loop
479
+ * LLM / Provider
480
+ * Session Persistence
481
+ * Tools
482
+ * Skills
483
+ * Approval
484
+ * Permission Presets
485
+ * Plan Mode
486
+ * Goal
487
+ * Jobs
488
+ * Subagents
489
+ * Credentials
490
+ * Settings
491
+
492
+ The TUI therefore does not maintain a separate model configuration, Session format, or Agent Runtime.
493
+
494
+ It can coexist with other DSH surfaces using the same runtime data:
495
+
496
+ ```sh
497
+ dsh --profile web
498
+ dsh --profile headless
499
+ dsh --profile pi-tui
500
+ ```
501
+
502
+ ## Extension API
503
+
504
+ In addition to being used as a TUI, `dsh-pi-tui` exposes versioned Extension APIs for other Cordis / DSH plugins that need to extend terminal interaction.
505
+
506
+ Three public entries are currently available:
507
+
508
+ | Entry | Use | Stability |
509
+ | ----------------------------------------- | ------------------------------- | --------- |
510
+ | `@xmoon76/dsh-pi-tui/extensions` | General extensions | Stable |
511
+ | `@xmoon76/dsh-pi-tui/extensions/advanced` | Deeper interaction capabilities | Advanced |
512
+ | `@xmoon76/dsh-pi-tui/extensions/unstable` | Low-level capabilities | Unstable |
513
+
514
+ Extension points include:
515
+
516
+ * Header / Footer
517
+ * Input Widget
518
+ * Slash Command
519
+ * Theme
520
+ * Setting
521
+ * Autocomplete
522
+ * Keybinding
523
+ * Message Renderer
524
+ * Tool Renderer
525
+ * Overlay
526
+ * Interactive UI
527
+ * Editor Control
528
+ * Replacement Editor
529
+
530
+ Plugins depend only on public entries and do not need to import internal types such as `TuiApp` or `TuiMainScreen`.
531
+
532
+ Minimal example:
533
+
534
+ ```ts
535
+ import {
536
+ PI_TUI_EXTENSIONS_SERVICE,
537
+ type PiTuiExtensionService,
538
+ } from '@xmoon76/dsh-pi-tui/extensions'
539
+
540
+ export const name = 'my-plugin'
541
+ export const inject = ['tuiStartup', PI_TUI_EXTENSIONS_SERVICE]
542
+
543
+ export function apply(ctx: Context): void {
544
+ const service = ctx.get(
545
+ PI_TUI_EXTENSIONS_SERVICE,
546
+ ) as PiTuiExtensionService
547
+
548
+ if (!service.api().capabilities.has('slot.chrome.header.badge')) {
549
+ return
550
+ }
551
+
552
+ service.register(
553
+ 'chrome.header.badge',
554
+ {
555
+ id: 'my-badge',
556
+ order: 100,
557
+ },
558
+ {
559
+ text: 'my-plugin',
560
+ tone: 'info',
561
+ },
562
+ )
563
+ }
564
+ ```
565
+
566
+ Documentation:
567
+
568
+ * [Extension API](docs/extension-api.md)
569
+ * [Extension tiers](docs/extension-tiers.md)
570
+ * [Advanced API](docs/extension-advanced.md)
571
+ * [Unstable API](docs/extension-unstable.md)
572
+ * [Plugin authoring](docs/plugin-authoring.md)
573
+ * [Capability matrix](docs/extension-capability-matrix.md)
574
+
575
+ ## Development
576
+
577
+ ```sh
578
+ pnpm install
579
+ pnpm build
580
+ pnpm typecheck
581
+ pnpm test
582
+ ```
583
+
584
+ The test suite covers the Pi TUI fork, host / surface behavior, and Extension API fixtures and smoke tests.
585
+
586
+ Terminal rendering and input routing are tested extensively with `@xterm/headless`, so most UI tests do not require a real TTY or a live model connection.
587
+
588
+ Performance baseline:
589
+
590
+ ```sh
591
+ node --expose-gc scripts/bench.mts
592
+ ```
593
+
594
+ The project is also developed against a dedicated `pi-tui-dev` profile:
595
+
596
+ ```sh
597
+ dsh plugin --profile pi-tui-dev -- add @xmoon76/dsh-pi-tui@link:$PWD
598
+ dsh --profile pi-tui-dev
599
+ ```
600
+
601
+ ## Repository layout
602
+
603
+ The repository root is the npm package published as `@xmoon76/dsh-pi-tui`.
604
+
605
+ The Pi TUI fork lives under:
606
+
607
+ ```text
608
+ packages/pi-tui/
609
+ ```
610
+
611
+ It is an internal build dependency bundled with the root package and does not need to be installed separately by users.
612
+
613
+ Upstream provenance, version information, and local divergence are tracked in:
614
+
615
+ ```text
616
+ packages/pi-tui/package.json
617
+ packages/pi-tui/AGENTS.md
618
+ ```
619
+
620
+ Contributor-oriented repository structure and development rules are documented in [AGENTS.md](AGENTS.md).
621
+
622
+ ## Documentation
623
+
624
+ | Document | Content |
625
+ | ------------------------------------------------------ | --------------------------------- |
626
+ | [docs/README.md](docs/README.md) | Documentation index |
627
+ | [docs/architecture.md](docs/architecture.md) | Architecture and module ownership |
628
+ | [docs/input-history.md](docs/input-history.md) | Input history |
629
+ | [docs/surface-decisions.md](docs/surface-decisions.md) | TUI interaction decisions |
630
+ | [docs/concurrency.md](docs/concurrency.md) | Session concurrency |
631
+ | [docs/failure-model.md](docs/failure-model.md) | Async failure / cancellation |
632
+ | [docs/perf-baseline.md](docs/perf-baseline.md) | Performance baseline |
633
+ | [docs/extension-api.md](docs/extension-api.md) | Extension API |
634
+ | [AGENTS.md](AGENTS.md) | Contributor operating manual |
635
+
636
+ ## Changelog
637
+
638
+ 简体中文:
639
+
640
+ [CHANGELOG.md](CHANGELOG.md)
641
+
642
+ English:
643
+
644
+ [CHANGELOG.en.md](CHANGELOG.en.md)
645
+
646
+ ## License
647
+
648
+ [MIT](LICENSE)