Skip to content

feat(storage): add centralized workspace storage plugin - #215

Closed
Grivn wants to merge 4 commits into
mainfrom
feat/issue-189-workspace-storage
Closed

feat(storage): add centralized workspace storage plugin#215
Grivn wants to merge 4 commits into
mainfrom
feat/issue-189-workspace-storage

Conversation

@Grivn

@Grivn Grivn commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

已按维护者要求改为 Core/Host 内置实现,由 PR #216 替代。新 PR 从最新 main 重新实现并重新完成测试;本 PR 的独立插件方案不再继续。
Superseded by PR #216, which implements the capability in the root Core/Host package from current main. This separate storage-plugin proposal is withdrawn; its branch remains for historical evidence.

摘要 / Summary

新增 dsh-mnemon-storage-workspaces 独立布局插件,通过 storageScope: workspaces 把四类数据存放在 <集中根>/workspaces/<规范路径 SHA-256>/,同时隔离不同项目。设置中的“记忆范围”提供“集中存储 · 按工作区隔离”及可选集中根目录,保存后实时生效。

Add a standalone storage layout plugin that keeps Runtime, Documents, Memory Spaces and state under one central directory with an isolated subtree per workspace. Its mode and optional root are configured together in Memory scope and apply live after Save.

  • 提供公开 MemoryStoragePlugin SDK 契约;Starter 消费无状态解析器,现有 Sources 继续持有数据。 / Public SDK layout contract, consumed by the Starter without another Cordis Entry or Source.
  • Sidebar 按查看工作区路由,Builtin/Headless 按所属会话 cwd;保留独立全局 USER.md 选项。 / Workspace-aware routing across Sidebar, Builtin and Headless, with optional global USER.md.
  • 更新只读存储清单、双语文档、changeset、独立制品验证和 CI。 / Updated inventory, bilingual docs, changesets and independent-artifact validation.
  • 修正新增插件的 changeset 判定:功能 PR 可保留待发布意图,正式版本 PR 仍要求版本前进和消费 changeset。 / New plugins can enter through a feature PR; versioned release gates remain enforced.

关联 Issue 或背景 / Related Issue or Context

Closes #189

涉及区域 / Affected Areas

  • Host 激活、Headless 或 bundle / Host activation, Headless, or bundle
  • 运行时记忆 / Runtime Memory
  • 项目档案 / Project Documents
  • 记忆空间或 Provider / Memory Spaces or Providers
  • 子 Agent 或 Agent 工作流 / Subagent or Agent workflow
  • Web UI 或对话交互 / Web UI or conversation interaction
  • 设置、存储或安全 / Settings, storage, or security
  • CLI、RPC、命令或工具 / CLI, RPC, commands, or tools
  • 安装、更新或发布 / Installation, update, or release
  • 测试、构建或文档 / Tests, build, or documentation
  • 其他(请说明)/ Other (explain below)

PR 类型 / PR Type

  • 面向用户的功能或行为变更 / User-facing feature or behavior change
  • Bug 修复 / Bug fix
  • 增强或优化 / Enhancement or optimization
  • 兼容性适配 / Compatibility change
  • 维护或重构 / Maintenance or refactor
  • 测试或构建 / Tests or build

最新代码确认 / Latest Codebase Confirmation

  • 我已基于最新 main 分支开发,或在提交前已 rebase 或合并最新 main。 / I developed from the latest main, or rebased or merged the latest main before submitting.

同步命令 / Sync command:

git fetch origin main && git rebase origin/main — isolated worktree, base a1c500a.

AI 编码披露 / AI Coding Disclosure

  • 完全 AI 编码:编程改动由 AI 产出,Codex 已自查并完成验证,等待维护者审查。 / Fully AI-coded: generated and checked by Codex; maintainer review pending.
  • 部分 AI 辅助:AI 帮助编写或修改了部分内容。 / Partially AI-assisted: AI helped write or modify part of the change.
  • 未使用 AI 编码辅助。 / No AI coding assistance was used.

使用的 AI 模型 / AI model used:

GPT-6

使用的编码 Agent 工具 / Coding Agent tool used:

Codex

仓库规范检查 / Repository Rules

  • 未修改 DSH 官方源码,未让 tsconfig 指向 DSH 源码 checkout,仅使用正式的 @deepseek-ai/* NPM 契约。 / I did not modify DSH source or point tsconfig at a DSH source checkout, and used only published @deepseek-ai/* NPM contracts.
  • Client 与 Host 边界仍以浏览器安全的 src/host/protocol.ts 为准,没有在两侧重复定义 wire DTO。 / The Client and Host boundary still uses browser-safe src/host/protocol.ts as the source for wire DTOs.
  • 持久化格式、RPC 权限、路径或凭据处理的变更包含兼容或拒绝路径、安全分析和相应测试。 / Changes to persistence formats, RPC authority, paths, or credentials include compatibility or rejection paths, security analysis, and tests.
  • 没有提交 token、密钥、私有记忆、未脱敏日志或生成的 lib/ 文件。 / I did not commit tokens, credentials, private memory, unredacted logs, or generated lib/ files.
  • 用户可见文案和长期文档已同步维护中文与英文版本,命令、配置键和路径保持一致。 / User-facing copy and long-lived documentation are synchronized in Chinese and English, with matching commands, configuration keys, and paths.
  • 会改变发布制品或其元数据的 PR 已添加 changeset;仅测试、CI 或站点文档变更可不添加。 / A PR that changes a published artifact or its metadata includes a changeset; test-only, CI-only, and site-documentation-only changes may omit one.
  • 新增和修改的代码、注释、文档、提交信息不含 emoji。 / New and modified code, comments, documentation, and commits contain no emoji.

兼容性与数据安全 / Compatibility and Data Safety

现有 globalworkspacecustom 布局及 legacy dataDir 行为保持兼容。集中根优先取 dataDir,否则取 MNEMON_DATA_DIR~/.mnemon;全局 USER.md 始终使用原全局根。已有符号链接别名通过 realpath 归一化;ID 为固定 64 位十六进制,拒绝非法路径,RPC 只接受 Host 登记或会话授权的工作区。只读清单不创建目录。

Existing modes and legacy configuration remain compatible. Central roots use the configured directory or the global default; global USER.md remains at the global root. Canonical absolute workspace paths produce bounded hash IDs; malformed paths and unauthorized workspace targets are rejected. Inventory remains read-only.

切换模式不移动、合并或删除旧数据。移动或重命名工作区会选择新 ID,需要显式恢复旧数据。ZIP Pack 仍只覆盖所选工作区;完整备份应包含整个集中根。远程 Provider 保留自身命名空间。回滚到不支持 workspaces 的旧版前,应先选择旧版支持的范围;新目录保留。

Switches preserve old roots. A workspace move or rename selects a new ID and requires explicit restoration. Packs cover the selected workspace; back up the whole central root for all workspaces. Remote Provider namespaces retain their own scope. Select a legacy-supported scope before rolling back to an older version.

本地验证 / Local Validation

执行的命令 / Commands run:

pnpm run verify
node scripts/verify-plugin-artifacts.mjs --skip-build
MNEMON_NATIVE_TEST_CLI=/opt/homebrew/bin/mnemon npx --yes --package=node@22.19.0 --package=pnpm@10.13.1 --call 'pnpm run verify'
CHANGESET_BASE_REVISION=$(git rev-parse origin/main) pnpm run release:intent
pnpm e2e:serve

结果摘要 / Result summary:

全部通过:最终 Node 22 全量验证包含根包 823 项、插件 320 项,共 1143 项;仅 Windows 专用测试因 macOS 环境跳过。类型检查、确定性构建、Headless、公开入口、包检查通过。17 个独立插件仓库和 18 个制品的独立安装、构建及测试通过;changeset 覆盖校验通过。

PASS: 1143 tests (823 root + 320 plugin), including the real Native CLI. Only the Windows-specific smoke test is skipped on macOS. Types, deterministic builds, Headless and package checks pass, as do 17 independent plugin repositories, 18 packed artifacts and release-intent coverage.

用户可见变更证据 / Local Feature Evidence

真实 DSH WebUI 验证了中英文及深浅主题、设置保存与路径校验、A/B 记忆和档案隔离、全局 USER、Provider 映射、Sidebar/Builtin、目录切换保留旧数据、重启恢复和 390px 运行时页面。 / Real DSH WebUI covered configuration, workspace isolation, global USER, Provider mapping, Sidebar/Builtin, root switching, restarts and narrow Runtime layout.

完整双语记录和 9 张截图 / Full bilingual record and nine screenshots · 脱敏磁盘断言 / Sanitized disk assertions

集中存储设置 / Centralized storage settings

B 工作区隔离 / Workspace B isolation

已记录的宿主限制:390px 设置弹窗内容过窄,Builtin 的会话宽度拖动条可能截获 Runtime Tab 中心点击,键盘可正常激活。未修改 DSH 源码。 / Recorded Host limits: cramped settings at 390px and a Builtin resize handle intercepting the Runtime tab center; keyboard activation works. No DSH source changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant