@agentforge/core 0.18.4 → 0.18.5
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/index.cjs +11 -19
- package/dist/index.js +11 -19
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -400,36 +400,28 @@ function getMissingDescriptions(schema) {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
// src/tools/helpers.ts
|
|
403
|
-
function
|
|
403
|
+
function constructTool(metadata, schema, invoke, shouldValidateSchemaDescriptions) {
|
|
404
404
|
const metadataResult = validateToolMetadata(metadata);
|
|
405
405
|
if (!metadataResult.success) {
|
|
406
406
|
const errors = metadataResult.error.errors.map((err) => ` - ${err.path.join(".")}: ${err.message}`).join("\n");
|
|
407
407
|
throw new Error(`Invalid tool metadata:
|
|
408
408
|
${errors}`);
|
|
409
409
|
}
|
|
410
|
-
|
|
411
|
-
|
|
410
|
+
if (shouldValidateSchemaDescriptions) {
|
|
411
|
+
validateSchemaDescriptions(schema);
|
|
412
|
+
}
|
|
413
|
+
return {
|
|
412
414
|
metadata: metadataResult.data,
|
|
413
415
|
schema,
|
|
414
|
-
invoke
|
|
416
|
+
invoke,
|
|
417
|
+
execute: invoke
|
|
415
418
|
};
|
|
416
|
-
|
|
417
|
-
|
|
419
|
+
}
|
|
420
|
+
function createTool(metadata, schema, invoke) {
|
|
421
|
+
return constructTool(metadata, schema, invoke, true);
|
|
418
422
|
}
|
|
419
423
|
function createToolUnsafe(metadata, schema, invoke) {
|
|
420
|
-
|
|
421
|
-
if (!metadataResult.success) {
|
|
422
|
-
const errors = metadataResult.error.errors.map((err) => ` - ${err.path.join(".")}: ${err.message}`).join("\n");
|
|
423
|
-
throw new Error(`Invalid tool metadata:
|
|
424
|
-
${errors}`);
|
|
425
|
-
}
|
|
426
|
-
const tool = {
|
|
427
|
-
metadata: metadataResult.data,
|
|
428
|
-
schema,
|
|
429
|
-
invoke
|
|
430
|
-
};
|
|
431
|
-
tool.execute = invoke;
|
|
432
|
-
return tool;
|
|
424
|
+
return constructTool(metadata, schema, invoke, false);
|
|
433
425
|
}
|
|
434
426
|
function validateTool(tool) {
|
|
435
427
|
const errors = [];
|
package/dist/index.js
CHANGED
|
@@ -224,36 +224,28 @@ function getMissingDescriptions(schema) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/tools/helpers.ts
|
|
227
|
-
function
|
|
227
|
+
function constructTool(metadata, schema, invoke, shouldValidateSchemaDescriptions) {
|
|
228
228
|
const metadataResult = validateToolMetadata(metadata);
|
|
229
229
|
if (!metadataResult.success) {
|
|
230
230
|
const errors = metadataResult.error.errors.map((err) => ` - ${err.path.join(".")}: ${err.message}`).join("\n");
|
|
231
231
|
throw new Error(`Invalid tool metadata:
|
|
232
232
|
${errors}`);
|
|
233
233
|
}
|
|
234
|
-
|
|
235
|
-
|
|
234
|
+
if (shouldValidateSchemaDescriptions) {
|
|
235
|
+
validateSchemaDescriptions(schema);
|
|
236
|
+
}
|
|
237
|
+
return {
|
|
236
238
|
metadata: metadataResult.data,
|
|
237
239
|
schema,
|
|
238
|
-
invoke
|
|
240
|
+
invoke,
|
|
241
|
+
execute: invoke
|
|
239
242
|
};
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
}
|
|
244
|
+
function createTool(metadata, schema, invoke) {
|
|
245
|
+
return constructTool(metadata, schema, invoke, true);
|
|
242
246
|
}
|
|
243
247
|
function createToolUnsafe(metadata, schema, invoke) {
|
|
244
|
-
|
|
245
|
-
if (!metadataResult.success) {
|
|
246
|
-
const errors = metadataResult.error.errors.map((err) => ` - ${err.path.join(".")}: ${err.message}`).join("\n");
|
|
247
|
-
throw new Error(`Invalid tool metadata:
|
|
248
|
-
${errors}`);
|
|
249
|
-
}
|
|
250
|
-
const tool = {
|
|
251
|
-
metadata: metadataResult.data,
|
|
252
|
-
schema,
|
|
253
|
-
invoke
|
|
254
|
-
};
|
|
255
|
-
tool.execute = invoke;
|
|
256
|
-
return tool;
|
|
248
|
+
return constructTool(metadata, schema, invoke, false);
|
|
257
249
|
}
|
|
258
250
|
function validateTool(tool) {
|
|
259
251
|
const errors = [];
|
package/package.json
CHANGED