@deepseek-ai/dsh-plan-mode 0.0.1-rc.2 → 0.0.1-rc.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 +2 -2
- package/README.md +2 -2
- package/README.zh.md +5 -5
- package/lib/index.js +6 -6
- package/lib/types/index.d.ts +3 -3
- package/lib/types/index.js +6 -6
- package/package.json +21 -21
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
3
|
# after editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/plan/plan-mode/README.md
|
|
5
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 7171997406ea43487762d9947d07426df400c78a
|
|
6
|
+
README.zh.md: 5c04cdabc293c9abda6bb5e77f596715ee137c6f
|
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Logged, per-agent plan collaboration state with deployment-owned guidance, direc
|
|
|
12
12
|
|
|
13
13
|
## Model and human interactions
|
|
14
14
|
|
|
15
|
-
While active, `plan:policy` renders the configured `section`. The plugin always registers `exit_plan_mode`, keeping tool schemas stable across the transition; its execute path accepts only active plan mode and leaves it only after an exact user approval through `ctx.
|
|
15
|
+
While active, `plan:policy` renders the configured `section`. The plugin always registers `exit_plan_mode`, keeping tool schemas stable across the transition; its execute path accepts only active plan mode and leaves it only after an exact user approval through `ctx.userQuestions`.
|
|
16
16
|
|
|
17
17
|
The review question declares the `plan-review` presentation intent, naming `Approve` as the label that approves it, so a capable UI presents the plan as a decision instead of a generic question; the answer the tool reads is the same either way. A dismissed review — the user closing the request to speak instead — is reported to the model as such, telling it to stay in plan mode and wait for the message; every other review failure keeps the seam's own message.
|
|
18
18
|
|
|
@@ -83,7 +83,7 @@ The [`exit_plan_mode` schema](../../../docs/tool-catalog.md#deepseek-aidsh-plan-
|
|
|
83
83
|
|
|
84
84
|
#### Token effect
|
|
85
85
|
|
|
86
|
-
The stable schema is paid according to
|
|
86
|
+
The stable schema is paid according to ToolRuntime mode, and each plan argument and review result remains in conversation history.
|
|
87
87
|
|
|
88
88
|
#### KV Cache effect
|
|
89
89
|
|
package/README.zh.md
CHANGED
|
@@ -8,13 +8,13 @@
|
|
|
8
8
|
|
|
9
9
|
`plan/mode`(`{ active: boolean }`)是一个仅存在于日志中、每次以完整值替换的 `SessionEventMap` 成员。`foldPlanMode(events)` 返回最后记录的值,如果没有则返回 `false`,因此恢复、fork 和压缩(compaction)都能直接从会话日志恢复 plan 状态。UI 通过 `session/event` 观察已提交的切换。
|
|
10
10
|
|
|
11
|
-
`ctx.planMode.set(agent, active)` 会在 agent 空闲时立即追加独立的 `plan/mode`
|
|
11
|
+
`ctx.planMode.set(agent, active)` 会在 agent 空闲时立即追加独立的 `plan/mode` 事件,因为下一个提示词之前不会运行轮内 pre-step。agent 运行时,该方法会保留待生效选择,直到下一个被接受的轮内 pre-step。返回值区分 `committed`、`queued`、表示反转的 `cancelled` 和 `noop`。`get(agent)` 返回 `{ active, pending? }`,将用于组装当前步骤的日志状态与用户的轮中选择分开。初始与续步 pre-step 都会应用待生效选择;同一步骤的请求恢复重试会复用已冻结的 assembly,并将该选择保留到下一个被接受的轮内 pre-step。当最后记录的请求头描述了另一状态时,用户选择的变更会贡献一条插件来源的 `user/message` 通知(两条提交路径皆然)。
|
|
12
12
|
|
|
13
13
|
## 模型与人类交互
|
|
14
14
|
|
|
15
|
-
激活时,`plan:policy` 会渲染已配置的 `section`。插件始终注册 `exit_plan_mode`,使工具 schema 在转换期间保持稳定;其 execute 路径只接受已激活的 plan mode,且只有通过 `ctx.
|
|
15
|
+
激活时,`plan:policy` 会渲染已配置的 `section`。插件始终注册 `exit_plan_mode`,使工具 schema 在转换期间保持稳定;其 execute 路径只接受已激活的 plan mode,且只有通过 `ctx.userQuestions` 获得用户明确批准后才退出。
|
|
16
16
|
|
|
17
|
-
评审问题声明 `plan-review` 呈现意图,并指名 `Approve` 为表示批准的标签,因此有能力的 UI
|
|
17
|
+
评审问题声明 `plan-review` 呈现意图,并指名 `Approve` 为表示批准的标签,因此有能力的 UI 会把计划呈现为一次决定而非通用问题;两种情况下该工具读到的回答完全相同。放弃审阅——用户关闭请求,转而发言——会如实报告给模型,要求它留在 plan mode 中等待那条消息;其余每一种评审失败都保留 seam 自身的消息。
|
|
18
18
|
|
|
19
19
|
组合 `ctx.commands` 时,该包会注册 `/plan [message]`,并将参数恰好为 `off` 的情况保留给直接退出。不带参数的 `/plan` 会启用 plan mode;任何其他非空参数都会先启用 plan mode,再通过 `agent.steer()` 提交,因此它会在 plan 引导下成为下一步骤的常规已记录用户消息。`/plan off` 会选择停用状态,不发送模型输入;它还可以在启用 plan mode 的待处理选择由轮内 pre-step 追加之前将其取消。
|
|
20
20
|
|
|
@@ -69,7 +69,7 @@ You are in plan mode. Explore and design before presenting the complete plan thr
|
|
|
69
69
|
|
|
70
70
|
#### Token 影响
|
|
71
71
|
|
|
72
|
-
可选消息的历史 token 成本与单独提交该文本相同;不带参数的 `/plan` 和 `/plan off` 不增加 token
|
|
72
|
+
可选消息的历史 token 成本与单独提交该文本相同;不带参数的 `/plan` 和 `/plan off` 不增加 token。一次带有切换通知的已激活状态退出会追加一条简短且会保留的通知。
|
|
73
73
|
|
|
74
74
|
#### KV Cache 影响
|
|
75
75
|
|
|
@@ -83,7 +83,7 @@ You are in plan mode. Explore and design before presenting the complete plan thr
|
|
|
83
83
|
|
|
84
84
|
#### Token 影响
|
|
85
85
|
|
|
86
|
-
稳定 schema 的成本取决于
|
|
86
|
+
稳定 schema 的成本取决于 ToolRuntime mode,每次传入的 plan 参数和评审结果都会保留在对话历史中。
|
|
87
87
|
|
|
88
88
|
#### KV Cache 影响
|
|
89
89
|
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { Service } from "@deepseek-ai/cordis";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
4
4
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
5
|
-
import {
|
|
5
|
+
import { UserQuestionError } from "@deepseek-ai/dsh-user-questions";
|
|
6
6
|
//#region lib/types/index.js
|
|
7
7
|
/**
|
|
8
8
|
* Plan mode is logged per-agent collaboration state: while active, a
|
|
@@ -108,7 +108,7 @@ function planModeAtLastHeader(events) {
|
|
|
108
108
|
* the `plan:policy` section, the `/plan` command, and the stable exit tool.
|
|
109
109
|
* UIs observe committed flips through `session/event`; there is no live mirror.
|
|
110
110
|
*/
|
|
111
|
-
var
|
|
111
|
+
var PlanModeController = class extends Service {
|
|
112
112
|
static inject = ["tools", "systemPrompt"];
|
|
113
113
|
/** Validated deployment-owned guidance. */
|
|
114
114
|
section;
|
|
@@ -250,8 +250,8 @@ var PlanModeService = class extends Service {
|
|
|
250
250
|
if (agent === void 0) throw new Error(`${EXIT_PLAN_MODE} requires a calling agent (no session to switch)`);
|
|
251
251
|
if (!foldPlanMode(agent.session.events)) throw new Error(`${EXIT_PLAN_MODE} is only available in plan mode`);
|
|
252
252
|
if (!/^#\s+\S/.test(args.plan.trim())) throw new Error(`${EXIT_PLAN_MODE} requires a non-empty markdown plan starting with a # heading`);
|
|
253
|
-
const interaction = ctx.get("
|
|
254
|
-
if (interaction === void 0) throw new Error("no user-
|
|
253
|
+
const interaction = ctx.get("userQuestions");
|
|
254
|
+
if (interaction === void 0) throw new Error("no user-questions channel is available to review the plan; ask the user to switch the session mode instead");
|
|
255
255
|
const answer = await interaction.ask({
|
|
256
256
|
questions: [{
|
|
257
257
|
id: REVIEW_ID,
|
|
@@ -273,7 +273,7 @@ var PlanModeService = class extends Service {
|
|
|
273
273
|
agent,
|
|
274
274
|
signal: exec.signal
|
|
275
275
|
}).catch((cause) => {
|
|
276
|
-
if (cause instanceof
|
|
276
|
+
if (cause instanceof UserQuestionError && cause.code === "ASK_CANCELLED") throw new Error("The user dismissed the plan review to speak instead; stay in plan mode, stop here, and wait for their message.");
|
|
277
277
|
throw cause;
|
|
278
278
|
});
|
|
279
279
|
if (disposed) throw new Error("the plan-mode service was reloaded while the plan was under review; present the plan again");
|
|
@@ -388,4 +388,4 @@ var PlanModeService = class extends Service {
|
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
390
|
//#endregion
|
|
391
|
-
export { EXIT_PLAN_MODE,
|
|
391
|
+
export { EXIT_PLAN_MODE, PlanModeController, PlanModeController as default, foldPlanMode, resolveConfig };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ declare module '@deepseek-ai/dsh-session/types' {
|
|
|
40
40
|
}
|
|
41
41
|
declare module '@deepseek-ai/cordis' {
|
|
42
42
|
interface Context {
|
|
43
|
-
planMode:
|
|
43
|
+
planMode: PlanModeController;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -75,7 +75,7 @@ export declare function foldPlanMode(events: readonly SessionEvent[], end?: numb
|
|
|
75
75
|
* the `plan:policy` section, the `/plan` command, and the stable exit tool.
|
|
76
76
|
* UIs observe committed flips through `session/event`; there is no live mirror.
|
|
77
77
|
*/
|
|
78
|
-
export declare class
|
|
78
|
+
export declare class PlanModeController extends Service {
|
|
79
79
|
static inject: string[];
|
|
80
80
|
/** Validated deployment-owned guidance. */
|
|
81
81
|
private readonly section;
|
|
@@ -119,5 +119,5 @@ export declare class PlanModeService extends Service {
|
|
|
119
119
|
/** Build a user-switch notice when the last logged header described the other mode. */
|
|
120
120
|
private narration;
|
|
121
121
|
}
|
|
122
|
-
export default
|
|
122
|
+
export default PlanModeController;
|
|
123
123
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/types/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import { Service } from '@deepseek-ai/cordis';
|
|
|
26
26
|
import { z as zod } from 'zod';
|
|
27
27
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
28
28
|
import { defineTool } from '@deepseek-ai/dsh-tools';
|
|
29
|
-
import {
|
|
29
|
+
import { UserQuestionError } from '@deepseek-ai/dsh-user-questions';
|
|
30
30
|
/**
|
|
31
31
|
* The model-facing exit tool's name. It stays registered while plan mode is
|
|
32
32
|
* inactive so the request tool catalog is stable across transitions.
|
|
@@ -126,7 +126,7 @@ function planModeAtLastHeader(events) {
|
|
|
126
126
|
* the `plan:policy` section, the `/plan` command, and the stable exit tool.
|
|
127
127
|
* UIs observe committed flips through `session/event`; there is no live mirror.
|
|
128
128
|
*/
|
|
129
|
-
export class
|
|
129
|
+
export class PlanModeController extends Service {
|
|
130
130
|
static inject = ['tools', 'systemPrompt'];
|
|
131
131
|
/** Validated deployment-owned guidance. */
|
|
132
132
|
section;
|
|
@@ -268,9 +268,9 @@ export class PlanModeService extends Service {
|
|
|
268
268
|
if (!/^#\s+\S/.test(args.plan.trim())) {
|
|
269
269
|
throw new Error(`${EXIT_PLAN_MODE} requires a non-empty markdown plan starting with a # heading`);
|
|
270
270
|
}
|
|
271
|
-
const interaction = ctx.get('
|
|
271
|
+
const interaction = ctx.get('userQuestions');
|
|
272
272
|
if (interaction === undefined) {
|
|
273
|
-
throw new Error('no user-
|
|
273
|
+
throw new Error('no user-questions channel is available to review the plan; ask the user to switch the session mode instead');
|
|
274
274
|
}
|
|
275
275
|
const answer = await interaction.ask({
|
|
276
276
|
questions: [{
|
|
@@ -295,7 +295,7 @@ export class PlanModeService extends Service {
|
|
|
295
295
|
// generic channel message names ask_user_question, which the model
|
|
296
296
|
// never called. An abort (turn cancel, provider teardown) keeps its
|
|
297
297
|
// own message — there is no user to wait for.
|
|
298
|
-
if (cause instanceof
|
|
298
|
+
if (cause instanceof UserQuestionError && cause.code === 'ASK_CANCELLED') {
|
|
299
299
|
throw new Error('The user dismissed the plan review to speak instead; '
|
|
300
300
|
+ 'stay in plan mode, stop here, and wait for their message.');
|
|
301
301
|
}
|
|
@@ -414,5 +414,5 @@ export class PlanModeService extends Service {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
export default
|
|
417
|
+
export default PlanModeController;
|
|
418
418
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-plan-mode",
|
|
3
3
|
"description": "Logged per-agent plan mode with deployment guidance, a direct slash command, and a user-reviewed exit",
|
|
4
|
-
"version": "0.0.1-rc.
|
|
4
|
+
"version": "0.0.1-rc.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
7
7
|
},
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
],
|
|
42
42
|
"license": "BSD-3-Clause",
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/dsh-
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-
|
|
48
|
-
"@deepseek-ai/dsh-session": "^0.0.1-rc.
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
44
|
+
"@deepseek-ai/dsh-agent": "^0.0.1-rc.3",
|
|
45
|
+
"@deepseek-ai/dsh-commands": "^0.0.1-rc.3",
|
|
46
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
|
|
47
|
+
"@deepseek-ai/dsh-llm": "^0.0.1-rc.3",
|
|
48
|
+
"@deepseek-ai/dsh-session": "^0.0.1-rc.3",
|
|
49
|
+
"@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.3",
|
|
50
|
+
"@deepseek-ai/dsh-tools": "^0.0.1-rc.3",
|
|
51
|
+
"@deepseek-ai/dsh-user-questions": "^0.0.1-rc.3",
|
|
52
52
|
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
53
|
+
"@deepseek-ai/dsh-session-projection": "^0.0.1-rc.3"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|
|
56
56
|
"@deepseek-ai/dsh-commands": {
|
|
@@ -61,17 +61,17 @@
|
|
|
61
61
|
"zod": "^4.4.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@deepseek-ai/dsh-agent": "^0.0.1-rc.
|
|
65
|
-
"@deepseek-ai/dsh-agent-loop": "^0.0.1-rc.
|
|
66
|
-
"@deepseek-ai/dsh-code-runtime": "^0.0.1-rc.
|
|
67
|
-
"@deepseek-ai/dsh-commands": "^0.0.1-rc.
|
|
68
|
-
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.
|
|
69
|
-
"@deepseek-ai/dsh-llm": "^0.0.1-rc.
|
|
70
|
-
"@deepseek-ai/dsh-session": "^0.0.1-rc.
|
|
71
|
-
"@deepseek-ai/dsh-session-projection": "^0.0.1-rc.
|
|
72
|
-
"@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.
|
|
73
|
-
"@deepseek-ai/dsh-tools": "^0.0.1-rc.
|
|
74
|
-
"@deepseek-ai/dsh-user-
|
|
64
|
+
"@deepseek-ai/dsh-agent": "^0.0.1-rc.3",
|
|
65
|
+
"@deepseek-ai/dsh-agent-loop": "^0.0.1-rc.3",
|
|
66
|
+
"@deepseek-ai/dsh-code-runtime": "^0.0.1-rc.3",
|
|
67
|
+
"@deepseek-ai/dsh-commands": "^0.0.1-rc.3",
|
|
68
|
+
"@deepseek-ai/dsh-invariants": "^0.0.1-rc.3",
|
|
69
|
+
"@deepseek-ai/dsh-llm": "^0.0.1-rc.3",
|
|
70
|
+
"@deepseek-ai/dsh-session": "^0.0.1-rc.3",
|
|
71
|
+
"@deepseek-ai/dsh-session-projection": "^0.0.1-rc.3",
|
|
72
|
+
"@deepseek-ai/dsh-system-prompt": "^0.0.1-rc.3",
|
|
73
|
+
"@deepseek-ai/dsh-tools": "^0.0.1-rc.3",
|
|
74
|
+
"@deepseek-ai/dsh-user-questions": "^0.0.1-rc.3",
|
|
75
75
|
"@deepseek-ai/cordis": "^4.0.1-rc.1"
|
|
76
76
|
}
|
|
77
77
|
}
|