Commit Graph
1436 Commits
Author SHA1 Message Date
240xu eb37f933d3 fix(open-external): support Termux (platform android) openers
On Termux — the dominant Node runtime that reports process.platform
'android' — both external-open actions fell through to xdg-open, which
does not exist there, so 'reveal in file manager' and custom-scheme URL
opens failed silently (the spawn error is swallowed by design).

- revealCommand: case 'android' → termux-open on the containing
  directory (no desktop file manager and no select protocol on Android;
  same parent-dir KISS as the Linux branch)
- urlCommand: case 'android' → termux-open-url (the URL intent
  dispatcher; termux-open would route URLs through the content chooser)

Command builders stay pure — the platform remains injectable and the new
branches are unit-tested like every other platform.
2026-09-26 20:23:33 +08:00
Melvin 2e22b9004b fix(fs): give each fs.write a unique temp file to avoid concurrent-save corruption
fs.write 的临时文件名只含 pid,同进程内对同一路径的并发保存共享同
一个 tmp:两个 writeFile 会交错/相互截断,先完成者 rename 走 tmp
后,另一个 rename 必然 ENOENT 报错,或目标文件最终是两份草稿的字
节混合,而编辑器仍显示"已保存"。"open to the side"会为同一路径
开第二个编辑器 tab,窗口期真实存在。

对齐 writeWorkspaceUpload 的既有方案(fs-operations.ts):隐藏文件
+ randomUUID + .tmp 后缀,并给 writeFile 加 wx 标志。失败路径的
rm 也因名字唯一不再可能误删他人正在写的 tmp。

新增契约测试:同路径并发 fs.write 全部成功且文件内容必为其中一份
完整草稿。
2026-09-25 03:02:30 +08:00
Melvin b772e6c134 fix(state): dragging a pane's only tab onto its own edge no longer loses the tab
moveTabToEdge 对边缘 zone 先把 tab 从源窗格摘除:若源窗格因此清空,
removeLeafAt 会把该叶子从树上删除;随后的 insertLeafAt 再以同一 id
为目标时已找不到叶子,携带被拖 tab 的新叶子成为孤儿被整体丢弃——
tab 从会话中消失(未保存的编辑器草稿一并丢失),activePane 悬挂,
且布局在 200ms 防抖后把无 tab 状态持久化到 localStorage。

改为边缘 zone 先切分目标窗格、再摘 tab:insertLeafAt 完成后目标
叶子仍在树上(自身拖拽时以 target 副本保留原 id),摘除/清空删除
逻辑不变;center 路径行为保持原样。

新增回归测试:单 tab 自拖边缘(旧代码丢 tab,新代码原地切分)、
多 tab 自拖边缘(被拖 tab 进入新叶子,其余留在原叶子)。
2026-09-25 02:56:46 +08:00
user.email 7ed13e6760 fix(preview): resolve relative file paths against session workspace for html and media preview 2026-09-24 11:03:20 +08:00
Atlas Zeng d641d2e211 Merge pull request #758 from omdsh-dev/feat/v0.21.1-stable
chore(release): v0.21.1 —— 适配 DSH 0.1.7-rc.1 的正式版
v0.21.1
2026-09-24 00:03:33 +08:00
Menghuan1918 ab2246da47 chore(release): cut v0.21.1 as the stable adapter for DSH 0.1.7-rc.1
The rc.1 adapter first went out as 0.21.0-rc.1, but DSH 0.1.7-rc.1 is
upstream's release batch, so the plugin that targets it must not sit on a
prerelease channel. Re-cut it as v0.21.1: the version is now free of `-`,
so release.yml publishes it under npm's `latest` instead of `alpha`.

Version literals only — package.json, dsh.plugin.json and
SIDEBAR_SERVICE_VERSION (tests/service.spec.ts still pins the last two
together). No code change: the peer floor stays ^0.1.7-rc.1 and the
support line stays "DSH 0.1.7-rc.1 and later".

Docs follow the channel move: README/README_EN/guide drop the "alpha
channel" framing, the install command becomes @latest, and every older
DSH line now gets an explicitly pinned command in the version table
(@0.19.1 and so on) because `latest` no longer covers them. The rc.1
design record keeps its history and gains a §8 for the re-cut.
2026-09-23 23:58:59 +08:00
Menghuan1918 991c5a92e0 docs(readme): give the version table real install commands
The table named a version spec per DSH line; it now carries the command a
reader can copy, one row per DSH generation, pinned to the exact version
(`@0.19.1`, not `@latest`) so a row cannot rot when `latest` moves to a
newer stable cut.

The command form is the one every era of this plugin documented itself —
`dsh plugin --profile web add dsh-better-sidebar@<spec>` — and DSH's CLI
has had `plugin --profile` since 0.1.0-rc.8, so the old rows are accurate
rather than invented.
2026-09-23 23:55:23 +08:00
Atlas Zeng fad1b7383d Merge pull request #748 from omdsh-dev/feat/dsh-0.1.7-alpha.1
feat: 适配 DSH 0.1.7(0.1.6-alpha.2 → 0.1.7-rc.1)
v0.21.0-rc.1
2026-09-23 23:43:36 +08:00
Menghuan1918 3af8793434 docs(readme): spell out which plugin version each DSH version needs
Adds an explicit DSH-to-plugin table to the Installation section of both
READMEs, because "which version do I install" now has more than one right
answer: 0.21.0-rc.1 targets DSH 0.1.7-rc.1 and later, 0.19.1 is the cut for
0.1.6-alpha.2 and earlier, and the two 0.1.7 alphas have NO published plugin
at all (0.21.0-alpha.1 never reached npm), so those hosts must move DSH to
rc.1 first.

The peer column is included on purpose: it is a range, not an exact pin —
`^0.1.7-rc.1` already admits a later rc.2 or the stable 0.1.7, so upstream
shipping one does not require a new plugin version. Pinning the peer to an
exact 0.1.7-rc.1 would instead be actively harmful: DSH 0.1.7-rc.1's own
boot preflight silently disables any plugin row whose `@deepseek-ai/dsh*`
peers do not satisfy the running host.
2026-09-23 23:38:11 +08:00
Menghuan1918 819e0f2228 test: stop shelling out to ripgrep in the icon-export guard
`tests/primitives-exports.spec.ts` collected its file list with
`execFileSync('rg', …)`. ripgrep is installed on a developer machine but not
on the CI runners, so the whole spec failed to COLLECT there
(`spawnSync rg ENOENT`, which is why `ci` and `ci-windows` were red on this
branch while `pnpm test` was green locally). Replaced with a plain readdir
walk over `src/` and `tests/` — no external binary, and the scan is a few
hundred small files.

Verified by running the spec with a failing `rg` shim first on PATH: it
passes, which it cannot do while still calling ripgrep.
2026-09-23 22:36:05 +08:00
Menghuan1918 6805ab51a2 docs: record the 0.1.7-rc.1 adaptation and resync the user docs
New design record `docs/plans/2026-09-23-dsh-0.1.7-rc.1-adaptation.md`
(method, the version-bump-only delta, the code-card break and the mermaid
regression it exposed, the over-yield recovery, the live 3080 upgrade with
its boot-log findings, and the evidence — including the note that the
mount lane first ran against a stale tarball because `e2e_resolve_tarball`
picks the newest existing one instead of packing).

AGENTS.md §3 gains the rc.1 rules: the boot-time peer preflight (a new
§3.4 item 12) with its four gotchas, the vendor hoist lesson, and the
code-card/toolbarLabels contract. Two claims are corrected while we are
here: the guide's four-entry description cap was attributed to rc.1 but
`GuideBody.tsx` and the host's terminal guide entry are byte-identical
across alpha.1 / alpha.2 / rc.1, and the icon surface is 25 named imports
plus a type-only `IconProps`, not 26.

README / README_EN / guide: version, badges, peer floor, the pinned-DSH
advice (`alpha` is now 0.1.7-alpha.2 while rc.1 rides `next`), the reduced
refusal list, and the correction that npm `latest` is 0.1.5-rc.3.
2026-09-23 22:36:05 +08:00
Menghuan1918 1d01ad942c fix(editor): reclaim the nine formats DSH has no preview for
The alpha.1 handover refused 27 extensions so DSH's own document preview
could own them, but nine of those have NO host renderer at all: `avif` and
`ods` sit in `document/unviewable.ts`'s "known binary, no renderer" list
and get the unsupported empty state directly, while `xlsb` / `xlt` /
`xltx` / `xltm` / `ots` / `dot` / `dotx` fall through to the plain-text
body, fail the binary check and land on the same dead end.

Before that handover these files reached the plugin's `code` catch-all and
rendered the binary-download pane, so refusing them was a user-visible
regression we introduced ourselves — and rc.1 did not restore it. They are
claimed again (`fods` stays handed over: the host shows that flat XML as
plain text, which beats a download pane).

`canOpen` had zero test coverage, which is exactly why the regression went
unnoticed, so `tests/native-surface.spec.ts` now pins both directions:
every format the host renders must be refused, every format it cannot
render must be claimed. Reverting to the old list makes it fail with
`macro.xlsb: expected false to be true`.
2026-09-23 22:25:19 +08:00
Menghuan1918 bd11bad65c feat: adapt to DSH 0.1.7-rc.1
Move the support line from 0.1.7-alpha.1 to 0.1.7-rc.1 (peer floor
`^0.1.7-rc.1`). 0.21.0-alpha.1 never reached npm, and once the code-card
labels below are fixed the same build crashes on alpha.1 (its DiffBlock
still reads the `labels.files` upstream deleted), so declaring only the
host we verify against is the honest floor — and from rc.1 on the host
enforces peers at boot anyway: a row whose `@deepseek-ai/dsh-*` peers do
not satisfy the runtime is silently disabled.

Dependencies: 28 devDependency pins and 14 peers move to 0.1.7-rc.1.
rc.1 also raised the vendored runtime (cordis 4.0.4, schemastery 3.18.4,
cordis-plugin-group 1.0.4, cordis-plugin-include 1.0.9) and publishes DSH
cross-references as exact versions, so bumping schemastery/cordis alone
left four unmet transitive peers — the three vendor packages are hoisted
into devDependencies, which is what makes `pnpm peers check` clean again.

One compile break: rc.1 added `CodeToolbarLabels` (codeLabel / wrapLabel /
unwrapLabel, all required), made DiffBlockLabels / ReadBlockLabels extend
it and deleted `DiffBlockLabels.files`. Fixing SideChatView then leaving
markdown on the legacy banner would render two different code-card styles
inside one side-chat view, so the plugin adopts the card everywhere:
`markdownTextProps()` now passes `labels.code.toolbarLabels` with the
host's own wording (codeBlock.title|wrap|unwrap, added to all 20
dictionaries; `sideChatBlockFiles` retires with the deleted footer).

Adopting the card surfaced a silent regression the suite caught: the new
toolbar shows `codeLabel` for languages the highlighter does not know, and
mermaid has no shiki grammar, so the info string no longer reaches the DOM
and the banner-text probe in mermaid.tsx matched nothing — mermaid fences
stopped being swapped for diagrams. Detection now matches the FENCE BODY
from the source that produced the render.

`tests/market-manifest.spec.ts` pins every DSH peer as a floating caret
range: an exact pin (the devDependency style) or a comparator without a
prerelease would fail rc.1's preflight and silently stop the plugin from
loading, and `pnpm peers check` cannot see that — it validates the
resolved dev tree, not the range shape the host reads.
2026-09-23 22:24:56 +08:00
Menghuan1918 2d2d78f3f2 feat(meta): colourise the plugin artwork and say what it actually is
Two things the Plugins list made obvious once the icon rendered beside the
built-ins.

The artwork was flat: one blue panel, one darker blue rail. The built-ins
each carry their own two-hue palette — the file header says so outright
("these glyphs carry their own brand colors and gradients instead of riding
currentColor") — and at the 30px a row renders at, a single-hue mark reads as
a plain block. Three candidates were rendered next to the real built-in
artwork at the real sizes (30 / 36 / 72, light and dark) before picking one: a
violet rail sat too close to the panel's deep blue to read as a second colour,
and a pale teal panel washed out. The shipped pair is blue for the panel
(gradient) and teal-green for the rail (gradient), which stays legible at row
size and matches the Subagent artwork's proven blue/green combination without
sharing its silhouette.

The description sold the plugin as someone else's sidebar. It now leads with
what it is — better — in one sentence rather than a colon and a feature list,
in both locales, and both `package.json` (the npm blurb and the list's
fallback label) and `dsh.plugin.json` say the same thing. The README never
framed it that way, so nothing there changed.

The artwork guard gained the two properties this decision rests on: the mark
must be colourised (two gradients, no currentColor) and must not use a
CSS-only paint, since the icon ships as an <img> and the search artwork's
foreignObject technique would stay empty there. Red/green verified — a flat
single-hue redraw fails it.

Verified on the live 3080 instance: the row renders the new artwork and
"更好用的右侧边栏——文件树、编辑器、文件变动、任务和侧边对话都收在这一栏里,每个会话互不干扰。"
with no VSCode framing anywhere in the copy.
2026-09-23 20:46:11 +08:00
Menghuan1918 3ee2d40ff9 feat(meta): give the plugin the icon and locale DSH 0.1.7 shows in its list
0.1.7 reads `package.json#icon` plus `locale/<lang>.json` to illustrate and
label a plugin in the Plugins page and the `plugin_manager` list. The plugin
had neither, so it rendered as a bare row (and every other third-party entry
in this profile still does — ours is now the only one with a real mark).

The icon follows the two icons DSH ships for this feature
(packages/experimental/*/icon.svg): a 36x36, fill-only geometric mark with a
blue gradient and no stroked outlines or text. It reads as a panel with a
docked right rail — the sidebar this plugin is. The first cut used two blocks
separated by a gap, but the rail shared the panel's light tone at the top, so
the split leaned on a 3px gap that shrinks away at list size; a darker rail
flush inside one panel survives any downscale.

`locale/en.json` is the discovery baseline English needs to be present for the
whole directory to be read — and `locale/zh.json` carries the Chinese title
and blurb. The manifest's own `description` still advertised the terminal and
the browser, which this plugin handed to DSH in 0.20.0; it is now user-visible
as the fallback label, so it was corrected too.

Every failure in this feature is silent: bad metadata only ever degrades to a
plain text row. `tests/plugin-meta.spec.ts` therefore pins both ends — the
manifest wiring and the packed tarball — plus the house style of the artwork,
and was red/green verified (removing `icon.svg` from `files` fails it twice,
once against the real tarball).

Verified on the live 3080 instance: `readPluginMeta` resolves the icon to a
`data:image/svg+xml` URI and the page renders it (`ourIconExact: 1`, no page
errors).
2026-09-22 17:44:18 +08:00
Menghuan1918 97ef21fe09 docs: record the live 3080 upgrade findings (profile artifacts, install short-circuit, dead disabled-plugins.json) 2026-09-22 17:37:25 +08:00
Menghuan1918 99892b2131 fix(settings): wait for the loader before migrating the retired settings
The one-time import of a pre-0.1.7 `settings.yaml` section never ran. It
started from the `ctx.inject(['settings'], …)` callback, which fires the
moment the settings SERVICE appears — while the loader is still mounting
rows, so `describe()` does not list this plugin's own entry yet, the lookup
returns undefined, and the import bailed on "no form" without a trace.
Upstream's own migration waits (`ctx.root.loader.await()`); this does the
same.

That made every early return of the import invisible, which is how it went
unnoticed: the callback simply produced nothing. It now returns a named
outcome ('imported' / 'no-profile-home' / 'no-form' / 'already-configured' /
'no-legacy-section' / 'rejected') and the caller logs it — anomalies at warn,
the rest at info. The `loader` mirror's `await` is optional so a composition
without the cordis loader still reaches the import instead of aborting the
whole settings face inside the inject callback; the smoke fakes model it.

Verified on the live 3080 instance: after the upgrade the settings form
reports the user's real values back (autoOpenJobs false, workspaceFence
false, the nine-entry tabsEnabled map), where before it reported pure
defaults. The mount lane stays 7/7.
2026-09-22 17:35:29 +08:00
Menghuan1918 6586e3e2d3 feat: adapt to DSH 0.1.7-alpha.1 and yield the read-only previews
DSH 0.1.7-alpha.1 is 1299 commits past 0.1.6-alpha.2 and rewrites four
contracts this plugin was built on. The peer floor moves to
^0.1.7-alpha.1 (semver's prerelease rule means ^0.1.6-alpha.2 can never
match a 0.1.7 prerelease); 0.1.6-alpha.2 and earlier stay on v0.19.1.
Released as 0.21.0-alpha.1 (dist-tag alpha).

Hard breaks:
- dsh-settings was rewritten: register(ns, schema) is gone, a form is
  addressed by the plugin row's Loader entry id and read from the
  module's exported Config. The preferences are merged into Config and
  marked volatile — which requires DSH's own schemastery, because only
  that build wraps a volatile field in the cosmokit reference the
  loader's volatile commit walks. With the public package a settings
  write reports success and revision 1 while the effective value never
  changes.
- ui-primitives renamed its whole icon family (IconXxx14/16 ->
  IconXxxRegular/Medium): 26 imported symbols, 17 files. The failing
  mode is render-time, not load-time. Five call sites that relied on the
  old 14px default now pass size={14} explicitly.
- Session format v4 rejects source.kind === 'plugin'; the side-chat
  boundary injection now writes plugin:dsh-better-sidebar, the same kind
  DSH's own v3->v4 migration produces, so historical threads survive.
  Tool results moved to role 'tool' with top-level content/isError; all
  four parsers accept both shapes.
- The client session snapshot dropped subagentsByParent/jobsBySession
  and the on-demand subagent-catalog observation API. The Tasks page
  reads projectionsBySession and a new jobs.list route.

Yields and convergence:
- The read-only previews go to DSH's documentpreview (Office->PDF, a
  spreadsheet worker, zoom, per-directory refresh); editor.canOpen
  refuses those 26 extensions. Markdown, HTML (with its sandbox
  switches) and the editable code buffer stay.
- The host browser kind is desktop-profile-only now, so the web e2e
  lanes expect no browser entry and assert its absence.
- Link takeover claims only urlTarget links and passes the rest to the
  host, fixing a regression from the 0.1.6 round: the fallback pointed
  at a 'browser' type the plugin no longer registers, so http links in
  its own markdown did nothing.

Also fixed, found along the way:
- The file tree refreshes live (new directory watch over the plugin's
  own socket), since the plugin owns the `files` kind.
- ctx.sessions.list has no `current` field at either tag; the three
  readers were dead. They now use ctx.sidebarRight.mounted.
- package.json.files was missing lib/client-locale.js.
- Two genuinely dead call sites: sessions.openSubagent/open/
  refreshSubagents do not exist on the current baseline, so the
  topology click, the jump-back and the retry were all no-ops.
- The test harness window shim lacked addEventListener, which the 0.1.7
  primitives call at module-evaluation time; and the e2e token exchange
  needs Playwright's request stack, not Node's fetch.
2026-09-22 17:09:08 +08:00
6699ll 4100e16c73 fix(security): stop git operands parsing as options, and harden the API dispatch
Three small hardening fixes on the host half, all in the same request path.

1) git revisions were spliced into argv as bare operands, so a value beginning
   with `-` was consumed by git's OPTION parser instead of being treated as a
   revision. `git.show` with rev `--stat` (or `--output=…`) returned empty
   instead of failing, which silently blanked the Changes tab's diff/blame
   panes; `git.commit-diff`/`revert`/`cherry-pick` took the same shape. Adding
   `--end-of-options` before the operand ends option parsing.

   Chosen over a regex allowlist on purpose: the UI legitimately sends `:0`
   (git's index selector, used for the worktree side of a diff) and `<hash>^`,
   and users have branch names this code cannot enumerate. A whitelist would
   have to keep growing and would still reject valid refs; the sentinel is
   exact and needs no enumeration.

2) `GitCommandError` had no branch in `writeError`, so every ordinary git
   failure — unknown ref, path outside the repository, not a repository —
   surfaced as 500 `internal`. That reads as a plugin crash and meant the
   `not-repo` code (already defined in git.ts) and its localized copy were
   unreachable from every route. Non-repository now answers 409 `not-repo`;
   other git failures answer 400 `git-error`.

3) the `/sidebar/api` dispatch table is an object literal, so a bare lookup
   resolved `Object.prototype` members as handlers:

     POST /sidebar/api/constructor     -> 200 {}
     POST /sidebar/api/toString        -> 200 "[object Undefined]"
     POST /sidebar/api/valueOf         -> 500 internal
     POST /sidebar/api/hasOwnProperty  -> 500 internal

   Switched to `Object.hasOwn` plus a `typeof === 'function'` guard, so every
   one of those is the documented 404.

Verified:
- `tests/smoke.spec.ts` gains four cases. Three are red on the pre-change
  source (operand guard: `show(dir,'--stat',…)` returned content instead of
  null; dispatch: `constructor` answered 200; git status: 500 instead of 409)
  and green after.
- the fourth pins the `:0` index selector as a NON-regression, so a future
  tightening of the operand handling cannot silently break the diff UI.
- the repo's own `harden` regression is covered: `git.revert(dir, '--abort')`
  and `cherryPick(dir, '--abort')` now reject rather than being honoured.
- empirically re-verified against git 2.53.0 that every legitimate revision
  form still resolves (`HEAD`, `:0`, `<hash>`, `<hash>^`, `HEAD~1`) while
  `--stat` / `--output=nul` / `-n` are refused.
- the wire.ts -> git.ts import introduces no cycle (git.ts imports only node
  builtins) and both bundles build clean; typecheck / lint / build /
  check:consumer-types clean.
- `pnpm test:windows` 1351 passed, 4 failed — byte-identical to the clean-main
  baseline for those two files (pre-existing Windows environment failures).
2026-09-22 03:12:00 +08:00
6699ll c7c9e3c9d8 fix(security): sandbox SVG served by the media route
`/sidebar/file` served `.svg` as `image/svg+xml` with no `Content-Disposition`,
no `X-Content-Type-Options` and no CSP. An SVG is a scriptable DOCUMENT, so
navigating to that URL directly (a link, `window.open`, a popup opened by a
previewed page) executes its `<script>` in the GUI's origin — which has
same-origin access to `/sidebar/api/*`, the exact surface the request-trust
fence is there to keep a browsed page away from.

The sibling `/sidebar/html` route already defends this (its own comment calls
the sandbox directive "the previewer's security boundary even for top-level
loads"); the media route simply never got the same treatment, because most of
what it serves is inert.

Fix: mirror the html route for the scriptable type only. When the resolved
media type is `image/svg+xml`, add

    content-security-policy: sandbox; object-src 'none'
    x-content-type-options: nosniff
    referrer-policy: no-referrer

Scope note: `<img src>` embedding is unaffected — CSP applies to the document,
not to an image reference — so the editor's image preview (viewers.tsx renders
`<img>`) and markdown image rewriting keep working unchanged. The guard is
type-scoped, so PNG/JPEG/PDF responses are byte-identical to before.

Verified:
- `smoke.spec.ts` drives the real `/sidebar/file` route: the new case asserts
  200 + `image/svg+xml` + a `sandbox` CSP + `nosniff`, and is RED on the
  pre-change source (the CSP header is absent). A companion case pins that a
  PNG response gains no CSP, so the change cannot silently widen.
- the test helper now surfaces response headers (`invokeGetFull`), reusing the
  existing `invokeGet` for every other caller.
- typecheck / lint / build clean.
2026-09-22 02:48:43 +08:00
Menghuan1918 de99fd4cfb docs: record the 0.1.6-alpha.2 adaptation and resync the user docs
Adds the per-version adaptation record (docs/plans/2026-09-21-…-adaptation.md),
rewrites AGENTS.md §3 for the new baseline (the two silent contract breaks, the
terminal/browser handoff, the new official plugin-manager surface, the three
ui-primitives breaks, the widened primitives bare-import set), and updates both
READMEs and the integration guide for the v0.20.0 feature set.

Also retires the support text the terminal deletion made false: the install
flow is one step again (no build-script approval), the FAQ's two node-pty rows
collapse into one pointing at DSH's own terminal, the platform note no longer
promises prebuilt native binaries (there are no native deps left), and the
installers drop the -Repair mode and their allowBuilds writes along with
pnpm-workspace.yaml's now-empty allowBuilds block. Removes the dead
browserNoSandboxWarning locale key (its setting went with the plugin's browser)
and tightens theme.spec's capsule guard so a literal colour fails it.

The e2e resolver now refuses a PATH  that is not on the baseline line:
this machine's PATH  is 0.1.6-alpha.1, and running the mount lane against
it fails at 'the bundle was not registered' with a zero exit from the CLI —
a misleading dead end worth one explicit error instead.
2026-09-21 21:00:09 +08:00
Menghuan1918 5912274e41 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.
2026-09-21 20:35:11 +08:00
Menghuan1918 d60899841d chore(baseline): target DSH 0.1.6-alpha.2 and drop 0.1.5-rc support
The peer floor had to move: semver's prerelease rule needs a comparator on the
same [major,minor,patch] tuple, so `^0.1.5-rc.1` can never match any 0.1.6
prerelease. The floor becomes `^0.1.6-alpha.2` (which does admit 0.1.6 alpha/rc
prereleases and excludes 0.1.5), and `engines.dsh` follows. This is a deliberate
support-line break, matching how v0.19.0 dropped 0.1.2: 0.1.5-rc hosts stay on
0.19.1.

Three upstream changes actually reach this plugin and are adapted here:

- `IconSendOutline16` no longer exists in ui-primitives (only
  `IconSendOutline14`).
- `TerminalBlockLabels` gained a required `noExitCode` pill text.
- `ConnectionIndicator` dropped `reconnectLabel`: the outage label is now the
  one static label that already names the retry action, so the label copy moves
  there, matching the host's own '连接异常,点击立即重连'.

ui-primitives still declares no `dependencies` while its bundle bare-imports
more than it used to: `diff` and `simple-icons` were previously satisfied only
transitively and had to be hoisted into devDependencies, exactly like the
anser/shiki/katex group before them. `@deepseek-ai/dsh-code-runtime` is gone
upstream (the package no longer exists) and leaves the dev tree.

The e2e fallback npx spec is pinned rather than version-less: an unpinned
`npx @deepseek-ai/dsh` resolves npm's `latest`, which is still the 0.1.5 line
this plugin no longer supports.
2026-09-21 20:22:16 +08:00
Menghuan1918 58ba17d462 fix(native): meet DSH 0.1.6-alpha.2 guide-id and turn-tail contracts
DSH 0.1.6-alpha.2 made two plugin-facing contracts stricter, and both broke
this plugin silently:

- `SidebarRightGuideEntry.id` is now required and unique per provider. The
  native tab registrations sent guide entries without one, so the second kind
  collided on `undefined` and `SidebarRightTabRegistry.register` threw
  'duplicate guide entry id'. The throw happens inside `ctx.inject`'s callback
  body, which cordis swallows, so the whole native surface stayed empty with no
  symptom beyond a missing guide row.
- `conversation.chat.turnTail` changed from a `chain` to an additive `list`.
  The chain's `select` made one entry render and let this plugin REPLACE the
  host's produced-files row; a list cannot express that, and the registration
  now throws 'list slot ... requires options.id'. Upstream chose the list
  deliberately ('An additive list lets both plugins contribute without either
  knowing the other's data or rendering'), so the plugin's row can only ever
  duplicate the host's deliverables row -- which itself opens files through the
  host's openFile, i.e. into this plugin's editor. The contribution is removed
  and the row is the host's alone.

The file-opening half survives as `sidebar-file.ts` (the changes tab and the
editor host still use it), and `resolveSidebarPath` moves to the `paths.ts`
path-helper module beside its siblings. `registerNativeSurface` grows an
optional `reportFailure` so a future contract break reaches the visible
diagnostic strip instead of a silently empty guide, and one bad descriptor can
no longer take the remaining registrations down with it.
2026-09-21 20:18:16 +08:00
nanami 2bd72809d4 fix(editor): never save a truncated read over the full file (#732)
A text load truncated at readLimit only carries the file's first bytes,
but the editor still offered editing and saving on it: fs.write replaces
the whole file, so one Ctrl+S on a >512KB file silently destroyed
everything past the limit.

- render truncated documents read-only (EditorState.readOnly)
- guard save() against the truncated keymap path
- report `truncated` in EditorToolbarState and hide the save buttons
  (host header + the editor's own toolbar) while it is set
- show the truncation banner in preview mode too, so the read-only state
  is explained before any edit attempt
2026-09-21 02:14:46 +08:00
Nikolai Berezovskii 5c61f2d607 fix: match native panel toggle glyph size at 15px 2026-09-20 19:38:37 +03:00
Nikolai Berezovskii dd85ae5ef1 fix: reuse the native panel glyph for identical icon styling 2026-09-20 19:36:37 +03:00
Nikolai Berezovskii f852900e94 fix: use an outline divider for the bottom panel toggle 2026-09-20 19:27:45 +03:00
awoodwhale 630762ae32 feat(catalog): 推荐目录新增 dsh-agent-persona
在「侧边栏内容」的添加插件弹窗里新增一条 Tab 插件:dsh-agent-persona(人设)。

- 按工作区或会话分发 system prompt 人设,可标一条默认人设兜底;
- 该插件的「人设」Tab 通过本插件的 betterSidebar 服务注册,因此安装行先装 dsh-better-sidebar;
- 包已发布到 npm,安装行用包名即可,无需 git 形式;
- 同步 zh / en / ja 三份词典(新增 zh 键必须同步 ja,见 AGENTS.md §5)。
2026-09-20 16:28:17 +08:00
lipengfei bdbfad9f72 feat(plugin-list): add dsh-memory-delta to the recommended tab catalog
Adds one entry to the tab-plugin catalog (plugins-tabs.ts) plus the two
localized keys it needs in all 21 dictionaries, mirroring how the existing
entries are declared:

- id / install: dsh-memory-delta, pinned to the prebuilt v1.0.0 tag via the
  github: form (no local build needed — the package ships client/, src/ and
  cordis.patch.yml as-is)
- name / description: pluginDshMemoryDeltaName / pluginDshMemoryDeltaDesc in
  zh, en and the 19 third-language dictionaries (key sets stay equal to zh, as
  tests/locales.spec.ts asserts)

The plugin registers a read-only sidebar tab; better-sidebar is a soft
dependency, so without it the plugin still works and simply has no panel.

Note on the non-zh/en/ja translations: I wrote them myself; corrections are
very welcome and I will not object to a maintainer rewording any of them.
2026-09-20 09:54:26 +08:00
OrangeX4 10fbf3c61c docs: refine Tylina catalog entry 2026-09-19 12:14:10 +08:00
laoyh 61a3270eb0 fix(native): keep a link's url seed on the tab it opens
Clicking an external link opened the sidebar's browser tab with an empty address
bar. Three sites dropped the URL:

- `openTab` built the native surface's tab record from `path` and `diff` only,
  ignoring the seed's `url`.
- The native tab adapter did the same when minting a record on first open.
- Navigating a record that already existed stored the URL in `meta.url`, which
  no view reads.

The browser view takes its address from `tab.path` and writes navigations back
to that same field, so every path left the bar empty.

Each site now resolves `path ?? url` into `path`, and the dead `meta.url` copy
goes with the change that made it unnecessary. The comparison is parenthesised
deliberately: `??` binds looser than `===`, so the unparenthesised form sends a
present `path` into the empty-object branch and loses it — measured while
writing this change.

The bottom-workbench branch already resolved the url onto `path`; it is left as
it was.
2026-09-19 04:49:39 +08:00
OrangeX4 ac8c7eb446 feat: add Tylina tab plugin 2026-09-19 02:57:37 +08:00
User d5f958dc02 docs: add Markdown output link preview plugin 2026-09-18 18:20:27 +08:00
joyyoung e5a8b5faf5 fix(client): report a rejected sidebar sync instead of failing silently
The mount effect calls void sync() at boot and again on every
settings/document-updated replay. sync() runs setPrefs() and then mount(),
so any throw in that chain rejects the promise with no fail() log, no
error strip and no cleanup line: the panel simply never mounts and the
bottom toggle stays dead.

Seen in the wild across plugins: the native right-sidebar registry throws
'sidebarRight: tab kind ... is already registered (extension)', the throw
escapes through a store listener, setPrefs rejects and the whole sidebar
disappears without a single log line. Listener isolation (PR #652) covers
that entry point; this catch keeps every other sync() rejection visible on
the same last-resort strip the mount path already uses.
2026-09-17 15:26:26 +08:00
xun1241 ba34b5494f fix(sidechat): preserve non-default reasoningEffort and prevent stale effort leak
1. In parentModelSelection: respect header.adapterDefaults?.reasoningEffort, preserving explicit reasoningEffort in lastUsed and checking effort matching in sameSelection parity with DSH core.
2. In sidechat.start: explicitly clear childAgentOptions.reasoningEffort when parentSelection has no effort, preventing stale effort leak from parent.options.
3. Expand tests in sidechat-core.spec.ts and sidechat-routes.spec.ts.
2026-09-16 23:44:35 +08:00
xiaochaZ f74b60aa37 fix(native): 跨会话打开不再交给 openTabIn(),改为排队到上屏重放
对"本页从未显示过"的会话调用 openTab/openResource 时,打开会被静默丢弃:
runtime 只在该会话挂载过之后才 adopt 它的 rightbar store,而
openTabIn()/openResourceIn() 对这种会话是静默 no-op(不写、也不回报),
place() 却无条件 return true,于是 entry 永远进不了 pending,
flushPending() 也就永远不会重放它 —— 与模块头注释和指南 §0 承诺的
"目标会话未挂载时排队到上屏重放"相反。

- place() 对非在屏会话不再调用 openTabIn()/openResourceIn(),直接 return
  false 让 entry 入队,由既有 flushPending()(已订阅 session list)在该会话
  上屏时重放;在屏会话的路径不变
- 同步模块头注释与 NativeController 的成员说明(那两个面保留为将来宿主
  返回 boolean 时的接缝,closeIn 仍在用)
- 新增 tests/native-surface-cross-session.spec.ts 锁定该契约

关联 #694
2026-09-16 23:15:53 +08:00
xun1241 e51864d8d1 fix(sidechat): inherit the parent's CURRENT model selection, not its stale options snapshot (#368)
sidechat.start seeded the child with `agentOptions: { ...parent.options }`.
In DSH 0.1.5 those options freeze the creation-time deployment default: a
composer model switch appends a durable `model/selection` event and drives
requests through the session-local selection + the `agent/request`
waterfall, never rewriting `agent.options`. A side thread created after an
explicit parent switch therefore silently ran the deployment default
instead of the model shown in the parent composer (issue #368, still
reproducible on 0.19.1 since no release shipped a fix).

- sidechat-core: add `parentModelSelection()`, a host-side mirror of the
  core `modelSelection` projection (a pending `model/selection` is consumed
  by a same-route `request/header`; the view value is `pending ?? lastUsed`),
  the same replication pattern as `resolvePresetId`.
- sidechat-routes: inherit the projected route in the child's agentOptions
  (provider/model/reasoningEffort; a request-header effort is deliberately
  NOT adopted since it may be an adapter default the core selection getter
  does not honor) and stamp the durable descriptor with the same route.
  Behavior is unchanged when the parent log carries no selection state.
- tests: projection unit cases (pending adoption, same-route consumption,
  cross-route isolation, header fallback, malformed rows) and route cases
  pinning the inherited agentOptions/descriptor for a composer switch and
  for a header-only parent.
2026-09-16 20:31:14 +08:00
KannaKuron 5f74f38be1 fix(catalog): add the new keys to all 19 third-language dictionaries
The locale guard (tests/locales.spec.ts) keeps every shipped third-language
dictionary key-set-equal to zh. Adding pluginIdeGitName / pluginIdeGitDesc to
zh and en alone left ja and the other 18 dictionaries two keys short.
2026-09-15 20:25:42 +08:00
KannaKuron 1c8f442096 feat(catalog): add dsh-ide-git to the tab plugin catalog
- One PluginEntry plus its two i18n keys (zh/en), in catalog order.
- dsh-ide-git is published on npm (0.4.2) and treats dsh-better-sidebar
  as an OPTIONAL peer: without it the plugin registers into DSH own right
  sidebar (ctx.sidebarRightTabs + the keyed sidebar.right.pane.tab seat),
  so the install line carries no prerequisite.
2026-09-15 20:16:09 +08:00
Pluto-Yt 32e8f56c4a fix(trust-fence): accept a bfcache-restored image with a stale cross-site marker
Chromium can restore a same-origin image subresource from bfcache while the
request still carries `Sec-Fetch-Site: cross-site`. The fence refused every
cross-site marker outright, so /sidebar/file answered 403 and the image
preview stayed blank until the tab was reloaded. Reproduced on a real
`dsh web` instance: the same URL returns 200 image/png normally and 403 once
the cross-site marker is present with no Origin.

The exception is deliberately narrow — GET /sidebar/file only, browser image
subresources only (`Sec-Fetch-Mode: no-cors` + `Sec-Fetch-Dest: image`), and
the unforgeable Referer must name the request's exact authority. `Sec-Fetch-*`
and `Referer` are forbidden request headers, so a foreign page cannot forge
them. API requests, non-GET media, non-image subresources, CORS image reads,
foreign/look-alike/malformed Referers and Referer-less requests stay refused,
and the existing Origin hostname check is unchanged.

tests/trusted-hosts.spec.ts covers the accepted loopback and trusted-remote
cases plus the refusal matrix over real GET /sidebar/file requests.
2026-09-15 10:47:30 +08:00
suiyideali e2f53df484 feat(editor): 编辑器内查找——接入 @codemirror/search(Cmd/Ctrl+F)
- src/client/TextEditor.tsx: 共享扩展表新增 search({top:true}) + keymap.of(searchKeymap)
  (Mod-f 打开、面板固定编辑器顶部、Mod-g / Shift-Mod-g 下一个 / 上一个、Mod-Alt-g
  跳转到行、Escape 关闭)。搜索扩展与代码 / markdown 两个 viewer、只读「预览」与
  编辑模式共用同一份扩展表,不存在仅可编辑的分支;search 注册在编辑器自有 keymap
  之前,Escape 优先关面板(面板未开时 closeSearchPanel 返回 false,仍回落到
  simplifySelection),保存键 Mod-s 位置与优先级不变。
- src/client/cm-search.ts(新增): 面板 chrome 走 --dsw-* 令牌(CodeMirror 自带
  面板按 &light 上灰白配色,深色皮肤下会浮出一个白框);phrases facet 放进
  Compartment,语言切换就地 reconfigure(文档 / 撤销历史 / keymap / 滚动不动)。
- i18n: 新增 15 个 search* key——zh/en 在 locales.ts,其余 19 份词典全量补译
  (tests/locales.spec.ts 的 key-set 相等断言);locales.ts 新增 localeSignature(),
  TextEditor 同时订阅 DSH locale 与 better-locale override(tab-cell memo 不比较
  override,只靠父组件重渲染会漏掉 ja 切换)。
- README / README_EN: 快捷键表各加一行「文件内查找 / Find in file」。
- tests/editor-find.spec.tsx(新增): 扩展含 search keymap、Mod-f 开顶部面板、
  Escape 关闭、语言热切换后重开面板文案跟随、Mod-s 保存键仍生效。
- tests/e2e/mount.e2e.ts: 打开 seed 文件后补 Ctrl/Cmd+F → .cm-search 面板可见、
  Escape 关闭的真机断言(真实 Chromium + 懒加载 client-editor.js chunk)。

背景:package.json 里 @codemirror/search 一直是死依赖(src 零 import),编辑器
没有任何查找面板——Cmd+F 不被 CodeMirror 接管,长文件里浏览器原生查找只能命中
已渲染的行。本次只接入文件内查找,终端搜索(@xterm/addon-search)另开 PR。
2026-09-15 10:42:46 +08:00
Kunping Wang b71d4e669b fix(editor): 保留文本文件原始编码 2026-09-14 15:38:52 +08:00
Kunping Wang a0fd003e98 fix(open-with): 收窄 WSL Remote URL 正则捕获 2026-09-14 15:30:56 +08:00
Kunping Wang 5a733e91f1 fix(open-with): 支持 WSL 外部打开操作 2026-09-14 15:30:21 +08:00
ymac 43a209939c fix(diff): count a rewritten line once in the +n/-m chips
diffStats counted ROWS, treating every `mod` row as both an insertion and
a deletion — but pairMods turns one rewritten line into two `mod` rows
(one per side), so a single-line rewrite reported +2 -2. Neither reference
agrees with that: `git diff --numstat` says 1/1, and the renderer draws
exactly one `-old` plus one `+new` line for it.

Count sides instead: an `add` row, or the new side of a `mod` row, is one
insertion; a `del` row, or the old side, is one deletion. On the commit
that surfaced this (taktop_redo 8b4b933) the changes-tab header read
+3300 -2 while `git show --shortstat` printed "3299 insertions(+),
1 deletion(-)"; it now reads +3299 -1, and CURRENT_STATUS.md's chip reads
+8 -1 against numstat's `8 1`. The session-op lane (the same function over
diffLines rows) moves to the same accounting.

tests/diff-rows.spec.ts replaces the "mods on both sides" expectation
(5/4 -> 3/2 for the same fixture) and adds a single-line-rewrite case plus
a session-op case.
2026-09-14 00:11:40 +08:00
ymac e4b189b7b5 fix(diff): name the rows git sends without ---/+++
git emits no ---/+++ for a binary file, a pure rename and a mode-only
change, and parseUnifiedDiff only ever read paths from those two lines.
The section therefore kept oldPath/newPath === '', so DiffFiles drew a
header carrying just the binary badge and no file name (sandwiched
between two .md rows, which is exactly how it reads as if those .md files
were the binary ones), and a pure rename / mode-only change collapsed to
an empty disabled button (no path, and fileTag cannot see a rename).

Recover the paths in order of authority: ---/+++ when present, else the
section's own `rename from|to`, `Binary files A and B differ`, or the
`diff --git` header. Only the mode-only shape needs the last one: it takes
the ` b/` whose two sides name the same file, and leaves the path empty
rather than guessing. ---/+++ values also lose the TAB git appends to a
spaced path, and decodeGitPath undoes git's C-quoting so diff text from a
default-quotePath source still renders the real file name.

runGit gains `-c core.quotePath=false` for the same reason at the source:
git's default turns a space/CJK path into an octal-escaped quoted string,
which every diff surface then renders as the file name. The `-z`-framed
porcelain callers are unaffected (git never quotes NUL-framed output).

Verified against taktop_redo 8b4b933, the commit whose three .jpg rows
rendered as bare badges: all three now carry their full path, and real git
output for space/CJK paths parses with no escapes and no trailing TAB.
New tests: tests/diff-binary-row.spec.tsx (rendered rows) and the path
matrix in tests/diff-rows.spec.ts; tests/git-spawn.spec.ts now derives the
subcommand from runGit's prefix instead of counting its flags.

tests/git.spec.ts had pinned the empty path (`oldPath === ''`) as the known
behaviour of a mode/rename-only section; it now asserts the recovered paths
instead, and the binary section there asserts its own name too.
2026-09-14 00:08:38 +08:00
Menghuan1918 da11815574 fix(sidechat): clear the child inbox after create — the fork markers alone do not fence the runtime inbox
The long-conversation queued-input leak: a side thread seed carries the
parent unclaimed agent/inbox/spliced events, and although the fork-marker
pair (isSeeded + inheritedEventCount, v0.18.1) cuts Session.ownEvents(), the
RUNTIME inbox path — ReactLoopInbox.current() -> ctx.sessionProjections
.stateOf() -> SessionProjectionRegistry.cellFor — folds snapshotEvents(), the
FULL log including the inherited prefix (the standard inbox projection init
ignores inheritedEventCount, and the registry session/created eager init
skips every seeded session since seq != 0). The phantom input stays live in
the child inbox, and the first side prompt claim drains next-step before the
turn message — the stale queued content reaches the model before the
boundary + question.

Fence: call handle.agent.inbox.clear() right after agents.create resolves,
before any inject/followup (public API; the compensating splices are the
child own durable events, so a cold resume folds to the same empty state;
the driver only claims on wake and nothing has been sent yet — no race).

Tests: sidechat-routes.spec asserts clear() ordering ahead of the first
contact on both create branches; sidechat-seed-validation.spec now also
drives the REAL SessionProjectionRegistry — one test pins the upstream hole
(markers alone leave the phantom live: if a future DSH makes the projection
fork-aware it fails on the pin bump and the fence can be dropped), one
proves clear() compensations empty it. Known limitation: threads created by
pre-fix versions still leak on cold resume (resume-path clearing would eat
legitimately queued input).
2026-09-13 23:36:24 +08:00
ymac 8a43f13528 fix(native): draw a file tab's glyph from its address, not its record
The chip resolved a file tab's icon from the plugin-side record only. That
record is minted by the tab BODY's render — one commit AFTER the chip first
draws — and it is dropped again when the body unmounts, so every newly
activated file tab rendered its descriptor's generic glyph (for the editor
that is the folder artwork) while the inactive tabs, re-rendered later with
the record in place, showed the right file icon: selecting a tab flipped it
to the folder glyph, selecting the next one restored the previous tab's
icon. Measured on a real `dsh web` + the reporter's profile, chip inner
HTML: the selected file chip carried `<FileTypeIcon kind="folder">`, an
inactive one carried the host's file artwork.

The title registration now receives the same address-derived `paramsOf` the
body gets, and the chip reads `record.tab.path ?? paramsOf(info)?.path`:
the record still wins (an in-place switch stores the path there, and a
page kind's address cannot carry it), while a file address makes the glyph
independent of the record's lifetime.

Verified: tests/native-tab-chip-icon.spec.ts (new) is red against the
unfixed code on the address case and green with the fix; the existing
native-surface chip tests (19) and service (60) still pass.
2026-09-13 18:36:46 +08:00
eeeeeeaaaa12 21c4922b08 test: pin the session-relative path resolution in fs.write (#646)
Covers relative-path resolution, absolute-path passthrough, and workspace fencing.
2026-09-13 13:16:13 +08:00