@steerable/agent-shell 0.14.3 → 0.14.4
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/dist/local-backend/router.d.ts +0 -1
- package/dist/local-backend/router.js +8 -46
- package/dist/local-backend/skills/70-plan-mode/SKILL.md +28 -40
- package/dist/local-backend/skills/80-tool-usage/SKILL.md +1 -1
- package/dist/local-backend/subagent-profiles.d.ts +2 -1
- package/dist/local-backend/subagent-profiles.js +26 -2
- package/package.json +5 -5
|
@@ -239,7 +239,6 @@ export declare class LocalBackendRouter {
|
|
|
239
239
|
private detectDeferredExecution;
|
|
240
240
|
private detectToolDenialInHistory;
|
|
241
241
|
private buildModePreamble;
|
|
242
|
-
private isLocalSystemInfoRequest;
|
|
243
242
|
private buildRuntimeEnvironmentContext;
|
|
244
243
|
private buildToolRealityCheck;
|
|
245
244
|
/**
|
|
@@ -3497,7 +3497,7 @@ export class LocalBackendRouter {
|
|
|
3497
3497
|
shouldGenerateTitle,
|
|
3498
3498
|
firstUserMessageForTitle,
|
|
3499
3499
|
resume: isResume,
|
|
3500
|
-
subagent: mergeTurnSubagentParam(Object.fromEntries(mentionRoster.map((row) => [row.profileName, row.profile])), Object.fromEntries(ambientRoster.map((row) => [row.profileName, row.profile]))),
|
|
3500
|
+
subagent: mergeTurnSubagentParam(Object.fromEntries(mentionRoster.map((row) => [row.profileName, row.profile])), Object.fromEntries(ambientRoster.map((row) => [row.profileName, row.profile])), chatMode),
|
|
3501
3501
|
parentAgentId: turnAgents.parent?.id ?? null,
|
|
3502
3502
|
});
|
|
3503
3503
|
});
|
|
@@ -4244,55 +4244,17 @@ export class LocalBackendRouter {
|
|
|
4244
4244
|
}
|
|
4245
4245
|
return false;
|
|
4246
4246
|
}
|
|
4247
|
-
buildModePreamble(chatMode,
|
|
4247
|
+
buildModePreamble(chatMode, _latestUserMessage) {
|
|
4248
4248
|
if (chatMode !== 'plan')
|
|
4249
4249
|
return '';
|
|
4250
|
-
|
|
4250
|
+
return [
|
|
4251
4251
|
'# 当前模式:PLAN(最高优先级)',
|
|
4252
4252
|
'',
|
|
4253
|
-
'-
|
|
4254
|
-
'-
|
|
4255
|
-
'-
|
|
4256
|
-
'-
|
|
4257
|
-
];
|
|
4258
|
-
if (this.isLocalSystemInfoRequest(latestUserMessage)) {
|
|
4259
|
-
lines.push('- 当前用户请求是本机系统/硬件配置类。读取 CPU/内存/磁盘/系统真实信息属于执行任务,不属于计划调研;Plan 模式下应只生成适合当前宿主系统的执行计划。', '- 如果宿主系统是 Windows,计划步骤必须使用 PowerShell/CIM,例如 `Get-CimInstance Win32_Processor`、`Get-CimInstance Win32_PhysicalMemory`、`Get-CimInstance Win32_DiskDrive`、`Get-CimInstance Win32_OperatingSystem`。');
|
|
4260
|
-
}
|
|
4261
|
-
return lines.join('\n');
|
|
4262
|
-
}
|
|
4263
|
-
isLocalSystemInfoRequest(text) {
|
|
4264
|
-
const normalized = text.toLowerCase();
|
|
4265
|
-
const localHints = [
|
|
4266
|
-
'电脑配置',
|
|
4267
|
-
'本机配置',
|
|
4268
|
-
'我的电脑',
|
|
4269
|
-
'系统信息',
|
|
4270
|
-
'硬件配置',
|
|
4271
|
-
'硬件信息',
|
|
4272
|
-
'cpu',
|
|
4273
|
-
'内存',
|
|
4274
|
-
'磁盘',
|
|
4275
|
-
'硬盘',
|
|
4276
|
-
'显卡',
|
|
4277
|
-
'gpu',
|
|
4278
|
-
'computer config',
|
|
4279
|
-
'system info',
|
|
4280
|
-
'hardware',
|
|
4281
|
-
];
|
|
4282
|
-
const actionHints = [
|
|
4283
|
-
'检查',
|
|
4284
|
-
'查看',
|
|
4285
|
-
'获取',
|
|
4286
|
-
'读取',
|
|
4287
|
-
'配置',
|
|
4288
|
-
'信息',
|
|
4289
|
-
'check',
|
|
4290
|
-
'show',
|
|
4291
|
-
'get',
|
|
4292
|
-
'inspect',
|
|
4293
|
-
];
|
|
4294
|
-
return (localHints.some((hint) => normalized.includes(hint)) &&
|
|
4295
|
-
actionHints.some((hint) => normalized.includes(hint)));
|
|
4253
|
+
'- 你当前处于**对话式规划模式(Plan Mode)**。无论用户语气多急迫(如“帮我改一下 / 直接跑一下”),都将其视为**先制定执行方案**的请求,严禁执行任何修改环境的动作或伪装“已完成”。',
|
|
4254
|
+
'- **阶段 1 — 环境事实先行探查**:仓库结构、文件内容、配置字段等客观事实,先通过只读工具(`local_read_file`、`grep`、`glob`、`view_image`、`explore` 子代理、`web_search`)核实,不要拿能自己查到的问题去反问用户。注意边界:只读探查仅服务于方案制定;若用户请求本身是一次只读查询/系统巡检(如“查看本机硬件配置”),直接获取最终结果等同于执行任务,此时只输出符合当前宿主系统的巡检方案步骤。',
|
|
4255
|
+
'- **阶段 2 — 关键取舍用 `ask_user` 对齐**:对于无法通过探查推导的产品偏好、范围边界或架构取舍,优先调用 `ask_user` 工具提供 2–4 个有实质差异的选项(首项标 `(推荐)`);在关键分歧未确认前,先完成提问交流,不要仓促输出半成品计划块。',
|
|
4256
|
+
'- **阶段 3 — 唯一、决策完备的 `<proposed_plan>` 定稿块**:当目标与实施路径已明确,将完整定稿方案包裹在独立成行的 `<proposed_plan>` 与 `</proposed_plan>` 标签中(每轮至多输出 1 个定稿块;后续按反馈修订时输出完整替换版,末尾不要追问“是否开始执行”)。',
|
|
4257
|
+
].join('\n');
|
|
4296
4258
|
}
|
|
4297
4259
|
buildRuntimeEnvironmentContext(chatMode, workingDirectory) {
|
|
4298
4260
|
const platform = process.platform;
|
|
@@ -1,58 +1,46 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: plan-mode
|
|
3
|
-
description: Loaded only in Plan mode.
|
|
3
|
+
description: Loaded only in Plan mode. Guides conversational three-phase planning (read-only exploration, ask_user tradeoff clarification, and a decision-complete <proposed_plan> artifact) without mutating the environment.
|
|
4
4
|
priority: 950
|
|
5
5
|
tags: [mode, planning]
|
|
6
6
|
conditions: [plan-mode]
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
-
#
|
|
9
|
+
# 规划模式(Plan Mode · 对话式三阶段工作流)
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
交给用户确认。**你现在不能执行任何会改变环境的动作。**
|
|
11
|
+
你当前处于**规划模式**。你的目标是与用户高效协作,产出一份**零悬念、可直接交接落地**的执行方案,在用户确认前**绝不执行任何改变环境的操作**。
|
|
13
12
|
|
|
14
|
-
##
|
|
13
|
+
## 模式铁律
|
|
15
14
|
|
|
16
|
-
1.
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
- 必须先看系统提示里的「本地运行环境」。如果宿主系统是 Windows,计划里应使用 PowerShell / CIM
|
|
25
|
-
命令(如 `Get-CimInstance Win32_Processor`、`Get-CimInstance Win32_PhysicalMemory`),不要写
|
|
26
|
-
Linux/macOS 命令(`/proc`、`sysctl`、`lshw` 等)。
|
|
27
|
-
2. **禁止执行**:本轮**没有**暴露 shell、写文件、replay 卡片、MCP 等任何有副作用的工具,也不要尝试调用。
|
|
28
|
-
即使用户直接说"帮我看一下 / 跑一下 / 执行",在计划模式下也**只输出计划**,把要执行的命令写进计划步骤里。
|
|
29
|
-
3. **不要先答应再改口**:开场**不要**写"好的,我来帮你查看/执行…"这类承诺执行的话,也不要为"不能执行"道歉。
|
|
30
|
-
直接进入调研(如需要)和计划本身。
|
|
31
|
-
4. **不要假装已执行**:不要写"已完成 / 已修改 / 运行结果如下"这类话,因为你本轮不会真正执行。
|
|
15
|
+
1. **严禁变更与越界执行**:
|
|
16
|
+
- 本模式已屏蔽 Shell、写/改文件、代码片段运行及任务进度表(`todo_write`)。即使用户说“帮我直接改掉 / 跑一下”,也必须将其视为**制定该任务的执行计划**。
|
|
17
|
+
- 不要以“好的,我现在帮你修改/执行…”开场,也不要虚构任何“已完成 / 运行结果如下”的输出。
|
|
18
|
+
2. **区分两类未知信息,按三阶段推进**:
|
|
19
|
+
- **可探查的环境事实(Discoverable Facts)→ 先查后问**:文件路径、现有接口签名、依赖版本、目录结构等,必须先用只读工具(`local_read_file`、`grep`、`glob`、`view_image`、`explore` 子代理、`web_search`)自行查明,严禁把能从工作区读到的问题抛给用户。
|
|
20
|
+
- **探查与执行任务的边界**:只读工具仅用于收集制定方案所需的上下文;若用户的最终诉求本身就是一次只读查询或系统巡检(如“检查我的电脑硬件配置”),直接读取结果就等于替用户跑完了任务——此时不要读取系统信息,而是根据「本地运行环境」提示写出适配当前操作系统的检查步骤方案。
|
|
21
|
+
- **不可探查的偏好与取舍(Preferences & Tradeoffs)→ 优先调 `ask_user`**:涉及产品意图、范围边界或多种合理技术路线时,若本轮存在 `ask_user` 工具,**优先调用 `ask_user` 提供 2–4 个互斥选项(首项放最推荐方案并标注 `(推荐)`)**,把关键问题一次问完。
|
|
22
|
+
- **未收敛前不硬凑定稿块**:如果高影响歧义尚未澄清、还在等待用户回答,本轮只做探查与提问,**不要输出 `<proposed_plan>` 块**。
|
|
32
23
|
|
|
33
|
-
##
|
|
24
|
+
## 定稿方案输出协议:`<proposed_plan>` 标签块
|
|
34
25
|
|
|
35
|
-
|
|
26
|
+
当目标与实施路径已经明确、无需执行者再做额外决策时,把完整定稿方案包裹在独立成行的 `<proposed_plan>` 与 `</proposed_plan>` 标签内(标签名保持英文原样,不要翻译或放进外层代码块里):
|
|
36
27
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- [ ] 第一步:足够具体、可直接执行,标注用到的工具/命令/文件
|
|
40
|
-
- [ ] 第二步:……
|
|
41
|
-
- [ ] (可选)第三步:……
|
|
42
|
-
```
|
|
28
|
+
<proposed_plan>
|
|
29
|
+
# 一句话方案标题
|
|
43
30
|
|
|
44
|
-
|
|
31
|
+
用 1–2 句话概括方案核心目标与技术选型。
|
|
45
32
|
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
33
|
+
## 核心实施步骤
|
|
34
|
+
- [ ] 第一步:具体到目标模块/文件/命令与行为变更
|
|
35
|
+
- [ ] 第二步:……
|
|
36
|
+
- [ ] 第三步:验证方式(测试命令、边界场景或预期产出)
|
|
49
37
|
|
|
50
|
-
|
|
38
|
+
## 默认假设与注意点
|
|
39
|
+
- 列出已采用的推荐默认项或关键风险提示(无则省略本节)
|
|
40
|
+
</proposed_plan>
|
|
51
41
|
|
|
52
|
-
|
|
53
|
-
- **待确认问题**:任何影响方案的歧义或缺失信息(最多问最关键的 1-3 个)。
|
|
42
|
+
### 定稿规范
|
|
54
43
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
我会按计划实际操作。若信息不足,请先回答上面的待确认问题。
|
|
44
|
+
- **每轮最多输出 1 个 `<proposed_plan>` 块**;内部可自由使用标准 Markdown(含二级标题、`- [ ]` 步骤清单、行内代码甚至嵌套 ` ```bash ` / ` ```ts ` 代码块)。
|
|
45
|
+
- **修订全量替换**:若用户留在规划模式提出修改意见,下一轮输出的新 `<proposed_plan>` 必须是整合修改后的**完整方案**,而非局部补丁。
|
|
46
|
+
- **收尾克制**:定稿块渲染后客户端会自动展示「开始执行计划 / 新建会话干净执行 / 继续修改计划」操作面板,正文末尾**不要**再追问“是否现在开始执行?”。
|
|
@@ -16,7 +16,7 @@ tags: [tool, guide]
|
|
|
16
16
|
|
|
17
17
|
## 多步任务清单(todo_write)
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
仅当本轮可用工具包含 `todo_write`(执行模式)且任务需要 3 步以上才能完成(生成多页 PPT、批量改文件、多阶段调研等)时,**先调 `todo_write` 建任务清单再动手**,并在执行过程中**每完成一步立即更新状态**(规划模式下不提供也不要调用 `todo_write`):
|
|
20
20
|
|
|
21
21
|
- 开始执行某项 → 标 `in_progress`(同时最多一个)
|
|
22
22
|
- **某项刚做完 → 立刻在同一轮(可与下一步业务工具一起批量发出)或紧随下一步调 `todo_write` 将其标为 `completed`,并把下一项标为 `in_progress`**
|
|
@@ -176,4 +176,5 @@ export interface TurnSubagentParam {
|
|
|
176
176
|
* @param ambientProfiles 常驻可委派画像;与提及画像同名时以提及为准。
|
|
177
177
|
* @returns 下发给 sidecar 的 `subagent` 参数。
|
|
178
178
|
*/
|
|
179
|
-
export declare function
|
|
179
|
+
export declare function builtinSubagentProfilesForMode(chatMode?: 'agent' | 'plan'): Record<string, BuiltinSubagentProfile>;
|
|
180
|
+
export declare function mergeTurnSubagentParam(mentionProfiles: Record<string, BuiltinSubagentProfile>, ambientProfiles?: Record<string, BuiltinSubagentProfile>, chatMode?: 'agent' | 'plan'): TurnSubagentParam;
|
|
@@ -362,10 +362,34 @@ export function buildDelegateRosterHint(delegates) {
|
|
|
362
362
|
* @param ambientProfiles 常驻可委派画像;与提及画像同名时以提及为准。
|
|
363
363
|
* @returns 下发给 sidecar 的 `subagent` 参数。
|
|
364
364
|
*/
|
|
365
|
-
export function
|
|
365
|
+
export function builtinSubagentProfilesForMode(chatMode = 'agent') {
|
|
366
|
+
if (chatMode !== 'plan')
|
|
367
|
+
return BUILTIN_SUBAGENT_PROFILES;
|
|
368
|
+
return {
|
|
369
|
+
explore: BUILTIN_SUBAGENT_PROFILES.explore,
|
|
370
|
+
research: {
|
|
371
|
+
...BUILTIN_SUBAGENT_PROFILES.research,
|
|
372
|
+
toolFilter: READ_ONLY_TOOLS,
|
|
373
|
+
description: '深度调研(只读)。多轮 web 搜索/抓取并交叉验证,返回带来源 URL 的结论供主代理整合进计划。',
|
|
374
|
+
systemPrompt: [
|
|
375
|
+
'你是只读调研代理,任务是对一个问题做深度调研并给出可核验的结论。',
|
|
376
|
+
'纪律:',
|
|
377
|
+
'1) 每个事实性主张都必须来自真实抓取结果,并附来源 URL;',
|
|
378
|
+
'2) 至少两个独立来源交叉验证关键结论,来源冲突时并列呈现;',
|
|
379
|
+
'3) 当前处于规划模式,禁止写入或修改任何文件——直接将结论返回给父代理;',
|
|
380
|
+
'4) 查不到就明说,禁止编造来源或数据。',
|
|
381
|
+
].join('\n'),
|
|
382
|
+
},
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
export function mergeTurnSubagentParam(mentionProfiles, ambientProfiles = {}, chatMode = 'agent') {
|
|
366
386
|
const mentionNames = Object.keys(mentionProfiles);
|
|
367
387
|
return {
|
|
368
|
-
profiles: {
|
|
388
|
+
profiles: {
|
|
389
|
+
...builtinSubagentProfilesForMode(chatMode),
|
|
390
|
+
...ambientProfiles,
|
|
391
|
+
...mentionProfiles,
|
|
392
|
+
},
|
|
369
393
|
...(mentionNames.length > 4 ? { maxParallel: mentionNames.length } : {}),
|
|
370
394
|
...(mentionNames.length > 0 ? { requiredProfiles: mentionNames } : {}),
|
|
371
395
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steerable/agent-shell",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.4",
|
|
4
4
|
"description": "Steerable framework — product-neutral Node HostRuntime and headless HTTP server shared by Tauri desktop and browser deployments; scenario packs extend it through @steerable/pack-sdk.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://steerableframework.com/",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"jpeg-js": "^0.4.4",
|
|
54
54
|
"node-pty": "^1.1.0",
|
|
55
55
|
"pngjs": "^7.0.0",
|
|
56
|
-
"@steerable/agent-harness": "0.14.
|
|
57
|
-
"@steerable/agent-protocol": "0.14.
|
|
58
|
-
"@steerable/agent-runtime": "0.14.
|
|
59
|
-
"@steerable/pack-sdk": "0.14.
|
|
56
|
+
"@steerable/agent-harness": "0.14.4",
|
|
57
|
+
"@steerable/agent-protocol": "0.14.4",
|
|
58
|
+
"@steerable/agent-runtime": "0.14.4",
|
|
59
|
+
"@steerable/pack-sdk": "0.14.4"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/better-sqlite3": "^7.6.13",
|