@apify/actors-mcp-server 0.1.20 → 0.1.22-beta.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 (97) hide show
  1. package/README.md +5 -25
  2. package/dist/actor/const.d.ts +15 -0
  3. package/dist/actor/const.d.ts.map +1 -0
  4. package/dist/actor/const.js +20 -0
  5. package/dist/actor/const.js.map +1 -0
  6. package/dist/{input.d.ts → actor/input.d.ts} +1 -1
  7. package/dist/actor/input.d.ts.map +1 -0
  8. package/dist/{input.js → actor/input.js} +5 -1
  9. package/dist/actor/input.js.map +1 -0
  10. package/dist/actor/server.d.ts +4 -0
  11. package/dist/actor/server.d.ts.map +1 -0
  12. package/dist/actor/server.js +81 -0
  13. package/dist/actor/server.js.map +1 -0
  14. package/dist/actor/types.d.ts +30 -0
  15. package/dist/actor/types.d.ts.map +1 -0
  16. package/dist/actor/types.js +2 -0
  17. package/dist/actor/types.js.map +1 -0
  18. package/dist/actor/utils.d.ts +11 -0
  19. package/dist/actor/utils.d.ts.map +1 -0
  20. package/dist/actor/utils.js +50 -0
  21. package/dist/actor/utils.js.map +1 -0
  22. package/dist/const.d.ts +10 -20
  23. package/dist/const.d.ts.map +1 -1
  24. package/dist/const.js +17 -27
  25. package/dist/const.js.map +1 -1
  26. package/dist/examples/clientSse.d.ts +10 -1
  27. package/dist/examples/clientSse.d.ts.map +1 -1
  28. package/dist/examples/clientSse.js +7 -4
  29. package/dist/examples/clientSse.js.map +1 -1
  30. package/dist/examples/clientStdio.js +2 -2
  31. package/dist/examples/clientStdio.js.map +1 -1
  32. package/dist/examples/clientStdioChat.js +1 -1
  33. package/dist/index.d.ts +2 -14
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +6 -42
  36. package/dist/index.js.map +1 -1
  37. package/dist/main.d.ts +4 -0
  38. package/dist/main.d.ts.map +1 -1
  39. package/dist/main.js +21 -118
  40. package/dist/main.js.map +1 -1
  41. package/dist/mcp-server.d.ts +39 -0
  42. package/dist/mcp-server.d.ts.map +1 -0
  43. package/dist/mcp-server.js +155 -0
  44. package/dist/mcp-server.js.map +1 -0
  45. package/dist/stdio.d.ts +15 -0
  46. package/dist/stdio.d.ts.map +1 -0
  47. package/dist/stdio.js +46 -0
  48. package/dist/stdio.js.map +1 -0
  49. package/dist/tools/actor.d.ts +37 -0
  50. package/dist/tools/actor.d.ts.map +1 -0
  51. package/dist/tools/actor.js +89 -0
  52. package/dist/tools/actor.js.map +1 -0
  53. package/dist/tools/build.d.ts +12 -0
  54. package/dist/tools/build.d.ts.map +1 -0
  55. package/dist/tools/build.js +120 -0
  56. package/dist/tools/build.js.map +1 -0
  57. package/dist/tools/helpers.d.ts +19 -0
  58. package/dist/tools/helpers.d.ts.map +1 -0
  59. package/dist/tools/helpers.js +62 -0
  60. package/dist/tools/helpers.js.map +1 -0
  61. package/dist/tools/index.d.ts +6 -0
  62. package/dist/tools/index.d.ts.map +1 -0
  63. package/dist/tools/index.js +8 -0
  64. package/dist/tools/index.js.map +1 -0
  65. package/dist/tools/mcp-apify-client.d.ts +6 -0
  66. package/dist/tools/mcp-apify-client.d.ts.map +1 -0
  67. package/dist/tools/mcp-apify-client.js +22 -0
  68. package/dist/tools/mcp-apify-client.js.map +1 -0
  69. package/dist/tools/store_collection.d.ts +21 -0
  70. package/dist/tools/store_collection.d.ts.map +1 -0
  71. package/dist/tools/store_collection.js +80 -0
  72. package/dist/tools/store_collection.js.map +1 -0
  73. package/dist/tools/utils.d.ts +77 -0
  74. package/dist/tools/utils.d.ts.map +1 -0
  75. package/dist/{actors.js → tools/utils.js} +112 -241
  76. package/dist/tools/utils.js.map +1 -0
  77. package/dist/tsconfig.tsbuildinfo +1 -1
  78. package/dist/types.d.ts +70 -9
  79. package/dist/types.d.ts.map +1 -1
  80. package/package.json +17 -14
  81. package/dist/actors.d.ts +0 -74
  82. package/dist/actors.d.ts.map +0 -1
  83. package/dist/actors.js.map +0 -1
  84. package/dist/input.d.ts.map +0 -1
  85. package/dist/input.js.map +0 -1
  86. package/dist/logger.d.ts +0 -3
  87. package/dist/logger.d.ts.map +0 -1
  88. package/dist/logger.js +0 -4
  89. package/dist/logger.js.map +0 -1
  90. package/dist/server.d.ts +0 -43
  91. package/dist/server.d.ts.map +0 -1
  92. package/dist/server.js +0 -178
  93. package/dist/server.js.map +0 -1
  94. package/dist/tools.d.ts +0 -46
  95. package/dist/tools.d.ts.map +0 -1
  96. package/dist/tools.js +0 -128
  97. package/dist/tools.js.map +0 -1
@@ -1,7 +1,4 @@
1
- import { Ajv } from 'ajv';
2
- import { ApifyClient } from 'apify-client';
3
- import { ACTOR_ADDITIONAL_INSTRUCTIONS, defaults, MAX_DESCRIPTION_LENGTH, ACTOR_README_MAX_LENGTH, ACTOR_ENUM_MAX_LENGTH } from './const.js';
4
- import { log } from './logger.js';
1
+ import { ACTOR_ENUM_MAX_LENGTH, ACTOR_MAX_DESCRIPTION_LENGTH } from '../const.js';
5
2
  export function actorNameToToolName(actorName) {
6
3
  return actorName
7
4
  .replace(/\//g, '-slash-')
@@ -9,160 +6,58 @@ export function actorNameToToolName(actorName) {
9
6
  .slice(0, 64);
10
7
  }
11
8
  /**
12
- * Get actor input schema by actor name.
13
- * First, fetch the actor details to get the default build tag and buildId.
14
- * Then, fetch the build details and return actorName, description, and input schema.
15
- * @param {string} actorIdOrName - Actor ID or Actor full name.
16
- * @param {number} limit - Truncate the README to this limit.
17
- * @returns {Promise<ActorDefinitionWithDesc | null>} - The actor definition with description or null if not found.
18
- */
19
- export async function getActorDefinition(actorIdOrName, limit = ACTOR_README_MAX_LENGTH) {
20
- const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
21
- const actorClient = client.actor(actorIdOrName);
22
- try {
23
- // Fetch actor details
24
- const actor = await actorClient.get();
25
- if (!actor) {
26
- log.error(`Failed to fetch input schema for Actor: ${actorIdOrName}. Actor not found.`);
27
- return null;
28
- }
29
- // fnesveda: The default build is not necessarily tagged, you can specify any build number as default build.
30
- // There will be a new API endpoint to fetch a default build.
31
- // For now, we'll use the tagged build, it will work for 90% of Actors. Later, we can update this.
32
- const tag = actor.defaultRunOptions?.build || '';
33
- const buildId = actor.taggedBuilds?.[tag]?.buildId || '';
34
- if (!buildId) {
35
- log.error(`Failed to fetch input schema for Actor: ${actorIdOrName}. Build ID not found.`);
36
- return null;
37
- }
38
- // Fetch build details and return the input schema
39
- const buildDetails = await client.build(buildId).get();
40
- if (buildDetails?.actorDefinition) {
41
- const actorDefinitions = buildDetails?.actorDefinition;
42
- actorDefinitions.id = actor.id;
43
- actorDefinitions.readme = truncateActorReadme(actorDefinitions.readme || '', limit);
44
- actorDefinitions.description = actor.description || '';
45
- actorDefinitions.actorFullName = `${actor.username}/${actor.name}`;
46
- actorDefinitions.defaultRunOptions = actor.defaultRunOptions;
47
- return pruneActorDefinition(actorDefinitions);
48
- }
49
- return null;
50
- }
51
- catch (error) {
52
- const errorMessage = `Failed to fetch input schema for Actor: ${actorIdOrName} with error ${error}.`;
53
- log.error(errorMessage);
54
- throw new Error(errorMessage);
55
- }
56
- }
57
- function pruneActorDefinition(response) {
58
- return {
59
- id: response.id,
60
- actorFullName: response.actorFullName || '',
61
- buildTag: response?.buildTag || '',
62
- readme: response?.readme || '',
63
- input: response?.input && 'type' in response.input && 'properties' in response.input
64
- ? { ...response.input,
65
- type: response.input.type,
66
- properties: response.input.properties }
67
- : undefined,
68
- description: response.description,
69
- defaultRunOptions: response.defaultRunOptions,
70
- };
71
- }
72
- /**
73
- * Helper function to shorten the enum list if it is too long.
74
- *
75
- * @param {string[]} enumList - The list of enum values to be shortened.
76
- * @returns {string[] | undefined} - The shortened enum list or undefined if the list is too long.
77
- */
78
- export function shortenEnum(enumList) {
79
- let charCount = 0;
80
- const resultEnumList = enumList.filter((enumValue) => {
81
- charCount += enumValue.length;
82
- return charCount <= ACTOR_ENUM_MAX_LENGTH;
83
- });
84
- return resultEnumList.length > 0 ? resultEnumList : undefined;
85
- }
86
- /**
87
- * Shortens the description, enum, and items.enum properties of the schema properties.
88
- * @param properties
89
- */
90
- export function shortenProperties(properties) {
91
- for (const property of Object.values(properties)) {
92
- if (property.description.length > MAX_DESCRIPTION_LENGTH) {
93
- property.description = `${property.description.slice(0, MAX_DESCRIPTION_LENGTH)}...`;
94
- }
95
- if (property.enum && property.enum?.length > 0) {
96
- property.enum = shortenEnum(property.enum);
97
- }
98
- if (property.items?.enum && property.items.enum.length > 0) {
99
- property.items.enum = shortenEnum(property.items.enum);
100
- }
101
- }
102
- return properties;
103
- }
104
- /** Prune Actor README if it is too long
105
- * If the README is too long
106
- * - We keep the README as it is up to the limit.
107
- * - After the limit, we keep heading only
108
- * - We add a note that the README was truncated because it was too long.
109
- */
110
- export function truncateActorReadme(readme, limit = ACTOR_README_MAX_LENGTH) {
111
- if (readme.length <= limit) {
112
- return readme;
113
- }
114
- const readmeFirst = readme.slice(0, limit);
115
- const readmeRest = readme.slice(limit);
116
- const lines = readmeRest.split('\n');
117
- const prunedReadme = lines.filter((line) => line.startsWith('#'));
118
- return `${readmeFirst}\n\nREADME was truncated because it was too long. Remaining headers:\n${prunedReadme.join(', ')}`;
119
- }
120
- /**
121
- * Helps determine the type of items in an array schema property.
122
- * Priority order: explicit type in items > prefill type > default value type > editor type.
123
- *
124
- * Based on JSON schema, the array needs a type, and most of the time Actor input schema does not have this, so we need to infer that.
125
- *
126
- */
127
- export function inferArrayItemType(property) {
128
- return property.items?.type
129
- || (Array.isArray(property.prefill) && property.prefill.length > 0 && typeof property.prefill[0])
130
- || (Array.isArray(property.default) && property.default.length > 0 && typeof property.default[0])
131
- || (property.editor && getEditorItemType(property.editor))
132
- || null;
133
- function getEditorItemType(editor) {
134
- const editorTypeMap = {
135
- requestListSources: 'object',
136
- stringList: 'string',
137
- json: 'object',
138
- globs: 'object',
139
- };
140
- return editorTypeMap[editor] || null;
141
- }
142
- }
143
- /**
144
- * Add enum values as string to property descriptions.
9
+ * Builds nested properties for object types in the schema.
145
10
  *
146
- * This is done as a preventive measure to prevent cases where library or agent framework
147
- * does not handle enums or examples based on JSON schema definition.
11
+ * Specifically handles special cases like proxy configuration and request list sources
12
+ * by adding predefined nested properties to these object types.
13
+ * This is necessary for the agent to correctly infer how to structure object inputs
14
+ * when passing arguments to the Actor.
148
15
  *
149
- * https://json-schema.org/understanding-json-schema/reference/enum
150
- * https://json-schema.org/understanding-json-schema/reference/annotations
16
+ * For proxy objects (type='object', editor='proxy'), adds 'useApifyProxy' property.
17
+ * For request list sources (type='array', editor='requestListSources'), adds URL structure to items.
151
18
  *
152
- * @param properties
19
+ * @param {Record<string, ISchemaProperties>} properties - The input schema properties
20
+ * @returns {Record<string, ISchemaProperties>} Modified properties with nested properties
153
21
  */
154
- function addEnumsToDescriptionsWithExamples(properties) {
155
- for (const property of Object.values(properties)) {
156
- if (property.enum && property.enum.length > 0) {
157
- property.description = `${property.description}\nPossible values: ${property.enum.slice(0, 20).join(',')}`;
22
+ export function buildNestedProperties(properties) {
23
+ const clonedProperties = { ...properties };
24
+ for (const [propertyName, property] of Object.entries(clonedProperties)) {
25
+ if (property.type === 'object' && property.editor === 'proxy') {
26
+ clonedProperties[propertyName] = {
27
+ ...property,
28
+ properties: {
29
+ ...property.properties,
30
+ useApifyProxy: {
31
+ title: 'Use Apify Proxy',
32
+ type: 'boolean',
33
+ description: 'Whether to use Apify Proxy - ALWAYS SET TO TRUE.',
34
+ default: true,
35
+ examples: [true],
36
+ },
37
+ },
38
+ required: ['useApifyProxy'],
39
+ };
158
40
  }
159
- const value = property.prefill ?? property.default;
160
- if (value && !(Array.isArray(value) && value.length === 0)) {
161
- property.examples = Array.isArray(value) ? value : [value];
162
- property.description = `${property.description}\nExample values: ${JSON.stringify(value)}`;
41
+ else if (property.type === 'array' && property.editor === 'requestListSources') {
42
+ clonedProperties[propertyName] = {
43
+ ...property,
44
+ items: {
45
+ ...property.items,
46
+ type: 'object',
47
+ title: 'Request list source',
48
+ description: 'Request list source',
49
+ properties: {
50
+ url: {
51
+ title: 'URL',
52
+ type: 'string',
53
+ description: 'URL of the request list source',
54
+ },
55
+ },
56
+ },
57
+ };
163
58
  }
164
59
  }
165
- return properties;
60
+ return clonedProperties;
166
61
  }
167
62
  /**
168
63
  * Filters schema properties to include only the necessary fields.
@@ -209,7 +104,7 @@ export function filterSchemaProperties(properties) {
209
104
  * @param {IActorInputSchema} input - Actor input object containing properties and required fields
210
105
  * @returns {Record<string, ISchemaProperties>} - Modified properties with required fields marked
211
106
  */
212
- function markInputPropertiesAsRequired(input) {
107
+ export function markInputPropertiesAsRequired(input) {
213
108
  const { required = [], properties } = input;
214
109
  for (const property of Object.keys(properties)) {
215
110
  if (required.includes(property)) {
@@ -222,106 +117,82 @@ function markInputPropertiesAsRequired(input) {
222
117
  return properties;
223
118
  }
224
119
  /**
225
- * Builds nested properties for object types in the schema.
226
- *
227
- * Specifically handles special cases like proxy configuration and request list sources
228
- * by adding predefined nested properties to these object types.
229
- * This is necessary for the agent to correctly infer how to structure object inputs
230
- * when passing arguments to the Actor.
120
+ * Helps determine the type of items in an array schema property.
121
+ * Priority order: explicit type in items > prefill type > default value type > editor type.
231
122
  *
232
- * For proxy objects (type='object', editor='proxy'), adds 'useApifyProxy' property.
233
- * For request list sources (type='array', editor='requestListSources'), adds URL structure to items.
123
+ * Based on JSON schema, the array needs a type, and most of the time Actor input schema does not have this, so we need to infer that.
234
124
  *
235
- * @param {Record<string, ISchemaProperties>} properties - The input schema properties
236
- * @returns {Record<string, ISchemaProperties>} Modified properties with nested properties
237
125
  */
238
- function buildNestedProperties(properties) {
239
- const clonedProperties = { ...properties };
240
- for (const [propertyName, property] of Object.entries(clonedProperties)) {
241
- if (property.type === 'object' && property.editor === 'proxy') {
242
- clonedProperties[propertyName] = {
243
- ...property,
244
- properties: {
245
- ...property.properties,
246
- useApifyProxy: {
247
- title: 'Use Apify Proxy',
248
- type: 'boolean',
249
- description: 'Whether to use Apify Proxy - ALWAYS SET TO TRUE.',
250
- default: true,
251
- examples: [true],
252
- },
253
- },
254
- required: ['useApifyProxy'],
255
- };
256
- }
257
- else if (property.type === 'array' && property.editor === 'requestListSources') {
258
- clonedProperties[propertyName] = {
259
- ...property,
260
- items: {
261
- ...property.items,
262
- type: 'object',
263
- title: 'Request list source',
264
- description: 'Request list source',
265
- properties: {
266
- url: {
267
- title: 'URL',
268
- type: 'string',
269
- description: 'URL of the request list source',
270
- },
271
- },
272
- },
273
- };
274
- }
126
+ export function inferArrayItemType(property) {
127
+ return property.items?.type
128
+ || (Array.isArray(property.prefill) && property.prefill.length > 0 && typeof property.prefill[0])
129
+ || (Array.isArray(property.default) && property.default.length > 0 && typeof property.default[0])
130
+ || (property.editor && getEditorItemType(property.editor))
131
+ || null;
132
+ function getEditorItemType(editor) {
133
+ const editorTypeMap = {
134
+ requestListSources: 'object',
135
+ stringList: 'string',
136
+ json: 'object',
137
+ globs: 'object',
138
+ };
139
+ return editorTypeMap[editor] || null;
275
140
  }
276
- return clonedProperties;
277
141
  }
278
142
  /**
279
- * Fetches actor input schemas by Actor IDs or Actor full names and creates MCP tools.
143
+ * Add enum values as string to property descriptions.
280
144
  *
281
- * This function retrieves the input schemas for the specified actors and compiles them into MCP tools.
282
- * It uses the AJV library to validate the input schemas.
145
+ * This is done as a preventive measure to prevent cases where library or agent framework
146
+ * does not handle enums or examples based on JSON schema definition.
283
147
  *
284
- * Tool name can't contain /, so it is replaced with _
148
+ * https://json-schema.org/understanding-json-schema/reference/enum
149
+ * https://json-schema.org/understanding-json-schema/reference/annotations
285
150
  *
286
- * The input schema processing workflow:
287
- * 1. Properties are marked as required using markInputPropertiesAsRequired() to add "REQUIRED" prefix to descriptions
288
- * 2. Nested properties are built by analyzing editor type (proxy, requestListSources) using buildNestedProperties()
289
- * 3. Properties are filtered using filterSchemaProperties()
290
- * 4. Properties are shortened using shortenProperties()
291
- * 5. Enums are added to descriptions with examples using addEnumsToDescriptionsWithExamples()
151
+ * @param properties
152
+ */
153
+ export function addEnumsToDescriptionsWithExamples(properties) {
154
+ for (const property of Object.values(properties)) {
155
+ if (property.enum && property.enum.length > 0) {
156
+ property.description = `${property.description}\nPossible values: ${property.enum.slice(0, 20).join(',')}`;
157
+ }
158
+ const value = property.prefill ?? property.default;
159
+ if (value && !(Array.isArray(value) && value.length === 0)) {
160
+ property.examples = Array.isArray(value) ? value : [value];
161
+ property.description = `${property.description}\nExample values: ${JSON.stringify(value)}`;
162
+ }
163
+ }
164
+ return properties;
165
+ }
166
+ /**
167
+ * Helper function to shorten the enum list if it is too long.
292
168
  *
293
- * @param {string[]} actors - An array of actor IDs or Actor full names.
294
- * @returns {Promise<Tool[]>} - A promise that resolves to an array of MCP tools.
169
+ * @param {string[]} enumList - The list of enum values to be shortened.
170
+ * @returns {string[] | undefined} - The shortened enum list or undefined if the list is too long.
295
171
  */
296
- export async function getActorsAsTools(actors) {
297
- const ajv = new Ajv({ coerceTypes: 'array', strict: false });
298
- const results = await Promise.all(actors.map(getActorDefinition));
299
- const tools = [];
300
- for (const result of results) {
301
- if (result) {
302
- if (result.input && 'properties' in result.input && result.input) {
303
- result.input.properties = markInputPropertiesAsRequired(result.input);
304
- result.input.properties = buildNestedProperties(result.input.properties);
305
- result.input.properties = filterSchemaProperties(result.input.properties);
306
- result.input.properties = shortenProperties(result.input.properties);
307
- result.input.properties = addEnumsToDescriptionsWithExamples(result.input.properties);
308
- }
309
- try {
310
- const memoryMbytes = result.defaultRunOptions?.memoryMbytes || defaults.maxMemoryMbytes;
311
- tools.push({
312
- name: actorNameToToolName(result.actorFullName),
313
- actorFullName: result.actorFullName,
314
- description: `${result.description} Instructions: ${ACTOR_ADDITIONAL_INSTRUCTIONS}`,
315
- inputSchema: result.input || {},
316
- ajvValidate: ajv.compile(result.input || {}),
317
- memoryMbytes: memoryMbytes > defaults.maxMemoryMbytes ? defaults.maxMemoryMbytes : memoryMbytes,
318
- });
319
- }
320
- catch (validationError) {
321
- log.error(`Failed to compile AJV schema for Actor: ${result.actorFullName}. Error: ${validationError}`);
322
- }
172
+ export function shortenEnum(enumList) {
173
+ let charCount = 0;
174
+ const resultEnumList = enumList.filter((enumValue) => {
175
+ charCount += enumValue.length;
176
+ return charCount <= ACTOR_ENUM_MAX_LENGTH;
177
+ });
178
+ return resultEnumList.length > 0 ? resultEnumList : undefined;
179
+ }
180
+ /**
181
+ * Shortens the description, enum, and items.enum properties of the schema properties.
182
+ * @param properties
183
+ */
184
+ export function shortenProperties(properties) {
185
+ for (const property of Object.values(properties)) {
186
+ if (property.description.length > ACTOR_MAX_DESCRIPTION_LENGTH) {
187
+ property.description = `${property.description.slice(0, ACTOR_MAX_DESCRIPTION_LENGTH)}...`;
188
+ }
189
+ if (property.enum && property.enum?.length > 0) {
190
+ property.enum = shortenEnum(property.enum);
191
+ }
192
+ if (property.items?.enum && property.items.enum.length > 0) {
193
+ property.items.enum = shortenEnum(property.items.enum);
323
194
  }
324
195
  }
325
- return tools;
196
+ return properties;
326
197
  }
327
- //# sourceMappingURL=actors.js.map
198
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/tools/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAGlF,MAAM,UAAU,mBAAmB,CAAC,SAAiB;IACjD,OAAO,SAAS;SACX,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC;SACzB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC;SACvB,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtB,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAA6C;IAC/E,MAAM,gBAAgB,GAAG,EAAE,GAAG,UAAU,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACtE,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,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