dsh-better-chat/README.en.md

118 lines
5.7 KiB
Markdown

# dsh-better-chat
Chat enhancements for DeepSeek Harness. v1.0.0 merges the **dsh-better-display
reading view** in: one plugin and one Web client artifact provide the reader tab
plus the approval / permission / plugin-store improvements.
## Install
```sh
dsh plugin --profile desktop add dsh-better-chat
```
From this repository (pin a commit):
```sh
dsh plugin --profile desktop add git+https://git.qyhhh.top/DeepsSeekHarness/dsh-better-chat.git#<commit>
```
The compiled `lib/` is committed, so installation needs no build step. Fully
restart DSH afterwards.
> If the standalone **dsh-better-display** is installed, remove it while updating
> this plugin: the reading view is now part of this package, and installing both
> registers two reader views and two settings sections (their titles overwrite
> each other).
## Feature 1: reading view (merged from dsh-better-display 0.3.12)
Adds a **阅读 / Reading** tab to the conversation: while a turn runs you see the
steps, reasoning and progress; on success the process collapses and the final
answer stays. The native conversation / trajectory views, composer, model picker,
tools and approvals remain.
- The reader column keeps the host ChatView `data-chat-flow` hook, so third-party
skins that hang the composer off that marker still show it.
- ````mcp-app` code blocks in the final answer render as interactive cards inside
`<iframe sandbox="allow-scripts allow-forms">`.
- **Better Chat** settings: preview deliverables in the right sidebar, frosted
glass (off by default), auto-fold the process (on by default), and approval-card
shortcuts.
- Upstream design notes, extension points and runbooks live in [`docs/`](docs/).
## Feature 2: Enter approves, Esc rejects on approval cards (v0.1.0; hints in v0.4.1, customization in v0.4.2)
DSH's approval card handles Enter / Esc itself, but only when focus is already
inside the card. This plugin adds:
1. **Auto-focus**: when an approval appears and the user is not typing elsewhere,
focus moves into the card's detail region.
2. **Document-level routing**: with focus outside the card, the configured key
clicks "Allow once" (never "Always allow" by default) and Esc clicks "Reject".
3. **Key hint**: the action row shows keycaps for the current bindings (default
`Enter Allow once · Ctrl+Enter Always allow · Esc Reject`), using the card's
real button labels. It disappears once answered, is not focusable and is not
clickable. macOS shows Cmd instead of Ctrl.
4. **Ctrl+Enter / Cmd+Enter = Always allow**, only when the card has the third
button. The official card ignores modified keys, so this chord is handled here
even while focus is inside the card. It never fires while typing in an input.
5. **Customizable shortcuts**: Settings → Better Chat → Approval card shortcuts.
Click a keycap and press the new combination. Allow-type actions stay on Enter,
reject stays on Esc; modifiers are free. You can clear "Always allow" or
restore defaults. Bindings persist under `dsh.better-chat.v1` and the card hint
updates immediately — no restart needed.
It never intercepts while typing, for a plain Enter/Esc when focus is inside the
card, for modifier sets that do not match the current binding, on auto-repeat,
during IME composition, when Enter lands on another button or link, or when the
card is answered.
## Feature 3: permission policy (v0.2.0, default auto-review restored in v1.0.1)
- Removes the "Full access / 完全权限" option from the `/permission` popup, the
composer permission menu and the settings default-permission dropdown.
UI-only: the slash command still works.
- **Defaults new/blank sessions to "Auto review (`auto`)"**: when the
`@deepseek-ai/dsh-experimental-auto-review` layer is enabled, newly created or
first-opened blank top-level sessions automatically switch to `auto` (backed by
both the host `agent/created` hook and the client session observer).
- **Never overwrites existing conversations or manual choices**: sessions with
existing history (`blank === false`), subagent sessions, and already-handled
sessions (persisted under `dsh.better-chat.permission-handled.v1`) are left
untouched across page reloads and restarts.
## Feature 4: plugin-store update button (v0.3.0)
Plugins installed from custom indexes only get an "update available" badge. This
feature adds an "Update to x.y.z" button that calls the host's own
`remote.pluginMarket` / `remote.pluginManager` to overwrite-install the exact
spec from the index. The remote services are injected by a child plugin, so the
feature silently disables itself when the experimental plugin index is off.
## Development
```sh
# Windows: pnpm's default isolated linker overflows on rolldown's native
# binding symlink; use the hoisted layout.
pnpm install --config.node-linker=hoisted
pnpm build # tsdown
pnpm test # vitest
```
- **Single artifact**: `lib/host.js` is the host entry and `lib/client.js` is the
only Web client artifact, registered as `dsh-better-chat`. The reader view and
the chat enhancements meet in `src/client/index.tsx`.
- **Toolchain**: [`tools/client-build.js`](tools/client-build.js) is the dshx
0.9.7 client bundle adapter (MIT, see third-party notices); the target DSH
platform module table is pinned in
`tools/harness/packages/client/web/src/platform.ts` (from dsh-v0.2.2-rc.2).
Set `DSHX_HARNESS` to build against another Harness checkout.
- **Tests**: `tests/chat/` covers the chat enhancements; `tests/*.test.ts` is the
upstream reading-view suite, re-baselined on the merged package layout.
## License
MIT. The reading-view source and docs come from
[dsh-better-display](https://github.com/aa2246740/dsh-better-display) (MIT); see
[`THIRD_PARTY_NOTICES.md`](THIRD_PARTY_NOTICES.md) and [`licenses/`](licenses/).