@ai-zen/agents-sdk 1.0.0-alpha.2 → 1.0.0-alpha.21
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 +368 -0
- package/README.md +15 -14
- package/README.zh.md +15 -14
- package/dist/agent-plugins/AutoMigratePlugin.d.ts +35 -9
- package/dist/agent-plugins/AutoMigratePlugin.js +23 -10
- package/dist/agent-plugins/ContextGuardPlugin.d.ts +14 -16
- package/dist/agent-plugins/ContextGuardPlugin.js +13 -17
- package/dist/config/ConfigManager.d.ts +57 -8
- package/dist/config/ConfigManager.js +166 -25
- package/dist/config/constants.d.ts +7 -0
- package/dist/config/constants.js +38 -13
- package/dist/config/factory-skills.d.ts +33 -0
- package/dist/config/factory-skills.js +126 -0
- package/dist/config/migrate.d.ts +67 -0
- package/dist/config/migrate.js +127 -0
- package/dist/config/reasoning-presets.d.ts +37 -0
- package/dist/config/reasoning-presets.js +64 -0
- package/dist/index.d.ts +11 -5
- package/dist/index.js +10 -2
- package/dist/runtime/HandoffGuardPlugin.d.ts +35 -0
- package/dist/runtime/HandoffGuardPlugin.js +65 -0
- package/dist/runtime/HandoffService.d.ts +245 -0
- package/dist/runtime/HandoffService.js +472 -0
- package/dist/runtime/SdkAgent.d.ts +7 -1
- package/dist/runtime/SdkAgent.js +3 -0
- package/dist/runtime/createAgent.d.ts +16 -1
- package/dist/runtime/createAgent.js +10 -5
- package/dist/runtime/createModel.d.ts +8 -4
- package/dist/runtime/createModel.js +19 -2
- package/dist/scope/plugins/builtin/BatchEditTool.js +5 -2
- package/dist/scope/plugins/builtin/DownloadFileTool.js +1 -1
- package/dist/scope/plugins/builtin/EditTool.js +6 -1
- package/dist/scope/plugins/builtin/ExecTool.js +2 -2
- package/dist/scope/plugins/builtin/FindTextTool.js +6 -6
- package/dist/scope/plugins/builtin/GenerateImageTool.d.ts +1 -1
- package/dist/scope/plugins/builtin/GenerateImageTool.js +7 -7
- package/dist/scope/plugins/builtin/GlobTool.js +1 -1
- package/dist/scope/plugins/builtin/InspectFileTool.d.ts +2 -2
- package/dist/scope/plugins/builtin/InspectFileTool.js +5 -5
- package/dist/scope/plugins/builtin/LsTool.js +1 -1
- package/dist/scope/plugins/builtin/{ReadFileTool.d.ts → ReadTool.d.ts} +1 -1
- package/dist/scope/plugins/builtin/{ReadFileTool.js → ReadTool.js} +3 -3
- package/dist/scope/plugins/builtin/{ExecAsyncTool.d.ts → SpawnTool.d.ts} +1 -1
- package/dist/scope/plugins/builtin/{ExecAsyncTool.js → SpawnTool.js} +2 -2
- package/dist/scope/plugins/builtin/ViewImageTool.d.ts +6 -4
- package/dist/scope/plugins/builtin/ViewImageTool.js +43 -59
- package/dist/scope/plugins/builtin/{WriteFileTool.d.ts → WriteTool.d.ts} +1 -1
- package/dist/scope/plugins/builtin/{WriteFileTool.js → WriteTool.js} +2 -2
- package/dist/scope/plugins/builtin/index.d.ts +4 -4
- package/dist/scope/plugins/builtin/index.js +7 -7
- package/dist/scope/plugins/builtin/outputGuard.d.ts +2 -2
- package/dist/scope/plugins/builtin/outputGuard.js +1 -1
- package/dist/scope/plugins/mcp/McpScopePlugin.d.ts +1 -1
- package/dist/scope/plugins/mcp/McpScopePlugin.js +4 -3
- package/dist/scope/plugins/mcp/mcpTools.d.ts +9 -3
- package/dist/scope/plugins/mcp/mcpTools.js +196 -18
- package/dist/scope/plugins/skills/discover.js +1 -2
- package/dist/scope/plugins/skills/skillTools.js +0 -2
- package/dist/scope/plugins/subagents/subAgentTools.js +2 -1
- package/dist/shared/content-blocks.d.ts +108 -0
- package/dist/shared/content-blocks.js +253 -0
- package/dist/shared/errors.d.ts +4 -8
- package/dist/shared/errors.js +8 -14
- package/dist/types/index.d.ts +103 -10
- package/package.json +3 -3
- package/dist/runtime/TaskMigrationService.d.ts +0 -128
- package/dist/runtime/TaskMigrationService.js +0 -211
package/dist/config/constants.js
CHANGED
|
@@ -4,11 +4,20 @@ import { Message } from "@ai-zen/agents-core";
|
|
|
4
4
|
// ---------------------------------------------------------------------------
|
|
5
5
|
/** 默认 Agent ID */
|
|
6
6
|
export const DEFAULT_AGENT_ID = "default";
|
|
7
|
+
/**
|
|
8
|
+
* 出厂默认模型 id。
|
|
9
|
+
*
|
|
10
|
+
* 模型的**唯一真相源是 `AgentDefinition.modelId`**:配置里不再有 `defaultModel`,
|
|
11
|
+
* 会话存档里也不记模型。这个常量只用于给出厂默认 Agent 填一个初始值。
|
|
12
|
+
*/
|
|
13
|
+
export const DEFAULT_MODEL_ID = "deepseek-flash";
|
|
7
14
|
/** 默认 Agent 定义(不含时间戳) */
|
|
8
15
|
export const DEFAULT_AGENT_DEFINITION = {
|
|
9
16
|
id: DEFAULT_AGENT_ID,
|
|
10
17
|
name: "默认助手",
|
|
11
18
|
description: "默认的 AI 助手,适用于日常问答和任务执行。",
|
|
19
|
+
// 模型写在 Agent 定义上,是运行期唯一真相源(无 config.defaultModel 兜底)
|
|
20
|
+
modelId: DEFAULT_MODEL_ID,
|
|
12
21
|
messages: [
|
|
13
22
|
Message.System(`你是一个幽默风趣、严谨可靠的智能助手,请用中文回复。当前操作系统:${process.platform}。
|
|
14
23
|
|
|
@@ -82,7 +91,10 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
82
91
|
name: "DeepSeek",
|
|
83
92
|
apiKey: "",
|
|
84
93
|
baseUrl: "https://api.deepseek.com/v1",
|
|
85
|
-
description: "DeepSeek API
|
|
94
|
+
description: "DeepSeek API 端点(支持 Files API:本地文件上传后以 file_id 引用)",
|
|
95
|
+
// 唯一声明了 Files API 能力的出厂端点;其余端点本地文件走 base64 内联。
|
|
96
|
+
// 判断依据是能力位而非端点 id,用户自建端点只要声明即可享受上传。
|
|
97
|
+
capabilities: { filesApi: true },
|
|
86
98
|
},
|
|
87
99
|
],
|
|
88
100
|
// 模型清单(2026-10-03 依据各厂商官方来源核对):
|
|
@@ -95,9 +107,16 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
95
107
|
// 标了 `custom: true` 的条目视为用户自有,原样保留。实现见
|
|
96
108
|
// ConfigManager.syncManagedModels。
|
|
97
109
|
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
110
|
+
// tokenThresholds 的两条线都与模型的真实上下文窗口无关:
|
|
111
|
+
// handoff(软线,交接触发)与 guard(硬线,请求前强行阻断)。
|
|
112
|
+
// 出厂取值:窗口 ≥1M 的模型统一 handoff=250K / guard=375K(约窗口的 25% / 37.5%),
|
|
113
|
+
// glm-4.7-flash 窗口仅 200K,取 handoff=100K / guard=150K。
|
|
114
|
+
//
|
|
115
|
+
// reasoningPreset:应用层元数据,**SDK 不解释**(既不参与请求参数生成,也不影响运行行为)。
|
|
116
|
+
// 它由客户端(如 CLI)自己定义含义:指向哪张思考档位表、`/think` 能选哪几档。
|
|
117
|
+
// 之所以留在出厂定义里:字段声明与行为消费是两件事,出厂模型需要把它带上,
|
|
118
|
+
// 否则 `syncManagedModels` 会用出厂定义整块覆盖并抹掉应用声明的值。
|
|
119
|
+
// 不写这个字段 = 应用层视作「不可调档」(如 GLM-4.7 强制思考且无 reasoning_effort 参数)。
|
|
101
120
|
models: [
|
|
102
121
|
// ---------- OpenAI ----------
|
|
103
122
|
{
|
|
@@ -105,9 +124,10 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
105
124
|
name: "GPT-6 Astra",
|
|
106
125
|
endpointId: "openai",
|
|
107
126
|
modelName: "gpt-6-astra",
|
|
108
|
-
|
|
127
|
+
tokenThresholds: { handoff: 250_000, guard: 375_000 },
|
|
109
128
|
defaultParams: {},
|
|
110
129
|
vision: true,
|
|
130
|
+
reasoningPreset: "openai",
|
|
111
131
|
description: "OpenAI 最强旗舰(2026-09):高级分析、软件工程、深度研究与科学工作",
|
|
112
132
|
},
|
|
113
133
|
{
|
|
@@ -115,9 +135,10 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
115
135
|
name: "GPT-6.1 Sol",
|
|
116
136
|
endpointId: "openai",
|
|
117
137
|
modelName: "gpt-6.1-sol",
|
|
118
|
-
|
|
138
|
+
tokenThresholds: { handoff: 250_000, guard: 375_000 },
|
|
119
139
|
defaultParams: {},
|
|
120
140
|
vision: true,
|
|
141
|
+
reasoningPreset: "openai",
|
|
121
142
|
description: "OpenAI 最新旗舰(2026-09-29):Agentic Coding、计算机操作与文档密集型专业任务",
|
|
122
143
|
},
|
|
123
144
|
{
|
|
@@ -125,9 +146,10 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
125
146
|
name: "GPT-6 Luna",
|
|
126
147
|
endpointId: "openai",
|
|
127
148
|
modelName: "gpt-6-luna",
|
|
128
|
-
|
|
149
|
+
tokenThresholds: { handoff: 250_000, guard: 375_000 },
|
|
129
150
|
defaultParams: {},
|
|
130
151
|
vision: true,
|
|
152
|
+
reasoningPreset: "openai",
|
|
131
153
|
description: "OpenAI GPT-6 系列快速低成本模型:适合高吞吐、低延迟场景",
|
|
132
154
|
},
|
|
133
155
|
// ---------- 智谱 BigModel ----------
|
|
@@ -136,8 +158,9 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
136
158
|
name: "GLM-5.3",
|
|
137
159
|
endpointId: "bigmodelcn",
|
|
138
160
|
modelName: "glm-5.3",
|
|
139
|
-
|
|
161
|
+
tokenThresholds: { handoff: 250_000, guard: 375_000 },
|
|
140
162
|
defaultParams: { thinking: { type: "enabled" }, reasoning_effort: "max" },
|
|
163
|
+
reasoningPreset: "zhipu-5.3",
|
|
141
164
|
description: "智谱最新旗舰:复杂软件工程与长程 Agent 任务(强制开启思考,1M 上下文)",
|
|
142
165
|
},
|
|
143
166
|
{
|
|
@@ -145,9 +168,10 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
145
168
|
name: "GLM-5.3-Flash",
|
|
146
169
|
endpointId: "bigmodelcn",
|
|
147
170
|
modelName: "glm-5.3-flash",
|
|
148
|
-
|
|
171
|
+
tokenThresholds: { handoff: 250_000, guard: 375_000 },
|
|
149
172
|
defaultParams: { thinking: { type: "enabled" }, reasoning_effort: "max" },
|
|
150
173
|
vision: true,
|
|
174
|
+
reasoningPreset: "zhipu-5.3",
|
|
151
175
|
description: "智谱原生多模态模型(图片/视频/文件):视觉 Coding,1M 上下文",
|
|
152
176
|
},
|
|
153
177
|
{
|
|
@@ -155,9 +179,10 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
155
179
|
name: "GLM-5.3-FlashX",
|
|
156
180
|
endpointId: "bigmodelcn",
|
|
157
181
|
modelName: "glm-5.3-flashx",
|
|
158
|
-
|
|
182
|
+
tokenThresholds: { handoff: 250_000, guard: 375_000 },
|
|
159
183
|
defaultParams: { thinking: { type: "enabled" }, reasoning_effort: "max" },
|
|
160
184
|
vision: true,
|
|
185
|
+
reasoningPreset: "zhipu-5.3",
|
|
161
186
|
description: "GLM-5.3-Flash 高速版(200 tokens/s),原生多模态",
|
|
162
187
|
},
|
|
163
188
|
{
|
|
@@ -166,7 +191,7 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
166
191
|
endpointId: "bigmodelcn",
|
|
167
192
|
modelName: "glm-4.7-flash",
|
|
168
193
|
// 该模型真实窗口仅 200K,阈值下调至 100K(约窗口的 50%),留足 response 空间
|
|
169
|
-
|
|
194
|
+
tokenThresholds: { handoff: 100_000, guard: 150_000 },
|
|
170
195
|
defaultParams: {},
|
|
171
196
|
description: "智谱免费文本模型:200K 上下文,适合轻量任务",
|
|
172
197
|
},
|
|
@@ -176,9 +201,10 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
176
201
|
name: "DeepSeek-V4.1-Flash",
|
|
177
202
|
endpointId: "deepseek",
|
|
178
203
|
modelName: "deepseek-flash",
|
|
179
|
-
|
|
204
|
+
tokenThresholds: { handoff: 250_000, guard: 375_000 },
|
|
180
205
|
defaultParams: { thinking: { type: "enabled" } },
|
|
181
206
|
vision: true,
|
|
207
|
+
reasoningPreset: "deepseek",
|
|
182
208
|
description: "DeepSeek 旗舰(2026-09-10):552B MoE 非对称架构,原生多模态,1M 上下文",
|
|
183
209
|
},
|
|
184
210
|
],
|
|
@@ -206,7 +232,6 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
206
232
|
defaultSize: "1024x1024",
|
|
207
233
|
},
|
|
208
234
|
],
|
|
209
|
-
defaultModel: "deepseek-flash",
|
|
210
235
|
defaultImageModel: "cogview-4",
|
|
211
236
|
defaultAgent: "default",
|
|
212
237
|
defaultMigrationModel: "deepseek-flash",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 出厂 Skill 资产 —— 随 SDK 版本释放到 `<basePath>/skills/<id>/SKILL.md`。
|
|
3
|
+
*
|
|
4
|
+
* 为什么以 TS 字符串常量内联、而不是独立 .md 文件:
|
|
5
|
+
* SDK 用 `tsc` 直接编译,不拷贝非 TS 资源;内容内联后 `dist/` 天然携带,
|
|
6
|
+
* 无需额外打包步骤,也不依赖包内相对资源路径。
|
|
7
|
+
*
|
|
8
|
+
* 覆盖策略(与 `syncManagedModels` 同构):
|
|
9
|
+
* - 磁盘上的 SKILL.md frontmatter 里写了 `custom: "true"` → 视为用户自有,永不被覆盖;
|
|
10
|
+
* - 否则每次 `ConfigManager.bootstrap()` 同步为当前版本内容(模板属于产品行为,
|
|
11
|
+
* 改进了就要让老用户吃到)。
|
|
12
|
+
*/
|
|
13
|
+
/** 交接 Skill 的 id(目录名 = frontmatter name) */
|
|
14
|
+
export declare const HANDOFF_SKILL_ID = "handoff";
|
|
15
|
+
/**
|
|
16
|
+
* 交接文档兜底模板。
|
|
17
|
+
*
|
|
18
|
+
* 仅在磁盘上读不到 `handoff` Skill 时使用(用户删除 / 目录不可读)。
|
|
19
|
+
* 它是**保险丝**,不是第二真相源:正常路径下模板一律来自 SKILL.md。
|
|
20
|
+
*/
|
|
21
|
+
export declare const FALLBACK_HANDOFF_TEMPLATE: string;
|
|
22
|
+
/** 全部出厂 Skill(顺序无意义,按 id 去重) */
|
|
23
|
+
export declare const FACTORY_SKILLS: readonly {
|
|
24
|
+
id: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}[];
|
|
27
|
+
/**
|
|
28
|
+
* 判断一份 SKILL.md 是否被用户声明为自有。
|
|
29
|
+
*
|
|
30
|
+
* 只检查 frontmatter 区块内的 `custom: true`(允许带引号),
|
|
31
|
+
* 正文里出现同样的字样不生效——避免误判导致模板停止更新。
|
|
32
|
+
*/
|
|
33
|
+
export declare function isCustomSkill(content: string): boolean;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 出厂 Skill 资产 —— 随 SDK 版本释放到 `<basePath>/skills/<id>/SKILL.md`。
|
|
3
|
+
*
|
|
4
|
+
* 为什么以 TS 字符串常量内联、而不是独立 .md 文件:
|
|
5
|
+
* SDK 用 `tsc` 直接编译,不拷贝非 TS 资源;内容内联后 `dist/` 天然携带,
|
|
6
|
+
* 无需额外打包步骤,也不依赖包内相对资源路径。
|
|
7
|
+
*
|
|
8
|
+
* 覆盖策略(与 `syncManagedModels` 同构):
|
|
9
|
+
* - 磁盘上的 SKILL.md frontmatter 里写了 `custom: "true"` → 视为用户自有,永不被覆盖;
|
|
10
|
+
* - 否则每次 `ConfigManager.bootstrap()` 同步为当前版本内容(模板属于产品行为,
|
|
11
|
+
* 改进了就要让老用户吃到)。
|
|
12
|
+
*/
|
|
13
|
+
/** 交接 Skill 的 id(目录名 = frontmatter name) */
|
|
14
|
+
export const HANDOFF_SKILL_ID = "handoff";
|
|
15
|
+
/**
|
|
16
|
+
* 交接文档兜底模板。
|
|
17
|
+
*
|
|
18
|
+
* 仅在磁盘上读不到 `handoff` Skill 时使用(用户删除 / 目录不可读)。
|
|
19
|
+
* 它是**保险丝**,不是第二真相源:正常路径下模板一律来自 SKILL.md。
|
|
20
|
+
*/
|
|
21
|
+
export const FALLBACK_HANDOFF_TEMPLATE = [
|
|
22
|
+
"# 交接文档",
|
|
23
|
+
"",
|
|
24
|
+
"立即停工:不再实现任何功能、不继续未完成任务、不向用户提问。",
|
|
25
|
+
"唯一任务是:核实当前真实状态 → 把交接文档写到「本次交接参数」给出的路径。",
|
|
26
|
+
"",
|
|
27
|
+
"## 💬 对话断点",
|
|
28
|
+
"## 🎯 任务目标",
|
|
29
|
+
"## 📊 当前状态",
|
|
30
|
+
"## ✅ 已完成",
|
|
31
|
+
"## 📋 未完成",
|
|
32
|
+
"## 🧠 关键决策",
|
|
33
|
+
"## ⚠️ 约束与偏好",
|
|
34
|
+
"## 📁 文件索引",
|
|
35
|
+
"## 🔔 接手第一步",
|
|
36
|
+
"",
|
|
37
|
+
"无法核实的信息写「⚠️ 未核实」,禁止推测。",
|
|
38
|
+
].join("\n");
|
|
39
|
+
/** 出厂 Skill:交接(handoff) */
|
|
40
|
+
const HANDOFF_SKILL = `---
|
|
41
|
+
name: handoff
|
|
42
|
+
description: 编写任务交接文档——对话停手离场时,把任务目标、当前真实状态、关键决策与下一步写成一份可被他人直接接手的文档。
|
|
43
|
+
metadata:
|
|
44
|
+
custom: "false"
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
# 交接文档书写规范
|
|
48
|
+
|
|
49
|
+
## 何时适用
|
|
50
|
+
|
|
51
|
+
上下文即将超限触发任务迁移、用户明确要求「写交接文档」、或你被要求「交班」时。
|
|
52
|
+
|
|
53
|
+
## 铁律(违反即视为失败)
|
|
54
|
+
|
|
55
|
+
1. **立即停工**:不再实现任何功能、不继续未完成的任务、不顺手修 bug、不做重构。
|
|
56
|
+
2. **不向用户提问**,不做方案讨论,不征求确认。
|
|
57
|
+
3. 只做两件事:**核实当前真实状态** → **写文档**。
|
|
58
|
+
4. 允许读取类操作(read / ls / glob / find_text / inspect_file / cwd,以及 git status、git diff、git log 等只读命令)。
|
|
59
|
+
禁止修改工作区:不改源码、不 npm install、不 commit、不 push。唯一允许写入的文件是交接文档本身。
|
|
60
|
+
5. **一次性写完**,不要反复重写;不要读大文件;不要把长代码贴进文档。
|
|
61
|
+
|
|
62
|
+
## 落盘
|
|
63
|
+
|
|
64
|
+
路径由「本次交接参数」给出,**原样使用**,不得改名、不得换目录、不得省略。
|
|
65
|
+
用 write 工具写入后,用 read 回读一次,确认内容完整(无 read 能力时跳过此步)。
|
|
66
|
+
|
|
67
|
+
## 文档结构(按序书写,标题保持原样)
|
|
68
|
+
|
|
69
|
+
## 💬 对话断点
|
|
70
|
+
用户最后要求了什么、你最后回复/交付了什么。各一段,不要复述整段对话。
|
|
71
|
+
|
|
72
|
+
## 🎯 任务目标
|
|
73
|
+
用户到底想要什么(意图与验收标准),而不是你执行过的步骤清单。
|
|
74
|
+
|
|
75
|
+
## 📊 当前状态
|
|
76
|
+
分支与 commit、未提交改动、测试是否通过、有无进程/端口在跑、依赖是否装好。
|
|
77
|
+
|
|
78
|
+
## ✅ 已完成
|
|
79
|
+
每项写:做了什么 + 产出路径(文件/目录) + 怎么验证它确实生效。
|
|
80
|
+
|
|
81
|
+
## 📋 未完成
|
|
82
|
+
按优先级排列;每项写「下一步最小动作」,具体到文件或可执行命令。
|
|
83
|
+
|
|
84
|
+
## 🧠 关键决策
|
|
85
|
+
为什么这样做(取舍理由);以及走过的死路——防止接手者重蹈覆辙。
|
|
86
|
+
|
|
87
|
+
## ⚠️ 约束与偏好
|
|
88
|
+
用户强调过的规矩、项目约定、不可改动的部分、必须遵守的风格。
|
|
89
|
+
|
|
90
|
+
## 📁 文件索引
|
|
91
|
+
路径 + 作用 + 本次是否改动(新增 / 修改 / 仅阅读)。
|
|
92
|
+
|
|
93
|
+
## 🔔 接手第一步
|
|
94
|
+
3 条以内可直接执行的命令或动作,让接手者立刻能开工。
|
|
95
|
+
|
|
96
|
+
## 状态核实清单
|
|
97
|
+
|
|
98
|
+
- \`git status\` / \`git diff --stat\`:当前分支、是否有未提交改动
|
|
99
|
+
- 最近一次测试结果:跑过就写结果摘要;没跑就写「未运行」,**不要写「应该能过」**
|
|
100
|
+
- 交接涉及的关键文件:用 ls / read 确认确实存在于磁盘
|
|
101
|
+
- 正在运行的服务与端口:\`ps\` / \`lsof -i\` 或项目自带的启动脚本
|
|
102
|
+
|
|
103
|
+
> ⚠️ 若「本次交接参数」声明工具不可用:以上每一项都写「⚠️ 未核实」,**禁止推测**具体路径、进度与测试状态。
|
|
104
|
+
|
|
105
|
+
## 写作要求
|
|
106
|
+
|
|
107
|
+
- 每句话都要让接手者能「立刻开始干活」;禁止「继续开发」「完善功能」「优化一下」这类空话。
|
|
108
|
+
- 已无法在当前上下文中确定的信息,写「需向用户确认 XXX」,不要编造。
|
|
109
|
+
- 全文控制在 300 行以内。
|
|
110
|
+
`;
|
|
111
|
+
/** 全部出厂 Skill(顺序无意义,按 id 去重) */
|
|
112
|
+
export const FACTORY_SKILLS = [
|
|
113
|
+
{ id: HANDOFF_SKILL_ID, content: HANDOFF_SKILL },
|
|
114
|
+
];
|
|
115
|
+
/**
|
|
116
|
+
* 判断一份 SKILL.md 是否被用户声明为自有。
|
|
117
|
+
*
|
|
118
|
+
* 只检查 frontmatter 区块内的 `custom: true`(允许带引号),
|
|
119
|
+
* 正文里出现同样的字样不生效——避免误判导致模板停止更新。
|
|
120
|
+
*/
|
|
121
|
+
export function isCustomSkill(content) {
|
|
122
|
+
const match = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
123
|
+
if (!match)
|
|
124
|
+
return false;
|
|
125
|
+
return /^\s*custom:\s*["']?true["']?\s*$/m.test(match[1]);
|
|
126
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 配置字段迁移 —— 历史形状升级到当前形状
|
|
3
|
+
*
|
|
4
|
+
* 三条遗留字段被淘汰:
|
|
5
|
+
*
|
|
6
|
+
* 1. `Model.maxContextTokens` / `Model.maxContextChars` → **`Model.tokenThresholds`**
|
|
7
|
+
* 旧名字一直在误导:它既不是「模型的真实上下文窗口」,也不是单一概念。现在拆成两条线:
|
|
8
|
+
* `handoff`(交接阈值,软线)与 `guard`(强行阻断阈值,硬线)。
|
|
9
|
+
* `maxContextChars` 是 token 口径之前的历史遗留,按 `floor(chars / 4)` 折成 tokens
|
|
10
|
+
* (与旧代码的回退算法一致)后并入 `handoff`。
|
|
11
|
+
* 2. **`Model.reasoning` → `Model.reasoningPreset`**
|
|
12
|
+
* alpha.13 曾用 `reasoning: { efforts, disable? }` 在模型上声明思考能力,后来改成
|
|
13
|
+
* 「引用策略表里的名字」。未标 `custom` 的模型会被出厂定义整块覆盖,但**标了 `custom`
|
|
14
|
+
* 的模型会原地保留**,于是留下一个无人认识的 `reasoning` 死字段,同时因为缺
|
|
15
|
+
* `reasoningPreset` 而默默失去调档能力。这里删掉旧字段,并按**同 id 的出厂模型**
|
|
16
|
+
* 补上正确的策略名(同一 id 即同一厂商型号,协议能力不会因用户改过参数而变)。
|
|
17
|
+
*
|
|
18
|
+
* 迁移时机:`ConfigManager.read()` 读出即迁(内存里永远是当前形状);
|
|
19
|
+
* 落盘由 `ensureDefaultConfig()` 负责 —— 它比较迁移结果与磁盘原文,不同才写回,
|
|
20
|
+
* 因此迁移只发生一次,且不会在每次启动时无谓地改写文件。
|
|
21
|
+
*/
|
|
22
|
+
import type { AppConfig, Model } from "../types/index.js";
|
|
23
|
+
/** 当前字段名 */
|
|
24
|
+
export declare const TOKEN_THRESHOLDS_KEY = "tokenThresholds";
|
|
25
|
+
/** 已淘汰的旧字段名(仅迁移代码认识它们) */
|
|
26
|
+
export declare const LEGACY_TOKEN_FIELD = "maxContextTokens";
|
|
27
|
+
export declare const LEGACY_CHARS_FIELD = "maxContextChars";
|
|
28
|
+
export declare const LEGACY_REASONING_FIELD = "reasoning";
|
|
29
|
+
/**
|
|
30
|
+
* 旧数据缺失阈值时的交接阈值兜底。
|
|
31
|
+
*
|
|
32
|
+
* 与 CLI 新建模型的默认值一致;宁可给一个保守值,也不要让模型缺阈值——
|
|
33
|
+
* 缺阈值意味着既没有交接触发、也没有阻断保护。
|
|
34
|
+
*/
|
|
35
|
+
export declare const DEFAULT_HANDOFF_THRESHOLD = 128000;
|
|
36
|
+
/**
|
|
37
|
+
* 迁移单个模型条目。
|
|
38
|
+
*
|
|
39
|
+
* 优先级:已有 `tokenThresholds` 的成员 > 旧 tokens 字段 > 旧 chars 字段折算 > 兜底默认。
|
|
40
|
+
* 旧字段一律删除(连同一份数据里残留的脏值),保证迁移后的形状唯一。
|
|
41
|
+
* 已有 `handoff` 但缺 `guard` 时按 1.5 倍补齐。
|
|
42
|
+
*/
|
|
43
|
+
export declare function migrateModelThresholds(model: Model): {
|
|
44
|
+
model: Model;
|
|
45
|
+
changed: boolean;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* 迁移单个模型的思考能力声明:`reasoning` → `reasoningPreset`。
|
|
49
|
+
*
|
|
50
|
+
* 只处理「旧字段存在」这一种情况:字段一旦落盘消失,用户后续主动删掉
|
|
51
|
+
* `reasoningPreset`(表示「这个模型我不想调档」)就不会被反复补回来。
|
|
52
|
+
*/
|
|
53
|
+
export declare function migrateModelReasoning(model: Model): {
|
|
54
|
+
model: Model;
|
|
55
|
+
changed: boolean;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 迁移整个配置。只处理对话模型(`models`)——
|
|
59
|
+
* 图片模型(`imageModels`)既没有上下文阈值、也没有思考概念。
|
|
60
|
+
*
|
|
61
|
+
* 同时清除已废弃的 `defaultModel`:模型的真相源已改为 `AgentDefinition.modelId`,
|
|
62
|
+
* 配置级默认值连同字段一起消失(旧值先由 `ConfigManager.bootstrap()` 搬到默认 Agent 上)。
|
|
63
|
+
*/
|
|
64
|
+
export declare function migrateConfig(config: AppConfig): {
|
|
65
|
+
config: AppConfig;
|
|
66
|
+
changed: boolean;
|
|
67
|
+
};
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 配置字段迁移 —— 历史形状升级到当前形状
|
|
3
|
+
*
|
|
4
|
+
* 三条遗留字段被淘汰:
|
|
5
|
+
*
|
|
6
|
+
* 1. `Model.maxContextTokens` / `Model.maxContextChars` → **`Model.tokenThresholds`**
|
|
7
|
+
* 旧名字一直在误导:它既不是「模型的真实上下文窗口」,也不是单一概念。现在拆成两条线:
|
|
8
|
+
* `handoff`(交接阈值,软线)与 `guard`(强行阻断阈值,硬线)。
|
|
9
|
+
* `maxContextChars` 是 token 口径之前的历史遗留,按 `floor(chars / 4)` 折成 tokens
|
|
10
|
+
* (与旧代码的回退算法一致)后并入 `handoff`。
|
|
11
|
+
* 2. **`Model.reasoning` → `Model.reasoningPreset`**
|
|
12
|
+
* alpha.13 曾用 `reasoning: { efforts, disable? }` 在模型上声明思考能力,后来改成
|
|
13
|
+
* 「引用策略表里的名字」。未标 `custom` 的模型会被出厂定义整块覆盖,但**标了 `custom`
|
|
14
|
+
* 的模型会原地保留**,于是留下一个无人认识的 `reasoning` 死字段,同时因为缺
|
|
15
|
+
* `reasoningPreset` 而默默失去调档能力。这里删掉旧字段,并按**同 id 的出厂模型**
|
|
16
|
+
* 补上正确的策略名(同一 id 即同一厂商型号,协议能力不会因用户改过参数而变)。
|
|
17
|
+
*
|
|
18
|
+
* 迁移时机:`ConfigManager.read()` 读出即迁(内存里永远是当前形状);
|
|
19
|
+
* 落盘由 `ensureDefaultConfig()` 负责 —— 它比较迁移结果与磁盘原文,不同才写回,
|
|
20
|
+
* 因此迁移只发生一次,且不会在每次启动时无谓地改写文件。
|
|
21
|
+
*/
|
|
22
|
+
import { DEFAULT_APP_CONFIG } from "./constants.js";
|
|
23
|
+
/** 当前字段名 */
|
|
24
|
+
export const TOKEN_THRESHOLDS_KEY = "tokenThresholds";
|
|
25
|
+
/** 已淘汰的旧字段名(仅迁移代码认识它们) */
|
|
26
|
+
export const LEGACY_TOKEN_FIELD = "maxContextTokens";
|
|
27
|
+
export const LEGACY_CHARS_FIELD = "maxContextChars";
|
|
28
|
+
export const LEGACY_REASONING_FIELD = "reasoning";
|
|
29
|
+
/**
|
|
30
|
+
* 旧数据缺失阈值时的交接阈值兜底。
|
|
31
|
+
*
|
|
32
|
+
* 与 CLI 新建模型的默认值一致;宁可给一个保守值,也不要让模型缺阈值——
|
|
33
|
+
* 缺阈值意味着既没有交接触发、也没有阻断保护。
|
|
34
|
+
*/
|
|
35
|
+
export const DEFAULT_HANDOFF_THRESHOLD = 128_000;
|
|
36
|
+
function toPositiveInt(value) {
|
|
37
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0)
|
|
38
|
+
return undefined;
|
|
39
|
+
return Math.floor(value);
|
|
40
|
+
}
|
|
41
|
+
function readThresholds(value) {
|
|
42
|
+
if (typeof value !== "object" || value === null)
|
|
43
|
+
return {};
|
|
44
|
+
const raw = value;
|
|
45
|
+
return {
|
|
46
|
+
handoff: toPositiveInt(raw.handoff),
|
|
47
|
+
guard: toPositiveInt(raw.guard),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 迁移单个模型条目。
|
|
52
|
+
*
|
|
53
|
+
* 优先级:已有 `tokenThresholds` 的成员 > 旧 tokens 字段 > 旧 chars 字段折算 > 兜底默认。
|
|
54
|
+
* 旧字段一律删除(连同一份数据里残留的脏值),保证迁移后的形状唯一。
|
|
55
|
+
* 已有 `handoff` 但缺 `guard` 时按 1.5 倍补齐。
|
|
56
|
+
*/
|
|
57
|
+
export function migrateModelThresholds(model) {
|
|
58
|
+
const source = model;
|
|
59
|
+
const current = readThresholds(source[TOKEN_THRESHOLDS_KEY]);
|
|
60
|
+
const legacyTokens = toPositiveInt(source[LEGACY_TOKEN_FIELD]);
|
|
61
|
+
const legacyChars = toPositiveInt(source[LEGACY_CHARS_FIELD]);
|
|
62
|
+
const legacySingle = toPositiveInt(source.tokenThreshold);
|
|
63
|
+
const hasLegacy = LEGACY_TOKEN_FIELD in source ||
|
|
64
|
+
LEGACY_CHARS_FIELD in source ||
|
|
65
|
+
"tokenThreshold" in source;
|
|
66
|
+
const complete = current.handoff !== undefined && current.guard !== undefined;
|
|
67
|
+
if (!hasLegacy && complete)
|
|
68
|
+
return { model, changed: false };
|
|
69
|
+
const fromChars = legacyChars !== undefined ? Math.max(1, Math.floor(legacyChars / 4)) : undefined;
|
|
70
|
+
const handoff = current.handoff ?? legacyTokens ?? fromChars ?? legacySingle ?? DEFAULT_HANDOFF_THRESHOLD;
|
|
71
|
+
// 旧数据里没有 guard 这一项:按重构前 ContextGuardPlugin 的默认 ratio(1.5)折算一次,
|
|
72
|
+
// 让迁移后的实际行为与迁移前一致。这是**一次性**换算,落盘后两个值都是整数,
|
|
73
|
+
// 运行时不再有任何倍数关系(想调硬线就直接改 guard 的数字)。
|
|
74
|
+
const guard = current.guard ?? Math.round(handoff * 1.5);
|
|
75
|
+
const next = { ...source };
|
|
76
|
+
delete next[LEGACY_TOKEN_FIELD];
|
|
77
|
+
delete next[LEGACY_CHARS_FIELD];
|
|
78
|
+
delete next.tokenThreshold;
|
|
79
|
+
next[TOKEN_THRESHOLDS_KEY] = { handoff, guard };
|
|
80
|
+
return { model: next, changed: true };
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 迁移单个模型的思考能力声明:`reasoning` → `reasoningPreset`。
|
|
84
|
+
*
|
|
85
|
+
* 只处理「旧字段存在」这一种情况:字段一旦落盘消失,用户后续主动删掉
|
|
86
|
+
* `reasoningPreset`(表示「这个模型我不想调档」)就不会被反复补回来。
|
|
87
|
+
*/
|
|
88
|
+
export function migrateModelReasoning(model) {
|
|
89
|
+
const source = model;
|
|
90
|
+
if (!(LEGACY_REASONING_FIELD in source))
|
|
91
|
+
return { model, changed: false };
|
|
92
|
+
const next = { ...source };
|
|
93
|
+
delete next[LEGACY_REASONING_FIELD];
|
|
94
|
+
// 同 id 的出厂模型能告诉我们「这个型号属于哪套协议」
|
|
95
|
+
if (next.reasoningPreset === undefined) {
|
|
96
|
+
const factory = (DEFAULT_APP_CONFIG.models ?? []).find((item) => item.id === model.id);
|
|
97
|
+
if (factory?.reasoningPreset)
|
|
98
|
+
next.reasoningPreset = factory.reasoningPreset;
|
|
99
|
+
}
|
|
100
|
+
return { model: next, changed: true };
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* 迁移整个配置。只处理对话模型(`models`)——
|
|
104
|
+
* 图片模型(`imageModels`)既没有上下文阈值、也没有思考概念。
|
|
105
|
+
*
|
|
106
|
+
* 同时清除已废弃的 `defaultModel`:模型的真相源已改为 `AgentDefinition.modelId`,
|
|
107
|
+
* 配置级默认值连同字段一起消失(旧值先由 `ConfigManager.bootstrap()` 搬到默认 Agent 上)。
|
|
108
|
+
*/
|
|
109
|
+
export function migrateConfig(config) {
|
|
110
|
+
let changed = false;
|
|
111
|
+
const models = (config.models ?? []).map((model) => {
|
|
112
|
+
const thresholds = migrateModelThresholds(model);
|
|
113
|
+
const reasoning = migrateModelReasoning(thresholds.model);
|
|
114
|
+
if (thresholds.changed || reasoning.changed)
|
|
115
|
+
changed = true;
|
|
116
|
+
return reasoning.model;
|
|
117
|
+
});
|
|
118
|
+
const next = { ...config, models };
|
|
119
|
+
// 已废弃字段:不参与运行,也不允许再写回磁盘
|
|
120
|
+
if ("defaultModel" in next) {
|
|
121
|
+
delete next.defaultModel;
|
|
122
|
+
changed = true;
|
|
123
|
+
}
|
|
124
|
+
if (!changed)
|
|
125
|
+
return { config, changed };
|
|
126
|
+
return { config: next, changed };
|
|
127
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 思考预设 —— 出厂内容 + 策略表文件名
|
|
3
|
+
*
|
|
4
|
+
* 这里的内容只是**初始值**:`ConfigManager.ensureReasoningPresets()` 在首次运行时把它
|
|
5
|
+
* 写到 `<basePath>/reasoning-presets.json`,之后以磁盘文件为准(用户可改、可加)。
|
|
6
|
+
* 与 `DEFAULT_APP_CONFIG` 写进 `config.json` 完全同一个套路。
|
|
7
|
+
*
|
|
8
|
+
* ## 为什么这份数据在 SDK
|
|
9
|
+
*
|
|
10
|
+
* 它是**跨客户端共享的资产**:CLI 用它决定 `/think` 能选哪几档,桌面端同理;两端不该
|
|
11
|
+
* 各维护一份「智谱 5.3 只认 low/high/max」的知识。所以**定义、出厂内容、读写**都在 SDK。
|
|
12
|
+
*
|
|
13
|
+
* ## 但 SDK 不拿它生成请求参数
|
|
14
|
+
*
|
|
15
|
+
* 参数合并只有一条路:`{ ...model.defaultParams, ...agent.modelParams }`(见 `createModel`)。
|
|
16
|
+
* 客户端读表 → 限制可选强度 → 把选中档位的补丁**写进** `AgentDefinition.modelParams`,
|
|
17
|
+
* 于是配置本身就是事实,运行期不再查表。
|
|
18
|
+
*
|
|
19
|
+
* ## 为什么每张表长这样(**全部来自官方文档,不要凭印象改**)
|
|
20
|
+
*
|
|
21
|
+
* | 端点 | 官方依据 | 若写错会怎样 |
|
|
22
|
+
* |------|---------|-------------|
|
|
23
|
+
* | OpenAI | `openai-node` 的 `Shared.ReasoningEffort`(`none/minimal/low/medium/high/xhigh/max`) | 无 `thinking` 参数,写了会被当未知参数拒绝 → 表里干脆不出现该键 |
|
|
24
|
+
* | DeepSeek | `api-docs.deepseek.com/guides/thinking_mode` | 可调 `low/high/max`;关闭用 `thinking.type = "disabled"` |
|
|
25
|
+
* | 智谱 GLM-5.3 系 | `docs.bigmodel.cn/cn/guide/capabilities/thinking` | **只认** `low/high/max`,其余输入报错;**不再支持关闭**(传 disabled 也报错)→ 表里没有 `off` |
|
|
26
|
+
* | 智谱 GLM-4.7 | 同上 | 强制思考且无 `reasoning_effort` 参数 → 不给它挂策略 |
|
|
27
|
+
*
|
|
28
|
+
* 三个结构性保证,都是「表的形状」带来的,不需要任何代码分支:
|
|
29
|
+
* 1. 可选档位 = `Object.keys(levels)`,不会有「菜单里有、发出去报错」的档位;
|
|
30
|
+
* 2. 能否关闭思考 = 表里有没有 `off` 键;
|
|
31
|
+
* 3. 某个键属于思考参数 = 它在表里出现过 —— 写入时按此剔除旧值,不需要硬编码键名。
|
|
32
|
+
*/
|
|
33
|
+
import type { ReasoningPresets } from "../types/index.js";
|
|
34
|
+
/** 策略表文件名(位于 `<basePath>/` 下,与 `config.json` 同级) */
|
|
35
|
+
export declare const REASONING_PRESETS_FILE = "reasoning-presets.json";
|
|
36
|
+
/** 出厂策略表 */
|
|
37
|
+
export declare const FACTORY_REASONING_PRESETS: ReasoningPresets;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 思考预设 —— 出厂内容 + 策略表文件名
|
|
3
|
+
*
|
|
4
|
+
* 这里的内容只是**初始值**:`ConfigManager.ensureReasoningPresets()` 在首次运行时把它
|
|
5
|
+
* 写到 `<basePath>/reasoning-presets.json`,之后以磁盘文件为准(用户可改、可加)。
|
|
6
|
+
* 与 `DEFAULT_APP_CONFIG` 写进 `config.json` 完全同一个套路。
|
|
7
|
+
*
|
|
8
|
+
* ## 为什么这份数据在 SDK
|
|
9
|
+
*
|
|
10
|
+
* 它是**跨客户端共享的资产**:CLI 用它决定 `/think` 能选哪几档,桌面端同理;两端不该
|
|
11
|
+
* 各维护一份「智谱 5.3 只认 low/high/max」的知识。所以**定义、出厂内容、读写**都在 SDK。
|
|
12
|
+
*
|
|
13
|
+
* ## 但 SDK 不拿它生成请求参数
|
|
14
|
+
*
|
|
15
|
+
* 参数合并只有一条路:`{ ...model.defaultParams, ...agent.modelParams }`(见 `createModel`)。
|
|
16
|
+
* 客户端读表 → 限制可选强度 → 把选中档位的补丁**写进** `AgentDefinition.modelParams`,
|
|
17
|
+
* 于是配置本身就是事实,运行期不再查表。
|
|
18
|
+
*
|
|
19
|
+
* ## 为什么每张表长这样(**全部来自官方文档,不要凭印象改**)
|
|
20
|
+
*
|
|
21
|
+
* | 端点 | 官方依据 | 若写错会怎样 |
|
|
22
|
+
* |------|---------|-------------|
|
|
23
|
+
* | OpenAI | `openai-node` 的 `Shared.ReasoningEffort`(`none/minimal/low/medium/high/xhigh/max`) | 无 `thinking` 参数,写了会被当未知参数拒绝 → 表里干脆不出现该键 |
|
|
24
|
+
* | DeepSeek | `api-docs.deepseek.com/guides/thinking_mode` | 可调 `low/high/max`;关闭用 `thinking.type = "disabled"` |
|
|
25
|
+
* | 智谱 GLM-5.3 系 | `docs.bigmodel.cn/cn/guide/capabilities/thinking` | **只认** `low/high/max`,其余输入报错;**不再支持关闭**(传 disabled 也报错)→ 表里没有 `off` |
|
|
26
|
+
* | 智谱 GLM-4.7 | 同上 | 强制思考且无 `reasoning_effort` 参数 → 不给它挂策略 |
|
|
27
|
+
*
|
|
28
|
+
* 三个结构性保证,都是「表的形状」带来的,不需要任何代码分支:
|
|
29
|
+
* 1. 可选档位 = `Object.keys(levels)`,不会有「菜单里有、发出去报错」的档位;
|
|
30
|
+
* 2. 能否关闭思考 = 表里有没有 `off` 键;
|
|
31
|
+
* 3. 某个键属于思考参数 = 它在表里出现过 —— 写入时按此剔除旧值,不需要硬编码键名。
|
|
32
|
+
*/
|
|
33
|
+
/** 策略表文件名(位于 `<basePath>/` 下,与 `config.json` 同级) */
|
|
34
|
+
export const REASONING_PRESETS_FILE = "reasoning-presets.json";
|
|
35
|
+
/** 出厂策略表 */
|
|
36
|
+
export const FACTORY_REASONING_PRESETS = {
|
|
37
|
+
/** OpenAI 系:只认 `reasoning_effort`;关闭思考 = `"none"` */
|
|
38
|
+
openai: {
|
|
39
|
+
levels: {
|
|
40
|
+
minimal: { reasoning_effort: "minimal" },
|
|
41
|
+
low: { reasoning_effort: "low" },
|
|
42
|
+
medium: { reasoning_effort: "medium" },
|
|
43
|
+
high: { reasoning_effort: "high" },
|
|
44
|
+
off: { reasoning_effort: "none" },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
/** 智谱 GLM-5.3 / 5.3-Flash / 5.3-FlashX:只认三档,且**不能关闭思考** */
|
|
48
|
+
"zhipu-5.3": {
|
|
49
|
+
levels: {
|
|
50
|
+
low: { thinking: { type: "enabled" }, reasoning_effort: "low" },
|
|
51
|
+
high: { thinking: { type: "enabled" }, reasoning_effort: "high" },
|
|
52
|
+
max: { thinking: { type: "enabled" }, reasoning_effort: "max" },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
/** DeepSeek:`thinking` 开关 + `reasoning_effort`,可关闭 */
|
|
56
|
+
deepseek: {
|
|
57
|
+
levels: {
|
|
58
|
+
low: { thinking: { type: "enabled" }, reasoning_effort: "low" },
|
|
59
|
+
high: { thinking: { type: "enabled" }, reasoning_effort: "high" },
|
|
60
|
+
max: { thinking: { type: "enabled" }, reasoning_effort: "max" },
|
|
61
|
+
off: { thinking: { type: "disabled" } },
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { PermissionPolicy, AgentPermissions, Endpoint, Model, ImageModel, AgentDefinition, AppConfig, ToolEnv, McpIcon, McpAnnotations, McpToolDef, McpResourceDef, McpPromptDef, McpServerManifest, McpServerConfig, McpConnectionState, } from "./types/index.js";
|
|
1
|
+
export type { PermissionPolicy, AgentPermissions, Endpoint, EndpointCapabilities, Model, TokenThresholds, ModelParams, ReasoningPatch, ReasoningPreset, ReasoningPresets, ImageModel, AgentDefinition, AppConfig, ToolEnv, McpIcon, McpAnnotations, McpToolDef, McpResourceDef, McpPromptDef, McpServerManifest, McpServerConfig, McpConnectionState, } from "./types/index.js";
|
|
2
2
|
export { PermissionEvaluator } from "./scope/PermissionEvaluator.js";
|
|
3
3
|
export type { CandidateSets } from "./scope/PermissionEvaluator.js";
|
|
4
4
|
export { createDisclosureParam } from "./scope/disclosure.js";
|
|
@@ -20,26 +20,32 @@ export { SubAgentsScopePlugin } from "./scope/plugins/subagents/SubAgentsScopePl
|
|
|
20
20
|
export { allInOne } from "./scope/plugins/allInOne.js";
|
|
21
21
|
export type { AllInOneOptions } from "./scope/plugins/allInOne.js";
|
|
22
22
|
export { ConfigManager, DEFAULT_AGENT_ID, DEFAULT_AGENT_DEFINITION, DEFAULT_SUBAGENT_ID, DEFAULT_SUBAGENT_DEFINITION, DEFAULT_APP_CONFIG, DEFAULT_MCP_CONFIG, CONFIG_SUB_DIRS, } from "./config/ConfigManager.js";
|
|
23
|
+
export { FACTORY_SKILLS, HANDOFF_SKILL_ID, FALLBACK_HANDOFF_TEMPLATE, isCustomSkill, } from "./config/factory-skills.js";
|
|
24
|
+
export { FACTORY_REASONING_PRESETS, REASONING_PRESETS_FILE, } from "./config/reasoning-presets.js";
|
|
23
25
|
export { EntityRepository } from "./shared/EntityRepository.js";
|
|
24
26
|
export { AgentRepository } from "./crud/AgentRepository.js";
|
|
27
|
+
export { fileToContentSection, resolveModelAndEndpoint, supportsFilesApi, mimeOf, toDataUrl, base64ByteLength, contentHash, clearUploadCache, MIME_BY_EXT, DEFAULT_MAX_INLINE_BYTES, } from "./shared/content-blocks.js";
|
|
28
|
+
export type { FileSource, FileToSectionInput, FileToSectionResult, ContentTransport, UploadFn, } from "./shared/content-blocks.js";
|
|
25
29
|
export { createModel } from "./runtime/createModel.js";
|
|
26
30
|
export { SdkAgent } from "./runtime/SdkAgent.js";
|
|
27
31
|
export type { AgentPlugin, SendContext } from "./runtime/SdkAgent.js";
|
|
28
32
|
export { createAgent } from "./runtime/createAgent.js";
|
|
33
|
+
export type { CreateAgentOptions } from "./runtime/createAgent.js";
|
|
29
34
|
export { McpConnectionManager } from "./scope/plugins/mcp/McpConnectionManager.js";
|
|
30
35
|
export type { McpConnectOptions } from "./scope/plugins/mcp/McpConnectionManager.js";
|
|
31
36
|
export { SdkCallbackTool } from "./scope/plugins/builtin/SdkCallbackTool.js";
|
|
32
37
|
export type { SdkCallbackToolOptions } from "./scope/plugins/builtin/SdkCallbackTool.js";
|
|
33
|
-
export {
|
|
34
|
-
export type {
|
|
38
|
+
export { HandoffAbortedError, HandoffService } from "./runtime/HandoffService.js";
|
|
39
|
+
export type { HandoffContext, HandoffMode, HandoffParams, HandoffServiceOptions, MigrateParams, MigrationStrategy, } from "./runtime/HandoffService.js";
|
|
40
|
+
export { HandoffGuardPlugin } from "./runtime/HandoffGuardPlugin.js";
|
|
35
41
|
export { AutoMigratePlugin } from "./agent-plugins/AutoMigratePlugin.js";
|
|
36
|
-
export type { AutoMigrateOptions } from "./agent-plugins/AutoMigratePlugin.js";
|
|
42
|
+
export type { AutoMigrateOptions, AutoMigrateTriggerInfo, AutoMigrateModeResolver, } from "./agent-plugins/AutoMigratePlugin.js";
|
|
37
43
|
export { AutoRefreshToolsPlugin } from "./agent-plugins/AutoRefreshToolsPlugin.js";
|
|
38
44
|
export { ContextGuardPlugin } from "./agent-plugins/ContextGuardPlugin.js";
|
|
39
45
|
export type { ContextGuardOptions } from "./agent-plugins/ContextGuardPlugin.js";
|
|
40
46
|
export { UnknownToolHintPlugin } from "./agent-plugins/UnknownToolHintPlugin.js";
|
|
41
47
|
export { BUILTIN_TOOL_CLASSES } from "./scope/plugins/builtin/index.js";
|
|
42
|
-
export { CwdTool,
|
|
48
|
+
export { CwdTool, ReadTool, InspectFileTool, WriteTool, ExecTool, MkdirTool, RmTool, GlobTool, LsTool, ExistTool, FindTextTool, DownloadFileTool, RenameTool, CopyTool, BatchEditTool, EditTool, SpawnTool, SleepTool, } from "./scope/plugins/builtin/index.js";
|
|
43
49
|
export { GenerateImageTool } from "./scope/plugins/builtin/GenerateImageTool.js";
|
|
44
50
|
export { ViewImageTool } from "./scope/plugins/builtin/ViewImageTool.js";
|
|
45
51
|
export { createLoadSkillTool, createCallSkillSubAgentTool } from "./scope/plugins/skills/skillTools.js";
|