Two conflicts, both in the native tab adapter's per-session work — main's
`5c95002` moved the expansion set into the plugin store's session state while
this branch moved the RECORD identity to `sessionId::tabId`:
- `src/client/native/tab-adapter.tsx`: keep main's store-backed expansion as
the authority (`attachStore` / `syncExpanded` / `getSessionStates().expanded`)
and this branch's seat-scoped identity (`views` keyed `sessionId::tabId`,
`get/has/update/drop/versionOf/retain` take the seat session). `toggleExpanded`
keeps main's active-`reduce` / background-`reduceFor` split, but locates the
record by its seat and writes the SCOPE session's set — the set every view of
that session mirrors.
- `tests/native-surface.spec.ts`: main's five expansion cases adapted to the
session-scoped API (seat session on `ensure`, two-arg `get`/`drop`, seat on
`toggleExpanded`); the branch's cases now bind a store before toggling, since
expansion no longer lives in the record itself.
The `files` takeover guard and its registration invariants come from
main; this merge drops the branch's duplicate.
plugin 0.2.7 declares dsh-better-sidebar@^0.17.0 || ^0.18.0 and is
co-tested on better-sidebar 0.18.0 + DSH 0.1.2-rc.1, so the catalog
install line no longer needs the 0.17.1 stable-line pin.
Adds Andor-Z/dsh-turn-outline (turn-outline tab) to the ecosystem:
- README.md / README_EN.md tab-plugin table rows + header count 24 -> 26
(aligns with the actual row count, which was already 25)
- recommended-catalog entry in plugins-tabs.ts (npm install; better-sidebar
prereq pinned to 0.17.1 - stable-line policy, see the entry comment)
- pluginTurnOutlineName/pluginTurnOutlineDesc i18n keys across all 20
dictionaries (locales.ts zh/en + 19 locale chunks)
Resolve client preview paths against the session cwd. Limit the server file fallback to relative input and retain upstream absolute HTML path semantics. Cover nested assets, Windows/UNC paths, and external files with workspace shadows.
surface.activate() only returned records.has(tabId) without focusing, so
external plugins with multi-instance native tabs (dsh-sidenote's side
chats) could never bring an existing tab to the front programmatically.
Focus via ISidebarRight.focus (dsh >= 0.1.5), which focuses the tab and
its pane.
surface.close() now also returns the record's meta so service.closeTab
can hand it to descriptor.onClose — native closes previously dropped it,
leaving meta-driven lifecycle consumers (e.g. recently-closed records)
starved.
DSH 0.1.7 gives a tab TYPE the `keepMounted` switch: a marked body stays
mounted through hiding, tab selection and Session switches. That is exactly
what the plugin tried to fake with module-level memory, so declare it on
every plugin type (the descriptor types and the `files` takeover) and let
the host hold the component state — tree scroll, unsaved drafts, chip
renames — with no plugin-side memory at all.
With the bodies staying up, the per-session record registry from the
previous commit is what keeps co-resident sessions apart; both halves are
required, because a body may still be remounted by the host (type disposal,
session teardown) and the records must outlive that.
Verification on a real host (`scripts/e2e-mount.sh`: npm pack -> fresh
scratch profile -> real `dsh web` pinned to 0.1.7-rc.1 -> headless Chromium),
new lane `tests/e2e/tree-scroll.e2e.ts`: build state in conversation A,
switch to B, come back, and compare the whole observable vector (tree
expansion, scroll offset, chip title) — plus the negative half, that B does
not inherit A's state.
That lane also exposed a defect in the old one: it picked its "second
conversation" by row index, but the session tree's first row is a WORKSPACE
row and a seeded session with no messages takes no row at all, so the
"A -> B -> A" round trip was re-selecting the same session and every
assertion held vacuously. It now identifies sessions by
`data-row-key="session:<id>"` and creates a real second session through the
rail.
`tests/e2e/mount.e2e.ts` reaches the side-chat tab through its guide entry
now: with the record retained, the chip shows the thread's own title, so
the old `/Side Chat/` chip match no longer names it.
Docs: AGENTS.md records the two facts that must hold together, and
docs/plans/2026-09-25-native-tab-state-retention-keepmounted.md replaces the
park/archive design (PR #712) with this one.
Native tab ids restart in every session (`tab1`, `tab2`, …), and DSH 0.1.7
keeps a visited tab body mounted across hiding, tab selection and Session
switches, so several sessions' same-named tabs are alive at once. The
plugin's registry was a single-keyed map, which made the entering session's
body adopt the leaving one's record — and the leaving body's unmount cleanup
then delete it. The visible result was #636: after a conversation switch the
explorer stopped responding entirely (no request sent), in both directions.
Records are now filed under `sessionId::tabId`, and the seat session is
carried explicitly instead of inferred:
- `createNativeTabRecords` takes the seat session on `ensure`, and
`get/has/update/drop/toggleExpanded/versionOf` all take it too;
`retain(sessions)` reclaims the records of sessions that are gone;
- the title slot gets its own seat `sessionId` — the chip is drawn BEFORE
the body, so it used to read whichever record the live slot happened to
hold (another conversation's title on the switch frame);
- `SidebarSurface.update/has/activate` take an optional `sessionId`: with
one, it names the session; without, the mounted seat answers, a unique
match still resolves, and an id that names a tab in several sessions
resolves to none rather than guessing (writing into another conversation
is worse than refusing);
- `BetterSidebarService.updateTab` forwards it, and the six call sites that
know their own scope (EditorHost, SideChatView, ChangesTab,
tree-mutations) pass theirs.
Tests (native-surface.spec.ts, +8): per-seat-session identity (same-named
tabs stay apart, a patch/drop hits exactly one session, `retain` reclaims),
and surface resolution (explicit session wins, mounted seat is the
fallback, an ambiguous bare id is refused, close plus dead-session reclaim).
Each is red without this change.
`sync()`'s cleanup loop compared the live registrations against the
DESCRIPTOR list, which never contains the `files` takeover (its key is
`FILES_KIND`, not a descriptor id). Every store/service notification — a
Session switch is one — therefore disposed and immediately rebuilt it:
[native] DISPOSE type dsh-better-sidebar:files
[native] register type dsh-better-sidebar:files
Disposal unmounts that kind's body, so the explorer's own component state
(its scroll offset) was rebuilt on every pulse even when the plugin-side
record survived. Its lifetime really belongs to the editor type's switch,
which the loop below already handles; skip it in the cleanup pass.
Pinned by "keeps the files takeover registered across a Session switch
pulse": reverting the guard turns it red (`expected 2 to be 1` — 2 is the
rebuilt registration count).
Rebased onto #777 (`4099700`): the guard itself now lives on `main` — its
cleanup pass already skips `FILES_KIND` and releases through `disposeSafely`
— so what remains in this commit is the comment above that guard, recording
the second reason it is load-bearing (a re-registration on an already
inactive context orphaned the id), plus the regression spec below.