@lienze/dsh-subagent-model-policy 0.0.0-stage → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.md +81 -2
- package/README_en.md +82 -0
- package/client.js +1271 -0
- package/cordis.patch.yml +3 -0
- package/icon.svg +1 -0
- package/index.js +810 -0
- package/locale/en.json +1 -0
- package/locale/zh.json +1 -0
- package/management.js +673 -0
- package/package.json +74 -4
- package/policy.js +119 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
本项目遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/) 的结构,版本号遵循 SemVer。
|
|
4
|
+
|
|
5
|
+
## [0.3.0] - 2026-11-09
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- 名称统一为「子智能体模型选择策略」/ `Subagent Model Policy`;npm 包名由 `@lienze/dsh-subagent-policy` 改为 `@lienze/dsh-subagent-model-policy`,安装与升级需使用新包名。
|
|
10
|
+
- 插件显示名与 README 标题同步更新;面板标题此前已使用同一名称。
|
|
11
|
+
- 补充发布元数据:`repository`/`homepage`/`bugs` 指向公开仓库,`keywords` 含插件市场识别用的 `dsh-plugin`,`engines.dsh` 声明最低宿主版本;npm 页面可直接跳转源码仓库。
|
|
12
|
+
- 增加英文说明 `README_en.md` 与顶部语言切换条;`files` 收录英文说明,新增 `npm run verify` 聚合语法检查、测试与打包预检。
|
|
13
|
+
|
|
14
|
+
### 兼容说明
|
|
15
|
+
|
|
16
|
+
- 存储域 `lez_subagent_policy`、命令 `/subagent-policy`、工具 `subagent_policy` / `delegate_with_policy`、内部 bundle id 与样式前缀保持不变;已保存策略与执行记录在新包名下继续可读。
|
|
17
|
+
- 旧包 `@lienze/dsh-subagent-policy@0.2.0-rc.1` 保留可查,迁移时改用新包名重新安装。
|
|
18
|
+
|
|
19
|
+
## [0.2.0-rc.1] - 2026-11-06
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- 三页面板:选择策略、模型池、执行洞察;策略开关与新会话默认开关行。
|
|
24
|
+
- 固定模型与 Agent 自选两类策略;旧版跟随策略只读兼容,显式保存时转换。
|
|
25
|
+
- 模型能力卡、宿主下发思考等级、模型池候选刷新与失效引用清理。
|
|
26
|
+
- 会话级并发子智能体数量与最大递归深度限制,宿主容量实时读取与门禁。
|
|
27
|
+
- 当前启用策略与新会话默认来源的删除保护。
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- 保存启用中策略、模型池说明与会话限制后,新内容在下一次主模型调用时生效;不再区分「保存并应用」。
|
|
32
|
+
- 设置新会话默认静默更新开关摘要,不弹顶部提示。
|
|
33
|
+
- 详情页提示在返回列表或切换页面后清除。
|
|
34
|
+
- 正常选择策略页隐藏宿主诊断与原生入口提示;诊断数据仍保留在快照。
|
|
35
|
+
- 「刷新候选」与全选/取消全选同一行;移除常驻「刷新服务端状态」按钮,面板重新可见时静默重读。
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- 旧版策略生效期间的池说明同步进入下一次注入。
|
|
40
|
+
- 无改动保存启用中策略不再先触发宿主容量门禁。
|
|
41
|
+
- 取消请求后的刷新门禁、错误重试与冲突恢复保持可用。
|
|
42
|
+
- 用户可见容量文案统一为「并发子智能体数量」。
|
|
43
|
+
|
|
44
|
+
### Limitations
|
|
45
|
+
|
|
46
|
+
- 预发布版本:AC-12 的 GUI 全项验收未完成;深度/存活真实超限、完整旧数据迁移与策略版本切换等场景仍暂缓。
|
|
47
|
+
- 宿主授权、主模型、官方 profile 与原生工具参数不由本插件修改。
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 lez
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 子智能体模型选择策略 · Subagent Model Policy
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
简体中文 · [English](https://github.com/ChenMuDX/dsh-subagent-model-policy/blob/main/README_en.md)
|
|
4
|
+
|
|
5
|
+
作者:lez · 版本 `0.3.0` · 目标宿主 DeepSeek Harness `0.2.2-rc.1`。
|
|
6
|
+
|
|
7
|
+
> 本版本使用数字版本号,但 AC-12 的 GUI 全项验收仍未完成,深度/存活超限等真实场景仍暂缓;不要把本版本表述为全项验收版。
|
|
8
|
+
|
|
9
|
+
在当前会话中管理子智能体的模型选择策略、候选模型池、会话级并发/递归限制,并记录创建时的策略与实际响应证据。默认关闭;安装不会改变主模型、其他会话的模型选择或宿主授权。
|
|
10
|
+
|
|
11
|
+
## 安装
|
|
12
|
+
|
|
13
|
+
在 DeepSeek Harness 的插件管理器中安装:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
@lienze/dsh-subagent-model-policy@0.3.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
安装后按当前 Harness 的方式重载插件与页面;源码修改不等于运行实例已更新。若当前 Harness 使用 CLI 管理 profile,按该版本文档把同一包说明符加入对应 profile。
|
|
20
|
+
|
|
21
|
+
包名中的 `@lienze` 是发布账号的 scope;插件内部的存储域、命令与工具名沿用历史前缀 `lez-`,不影响安装、升级或已保存数据。
|
|
22
|
+
|
|
23
|
+
## 入口
|
|
24
|
+
|
|
25
|
+
会话标题栏的「子智能体模型选择策略」按钮,或右侧栏页签中的同名入口。面板包含三个页面:
|
|
26
|
+
|
|
27
|
+
- **选择策略**:策略开关、新会话默认开关、策略池与页内编辑。
|
|
28
|
+
- **模型池**:候选勾选、刷新候选、能力卡、会话并发/递归限制。
|
|
29
|
+
- **执行洞察**:本插件记录的真实创建与响应证据。
|
|
30
|
+
|
|
31
|
+
## 策略语义
|
|
32
|
+
|
|
33
|
+
- **固定模型**:委派只使用选中的模型;不匹配时报错,不静默替换。
|
|
34
|
+
- **Agent 自选**:从会话池候选子集中选择,并在委派时显式填写精确 provider/model。
|
|
35
|
+
- 旧版「跟随父模型」策略只读保留;保存为固定或 Agent 自选时显式转换。
|
|
36
|
+
- 保存启用中的策略后,新内容在下一次主 Agent 发起模型调用时生效;保存非启用策略只更新策略库,启用后才生效。
|
|
37
|
+
- 无改动重复保存不制造新版本;界面不显示内部版本号。
|
|
38
|
+
- 当前启用策略和新会话默认的来源策略不可删除;需先关闭策略或更改/清除默认。
|
|
39
|
+
- 设置为新会话默认后不弹顶部提示,只更新「新会话默认」开关摘要。
|
|
40
|
+
- 关闭策略不会删除策略、不改主模型,也不追溯终止已创建的子智能体。
|
|
41
|
+
|
|
42
|
+
## 模型池与限制
|
|
43
|
+
|
|
44
|
+
- 模型池只列出当前宿主允许的候选;勾选不会扩大宿主授权,也不管理 API Key、连接或官方授权。
|
|
45
|
+
- 当前启用策略引用的候选受保护,移除会被拒绝并提示先调整或关闭。
|
|
46
|
+
- 「刷新候选」按发起瞬间的宿主授权与可用性移除失效候选,并同步清理策略中的失效引用;当前启用内容受保护。
|
|
47
|
+
- 模型行显示宿主提供的思考等级与能力卡;未提供时不猜测等级名。
|
|
48
|
+
- 并发子智能体数量与最大递归深度为会话公共配置,切换策略不改变;实际委派同时受宿主上限和本会话限制约束。
|
|
49
|
+
- 保存启用中策略、启用策略和保存限制共用宿主容量门禁;无法读取宿主容量时拒绝写入并说明原因,保留已启用内容。
|
|
50
|
+
|
|
51
|
+
## Agent 工具
|
|
52
|
+
|
|
53
|
+
- `subagent_policy`:读取策略、模型说明、注入预览与运行回读。
|
|
54
|
+
- `delegate_with_policy`:创建本地 fresh/fork 子智能体,返回子会话 id;自选模式必须显式提供精确 provider/model 和一句选择依据。完成后由原生 subagent 运行时投递结果。
|
|
55
|
+
|
|
56
|
+
策略保存不自动创建子任务;是否委派仍由用户任务与 Agent 决定。
|
|
57
|
+
|
|
58
|
+
## 原生入口边界
|
|
59
|
+
|
|
60
|
+
原生 `subagent`、`subagent_fork`、`workflow`、`spawn_teammate` 的本地创建只做准入校验,不代填或改写模型参数。固定/自选模式下,原生入口不能指定目标模型时可能被拒绝,此时应改用 `delegate_with_policy`。插件不 monkey-patch、不替换官方工具,也不保证外部后端或非本地创建。
|
|
61
|
+
|
|
62
|
+
## 证据语义
|
|
63
|
+
|
|
64
|
+
- `assistant/message`:从子会话自身后缀的模型消息读取实际响应路由。
|
|
65
|
+
- `request/header`:只说明拟请求路由,不显示为实际响应。
|
|
66
|
+
- `pending`:尚无证据。
|
|
67
|
+
- 子 Agent 自述、模型说明和请求配置不能替代实际响应证据。执行洞察保留创建时的策略名,不随之后重命名或删除改写。
|
|
68
|
+
|
|
69
|
+
## 范围与暂缓
|
|
70
|
+
|
|
71
|
+
- 覆盖当前会话内的策略库、模型池、默认内容与会话限制;不做跨会话共享策略库或项目级默认。
|
|
72
|
+
- 不修改宿主授权、主模型、官方 profile 配置或原生工具参数。
|
|
73
|
+
- 宿主撤销授权后,已绑定子 Agent 的后续请求由宿主拒绝,插件不静默回退。
|
|
74
|
+
- 预发布阶段未完成 AC-12 全项 GUI 验收;深度/存活真实超限、完整旧数据迁移与策略版本切换等场景仍暂缓。合成测试通过不等于这些场景已实测。
|
|
75
|
+
|
|
76
|
+
## 卸载
|
|
77
|
+
|
|
78
|
+
通过 Harness 插件管理器禁用或移除 bundle。插件保存的会话策略与执行记录保留在宿主 storageDomain;重新启用后仍可读取。不要手动编辑 profile 生成的 `package.json`、`cordis.patch.yml` 或 `cordis.yml`。
|
|
79
|
+
|
|
80
|
+
## 许可证
|
|
81
|
+
|
|
82
|
+
MIT。见 [LICENSE](LICENSE)。
|
package/README_en.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Subagent Model Policy
|
|
2
|
+
|
|
3
|
+
[简体中文](https://github.com/ChenMuDX/dsh-subagent-model-policy/blob/main/README.md) · English
|
|
4
|
+
|
|
5
|
+
Author: lez · Version `0.3.0` · Target host DeepSeek Harness `0.2.2-rc.1`.
|
|
6
|
+
|
|
7
|
+
> This release uses a numeric version, but the full AC-12 GUI acceptance is still incomplete, and real scenarios such as depth/liveness overflow remain deferred. Do not describe it as fully accepted.
|
|
8
|
+
|
|
9
|
+
Manage the model selection policy for subagents in the current session: candidate model pool, session-level concurrency and recursion limits, and the recorded policy and actual response evidence at creation time. Disabled by default; installing it does not change the main model, other sessions' model selection, or host authorization.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
Install from the DeepSeek Harness plugin manager:
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
@lienze/dsh-subagent-model-policy@0.3.0
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
After installing or updating, reload the plugin and page the way your Harness does; a source change is not a running instance. If your Harness manages profiles through the CLI, add the same package specifier to that profile.
|
|
20
|
+
|
|
21
|
+
The `@lienze` scope is the publishing account's scope. Internal identifiers keep the historical `lez-` prefix; this does not affect installation, upgrades or stored data.
|
|
22
|
+
|
|
23
|
+
## Entry points
|
|
24
|
+
|
|
25
|
+
The "Subagent Model Policy" button in the session title bar, or the entry with the same name in the right sidebar tabs. The panel has three pages:
|
|
26
|
+
|
|
27
|
+
- **Choose strategy**: policy switch, new-session default switch, strategy library and in-page editing.
|
|
28
|
+
- **Model pool**: candidate selection, refresh candidates, ability cards, session concurrency/recursion limits.
|
|
29
|
+
- **Execution insights**: real creations and response evidence recorded by this plugin.
|
|
30
|
+
|
|
31
|
+
## Policy semantics
|
|
32
|
+
|
|
33
|
+
- **Fixed model**: delegation only uses the selected model; a mismatch fails instead of silently switching.
|
|
34
|
+
- **Agent choice**: the agent picks from the session pool's candidate subset and must supply an exact provider/model when delegating.
|
|
35
|
+
- The legacy "follow parent model" policy is kept read-only; saving as fixed or agent choice converts it explicitly.
|
|
36
|
+
- After saving an enabled policy, the new content takes effect on the next main-agent model call; saving a disabled policy only updates the strategy library.
|
|
37
|
+
- Saving without changes does not create a new revision; the UI does not show internal revision numbers.
|
|
38
|
+
- The enabled policy and the source strategy of the new-session default cannot be deleted; close the policy or change/clear the default first.
|
|
39
|
+
- Setting a new-session default does not raise a top banner; only the "New-session default" summary updates.
|
|
40
|
+
- Closing the policy does not delete it, does not change the main model, and does not terminate subagents already created.
|
|
41
|
+
|
|
42
|
+
## Model pool and limits
|
|
43
|
+
|
|
44
|
+
- The model pool only lists candidates the host currently allows; selecting them does not widen host authorization, and the plugin does not manage API keys, connections or official authorization.
|
|
45
|
+
- Candidates referenced by the enabled policy are protected; removing them is refused with a prompt to adjust or close the policy first.
|
|
46
|
+
- "Refresh candidates" drops candidates that became invalid at the moment of the request and cleans their stale references in policies; the currently enabled content stays protected.
|
|
47
|
+
- Model rows show the thinking levels and ability cards provided by the host; when the host provides none, no level names are guessed.
|
|
48
|
+
- Concurrent subagent count and maximum recursion depth are shared session settings and do not change when switching policies; actual delegation is constrained by both the host ceiling and this session's limits.
|
|
49
|
+
- Saving an enabled policy, enabling a policy and saving limits share the host capacity gate; when host capacity cannot be read, writes are refused with the reason and the enabled content is preserved.
|
|
50
|
+
|
|
51
|
+
## Agent tools
|
|
52
|
+
|
|
53
|
+
- `subagent_policy`: reads the policy, model notes, injection preview and runtime readback.
|
|
54
|
+
- `delegate_with_policy`: creates a local fresh/fork subagent and returns its id; agent-choice mode must pass an exact provider/model and a one-line reason. Results are delivered by the native subagent runtime.
|
|
55
|
+
|
|
56
|
+
Saving a policy never creates subagent tasks; whether to delegate is still decided by the user's task and the agent.
|
|
57
|
+
|
|
58
|
+
## Native entry boundaries
|
|
59
|
+
|
|
60
|
+
Local creations through native `subagent`, `subagent_fork`, `workflow` and `spawn_teammate` get admission checks only; the plugin neither fills in nor rewrites model parameters. Under fixed/agent-choice policies, a native entry that cannot name the target model may be refused; use `delegate_with_policy` in that case. The plugin does not monkey-patch or replace official tools, and does not cover external backends or non-local creations.
|
|
61
|
+
|
|
62
|
+
## Evidence semantics
|
|
63
|
+
|
|
64
|
+
- `assistant/message`: the actual response route read from the sub-session's own trailing model message.
|
|
65
|
+
- `request/header`: only the intended request route, never shown as an actual response.
|
|
66
|
+
- `pending`: no evidence yet.
|
|
67
|
+
- A sub-agent's self-report, model notes and request configuration cannot replace actual response evidence. Execution insights keep the strategy name captured at creation time and do not rewrite it after later renames or deletions.
|
|
68
|
+
|
|
69
|
+
## Scope and deferred items
|
|
70
|
+
|
|
71
|
+
- Covers the strategy library, model pool, defaults and session limits inside the current session; no cross-session shared library and no project-level defaults.
|
|
72
|
+
- Does not modify host authorization, the main model, official profile configuration or native tool parameters.
|
|
73
|
+
- After the host revokes authorization, subsequent requests of already-bound sub-agents are refused by the host; the plugin does not fall back silently.
|
|
74
|
+
- The pre-release has not completed full AC-12 GUI acceptance; real depth/liveness overflow, complete legacy data migration and strategy-version switching remain deferred. Passing synthetic tests does not mean these scenarios were measured.
|
|
75
|
+
|
|
76
|
+
## Uninstall
|
|
77
|
+
|
|
78
|
+
Disable or remove the bundle through the Harness plugin manager. Stored session policies and execution records stay in the host storageDomain and remain readable after re-enabling. Do not hand-edit the profile-generated `package.json`, `cordis.patch.yml` or `cordis.yml`.
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
MIT. See [LICENSE](LICENSE).
|