Bundle
dsh-fixed-new-session-model
固定新会话默认模型与 Agent 预设模式,并支持按工作区独立绑定
- Source
- chenyangcun
- License
- MIT
- Updated
- Updated 2 days ago
Readme
# dsh-fixed-new-session-model
中文 | [English](README.en.md)
[](https://www.npmjs.com/package/dsh-fixed-new-session-model)
[](https://github.com/chenyangcun/dsh-fixed-new-session-model)
为 DeepSeek Harness(DSH)固定新会话的默认 Agent 预设与模型,并支持按工作区设置独立规则。
打开 **设置 → 默认模式与模型**,即可在一个页面中完成全部配置。

每个工作区都可以跟随全局默认值,也可以绑定自己的预设与模型。

## 安装
```sh
dsh plugin --profile web add dsh-fixed-new-session-model
```
安装完成后重启当前 DSH Web 进程,然后打开 **设置 → 默认模式与模型**。
从源码安装或参与开发时,可以在仓库目录执行:
```sh
dsh plugin --profile web add .
```
## 你会得到
- **稳定的全局 Agent 预设**——未配置工作区独立规则时,新会话始终使用指定预设
- **稳定的全局模型**——固定提供方、模型 ID 与推理等级,不受会话内临时切换模型影响
- **工作区独立规则**——可以为每个工作区指定专属的 Agent 预设与模型
- **按字段继承**——只覆盖预设并让模型跟随全局,或者同时配置两者
- **自动应用**——创建工作区会话或复用已有空白会话时自动应用匹配规则
- **保护已有会话**——已经产生对话内容的会话不会被后台规则强制切换
- **原生设置界面**——直接在 DSH 设置页编辑、查看和恢复规则
## 使用
1. 打开 **设置 → 默认模式与模型**。
2. 在“全局默认设置”中选择 Agent 预设、提供方、模型和可选的推理等级,然后保存。
3. 某个项目需要不同配置时,切换到“工作区独立配置”。
4. 选择目标工作区和预设;模型可以跟随全局,也可以绑定工作区专属模型。
5. 新建会话或切换到该工作区的空白会话,插件会自动应用对应配置。
“恢复跟随全局”会删除当前工作区的独立规则,不会修改全局配置。
## 配置优先级
```text
工作区独立配置
↓ 未显式配置的字段继续继承
插件全局默认配置
↓
DSH 原有默认配置
```
Agent 预设与模型分别继承。例如,可以让某个工作区始终使用 `standard-codex`,同时让模型继续跟随全局选择。
## 工作原理
- Host 插件注册 `workspace-defaults` 设置结构,并阻止会话内临时模型选择覆盖已保存的全局默认值。
- Web 客户端通过原生 `settings.section` 注册设置页面。
- 创建工作区会话前,插件会把匹配到的 Agent 预设注入 `session.create`。
- DSH 复用工作区空白会话时,插件会在打开会话前同步预设与模型。
- 全部规则复用 DSH 原有设置系统;插件不会创建独立数据库或凭据文件。
| 设置命名空间 | 保存内容 |
| --- | --- |
| `agent-presets` | 全局 Agent 预设 |
| `agent-default-model` | 全局提供方、模型与推理等级 |
| `workspace-defaults` | 各工作区的独立规则 |
## 兼容性
本插件支持标准版 DeepSeek Harness(DSH),当前已在以下环境验证:
- `@deepseek-ai/dsh` `0.1.1-rc.2` 与 `0.1.2-rc.1`
- 标准 Web Profile
- npm 安装与本地 `link:` bundle
插件通过 DSH 的 Settings、Remote 和模型选择服务工作。升级 DSH 后,请重新在 Web Profile 中执行 `pnpm install`,并确认设置项仍能正常加载。
## 安全
- 不读取或存储模型 API Key
- 不向外部服务发送网络请求
- 只使用 DSH 自身的设置、会话、工作区、预设和模型选择接口
## 开发验证
```sh
node --check index.js
node --check lib/client.js
npm test
npm pack --dry-run
```
## 许可证
[MIT](LICENSE)
欢迎通过 [Issues](https://github.com/chenyangcun/dsh-fixed-new-session-model/issues) 反馈问题或建议。
Install
dsh plugin --profile web add github:chenyangcun/dsh-fixed-new-session-model#004cada0a9abd9fe6ec32fe401718cd82a83d612
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-fixed-new-session-model from the hub