diff --git a/docs/external-plugin-guide.md b/docs/external-plugin-guide.md index cc36cd16..dfb36408 100644 --- a/docs/external-plugin-guide.md +++ b/docs/external-plugin-guide.md @@ -477,7 +477,7 @@ ctx.effect(() => { | id | order | single | hidden | 用途 | |---|---|---|---|---| -| `editor` | 10 | 否(按 path 去重) | 否 | 唯一「文件窗口」(编辑/预览 + 资源管理)。chrome 恒合并形态:路径输入框 + 编辑器控件 + 可开关内嵌文件树(全局搜索 `fs.search`;状态存 `tab.meta.treeOpen/treeWidth`)。`editorExplorer`:关(默认)= 按 path 新开,无路径窗口 = 纯资源管理器;开 = 树点击/Enter 经 `updateTab` 原地切换(id/meta 不变),无路径窗口 = 带 chrome 空窗口。树右键「在新 Tab 中打开」「在侧边打开」(pane 右侧 split)。新会话 seed 空文件窗口(`title:'Files'`);旧 `explorer` tab 经 `sanitizeState` 迁移。树 listing 与文件名搜索应用 `explorerExclude` 排除模式(editor 卡片齿轮弹窗可编辑;host 侧过滤,匹配条目彻底移除且永不阻塞折叠);单目录链折叠为 `a/b/c` 面包屑行(POSIX 隐藏与排除条目不计入唯一子项判定) | +| `editor` | 10 | 否(按 path 去重) | 否 | 唯一「文件窗口」(编辑/预览 + 资源管理)。chrome 恒合并形态:路径输入框 + 编辑器控件 + 可开关内嵌文件树(全局搜索 `fs.search`;状态存 `tab.meta.treeOpen/treeWidth`)。`editorExplorer`:关(默认)= 按 path 新开,无路径窗口 = 纯资源管理器;开 = 树点击/Enter 经 `updateTab` 原地切换(id/meta 不变),无路径窗口 = 带 chrome 空窗口。树右键「在新 Tab 中打开」「在侧边打开」(pane 右侧 split)。新会话**不 seed 任何页签**(右侧栏归宿主,插件只投 tab 类型;首开落在宿主开始页,即本插件接管的 `guideTakeover` 页面);旧 `explorer` tab 经 `sanitizeState` 迁移为无路径的 `editor` 页签(`title:'Files'`、`meta.treeOpen:true`)。树 listing 与文件名搜索应用 `explorerExclude` 排除模式(editor 卡片齿轮弹窗可编辑;host 侧过滤,匹配条目彻底移除且永不阻塞折叠);单目录链折叠为 `a/b/c` 面包屑行(POSIX 隐藏与排除条目不计入唯一子项判定) | | `git` | 20 | 是 | 是(本轮文件操作数) | 「Git」统一 tab(id 保留 `git` 以兼容持久化布局):**Git 视角**(Source Control:独立折叠的 Changes / Graph;Changes 内为多行 Message + 仅填草稿的 Generate、Merge Changes → Staged Changes → Changes(资源组也独立折叠,计数常驻标题最右,文件行整行 hover);Git 刷新仅留在 Changes 标题,外层本轮文件刷新保留;真实 parent hashes 泳道图;常驻底栏为可点击分支 + `*`/`+`/`!` 标记、upstream 的 behind↓ / ahead↑ 及安全 Pull-then-Push 同步;Push/Pull 与 worktree·子仓库选择移入 More Actions;提交只消费已暂存项,冲突/空消息/无暂存时禁止,草稿按会话·仓库·worktree 隔离)+ **本轮文件视角**(原 file-trace:模型读/写/编辑实时折叠,按操作时间倒序平铺、不按文件分组,每行「操作 → 文件路径 → 大小/时间」,支持类型筛选);会话事件经插件自有宿主路由 `changes.ops` 供给(live 日志优先、冷会话回放持久化记录,`afterSeq` 增量),primed 后用 `wait` 挂在宿主侧等下一个工具事件而不是重放整窗),badge 读 tab 轮询写入的同步缓存。页头使用宿主公开的 `@deepseek-ai/dsh-client-ui-primitives` 中的 `SegmentedControl`(36px 高度、主题 Token 样式;自动处理选中状态、ARIA 关系及左右方向键、Home/End 键盘导航)。两视角共用底部可拖拽预览面板(`tab.meta.lens/previewH` 持久化),diff 渲染统一走 `src/client/diff/`(`DiffRows`/`DiffFiles`:mod 配对 + 行内高亮 + 语法着色 + 上下文折叠);Git 目标可展开为独立 diff tab(落进工作台的 diff 分栏) | | `subagent` | 30 | 是 | 否 | 任务管理(工作流图/树、团队任务板、后台任务抽屉) | | `sidechat` | 35 | 否(`sidechat:`,按 `meta.threadId` 去重) | 否 | 侧边对话(默认共用一页;设置可切换「每个对话独立页」):共用页再次打开聚焦同一页并回到本会话最近线程;独立页每个线程一个原生 occurrence,按 contentId 精确恢复。打开即建空线程(首条消息赢得标签并同步标题);线程 = 插件自建子会话(种子继承父会话上下文,进行中回合以 `interrupted` 闭合;种子带合法 `subagent/descriptor`,SubagentView 按 `Side: ` 前缀过滤),`origin:'subagent'` 隐藏于主列表;走 `/sidebar/api/sidechat.*` 路由;头部菜单切换/重开(`parkSidechatReopen` + 确定性 id),关 Tab 释放 live agent;重开经 `collectOwnEvents` 回源到种子边界;「保存为新会话」= `session.fork`(`this` 敏感)。[设计文档](plans/2026-08-20-sidechat-tab-design.md) | diff --git a/src/prefs-shared.ts b/src/prefs-shared.ts index 963e23fd..0a3b9595 100644 --- a/src/prefs-shared.ts +++ b/src/prefs-shared.ts @@ -66,10 +66,15 @@ export interface SidebarPrefs { /** * Whether the editor tab runs in merged mode: a path input replaces the * plain header and a toggleable file-tree panel (with a global name - * search) docks at the tab's right edge. On by default; also makes brand - * new sessions seed an empty editor tab (tree panel open) instead of the - * explorer tab. The switch lives under the editor card's gear in the - * Side card settings; off restores the pre-merge editor exactly. + * search) docks at the tab's right edge. Off by default; on makes a tree + * click switch the open file in place (same tab id and meta) instead of + * opening another window. The switch lives under the editor card's gear in + * the Side card settings. + * + * This no longer seeds anything: since the plugin's own right panel was + * retired (the host owns the right column and its tab list), a brand-new + * session starts with no tab at all, and the host's start page — which this + * plugin takes over — is what the first open lands on. See `guideTakeover`. */ editorExplorer: boolean /** diff --git a/tests/e2e/blank-session-dock-entry.e2e.ts b/tests/e2e/blank-session-dock-entry.e2e.ts index 9053f955..c79edec6 100644 --- a/tests/e2e/blank-session-dock-entry.e2e.ts +++ b/tests/e2e/blank-session-dock-entry.e2e.ts @@ -80,3 +80,46 @@ test('a blank session keeps the bottom workbench reachable from the top-right en expect(pageErrors, 'uncaught page errors').toEqual([]) expect(consoleErrors, 'console errors').toEqual([]) }) + +/** + * Issue #1218: a brand-new session's right Sidebar must render this plugin's + * content on the FIRST expand — no host Split control in between. + * + * Every other lane expands the right column on a session that already has a + * message (the header corner is only drawn for a session with content), so the + * blank-session open path had no coverage. The start page is the plugin's + * `guideTakeover` chain replacement of the host guide body; the marker + * `[data-dsh-guide-grid]` exists only on the plugin's own grid, so a visible + * grid proves the takeover rendered rather than the host's shipped guide. + */ +test('a blank session renders the plugin start page on the first right-sidebar expand (#1218)', async ({ page }) => { + const pageErrors: string[] = [] + const consoleErrors: string[] = [] + page.on('pageerror', (error) => pageErrors.push(String(error))) + page.on('console', (message) => { + if (message.type() === 'error') consoleErrors.push(message.text()) + }) + + await page.goto(PAGE_URL, { waitUntil: 'domcontentloaded' }) + await expect(page.locator('#root > *')).not.toHaveCount(0, { timeout: 90_000 }) + await dismissOnboarding(page) + await page.getByRole('button', { name: /^(New session|新建会话)$/i }).first().click({ timeout: 30_000 }) + + // One click on the host's own control, and nothing else. + await page.locator('[data-sidebar-right-expand]').first().click({ timeout: 60_000 }) + + await expect( + page.locator('[data-sidebar-right-guide]'), + 'a freshly expanded blank-session surface shows the guide page', + ).toBeVisible({ timeout: 30_000 }) + await expect( + page.locator('[data-dsh-guide-grid]'), + "the plugin's start-page takeover owns the guide body on the first expand", + ).toBeVisible({ timeout: 30_000 }) + // A slot that failed to resolve draws a host "nothing here" notice instead of + // the grid; assert the pane holds no such error slot either. + await expect(page.locator('[data-sidebar-right-panel] [data-slot-error]')).toHaveCount(0) + + expect(pageErrors, 'uncaught page errors').toEqual([]) + expect(consoleErrors, 'console errors').toEqual([]) +})