feat: yield the terminal and browser to DSH 0.1.6's own sidebar types

DSH 0.1.6-alpha.2 ships a right-Sidebar terminal and a right-Sidebar browser
of its own. Both were things this plugin had built from scratch, so keeping
them meant two implementations of one surface plus a plugin that shadows a
host type the product is actively developing.

Terminal: the plugin's whole PTY stack goes — the UI-tab manager, the
agent-owned registry, the lazy node-pty loader, the eight model-facing
terminal_* tools, the xterm view and its font/link/scrollback helpers, and
the cross-session 'pinned terminal' rail that existed only to keep a terminal
alive across a session switch. The host's terminal kind becomes the only
provider, which also retires the node-pty dependency, its pnpm allowBuilds
entry, and the installer's -Repair mode (issue #140's whole class of
'node-pty failed to load' support).

Model-facing capability note: the plugin used to inject terminal_* tools
(off by default). Those are the model's only cross-call persistent terminal,
and DSH's own equivalent (@deepseek-ai/dsh-tool-terminal) is not mounted by
any shipped bundle, so removing them leaves the model with the one-shot
bash/pwsh tools only. That is the accepted cost of not maintaining a second
PTY surface; the README documents how to enable the upstream toolset.

Browser: the plugin's browser tab type is dropped, so the host's own browser
kind owns embedded pages. The DOM-level link takeover STAYS (it is the only
thing that can route an https link to the system browser by protocol, which
the host does not do) but now delegates to the host's browser tab via
ctx.sidebarRight.openTab('browser', …) with a window.open fallback, and the
two settings that only ever configured the plugin's own iframe (sandbox
escape hatch, loopback allowlist) go with it — along with the host-side
browser.probe route they fed.

Cards: the empty-pane welcome cards adopt the host's guide-capsule recipe
(0.5px l4 hairline, 24px radius, layer-1 fill, 56px floor, 14px/20px padding)
so the plugin's 'pick what opens here' surface reads as the same design as
DSH's own. A theme.spec guard pins the geometry and the token-only paint —
including that the upstream-only --dsw-alias-bg-l1/-l2 spellings (defined
nowhere, so their declarations are silently dropped upstream) never appear
here.

Also drops the dead state the removed features left behind (SidebarTab.pin,
nextTerminal, agentWaits, bottomOpenedOnce, the agent-tab helpers, the
pinned-tab memo key), re-points every test fixture that used them at
surviving equivalents, and prunes the specs of the deleted features.
This commit is contained in:
Menghuan1918 committed 2026-09-21 20:35:11 +08:00
1 parent d60899841d
commit 5912274e41
79 files changed
+381 -9464

No files matched your search

+20 -9
View File
@@ -13,11 +13,12 @@
* plugin's `[data-dsh-better-sidebar]` host mount;
* 3. asserts the plugin's crash markers never appear (no RenderBoundary /
* fail() strips, no `pageerror`, no plugin-prefixed console errors);
* 4. expands DSH's native right Sidebar, sweeps every built-in tab type
* through its guide page (Files / Changes / Tasks / Terminal / Browser) —
* including the lazily-fetched terminal chunk — and then opens seeded
* files through the Files window's tree (separate mode: each file opens
* its own new tab, the seeded home "Files" tab stays the explorer),
* 4. expands DSH's native right Sidebar, sweeps every tab type the COMPOSED
* guide offers (the plugin's own Files / Changes / Tasks / Side chat, plus
* whatever the host contributes — its own terminal and browser tab types
* when those packages are mounted) through its guide page, and then opens
* seeded files through the Files window's tree (separate mode: each file
* opens its own new tab, the seeded home "Files" tab stays the explorer),
* while response waits armed before goto prove the lazily-fetched editor
* chunk (client-editor.js) and the mermaid chunk (client-mermaid.js,
* rendered SVG diagram + zoom modal) loaded.
@@ -56,8 +57,18 @@ const SEEDED_README_FILE = 'readme-style.md'
*/
const CRASH_STRIP_PATTERNS = [/^dsh-better-sidebar:/, /^\[dsh-better-sidebar\]/]
/** Built-in tab titles the sweep drives (en-US copy; follows DSH locale). */
const NATIVE_TABS = ['files', 'git', 'subagent', 'sidechat', 'terminal', 'browser']
/**
* The tab types the plugin itself contributes, plus the host-owned kinds the
* guide is asserted to still offer.
*
* `terminal` and `browser` are DSH 0.1.6's own right-Sidebar types: this
* plugin deliberately ships neither (it used to own both), so the guide must
* show exactly ONE entry for each when the host mounts those packages — a
* second entry would mean the plugin is shadowing the host again.
*/
const PLUGIN_TABS = ['files', 'git', 'subagent', 'sidechat'] as const
const HOST_OWNED_TABS = ['terminal', 'browser'] as const
const NATIVE_TABS: readonly string[] = [...PLUGIN_TABS, ...HOST_OWNED_TABS]
let api: APIRequestContext
/** The seeded session id (captured by seedSession; the Side Chat smoke's parent). */
@@ -288,7 +299,7 @@ test('plugin mounts into the DSH shell and survives a built-in tab sweep', async
}
// Sweep every type through the guide. Each open mounts a real viewer (the
// terminal fetches its lazy chunk); a failure anywhere surfaces as a
// editor and mermaid chunks arrive lazily); a failure anywhere surfaces as a
// pageerror or a crash strip, both of which the next assertion sees. A pane
// holds one guide tab, so re-seed it through the strip's add control before
// every pick.
@@ -361,7 +372,7 @@ test('plugin mounts into the DSH shell and survives a built-in tab sweep', async
const settingsGetBody = (await settingsGet.json()) as { value?: { tabsEnabled?: Record<string, boolean> } }
const originalTabsEnabled = settingsGetBody.value?.tabsEnabled ?? {}
/** The types this check switches off (leaving three entries, i.e. ≤4). */
const shrunken = ['git', 'subagent', 'terminal'] as const
const shrunken = ['git', 'subagent'] as const
try {
// Send the FULL map back (the route's patch is key-wise merged, so a
// full map is correct whether the host merges or replaces).
+7 -2
View File
@@ -33,8 +33,13 @@ import { PAGE_URL, createHostApi, hostRpc, sendFirstMessage } from './host'
* share seed paths with mount/drag). */
const WORKSPACE_PATH = process.env.DSH_E2E_PERF_WORKSPACE ?? join(tmpdir(), 'dsh-e2e-perf-workspace')
/** Built-in tab titles the sweep drives (en-US copy; follows DSH locale). */
const NATIVE_TABS = ['files', 'git', 'subagent', 'sidechat', 'terminal', 'browser']
/**
* Every tab type the composed guide must offer: the plugin's own four plus
* DSH 0.1.6's host-owned terminal and browser. This plugin deliberately ships
* neither of those, so exactly one entry each proves it is not shadowing the
* host. The ids are the guides' `data-sidebar-right-guide-entry` keys.
*/
const NATIVE_TABS = ['files', 'git', 'subagent', 'sidechat', 'terminal', 'browser'] as const
let api: APIRequestContext