@deepseek-ai/dsh-tool-goal 0.2.1-rc.5 → 0.2.2-alpha.3
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.i18n.yaml +4 -4
- package/README.md +2 -2
- package/README.zh.md +2 -2
- package/lib/index.js +8 -14
- package/locale/de.json +6 -0
- package/locale/es.json +6 -0
- package/locale/fr.json +6 -0
- package/locale/ja.json +6 -0
- package/locale/pt.json +6 -0
- package/locale/ru.json +6 -0
- package/package.json +22 -21
package/README.i18n.yaml
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
en: 0a5939086aa67be0
|
|
19
19
|
zh: c97e18432e623631
|
|
20
20
|
/deepseek-ai-dsh-tool-goal/use-this-package/tools:
|
|
21
|
-
en:
|
|
22
|
-
zh:
|
|
21
|
+
en: 48dce14f274a98d2
|
|
22
|
+
zh: c856cdbc582172cf
|
|
23
23
|
/deepseek-ai-dsh-tool-goal/use-this-package/configure-it:
|
|
24
24
|
en: e3f5e8d634a488b7
|
|
25
25
|
zh: 04dcf916aa2114d2
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
en: 4e9fdb5a89f4baa3
|
|
31
31
|
zh: 50d182467ae1f3a7
|
|
32
32
|
/deepseek-ai-dsh-tool-goal/understand-the-implementation/design:
|
|
33
|
-
en:
|
|
34
|
-
zh:
|
|
33
|
+
en: 1c51463a2abd9514
|
|
34
|
+
zh: b02fbbd125d96bf6
|
|
35
35
|
/deepseek-ai-dsh-tool-goal/understand-the-implementation/source-map:
|
|
36
36
|
en: 4d5c648787409868
|
|
37
37
|
zh: b4938bfe660f18aa
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ All three tools return the same compact JSON — `{ goal: null }` when no goal i
|
|
|
37
37
|
| `create_goal(objective, max_goal_rounds?)` | Creates one goal from a direct top-level human turn |
|
|
38
38
|
| `update_goal(goal_id, revision, action, objective?, max_goal_rounds?, blocked_reason?)` | `edit`, `pause`, `resume`, `complete`, or `blocked` on the exact goal revision |
|
|
39
39
|
|
|
40
|
-
Call `get_goal` before `update_goal` and copy the exact `goal_id` and `revision`; all calls are exclusive, so a model-ordered batch observes earlier mutations and their new revisions.
|
|
40
|
+
Call `get_goal` before `update_goal` and copy the exact `goal_id` and `revision`; all calls are exclusive, so a model-ordered batch observes earlier mutations and their new revisions. `objective` and `max_goal_rounds` affect only `edit` and are ignored for all other actions. `blocked_reason` is required and non-empty for `blocked`, persisted with the stable code `model-reported`, and ignored for all other actions. Ignored fields cannot change the objective, round cap, or blocker reason. Declared types, authority, and exact-revision checks still apply. For `edit`, exact empty-string objectives and zero round caps count as omitted, and at least one meaningful replacement is required.
|
|
41
41
|
|
|
42
42
|
### Configure it
|
|
43
43
|
|
|
@@ -68,7 +68,7 @@ This section explains how the tools enforce authority and render output; the obs
|
|
|
68
68
|
|
|
69
69
|
### Design
|
|
70
70
|
|
|
71
|
-
- **Authority at execution.** Every call resolves the exact live agent, its inherited `AgentRegistry` initiator, running status, and an open turn; `create`, `edit`, `pause`, and `resume` additionally require an accepted `{ kind: 'user' }` message or steering event in a runtime-root agent's current turn. A durable paused goal fails the `resume` action with `GOAL_TOOL_RESUME_PAUSED`; the user-facing command or Web control owns that transition. Durable fork lineage does not demote a resumed root; live subagent ownership does.
|
|
71
|
+
- **Authority at execution.** The plugin requires `agents` and reads turn state through `turnBoundaryOf(session)`. Every call resolves the exact live agent, its inherited `AgentRegistry` initiator, running status, and an open turn; `create`, `edit`, `pause`, and `resume` additionally require an accepted `{ kind: 'user' }` message or steering event in a runtime-root agent's current turn. A durable paused goal fails the `resume` action with `GOAL_TOOL_RESUME_PAUSED`; the user-facing command or Web control owns that transition. Durable fork lineage does not demote a resumed root; live subagent ownership does.
|
|
72
72
|
- **Host attestation of human input.** `{ kind: 'user' }` is assigned by `Agent.followup()` and `steer()` when their caller omits a source, so plugins, schedulers, and other non-human producers must pass their own source rather than inheriting human authority.
|
|
73
73
|
- **System-prompt guidance with the configured threshold.** The package registers one `tool:goal` system-prompt section whose fixed text interpolates `blockedAfterConsecutiveRounds`; the same value is the hard lower bound enforced at execution.
|
|
74
74
|
- **Wrap-up context for terminal rounds.** A successful autonomous `complete` or `blocked` defers a closing `<goal_complete>` or `<goal_blocked>` instruction so the model addresses the user once before the turn ends; direct-human mutations never defer this context.
|
package/README.zh.md
CHANGED
|
@@ -37,7 +37,7 @@ kind: "package-reference"
|
|
|
37
37
|
| `create_goal(objective, max_goal_rounds?)` | 根据人类直接发起的顶层轮次创建一个 goal |
|
|
38
38
|
| `update_goal(goal_id, revision, action, objective?, max_goal_rounds?, blocked_reason?)` | 对精确 goal revision 执行 `edit`、`pause`、`resume`、`complete` 或 `blocked` |
|
|
39
39
|
|
|
40
|
-
在 `update_goal` 之前调用 `get_goal`,并复制精确的 `goal_id` 与 `revision`;所有调用都互斥,因此模型排序的批次能观察到更早变更及其新 revision
|
|
40
|
+
在 `update_goal` 之前调用 `get_goal`,并复制精确的 `goal_id` 与 `revision`;所有调用都互斥,因此模型排序的批次能观察到更早变更及其新 revision。`objective` 和 `max_goal_rounds` 仅影响 `edit`,所有其他 action 均忽略它们。`blocked_reason` 在 `blocked` 时必填且非空,并以稳定代码 `model-reported` 持久化,所有其他 action 均忽略它。被忽略的字段不能改变目标、轮数上限或阻塞原因。声明的类型、权限和精确 revision 校验仍然生效。对于 `edit`,目标为空字符串、轮数上限为零时视为省略,且至少需要一个有效替换值。
|
|
41
41
|
|
|
42
42
|
### 配置
|
|
43
43
|
|
|
@@ -68,7 +68,7 @@ kind: "package-reference"
|
|
|
68
68
|
|
|
69
69
|
### 设计
|
|
70
70
|
|
|
71
|
-
- **执行时权限。**
|
|
71
|
+
- **执行时权限。** 插件依赖 `agents`,并通过 `turnBoundaryOf(session)` 读取轮次状态。每次调用都解析精确活跃 agent、其继承的 `AgentRegistry` initiator、running 状态与开放轮次;`create`、`edit`、`pause` 和 `resume` 还要求运行时根 agent 的当前轮次中存在已接受的 `{ kind: 'user' }` 消息或 steering 事件。持久的 paused goal 会让 `resume` 以 `GOAL_TOOL_RESUME_PAUSED` 失败;面向用户的命令或 Web 控件拥有该转换。持久 fork 谱系不会降低已恢复根 agent 的等级;活跃 subagent 所有权会降低。
|
|
72
72
|
- **人类输入的宿主证明。** `Agent.followup()` 与 `steer()` 会在调用方省略 source 时分配 `{ kind: 'user' }`,因此插件、调度器与其他非人类生产方必须传入自己的 source,不能继承人类权限。
|
|
73
73
|
- **带配置阈值的系统提示词指引。** 本包注册一个 `tool:goal` 系统提示词章节,其固定文本插入 `blockedAfterConsecutiveRounds`;同一数值就是执行时强制执行的硬下限。
|
|
74
74
|
- **终局 Round 的结束上下文。** 成功的自主 `complete` 或 `blocked` 会延后一条 `<goal_complete>` 或 `<goal_blocked>` 结束指令,让模型在轮次结束前向用户做一次交代;人类直接变更绝不会延后该上下文。
|
package/lib/index.js
CHANGED
|
@@ -11,8 +11,8 @@ function reject(message, code = "GOAL_TOOL_AUTHORITY_REQUIRED") {
|
|
|
11
11
|
/** Resolve the immutable event cut and open-turn boundary without copying the turn suffix. */
|
|
12
12
|
function openTurnEvents(ctx, agent) {
|
|
13
13
|
const events = agent.session.snapshotEvents();
|
|
14
|
-
const boundary = ctx.
|
|
15
|
-
if (boundary
|
|
14
|
+
const boundary = ctx.agents.turnBoundaryOf(agent.session);
|
|
15
|
+
if (boundary.openTurnStartSeq === null) reject("goal tools require an open model turn", "GOAL_TOOL_DRIVER_REQUIRED");
|
|
16
16
|
return {
|
|
17
17
|
events,
|
|
18
18
|
openTurnStartSeq: boundary.openTurnStartSeq
|
|
@@ -108,8 +108,7 @@ const inject = [
|
|
|
108
108
|
"agents",
|
|
109
109
|
"goals",
|
|
110
110
|
"tools",
|
|
111
|
-
"systemPrompt"
|
|
112
|
-
"sessionProjections"
|
|
111
|
+
"systemPrompt"
|
|
113
112
|
];
|
|
114
113
|
/** Schemastery config for the goal-tool policy. */
|
|
115
114
|
const Config = z.object({ blockedAfterConsecutiveRounds: z.number().step(1).min(1).default(3) });
|
|
@@ -335,27 +334,22 @@ function apply(ctx, config) {
|
|
|
335
334
|
execute(args, exec) {
|
|
336
335
|
const execution = goalToolExecution(ctx, exec);
|
|
337
336
|
const ref = goalRef(args.goal_id, args.revision);
|
|
338
|
-
const replacements = {
|
|
339
|
-
...hasText(args.objective) ? { objective: args.objective } : {},
|
|
340
|
-
...hasRoundCap(args.max_goal_rounds) ? { maxGoalRounds: args.max_goal_rounds } : {}
|
|
341
|
-
};
|
|
342
337
|
if (args.action === "edit") {
|
|
343
338
|
requireDirectHuman(ctx, execution);
|
|
344
|
-
|
|
345
|
-
|
|
339
|
+
const goal = ctx.goals.edit(execution.agent, ref, {
|
|
340
|
+
...hasText(args.objective) ? { objective: args.objective } : {},
|
|
341
|
+
...hasRoundCap(args.max_goal_rounds) ? { maxGoalRounds: args.max_goal_rounds } : {}
|
|
342
|
+
});
|
|
346
343
|
return Promise.resolve(goalValue(goal));
|
|
347
344
|
}
|
|
348
345
|
if (args.action === "pause" || args.action === "resume") {
|
|
349
346
|
requireDirectHuman(ctx, execution);
|
|
350
|
-
if (hasText(args.objective) || hasRoundCap(args.max_goal_rounds) || hasText(args.blocked_reason)) throw new HarnessError("objective and max_goal_rounds are valid only with action edit; blocked_reason is valid only with action blocked", "GOAL_TOOL_INVALID_UPDATE");
|
|
351
347
|
const current = ctx.goals.get(execution.agent);
|
|
352
348
|
if (args.action === "resume" && current?.id === ref.id && current.revision === ref.revision && current.phase === "paused") throw new HarnessError("the model cannot resume a paused goal; the user must resume it", "GOAL_TOOL_RESUME_PAUSED");
|
|
353
349
|
const goal = args.action === "pause" ? ctx.goals.pause(execution.agent, ref) : ctx.goals.resume(execution.agent, ref);
|
|
354
350
|
return Promise.resolve(goalValue(goal));
|
|
355
351
|
}
|
|
356
352
|
const authority = completionAuthority(ctx, execution);
|
|
357
|
-
if (hasText(args.objective) || hasRoundCap(args.max_goal_rounds)) throw new HarnessError("objective and max_goal_rounds are valid only with action edit", "GOAL_TOOL_INVALID_UPDATE");
|
|
358
|
-
if (args.action === "complete" && hasText(args.blocked_reason)) throw new HarnessError("blocked_reason is valid only with action blocked", "GOAL_TOOL_INVALID_UPDATE");
|
|
359
353
|
if (args.action === "blocked" && (args.blocked_reason === void 0 || args.blocked_reason.trim().length === 0)) throw new HarnessError("blocked_reason is required with action blocked", "GOAL_TOOL_INVALID_UPDATE");
|
|
360
354
|
if (args.action === "blocked" && authority.kind === "goal-round" && authority.goal.roundsStarted < resolved.blockedAfterConsecutiveRounds) throw new HarnessError(`blocked requires at least ${resolved.blockedAfterConsecutiveRounds} consecutive goal rounds; current round is ${authority.goal.roundsStarted}`, "GOAL_TOOL_BLOCK_THRESHOLD");
|
|
361
355
|
const goal = args.action === "complete" ? ctx.goals.complete(execution.agent, ref) : ctx.goals.block(execution.agent, ref, {
|
|
@@ -372,7 +366,7 @@ function apply(ctx, config) {
|
|
|
372
366
|
}));
|
|
373
367
|
return Promise.resolve(goalValue(goal));
|
|
374
368
|
},
|
|
375
|
-
presentCall: (args) => present(`${args.action === "blocked" ? "Mark" : args.action.charAt(0).toUpperCase() + args.action.slice(1)} goal`, "other", hasText(args.blocked_reason) ? args.blocked_reason : hasText(args.objective) ? args.objective : hasRoundCap(args.max_goal_rounds) ? args.max_goal_rounds : args.goal_id)
|
|
369
|
+
presentCall: (args) => present(`${args.action === "blocked" ? "Mark" : args.action.charAt(0).toUpperCase() + args.action.slice(1)} goal`, "other", args.action === "blocked" && hasText(args.blocked_reason) ? args.blocked_reason : args.action === "edit" && hasText(args.objective) ? args.objective : args.action === "edit" && hasRoundCap(args.max_goal_rounds) ? args.max_goal_rounds : args.goal_id)
|
|
376
370
|
}));
|
|
377
371
|
}
|
|
378
372
|
//#endregion
|
package/locale/de.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/ja.json
ADDED
package/locale/pt.json
ADDED
package/locale/ru.json
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-tool-goal",
|
|
3
3
|
"description": "Model-facing same-session goal tools with execution-time authority checks",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -29,29 +29,30 @@
|
|
|
29
29
|
],
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
33
|
-
"@deepseek-ai/dsh-goal": "0.2.
|
|
34
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
35
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
36
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
37
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
38
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
39
|
-
"@deepseek-ai/dsh-session-projection": "0.2.1-rc.5"
|
|
32
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.3",
|
|
33
|
+
"@deepseek-ai/dsh-goal": "0.2.2-alpha.3",
|
|
34
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
|
|
35
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.3",
|
|
38
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
|
-
"@deepseek-ai/schemastery": "~3.18.
|
|
41
|
+
"@deepseek-ai/schemastery": "~3.18.6-alpha.2"
|
|
43
42
|
},
|
|
44
43
|
"devDependencies": {
|
|
45
|
-
"@deepseek-ai/cordis-plugin-loader": "~1.0.
|
|
46
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
47
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.
|
|
48
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.
|
|
49
|
-
"@deepseek-ai/dsh-goal": "0.2.
|
|
50
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
51
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
52
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
44
|
+
"@deepseek-ai/cordis-plugin-loader": "~1.0.7-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.3",
|
|
46
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "0.2.2-alpha.3",
|
|
47
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.2-alpha.3",
|
|
48
|
+
"@deepseek-ai/dsh-goal": "0.2.2-alpha.3",
|
|
49
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
|
|
50
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.3",
|
|
51
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
|
|
52
|
+
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-alpha.3",
|
|
53
|
+
"@deepseek-ai/dsh-tool-testkit": "0.2.2-alpha.3",
|
|
54
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.3",
|
|
55
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3"
|
|
56
57
|
}
|
|
57
58
|
}
|