@zhin.js/ai 0.0.2 → 1.0.1

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 (94) hide show
  1. package/CHANGELOG.md +2 -7
  2. package/lib/agent.d.ts +54 -6
  3. package/lib/agent.d.ts.map +1 -1
  4. package/lib/agent.js +468 -116
  5. package/lib/agent.js.map +1 -1
  6. package/lib/compaction.d.ts +132 -0
  7. package/lib/compaction.d.ts.map +1 -0
  8. package/lib/compaction.js +370 -0
  9. package/lib/compaction.js.map +1 -0
  10. package/lib/context-manager.d.ts.map +1 -1
  11. package/lib/context-manager.js +10 -3
  12. package/lib/context-manager.js.map +1 -1
  13. package/lib/conversation-memory.d.ts +192 -0
  14. package/lib/conversation-memory.d.ts.map +1 -0
  15. package/lib/conversation-memory.js +619 -0
  16. package/lib/conversation-memory.js.map +1 -0
  17. package/lib/index.d.ts +25 -163
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +24 -1122
  20. package/lib/index.js.map +1 -1
  21. package/lib/output.d.ts +93 -0
  22. package/lib/output.d.ts.map +1 -0
  23. package/lib/output.js +176 -0
  24. package/lib/output.js.map +1 -0
  25. package/lib/providers/anthropic.d.ts +7 -0
  26. package/lib/providers/anthropic.d.ts.map +1 -1
  27. package/lib/providers/anthropic.js +5 -0
  28. package/lib/providers/anthropic.js.map +1 -1
  29. package/lib/providers/ollama.d.ts +10 -0
  30. package/lib/providers/ollama.d.ts.map +1 -1
  31. package/lib/providers/ollama.js +19 -4
  32. package/lib/providers/ollama.js.map +1 -1
  33. package/lib/providers/openai.d.ts +7 -0
  34. package/lib/providers/openai.d.ts.map +1 -1
  35. package/lib/providers/openai.js +11 -0
  36. package/lib/providers/openai.js.map +1 -1
  37. package/lib/rate-limiter.d.ts +38 -0
  38. package/lib/rate-limiter.d.ts.map +1 -0
  39. package/lib/rate-limiter.js +86 -0
  40. package/lib/rate-limiter.js.map +1 -0
  41. package/lib/session.d.ts +7 -0
  42. package/lib/session.d.ts.map +1 -1
  43. package/lib/session.js +47 -18
  44. package/lib/session.js.map +1 -1
  45. package/lib/storage.d.ts +68 -0
  46. package/lib/storage.d.ts.map +1 -0
  47. package/lib/storage.js +105 -0
  48. package/lib/storage.js.map +1 -0
  49. package/lib/tone-detector.d.ts +19 -0
  50. package/lib/tone-detector.d.ts.map +1 -0
  51. package/lib/tone-detector.js +72 -0
  52. package/lib/tone-detector.js.map +1 -0
  53. package/lib/types.d.ts +84 -8
  54. package/lib/types.d.ts.map +1 -1
  55. package/package.json +13 -42
  56. package/src/agent.ts +518 -135
  57. package/src/compaction.ts +529 -0
  58. package/src/context-manager.ts +10 -9
  59. package/src/conversation-memory.ts +816 -0
  60. package/src/index.ts +121 -1406
  61. package/src/output.ts +261 -0
  62. package/src/providers/anthropic.ts +4 -0
  63. package/src/providers/ollama.ts +23 -4
  64. package/src/providers/openai.ts +8 -1
  65. package/src/rate-limiter.ts +129 -0
  66. package/src/session.ts +47 -18
  67. package/src/storage.ts +135 -0
  68. package/src/tone-detector.ts +89 -0
  69. package/src/types.ts +95 -6
  70. package/tests/agent.test.ts +123 -70
  71. package/tests/compaction.test.ts +310 -0
  72. package/tests/context-manager.test.ts +73 -47
  73. package/tests/conversation-memory.test.ts +128 -0
  74. package/tests/output.test.ts +128 -0
  75. package/tests/providers.test.ts +574 -0
  76. package/tests/rate-limiter.test.ts +108 -0
  77. package/tests/session.test.ts +139 -48
  78. package/tests/setup.ts +82 -240
  79. package/tests/storage.test.ts +224 -0
  80. package/tests/tone-detector.test.ts +80 -0
  81. package/tsconfig.json +4 -5
  82. package/vitest.setup.ts +1 -0
  83. package/README.md +0 -564
  84. package/TOOLS.md +0 -294
  85. package/lib/tools.d.ts +0 -45
  86. package/lib/tools.d.ts.map +0 -1
  87. package/lib/tools.js +0 -194
  88. package/lib/tools.js.map +0 -1
  89. package/src/tools.ts +0 -205
  90. package/tests/ai-trigger.test.ts +0 -369
  91. package/tests/integration.test.ts +0 -596
  92. package/tests/providers.integration.test.ts +0 -227
  93. package/tests/tool.test.ts +0 -800
  94. package/tests/tools-builtin.test.ts +0 -346
package/TOOLS.md DELETED
@@ -1,294 +0,0 @@
1
- # AI 工具系统
2
-
3
- @zhin.js/ai 插件支持从多个来源收集和使用 AI 工具,实现更强大的 Agent 能力。
4
-
5
- ## 工具来源
6
-
7
- ### 1. 内置工具 (Builtin Tools)
8
-
9
- AI 服务内置了一些常用工具:
10
-
11
- - `get_time`: 获取当前时间
12
- - `calculate`: 进行数学计算
13
- - `search_web`: 网页搜索(需配置)
14
-
15
- ### 2. 适配器工具 (Adapter Tools)
16
-
17
- 每个适配器可以提供平台特定的工具:
18
-
19
- ```typescript
20
- // 适配器继承 Adapter 基类后自动获得 addTool 方法
21
- class MyAdapter extends Adapter<MyBot> {
22
- constructor(plugin: Plugin) {
23
- super(plugin, 'my-platform', config);
24
-
25
- // 注册默认工具(发送消息、列出 Bot 等)
26
- this.registerDefaultTools();
27
-
28
- // 注册自定义工具
29
- this.addTool({
30
- name: 'my_platform_get_user',
31
- description: '获取平台用户信息',
32
- parameters: {
33
- type: 'object',
34
- properties: {
35
- userId: { type: 'string', description: '用户 ID' }
36
- },
37
- required: ['userId']
38
- },
39
- execute: async (args) => {
40
- return await this.getUserInfo(args.userId);
41
- }
42
- });
43
- }
44
- }
45
- ```
46
-
47
- **Process 适配器示例工具**:
48
- - `process_send_message`: 发送消息
49
- - `process_list_bots`: 列出已连接的 Bot
50
- - `process_get_info`: 获取进程信息
51
- - `process_get_env`: 获取环境变量
52
- - `process_console_log`: 输出到控制台
53
-
54
- ### 3. 插件工具 (Plugin Tools)
55
-
56
- 任何插件都可以注册自己的工具:
57
-
58
- ```typescript
59
- import { usePlugin, defineTool } from 'zhin.js';
60
-
61
- const { addTool } = usePlugin();
62
-
63
- // 使用 defineTool 获得类型支持
64
- const weatherTool = defineTool({
65
- name: 'get_weather',
66
- description: '获取指定城市的天气信息',
67
- parameters: {
68
- type: 'object',
69
- properties: {
70
- city: { type: 'string', description: '城市名称' },
71
- unit: {
72
- type: 'string',
73
- enum: ['celsius', 'fahrenheit'],
74
- description: '温度单位'
75
- }
76
- },
77
- required: ['city']
78
- },
79
- execute: async (args) => {
80
- const { city, unit = 'celsius' } = args;
81
- // 调用天气 API
82
- return { city, temperature: 25, unit };
83
- }
84
- });
85
-
86
- // 注册工具
87
- addTool(weatherTool);
88
-
89
- // 或直接传入对象
90
- addTool({
91
- name: 'translate',
92
- description: '翻译文本',
93
- parameters: {
94
- type: 'object',
95
- properties: {
96
- text: { type: 'string', description: '要翻译的文本' },
97
- from: { type: 'string', description: '源语言' },
98
- to: { type: 'string', description: '目标语言' }
99
- },
100
- required: ['text', 'to']
101
- },
102
- execute: async (args) => {
103
- // 翻译逻辑
104
- return { translated: '...' };
105
- }
106
- });
107
- ```
108
-
109
- ### 4. 自定义工具 (Custom Tools)
110
-
111
- 直接在 AI 服务中注册工具:
112
-
113
- ```typescript
114
- import { usePlugin } from 'zhin.js';
115
-
116
- const { useContext } = usePlugin();
117
-
118
- useContext('ai', (ai) => {
119
- // 注册自定义工具
120
- const dispose = ai.registerTool({
121
- name: 'custom_tool',
122
- description: '自定义工具',
123
- parameters: { type: 'object', properties: {} },
124
- execute: async () => ({ result: 'custom' })
125
- });
126
-
127
- return dispose; // 清理时自动移除
128
- });
129
- ```
130
-
131
- ## 使用工具
132
-
133
- ### 通过 Agent
134
-
135
- ```typescript
136
- useContext('ai', (ai) => {
137
- // 创建 Agent 时自动收集所有可用工具
138
- const agent = ai.createAgent({
139
- provider: 'openai',
140
- model: 'gpt-4',
141
- systemPrompt: '你是一个智能助手',
142
- // 可选:禁用自动收集外部工具
143
- // collectExternalTools: false,
144
- // 可选:禁用内置工具
145
- // useBuiltinTools: false,
146
- // 可选:添加额外工具
147
- tools: [myExtraTool]
148
- });
149
-
150
- // 执行任务
151
- const result = await agent.run('查询北京的天气并用英语描述');
152
- console.log(result.content);
153
- console.log(result.toolCalls); // 查看工具调用记录
154
- });
155
- ```
156
-
157
- ### 通过命令
158
-
159
- ```
160
- # 查看所有可用工具
161
- /ai.tools
162
-
163
- # 使用带工具调用的对话
164
- /chat 帮我查一下现在的时间
165
- ```
166
-
167
- ## 工具收集机制
168
-
169
- AI 服务通过以下方式收集工具:
170
-
171
- 1. **Plugin.collectAllTools()**: 遍历插件树收集所有插件注册的工具
172
- 2. **Adapter.getTools()**: 收集所有适配器注册的工具
173
- 3. **AIService.customTools**: 直接在 AI 服务中注册的工具
174
- 4. **AIService.builtinTools**: 内置工具
175
-
176
- ```
177
- AIService.createAgent()
178
- ├── builtinTools (内置工具)
179
- ├── customTools (自定义工具)
180
- ├── Plugin.collectAllTools()
181
- │ ├── 当前插件的工具
182
- │ └── 所有子插件的工具(递归)
183
- └── Adapter.getTools()
184
- ├── 默认工具(send_message, list_bots)
185
- └── 平台特定工具
186
- ```
187
-
188
- ## 最佳实践
189
-
190
- ### 工具命名规范
191
-
192
- - 使用小写字母和下划线
193
- - 包含来源前缀避免冲突:`platform_action` 或 `plugin_action`
194
- - 例如:`icqq_get_group_members`, `music_search_song`
195
-
196
- ### 参数设计
197
-
198
- ```typescript
199
- {
200
- type: 'object',
201
- properties: {
202
- // 必填参数放前面
203
- userId: {
204
- type: 'string',
205
- description: '用户唯一标识符'
206
- },
207
- // 可选参数给默认值
208
- limit: {
209
- type: 'number',
210
- description: '返回数量限制',
211
- default: 10
212
- },
213
- // 枚举类型明确列出选项
214
- format: {
215
- type: 'string',
216
- enum: ['json', 'text', 'markdown'],
217
- description: '返回格式'
218
- }
219
- },
220
- required: ['userId'] // 明确必填项
221
- }
222
- ```
223
-
224
- ### 错误处理
225
-
226
- ```typescript
227
- execute: async (args, context) => {
228
- try {
229
- const result = await doSomething(args);
230
- return { success: true, data: result };
231
- } catch (error) {
232
- return {
233
- success: false,
234
- error: error instanceof Error ? error.message : String(error)
235
- };
236
- }
237
- }
238
- ```
239
-
240
- ### 安全考虑
241
-
242
- ```typescript
243
- execute: async (args, context) => {
244
- // 检查上下文权限
245
- if (context?.senderId !== 'admin') {
246
- return { error: '权限不足' };
247
- }
248
-
249
- // 过滤敏感操作
250
- if (args.path?.includes('..')) {
251
- return { error: '非法路径' };
252
- }
253
-
254
- // 执行操作
255
- return await secureOperation(args);
256
- }
257
- ```
258
-
259
- ## 类型定义
260
-
261
- ```typescript
262
- interface AITool {
263
- /** 工具名称(唯一标识) */
264
- name: string;
265
- /** 工具描述(AI 用于理解用途) */
266
- description: string;
267
- /** 参数 JSON Schema */
268
- parameters: ToolJsonSchema;
269
- /** 工具执行函数 */
270
- execute: (args: Record<string, any>, context?: ToolContext) => Promise<any>;
271
- /** 工具来源标识(自动添加) */
272
- source?: string;
273
- /** 工具标签(用于分类过滤) */
274
- tags?: string[];
275
- }
276
-
277
- interface ToolContext {
278
- platform?: string; // 来源平台
279
- botId?: string; // Bot ID
280
- sceneId?: string; // 场景 ID
281
- senderId?: string; // 发送者 ID
282
- extra?: Record<string, any>; // 额外数据
283
- }
284
-
285
- interface ToolJsonSchema {
286
- type: string;
287
- properties?: Record<string, ToolJsonSchema>;
288
- required?: string[];
289
- items?: ToolJsonSchema;
290
- enum?: any[];
291
- description?: string;
292
- default?: any;
293
- }
294
- ```
package/lib/tools.d.ts DELETED
@@ -1,45 +0,0 @@
1
- /**
2
- * @zhin.js/ai - Built-in Tools
3
- * 内置工具集合 - 使用 ZhinTool 类定义
4
- */
5
- import { ZhinTool } from '@zhin.js/core';
6
- /**
7
- * 计算器工具
8
- * 支持基本运算和数学函数
9
- */
10
- export declare const calculatorTool: ZhinTool;
11
- /**
12
- * 时间工具
13
- * 获取当前时间和日期
14
- */
15
- export declare const timeTool: ZhinTool;
16
- /**
17
- * 网页搜索工具
18
- * 需要配置搜索 API
19
- */
20
- export declare const searchTool: ZhinTool;
21
- /**
22
- * 代码执行工具
23
- * 在安全沙箱中执行 JavaScript
24
- */
25
- export declare const codeRunnerTool: ZhinTool;
26
- /**
27
- * HTTP 请求工具
28
- * 发送 HTTP 请求获取数据
29
- */
30
- export declare const httpTool: ZhinTool;
31
- /**
32
- * 记忆工具
33
- * 让 AI 记住重要信息
34
- */
35
- export declare const memoryTool: ZhinTool;
36
- /**
37
- * 获取所有内置工具(ZhinTool 实例)
38
- * 注意:天气工具已移除,请使用 weather-tool 插件,支持多平台配置
39
- */
40
- export declare function getBuiltinTools(): ZhinTool[];
41
- /**
42
- * 获取所有可用的内置工具(包括可选工具)
43
- */
44
- export declare function getAllBuiltinTools(): ZhinTool[];
45
- //# sourceMappingURL=tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAa,MAAM,eAAe,CAAC;AAEpD;;;GAGG;AACH,eAAO,MAAM,cAAc,UAwBvB,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,QAAQ,UA6BjB,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,UAAU,UAWnB,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,cAAc,UAsBvB,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,QAAQ,UAwCjB,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,UAAU,UAYnB,CAAC;AAEL;;;GAGG;AACH,wBAAgB,eAAe,IAAI,QAAQ,EAAE,CAK5C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,QAAQ,EAAE,CAS/C"}
package/lib/tools.js DELETED
@@ -1,194 +0,0 @@
1
- /**
2
- * @zhin.js/ai - Built-in Tools
3
- * 内置工具集合 - 使用 ZhinTool 类定义
4
- */
5
- import { ZhinTool } from '@zhin.js/core';
6
- /**
7
- * 计算器工具
8
- * 支持基本运算和数学函数
9
- */
10
- export const calculatorTool = new ZhinTool('calculator')
11
- .desc('执行数学计算。支持基本运算(+、-、*、/、^)和数学函数(sin、cos、sqrt 等)')
12
- .param('expression', { type: 'string', description: '数学表达式,例如 "2 + 3 * 4" 或 "sqrt(16)"' }, true)
13
- .execute(async ({ expression }) => {
14
- try {
15
- // 安全的数学表达式求值
16
- const sanitized = expression
17
- .replace(/[^0-9+\-*/().^eEsincosqrtabspowlogxMathPI\s]/g, '')
18
- .replace(/\bsqrt\b/g, 'Math.sqrt')
19
- .replace(/\bsin\b/g, 'Math.sin')
20
- .replace(/\bcos\b/g, 'Math.cos')
21
- .replace(/\btan\b/g, 'Math.tan')
22
- .replace(/\blog\b/g, 'Math.log')
23
- .replace(/\babs\b/g, 'Math.abs')
24
- .replace(/\bpow\b/g, 'Math.pow')
25
- .replace(/\bPI\b/g, 'Math.PI')
26
- .replace(/\bE\b(?![0-9])/g, 'Math.E')
27
- .replace(/\^/g, '**');
28
- const result = new Function(`return ${sanitized}`)();
29
- return { result, expression };
30
- }
31
- catch (error) {
32
- return { error: '无法计算表达式', expression };
33
- }
34
- });
35
- /**
36
- * 时间工具
37
- * 获取当前时间和日期
38
- */
39
- export const timeTool = new ZhinTool('get_time')
40
- .desc('获取当前时间和日期信息')
41
- .param('timezone', { type: 'string', description: '时区,例如 "Asia/Shanghai" 或 "UTC"' })
42
- .param('format', { type: 'string', description: '输出格式: full(完整), date(日期), time(时间), timestamp(时间戳)' })
43
- .execute(async ({ timezone, format = 'full' }) => {
44
- const now = new Date();
45
- const options = {
46
- timeZone: timezone || 'Asia/Shanghai',
47
- };
48
- switch (format) {
49
- case 'date':
50
- options.dateStyle = 'full';
51
- break;
52
- case 'time':
53
- options.timeStyle = 'long';
54
- break;
55
- case 'timestamp':
56
- return { timestamp: now.getTime(), iso: now.toISOString() };
57
- default:
58
- options.dateStyle = 'full';
59
- options.timeStyle = 'long';
60
- }
61
- return {
62
- formatted: now.toLocaleString('zh-CN', options),
63
- timestamp: now.getTime(),
64
- iso: now.toISOString(),
65
- };
66
- });
67
- /**
68
- * 网页搜索工具
69
- * 需要配置搜索 API
70
- */
71
- export const searchTool = new ZhinTool('web_search')
72
- .desc('在互联网上搜索信息(需要配置搜索 API)')
73
- .param('query', { type: 'string', description: '搜索关键词' }, true)
74
- .param('limit', { type: 'number', description: '返回结果数量(默认 5)' })
75
- .execute(async ({ query, limit = 5 }) => {
76
- // 默认实现提示需要配置
77
- return {
78
- query,
79
- error: '搜索功能未配置,请提供搜索 API',
80
- hint: '可以集成 SerpAPI、Bing Search API 或 Google Custom Search',
81
- };
82
- });
83
- /**
84
- * 代码执行工具
85
- * 在安全沙箱中执行 JavaScript
86
- */
87
- export const codeRunnerTool = new ZhinTool('run_code')
88
- .desc('执行 JavaScript 代码(在安全沙箱中)')
89
- .param('code', { type: 'string', description: 'JavaScript 代码' }, true)
90
- .execute(async ({ code }) => {
91
- try {
92
- // 简单的沙箱执行(生产环境应使用 vm2 或 isolated-vm)
93
- const result = new Function(`
94
- 'use strict';
95
- const console = { log: (...args) => args.join(' ') };
96
- return (function() { ${code} })();
97
- `)();
98
- return {
99
- success: true,
100
- result: result !== undefined ? String(result) : 'undefined',
101
- };
102
- }
103
- catch (error) {
104
- return {
105
- success: false,
106
- error: error instanceof Error ? error.message : String(error),
107
- };
108
- }
109
- });
110
- /**
111
- * HTTP 请求工具
112
- * 发送 HTTP 请求获取数据
113
- */
114
- export const httpTool = new ZhinTool('http_request')
115
- .desc('发送 HTTP 请求获取数据')
116
- .param('url', { type: 'string', description: '请求 URL' }, true)
117
- .param('method', { type: 'string', description: 'HTTP 方法: GET, POST, PUT, DELETE(默认 GET)' })
118
- .param('headers', { type: 'object', description: '请求头(JSON 对象)' })
119
- .param('body', { type: 'string', description: '请求体(JSON 字符串)' })
120
- .execute(async ({ url, method = 'GET', headers = {}, body }) => {
121
- try {
122
- const response = await fetch(url, {
123
- method: method,
124
- headers: {
125
- 'Content-Type': 'application/json',
126
- ...headers,
127
- },
128
- body: body ? body : undefined,
129
- });
130
- const contentType = response.headers.get('content-type') || '';
131
- let data;
132
- if (contentType.includes('application/json')) {
133
- data = await response.json();
134
- }
135
- else {
136
- data = await response.text();
137
- // 限制文本长度
138
- if (data.length > 5000) {
139
- data = data.substring(0, 5000) + '... (truncated)';
140
- }
141
- }
142
- return {
143
- status: response.status,
144
- statusText: response.statusText,
145
- data,
146
- };
147
- }
148
- catch (error) {
149
- return {
150
- error: error instanceof Error ? error.message : String(error),
151
- };
152
- }
153
- });
154
- /**
155
- * 记忆工具
156
- * 让 AI 记住重要信息
157
- */
158
- export const memoryTool = new ZhinTool('remember')
159
- .desc('记住用户告诉你的重要信息,以便后续对话中使用')
160
- .param('key', { type: 'string', description: '记忆的标识符,如 "user_name", "preference"' }, true)
161
- .param('value', { type: 'string', description: '要记住的内容' }, true)
162
- .execute(async ({ key, value }, context) => {
163
- // 这里需要与 session/context manager 集成
164
- return {
165
- success: true,
166
- message: `已记住 ${key}: ${value}`,
167
- key,
168
- value,
169
- };
170
- });
171
- /**
172
- * 获取所有内置工具(ZhinTool 实例)
173
- * 注意:天气工具已移除,请使用 weather-tool 插件,支持多平台配置
174
- */
175
- export function getBuiltinTools() {
176
- return [
177
- calculatorTool,
178
- timeTool,
179
- ];
180
- }
181
- /**
182
- * 获取所有可用的内置工具(包括可选工具)
183
- */
184
- export function getAllBuiltinTools() {
185
- return [
186
- calculatorTool,
187
- timeTool,
188
- searchTool,
189
- codeRunnerTool,
190
- httpTool,
191
- memoryTool,
192
- ];
193
- }
194
- //# sourceMappingURL=tools.js.map
package/lib/tools.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAa,MAAM,eAAe,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC;KACrD,IAAI,CAAC,+CAA+C,CAAC;KACrD,KAAK,CAAC,YAAY,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE,EAAE,IAAI,CAAC;KAC/F,OAAO,CA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