Repository navigation
Replies: 2 comments
|
Adding a data point from a plugin that implements this for Git worktrees. I went with a UI-only variant that needs no change to the Workspace/Session domain rules. Each linked worktree stays its own DSH Workspace, so I patched
The result in the sidebar: Compared with the |
|
Agree with the domain-layer The menu-reuse gap is already solved on 0.2.2; the grouping layer is notOn 0.2.1-rc.5 (the current desktop build), the built-in Session row actions — fork, pin, archive, rename, copy id — are registered on the ctx.slots.inject('sidebar.workspaces', () => ctx.slots.register({
name: 'sidebar.workspaces',
children: {
'sidebar.workspaces.session.menu.item': { kind: 'list', scope: 'root', ... },
// ...
},
}, WorkspaceBrowser))So any plugin that replaces that region loses those entries: the slot is still declared, but the only renderer is gone. Searching the 0.2.1-rc.5 artifacts for On master / 0.2.2-alpha.2 the same actions were refactored into structured contributions: ctx.effect(() => ctx.contextMenus.register({
id: `session.${id}`, target: 'session', order, resolve,
}), `ui-workspace: ${id} menu`)Any plugin can now reuse the whole menu with That refactor is the precedent this proposal needs. What is still missing is the same kind of seam for grouping: today a plugin can only add a nesting level by replacing the entire browser, and once it does, the chrome the browser owns — search and session-content search, view options (group / order / archived filter), the Cost of shadowing
|
Uh oh!
There was an error while loading. Please reload this page.
摘要
DeepSeek Harness 目前把 Session 的执行目录(
cwd)和 Workspace 的展示归属绑定为同一个目录。这个约束使一个 Git 仓库下的每个git worktree都必须注册为一个新的 DSH Workspace;当开发者并行运行多个任务时,侧栏 Workspace 列表会迅速膨胀。建议保留现有单目录 Workspace 的默认语义,并增加一条受策略约束的关联路径:一个 Session 可以在 linked Git worktree 中执行,同时展示在其主仓库的 Workspace 下。它应是显式的
association,而不是放宽为任意workspaceId + cwd。这与 #5505 的多文件夹 Workspace 提案互补:#5505 解决一个 Workspace 聚合多个普通目录和多根权限;本提案解决同一个 Git 仓库派生出的隔离 worktree 会话如何保持一个侧栏归属。
问题
以仓库
/repo为例,开发者为三个并行任务创建:三个 Session 必须分别以这三个目录注册为 Workspace,才能让 Agent 真正在隔离的 worktree 中运行。这样虽然保证了文件隔离,但左侧会出现四个几乎同名的 Workspace(主仓库加三个 worktree),组织成本随并行任务数线性增长。
期望的交互是:侧栏只显示
/repo这一个 Workspace;其下的三个会话各自仍在对应的 worktree cwd 中运行。会话行可由插件显示一个 worktree 图标,悬停时展示目录、创建时的 base branch 和当前 branch。当前约束
现有行为不是纯 UI 限制,而是领域层不变量:
@deepseek-ai/dsh-api-session-controller的SessionCommandController.create拒绝同时传入workspaceId和cwd,并在给定workspaceId时将 cwd 设为workspace.path。@deepseek-ai/dsh-workspace的WorkspaceEntity只保留session.cwd === workspace.path的成员;attachSession()和每次持久化 mutation 都执行这一过滤。@deepseek-ai/dsh-client-ui-workspace只根据 Host 投影的workspace.sessionIds分组。因此即使插件暂时把 session id 写入记录,它也会在重载或下一次更新时消失。所以当前插件无法可靠实现该模型:先按 worktree cwd 创建 Session,再归入父 Workspace 会被领域层拒绝;用 DOM 改侧栏只会掩盖持久化问题。
建议的最小核心接口
1. 保留旧 API,增加显式关联字段
现有
workspaceId保持原义:Session cwd 必须等于 Workspace path。workspaceId + cwd仍然是非法组合,避免旧调用的语义悄悄改变。为受控的跨目录关联增加
association:SessionCommandController在创建 Session 后,把 association 交给 Workspace domain 做持久化归属;只有创建和归属都成功时才返回成功。若中间失败,错误需保留预分配的sessionId,以复用既有workspace-attach-failed的恢复模型。2. 在
@deepseek-ai/dsh-workspace中持久化关联类型WorkspaceRecord可以把每个成员的关联方式显式保存,例如:存量记录迁移为
same-path,继续要求session.cwd === workspace.path。对于linked-git-worktree,成员资格由对应策略校验,而不再用单一的路径相等判断。sessionIds的顺序与现有行为一致;一个 Session 仍只能属于一个 Workspace。这项改变要同时覆盖启动重建、实时 header 更新、mutation prune、archive、fork、预分配 session id、删除 Workspace 和 Session 排序,避免只修改
attachSession()导致重载后再次丢失成员。3. 策略校验应可扩展,而不是让 core 执行 Git 命令
建议由 Workspace domain 暴露一个
WorkspaceSessionAssociationPolicy注册表。linked-git-worktree的策略由 Git/worktree 插件在 Host 侧提供并验证:git worktree list --porcelain包含该 cwd;repositoryPath;repositoryPath等于目标 Workspace 的规范化路径。DSH core 无需引入 Git 依赖,也不会允许任意 cwd 被归入任意 Workspace。未知或未安装的策略必须拒绝新关联;已有无法验证的关联应保留诊断信息,并显示为不可用,而不能静默改为主仓库 cwd。
4. Capability 与客户端展示
建议发布一个明确 capability,例如
linked-session-cwd/v1。插件只有检测到该 capability 时,才开放“创建 worktree 但不新建 Workspace”;旧版 DSH 仍使用现有“每个 worktree 注册一个 Workspace”的兼容路径。为避免插件替换整个侧栏,
@deepseek-ai/dsh-client-ui-workspace可以在SessionNodeItem的标题与时间之间增加一个 multi slot,例如sidebar.workspaces.session.trailing。slot props 至少包含sessionId、cwd、workspaceId和 grouped/flat placement。worktree 插件用它渲染无副作用的图标与 HoverCard;行点击、拖拽、菜单和键盘树导航继续由ui-workspace持有。生命周期与失败语义
sessions.create({ cwd, association })。git worktree remove清理本次新建且未被引用的目录。验收建议
workspaceId创建与纯cwd创建的行为和持久化格式不变。cwd + association成功后,重启、刷新和任意 Workspace mutation 后 Session 仍属于父 Workspace,且 SessionHeader.cwd 仍为 worktree 路径。English TL;DR
DSH currently treats a session's execution directory (
cwd) and its Workspace membership as the same thing. That forces every Git linked worktree to become a separate Workspace, which makes the sidebar unusable for developers running several tasks in parallel.Please add an explicit, policy-validated association path: a Session may run in a linked Git worktree while belonging to the parent repository Workspace for sidebar organization. Keep the existing
workspaceIdbehavior unchanged and keepworkspaceId + cwdinvalid; addcwd + associationinstead. The Workspace domain should persist association kinds, validate them through an extensible policy registered by the Git plugin, and expose a capability such aslinked-session-cwd/v1. A small session-row trailing slot would let plugins display worktree metadata without replacing sidebar DOM.This complements, rather than replaces, #5505: that proposal is about multiple ordinary folders and sandbox roots; this one is specifically about grouped, isolated Git worktree sessions.
All reactions