dsh-workspace-sync
Manifest validAutomatically track and synchronize local project/workspace directory renames in DeepSeek Harness (dsh) via filesystem inode identity.
dsh-workspace-sync
Automatically track and synchronize local project/workspace directory renames in DeepSeek Harness (dsh) using filesystem inode identity (dev:ino).
English | 简体中文
Problem Solved
In DeepSeek Harness (dsh), renaming or moving a local project directory on disk breaks 4 independent layers because absolute paths are bound at creation time:
WorkingDirectoryService(@deepseek-ai/dsh-working-directory):session.header.cwdis immutable; once the folder is renamed,ensure()throwsworking-directory: directory does not existon every subsequent turn.WorkspaceRegistry(@deepseek-ai/dsh-workspace):WorkspaceRecord.pathstays on the old path, sidebar previews break, re-adding the renamed folder creates a duplicate empty workspace, and mutating a workspace whosesessionPathsstill point to the old path prunes existing sessions.WorkspaceFiles(@deepseek-ai/dsh-api-workspace-files):workspaceFileScopeTypert lookup resolvesheader.cwd, breaking file tree & document preview after rename.SandboxPolicyService(@deepseek-ai/dsh-sandbox-policy):resolve()returnssession.header.cwd, lockingworkspace-writepermissions to the obsolete path.
How dsh-workspace-sync Works
Without modifying DSH core source files, this plugin hooks into all four layers cleanly via Cordis:
- Persistent Identity Map (
$DSH_HOME/storages/workspace-sync.json): Observes directorydev:ino(viafs.stat(..., { bigint: true }), falling back tobirthtimeNsifinois 0). Supports both live renames and offline renames across DSH restarts, as well as transitive/nested renames. - Working Directory Follow: Wraps
workingDirectory.ensure&workingDirectory.setto locate renamed directories bydev:inoand migrate the session's active working directory seamlessly. - Workspace Registry Sync +
fs.watch: Watches workspace parent directories (non-persistent, debounced) and reconciles on startup and beforecreate/resolveByPath, updatingWorkspaceEntitypath & default title while preserving custom titles and allsessionIds. - File View & Sandbox Sync: Configures the official
workspaceFileScopeTypert lookup and wrapssandboxPolicy.resolve()so file previews andworkspace-writeboundaries follow the renamed directory immediately.
Installation & Usage
# Check DSH profiles status
node bin/dsh-workspace-sync.js status
# Link and enable in all local DSH profiles (~/.dsh/profiles/*)
node bin/dsh-workspace-sync.js install
# Uninstall from local DSH profiles
node bin/dsh-workspace-sync.js uninstall
Restart DeepSeek Harness (Desktop or Web) after running install.
Testing
node --test test/workspace-sync.test.js
Codex Issue Draft
See CODEX_ISSUE.md for the root-cause analysis and ready-to-submit GitHub Issue for openai/codex regarding its directory-recreation behavior (std::fs::create_dir_all on stale deny_write_paths / deny_read_paths).
简体中文
为 DeepSeek Harness (dsh) 提供本地项目文件夹重命名自动同步插件:
- 自动识别改名目录:通过文件系统底层
dev:ino唯一标识(持久化保存在$DSH_HOME/storages/workspace-sync.json),支持运行中改名与关闭重启后改名。 - 全链路四层同步:
- 会话工作目录:拦截
workingDirectory.ensure(),自动跟随改名后的新路径,彻底消除working-directory: directory does not exist报错卡死。 - 工作区列表与会话归属:监听工作区父目录变更并在启动/创建前自动对账,同步更新工作区路径及默认标题(保留自定义标题与全部历史
sessionIds,不会误删会话或产生重复工作区)。 - 右侧文件树与预览:通过官方
typert.lookups.configure("workspaceFileScope")实时映射到新路径。 - 沙箱写权限边界:同步更新
sandboxPolicy.resolve()返回的workspaceRoot,避免workspace-write拒绝写入新目录。
- 会话工作目录:拦截
安装与测试
cd "E:\dsh-workspace-sync"
node --test test/workspace-sync.test.js
node bin/dsh-workspace-sync.js status
node bin/dsh-workspace-sync.js install
安装后重启 DeepSeek Harness 即可生效。如需卸载可执行 node bin/dsh-workspace-sync.js uninstall。
Comments
Loading…