@robota-sdk/agent-tools 3.0.0-beta.54 → 3.0.0-beta.55
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/node/index.cjs +30 -7
- package/dist/node/index.d.cts +1 -0
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +30 -7
- package/package.json +3 -3
package/dist/node/index.cjs
CHANGED
|
@@ -215,7 +215,9 @@ function zodToJsonSchema(schema, options = {}) {
|
|
|
215
215
|
type: "object",
|
|
216
216
|
properties,
|
|
217
217
|
required,
|
|
218
|
-
...options.allowAdditionalProperties
|
|
218
|
+
...(options.allowAdditionalProperties || schemaDef.unknownKeys === "passthrough") && {
|
|
219
|
+
additionalProperties: true
|
|
220
|
+
}
|
|
219
221
|
};
|
|
220
222
|
}
|
|
221
223
|
function convertZodTypeToProperty(typeObj) {
|
|
@@ -347,7 +349,7 @@ function validateParameterType(key, value, schema) {
|
|
|
347
349
|
}
|
|
348
350
|
return void 0;
|
|
349
351
|
}
|
|
350
|
-
function getValidationErrors(parameters, schemaRequired, schemaProperties) {
|
|
352
|
+
function getValidationErrors(parameters, schemaRequired, schemaProperties, additionalProperties) {
|
|
351
353
|
const errors = [];
|
|
352
354
|
for (const field of schemaRequired) {
|
|
353
355
|
if (!(field in parameters)) {
|
|
@@ -357,6 +359,14 @@ function getValidationErrors(parameters, schemaRequired, schemaProperties) {
|
|
|
357
359
|
for (const [key, value] of Object.entries(parameters)) {
|
|
358
360
|
const paramSchema = schemaProperties[key];
|
|
359
361
|
if (!paramSchema) {
|
|
362
|
+
if (additionalProperties === true) {
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
if (additionalProperties && typeof additionalProperties === "object") {
|
|
366
|
+
const additionalTypeError = validateParameterType(key, value, additionalProperties);
|
|
367
|
+
if (additionalTypeError) errors.push(additionalTypeError);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
360
370
|
errors.push(`Unknown parameter: ${key}`);
|
|
361
371
|
continue;
|
|
362
372
|
}
|
|
@@ -367,8 +377,13 @@ function getValidationErrors(parameters, schemaRequired, schemaProperties) {
|
|
|
367
377
|
}
|
|
368
378
|
return errors;
|
|
369
379
|
}
|
|
370
|
-
function validateToolParameters(parameters, schemaRequired, schemaProperties) {
|
|
371
|
-
const errors = getValidationErrors(
|
|
380
|
+
function validateToolParameters(parameters, schemaRequired, schemaProperties, additionalProperties) {
|
|
381
|
+
const errors = getValidationErrors(
|
|
382
|
+
parameters,
|
|
383
|
+
schemaRequired,
|
|
384
|
+
schemaProperties,
|
|
385
|
+
additionalProperties
|
|
386
|
+
);
|
|
372
387
|
return {
|
|
373
388
|
isValid: errors.length === 0,
|
|
374
389
|
errors
|
|
@@ -408,7 +423,8 @@ var FunctionTool = class {
|
|
|
408
423
|
const errors = getValidationErrors(
|
|
409
424
|
parameters,
|
|
410
425
|
this.schema.parameters.required || [],
|
|
411
|
-
this.schema.parameters.properties || {}
|
|
426
|
+
this.schema.parameters.properties || {},
|
|
427
|
+
this.schema.parameters.additionalProperties
|
|
412
428
|
);
|
|
413
429
|
throw new import_agent_core3.ValidationError(`Invalid parameters for tool "${toolName}": ${errors.join(", ")}`);
|
|
414
430
|
}
|
|
@@ -448,7 +464,8 @@ var FunctionTool = class {
|
|
|
448
464
|
return getValidationErrors(
|
|
449
465
|
parameters,
|
|
450
466
|
this.schema.parameters.required || [],
|
|
451
|
-
this.schema.parameters.properties || {}
|
|
467
|
+
this.schema.parameters.properties || {},
|
|
468
|
+
this.schema.parameters.additionalProperties
|
|
452
469
|
).length === 0;
|
|
453
470
|
}
|
|
454
471
|
/**
|
|
@@ -458,7 +475,8 @@ var FunctionTool = class {
|
|
|
458
475
|
return validateToolParameters(
|
|
459
476
|
parameters,
|
|
460
477
|
this.schema.parameters.required || [],
|
|
461
|
-
this.schema.parameters.properties || {}
|
|
478
|
+
this.schema.parameters.properties || {},
|
|
479
|
+
this.schema.parameters.additionalProperties
|
|
462
480
|
);
|
|
463
481
|
}
|
|
464
482
|
/**
|
|
@@ -863,6 +881,11 @@ async function runBash(args) {
|
|
|
863
881
|
const timer = setTimeout(() => {
|
|
864
882
|
timedOut = true;
|
|
865
883
|
child.kill("SIGTERM");
|
|
884
|
+
settle({
|
|
885
|
+
success: false,
|
|
886
|
+
output: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
887
|
+
error: `Command timed out after ${timeout}ms`
|
|
888
|
+
});
|
|
866
889
|
}, timeout);
|
|
867
890
|
function settle(result) {
|
|
868
891
|
if (settled) return;
|
package/dist/node/index.d.cts
CHANGED
package/dist/node/index.d.ts
CHANGED
package/dist/node/index.js
CHANGED
|
@@ -165,7 +165,9 @@ function zodToJsonSchema(schema, options = {}) {
|
|
|
165
165
|
type: "object",
|
|
166
166
|
properties,
|
|
167
167
|
required,
|
|
168
|
-
...options.allowAdditionalProperties
|
|
168
|
+
...(options.allowAdditionalProperties || schemaDef.unknownKeys === "passthrough") && {
|
|
169
|
+
additionalProperties: true
|
|
170
|
+
}
|
|
169
171
|
};
|
|
170
172
|
}
|
|
171
173
|
function convertZodTypeToProperty(typeObj) {
|
|
@@ -297,7 +299,7 @@ function validateParameterType(key, value, schema) {
|
|
|
297
299
|
}
|
|
298
300
|
return void 0;
|
|
299
301
|
}
|
|
300
|
-
function getValidationErrors(parameters, schemaRequired, schemaProperties) {
|
|
302
|
+
function getValidationErrors(parameters, schemaRequired, schemaProperties, additionalProperties) {
|
|
301
303
|
const errors = [];
|
|
302
304
|
for (const field of schemaRequired) {
|
|
303
305
|
if (!(field in parameters)) {
|
|
@@ -307,6 +309,14 @@ function getValidationErrors(parameters, schemaRequired, schemaProperties) {
|
|
|
307
309
|
for (const [key, value] of Object.entries(parameters)) {
|
|
308
310
|
const paramSchema = schemaProperties[key];
|
|
309
311
|
if (!paramSchema) {
|
|
312
|
+
if (additionalProperties === true) {
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (additionalProperties && typeof additionalProperties === "object") {
|
|
316
|
+
const additionalTypeError = validateParameterType(key, value, additionalProperties);
|
|
317
|
+
if (additionalTypeError) errors.push(additionalTypeError);
|
|
318
|
+
continue;
|
|
319
|
+
}
|
|
310
320
|
errors.push(`Unknown parameter: ${key}`);
|
|
311
321
|
continue;
|
|
312
322
|
}
|
|
@@ -317,8 +327,13 @@ function getValidationErrors(parameters, schemaRequired, schemaProperties) {
|
|
|
317
327
|
}
|
|
318
328
|
return errors;
|
|
319
329
|
}
|
|
320
|
-
function validateToolParameters(parameters, schemaRequired, schemaProperties) {
|
|
321
|
-
const errors = getValidationErrors(
|
|
330
|
+
function validateToolParameters(parameters, schemaRequired, schemaProperties, additionalProperties) {
|
|
331
|
+
const errors = getValidationErrors(
|
|
332
|
+
parameters,
|
|
333
|
+
schemaRequired,
|
|
334
|
+
schemaProperties,
|
|
335
|
+
additionalProperties
|
|
336
|
+
);
|
|
322
337
|
return {
|
|
323
338
|
isValid: errors.length === 0,
|
|
324
339
|
errors
|
|
@@ -358,7 +373,8 @@ var FunctionTool = class {
|
|
|
358
373
|
const errors = getValidationErrors(
|
|
359
374
|
parameters,
|
|
360
375
|
this.schema.parameters.required || [],
|
|
361
|
-
this.schema.parameters.properties || {}
|
|
376
|
+
this.schema.parameters.properties || {},
|
|
377
|
+
this.schema.parameters.additionalProperties
|
|
362
378
|
);
|
|
363
379
|
throw new ValidationError2(`Invalid parameters for tool "${toolName}": ${errors.join(", ")}`);
|
|
364
380
|
}
|
|
@@ -398,7 +414,8 @@ var FunctionTool = class {
|
|
|
398
414
|
return getValidationErrors(
|
|
399
415
|
parameters,
|
|
400
416
|
this.schema.parameters.required || [],
|
|
401
|
-
this.schema.parameters.properties || {}
|
|
417
|
+
this.schema.parameters.properties || {},
|
|
418
|
+
this.schema.parameters.additionalProperties
|
|
402
419
|
).length === 0;
|
|
403
420
|
}
|
|
404
421
|
/**
|
|
@@ -408,7 +425,8 @@ var FunctionTool = class {
|
|
|
408
425
|
return validateToolParameters(
|
|
409
426
|
parameters,
|
|
410
427
|
this.schema.parameters.required || [],
|
|
411
|
-
this.schema.parameters.properties || {}
|
|
428
|
+
this.schema.parameters.properties || {},
|
|
429
|
+
this.schema.parameters.additionalProperties
|
|
412
430
|
);
|
|
413
431
|
}
|
|
414
432
|
/**
|
|
@@ -813,6 +831,11 @@ async function runBash(args) {
|
|
|
813
831
|
const timer = setTimeout(() => {
|
|
814
832
|
timedOut = true;
|
|
815
833
|
child.kill("SIGTERM");
|
|
834
|
+
settle({
|
|
835
|
+
success: false,
|
|
836
|
+
output: Buffer.concat(stdoutChunks).toString("utf8"),
|
|
837
|
+
error: `Command timed out after ${timeout}ms`
|
|
838
|
+
});
|
|
816
839
|
}, timeout);
|
|
817
840
|
function settle(result) {
|
|
818
841
|
if (settled) return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robota-sdk/agent-tools",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.55",
|
|
4
4
|
"description": "Tool registry and implementations for Robota SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/node/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"zod": "^3.24.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@robota-sdk/agent-core": "3.0.0-beta.
|
|
37
|
+
"@robota-sdk/agent-core": "3.0.0-beta.55"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"openapi-types": "^12.1.3",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"tsup": "^8.0.1",
|
|
43
43
|
"typescript": "^5.3.3",
|
|
44
44
|
"vitest": "^1.6.1",
|
|
45
|
-
"@robota-sdk/agent-core": "3.0.0-beta.
|
|
45
|
+
"@robota-sdk/agent-core": "3.0.0-beta.55"
|
|
46
46
|
},
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"publishConfig": {
|