From 76961347f2f5ebf3afb243efab803c4eda42ba24 Mon Sep 17 00:00:00 2001 From: Grivn Date: Sun, 16 Aug 2026 17:15:22 +0800 Subject: [PATCH 1/2] feat: support headless profiles --- README.md | 16 ++- README.zh-CN.md | 16 ++- .../diagrams/en/project-architecture.svg | 2 +- .../diagrams/zh-CN/project-architecture.svg | 2 +- docs/en/architecture.md | 10 +- docs/en/configuration.md | 2 + docs/en/development.md | 6 +- docs/en/getting-started.md | 15 ++- docs/en/interfaces.md | 19 ++- docs/en/operations.md | 1 + docs/en/project-overview.md | 2 +- docs/zh-CN/architecture.md | 10 +- docs/zh-CN/configuration.md | 2 + docs/zh-CN/development.md | 6 +- docs/zh-CN/getting-started.md | 15 ++- docs/zh-CN/interfaces.md | 19 ++- docs/zh-CN/operations.md | 1 + docs/zh-CN/project-overview.md | 2 +- package.json | 6 +- scripts/verify-headless-profile.mjs | 116 ++++++++++++++++++ src/contracts.ts | 6 +- src/index.ts | 19 ++- tests/lifecycle.spec.ts | 18 +++ tests/live-runtime.spec.ts | 23 ++++ tests/plugin.spec.ts | 57 +++++++-- 25 files changed, 352 insertions(+), 39 deletions(-) create mode 100644 scripts/verify-headless-profile.mjs diff --git a/README.md b/README.md index 78a6a6f..6c6e9d7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ - **Cross-agent sharing**: Mnemon-enabled agents can read and reuse DSH's Mnemon Memory Spaces. - **Three cooperating tiers**: Runtime Memory, Project Documents, and Memory Spaces retain information at the right granularity. - **Supervised writes**: isolated memory subagents make semantic decisions; the Host enforces paths, permissions, capacity, locks, and revisions. -- **Native DSH experience**: a Sidebar workbench by default, turn memory, a Save-to-memory dialog, bilingual copy, and global themes. +- **Web and Headless**: a complete Sidebar workbench for interactive management, plus the same Agent tools, memory context, and cwd routing in one-shot Headless tasks. Current user instructions, repository files, and live tool results always take precedence over historical memory. @@ -56,15 +56,25 @@ Expand-Archive -Path $archive -DestinationPath $installDir -Force ### 2. Install the plugin +For the complete Web workbench: + ```sh dsh plugin --profile web add dsh-mnemon dsh --profile web ``` +DSH profiles have independent plugin rosters. Install it separately for one-shot Headless tasks: + +```sh +dsh plugin --profile headless add dsh-mnemon +dsh --profile headless "Check durable project context before answering this task." +``` + Use an absolute path for a local development checkout: ```sh dsh plugin --profile web add "link:/absolute/path/to/dsh-mnemon" +dsh plugin --profile headless add "link:/absolute/path/to/dsh-mnemon" ``` ### 3. Open Memory System @@ -79,6 +89,8 @@ New installations use `sidebar` by default. Click **Memory System** in the DSH s See [Getting Started](./docs/en/getting-started.md) for provider requirements and complete verification. +Headless has no workbench or conversation buttons. It still mounts Runtime context, Documents, Memory Space tools, lifecycle guidance, and supervised writes. With `storageScope=workspace`, its memory root follows the invocation directory. Because the process exits as soon as the one-shot Agent becomes idle, delayed background review is cancelled at shutdown; explicit or model-guided writes completed during the task remain durable. + ## One workbench, three memory tiers | Tier | Best for | How it reaches context | @@ -180,7 +192,7 @@ pnpm install pnpm run verify ``` -`verify` runs TypeScript checks, Vitest, a reproducible double build, and published-package validation. `lib/` is generated and intentionally not tracked. +`verify` runs TypeScript checks, Vitest, a reproducible double build, an isolated real Headless-profile activation check, and published-package validation. `lib/` is generated and intentionally not tracked. ## License diff --git a/README.zh-CN.md b/README.zh-CN.md index 3be1afb..6875032 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -16,7 +16,7 @@ - **跨 Agent 共享**:DSH 的 Mnemon 记忆体可以被其他支持 Mnemon 的 Agent 读取和复用。 - **三层协作**:运行时记忆、项目档案、记忆体各自保存适合自己的信息粒度。 - **受监督写入**:语义判断交给隔离的记忆子 Agent,路径、权限、容量、锁与 revision 由 Host 控制。 -- **DSH 原生体验**:默认 Sidebar 工作台、对话内回合记忆、存入记忆弹窗、双语界面与明暗主题。 +- **Web 与 Headless**:Web 提供完整 Sidebar 工作台;一次性 Headless 任务获得同一套 Agent 工具、记忆上下文和 cwd 路由。 当前用户指令、仓库文件与实时工具结果始终高于历史记忆。 @@ -56,15 +56,25 @@ Expand-Archive -Path $archive -DestinationPath $installDir -Force ### 2. 安装插件 +完整 Web 工作台: + ```sh dsh plugin --profile web add dsh-mnemon dsh --profile web ``` +DSH 各 profile 的插件清单彼此独立;一次性 Headless 任务需要单独安装: + +```sh +dsh plugin --profile headless add dsh-mnemon +dsh --profile headless "回答前先检查持久化的项目上下文。" +``` + 本地开发检出使用绝对路径: ```sh dsh plugin --profile web add "link:/absolute/path/to/dsh-mnemon" +dsh plugin --profile headless add "link:/absolute/path/to/dsh-mnemon" ``` ### 3. 打开记忆系统 @@ -79,6 +89,8 @@ dsh plugin --profile web add "link:/absolute/path/to/dsh-mnemon" 更完整的安装、Provider 要求与验证步骤见[快速开始](./docs/zh-CN/getting-started.md)。 +Headless 没有工作台和对话按钮,但仍会挂载运行时上下文、档案、记忆体工具、生命周期提示和受监督写入。`storageScope=workspace` 时,记忆根跟随启动命令所在目录。一次性 Agent 进入 idle 后进程立即退出,因此延迟后台审查会在关闭时取消;任务内已经完成的显式或模型引导写入仍会持久化。 + ## 一个工作台,三层记忆 | 层级 | 适合保存 | 如何进入上下文 | @@ -180,7 +192,7 @@ pnpm install pnpm run verify ``` -`verify` 依次运行 TypeScript 检查、Vitest、两次可复现构建和发布包校验。`lib/` 是生成目录,不再提交到仓库。 +`verify` 依次运行 TypeScript 检查、Vitest、两次可复现构建、隔离的真实 Headless profile 激活检查和发布包校验。`lib/` 是生成目录,不再提交到仓库。 ## License diff --git a/docs/assets/diagrams/en/project-architecture.svg b/docs/assets/diagrams/en/project-architecture.svg index b7dd765..005b559 100644 --- a/docs/assets/diagrams/en/project-architecture.svg +++ b/docs/assets/diagrams/en/project-architecture.svg @@ -1,6 +1,6 @@ dsh-mnemon runtime architecture - DSH Web, the root Agent, and tools and commands enter the dsh-mnemon control and supervision layer, which connects to Runtime Memory, Project Documents, and long-term Mnemon Memory Spaces. + DSH Web or Headless root Agents enter the dsh-mnemon control and supervision layer through memory context, tools, and commands, which connect to Runtime Memory, Project Documents, and long-term Mnemon Memory Spaces.