@ai-setting/roy-agent-core 1.5.13-test → 1.5.15-test
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/package.json +1 -1
- package/dist/config/index.d.ts +0 -1250
- package/dist/config/index.js +0 -32
- package/dist/env/agent/index.d.ts +0 -2279
- package/dist/env/agent/index.js +0 -24
- package/dist/env/commands/index.d.ts +0 -1131
- package/dist/env/commands/index.js +0 -14
- package/dist/env/debug/formatters/index.d.ts +0 -236
- package/dist/env/debug/formatters/index.js +0 -11
- package/dist/env/debug/index.d.ts +0 -1652
- package/dist/env/debug/index.js +0 -26
- package/dist/env/hook/index.d.ts +0 -279
- package/dist/env/hook/index.js +0 -29
- package/dist/env/index.d.ts +0 -3481
- package/dist/env/index.js +0 -82
- package/dist/env/llm/index.d.ts +0 -1760
- package/dist/env/llm/index.js +0 -40
- package/dist/env/log-trace/index.d.ts +0 -1574
- package/dist/env/log-trace/index.js +0 -83
- package/dist/env/mcp/index.d.ts +0 -1331
- package/dist/env/mcp/index.js +0 -39
- package/dist/env/mcp/tool/index.d.ts +0 -183
- package/dist/env/mcp/tool/index.js +0 -14
- package/dist/env/memory/built-in/index.d.ts +0 -232
- package/dist/env/memory/built-in/index.js +0 -11
- package/dist/env/memory/index.d.ts +0 -1799
- package/dist/env/memory/index.js +0 -56
- package/dist/env/memory/plugin/index.d.ts +0 -747
- package/dist/env/memory/plugin/index.js +0 -36
- package/dist/env/prompt/index.d.ts +0 -1164
- package/dist/env/prompt/index.js +0 -20
- package/dist/env/session/index.d.ts +0 -1908
- package/dist/env/session/index.js +0 -25
- package/dist/env/session/storage/index.d.ts +0 -564
- package/dist/env/session/storage/index.js +0 -18
- package/dist/env/skill/index.d.ts +0 -1266
- package/dist/env/skill/index.js +0 -34
- package/dist/env/skill/tool/index.d.ts +0 -193
- package/dist/env/skill/tool/index.js +0 -9
- package/dist/env/task/delegate/index.d.ts +0 -1612
- package/dist/env/task/delegate/index.js +0 -18
- package/dist/env/task/events/index.d.ts +0 -171
- package/dist/env/task/events/index.js +0 -7
- package/dist/env/task/hooks/index.d.ts +0 -624
- package/dist/env/task/hooks/index.js +0 -7
- package/dist/env/task/index.d.ts +0 -1553
- package/dist/env/task/index.js +0 -34
- package/dist/env/task/plugins/index.d.ts +0 -466
- package/dist/env/task/plugins/index.js +0 -23
- package/dist/env/task/storage/index.d.ts +0 -241
- package/dist/env/task/storage/index.js +0 -14
- package/dist/env/task/tools/index.d.ts +0 -1485
- package/dist/env/task/tools/index.js +0 -17
- package/dist/env/task/tools/operation/index.d.ts +0 -1484
- package/dist/env/task/tools/operation/index.js +0 -15
- package/dist/env/tool/built-in/index.d.ts +0 -218
- package/dist/env/tool/built-in/index.js +0 -25
- package/dist/env/tool/index.d.ts +0 -1396
- package/dist/env/tool/index.js +0 -39
- package/dist/env/workflow/decorators/index.d.ts +0 -2161
- package/dist/env/workflow/decorators/index.js +0 -27
- package/dist/env/workflow/engine/index.d.ts +0 -3453
- package/dist/env/workflow/engine/index.js +0 -28
- package/dist/env/workflow/index.d.ts +0 -3546
- package/dist/env/workflow/index.js +0 -136
- package/dist/env/workflow/nodes/index.d.ts +0 -2092
- package/dist/env/workflow/nodes/index.js +0 -19
- package/dist/env/workflow/service/index.d.ts +0 -227
- package/dist/env/workflow/service/index.js +0 -13
- package/dist/env/workflow/storage/index.d.ts +0 -165
- package/dist/env/workflow/storage/index.js +0 -27
- package/dist/env/workflow/tools/index.d.ts +0 -416
- package/dist/env/workflow/tools/index.js +0 -159
- package/dist/env/workflow/types/index.d.ts +0 -2255
- package/dist/env/workflow/types/index.js +0 -98
- package/dist/env/workflow/utils/index.d.ts +0 -2031
- package/dist/env/workflow/utils/index.js +0 -637
- package/dist/index.d.ts +0 -7858
- package/dist/index.js +0 -399
- package/dist/shared/@ai-setting/roy-agent-core-0rtxwr28.js +0 -258
- package/dist/shared/@ai-setting/roy-agent-core-0vbdz0x7.js +0 -36
- package/dist/shared/@ai-setting/roy-agent-core-1akcqxj9.js +0 -349
- package/dist/shared/@ai-setting/roy-agent-core-1ce3fqrk.js +0 -117
- package/dist/shared/@ai-setting/roy-agent-core-2dhd60aw.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-3jywqmdd.js +0 -393
- package/dist/shared/@ai-setting/roy-agent-core-3rr5k71j.js +0 -200
- package/dist/shared/@ai-setting/roy-agent-core-44hnfb02.js +0 -299
- package/dist/shared/@ai-setting/roy-agent-core-4t40mkpv.js +0 -206
- package/dist/shared/@ai-setting/roy-agent-core-4txzpsbt.js +0 -393
- package/dist/shared/@ai-setting/roy-agent-core-5x94xmt6.js +0 -350
- package/dist/shared/@ai-setting/roy-agent-core-69jskqjg.js +0 -180
- package/dist/shared/@ai-setting/roy-agent-core-6kvtahqv.js +0 -408
- package/dist/shared/@ai-setting/roy-agent-core-7fgf85wc.js +0 -284
- package/dist/shared/@ai-setting/roy-agent-core-81w1963m.js +0 -762
- package/dist/shared/@ai-setting/roy-agent-core-8gxth0eh.js +0 -10
- package/dist/shared/@ai-setting/roy-agent-core-92z6t4he.js +0 -14
- package/dist/shared/@ai-setting/roy-agent-core-93zfb3r1.js +0 -922
- package/dist/shared/@ai-setting/roy-agent-core-9yxb3ty9.js +0 -15
- package/dist/shared/@ai-setting/roy-agent-core-b0x5dda6.js +0 -1130
- package/dist/shared/@ai-setting/roy-agent-core-bcbqy27c.js +0 -14
- package/dist/shared/@ai-setting/roy-agent-core-bvr1761x.js +0 -653
- package/dist/shared/@ai-setting/roy-agent-core-ctdhjv68.js +0 -93
- package/dist/shared/@ai-setting/roy-agent-core-d7cyjkf7.js +0 -872
- package/dist/shared/@ai-setting/roy-agent-core-dh9d7a3m.js +0 -11
- package/dist/shared/@ai-setting/roy-agent-core-e25xkv53.js +0 -64
- package/dist/shared/@ai-setting/roy-agent-core-eajcvp4e.js +0 -378
- package/dist/shared/@ai-setting/roy-agent-core-f7q2x5z6.js +0 -492
- package/dist/shared/@ai-setting/roy-agent-core-fs0mn2jk.js +0 -52
- package/dist/shared/@ai-setting/roy-agent-core-g1s2h0e5.js +0 -171
- package/dist/shared/@ai-setting/roy-agent-core-g99pxzn5.js +0 -862
- package/dist/shared/@ai-setting/roy-agent-core-gbqcyegm.js +0 -1387
- package/dist/shared/@ai-setting/roy-agent-core-gjq1yk68.js +0 -208
- package/dist/shared/@ai-setting/roy-agent-core-gq20wsgv.js +0 -139
- package/dist/shared/@ai-setting/roy-agent-core-gwc4h96n.js +0 -534
- package/dist/shared/@ai-setting/roy-agent-core-jfh9q2qh.js +0 -204
- package/dist/shared/@ai-setting/roy-agent-core-jvatggbb.js +0 -603
- package/dist/shared/@ai-setting/roy-agent-core-kkbwepqb.js +0 -97
- package/dist/shared/@ai-setting/roy-agent-core-pjr12nnd.js +0 -587
- package/dist/shared/@ai-setting/roy-agent-core-psv4v63c.js +0 -176
- package/dist/shared/@ai-setting/roy-agent-core-psvxt4c9.js +0 -60
- package/dist/shared/@ai-setting/roy-agent-core-qqceba6k.js +0 -442
- package/dist/shared/@ai-setting/roy-agent-core-qxhq8ven.js +0 -57
- package/dist/shared/@ai-setting/roy-agent-core-qxnbvgwe.js +0 -66
- package/dist/shared/@ai-setting/roy-agent-core-r9ezzemr.js +0 -10
- package/dist/shared/@ai-setting/roy-agent-core-rhmtwnw1.js +0 -267
- package/dist/shared/@ai-setting/roy-agent-core-rvv6ydff.js +0 -584
- package/dist/shared/@ai-setting/roy-agent-core-rvxg1wps.js +0 -102
- package/dist/shared/@ai-setting/roy-agent-core-satmq6sh.js +0 -549
- package/dist/shared/@ai-setting/roy-agent-core-sx7wsvnn.js +0 -15
- package/dist/shared/@ai-setting/roy-agent-core-t94ktchq.js +0 -213
- package/dist/shared/@ai-setting/roy-agent-core-vf215qfv.js +0 -812
- package/dist/shared/@ai-setting/roy-agent-core-vkz81f7v.js +0 -1316
- package/dist/shared/@ai-setting/roy-agent-core-vn2bc59q.js +0 -1205
- package/dist/shared/@ai-setting/roy-agent-core-wa1kzqky.js +0 -328
- package/dist/shared/@ai-setting/roy-agent-core-wft9ra24.js +0 -20
- package/dist/shared/@ai-setting/roy-agent-core-wrcy0h6z.js +0 -2098
- package/dist/shared/@ai-setting/roy-agent-core-xq8hhqb8.js +0 -419
- package/dist/shared/@ai-setting/roy-agent-core-xs5rsgat.js +0 -368
- package/dist/shared/@ai-setting/roy-agent-core-zbkpc41z.js +0 -377
- package/dist/shared/@ai-setting/roy-agent-core-zgypchmt.js +0 -172
- package/dist/shared/@ai-setting/roy-agent-core-zpn0bqa8.js +0 -103
package/dist/env/mcp/index.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DEFAULT_MCP_CONFIG,
|
|
3
|
-
MCP_CONFIG_KEYS,
|
|
4
|
-
McpComponent,
|
|
5
|
-
McpLoader,
|
|
6
|
-
McpScanner,
|
|
7
|
-
McpServerConfigSchema,
|
|
8
|
-
McpServerLocalConfigSchema,
|
|
9
|
-
McpServerRemoteConfigSchema,
|
|
10
|
-
getMcpPathPriority
|
|
11
|
-
} from "../../shared/@ai-setting/roy-agent-core-pjr12nnd.js";
|
|
12
|
-
import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
|
|
13
|
-
import {
|
|
14
|
-
adaptMcpTool,
|
|
15
|
-
convertInputSchemaToZod,
|
|
16
|
-
createMcpToolsDescription
|
|
17
|
-
} from "../../shared/@ai-setting/roy-agent-core-1akcqxj9.js";
|
|
18
|
-
import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
|
|
19
|
-
import"../../shared/@ai-setting/roy-agent-core-kkbwepqb.js";
|
|
20
|
-
import"../../shared/@ai-setting/roy-agent-core-2dhd60aw.js";
|
|
21
|
-
import"../../shared/@ai-setting/roy-agent-core-gjq1yk68.js";
|
|
22
|
-
import"../../shared/@ai-setting/roy-agent-core-44hnfb02.js";
|
|
23
|
-
import"../../shared/@ai-setting/roy-agent-core-xs5rsgat.js";
|
|
24
|
-
import"../../shared/@ai-setting/roy-agent-core-psv4v63c.js";
|
|
25
|
-
import"../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
26
|
-
export {
|
|
27
|
-
getMcpPathPriority,
|
|
28
|
-
createMcpToolsDescription,
|
|
29
|
-
convertInputSchemaToZod,
|
|
30
|
-
adaptMcpTool,
|
|
31
|
-
McpServerRemoteConfigSchema,
|
|
32
|
-
McpServerLocalConfigSchema,
|
|
33
|
-
McpServerConfigSchema,
|
|
34
|
-
McpScanner,
|
|
35
|
-
McpLoader,
|
|
36
|
-
McpComponent,
|
|
37
|
-
MCP_CONFIG_KEYS,
|
|
38
|
-
DEFAULT_MCP_CONFIG
|
|
39
|
-
};
|
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { z as z2 } from "zod";
|
|
2
|
-
import { Tool as McpTool } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
|
-
import { z, ZodType as ZodType2, ZodError } from "zod";
|
|
5
|
-
/**
|
|
6
|
-
* 沙箱配置
|
|
7
|
-
*/
|
|
8
|
-
interface SandboxConfig {
|
|
9
|
-
/** 是否启用沙箱 */
|
|
10
|
-
enabled: boolean;
|
|
11
|
-
/** 沙箱类型 */
|
|
12
|
-
type: "native" | "docker";
|
|
13
|
-
/** 动作过滤 */
|
|
14
|
-
actionFilter?: {
|
|
15
|
-
/** 包含的动作 */
|
|
16
|
-
include?: string[];
|
|
17
|
-
/** 排除的动作 */
|
|
18
|
-
exclude?: string[];
|
|
19
|
-
};
|
|
20
|
-
/** 文件系统限制 */
|
|
21
|
-
filesystem?: {
|
|
22
|
-
/** 允许读取 */
|
|
23
|
-
allowRead?: string[];
|
|
24
|
-
/** 禁止读取 */
|
|
25
|
-
denyRead?: string[];
|
|
26
|
-
/** 允许写入 */
|
|
27
|
-
allowWrite?: string[];
|
|
28
|
-
/** 禁止写入 */
|
|
29
|
-
denyWrite?: string[];
|
|
30
|
-
};
|
|
31
|
-
/** 网络限制 */
|
|
32
|
-
network?: {
|
|
33
|
-
/** 允许的域名 */
|
|
34
|
-
allowedDomains?: string[];
|
|
35
|
-
/** 禁止的域名 */
|
|
36
|
-
deniedDomains?: string[];
|
|
37
|
-
};
|
|
38
|
-
/** Docker 配置 */
|
|
39
|
-
docker?: {
|
|
40
|
-
/** 镜像 */
|
|
41
|
-
image?: string;
|
|
42
|
-
/** 网络模式 */
|
|
43
|
-
networkMode?: "bridge" | "host" | "none";
|
|
44
|
-
/** 卷挂载 */
|
|
45
|
-
volumes?: Record<string, string>;
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 工具执行上下文
|
|
50
|
-
*/
|
|
51
|
-
interface ToolContext {
|
|
52
|
-
/** 工作目录 */
|
|
53
|
-
workdir?: string;
|
|
54
|
-
/** 用户 ID */
|
|
55
|
-
user_id?: string;
|
|
56
|
-
/** 会话 ID */
|
|
57
|
-
session_id?: string;
|
|
58
|
-
/** 消息 ID */
|
|
59
|
-
message_id?: string;
|
|
60
|
-
/** 中断信号 */
|
|
61
|
-
abort?: AbortSignal;
|
|
62
|
-
/** 额外元数据 */
|
|
63
|
-
metadata?: Record<string, unknown>;
|
|
64
|
-
/** 沙箱配置 */
|
|
65
|
-
sandbox?: SandboxConfig;
|
|
66
|
-
/** 沙箱 Provider */
|
|
67
|
-
sandboxProvider?: unknown | null;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* 工具结果元数据
|
|
71
|
-
*/
|
|
72
|
-
interface ToolResultMetadata {
|
|
73
|
-
/** 执行时间(毫秒) */
|
|
74
|
-
execution_time_ms: number;
|
|
75
|
-
/** 输出大小(字节) */
|
|
76
|
-
output_size?: number;
|
|
77
|
-
/** 标准输出 */
|
|
78
|
-
stdout?: string;
|
|
79
|
-
/** 标准错误 */
|
|
80
|
-
stderr?: string;
|
|
81
|
-
/** 退出码 */
|
|
82
|
-
exit_code?: number;
|
|
83
|
-
/** Token 使用量 */
|
|
84
|
-
usage?: {
|
|
85
|
-
inputTokens: number;
|
|
86
|
-
outputTokens: number;
|
|
87
|
-
totalTokens?: number;
|
|
88
|
-
};
|
|
89
|
-
/** 额外元数据 */
|
|
90
|
-
[key: string]: unknown;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 工具执行结果
|
|
94
|
-
*/
|
|
95
|
-
interface ToolResult {
|
|
96
|
-
/** 是否成功 */
|
|
97
|
-
success: boolean;
|
|
98
|
-
/** 输出内容 */
|
|
99
|
-
output: string | Record<string, unknown>;
|
|
100
|
-
/** 错误信息 */
|
|
101
|
-
error?: string;
|
|
102
|
-
/** 结果元数据 */
|
|
103
|
-
metadata?: ToolResultMetadata;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* 工具元数据
|
|
107
|
-
*/
|
|
108
|
-
interface ToolMetadata {
|
|
109
|
-
/** 分类 */
|
|
110
|
-
category?: string;
|
|
111
|
-
/** 标签 */
|
|
112
|
-
tags?: string[];
|
|
113
|
-
/** 版本 */
|
|
114
|
-
version?: string;
|
|
115
|
-
/** 作者 */
|
|
116
|
-
author?: string;
|
|
117
|
-
/** 是否实验性 */
|
|
118
|
-
experimental?: boolean;
|
|
119
|
-
/** MCP 工具信息(MCP adapter 使用) */
|
|
120
|
-
mcpTool?: {
|
|
121
|
-
originalName: string;
|
|
122
|
-
originalDescription: string;
|
|
123
|
-
inputSchema?: unknown;
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* 工具沙箱配置
|
|
128
|
-
*/
|
|
129
|
-
interface ToolSandboxConfig {
|
|
130
|
-
/** 是否启用沙箱 */
|
|
131
|
-
enabled: boolean;
|
|
132
|
-
/** 沙箱配置 */
|
|
133
|
-
config?: Partial<SandboxConfig>;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* 工具权限配置
|
|
137
|
-
*/
|
|
138
|
-
interface ToolPermissionConfig {
|
|
139
|
-
/** 是否需要用户确认 */
|
|
140
|
-
requireConfirmation?: boolean;
|
|
141
|
-
/** 权限级别 */
|
|
142
|
-
level?: "safe" | "dangerous" | "critical";
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* 工具信息
|
|
146
|
-
*/
|
|
147
|
-
interface ToolInfo<Parameters extends ZodType2 = ZodType2> {
|
|
148
|
-
/** 工具名称 */
|
|
149
|
-
name: string;
|
|
150
|
-
/** 工具描述 */
|
|
151
|
-
description: string;
|
|
152
|
-
/** 参数 Schema */
|
|
153
|
-
parameters: Parameters;
|
|
154
|
-
/** 初始化函数(可选) */
|
|
155
|
-
init?: (ctx?: ToolContext) => Promise<void>;
|
|
156
|
-
/** 执行函数 */
|
|
157
|
-
execute: (args: z.infer<Parameters>, ctx: ToolContext) => Promise<ToolResult>;
|
|
158
|
-
/** 参数验证错误格式化(可选) */
|
|
159
|
-
formatValidationError?: (error: ZodError) => string;
|
|
160
|
-
/** 沙箱配置 */
|
|
161
|
-
sandbox?: ToolSandboxConfig;
|
|
162
|
-
/** 权限配置 */
|
|
163
|
-
permission?: ToolPermissionConfig;
|
|
164
|
-
/** 工具元数据 */
|
|
165
|
-
metadata?: ToolMetadata;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* 将 MCP 工具转换为 Environment Tool
|
|
169
|
-
*
|
|
170
|
-
* 命名策略: mcp_{serverName}_{toolName}
|
|
171
|
-
*/
|
|
172
|
-
declare function adaptMcpTool(mcpTool: McpTool, mcpClient: Client, serverName: string): ToolInfo;
|
|
173
|
-
/**
|
|
174
|
-
* 转换 MCP inputSchema 为 Zod schema
|
|
175
|
-
*
|
|
176
|
-
* 关键:保留参数描述,让 LLM 知道每个参数的用途
|
|
177
|
-
*/
|
|
178
|
-
declare function convertInputSchemaToZod(inputSchema: McpTool["inputSchema"]): z2.ZodType<unknown>;
|
|
179
|
-
/**
|
|
180
|
-
* 创建 MCP 工具描述
|
|
181
|
-
*/
|
|
182
|
-
declare function createMcpToolsDescription(tools: ToolInfo[]): string;
|
|
183
|
-
export { createMcpToolsDescription, convertInputSchemaToZod, adaptMcpTool };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
adaptMcpTool,
|
|
3
|
-
convertInputSchemaToZod,
|
|
4
|
-
createMcpToolsDescription
|
|
5
|
-
} from "../../../shared/@ai-setting/roy-agent-core-1akcqxj9.js";
|
|
6
|
-
import"../../../shared/@ai-setting/roy-agent-core-44hnfb02.js";
|
|
7
|
-
import"../../../shared/@ai-setting/roy-agent-core-xs5rsgat.js";
|
|
8
|
-
import"../../../shared/@ai-setting/roy-agent-core-psv4v63c.js";
|
|
9
|
-
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
10
|
-
export {
|
|
11
|
-
createMcpToolsDescription,
|
|
12
|
-
convertInputSchemaToZod,
|
|
13
|
-
adaptMcpTool
|
|
14
|
-
};
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { z, ZodType, ZodError } from "zod";
|
|
2
|
-
/**
|
|
3
|
-
* 沙箱配置
|
|
4
|
-
*/
|
|
5
|
-
interface SandboxConfig {
|
|
6
|
-
/** 是否启用沙箱 */
|
|
7
|
-
enabled: boolean;
|
|
8
|
-
/** 沙箱类型 */
|
|
9
|
-
type: "native" | "docker";
|
|
10
|
-
/** 动作过滤 */
|
|
11
|
-
actionFilter?: {
|
|
12
|
-
/** 包含的动作 */
|
|
13
|
-
include?: string[];
|
|
14
|
-
/** 排除的动作 */
|
|
15
|
-
exclude?: string[];
|
|
16
|
-
};
|
|
17
|
-
/** 文件系统限制 */
|
|
18
|
-
filesystem?: {
|
|
19
|
-
/** 允许读取 */
|
|
20
|
-
allowRead?: string[];
|
|
21
|
-
/** 禁止读取 */
|
|
22
|
-
denyRead?: string[];
|
|
23
|
-
/** 允许写入 */
|
|
24
|
-
allowWrite?: string[];
|
|
25
|
-
/** 禁止写入 */
|
|
26
|
-
denyWrite?: string[];
|
|
27
|
-
};
|
|
28
|
-
/** 网络限制 */
|
|
29
|
-
network?: {
|
|
30
|
-
/** 允许的域名 */
|
|
31
|
-
allowedDomains?: string[];
|
|
32
|
-
/** 禁止的域名 */
|
|
33
|
-
deniedDomains?: string[];
|
|
34
|
-
};
|
|
35
|
-
/** Docker 配置 */
|
|
36
|
-
docker?: {
|
|
37
|
-
/** 镜像 */
|
|
38
|
-
image?: string;
|
|
39
|
-
/** 网络模式 */
|
|
40
|
-
networkMode?: "bridge" | "host" | "none";
|
|
41
|
-
/** 卷挂载 */
|
|
42
|
-
volumes?: Record<string, string>;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 工具执行上下文
|
|
47
|
-
*/
|
|
48
|
-
interface ToolContext {
|
|
49
|
-
/** 工作目录 */
|
|
50
|
-
workdir?: string;
|
|
51
|
-
/** 用户 ID */
|
|
52
|
-
user_id?: string;
|
|
53
|
-
/** 会话 ID */
|
|
54
|
-
session_id?: string;
|
|
55
|
-
/** 消息 ID */
|
|
56
|
-
message_id?: string;
|
|
57
|
-
/** 中断信号 */
|
|
58
|
-
abort?: AbortSignal;
|
|
59
|
-
/** 额外元数据 */
|
|
60
|
-
metadata?: Record<string, unknown>;
|
|
61
|
-
/** 沙箱配置 */
|
|
62
|
-
sandbox?: SandboxConfig;
|
|
63
|
-
/** 沙箱 Provider */
|
|
64
|
-
sandboxProvider?: unknown | null;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* 工具结果元数据
|
|
68
|
-
*/
|
|
69
|
-
interface ToolResultMetadata {
|
|
70
|
-
/** 执行时间(毫秒) */
|
|
71
|
-
execution_time_ms: number;
|
|
72
|
-
/** 输出大小(字节) */
|
|
73
|
-
output_size?: number;
|
|
74
|
-
/** 标准输出 */
|
|
75
|
-
stdout?: string;
|
|
76
|
-
/** 标准错误 */
|
|
77
|
-
stderr?: string;
|
|
78
|
-
/** 退出码 */
|
|
79
|
-
exit_code?: number;
|
|
80
|
-
/** Token 使用量 */
|
|
81
|
-
usage?: {
|
|
82
|
-
inputTokens: number;
|
|
83
|
-
outputTokens: number;
|
|
84
|
-
totalTokens?: number;
|
|
85
|
-
};
|
|
86
|
-
/** 额外元数据 */
|
|
87
|
-
[key: string]: unknown;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* 工具执行结果
|
|
91
|
-
*/
|
|
92
|
-
interface ToolResult {
|
|
93
|
-
/** 是否成功 */
|
|
94
|
-
success: boolean;
|
|
95
|
-
/** 输出内容 */
|
|
96
|
-
output: string | Record<string, unknown>;
|
|
97
|
-
/** 错误信息 */
|
|
98
|
-
error?: string;
|
|
99
|
-
/** 结果元数据 */
|
|
100
|
-
metadata?: ToolResultMetadata;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* 工具元数据
|
|
104
|
-
*/
|
|
105
|
-
interface ToolMetadata {
|
|
106
|
-
/** 分类 */
|
|
107
|
-
category?: string;
|
|
108
|
-
/** 标签 */
|
|
109
|
-
tags?: string[];
|
|
110
|
-
/** 版本 */
|
|
111
|
-
version?: string;
|
|
112
|
-
/** 作者 */
|
|
113
|
-
author?: string;
|
|
114
|
-
/** 是否实验性 */
|
|
115
|
-
experimental?: boolean;
|
|
116
|
-
/** MCP 工具信息(MCP adapter 使用) */
|
|
117
|
-
mcpTool?: {
|
|
118
|
-
originalName: string;
|
|
119
|
-
originalDescription: string;
|
|
120
|
-
inputSchema?: unknown;
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* 工具沙箱配置
|
|
125
|
-
*/
|
|
126
|
-
interface ToolSandboxConfig {
|
|
127
|
-
/** 是否启用沙箱 */
|
|
128
|
-
enabled: boolean;
|
|
129
|
-
/** 沙箱配置 */
|
|
130
|
-
config?: Partial<SandboxConfig>;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* 工具权限配置
|
|
134
|
-
*/
|
|
135
|
-
interface ToolPermissionConfig {
|
|
136
|
-
/** 是否需要用户确认 */
|
|
137
|
-
requireConfirmation?: boolean;
|
|
138
|
-
/** 权限级别 */
|
|
139
|
-
level?: "safe" | "dangerous" | "critical";
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* 工具信息
|
|
143
|
-
*/
|
|
144
|
-
interface ToolInfo<Parameters extends ZodType = ZodType> {
|
|
145
|
-
/** 工具名称 */
|
|
146
|
-
name: string;
|
|
147
|
-
/** 工具描述 */
|
|
148
|
-
description: string;
|
|
149
|
-
/** 参数 Schema */
|
|
150
|
-
parameters: Parameters;
|
|
151
|
-
/** 初始化函数(可选) */
|
|
152
|
-
init?: (ctx?: ToolContext) => Promise<void>;
|
|
153
|
-
/** 执行函数 */
|
|
154
|
-
execute: (args: z.infer<Parameters>, ctx: ToolContext) => Promise<ToolResult>;
|
|
155
|
-
/** 参数验证错误格式化(可选) */
|
|
156
|
-
formatValidationError?: (error: ZodError) => string;
|
|
157
|
-
/** 沙箱配置 */
|
|
158
|
-
sandbox?: ToolSandboxConfig;
|
|
159
|
-
/** 权限配置 */
|
|
160
|
-
permission?: ToolPermissionConfig;
|
|
161
|
-
/** 工具元数据 */
|
|
162
|
-
metadata?: ToolMetadata;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* 工具类型别名
|
|
166
|
-
*/
|
|
167
|
-
type Tool = ToolInfo;
|
|
168
|
-
/**
|
|
169
|
-
* Memory 来源类型
|
|
170
|
-
* - project: 项目级记忆
|
|
171
|
-
* - global: 全局记忆
|
|
172
|
-
*/
|
|
173
|
-
type MemorySource = "project" | "global";
|
|
174
|
-
/**
|
|
175
|
-
* Memory 路径配置
|
|
176
|
-
*/
|
|
177
|
-
interface MemoryPath {
|
|
178
|
-
/** 来源类型 */
|
|
179
|
-
type: MemorySource;
|
|
180
|
-
/** 绝对路径 */
|
|
181
|
-
path: string;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* record_memory 操作结果
|
|
185
|
-
*/
|
|
186
|
-
interface RecordMemoryResult {
|
|
187
|
-
/** 文件路径 */
|
|
188
|
-
path: string;
|
|
189
|
-
/** 操作类型 */
|
|
190
|
-
action: "created" | "append" | "prepend" | "overwrite" | "delete";
|
|
191
|
-
}
|
|
192
|
-
import { z as z3 } from "zod";
|
|
193
|
-
/**
|
|
194
|
-
* record_memory 工具参数
|
|
195
|
-
*/
|
|
196
|
-
declare const RecordMemorySchema2: unknown;
|
|
197
|
-
type RecordMemoryParams2 = z3.infer<typeof RecordMemorySchema2>;
|
|
198
|
-
import { z as z4 } from "zod";
|
|
199
|
-
/**
|
|
200
|
-
* recall_memory 工具参数
|
|
201
|
-
*/
|
|
202
|
-
declare const RecallMemorySchema2: unknown;
|
|
203
|
-
type RecallMemoryParams2 = z4.infer<typeof RecallMemorySchema2>;
|
|
204
|
-
/**
|
|
205
|
-
* record_memory 工具操作接口
|
|
206
|
-
*/
|
|
207
|
-
interface RecordMemoryOperations {
|
|
208
|
-
(args: {
|
|
209
|
-
scope: "project" | "global";
|
|
210
|
-
mode: "append" | "prepend" | "overwrite" | "delete";
|
|
211
|
-
content?: string;
|
|
212
|
-
title?: string;
|
|
213
|
-
}): Promise<RecordMemoryResult | null>;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* recall_memory 工具操作接口
|
|
217
|
-
*/
|
|
218
|
-
interface RecallMemoryOperations {
|
|
219
|
-
(scope?: "project" | "global"): Promise<string>;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* MemoryToolConfig
|
|
223
|
-
*/
|
|
224
|
-
interface MemoryToolConfig {
|
|
225
|
-
getMemoryPaths: () => MemoryPath[];
|
|
226
|
-
getMemoryFile: () => string;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* 创建所有记忆工具
|
|
230
|
-
*/
|
|
231
|
-
declare function createMemoryTools(recordMemory: RecordMemoryOperations, recallMemory: RecallMemoryOperations, config: MemoryToolConfig): Tool[];
|
|
232
|
-
export { createMemoryTools, RecordMemorySchema2 as RecordMemorySchema, RecordMemoryParams2 as RecordMemoryParams, RecordMemoryOperations, RecallMemorySchema2 as RecallMemorySchema, RecallMemoryParams2 as RecallMemoryParams, RecallMemoryOperations, MemoryToolConfig };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RecallMemorySchema,
|
|
3
|
-
RecordMemorySchema,
|
|
4
|
-
createMemoryTools
|
|
5
|
-
} from "../../../shared/@ai-setting/roy-agent-core-g1s2h0e5.js";
|
|
6
|
-
import"../../../shared/@ai-setting/roy-agent-core-fs0mn2jk.js";
|
|
7
|
-
export {
|
|
8
|
-
createMemoryTools,
|
|
9
|
-
RecordMemorySchema,
|
|
10
|
-
RecallMemorySchema
|
|
11
|
-
};
|