@ai-zen/agents-sdk 1.0.0-alpha.9 → 1.0.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.
Files changed (86) hide show
  1. package/CHANGELOG.md +651 -2
  2. package/README.md +22 -6
  3. package/README.zh.md +23 -7
  4. package/dist/agent-plugins/AutoMigratePlugin.d.ts +35 -9
  5. package/dist/agent-plugins/AutoMigratePlugin.js +21 -10
  6. package/dist/agent-plugins/AutoRefreshToolsPlugin.js +1 -3
  7. package/dist/agent-plugins/ContextGuardPlugin.d.ts +28 -16
  8. package/dist/agent-plugins/ContextGuardPlugin.js +23 -17
  9. package/dist/agent-plugins/UnknownToolHintPlugin.js +4 -4
  10. package/dist/config/ConfigManager.d.ts +57 -8
  11. package/dist/config/ConfigManager.js +167 -26
  12. package/dist/config/constants.d.ts +7 -0
  13. package/dist/config/constants.js +70 -43
  14. package/dist/config/factory-skills.d.ts +33 -0
  15. package/dist/config/factory-skills.js +126 -0
  16. package/dist/config/migrate.d.ts +106 -0
  17. package/dist/config/migrate.js +196 -0
  18. package/dist/config/reasoning-presets.d.ts +37 -0
  19. package/dist/config/reasoning-presets.js +64 -0
  20. package/dist/index.d.ts +13 -7
  21. package/dist/index.js +11 -3
  22. package/dist/runtime/HandoffGuardPlugin.d.ts +35 -0
  23. package/dist/runtime/HandoffGuardPlugin.js +65 -0
  24. package/dist/runtime/HandoffService.d.ts +246 -0
  25. package/dist/runtime/HandoffService.js +475 -0
  26. package/dist/runtime/SdkAgent.d.ts +7 -1
  27. package/dist/runtime/SdkAgent.js +3 -0
  28. package/dist/runtime/createAgent.d.ts +20 -1
  29. package/dist/runtime/createAgent.js +14 -9
  30. package/dist/runtime/createModel.d.ts +8 -4
  31. package/dist/runtime/createModel.js +22 -5
  32. package/dist/scope/PermissionEvaluator.js +1 -1
  33. package/dist/scope/Scope.d.ts +3 -1
  34. package/dist/scope/Scope.js +4 -2
  35. package/dist/scope/plugins/builtin/BatchEditTool.js +24 -14
  36. package/dist/scope/plugins/builtin/CopyTool.js +4 -4
  37. package/dist/scope/plugins/builtin/CwdTool.js +1 -1
  38. package/dist/scope/plugins/builtin/DownloadFileTool.d.ts +1 -0
  39. package/dist/scope/plugins/builtin/DownloadFileTool.js +58 -34
  40. package/dist/scope/plugins/builtin/EditTool.js +25 -25
  41. package/dist/scope/plugins/builtin/ExecTool.js +134 -25
  42. package/dist/scope/plugins/builtin/ExistTool.js +2 -2
  43. package/dist/scope/plugins/builtin/FindTextTool.js +15 -10
  44. package/dist/scope/plugins/builtin/GenerateImageTool.js +91 -25
  45. package/dist/scope/plugins/builtin/GlobTool.js +10 -5
  46. package/dist/scope/plugins/builtin/InspectFileTool.js +7 -7
  47. package/dist/scope/plugins/builtin/LsTool.js +5 -5
  48. package/dist/scope/plugins/builtin/MkdirTool.js +3 -3
  49. package/dist/scope/plugins/builtin/ReadTool.js +8 -8
  50. package/dist/scope/plugins/builtin/RenameTool.js +3 -3
  51. package/dist/scope/plugins/builtin/RmTool.js +3 -3
  52. package/dist/scope/plugins/builtin/SleepTool.js +6 -6
  53. package/dist/scope/plugins/builtin/SpawnTool.js +32 -49
  54. package/dist/scope/plugins/builtin/ViewImageTool.d.ts +6 -4
  55. package/dist/scope/plugins/builtin/ViewImageTool.js +50 -62
  56. package/dist/scope/plugins/builtin/WriteTool.js +3 -3
  57. package/dist/scope/plugins/builtin/searchBase.d.ts +9 -0
  58. package/dist/scope/plugins/builtin/searchBase.js +17 -0
  59. package/dist/scope/plugins/builtin/test-helpers.d.ts +3 -3
  60. package/dist/scope/plugins/builtin/test-helpers.js +3 -3
  61. package/dist/scope/plugins/builtin/textEdit.d.ts +17 -0
  62. package/dist/scope/plugins/builtin/textEdit.js +37 -0
  63. package/dist/scope/plugins/mcp/McpConnectionManager.d.ts +9 -1
  64. package/dist/scope/plugins/mcp/McpConnectionManager.js +95 -16
  65. package/dist/scope/plugins/mcp/McpScopePlugin.d.ts +1 -1
  66. package/dist/scope/plugins/mcp/McpScopePlugin.js +8 -6
  67. package/dist/scope/plugins/mcp/discover.js +1 -1
  68. package/dist/scope/plugins/mcp/mcpTools.d.ts +9 -3
  69. package/dist/scope/plugins/mcp/mcpTools.js +247 -37
  70. package/dist/scope/plugins/skills/SkillsScopePlugin.js +2 -3
  71. package/dist/scope/plugins/skills/discover.js +28 -9
  72. package/dist/scope/plugins/skills/skillTools.js +30 -20
  73. package/dist/scope/plugins/subagents/SubAgentsScopePlugin.js +1 -3
  74. package/dist/scope/plugins/subagents/subAgentTools.js +4 -3
  75. package/dist/scope/plugins/usertools/discover.d.ts +8 -3
  76. package/dist/scope/plugins/usertools/discover.js +139 -12
  77. package/dist/shared/EntityRepository.d.ts +10 -1
  78. package/dist/shared/EntityRepository.js +18 -6
  79. package/dist/shared/content-blocks.d.ts +101 -0
  80. package/dist/shared/content-blocks.js +253 -0
  81. package/dist/shared/errors.d.ts +4 -8
  82. package/dist/shared/errors.js +8 -14
  83. package/dist/types/index.d.ts +170 -8
  84. package/package.json +16 -7
  85. package/dist/runtime/TaskMigrationService.d.ts +0 -128
  86. package/dist/runtime/TaskMigrationService.js +0 -211
@@ -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
+ "# Handoff Document",
23
+ "",
24
+ "Stop work immediately: implement no further features, do not continue unfinished tasks, and do not ask the user questions.",
25
+ "Your only task is: verify the actual current state → write the handoff document to the path given by the handoff parameters.",
26
+ "",
27
+ "## 💬 Conversation Breakpoint",
28
+ "## 🎯 Task Goal",
29
+ "## 📊 Current State",
30
+ "## ✅ Completed",
31
+ "## 📋 Not Completed",
32
+ "## 🧠 Key Decisions",
33
+ "## ⚠️ Constraints and Preferences",
34
+ "## 📁 File Index",
35
+ "## 🔔 First Step for the Next Agent",
36
+ "",
37
+ 'For anything you cannot verify, write "⚠️ Unverified"; speculation is forbidden.',
38
+ ].join("\n");
39
+ /** 出厂 Skill:交接(handoff) */
40
+ const HANDOFF_SKILL = `---
41
+ name: handoff
42
+ description: Write a task handoff document — when you stop work and leave the conversation, put the task goal, the actual current state, key decisions and next steps into a document that someone else can pick up directly.
43
+ metadata:
44
+ custom: "false"
45
+ ---
46
+
47
+ # Handoff Document Writing Standard
48
+
49
+ ## When It Applies
50
+
51
+ When the context is about to overflow and trigger a task migration, when the user explicitly asks you to "write a handoff document", or when you are asked to "hand over".
52
+
53
+ ## Iron Rules (violating any of them counts as failure)
54
+
55
+ 1. **Stop work immediately**: implement no further features, do not continue unfinished tasks, do not fix bugs in passing, do not refactor.
56
+ 2. **Do not ask the user questions**, do not discuss approaches, do not ask for confirmation.
57
+ 3. Do only two things: **verify the actual current state** → **write the document**.
58
+ 4. Read-only operations are allowed (read / ls / glob / find_text / inspect_file / cwd, plus read-only commands such as git status, git diff, git log).
59
+ Modifying the workspace is forbidden: do not change source code, do not npm install, do not commit, do not push. The only file you are allowed to write is the handoff document itself.
60
+ 5. **Write it in one pass**, do not rewrite it over and over; do not read large files; do not paste long code into the document.
61
+
62
+ ## Writing the File
63
+
64
+ The path is given by the handoff parameters — **use it verbatim**; do not rename it, do not move it to another directory, do not omit it.
65
+ After writing with the write tool, read it back once with the read tool to confirm the content is complete (skip this step if you have no read capability).
66
+
67
+ ## Document Structure (write in this order, keep the headings exactly as they are)
68
+
69
+ ## 💬 Conversation Breakpoint
70
+ What the user last asked for, and what you last replied with or delivered. One paragraph each; do not restate the whole conversation.
71
+
72
+ ## 🎯 Task Goal
73
+ What the user actually wants (intent and acceptance criteria), not a checklist of the steps you performed.
74
+
75
+ ## 📊 Current State
76
+ Branch and commit, uncommitted changes, whether tests pass, whether any process/port is running, whether dependencies are installed.
77
+
78
+ ## ✅ Completed
79
+ For each item write: what was done + the output path (file/directory) + how to verify that it really took effect.
80
+
81
+ ## 📋 Not Completed
82
+ Order by priority; for each item write "the smallest next action", down to a specific file or runnable command.
83
+
84
+ ## 🧠 Key Decisions
85
+ Why it was done this way (the trade-off reasoning); and the dead ends you walked into — so the next person does not repeat them.
86
+
87
+ ## ⚠️ Constraints and Preferences
88
+ Rules the user stressed, project conventions, parts that must not be changed, styles that must be followed.
89
+
90
+ ## 📁 File Index
91
+ Path + purpose + whether it changed this time (added / modified / read only).
92
+
93
+ ## 🔔 First Step for the Next Agent
94
+ At most 3 commands or actions that can be run directly, so the next person can start working immediately.
95
+
96
+ ## State Verification Checklist
97
+
98
+ - \`git status\` / \`git diff --stat\`: current branch, whether there are uncommitted changes
99
+ - The latest test result: if you ran tests, write a summary of the result; if you did not, write "not run" — **do not write "it should pass"**
100
+ - Key files involved in the handoff: use ls / read to confirm they really exist on disk
101
+ - Running services and ports: \`ps\` / \`lsof -i\`, or the project's own start script
102
+
103
+ > ⚠️ If the handoff parameters state that tools are unavailable: write "⚠️ Unverified" for every item above; **speculation is forbidden** about specific paths, progress and test status.
104
+
105
+ ## Writing Requirements
106
+
107
+ - Every sentence must let the next person "start working immediately"; empty phrases such as "continue development", "polish the features", "do some optimization" are forbidden.
108
+ - For information you can no longer determine in the current context, write "needs user confirmation on XXX"; do not fabricate it.
109
+ - Keep the whole document within 300 lines.
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,106 @@
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
+ * 另有一类「缺省值缺位」的迁移:`Endpoint.capabilities`(见 `normalizeEndpointCapabilities`)。
19
+ *
20
+ * 迁移时机:`ConfigManager.read()` 读出即迁(内存里永远是当前形状);
21
+ * 落盘由 `ensureDefaultConfig()` 负责 —— 它比较迁移结果与磁盘原文,不同才写回,
22
+ * 因此迁移只发生一次,且不会在每次启动时无谓地改写文件。
23
+ */
24
+ import type { AppConfig, Model } from "../types/index.js";
25
+ /** 当前字段名 */
26
+ export declare const TOKEN_THRESHOLDS_KEY = "tokenThresholds";
27
+ /** 已淘汰的旧字段名(仅迁移代码认识它们) */
28
+ export declare const LEGACY_TOKEN_FIELD = "maxContextTokens";
29
+ export declare const LEGACY_CHARS_FIELD = "maxContextChars";
30
+ export declare const LEGACY_REASONING_FIELD = "reasoning";
31
+ /**
32
+ * 旧数据缺失阈值时的交接阈值兜底。
33
+ *
34
+ * 与 CLI 新建模型的默认值一致;宁可给一个保守值,也不要让模型缺阈值——
35
+ * 缺阈值意味着既没有交接触发、也没有阻断保护。
36
+ */
37
+ export declare const DEFAULT_HANDOFF_THRESHOLD = 128000;
38
+ /**
39
+ * 迁移单个模型条目。
40
+ *
41
+ * 优先级:已有 `tokenThresholds` 的成员 > 旧 tokens 字段 > 旧 chars 字段折算 > 兜底默认。
42
+ * 旧字段一律删除(连同一份数据里残留的脏值),保证迁移后的形状唯一。
43
+ * 已有 `handoff` 但缺 `guard` 时按 1.5 倍补齐。
44
+ */
45
+ export declare function migrateModelThresholds(model: Model): {
46
+ model: Model;
47
+ changed: boolean;
48
+ };
49
+ /**
50
+ * 迁移单个模型的思考能力声明:`reasoning` → `reasoningPreset`。
51
+ *
52
+ * 只处理「旧字段存在」这一种情况:字段一旦落盘消失,用户后续主动删掉
53
+ * `reasoningPreset`(表示「这个模型我不想调档」)就不会被反复补回来。
54
+ */
55
+ export declare function migrateModelReasoning(model: Model): {
56
+ model: Model;
57
+ changed: boolean;
58
+ };
59
+ /**
60
+ * 迁移整个配置。只处理对话模型(`models`)——
61
+ * 图片模型(`imageModels`)既没有上下文阈值、也没有思考概念。
62
+ *
63
+ * 同时做两件字段级收敛:
64
+ * - 清除已废弃的 `defaultModel`(模型真相源已改为 `AgentDefinition.modelId`);
65
+ * - 补齐中断策略(`abortedMessageStrategy` / `abortedToolRoundStrategy`):把缺失或
66
+ * 非法值写成出厂默认。这样「配置即事实」——文件里写着的就是运行时用的,不再需要
67
+ * 使用方各自 `?? "keep"` 地兵分两路兜底。
68
+ */
69
+ export declare function migrateConfig(config: AppConfig): {
70
+ config: AppConfig;
71
+ changed: boolean;
72
+ };
73
+ /** 合法的中断策略取值(与 core 的枚举一致) */
74
+ export declare const ABORTED_MESSAGE_STRATEGIES: readonly ["keep", "drop"];
75
+ export declare const ABORTED_TOOL_ROUND_STRATEGIES: readonly ["fill", "drop"];
76
+ /** 缺失 / 非法 → 出厂默认;返回是否有改动(直接改写传入对象) */
77
+ export declare function normalizeAbortStrategies(config: AppConfig): boolean;
78
+ /**
79
+ * 补齐端点**缺失**的能力位声明(`Endpoint.capabilities`)。
80
+ *
81
+ * ## 这个问题是怎么来的
82
+ *
83
+ * `capabilities.filesApi` 是 alpha.12 才引入的能力位 —— 同一版把 `view_image` 的判定
84
+ * 从「端点 id 是不是 `deepseek`」改成「看这一位」,并只给**出厂 deepseek** 打了 `true`。
85
+ * 但端点**不参与出厂托管**(`ConfigManager.syncManagedModels` 明写「保持用户配置」),
86
+ * 迁移此前也完全不碰 `endpoints` —— 于是 alpha.12 之前就已写下的配置,其 deepseek
87
+ * 端点永远缺 `capabilities`,`supportsFilesApi()` 恒为 `false`:
88
+ *
89
+ * · 出厂承诺的「deepseek 走 Files API」对这些用户从未生效;
90
+ * · 而且**全程静默** —— 「未声明能力位」和「缺 apiKey」两个分支都不发 warning,
91
+ * 图片 / `view_image` / MCP 媒体就悄悄退化成 base64 内联,请求体随历史膨胀。
92
+ *
93
+ * 这是「默认值缺位」,不是「用户选择」,所以由迁移补 —— 与模型清单不同,端点本身仍然
94
+ * 归用户所有,我们只往**空位**里放出厂默认。
95
+ *
96
+ * ## 边界:只补整体缺失,绝不覆盖
97
+ *
98
+ * - `capabilities` **整体缺失** → 按**同 id 的出厂端点**补上整块;
99
+ * - `capabilities` 已存在(哪怕是 `{}`、哪怕写着 `filesApi: false`)→ 一个字段都不动:
100
+ * 用户已经表过态,`false` 就是「我不走 Files API」;
101
+ * - 端点 id 不在出厂清单(用户自建)→ 不动:我们不知道它是否真有 `/files`,
102
+ * 猜错会把上传请求打到不存在的接口上。
103
+ *
104
+ * @returns 是否有改动(直接改写传入对象)
105
+ */
106
+ export declare function normalizeEndpointCapabilities(config: AppConfig): boolean;
@@ -0,0 +1,196 @@
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
+ * 另有一类「缺省值缺位」的迁移:`Endpoint.capabilities`(见 `normalizeEndpointCapabilities`)。
19
+ *
20
+ * 迁移时机:`ConfigManager.read()` 读出即迁(内存里永远是当前形状);
21
+ * 落盘由 `ensureDefaultConfig()` 负责 —— 它比较迁移结果与磁盘原文,不同才写回,
22
+ * 因此迁移只发生一次,且不会在每次启动时无谓地改写文件。
23
+ */
24
+ import { DEFAULT_APP_CONFIG } from "./constants.js";
25
+ /** 当前字段名 */
26
+ export const TOKEN_THRESHOLDS_KEY = "tokenThresholds";
27
+ /** 已淘汰的旧字段名(仅迁移代码认识它们) */
28
+ export const LEGACY_TOKEN_FIELD = "maxContextTokens";
29
+ export const LEGACY_CHARS_FIELD = "maxContextChars";
30
+ export const LEGACY_REASONING_FIELD = "reasoning";
31
+ /**
32
+ * 旧数据缺失阈值时的交接阈值兜底。
33
+ *
34
+ * 与 CLI 新建模型的默认值一致;宁可给一个保守值,也不要让模型缺阈值——
35
+ * 缺阈值意味着既没有交接触发、也没有阻断保护。
36
+ */
37
+ export const DEFAULT_HANDOFF_THRESHOLD = 128_000;
38
+ function toPositiveInt(value) {
39
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0)
40
+ return undefined;
41
+ return Math.floor(value);
42
+ }
43
+ function readThresholds(value) {
44
+ if (typeof value !== "object" || value === null)
45
+ return {};
46
+ const raw = value;
47
+ return {
48
+ handoff: toPositiveInt(raw.handoff),
49
+ guard: toPositiveInt(raw.guard),
50
+ };
51
+ }
52
+ /**
53
+ * 迁移单个模型条目。
54
+ *
55
+ * 优先级:已有 `tokenThresholds` 的成员 > 旧 tokens 字段 > 旧 chars 字段折算 > 兜底默认。
56
+ * 旧字段一律删除(连同一份数据里残留的脏值),保证迁移后的形状唯一。
57
+ * 已有 `handoff` 但缺 `guard` 时按 1.5 倍补齐。
58
+ */
59
+ export function migrateModelThresholds(model) {
60
+ const source = model;
61
+ const current = readThresholds(source[TOKEN_THRESHOLDS_KEY]);
62
+ const legacyTokens = toPositiveInt(source[LEGACY_TOKEN_FIELD]);
63
+ const legacyChars = toPositiveInt(source[LEGACY_CHARS_FIELD]);
64
+ const legacySingle = toPositiveInt(source.tokenThreshold);
65
+ const hasLegacy = LEGACY_TOKEN_FIELD in source || LEGACY_CHARS_FIELD in source || "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
+ * 同时做两件字段级收敛:
107
+ * - 清除已废弃的 `defaultModel`(模型真相源已改为 `AgentDefinition.modelId`);
108
+ * - 补齐中断策略(`abortedMessageStrategy` / `abortedToolRoundStrategy`):把缺失或
109
+ * 非法值写成出厂默认。这样「配置即事实」——文件里写着的就是运行时用的,不再需要
110
+ * 使用方各自 `?? "keep"` 地兵分两路兜底。
111
+ */
112
+ export function migrateConfig(config) {
113
+ let changed = false;
114
+ const models = (config.models ?? []).map((model) => {
115
+ const thresholds = migrateModelThresholds(model);
116
+ const reasoning = migrateModelReasoning(thresholds.model);
117
+ if (thresholds.changed || reasoning.changed)
118
+ changed = true;
119
+ return reasoning.model;
120
+ });
121
+ const next = {
122
+ ...config,
123
+ models,
124
+ // 端点数组浅拷贝:能力位补齐会改元素,不把副作用浇到调用方手里的旧对象上
125
+ endpoints: (config.endpoints ?? []).map((endpoint) => ({ ...endpoint })),
126
+ };
127
+ // 已废弃字段:不参与运行,也不允许再写回磁盘
128
+ if ("defaultModel" in next) {
129
+ delete next.defaultModel;
130
+ changed = true;
131
+ }
132
+ if (normalizeAbortStrategies(next))
133
+ changed = true;
134
+ if (normalizeEndpointCapabilities(next))
135
+ changed = true;
136
+ if (!changed)
137
+ return { config, changed };
138
+ return { config: next, changed };
139
+ }
140
+ /** 合法的中断策略取值(与 core 的枚举一致) */
141
+ export const ABORTED_MESSAGE_STRATEGIES = ["keep", "drop"];
142
+ export const ABORTED_TOOL_ROUND_STRATEGIES = ["fill", "drop"];
143
+ /** 缺失 / 非法 → 出厂默认;返回是否有改动(直接改写传入对象) */
144
+ export function normalizeAbortStrategies(config) {
145
+ let changed = false;
146
+ if (!ABORTED_MESSAGE_STRATEGIES.includes(config.abortedMessageStrategy)) {
147
+ config.abortedMessageStrategy = DEFAULT_APP_CONFIG.abortedMessageStrategy;
148
+ changed = true;
149
+ }
150
+ if (!ABORTED_TOOL_ROUND_STRATEGIES.includes(config.abortedToolRoundStrategy)) {
151
+ config.abortedToolRoundStrategy = DEFAULT_APP_CONFIG.abortedToolRoundStrategy;
152
+ changed = true;
153
+ }
154
+ return changed;
155
+ }
156
+ /**
157
+ * 补齐端点**缺失**的能力位声明(`Endpoint.capabilities`)。
158
+ *
159
+ * ## 这个问题是怎么来的
160
+ *
161
+ * `capabilities.filesApi` 是 alpha.12 才引入的能力位 —— 同一版把 `view_image` 的判定
162
+ * 从「端点 id 是不是 `deepseek`」改成「看这一位」,并只给**出厂 deepseek** 打了 `true`。
163
+ * 但端点**不参与出厂托管**(`ConfigManager.syncManagedModels` 明写「保持用户配置」),
164
+ * 迁移此前也完全不碰 `endpoints` —— 于是 alpha.12 之前就已写下的配置,其 deepseek
165
+ * 端点永远缺 `capabilities`,`supportsFilesApi()` 恒为 `false`:
166
+ *
167
+ * · 出厂承诺的「deepseek 走 Files API」对这些用户从未生效;
168
+ * · 而且**全程静默** —— 「未声明能力位」和「缺 apiKey」两个分支都不发 warning,
169
+ * 图片 / `view_image` / MCP 媒体就悄悄退化成 base64 内联,请求体随历史膨胀。
170
+ *
171
+ * 这是「默认值缺位」,不是「用户选择」,所以由迁移补 —— 与模型清单不同,端点本身仍然
172
+ * 归用户所有,我们只往**空位**里放出厂默认。
173
+ *
174
+ * ## 边界:只补整体缺失,绝不覆盖
175
+ *
176
+ * - `capabilities` **整体缺失** → 按**同 id 的出厂端点**补上整块;
177
+ * - `capabilities` 已存在(哪怕是 `{}`、哪怕写着 `filesApi: false`)→ 一个字段都不动:
178
+ * 用户已经表过态,`false` 就是「我不走 Files API」;
179
+ * - 端点 id 不在出厂清单(用户自建)→ 不动:我们不知道它是否真有 `/files`,
180
+ * 猜错会把上传请求打到不存在的接口上。
181
+ *
182
+ * @returns 是否有改动(直接改写传入对象)
183
+ */
184
+ export function normalizeEndpointCapabilities(config) {
185
+ let changed = false;
186
+ for (const endpoint of config.endpoints ?? []) {
187
+ if (endpoint.capabilities != null)
188
+ continue;
189
+ const factory = (DEFAULT_APP_CONFIG.endpoints ?? []).find((item) => item.id === endpoint.id);
190
+ if (!factory?.capabilities)
191
+ continue;
192
+ endpoint.capabilities = { ...factory.capabilities };
193
+ changed = true;
194
+ }
195
+ return changed;
196
+ }
@@ -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, ToolEnvDeps, GenerateImageFn, 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";
@@ -10,7 +10,7 @@ export type { SkillInfo, Frontmatter } from "./scope/plugins/skills/discover.js"
10
10
  export { discoverMcpServers } from "./scope/plugins/mcp/discover.js";
11
11
  export { discoverUserTools } from "./scope/plugins/usertools/discover.js";
12
12
  export { Scope } from "./scope/Scope.js";
13
- export type { FilterOutput, ExcludeOptions, FilterOptions, } from "./scope/Scope.js";
13
+ export type { FilterOutput, ExcludeOptions, FilterOptions } from "./scope/Scope.js";
14
14
  export type { ScopePlugin, ScopeCandidates } from "./scope/ScopePlugin.js";
15
15
  export { BuiltinToolsScopePlugin } from "./scope/plugins/builtin/BuiltinToolsScopePlugin.js";
16
16
  export { UserToolsScopePlugin } from "./scope/plugins/usertools/UserToolsScopePlugin.js";
@@ -20,20 +20,26 @@ 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 { TaskMigrationService } from "./runtime/TaskMigrationService.js";
34
- export type { MigrationContext, MigrationStrategy, TaskMigrationServiceOptions, } from "./runtime/TaskMigrationService.js";
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";
@@ -42,8 +48,8 @@ export { BUILTIN_TOOL_CLASSES } from "./scope/plugins/builtin/index.js";
42
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
- export { createLoadSkillTool, createCallSkillSubAgentTool } from "./scope/plugins/skills/skillTools.js";
46
- export { createLoadMcpTool, createCallMcpTool, createReadMcpResourceTool } from "./scope/plugins/mcp/mcpTools.js";
51
+ export { createLoadSkillTool, createCallSkillSubAgentTool, } from "./scope/plugins/skills/skillTools.js";
52
+ export { createLoadMcpTool, createCallMcpTool, createReadMcpResourceTool, } from "./scope/plugins/mcp/mcpTools.js";
47
53
  export { createSubAgentTool } from "./scope/plugins/subagents/subAgentTools.js";
48
54
  export { getLogger, setLogger } from "./shared/logger.js";
49
55
  export type { Logger, LogFunctions } from "./shared/logger.js";
package/dist/index.js CHANGED
@@ -17,16 +17,24 @@ export { SubAgentsScopePlugin } from "./scope/plugins/subagents/SubAgentsScopePl
17
17
  export { allInOne } from "./scope/plugins/allInOne.js";
18
18
  // 配置 — ConfigManager
19
19
  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";
20
+ // 出厂资产 — 出厂 Skill(随版本释放到 <basePath>/skills/)
21
+ export { FACTORY_SKILLS, HANDOFF_SKILL_ID, FALLBACK_HANDOFF_TEMPLATE, isCustomSkill, } from "./config/factory-skills.js";
22
+ // 出厂资产 — 思考策略表(随版本释放到 <basePath>/reasoning-presets.json)
23
+ // 表是跨客户端共享的「定义 + 出厂默认」,SDK 不拿它生成请求参数
24
+ export { FACTORY_REASONING_PRESETS, REASONING_PRESETS_FILE } from "./config/reasoning-presets.js";
20
25
  // CRUD — 实体仓储(仅 Agent 定义等能力实体)
21
26
  export { EntityRepository } from "./shared/EntityRepository.js";
22
27
  export { AgentRepository } from "./crud/AgentRepository.js";
28
+ // 文件 → 内容块(统一入口)— 上层应用构造媒体消息时请走这里,不要自己判断上传还是内联
29
+ export { fileToContentSection, resolveModelAndEndpoint, supportsFilesApi, mimeOf, toDataUrl, base64ByteLength, contentHash, clearUploadCache, MIME_BY_EXT, DEFAULT_MAX_INLINE_BYTES, } from "./shared/content-blocks.js";
23
30
  // 运行时
24
31
  export { createModel } from "./runtime/createModel.js";
25
32
  export { SdkAgent } from "./runtime/SdkAgent.js";
26
33
  export { createAgent } from "./runtime/createAgent.js";
27
34
  export { McpConnectionManager } from "./scope/plugins/mcp/McpConnectionManager.js";
28
35
  export { SdkCallbackTool } from "./scope/plugins/builtin/SdkCallbackTool.js";
29
- export { TaskMigrationService } from "./runtime/TaskMigrationService.js";
36
+ export { HandoffAbortedError, HandoffService } from "./runtime/HandoffService.js";
37
+ export { HandoffGuardPlugin } from "./runtime/HandoffGuardPlugin.js";
30
38
  // 插件
31
39
  export { AutoMigratePlugin } from "./agent-plugins/AutoMigratePlugin.js";
32
40
  export { AutoRefreshToolsPlugin } from "./agent-plugins/AutoRefreshToolsPlugin.js";
@@ -37,8 +45,8 @@ export { BUILTIN_TOOL_CLASSES } from "./scope/plugins/builtin/index.js";
37
45
  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";
38
46
  export { GenerateImageTool } from "./scope/plugins/builtin/GenerateImageTool.js";
39
47
  export { ViewImageTool } from "./scope/plugins/builtin/ViewImageTool.js";
40
- export { createLoadSkillTool, createCallSkillSubAgentTool } from "./scope/plugins/skills/skillTools.js";
41
- export { createLoadMcpTool, createCallMcpTool, createReadMcpResourceTool } from "./scope/plugins/mcp/mcpTools.js";
48
+ export { createLoadSkillTool, createCallSkillSubAgentTool, } from "./scope/plugins/skills/skillTools.js";
49
+ export { createLoadMcpTool, createCallMcpTool, createReadMcpResourceTool, } from "./scope/plugins/mcp/mcpTools.js";
42
50
  export { createSubAgentTool } from "./scope/plugins/subagents/subAgentTools.js";
43
51
  // 共享
44
52
  export { getLogger, setLogger } from "./shared/logger.js";