[Feature Idea] 多文件夹工作区与 primary 文件夹(对齐 Codex 的项目模型) #5505
vincent-guo
started this conversation in
Ideas
Replies: 1 comment
|
目前支持了吗 ? 多根聚合 kiro codex 都是可以的 qoder等 是个非常实用的功能, 我也是搜索dsh是否有这个功能, 才发现已经有人提了, 就在这追踪了 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
[功能建议] 多文件夹工作区与 primary 文件夹(对齐 Codex 的项目模型)
摘要
DeepSeek Harness 目前把一个工作区(workspace)严格绑定到一个目录。本提案建议将工作区模型扩展为有序的文件夹列表,并指定其中一个为 primary,对齐 OpenAI Codex 桌面版已落地的多文件夹项目设计,同时保持现有「单目录」行为作为兼容默认值。
问题
真实项目很少只存在于一个目录里。一个典型任务往往横跨前端仓库、后端仓库和一个共享库。而目前 DSH 要求:
packages/workspace/workspace)——工作区是建立在唯一 canonical path 之上的持久记录;cwd,解析自workspace.path(见packages/api/session-controller/src/commands.ts);SandboxExecutionPolicy.workspaceRoot(见packages/sandbox/sandbox/src/index.ts)。因此跨目录工作只能依赖频繁的
danger-full-access升级,或复制/移动文件——两者体验都很差。Codex 的做法(参考)
Codex 把「组织」与「权限」分离,并且让每一层都可选:
AGENTS.md/skills/config.toml的自动发现都以 primary 为基准;secondary 文件夹可读可写可搜索,但不参与配置发现。参考:https://learn.chatgpt.com/docs/projects
建议的 DSH 设计方案
对齐 Codex app 模型,映射到 DSH 现有分层:
WorkspaceRecord从单一path升级为有序folders: string[](第一项为 primary)。存量记录在启动时一次性迁移为folders: [path]。唯一性不变量从「一个 canonical path 只属于一个工作区」扩展为「一个 canonical path 至多出现在一个工作区的文件夹集合中」(validateStoredState同步收紧)。cwd仍等于 primary path,保持SessionHeader不可变契约。成员资格校验从cwd === path放宽为cwd ∈ folders。变更 primary 只影响之后新建的会话;已有会话以当前文件夹集合作为可写范围。移除 secondary 只移除记录——文件与日志一概不动(与现有工作区删除不变量一致)。SandboxExecutionPolicy增加额外的可写根(workspaceRoot仍作为 primary,用于展示与相对路径)。writableRoots()——模式语义的唯一实现点——扩展为整个文件夹集合,并同步所有强制方言:Seatbelt、Bubblewrap、Landlock、Windows ACL(见packages/sandbox/sandbox-local),以及进程内文件系统 fence。逐调用升级(sandbox_permissions)保持不变。AGENTS.md/config 发现保持单一锚点:primary 文件夹(即会话cwd),对齐 Codex app 语义,避免多根合并的优先级与字节预算问题。secondary 仅提供读写与搜索。为什么这需要核心支持(插件边界)
按 CONTRIBUTING.md 的说明,生态路线是插件,而社区插件已经可以交付组织层(文件夹集合登记、primary 指定、侧边栏 UI)。但插件无法交付强制层:
ctx.sandbox是单实现 seam,且逐调用策略只携带一个可写根,secondary 的写入会退化为逐调用danger-full-access审批。因此本提案请求核心团队开放最小的 API 面——多根可写策略——同时社区插件可以先行承担组织层。备选方案
--add-dir):改动更小,但没有持久化与项目分组能力;保留为未来可能的会话级覆盖项。permissions):最灵活,但 profile 生成与 UI 成本显著更高;明确不在 v1 范围内(v1 中 secondary 与 Codex app 一致,可读写)。风险与迁移
roots.ts的文档明确)。English TL;DR
DeepSeek Harness currently binds one workspace to exactly one directory, while real work spans multiple repositories. Codex solves this with optional multi-folder projects: a project may attach 0..N folders with one designated primary (driving new chats and config discovery), secondaries are readable/writable/searchable but excluded from discovery, and chats work without a project at all. This proposal asks DSH to adopt the same model:
WorkspaceRecord.pathbecomes an orderedfolders[](existing records migrate automatically), a session'scwdstays the primary (preserving the immutableSessionHeadercontract),SandboxExecutionPolicygains additional writable roots across all four runners and the fs fence, andAGENTS.mddiscovery stays primary-only. The sandbox multi-root policy is the one API surface a plugin cannot reach (ctx.sandboxis a single-implementation seam); the organizational layer can meanwhile be carried by a community plugin.English version (full text)
Summary
DeepSeek Harness currently binds one workspace to exactly one directory. This proposal extends the workspace model to an ordered list of folders with a designated primary folder, mirroring the multi-folder project design OpenAI Codex shipped in its desktop app, while keeping today's one-directory behavior as the compatible default.
Problem
Real projects rarely live in a single directory. A typical task spans a frontend repo, a backend repo, and a shared library. Today DSH requires:
packages/workspace/workspace) — a workspace is a durable record over exactly one canonical path;cwdper session, resolved asworkspace.path(seepackages/api/session-controller/src/commands.ts);SandboxExecutionPolicy.workspaceRootinpackages/sandbox/sandbox/src/index.ts).Working across directories therefore means either frequent
danger-full-accessescalations or copying/moving files — both poor experiences.How Codex solves it (reference)
Codex separates organization from permissions, and makes every layer optional:
AGENTS.md/ skills /config.tomlall use the primary folder. Secondary folders are fully readable/writable/searchable but do not participate in configuration discovery.Reference: https://learn.chatgpt.com/docs/projects
Proposed design for DSH
Aligned with the Codex app model, mapped onto DSH's existing layers:
WorkspaceRecordgains an orderedfolders: string[]in place of the singlepath(first entry = primary). Existing records migrate once at startup tofolders: [path]. The uniqueness invariant extends from "one canonical path per workspace" to "a canonical path may appear in at most one workspace's folder set" (validateStoredStatetightened accordingly).cwdremains the primary path, preserving the immutable-SessionHeadercontract. Membership validation relaxes fromcwd === pathtocwd ∈ folders. Changing the primary affects only sessions created afterwards; existing sessions inherit the current folder set as their writable scope. Removing a secondary folder only removes the record — files and logs are never touched (same invariant as workspace deletion today).SandboxExecutionPolicygains additional writable roots (workspaceRootstays primary for display/relative-path purposes).writableRoots()— the single home of the mode's meaning — extends to the folder set, and every enforcing dialect follows: Seatbelt, Bubblewrap, Landlock, and the Windows ACL runner inpackages/sandbox/sandbox-local, plus the in-process filesystem fence. Per-call escalation (sandbox_permissions) remains unchanged.AGENTS.md/config discovery keeps a single anchor: the primary folder (the sessioncwd), matching Codex app semantics and avoiding multi-root merge/precedence/budget questions. Secondary folders are read/write/search only.Why this needs core support (the plugin boundary)
Per CONTRIBUTING.md, the ecosystem route is plugins, and a community plugin can already deliver the organizational layer (folder-set registry, primary designation, sidebar UI). It cannot deliver the enforcement layer:
ctx.sandboxis a single-implementation seam, and the per-call policy carries exactly one writable root. Secondary-folder writes would degrade to per-calldanger-full-accessapproval. This proposal therefore asks the core team to open the minimal API surface — multi-root writable policy — while a community plugin can carry the organizational layer in the meantime.Alternatives considered
--add-dirparity): smaller change, but no persistence or project grouping; kept as a possible future per-session override.permissionsparity): most flexible, significantly more work in profile generation and UI; explicitly out of scope for v1 (secondary folders read/write like Codex app).Risks / migration
roots.ts).All reactions