@amical/aiagent-sdk 0.1.10 → 0.1.12
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/{WebMemoryManager-DXxLUDBB.d.ts → WebMemoryManager-BZNjinHF.d.ts} +10 -3
- package/dist/{WebMemoryManager-Bk19j8i6.d.mts → WebMemoryManager-DpaY-f0l.d.mts} +10 -3
- package/dist/index.d.mts +71 -4
- package/dist/index.d.ts +71 -4
- package/dist/index.js +223 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +220 -34
- package/dist/index.mjs.map +1 -1
- package/dist/runtime/nodeRuntime.d.mts +12 -3
- package/dist/runtime/nodeRuntime.d.ts +12 -3
- package/dist/runtime/nodeRuntime.js +357 -47
- package/dist/runtime/nodeRuntime.js.map +1 -1
- package/dist/runtime/nodeRuntime.mjs +354 -48
- package/dist/runtime/nodeRuntime.mjs.map +1 -1
- package/dist/runtime/webRuntime.d.mts +3 -2
- package/dist/runtime/webRuntime.d.ts +3 -2
- package/dist/runtime/webRuntime.js +357 -47
- package/dist/runtime/webRuntime.js.map +1 -1
- package/dist/runtime/webRuntime.mjs +354 -48
- package/dist/runtime/webRuntime.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2,16 +2,16 @@ import { IMemoryManager, AgentMessage } from './index.js';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Web 端 MemoryManager 实现
|
|
5
|
-
* 使用
|
|
6
|
-
* 此处提供一个基于 SessionStorage / 内存 回退的轻量实现。
|
|
5
|
+
* 使用 SessionStorage / 内存 回退来持久化对话历史。
|
|
7
6
|
*/
|
|
8
7
|
declare class WebMemoryManager implements IMemoryManager {
|
|
9
8
|
private storageKey;
|
|
10
9
|
private maxMessages;
|
|
11
10
|
private inMemoryFallback;
|
|
11
|
+
onCondense?: () => void | Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* @param storageKey SessionStorage 中的键名
|
|
14
|
-
* @param maxMessages 保留的最大消息数量,用于简单的历史截断(默认
|
|
14
|
+
* @param maxMessages 保留的最大消息数量,用于简单的历史截断(默认 200)
|
|
15
15
|
*/
|
|
16
16
|
constructor(storageKey?: string, maxMessages?: number);
|
|
17
17
|
private isStorageAvailable;
|
|
@@ -19,6 +19,13 @@ declare class WebMemoryManager implements IMemoryManager {
|
|
|
19
19
|
private writeMessages;
|
|
20
20
|
getHistory(): Promise<AgentMessage[]>;
|
|
21
21
|
appendMessage(message: AgentMessage): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 压缩历史:
|
|
24
|
+
* - system 消息保持不变
|
|
25
|
+
* - 以 agent_attempt_completion 为边界切分完整对话,仅合并“后面还有其他完整对话”的旧完整对话
|
|
26
|
+
* - 其余需要压缩的场景下,对前半段工具调用结果标记为“结果已过期”
|
|
27
|
+
* - 同时触发 onCondense 回调(宿主可据此清空 dify conversationId 新开窗口)
|
|
28
|
+
*/
|
|
22
29
|
condenseHistory(): Promise<void>;
|
|
23
30
|
clear(): Promise<void>;
|
|
24
31
|
}
|
|
@@ -2,16 +2,16 @@ import { IMemoryManager, AgentMessage } from './index.mjs';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Web 端 MemoryManager 实现
|
|
5
|
-
* 使用
|
|
6
|
-
* 此处提供一个基于 SessionStorage / 内存 回退的轻量实现。
|
|
5
|
+
* 使用 SessionStorage / 内存 回退来持久化对话历史。
|
|
7
6
|
*/
|
|
8
7
|
declare class WebMemoryManager implements IMemoryManager {
|
|
9
8
|
private storageKey;
|
|
10
9
|
private maxMessages;
|
|
11
10
|
private inMemoryFallback;
|
|
11
|
+
onCondense?: () => void | Promise<void>;
|
|
12
12
|
/**
|
|
13
13
|
* @param storageKey SessionStorage 中的键名
|
|
14
|
-
* @param maxMessages 保留的最大消息数量,用于简单的历史截断(默认
|
|
14
|
+
* @param maxMessages 保留的最大消息数量,用于简单的历史截断(默认 200)
|
|
15
15
|
*/
|
|
16
16
|
constructor(storageKey?: string, maxMessages?: number);
|
|
17
17
|
private isStorageAvailable;
|
|
@@ -19,6 +19,13 @@ declare class WebMemoryManager implements IMemoryManager {
|
|
|
19
19
|
private writeMessages;
|
|
20
20
|
getHistory(): Promise<AgentMessage[]>;
|
|
21
21
|
appendMessage(message: AgentMessage): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* 压缩历史:
|
|
24
|
+
* - system 消息保持不变
|
|
25
|
+
* - 以 agent_attempt_completion 为边界切分完整对话,仅合并“后面还有其他完整对话”的旧完整对话
|
|
26
|
+
* - 其余需要压缩的场景下,对前半段工具调用结果标记为“结果已过期”
|
|
27
|
+
* - 同时触发 onCondense 回调(宿主可据此清空 dify conversationId 新开窗口)
|
|
28
|
+
*/
|
|
22
29
|
condenseHistory(): Promise<void>;
|
|
23
30
|
clear(): Promise<void>;
|
|
24
31
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -113,9 +113,11 @@ declare const defaultTools: readonly [{
|
|
|
113
113
|
readonly example: "## Example: Requesting to make targeted edits to a file\n\n<agent_replace_in_file>\n<path>src/components/App.tsx</path>\n<diff>\n------- SEARCH\nimport React from 'react';\n=======\nimport React, { useState } from 'react';\n+++++++ REPLACE\n\n------- SEARCH\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\n=======\n+++++++ REPLACE\n\n------- SEARCH\nreturn (\n <div>\n=======\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\nreturn (\n <div>\n+++++++ REPLACE\n</diff>\n<task_progress>\n- [x] Set up project structure\n- [x] Install dependencies\n- [ ] Create components\n- [ ] Test application\n</task_progress>\n</agent_replace_in_file>";
|
|
114
114
|
}, {
|
|
115
115
|
readonly name: AgentDefaultTool.FILE_READ;
|
|
116
|
-
readonly description: "Read the contents of a specific file.";
|
|
116
|
+
readonly description: "Read the contents of a specific file. The returned content includes line numbers (e.g. '10|const x = 1;') so you can reference exact lines when editing.";
|
|
117
117
|
readonly params: {
|
|
118
118
|
readonly path: "(required) The absolute or relative file path to read.";
|
|
119
|
+
readonly start_line: "(optional) The 1-based line number to start reading from (inclusive). Defaults to 1.";
|
|
120
|
+
readonly end_line: "(optional) The 1-based line number to stop reading at (inclusive). Defaults to the last line.";
|
|
119
121
|
};
|
|
120
122
|
}, {
|
|
121
123
|
readonly name: AgentDefaultTool.FILE_NEW;
|
|
@@ -180,6 +182,43 @@ declare function setDynamicToolUseNames(namespace: string, names: string[]): voi
|
|
|
180
182
|
declare function getToolUseNames(): string[];
|
|
181
183
|
declare const READ_ONLY_TOOLS: readonly [AgentDefaultTool.LIST_FILES, AgentDefaultTool.FILE_READ, AgentDefaultTool.SEARCH, AgentDefaultTool.SEARCH_CONTENT, AgentDefaultTool.LIST_CODE_DEF, AgentDefaultTool.BROWSER, AgentDefaultTool.ASK, AgentDefaultTool.WEB_SEARCH, AgentDefaultTool.WEB_FETCH, AgentDefaultTool.LOAD_SKILL, AgentDefaultTool.USE_SUBAGENTS];
|
|
182
184
|
|
|
185
|
+
/**
|
|
186
|
+
* 自定义工具的数据结构与渲染辅助函数。
|
|
187
|
+
*
|
|
188
|
+
* 自定义工具支持“工具集(tool group)”结构:
|
|
189
|
+
* - 顶层只展示工具集入口(name/description/params),避免系统提示词臃肿。
|
|
190
|
+
* - 当 Agent 调用某个工具集入口时,才把该集合的 children 注册为可用工具,
|
|
191
|
+
* 并将其 prompt 描述作为工具调用结果返回给模型。
|
|
192
|
+
*/
|
|
193
|
+
interface CustomToolDefinition {
|
|
194
|
+
name: string;
|
|
195
|
+
description: string;
|
|
196
|
+
params?: Record<string, string>;
|
|
197
|
+
onCall?: (params: Record<string, any>) => Promise<any> | any;
|
|
198
|
+
/**
|
|
199
|
+
* 子工具。存在时表示该工具为“工具集入口”,初始不展开 children。
|
|
200
|
+
*/
|
|
201
|
+
children?: CustomToolDefinition[];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 判断一个自定义工具是否为工具集入口。
|
|
205
|
+
*/
|
|
206
|
+
declare function isCustomToolGroup(tool: CustomToolDefinition): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* 递归收集所有自定义工具名(含嵌套 children),用于全局唯一性校验。
|
|
209
|
+
*/
|
|
210
|
+
declare function collectCustomToolNames(tools: CustomToolDefinition[]): string[];
|
|
211
|
+
/**
|
|
212
|
+
* 将单个工具定义渲染为系统提示词中的工具说明块。
|
|
213
|
+
*
|
|
214
|
+
* 注意:该函数只渲染工具自身的 name/description/params,不会展开 children。
|
|
215
|
+
*/
|
|
216
|
+
declare function renderCustomToolPrompt(tool: CustomToolDefinition, cwd?: string): string;
|
|
217
|
+
/**
|
|
218
|
+
* 批量渲染工具说明。
|
|
219
|
+
*/
|
|
220
|
+
declare function renderCustomToolsPrompt(tools: CustomToolDefinition[], cwd?: string): string;
|
|
221
|
+
|
|
183
222
|
/**
|
|
184
223
|
* @description **Version 2**
|
|
185
224
|
* Parses an assistant message string potentially containing mixed text and tool usage blocks
|
|
@@ -313,6 +352,10 @@ interface IMemoryManager {
|
|
|
313
352
|
* 截断或压缩过长历史
|
|
314
353
|
*/
|
|
315
354
|
condenseHistory?(): Promise<void>;
|
|
355
|
+
/**
|
|
356
|
+
* 当历史被压缩时触发(宿主可在此处理例如 dify provider 清空 conversationId 等逻辑)
|
|
357
|
+
*/
|
|
358
|
+
onCondense?: () => void | Promise<void>;
|
|
316
359
|
/**
|
|
317
360
|
* 清空记忆
|
|
318
361
|
*/
|
|
@@ -352,6 +395,7 @@ interface IApiHandler {
|
|
|
352
395
|
* 获取当前配置的模型信息
|
|
353
396
|
*/
|
|
354
397
|
getModelInfo(): ApiProviderInfo;
|
|
398
|
+
clearConversationId(): void;
|
|
355
399
|
}
|
|
356
400
|
|
|
357
401
|
/**
|
|
@@ -417,7 +461,7 @@ interface AgentOptions {
|
|
|
417
461
|
promptManager: IPromptManager;
|
|
418
462
|
memory: IMemoryManager;
|
|
419
463
|
mcp?: IMcpManager;
|
|
420
|
-
customTools?:
|
|
464
|
+
customTools?: CustomToolDefinition[];
|
|
421
465
|
allowDefaultTools?: string[];
|
|
422
466
|
customInstructions?: string;
|
|
423
467
|
/** 最大循环次数,默认150 */
|
|
@@ -451,10 +495,20 @@ declare class ClineAgent {
|
|
|
451
495
|
private maxLoopCount;
|
|
452
496
|
skillDir: string;
|
|
453
497
|
rulesDir: string;
|
|
454
|
-
customTools:
|
|
498
|
+
customTools: CustomToolDefinition[];
|
|
499
|
+
/** 当前可用(已展开集合)的顶层工具列表,传给 PromptManager 渲染 */
|
|
500
|
+
activeCustomTools: CustomToolDefinition[];
|
|
501
|
+
/** 所有已知工具名(含未激活 children),便于查找定义 */
|
|
502
|
+
customToolsByName: Map<string, CustomToolDefinition>;
|
|
455
503
|
customToolNames: Set<string>;
|
|
456
504
|
allowDefaultTools?: string[];
|
|
457
505
|
customInstructions?: string;
|
|
506
|
+
/** 已激活的工具集入口名 */
|
|
507
|
+
private activatedGroups;
|
|
508
|
+
/** activeCustomTools 变更版本号,用于 Prompt 缓存失效 */
|
|
509
|
+
private activeToolsVersion;
|
|
510
|
+
/** 缓存 sysPrompt 时记录的版本号 */
|
|
511
|
+
private promptActiveToolsVersion;
|
|
458
512
|
sysPrompt?: string;
|
|
459
513
|
noUseTollSysPrompt?: string;
|
|
460
514
|
onStateChange?: (state: AgentState) => void;
|
|
@@ -486,6 +540,19 @@ declare class ClineAgent {
|
|
|
486
540
|
* 核心任务循环
|
|
487
541
|
*/
|
|
488
542
|
private loop;
|
|
543
|
+
/**
|
|
544
|
+
* 激活自定义工具集:将入口的 children 注册到活跃工具列表并返回渲染后的 prompt。
|
|
545
|
+
*/
|
|
546
|
+
private activateCustomToolGroup;
|
|
547
|
+
/**
|
|
548
|
+
* 检查自上次获取 prompt 后是否有工具集被激活,若有则刷新缓存。
|
|
549
|
+
*/
|
|
550
|
+
private getCurrentPrompt;
|
|
551
|
+
/**
|
|
552
|
+
* 将文件内容格式化为带行号文本(模拟编辑器行号显示),
|
|
553
|
+
* 支持通过 start_line / end_line 截取读取范围。
|
|
554
|
+
*/
|
|
555
|
+
private formatFileContentWithLineNumbers;
|
|
489
556
|
/**
|
|
490
557
|
* 简单的 Diff 解析与替换辅助方法
|
|
491
558
|
*/
|
|
@@ -513,4 +580,4 @@ declare class ClineAgent {
|
|
|
513
580
|
|
|
514
581
|
declare const VERSION = "0.1.0";
|
|
515
582
|
|
|
516
|
-
export { AgentDefaultTool, type AgentMessage, type AgentOptions, AgentState, type ApiProviderInfo, type ApiStreamChunk, type AssistantMessageContent, ClineAgent, type IAgentRuntime, type IApiHandler, type IMcpManager, type IMemoryManager, type IPromptManager, type McpServerInfo, type McpTool, type McpToolCallResult, READ_ONLY_TOOLS, type ReasoningStreamContent, TOOL_RESULT_BLOCK, type TextStreamContent, type ToolParamName, type ToolUse, VERSION, defaultTools, getToolUseNames, parseAssistantMessageV2, setDynamicToolUseNames, toolParamNames, toolUseNames };
|
|
583
|
+
export { AgentDefaultTool, type AgentMessage, type AgentOptions, AgentState, type ApiProviderInfo, type ApiStreamChunk, type AssistantMessageContent, ClineAgent, type CustomToolDefinition, type IAgentRuntime, type IApiHandler, type IMcpManager, type IMemoryManager, type IPromptManager, type McpServerInfo, type McpTool, type McpToolCallResult, READ_ONLY_TOOLS, type ReasoningStreamContent, TOOL_RESULT_BLOCK, type TextStreamContent, type ToolParamName, type ToolUse, VERSION, collectCustomToolNames, defaultTools, getToolUseNames, isCustomToolGroup, parseAssistantMessageV2, renderCustomToolPrompt, renderCustomToolsPrompt, setDynamicToolUseNames, toolParamNames, toolUseNames };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,9 +113,11 @@ declare const defaultTools: readonly [{
|
|
|
113
113
|
readonly example: "## Example: Requesting to make targeted edits to a file\n\n<agent_replace_in_file>\n<path>src/components/App.tsx</path>\n<diff>\n------- SEARCH\nimport React from 'react';\n=======\nimport React, { useState } from 'react';\n+++++++ REPLACE\n\n------- SEARCH\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\n=======\n+++++++ REPLACE\n\n------- SEARCH\nreturn (\n <div>\n=======\nfunction handleSubmit() {\n saveData();\n setLoading(false);\n}\n\nreturn (\n <div>\n+++++++ REPLACE\n</diff>\n<task_progress>\n- [x] Set up project structure\n- [x] Install dependencies\n- [ ] Create components\n- [ ] Test application\n</task_progress>\n</agent_replace_in_file>";
|
|
114
114
|
}, {
|
|
115
115
|
readonly name: AgentDefaultTool.FILE_READ;
|
|
116
|
-
readonly description: "Read the contents of a specific file.";
|
|
116
|
+
readonly description: "Read the contents of a specific file. The returned content includes line numbers (e.g. '10|const x = 1;') so you can reference exact lines when editing.";
|
|
117
117
|
readonly params: {
|
|
118
118
|
readonly path: "(required) The absolute or relative file path to read.";
|
|
119
|
+
readonly start_line: "(optional) The 1-based line number to start reading from (inclusive). Defaults to 1.";
|
|
120
|
+
readonly end_line: "(optional) The 1-based line number to stop reading at (inclusive). Defaults to the last line.";
|
|
119
121
|
};
|
|
120
122
|
}, {
|
|
121
123
|
readonly name: AgentDefaultTool.FILE_NEW;
|
|
@@ -180,6 +182,43 @@ declare function setDynamicToolUseNames(namespace: string, names: string[]): voi
|
|
|
180
182
|
declare function getToolUseNames(): string[];
|
|
181
183
|
declare const READ_ONLY_TOOLS: readonly [AgentDefaultTool.LIST_FILES, AgentDefaultTool.FILE_READ, AgentDefaultTool.SEARCH, AgentDefaultTool.SEARCH_CONTENT, AgentDefaultTool.LIST_CODE_DEF, AgentDefaultTool.BROWSER, AgentDefaultTool.ASK, AgentDefaultTool.WEB_SEARCH, AgentDefaultTool.WEB_FETCH, AgentDefaultTool.LOAD_SKILL, AgentDefaultTool.USE_SUBAGENTS];
|
|
182
184
|
|
|
185
|
+
/**
|
|
186
|
+
* 自定义工具的数据结构与渲染辅助函数。
|
|
187
|
+
*
|
|
188
|
+
* 自定义工具支持“工具集(tool group)”结构:
|
|
189
|
+
* - 顶层只展示工具集入口(name/description/params),避免系统提示词臃肿。
|
|
190
|
+
* - 当 Agent 调用某个工具集入口时,才把该集合的 children 注册为可用工具,
|
|
191
|
+
* 并将其 prompt 描述作为工具调用结果返回给模型。
|
|
192
|
+
*/
|
|
193
|
+
interface CustomToolDefinition {
|
|
194
|
+
name: string;
|
|
195
|
+
description: string;
|
|
196
|
+
params?: Record<string, string>;
|
|
197
|
+
onCall?: (params: Record<string, any>) => Promise<any> | any;
|
|
198
|
+
/**
|
|
199
|
+
* 子工具。存在时表示该工具为“工具集入口”,初始不展开 children。
|
|
200
|
+
*/
|
|
201
|
+
children?: CustomToolDefinition[];
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* 判断一个自定义工具是否为工具集入口。
|
|
205
|
+
*/
|
|
206
|
+
declare function isCustomToolGroup(tool: CustomToolDefinition): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* 递归收集所有自定义工具名(含嵌套 children),用于全局唯一性校验。
|
|
209
|
+
*/
|
|
210
|
+
declare function collectCustomToolNames(tools: CustomToolDefinition[]): string[];
|
|
211
|
+
/**
|
|
212
|
+
* 将单个工具定义渲染为系统提示词中的工具说明块。
|
|
213
|
+
*
|
|
214
|
+
* 注意:该函数只渲染工具自身的 name/description/params,不会展开 children。
|
|
215
|
+
*/
|
|
216
|
+
declare function renderCustomToolPrompt(tool: CustomToolDefinition, cwd?: string): string;
|
|
217
|
+
/**
|
|
218
|
+
* 批量渲染工具说明。
|
|
219
|
+
*/
|
|
220
|
+
declare function renderCustomToolsPrompt(tools: CustomToolDefinition[], cwd?: string): string;
|
|
221
|
+
|
|
183
222
|
/**
|
|
184
223
|
* @description **Version 2**
|
|
185
224
|
* Parses an assistant message string potentially containing mixed text and tool usage blocks
|
|
@@ -313,6 +352,10 @@ interface IMemoryManager {
|
|
|
313
352
|
* 截断或压缩过长历史
|
|
314
353
|
*/
|
|
315
354
|
condenseHistory?(): Promise<void>;
|
|
355
|
+
/**
|
|
356
|
+
* 当历史被压缩时触发(宿主可在此处理例如 dify provider 清空 conversationId 等逻辑)
|
|
357
|
+
*/
|
|
358
|
+
onCondense?: () => void | Promise<void>;
|
|
316
359
|
/**
|
|
317
360
|
* 清空记忆
|
|
318
361
|
*/
|
|
@@ -352,6 +395,7 @@ interface IApiHandler {
|
|
|
352
395
|
* 获取当前配置的模型信息
|
|
353
396
|
*/
|
|
354
397
|
getModelInfo(): ApiProviderInfo;
|
|
398
|
+
clearConversationId(): void;
|
|
355
399
|
}
|
|
356
400
|
|
|
357
401
|
/**
|
|
@@ -417,7 +461,7 @@ interface AgentOptions {
|
|
|
417
461
|
promptManager: IPromptManager;
|
|
418
462
|
memory: IMemoryManager;
|
|
419
463
|
mcp?: IMcpManager;
|
|
420
|
-
customTools?:
|
|
464
|
+
customTools?: CustomToolDefinition[];
|
|
421
465
|
allowDefaultTools?: string[];
|
|
422
466
|
customInstructions?: string;
|
|
423
467
|
/** 最大循环次数,默认150 */
|
|
@@ -451,10 +495,20 @@ declare class ClineAgent {
|
|
|
451
495
|
private maxLoopCount;
|
|
452
496
|
skillDir: string;
|
|
453
497
|
rulesDir: string;
|
|
454
|
-
customTools:
|
|
498
|
+
customTools: CustomToolDefinition[];
|
|
499
|
+
/** 当前可用(已展开集合)的顶层工具列表,传给 PromptManager 渲染 */
|
|
500
|
+
activeCustomTools: CustomToolDefinition[];
|
|
501
|
+
/** 所有已知工具名(含未激活 children),便于查找定义 */
|
|
502
|
+
customToolsByName: Map<string, CustomToolDefinition>;
|
|
455
503
|
customToolNames: Set<string>;
|
|
456
504
|
allowDefaultTools?: string[];
|
|
457
505
|
customInstructions?: string;
|
|
506
|
+
/** 已激活的工具集入口名 */
|
|
507
|
+
private activatedGroups;
|
|
508
|
+
/** activeCustomTools 变更版本号,用于 Prompt 缓存失效 */
|
|
509
|
+
private activeToolsVersion;
|
|
510
|
+
/** 缓存 sysPrompt 时记录的版本号 */
|
|
511
|
+
private promptActiveToolsVersion;
|
|
458
512
|
sysPrompt?: string;
|
|
459
513
|
noUseTollSysPrompt?: string;
|
|
460
514
|
onStateChange?: (state: AgentState) => void;
|
|
@@ -486,6 +540,19 @@ declare class ClineAgent {
|
|
|
486
540
|
* 核心任务循环
|
|
487
541
|
*/
|
|
488
542
|
private loop;
|
|
543
|
+
/**
|
|
544
|
+
* 激活自定义工具集:将入口的 children 注册到活跃工具列表并返回渲染后的 prompt。
|
|
545
|
+
*/
|
|
546
|
+
private activateCustomToolGroup;
|
|
547
|
+
/**
|
|
548
|
+
* 检查自上次获取 prompt 后是否有工具集被激活,若有则刷新缓存。
|
|
549
|
+
*/
|
|
550
|
+
private getCurrentPrompt;
|
|
551
|
+
/**
|
|
552
|
+
* 将文件内容格式化为带行号文本(模拟编辑器行号显示),
|
|
553
|
+
* 支持通过 start_line / end_line 截取读取范围。
|
|
554
|
+
*/
|
|
555
|
+
private formatFileContentWithLineNumbers;
|
|
489
556
|
/**
|
|
490
557
|
* 简单的 Diff 解析与替换辅助方法
|
|
491
558
|
*/
|
|
@@ -513,4 +580,4 @@ declare class ClineAgent {
|
|
|
513
580
|
|
|
514
581
|
declare const VERSION = "0.1.0";
|
|
515
582
|
|
|
516
|
-
export { AgentDefaultTool, type AgentMessage, type AgentOptions, AgentState, type ApiProviderInfo, type ApiStreamChunk, type AssistantMessageContent, ClineAgent, type IAgentRuntime, type IApiHandler, type IMcpManager, type IMemoryManager, type IPromptManager, type McpServerInfo, type McpTool, type McpToolCallResult, READ_ONLY_TOOLS, type ReasoningStreamContent, TOOL_RESULT_BLOCK, type TextStreamContent, type ToolParamName, type ToolUse, VERSION, defaultTools, getToolUseNames, parseAssistantMessageV2, setDynamicToolUseNames, toolParamNames, toolUseNames };
|
|
583
|
+
export { AgentDefaultTool, type AgentMessage, type AgentOptions, AgentState, type ApiProviderInfo, type ApiStreamChunk, type AssistantMessageContent, ClineAgent, type CustomToolDefinition, type IAgentRuntime, type IApiHandler, type IMcpManager, type IMemoryManager, type IPromptManager, type McpServerInfo, type McpTool, type McpToolCallResult, READ_ONLY_TOOLS, type ReasoningStreamContent, TOOL_RESULT_BLOCK, type TextStreamContent, type ToolParamName, type ToolUse, VERSION, collectCustomToolNames, defaultTools, getToolUseNames, isCustomToolGroup, parseAssistantMessageV2, renderCustomToolPrompt, renderCustomToolsPrompt, setDynamicToolUseNames, toolParamNames, toolUseNames };
|