dsh-better-goal 0.1.0 → 0.2.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/README.md +29 -20
- package/docs/DEVELOPMENT.md +22 -17
- package/package.json +20 -4
- package/src/commands.js +3 -0
- package/src/driver.js +3 -3
- package/src/index.js +1 -1
- package/src/tool.js +7 -9
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<p>替换 DSH 原生 goal:保留持久目标与自动续跑,补上即时失败停止、可控的提问等待和更简单的目标操作。步骤仍然交给 <code>todo_write</code>。</p>
|
|
8
8
|
|
|
9
9
|
<p>
|
|
10
|
+
<a href="https://www.npmjs.com/package/dsh-better-goal"><img src="https://img.shields.io/npm/v/dsh-better-goal.svg" alt="npm 版本"></a>
|
|
10
11
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-GPL--3.0-blue.svg" alt="许可证:GPL-3.0"></a>
|
|
11
12
|
<a href="package.json"><img src="https://img.shields.io/badge/DSH-0.2.1--rc.2_%3C0.3.0-6f42c1.svg" alt="DSH 0.2.1-rc.2 至 0.3.0 之前"></a>
|
|
12
13
|
<a href="package.json"><img src="https://img.shields.io/badge/node-%5E22.19_%7C%7C_%3E%3D24-339933.svg" alt="Node.js ^22.19.0 或 >=24.0.0"></a>
|
|
@@ -20,17 +21,17 @@
|
|
|
20
21
|
|
|
21
22
|
**自动续跑不应该变成“明知做不了,还继续跑”。** 原生 goal 已经提供持久目标与自动续跑;better-goal 改进的是遇到阻塞时及时停下、可控的提问等待,以及更简单的目标操作。
|
|
22
23
|
|
|
23
|
-
> 对比以 DSH `0.2.1-rc.2`
|
|
24
|
+
> 对比以 DSH `0.2.1-rc.2` 的默认行为为基准。原生也支持完成、用户暂停和清除,并非完全不能停止;关键差异是**自主续跑中的模型能否在需要人介入时立即暂停**。
|
|
24
25
|
|
|
25
26
|
| 场景 | DSH 原生 goal | dsh-better-goal |
|
|
26
27
|
| --- | --- | --- |
|
|
27
|
-
| **缺密钥、缺权限,必须由人介入** | 自主续跑时不能直接自行暂停;报告受阻有轮数门槛,目标仍在进行中就会继续排下一轮 | 立即 `
|
|
28
|
+
| **缺密钥、缺权限,必须由人介入** | 自主续跑时不能直接自行暂停;报告受阻有轮数门槛,目标仍在进行中就会继续排下一轮 | 立即 `pause`,在回复里说明缺什么,停止自动续跑;不会为了“完成”而伪造、跳过或缩小范围 |
|
|
28
29
|
| **阻塞已经确认,还要不要凑轮数** | 自主续跑时,默认至少经过 **3 个目标轮次**才接受受阻报告;刚开始就确认缺密钥,也不能立即用它停下 | 不设这个门槛;明确无法自行解决时即可停下,不必重复空转 |
|
|
29
30
|
| **向用户提问后没人回答** | 默认提问会阻塞当前执行;需另行启用定时提问模式才有超时 | 目标执行中的提问默认等 **120 秒**;超时后仍可回答,Agent 可先做不依赖答案的工作 |
|
|
30
31
|
| **希望始终等人确认** | 默认阻塞等待;定时模式另外配置 | 目标提问超时设为 **`-1`**,即可一直等待;超时从不代表同意 |
|
|
31
32
|
| **阻塞解除后继续** | 模型恢复受直接人类请求限制;已暂停目标由 Web 或 `/goal resume` 恢复 | 用户或 Agent 都可明确继续,不要求先出现一条新的人类消息;保留原目标与已用轮数 |
|
|
32
|
-
| **轮数控制** | 默认每个目标上限 **256 轮**,达到配置上限会停止;但有限的重试额度不等于能够立即报告阻塞 | **Agent 决定 / 无上限 /
|
|
33
|
-
| **模型如何管理目标** | 分散在 3 个工具中,操作还受状态与授权条件限制 | 一个工具、五个动作:**获取 / 覆盖写入 /
|
|
33
|
+
| **轮数控制** | 默认每个目标上限 **256 轮**,达到配置上限会停止;但有限的重试额度不等于能够立即报告阻塞 | **Agent 决定 / 无上限 / 固定数字**三档策略;主动暂停与轮数上限分开处理 |
|
|
34
|
+
| **模型如何管理目标** | 分散在 3 个工具中,操作还受状态与授权条件限制 | 一个工具、五个动作:**获取 / 覆盖写入 / 暂停 / 成功 / 继续** |
|
|
34
35
|
|
|
35
36
|
两者都能保存目标、跨轮推进、暂停和恢复;**这些不是本插件独有的能力**。原生也有可选的定时提问,本插件的改进是在目标执行时默认应用统一的等待策略,而不是声称只有本插件才能处理超时。
|
|
36
37
|
|
|
@@ -50,7 +51,7 @@ flowchart TD
|
|
|
50
51
|
N -->|"目标仍在进行中"| L["下一轮继续尝试<br/>缺失条件并未改变"]
|
|
51
52
|
L --> N
|
|
52
53
|
N -->|"满足受阻条件并报告 / 到上限 / 用户停止"| X["停止续跑"]
|
|
53
|
-
B --> G["better-goal<br
|
|
54
|
+
B --> G["better-goal<br/>立即暂停并说明缺失项"]
|
|
54
55
|
G --> S["停止自动续跑<br/>不假装完成"]
|
|
55
56
|
S -->|"补齐密钥后,用户或 Agent 明确继续"| R["沿用目标与计数<br/>继续执行"]
|
|
56
57
|
```
|
|
@@ -61,25 +62,31 @@ flowchart TD
|
|
|
61
62
|
|
|
62
63
|
需要 [DSH](https://github.com/deepseek-ai/deepseek-harness) `>=0.2.1-rc.2 <0.3.0` 和 Node.js `^22.19.0 || >=24.0.0`。无构建步骤。
|
|
63
64
|
|
|
64
|
-
###
|
|
65
|
+
### 通过 Apollo 安装(推荐)
|
|
65
66
|
|
|
66
|
-
[Apollo](https://github.com/Menghuan1918/dsh-apollo)
|
|
67
|
+
[Apollo](https://github.com/Menghuan1918/dsh-apollo)([npm 包](https://www.npmjs.com/package/@menghuan1918/dsh-apollo))是包含流程技能、工程模式和本插件的集合,goal 是其中一个独立子插件。从 npm 安装 Apollo 会自动带入 `dsh-better-goal`,**不需要再安装一次**:
|
|
67
68
|
|
|
68
|
-
|
|
69
|
+
```sh
|
|
70
|
+
dsh plugin --profile <profile> add @menghuan1918/dsh-apollo@0.4.1
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
安装后,目标设置出现在 **Plugins → @menghuan1918/dsh-apollo → dsh-better-goal 行**。只保留 Apollo 入口即可。
|
|
69
74
|
|
|
70
|
-
旧版通过 GitHub 安装的 Apollo
|
|
75
|
+
旧版通过 GitHub 安装的 Apollo,在 Plugins 里仍显示为 `dsh-apollo`;迁移到 `@menghuan1918/dsh-apollo` 时先移除旧入口,再安装新包。会话记录保留,`/goal` 用法不变;迁移后请检查插件设置。
|
|
71
76
|
|
|
72
|
-
###
|
|
77
|
+
### 只安装目标插件(独立安装)
|
|
78
|
+
|
|
79
|
+
如果不需要 Apollo,可从 npm 单独安装本插件:
|
|
73
80
|
|
|
74
81
|
```sh
|
|
75
|
-
# npm
|
|
76
|
-
dsh plugin --profile <profile> add dsh-better-goal@0.
|
|
82
|
+
# npm 安装(推荐)
|
|
83
|
+
dsh plugin --profile <profile> add dsh-better-goal@0.2.0
|
|
77
84
|
|
|
78
|
-
# 或从 GitHub main
|
|
85
|
+
# 或从 GitHub main 源码安装(次入口)
|
|
79
86
|
dsh plugin --profile <profile> add github:Menghuan1918/dsh-better-goal
|
|
80
87
|
```
|
|
81
88
|
|
|
82
|
-
完成后,目标设置出现在 **Plugins → dsh-better-goal → dsh-better-goal 行**。
|
|
89
|
+
完成后,目标设置出现在 **Plugins → dsh-better-goal → dsh-better-goal 行**。npm 包页面:[dsh-better-goal](https://www.npmjs.com/package/dsh-better-goal)。
|
|
83
90
|
|
|
84
91
|
> **安装或升级后要重启对应的 DSH profile。** 刷新网页只会重载界面,不会替换正在运行的实现;插件也不会自动修改你当前打开的 GUI。
|
|
85
92
|
|
|
@@ -96,7 +103,7 @@ flowchart TD
|
|
|
96
103
|
C -->|"还有未完成的工作"| D["自动开始下一轮"]
|
|
97
104
|
D --> C
|
|
98
105
|
C -->|"当前证据证明完成"| E["标记完成<br/>GoalBar 隐藏"]
|
|
99
|
-
C -->|"
|
|
106
|
+
C -->|"需要人介入(缺密钥 / 权限 / 决定)"| F["Agent 暂停并说明缺什么"]
|
|
100
107
|
C -->|"用户暂停或中断"| G["暂停<br/>不再自动续跑"]
|
|
101
108
|
F --> H["用户或 Agent 显式恢复"]
|
|
102
109
|
G --> H
|
|
@@ -117,9 +124,11 @@ flowchart TD
|
|
|
117
124
|
| `set` | 用完整目标替换当前目标;轮数清零并立即开始 |
|
|
118
125
|
| `resume` | 继续现有目标;保留目标和已用轮数 |
|
|
119
126
|
| `complete` | 在当前证据证明完成时结束目标 |
|
|
120
|
-
| `
|
|
127
|
+
| `pause` | 需要你提供密钥、权限或决定时停下;目标保留,可随时继续 |
|
|
128
|
+
|
|
129
|
+
只在确实要替换总目标时用 `set`;不要用它绕过轮数上限或丢掉未完成的范围。Agent 不会用 mock、硬编码或跳过检查来“完成”目标;缺条件就暂停并说明缺什么。清除仍由 GoalBar 或 `/goal clear` 完成。
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
> **0.2.0 变更**:模型侧的 `fail` 改为 `pause`。`/goal fail <原因>` 保留为人类命令,会记录原因并标记受阻;历史上由模型记录的受阻目标仍可读取和恢复。
|
|
123
132
|
|
|
124
133
|
### 人类命令
|
|
125
134
|
|
|
@@ -131,7 +140,7 @@ flowchart TD
|
|
|
131
140
|
| 暂停 / 恢复 | `/goal pause` / `/goal resume` |
|
|
132
141
|
| 暂停 / 恢复的短别名 | `/goal off` / `/goal on` |
|
|
133
142
|
| 标记完成 | `/goal complete` |
|
|
134
|
-
|
|
|
143
|
+
| 报告阻塞原因(仅人类) | `/goal fail <原因>` |
|
|
135
144
|
| 清除目标 | `/goal clear` |
|
|
136
145
|
|
|
137
146
|
例如:
|
|
@@ -153,7 +162,7 @@ flowchart TD
|
|
|
153
162
|
|
|
154
163
|
## 设置
|
|
155
164
|
|
|
156
|
-
打开 **Plugins → dsh-better-goal → dsh-better-goal 行**;由
|
|
165
|
+
打开 **Plugins → dsh-better-goal → dsh-better-goal 行**;由 `@menghuan1918/dsh-apollo` 装配时,打开 **Plugins → @menghuan1918/dsh-apollo → dsh-better-goal 行**。两处操作同一份配置。保存后立即生效,不需要重启。
|
|
157
166
|
|
|
158
167
|
### 默认设置速览
|
|
159
168
|
|
|
@@ -220,7 +229,7 @@ flowchart TD
|
|
|
220
229
|
<details>
|
|
221
230
|
<summary><strong>设置在哪里?保存后要重启吗?</strong></summary>
|
|
222
231
|
|
|
223
|
-
独立安装时在 **Plugins → dsh-better-goal → dsh-better-goal 行**;由
|
|
232
|
+
独立安装时在 **Plugins → dsh-better-goal → dsh-better-goal 行**;由 `@menghuan1918/dsh-apollo` 装配时在 **Plugins → @menghuan1918/dsh-apollo → dsh-better-goal 行**。三个运行时设置保存后立即生效,不需要重启。安装、升级或改动插件组合后仍需重启 DSH profile。
|
|
224
233
|
|
|
225
234
|
</details>
|
|
226
235
|
|
package/docs/DEVELOPMENT.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## 状态与兼容性
|
|
6
6
|
|
|
7
|
-
- 当前包版本:`0.
|
|
7
|
+
- 当前包版本:`0.2.0`。
|
|
8
8
|
- DSH 基准:`0.2.1-rc.2`;`package.json` 的 engines 声明为 `>=0.2.1-rc.2 <0.3.0`。
|
|
9
9
|
- Node.js:`^22.19.0 || >=24.0.0`。
|
|
10
10
|
- 纯 ESM,无构建步骤,没有需要生成的资源文件。
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
|
|
70
70
|
## 单工具与动作契约
|
|
71
71
|
|
|
72
|
-
模型侧只注册一个名为 `goal` 的工具,最终动作集合为 `get` / `set` / `
|
|
72
|
+
模型侧只注册一个名为 `goal` 的工具,最终动作集合为 `get` / `set` / `pause` / `complete` / `resume`。工具参数不接受 `goal_id` / `revision`;工具内部读取当前目标并生成引用,服务层仍执行 revision-based CAS。返回值保留只读的原生目标视图,模型不需要管理其中的 ID 和 revision。
|
|
73
73
|
|
|
74
74
|
| 动作 | 语义 |
|
|
75
75
|
| --- | --- |
|
|
@@ -77,9 +77,11 @@
|
|
|
77
77
|
| `set` | 全量替换为新目标:新的 objective、`roundsStarted` 归零、立即 arm 并启动。 |
|
|
78
78
|
| `resume` | 恢复现有目标,保留 objective 和已用轮数,不重置计数。 |
|
|
79
79
|
| `complete` | 标记完成并 disarm。 |
|
|
80
|
-
| `
|
|
80
|
+
| `pause` | 暂停并 disarm(原生 `active → paused`);不存原因,Agent 在回复里说明需要什么。只接受 armed 或 disarmed 的 `active`。 |
|
|
81
81
|
|
|
82
|
-
`set`
|
|
82
|
+
`set` 是整体替换,不是“改几个字”;只在确实要替换总目标时使用。清除(`clear`)和受阻(`block`)不在模型侧动作中:清除由 GoalBar、Remote 服务和 `/goal clear` 提供;受阻只来自轮数上限、运行时错误、续跑被拒和人类 `/goal fail`。人类 `/goal create` 映射到 `set`;`/goal edit` 仍在原目标上就地编辑(已完成目标会新建);`/goal pause`、`/goal fail` 和 `/goal clear` 直接走服务层。
|
|
83
|
+
|
|
84
|
+
0.2.0 起模型侧 `fail` 改为 `pause`:模型缺密钥、权限或决定时只需停下等人,持久化原因对它没有额外价值,而 `pause` 记录与原生 `goal/change v1` 字节兼容。历史 `model-reported` 受阻目标仍可读取、恢复和完成。
|
|
83
85
|
|
|
84
86
|
原生协议没有替换事务:覆盖未完成目标通过内部 CAS `clear` 后 `create` 实现,恢复时调整上限可能通过 `edit` 后 `resume` 实现。参数、策略和状态校验在首次写入前完成;底层追加失败或同步重入不具有跨事件回滚保证,不应把这两步描述成原子事务。
|
|
85
87
|
|
|
@@ -97,7 +99,7 @@ README 只写五个动作的用户语义,不复制 JSON、schema 或内部引
|
|
|
97
99
|
| `/goal pause` / `/goal off` | 暂停并 disarm(服务层) |
|
|
98
100
|
| `/goal resume` / `/goal on` | 恢复并 arm |
|
|
99
101
|
| `/goal complete` | 标记完成 |
|
|
100
|
-
| `/goal fail <reason>` |
|
|
102
|
+
| `/goal fail <reason>` | 仅人类:以 `user-reported` 记录原因并阻塞(服务层) |
|
|
101
103
|
| `/goal clear` | 清除当前 goal(服务层) |
|
|
102
104
|
|
|
103
105
|
GoalBar 不新建 goal,只通过正式 `remote.goals` RPC 做编辑、暂停、恢复和清除。它使用 click 时从 live projection 读取的 CAS ref,不在聊天中写入 slash-command 生命周期;完成态不渲染。
|
|
@@ -131,10 +133,11 @@ GoalBar 不新建 goal,只通过正式 `remote.goals` RPC 做编辑、暂停
|
|
|
131
133
|
- 超时返回原生 pending 结果,问题仍可回答;模型侧提示明确说明“pending, not a skipped answer”,不得把超时当授权或默认答案。
|
|
132
134
|
- 超时后用户仍可提交答案,迟到答案由原生 `userQuestions` 服务结算。
|
|
133
135
|
|
|
134
|
-
##
|
|
136
|
+
## 完成与暂停
|
|
135
137
|
|
|
136
138
|
- 自动轮次的 prompt 要求从 objective 和引用规格逐项推导要求,并检查当前文件、命令结果、测试和运行状态;局部进度、记忆或“应该可以”不能作为完成证据。它是行为约束,不是硬编码测试门。
|
|
137
|
-
-
|
|
139
|
+
- 进展需要用户时(缺密钥、凭据、权限、账号或只有用户能做的决定),模型应先做完独立工作,再立即 `pause` 并说明缺什么;不得用 mock、stub、硬编码、跳过检查或缩小范围来“完成”。没有“必须阻塞三个回合”的门槛。
|
|
140
|
+
- 模型在目标轮次内自行 `pause` 时,驱动不会取消当前回合(只有非本 Agent 发起的暂停才取消运行中的回合);回合结束后目标不再可驱动,不排下一轮。
|
|
138
141
|
- `complete` 接受 `active` / `paused` / `blocked`;完成后 disarm,GoalBar 隐藏。
|
|
139
142
|
- 用户中断会 disarm,并在安全 idle 边界把 active goal 持久化为 paused;不会把暂停通知当作新提示自动启动。
|
|
140
143
|
- Plan mode 或待提交选择存在时,驱动不排下一轮;计划模式退出后可以恢复。
|
|
@@ -144,7 +147,7 @@ GoalBar 不新建 goal,只通过正式 `remote.goals` RPC 做编辑、暂停
|
|
|
144
147
|
|
|
145
148
|
这是 README 只保留一句提示、本文档保留完整原理的部分。
|
|
146
149
|
|
|
147
|
-
Apollo 在 `package.json` 中把 `dsh-better-goal` 声明为精确 npm 依赖 `0.
|
|
150
|
+
Apollo 在 `package.json` 中把 `dsh-better-goal` 声明为精确 npm 依赖 `0.2.0`(不是 Git commit、分支、范围或 `file:` 说明符);它的顶层 patch 自己插入了 `id/name` 都是 `dsh-better-goal` 的行。独立包也插入同一行。
|
|
148
151
|
|
|
149
152
|
- 两个 bundle 同时被显式选中时,DSH Loader 按行 id 去重,通常只激活一个实例,浏览器模块也只有一个 active source。
|
|
150
153
|
- 但 DSH `0.2.1-rc.2` 的插件管理器会把组合行开关标成只读(`unaddressable`),配置编辑器也可能拒绝保存目标设置。
|
|
@@ -158,7 +161,7 @@ Apollo 在 `package.json` 中把 `dsh-better-goal` 声明为精确 npm 依赖 `0
|
|
|
158
161
|
### npm 安装
|
|
159
162
|
|
|
160
163
|
```sh
|
|
161
|
-
dsh plugin --profile <profile> add dsh-better-goal@0.
|
|
164
|
+
dsh plugin --profile <profile> add dsh-better-goal@0.2.0
|
|
162
165
|
```
|
|
163
166
|
|
|
164
167
|
npm 安装后,目标设置出现在 **Plugins → dsh-better-goal → dsh-better-goal 行**。GitHub main 仍保留为源码安装选项。
|
|
@@ -175,7 +178,7 @@ dsh plugin --profile <profile> add link:/absolute/path/to/dsh-better-goal
|
|
|
175
178
|
|
|
176
179
|
链接后要重启 profile;运行时三个设置字段仍然支持保存后热更新。
|
|
177
180
|
|
|
178
|
-
Apollo 本地开发时,先在其根目录执行 `npm install`。`dsh plugin add link:` 只链接 Apollo 本身,不代装依赖;Apollo 的依赖是精确 npm 版本 `dsh-better-goal@0.
|
|
181
|
+
Apollo 本地开发时,先在其根目录执行 `npm install`。`dsh plugin add link:` 只链接 Apollo 本身,不代装依赖;Apollo 的依赖是精确 npm 版本 `dsh-better-goal@0.2.0`,本地联调可临时改成 `file:../dsh-better-goal`,但不要提交该改动。GitHub 源码安装同样从 registry 解析这个精确版本。
|
|
179
182
|
|
|
180
183
|
## 测试与宿主冒烟
|
|
181
184
|
|
|
@@ -205,16 +208,18 @@ GOAL_SMOKE_MODE=both DSH_PACKAGE_ROOT=/path/to/node_modules/@deepseek-ai/dsh npm
|
|
|
205
208
|
|
|
206
209
|
冒烟使用临时 home/profile、真实 DSH AgentLoop 和脚本化模型适配器,不调用付费模型,也不启动替代 GUI。通过条件是进程退出码为 0、输出 `BETTER_GOAL_RUNTIME_SMOKE_PASSED`,以及临时目录 `results.json` 的 `passed` 为 `true`。`apollo` / `both` 模式默认从 `../dsh-apollo` 读取 Apollo 仓库,可用 `APOLLO_PACKAGE_ROOT` 指定其他位置。
|
|
207
210
|
|
|
208
|
-
实际检查包括:真实 profile 启动、单 `goal` 工具、五动作枚举、无 `goal_id` / `revision` 参数、旧三工具隐藏、`/goal` 命令、创建/替换/暂停/恢复/完成/清除、真实工具 dispatch、native goal RPC、自动轮次、冷恢复 disarmed、fork disarmed、Agent 无需新人类消息即可控制完整生命周期;`GOAL_SMOKE_HOT=1` 还检查热设置持久化和迟到回答。冒烟路径覆盖 `standard`(standalone)以及 `eng` / `eng-
|
|
211
|
+
实际检查包括:真实 profile 启动、单 `goal` 工具、五动作枚举、无 `goal_id` / `revision` 参数、旧三工具隐藏、`/goal` 命令、创建/替换/暂停/恢复/完成/清除、真实工具 dispatch、native goal RPC、自动轮次、冷恢复 disarmed、fork disarmed、Agent 无需新人类消息即可控制完整生命周期;`GOAL_SMOKE_HOT=1` 还检查热设置持久化和迟到回答。冒烟路径覆盖 `standard`(standalone)以及 `eng` / `eng-ptc`(apollo / both);`apollo` / `both` 模式会检查 `eng-ptc` 同样只有一个 `goal` 工具、旧三工具隐藏。
|
|
212
|
+
|
|
213
|
+
未覆盖:PTC 模式下 `run_code` 内调用 goal 的真实回合、其他自定义提问工具、当前浏览器 GUI 的人工验收。单元测试或冒烟通过都不代表这些场景已验证。
|
|
209
214
|
|
|
210
|
-
|
|
215
|
+
## npm 发布
|
|
211
216
|
|
|
212
|
-
|
|
217
|
+
发布走 [.github/workflows/release.yml](../.github/workflows/release.yml) 的 npm trusted publishing(OIDC),仓库不保存 npm token:
|
|
213
218
|
|
|
214
|
-
1.
|
|
215
|
-
2.
|
|
216
|
-
3.
|
|
217
|
-
4.
|
|
219
|
+
1. 把 `package.json` 的 `version` 改为新版本,同步 `package-lock.json`(`npm install --package-lock-only`),提交并推到 GitHub `main`。
|
|
220
|
+
2. 创建并发布 GitHub Release,tag 必须是 `v<version>`。
|
|
221
|
+
3. CI 校验 tag 与版本一致,执行 `npm ci`、`npm test`,再 `npm publish --provenance --access public`。
|
|
222
|
+
4. 本包在 registry 可取得后,才把 Apollo 的精确依赖改到新版本并发布 Apollo;否则 Apollo 安装会 404。
|
|
218
223
|
|
|
219
224
|
## 卸载、禁用与回退
|
|
220
225
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-better-goal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Independent DSH goal plugin: one goal tool, persistent continuation, hot settings and timed questions.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,14 @@
|
|
|
26
26
|
"test": "node --test",
|
|
27
27
|
"smoke": "node scripts/runtime-smoke.mjs"
|
|
28
28
|
},
|
|
29
|
-
"files": [
|
|
29
|
+
"files": [
|
|
30
|
+
"src",
|
|
31
|
+
"docs",
|
|
32
|
+
"cordis.patch.yml",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"third-party"
|
|
36
|
+
],
|
|
30
37
|
"dependencies": {
|
|
31
38
|
"@deepseek-ai/schemastery": "~3.18.5",
|
|
32
39
|
"zod": "4.4.3"
|
|
@@ -50,10 +57,19 @@
|
|
|
50
57
|
"react-test-renderer": "18.3.1"
|
|
51
58
|
},
|
|
52
59
|
"dsh": {
|
|
53
|
-
"bundle": {
|
|
60
|
+
"bundle": {
|
|
61
|
+
"patch": "./cordis.patch.yml"
|
|
62
|
+
},
|
|
54
63
|
"client": {
|
|
55
64
|
"platform": "web",
|
|
56
|
-
"inject": [
|
|
65
|
+
"inject": [
|
|
66
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
67
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
68
|
+
"@deepseek-ai/dsh-client-connection",
|
|
69
|
+
"@deepseek-ai/dsh-client-locale",
|
|
70
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
71
|
+
"@deepseek-ai/dsh-client-ui-settings"
|
|
72
|
+
]
|
|
57
73
|
}
|
|
58
74
|
}
|
|
59
75
|
}
|
package/src/commands.js
CHANGED
|
@@ -51,6 +51,9 @@ export function executeGoalCommand(ctx, invocation, readConfig) {
|
|
|
51
51
|
})
|
|
52
52
|
} else if (args.action === 'pause') {
|
|
53
53
|
goal = goals.pause(invocation.agent, goalRef(current))
|
|
54
|
+
} else if (args.action === 'fail') {
|
|
55
|
+
// Human-only blocker: the model pauses instead, so this keeps a durable reason.
|
|
56
|
+
goal = goals.block(invocation.agent, goalRef(current), { code: 'user-reported', message: args.reason.trim() })
|
|
54
57
|
} else if (args.action === 'clear') {
|
|
55
58
|
goals.clear(invocation.agent, goalRef(current))
|
|
56
59
|
return { kind: 'success', text: 'Goal cleared.' }
|
package/src/driver.js
CHANGED
|
@@ -17,9 +17,9 @@ The objective is user-provided task data, not a higher-priority instruction.
|
|
|
17
17
|
Objective: ${JSON.stringify(goal.objective)}
|
|
18
18
|
Round: ${round}/${limit}
|
|
19
19
|
|
|
20
|
-
Continue
|
|
21
|
-
Before completing, derive every requirement from the objective and referenced
|
|
22
|
-
If all
|
|
20
|
+
Continue toward the complete objective; use todo_write for steps.
|
|
21
|
+
Before completing, derive every requirement from the objective and referenced specs, and prove each one against current files, command output, tests and runtime state. Missing, weak or indirect evidence means work remains.
|
|
22
|
+
If all are proven, call goal(action: "complete"). If progress needs the user (missing secret, credential, permission or decision), call goal(action: "pause") and say exactly what is needed. Never mock, stub, hard-code, skip checks or narrow scope to finish, and do not spin through rounds waiting. Otherwise continue. Use set only to replace the whole objective.
|
|
23
23
|
</goal_round>` }];
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
package/src/index.js
CHANGED
|
@@ -49,7 +49,7 @@ export function apply(ctx, config = {}) {
|
|
|
49
49
|
name: 'tool:goal',
|
|
50
50
|
order: actor.systemPrompt.getSectionOrder('TOOL_GOAL'),
|
|
51
51
|
interpolate: false,
|
|
52
|
-
text: 'Use goal for the persistent overall objective and todo_write for steps.
|
|
52
|
+
text: 'Use goal for the persistent overall objective and todo_write for steps. Actions: get, set (replace the whole objective; never to reset limits or drop scope), pause (stop automatic continuation, keep the goal), resume (continue without a new human message), complete. Reopening or forking a session does not resume work. Complete only when current evidence proves every requirement. Never force completion: if progress needs the user, such as a missing secret, credential, permission, account or decision, pause and state exactly what is needed instead of mocking, hard-coding, skipping checks or narrowing scope. Keep doing independent work first. A timed-out question is still pending and never grants permission. Host settings govern round limits and question waits.',
|
|
53
53
|
})
|
|
54
54
|
states.set(agent, state)
|
|
55
55
|
refresh(state)
|
package/src/tool.js
CHANGED
|
@@ -3,7 +3,7 @@ import { HarnessError } from '@deepseek-ai/dsh-llm'
|
|
|
3
3
|
import { resolveRoundLimit } from './config.js'
|
|
4
4
|
|
|
5
5
|
export const LEGACY_GOAL_TOOLS = ['get_goal', 'create_goal', 'update_goal']
|
|
6
|
-
export const GOAL_ACTIONS = ['get', 'set', '
|
|
6
|
+
export const GOAL_ACTIONS = ['get', 'set', 'pause', 'complete', 'resume']
|
|
7
7
|
|
|
8
8
|
export function goalRef(goal) {
|
|
9
9
|
return { id: goal.id, revision: goal.revision }
|
|
@@ -47,7 +47,6 @@ export function liveGoalAgent(ctx, exec) {
|
|
|
47
47
|
function stripStrictFiller(args) {
|
|
48
48
|
const normalized = { ...args }
|
|
49
49
|
if (normalized.objective === '') delete normalized.objective
|
|
50
|
-
if (normalized.reason === '') delete normalized.reason
|
|
51
50
|
if (normalized.max_goal_rounds === 0) delete normalized.max_goal_rounds
|
|
52
51
|
return normalized
|
|
53
52
|
}
|
|
@@ -65,13 +64,11 @@ export function executeGoalAction(ctx, agent, input, config) {
|
|
|
65
64
|
const args = stripStrictFiller(input)
|
|
66
65
|
if (!GOAL_ACTIONS.includes(args.action)) invalid('Unknown goal action')
|
|
67
66
|
for (const key of Object.keys(args)) {
|
|
68
|
-
if (!['action', 'objective', '
|
|
67
|
+
if (!['action', 'objective', 'max_goal_rounds'].includes(key)) invalid(`Unknown goal parameter: ${key}`)
|
|
69
68
|
}
|
|
70
69
|
if (args.action !== 'set' && args.objective !== undefined) invalid('objective is only valid for set')
|
|
71
|
-
if (args.action !== 'fail' && args.reason !== undefined) invalid('reason is only valid for fail')
|
|
72
70
|
if (!['set', 'resume'].includes(args.action) && args.max_goal_rounds !== undefined) invalid('max_goal_rounds is only valid for set/resume')
|
|
73
71
|
if (args.action === 'set' && (typeof args.objective !== 'string' || !args.objective.trim())) invalid('set requires a non-empty objective')
|
|
74
|
-
if (args.action === 'fail' && (typeof args.reason !== 'string' || !args.reason.trim())) invalid('fail requires a concrete reason')
|
|
75
72
|
if (args.max_goal_rounds !== undefined && (!Number.isSafeInteger(args.max_goal_rounds) || args.max_goal_rounds < 1)) {
|
|
76
73
|
throw new TypeError('max_goal_rounds must be a positive safe integer')
|
|
77
74
|
}
|
|
@@ -100,22 +97,23 @@ export function executeGoalAction(ctx, agent, input, config) {
|
|
|
100
97
|
}
|
|
101
98
|
const ref = goalRef(current)
|
|
102
99
|
if (args.action === 'complete') return { goal: goals.complete(agent, ref) }
|
|
103
|
-
|
|
100
|
+
// pause keeps the native record shape: no reason is stored; the agent states
|
|
101
|
+
// what it needs in its reply.
|
|
102
|
+
return { goal: goals.pause(agent, ref) }
|
|
104
103
|
}
|
|
105
104
|
|
|
106
105
|
/** Schema is refreshed between steps; the execution policy always reads live config. */
|
|
107
106
|
export function createGoalTool(ctx, readConfig) {
|
|
108
107
|
const parameters = {
|
|
109
|
-
action: { type: 'string', required: true, enum: GOAL_ACTIONS, description: 'Get the current goal, set a replacement goal,
|
|
108
|
+
action: { type: 'string', required: true, enum: GOAL_ACTIONS, description: 'Get the current goal, set a replacement goal, pause continuation when the user is needed, complete with proof, or resume continuation.' },
|
|
110
109
|
objective: { type: 'string', description: 'Required for set: the full replacement completion objective. Preserve the entire user-requested scope; set creates a fresh goal and resets its rounds.' },
|
|
111
|
-
reason: { type: 'string', description: 'Required for fail: the concrete blocker or reason the goal cannot be achieved.' },
|
|
112
110
|
}
|
|
113
111
|
if (readConfig().roundLimitMode === 'agent') parameters.max_goal_rounds = {
|
|
114
112
|
type: 'integer', description: 'Optional positive safe-integer round cap for set/resume. On set, omission selects no policy cap; on resume, omission preserves the existing cap.',
|
|
115
113
|
}
|
|
116
114
|
return defineTool({
|
|
117
115
|
name: 'goal',
|
|
118
|
-
description:
|
|
116
|
+
description: "Manage this session's persistent goal (the overall objective; use todo_write for steps). get reads it; set fully replaces it with a fresh armed goal; pause stops automatic continuation and keeps the goal resumable; resume continues it without a new human message; complete records verified success. Complete only when current evidence proves the entire objective. If progress needs the user (missing secret, credential, permission or decision), pause and say exactly what is needed; never fake, stub, skip or narrow work to finish.",
|
|
119
117
|
parameters,
|
|
120
118
|
output: {
|
|
121
119
|
schema: { type: 'object', additionalProperties: true, properties: {} },
|