@probelabs/probe 0.6.0-rc168 → 0.6.0-rc169
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/build/agent/ProbeAgent.js +41 -17
- package/build/agent/index.js +53 -22
- package/build/agent/tools.js +26 -9
- package/cjs/agent/ProbeAgent.cjs +88 -31
- package/cjs/index.cjs +88 -31
- package/package.json +1 -1
- package/src/agent/ProbeAgent.js +41 -17
- package/src/agent/tools.js +26 -9
|
@@ -420,14 +420,20 @@ export class ProbeAgent {
|
|
|
420
420
|
* Initialize tools with configuration
|
|
421
421
|
*/
|
|
422
422
|
initializeTools() {
|
|
423
|
+
const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
|
|
424
|
+
|
|
423
425
|
const configOptions = {
|
|
424
426
|
sessionId: this.sessionId,
|
|
425
427
|
debug: this.debug,
|
|
426
428
|
defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
|
|
427
429
|
allowedFolders: this.allowedFolders,
|
|
428
430
|
outline: this.outline,
|
|
431
|
+
allowEdit: this.allowEdit,
|
|
432
|
+
enableDelegate: this.enableDelegate,
|
|
429
433
|
enableBash: this.enableBash,
|
|
430
|
-
bashConfig: this.bashConfig
|
|
434
|
+
bashConfig: this.bashConfig,
|
|
435
|
+
allowedTools: this.allowedTools,
|
|
436
|
+
isToolAllowed
|
|
431
437
|
};
|
|
432
438
|
|
|
433
439
|
// Create base tools
|
|
@@ -436,15 +442,33 @@ export class ProbeAgent {
|
|
|
436
442
|
// Create wrapped tools with event emission
|
|
437
443
|
const wrappedTools = createWrappedTools(baseTools);
|
|
438
444
|
|
|
439
|
-
// Store tool instances for execution
|
|
440
|
-
this.toolImplementations = {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
// Store tool instances for execution (respect allowedTools + feature flags)
|
|
446
|
+
this.toolImplementations = {};
|
|
447
|
+
|
|
448
|
+
if (wrappedTools.searchToolInstance && isToolAllowed('search')) {
|
|
449
|
+
this.toolImplementations.search = wrappedTools.searchToolInstance;
|
|
450
|
+
}
|
|
451
|
+
if (wrappedTools.queryToolInstance && isToolAllowed('query')) {
|
|
452
|
+
this.toolImplementations.query = wrappedTools.queryToolInstance;
|
|
453
|
+
}
|
|
454
|
+
if (wrappedTools.extractToolInstance && isToolAllowed('extract')) {
|
|
455
|
+
this.toolImplementations.extract = wrappedTools.extractToolInstance;
|
|
456
|
+
}
|
|
457
|
+
if (this.enableDelegate && wrappedTools.delegateToolInstance && isToolAllowed('delegate')) {
|
|
458
|
+
this.toolImplementations.delegate = wrappedTools.delegateToolInstance;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// File browsing tools
|
|
462
|
+
if (isToolAllowed('listFiles')) {
|
|
463
|
+
this.toolImplementations.listFiles = listFilesToolInstance;
|
|
464
|
+
}
|
|
465
|
+
if (isToolAllowed('searchFiles')) {
|
|
466
|
+
this.toolImplementations.searchFiles = searchFilesToolInstance;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Image loading tool
|
|
470
|
+
if (isToolAllowed('readImage')) {
|
|
471
|
+
this.toolImplementations.readImage = {
|
|
448
472
|
execute: async (params) => {
|
|
449
473
|
const imagePath = params.path;
|
|
450
474
|
if (!imagePath) {
|
|
@@ -460,20 +484,20 @@ export class ProbeAgent {
|
|
|
460
484
|
|
|
461
485
|
return `Image loaded successfully: ${imagePath}. The image is now available for analysis in the conversation.`;
|
|
462
486
|
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
465
489
|
|
|
466
|
-
// Add bash tool if enabled
|
|
467
|
-
if (this.enableBash && wrappedTools.bashToolInstance) {
|
|
490
|
+
// Add bash tool if enabled and allowed
|
|
491
|
+
if (this.enableBash && wrappedTools.bashToolInstance && isToolAllowed('bash')) {
|
|
468
492
|
this.toolImplementations.bash = wrappedTools.bashToolInstance;
|
|
469
493
|
}
|
|
470
494
|
|
|
471
|
-
// Add edit and create tools if enabled
|
|
495
|
+
// Add edit and create tools if enabled and allowed
|
|
472
496
|
if (this.allowEdit) {
|
|
473
|
-
if (wrappedTools.editToolInstance) {
|
|
497
|
+
if (wrappedTools.editToolInstance && isToolAllowed('edit')) {
|
|
474
498
|
this.toolImplementations.edit = wrappedTools.editToolInstance;
|
|
475
499
|
}
|
|
476
|
-
if (wrappedTools.createToolInstance) {
|
|
500
|
+
if (wrappedTools.createToolInstance && isToolAllowed('create')) {
|
|
477
501
|
this.toolImplementations.create = wrappedTools.createToolInstance;
|
|
478
502
|
}
|
|
479
503
|
}
|
package/build/agent/index.js
CHANGED
|
@@ -17550,17 +17550,30 @@ var init_xmlParsingUtils = __esm({
|
|
|
17550
17550
|
// src/agent/tools.js
|
|
17551
17551
|
import { randomUUID as randomUUID3 } from "crypto";
|
|
17552
17552
|
function createTools(configOptions) {
|
|
17553
|
-
const tools2 = {
|
|
17554
|
-
|
|
17555
|
-
|
|
17556
|
-
|
|
17557
|
-
|
|
17558
|
-
|
|
17559
|
-
|
|
17553
|
+
const tools2 = {};
|
|
17554
|
+
const isToolAllowed = configOptions.isToolAllowed || ((toolName) => {
|
|
17555
|
+
if (!configOptions.allowedTools) return true;
|
|
17556
|
+
return configOptions.allowedTools.isEnabled(toolName);
|
|
17557
|
+
});
|
|
17558
|
+
if (isToolAllowed("search")) {
|
|
17559
|
+
tools2.searchTool = searchTool(configOptions);
|
|
17560
|
+
}
|
|
17561
|
+
if (isToolAllowed("query")) {
|
|
17562
|
+
tools2.queryTool = queryTool(configOptions);
|
|
17563
|
+
}
|
|
17564
|
+
if (isToolAllowed("extract")) {
|
|
17565
|
+
tools2.extractTool = extractTool(configOptions);
|
|
17566
|
+
}
|
|
17567
|
+
if (configOptions.enableDelegate && isToolAllowed("delegate")) {
|
|
17568
|
+
tools2.delegateTool = delegateTool(configOptions);
|
|
17569
|
+
}
|
|
17570
|
+
if (configOptions.enableBash && isToolAllowed("bash")) {
|
|
17560
17571
|
tools2.bashTool = bashTool(configOptions);
|
|
17561
17572
|
}
|
|
17562
|
-
if (configOptions.allowEdit) {
|
|
17573
|
+
if (configOptions.allowEdit && isToolAllowed("edit")) {
|
|
17563
17574
|
tools2.editTool = editTool(configOptions);
|
|
17575
|
+
}
|
|
17576
|
+
if (configOptions.allowEdit && isToolAllowed("create")) {
|
|
17564
17577
|
tools2.createTool = createTool(configOptions);
|
|
17565
17578
|
}
|
|
17566
17579
|
return tools2;
|
|
@@ -59264,25 +59277,43 @@ var init_ProbeAgent = __esm({
|
|
|
59264
59277
|
* Initialize tools with configuration
|
|
59265
59278
|
*/
|
|
59266
59279
|
initializeTools() {
|
|
59280
|
+
const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
|
|
59267
59281
|
const configOptions = {
|
|
59268
59282
|
sessionId: this.sessionId,
|
|
59269
59283
|
debug: this.debug,
|
|
59270
59284
|
defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
|
|
59271
59285
|
allowedFolders: this.allowedFolders,
|
|
59272
59286
|
outline: this.outline,
|
|
59287
|
+
allowEdit: this.allowEdit,
|
|
59288
|
+
enableDelegate: this.enableDelegate,
|
|
59273
59289
|
enableBash: this.enableBash,
|
|
59274
|
-
bashConfig: this.bashConfig
|
|
59290
|
+
bashConfig: this.bashConfig,
|
|
59291
|
+
allowedTools: this.allowedTools,
|
|
59292
|
+
isToolAllowed
|
|
59275
59293
|
};
|
|
59276
59294
|
const baseTools = createTools(configOptions);
|
|
59277
59295
|
const wrappedTools = createWrappedTools(baseTools);
|
|
59278
|
-
this.toolImplementations = {
|
|
59279
|
-
|
|
59280
|
-
|
|
59281
|
-
|
|
59282
|
-
|
|
59283
|
-
|
|
59284
|
-
|
|
59285
|
-
|
|
59296
|
+
this.toolImplementations = {};
|
|
59297
|
+
if (wrappedTools.searchToolInstance && isToolAllowed("search")) {
|
|
59298
|
+
this.toolImplementations.search = wrappedTools.searchToolInstance;
|
|
59299
|
+
}
|
|
59300
|
+
if (wrappedTools.queryToolInstance && isToolAllowed("query")) {
|
|
59301
|
+
this.toolImplementations.query = wrappedTools.queryToolInstance;
|
|
59302
|
+
}
|
|
59303
|
+
if (wrappedTools.extractToolInstance && isToolAllowed("extract")) {
|
|
59304
|
+
this.toolImplementations.extract = wrappedTools.extractToolInstance;
|
|
59305
|
+
}
|
|
59306
|
+
if (this.enableDelegate && wrappedTools.delegateToolInstance && isToolAllowed("delegate")) {
|
|
59307
|
+
this.toolImplementations.delegate = wrappedTools.delegateToolInstance;
|
|
59308
|
+
}
|
|
59309
|
+
if (isToolAllowed("listFiles")) {
|
|
59310
|
+
this.toolImplementations.listFiles = listFilesToolInstance;
|
|
59311
|
+
}
|
|
59312
|
+
if (isToolAllowed("searchFiles")) {
|
|
59313
|
+
this.toolImplementations.searchFiles = searchFilesToolInstance;
|
|
59314
|
+
}
|
|
59315
|
+
if (isToolAllowed("readImage")) {
|
|
59316
|
+
this.toolImplementations.readImage = {
|
|
59286
59317
|
execute: async (params) => {
|
|
59287
59318
|
const imagePath = params.path;
|
|
59288
59319
|
if (!imagePath) {
|
|
@@ -59294,16 +59325,16 @@ var init_ProbeAgent = __esm({
|
|
|
59294
59325
|
}
|
|
59295
59326
|
return `Image loaded successfully: ${imagePath}. The image is now available for analysis in the conversation.`;
|
|
59296
59327
|
}
|
|
59297
|
-
}
|
|
59298
|
-
}
|
|
59299
|
-
if (this.enableBash && wrappedTools.bashToolInstance) {
|
|
59328
|
+
};
|
|
59329
|
+
}
|
|
59330
|
+
if (this.enableBash && wrappedTools.bashToolInstance && isToolAllowed("bash")) {
|
|
59300
59331
|
this.toolImplementations.bash = wrappedTools.bashToolInstance;
|
|
59301
59332
|
}
|
|
59302
59333
|
if (this.allowEdit) {
|
|
59303
|
-
if (wrappedTools.editToolInstance) {
|
|
59334
|
+
if (wrappedTools.editToolInstance && isToolAllowed("edit")) {
|
|
59304
59335
|
this.toolImplementations.edit = wrappedTools.editToolInstance;
|
|
59305
59336
|
}
|
|
59306
|
-
if (wrappedTools.createToolInstance) {
|
|
59337
|
+
if (wrappedTools.createToolInstance && isToolAllowed("create")) {
|
|
59307
59338
|
this.toolImplementations.create = wrappedTools.createToolInstance;
|
|
59308
59339
|
}
|
|
59309
59340
|
}
|
package/build/agent/tools.js
CHANGED
|
@@ -31,21 +31,39 @@ import { processXmlWithThinkingAndRecovery } from './xmlParsingUtils.js';
|
|
|
31
31
|
|
|
32
32
|
// Create configured tool instances
|
|
33
33
|
export function createTools(configOptions) {
|
|
34
|
-
const tools = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
const tools = {};
|
|
35
|
+
|
|
36
|
+
const isToolAllowed =
|
|
37
|
+
configOptions.isToolAllowed ||
|
|
38
|
+
((toolName) => {
|
|
39
|
+
if (!configOptions.allowedTools) return true;
|
|
40
|
+
return configOptions.allowedTools.isEnabled(toolName);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Core tools
|
|
44
|
+
if (isToolAllowed('search')) {
|
|
45
|
+
tools.searchTool = searchTool(configOptions);
|
|
46
|
+
}
|
|
47
|
+
if (isToolAllowed('query')) {
|
|
48
|
+
tools.queryTool = queryTool(configOptions);
|
|
49
|
+
}
|
|
50
|
+
if (isToolAllowed('extract')) {
|
|
51
|
+
tools.extractTool = extractTool(configOptions);
|
|
52
|
+
}
|
|
53
|
+
if (configOptions.enableDelegate && isToolAllowed('delegate')) {
|
|
54
|
+
tools.delegateTool = delegateTool(configOptions);
|
|
55
|
+
}
|
|
40
56
|
|
|
41
57
|
// Add bash tool if enabled
|
|
42
|
-
if (configOptions.enableBash) {
|
|
58
|
+
if (configOptions.enableBash && isToolAllowed('bash')) {
|
|
43
59
|
tools.bashTool = bashTool(configOptions);
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
// Add edit and create tools if enabled
|
|
47
|
-
if (configOptions.allowEdit) {
|
|
63
|
+
if (configOptions.allowEdit && isToolAllowed('edit')) {
|
|
48
64
|
tools.editTool = editTool(configOptions);
|
|
65
|
+
}
|
|
66
|
+
if (configOptions.allowEdit && isToolAllowed('create')) {
|
|
49
67
|
tools.createTool = createTool(configOptions);
|
|
50
68
|
}
|
|
51
69
|
|
|
@@ -199,4 +217,3 @@ export function parseXmlToolCallWithThinking(xmlString, validTools) {
|
|
|
199
217
|
// Otherwise, use the original parseXmlToolCall function to parse the cleaned XML string
|
|
200
218
|
return parseXmlToolCall(cleanedXmlString, validTools);
|
|
201
219
|
}
|
|
202
|
-
|
package/cjs/agent/ProbeAgent.cjs
CHANGED
|
@@ -17003,7 +17003,7 @@ var require_package2 = __commonJS({
|
|
|
17003
17003
|
module2.exports = {
|
|
17004
17004
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
17005
17005
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
17006
|
-
version: "3.
|
|
17006
|
+
version: "3.938.0",
|
|
17007
17007
|
scripts: {
|
|
17008
17008
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
17009
17009
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -23276,6 +23276,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
23276
23276
|
var _A2 = "Accept";
|
|
23277
23277
|
var _ADE3 = "AccessDeniedException";
|
|
23278
23278
|
var _AG = "ApplyGuardrail";
|
|
23279
|
+
var _AGD = "AppliedGuardrailDetails";
|
|
23279
23280
|
var _AGR = "ApplyGuardrailRequest";
|
|
23280
23281
|
var _AGRp = "ApplyGuardrailResponse";
|
|
23281
23282
|
var _AIM = "AsyncInvokeMessage";
|
|
@@ -23491,6 +23492,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
23491
23492
|
var _XABST = "X-Amzn-Bedrock-Service-Tier";
|
|
23492
23493
|
var _XABT = "X-Amzn-Bedrock-Trace";
|
|
23493
23494
|
var _a16 = "action";
|
|
23495
|
+
var _aGD = "appliedGuardrailDetails";
|
|
23494
23496
|
var _aIS = "asyncInvokeSummaries";
|
|
23495
23497
|
var _aMRF = "additionalModelRequestFields";
|
|
23496
23498
|
var _aMRFP = "additionalModelResponseFieldPaths";
|
|
@@ -23554,10 +23556,14 @@ var require_dist_cjs66 = __commonJS({
|
|
|
23554
23556
|
var _fi = "findings";
|
|
23555
23557
|
var _fil = "filters";
|
|
23556
23558
|
var _g = "guardrail";
|
|
23559
|
+
var _gA = "guardrailArn";
|
|
23557
23560
|
var _gC = "guardrailCoverage";
|
|
23558
23561
|
var _gCu = "guardrailConfig";
|
|
23559
23562
|
var _gCua = "guardContent";
|
|
23560
|
-
var _gI = "
|
|
23563
|
+
var _gI = "guardrailId";
|
|
23564
|
+
var _gIu = "guardrailIdentifier";
|
|
23565
|
+
var _gO = "guardrailOrigin";
|
|
23566
|
+
var _gOu = "guardrailOwnership";
|
|
23561
23567
|
var _gPL = "guardrailProcessingLatency";
|
|
23562
23568
|
var _gV = "guardrailVersion";
|
|
23563
23569
|
var _gu = "guarded";
|
|
@@ -23728,12 +23734,20 @@ var require_dist_cjs66 = __commonJS({
|
|
|
23728
23734
|
];
|
|
23729
23735
|
schema.TypeRegistry.for(n04).registerError(AccessDeniedException5, AccessDeniedException$1);
|
|
23730
23736
|
var AnyToolChoice = [3, n04, _ATC, 0, [], []];
|
|
23737
|
+
var AppliedGuardrailDetails = [
|
|
23738
|
+
3,
|
|
23739
|
+
n04,
|
|
23740
|
+
_AGD,
|
|
23741
|
+
0,
|
|
23742
|
+
[_gI, _gV, _gA, _gO, _gOu],
|
|
23743
|
+
[0, 0, 0, 64 | 0, 0]
|
|
23744
|
+
];
|
|
23731
23745
|
var ApplyGuardrailRequest = [
|
|
23732
23746
|
3,
|
|
23733
23747
|
n04,
|
|
23734
23748
|
_AGR,
|
|
23735
23749
|
0,
|
|
23736
|
-
[
|
|
23750
|
+
[_gIu, _gV, _s4, _co3, _oS],
|
|
23737
23751
|
[[0, 1], [0, 1], 0, [() => GuardrailContentBlockList, 0], 0]
|
|
23738
23752
|
];
|
|
23739
23753
|
var ApplyGuardrailResponse = [
|
|
@@ -23963,7 +23977,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
23963
23977
|
n04,
|
|
23964
23978
|
_GA,
|
|
23965
23979
|
0,
|
|
23966
|
-
[_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM],
|
|
23980
|
+
[_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM, _aGD],
|
|
23967
23981
|
[
|
|
23968
23982
|
() => GuardrailTopicPolicyAssessment,
|
|
23969
23983
|
() => GuardrailContentPolicyAssessment,
|
|
@@ -23971,7 +23985,8 @@ var require_dist_cjs66 = __commonJS({
|
|
|
23971
23985
|
() => GuardrailSensitiveInformationPolicyAssessment,
|
|
23972
23986
|
() => GuardrailContextualGroundingPolicyAssessment,
|
|
23973
23987
|
[() => GuardrailAutomatedReasoningPolicyAssessment, 0],
|
|
23974
|
-
() => GuardrailInvocationMetrics
|
|
23988
|
+
() => GuardrailInvocationMetrics,
|
|
23989
|
+
() => AppliedGuardrailDetails
|
|
23975
23990
|
]
|
|
23976
23991
|
];
|
|
23977
23992
|
var GuardrailAutomatedReasoningImpossibleFinding = [
|
|
@@ -24103,7 +24118,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
24103
24118
|
[() => GuardrailAutomatedReasoningLogicWarning, 0]
|
|
24104
24119
|
]
|
|
24105
24120
|
];
|
|
24106
|
-
var GuardrailConfiguration = [3, n04, _GC, 0, [
|
|
24121
|
+
var GuardrailConfiguration = [3, n04, _GC, 0, [_gIu, _gV, _tr], [0, 0, 0]];
|
|
24107
24122
|
var GuardrailContentFilter = [3, n04, _GCF, 0, [_t, _conf, _fS, _a16, _de], [0, 0, 0, 0, 2]];
|
|
24108
24123
|
var GuardrailContentPolicyAssessment = [
|
|
24109
24124
|
3,
|
|
@@ -24176,7 +24191,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
24176
24191
|
[_pE, _re],
|
|
24177
24192
|
[() => GuardrailPiiEntityFilterList, () => GuardrailRegexFilterList]
|
|
24178
24193
|
];
|
|
24179
|
-
var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [
|
|
24194
|
+
var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [_gIu, _gV, _tr, _sPM], [0, 0, 0, 0]];
|
|
24180
24195
|
var GuardrailTextBlock = [3, n04, _GTB, 0, [_te, _q], [0, 64 | 0]];
|
|
24181
24196
|
var GuardrailTextCharactersCoverage = [3, n04, _GTCC, 0, [_gu, _to], [1, 1]];
|
|
24182
24197
|
var GuardrailTopic = [3, n04, _GT, 0, [_n, _t, _a16, _de], [0, 0, 0, 2]];
|
|
@@ -24231,7 +24246,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
24231
24246
|
n04,
|
|
24232
24247
|
_IMR,
|
|
24233
24248
|
0,
|
|
24234
|
-
[_bo, _cT, _ac, _mI, _tr,
|
|
24249
|
+
[_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
|
|
24235
24250
|
[
|
|
24236
24251
|
[() => Body, 16],
|
|
24237
24252
|
[
|
|
@@ -24332,7 +24347,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
24332
24347
|
n04,
|
|
24333
24348
|
_IMWRSR,
|
|
24334
24349
|
0,
|
|
24335
|
-
[_bo, _cT, _ac, _mI, _tr,
|
|
24350
|
+
[_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
|
|
24336
24351
|
[
|
|
24337
24352
|
[() => Body, 16],
|
|
24338
24353
|
[
|
|
@@ -25151,6 +25166,15 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25151
25166
|
GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
|
|
25152
25167
|
NONE: "NONE"
|
|
25153
25168
|
};
|
|
25169
|
+
var GuardrailOrigin = {
|
|
25170
|
+
ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED",
|
|
25171
|
+
ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED",
|
|
25172
|
+
REQUEST: "REQUEST"
|
|
25173
|
+
};
|
|
25174
|
+
var GuardrailOwnership = {
|
|
25175
|
+
CROSS_ACCOUNT: "CROSS_ACCOUNT",
|
|
25176
|
+
SELF: "SELF"
|
|
25177
|
+
};
|
|
25154
25178
|
var GuardrailAutomatedReasoningLogicWarningType = {
|
|
25155
25179
|
ALWAYS_FALSE: "ALWAYS_FALSE",
|
|
25156
25180
|
ALWAYS_TRUE: "ALWAYS_TRUE"
|
|
@@ -25362,7 +25386,9 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25362
25386
|
exports2.GuardrailConverseImageFormat = GuardrailConverseImageFormat;
|
|
25363
25387
|
exports2.GuardrailImageFormat = GuardrailImageFormat;
|
|
25364
25388
|
exports2.GuardrailManagedWordType = GuardrailManagedWordType;
|
|
25389
|
+
exports2.GuardrailOrigin = GuardrailOrigin;
|
|
25365
25390
|
exports2.GuardrailOutputScope = GuardrailOutputScope;
|
|
25391
|
+
exports2.GuardrailOwnership = GuardrailOwnership;
|
|
25366
25392
|
exports2.GuardrailPiiEntityType = GuardrailPiiEntityType;
|
|
25367
25393
|
exports2.GuardrailSensitiveInformationPolicyAction = GuardrailSensitiveInformationPolicyAction;
|
|
25368
25394
|
exports2.GuardrailStreamProcessingMode = GuardrailStreamProcessingMode;
|
|
@@ -43363,17 +43389,30 @@ var init_xmlParsingUtils = __esm({
|
|
|
43363
43389
|
|
|
43364
43390
|
// src/agent/tools.js
|
|
43365
43391
|
function createTools(configOptions) {
|
|
43366
|
-
const tools2 = {
|
|
43367
|
-
|
|
43368
|
-
|
|
43369
|
-
|
|
43370
|
-
|
|
43371
|
-
|
|
43372
|
-
|
|
43392
|
+
const tools2 = {};
|
|
43393
|
+
const isToolAllowed = configOptions.isToolAllowed || ((toolName) => {
|
|
43394
|
+
if (!configOptions.allowedTools) return true;
|
|
43395
|
+
return configOptions.allowedTools.isEnabled(toolName);
|
|
43396
|
+
});
|
|
43397
|
+
if (isToolAllowed("search")) {
|
|
43398
|
+
tools2.searchTool = searchTool(configOptions);
|
|
43399
|
+
}
|
|
43400
|
+
if (isToolAllowed("query")) {
|
|
43401
|
+
tools2.queryTool = queryTool(configOptions);
|
|
43402
|
+
}
|
|
43403
|
+
if (isToolAllowed("extract")) {
|
|
43404
|
+
tools2.extractTool = extractTool(configOptions);
|
|
43405
|
+
}
|
|
43406
|
+
if (configOptions.enableDelegate && isToolAllowed("delegate")) {
|
|
43407
|
+
tools2.delegateTool = delegateTool(configOptions);
|
|
43408
|
+
}
|
|
43409
|
+
if (configOptions.enableBash && isToolAllowed("bash")) {
|
|
43373
43410
|
tools2.bashTool = bashTool(configOptions);
|
|
43374
43411
|
}
|
|
43375
|
-
if (configOptions.allowEdit) {
|
|
43412
|
+
if (configOptions.allowEdit && isToolAllowed("edit")) {
|
|
43376
43413
|
tools2.editTool = editTool(configOptions);
|
|
43414
|
+
}
|
|
43415
|
+
if (configOptions.allowEdit && isToolAllowed("create")) {
|
|
43377
43416
|
tools2.createTool = createTool(configOptions);
|
|
43378
43417
|
}
|
|
43379
43418
|
return tools2;
|
|
@@ -85077,25 +85116,43 @@ var init_ProbeAgent = __esm({
|
|
|
85077
85116
|
* Initialize tools with configuration
|
|
85078
85117
|
*/
|
|
85079
85118
|
initializeTools() {
|
|
85119
|
+
const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
|
|
85080
85120
|
const configOptions = {
|
|
85081
85121
|
sessionId: this.sessionId,
|
|
85082
85122
|
debug: this.debug,
|
|
85083
85123
|
defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
|
|
85084
85124
|
allowedFolders: this.allowedFolders,
|
|
85085
85125
|
outline: this.outline,
|
|
85126
|
+
allowEdit: this.allowEdit,
|
|
85127
|
+
enableDelegate: this.enableDelegate,
|
|
85086
85128
|
enableBash: this.enableBash,
|
|
85087
|
-
bashConfig: this.bashConfig
|
|
85129
|
+
bashConfig: this.bashConfig,
|
|
85130
|
+
allowedTools: this.allowedTools,
|
|
85131
|
+
isToolAllowed
|
|
85088
85132
|
};
|
|
85089
85133
|
const baseTools = createTools(configOptions);
|
|
85090
85134
|
const wrappedTools = createWrappedTools(baseTools);
|
|
85091
|
-
this.toolImplementations = {
|
|
85092
|
-
|
|
85093
|
-
|
|
85094
|
-
|
|
85095
|
-
|
|
85096
|
-
|
|
85097
|
-
|
|
85098
|
-
|
|
85135
|
+
this.toolImplementations = {};
|
|
85136
|
+
if (wrappedTools.searchToolInstance && isToolAllowed("search")) {
|
|
85137
|
+
this.toolImplementations.search = wrappedTools.searchToolInstance;
|
|
85138
|
+
}
|
|
85139
|
+
if (wrappedTools.queryToolInstance && isToolAllowed("query")) {
|
|
85140
|
+
this.toolImplementations.query = wrappedTools.queryToolInstance;
|
|
85141
|
+
}
|
|
85142
|
+
if (wrappedTools.extractToolInstance && isToolAllowed("extract")) {
|
|
85143
|
+
this.toolImplementations.extract = wrappedTools.extractToolInstance;
|
|
85144
|
+
}
|
|
85145
|
+
if (this.enableDelegate && wrappedTools.delegateToolInstance && isToolAllowed("delegate")) {
|
|
85146
|
+
this.toolImplementations.delegate = wrappedTools.delegateToolInstance;
|
|
85147
|
+
}
|
|
85148
|
+
if (isToolAllowed("listFiles")) {
|
|
85149
|
+
this.toolImplementations.listFiles = listFilesToolInstance;
|
|
85150
|
+
}
|
|
85151
|
+
if (isToolAllowed("searchFiles")) {
|
|
85152
|
+
this.toolImplementations.searchFiles = searchFilesToolInstance;
|
|
85153
|
+
}
|
|
85154
|
+
if (isToolAllowed("readImage")) {
|
|
85155
|
+
this.toolImplementations.readImage = {
|
|
85099
85156
|
execute: async (params) => {
|
|
85100
85157
|
const imagePath = params.path;
|
|
85101
85158
|
if (!imagePath) {
|
|
@@ -85107,16 +85164,16 @@ var init_ProbeAgent = __esm({
|
|
|
85107
85164
|
}
|
|
85108
85165
|
return `Image loaded successfully: ${imagePath}. The image is now available for analysis in the conversation.`;
|
|
85109
85166
|
}
|
|
85110
|
-
}
|
|
85111
|
-
}
|
|
85112
|
-
if (this.enableBash && wrappedTools.bashToolInstance) {
|
|
85167
|
+
};
|
|
85168
|
+
}
|
|
85169
|
+
if (this.enableBash && wrappedTools.bashToolInstance && isToolAllowed("bash")) {
|
|
85113
85170
|
this.toolImplementations.bash = wrappedTools.bashToolInstance;
|
|
85114
85171
|
}
|
|
85115
85172
|
if (this.allowEdit) {
|
|
85116
|
-
if (wrappedTools.editToolInstance) {
|
|
85173
|
+
if (wrappedTools.editToolInstance && isToolAllowed("edit")) {
|
|
85117
85174
|
this.toolImplementations.edit = wrappedTools.editToolInstance;
|
|
85118
85175
|
}
|
|
85119
|
-
if (wrappedTools.createToolInstance) {
|
|
85176
|
+
if (wrappedTools.createToolInstance && isToolAllowed("create")) {
|
|
85120
85177
|
this.toolImplementations.create = wrappedTools.createToolInstance;
|
|
85121
85178
|
}
|
|
85122
85179
|
}
|
package/cjs/index.cjs
CHANGED
|
@@ -18445,7 +18445,7 @@ var require_package2 = __commonJS({
|
|
|
18445
18445
|
module2.exports = {
|
|
18446
18446
|
name: "@aws-sdk/client-bedrock-runtime",
|
|
18447
18447
|
description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
|
|
18448
|
-
version: "3.
|
|
18448
|
+
version: "3.938.0",
|
|
18449
18449
|
scripts: {
|
|
18450
18450
|
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
18451
18451
|
"build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
|
|
@@ -24718,6 +24718,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
24718
24718
|
var _A2 = "Accept";
|
|
24719
24719
|
var _ADE3 = "AccessDeniedException";
|
|
24720
24720
|
var _AG = "ApplyGuardrail";
|
|
24721
|
+
var _AGD = "AppliedGuardrailDetails";
|
|
24721
24722
|
var _AGR = "ApplyGuardrailRequest";
|
|
24722
24723
|
var _AGRp = "ApplyGuardrailResponse";
|
|
24723
24724
|
var _AIM = "AsyncInvokeMessage";
|
|
@@ -24933,6 +24934,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
24933
24934
|
var _XABST = "X-Amzn-Bedrock-Service-Tier";
|
|
24934
24935
|
var _XABT = "X-Amzn-Bedrock-Trace";
|
|
24935
24936
|
var _a16 = "action";
|
|
24937
|
+
var _aGD = "appliedGuardrailDetails";
|
|
24936
24938
|
var _aIS = "asyncInvokeSummaries";
|
|
24937
24939
|
var _aMRF = "additionalModelRequestFields";
|
|
24938
24940
|
var _aMRFP = "additionalModelResponseFieldPaths";
|
|
@@ -24996,10 +24998,14 @@ var require_dist_cjs66 = __commonJS({
|
|
|
24996
24998
|
var _fi = "findings";
|
|
24997
24999
|
var _fil = "filters";
|
|
24998
25000
|
var _g = "guardrail";
|
|
25001
|
+
var _gA = "guardrailArn";
|
|
24999
25002
|
var _gC = "guardrailCoverage";
|
|
25000
25003
|
var _gCu = "guardrailConfig";
|
|
25001
25004
|
var _gCua = "guardContent";
|
|
25002
|
-
var _gI = "
|
|
25005
|
+
var _gI = "guardrailId";
|
|
25006
|
+
var _gIu = "guardrailIdentifier";
|
|
25007
|
+
var _gO = "guardrailOrigin";
|
|
25008
|
+
var _gOu = "guardrailOwnership";
|
|
25003
25009
|
var _gPL = "guardrailProcessingLatency";
|
|
25004
25010
|
var _gV = "guardrailVersion";
|
|
25005
25011
|
var _gu = "guarded";
|
|
@@ -25170,12 +25176,20 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25170
25176
|
];
|
|
25171
25177
|
schema.TypeRegistry.for(n04).registerError(AccessDeniedException5, AccessDeniedException$1);
|
|
25172
25178
|
var AnyToolChoice = [3, n04, _ATC, 0, [], []];
|
|
25179
|
+
var AppliedGuardrailDetails = [
|
|
25180
|
+
3,
|
|
25181
|
+
n04,
|
|
25182
|
+
_AGD,
|
|
25183
|
+
0,
|
|
25184
|
+
[_gI, _gV, _gA, _gO, _gOu],
|
|
25185
|
+
[0, 0, 0, 64 | 0, 0]
|
|
25186
|
+
];
|
|
25173
25187
|
var ApplyGuardrailRequest = [
|
|
25174
25188
|
3,
|
|
25175
25189
|
n04,
|
|
25176
25190
|
_AGR,
|
|
25177
25191
|
0,
|
|
25178
|
-
[
|
|
25192
|
+
[_gIu, _gV, _s4, _co3, _oS],
|
|
25179
25193
|
[[0, 1], [0, 1], 0, [() => GuardrailContentBlockList, 0], 0]
|
|
25180
25194
|
];
|
|
25181
25195
|
var ApplyGuardrailResponse = [
|
|
@@ -25405,7 +25419,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25405
25419
|
n04,
|
|
25406
25420
|
_GA,
|
|
25407
25421
|
0,
|
|
25408
|
-
[_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM],
|
|
25422
|
+
[_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM, _aGD],
|
|
25409
25423
|
[
|
|
25410
25424
|
() => GuardrailTopicPolicyAssessment,
|
|
25411
25425
|
() => GuardrailContentPolicyAssessment,
|
|
@@ -25413,7 +25427,8 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25413
25427
|
() => GuardrailSensitiveInformationPolicyAssessment,
|
|
25414
25428
|
() => GuardrailContextualGroundingPolicyAssessment,
|
|
25415
25429
|
[() => GuardrailAutomatedReasoningPolicyAssessment, 0],
|
|
25416
|
-
() => GuardrailInvocationMetrics
|
|
25430
|
+
() => GuardrailInvocationMetrics,
|
|
25431
|
+
() => AppliedGuardrailDetails
|
|
25417
25432
|
]
|
|
25418
25433
|
];
|
|
25419
25434
|
var GuardrailAutomatedReasoningImpossibleFinding = [
|
|
@@ -25545,7 +25560,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25545
25560
|
[() => GuardrailAutomatedReasoningLogicWarning, 0]
|
|
25546
25561
|
]
|
|
25547
25562
|
];
|
|
25548
|
-
var GuardrailConfiguration = [3, n04, _GC, 0, [
|
|
25563
|
+
var GuardrailConfiguration = [3, n04, _GC, 0, [_gIu, _gV, _tr], [0, 0, 0]];
|
|
25549
25564
|
var GuardrailContentFilter = [3, n04, _GCF, 0, [_t, _conf, _fS, _a16, _de], [0, 0, 0, 0, 2]];
|
|
25550
25565
|
var GuardrailContentPolicyAssessment = [
|
|
25551
25566
|
3,
|
|
@@ -25618,7 +25633,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25618
25633
|
[_pE, _re],
|
|
25619
25634
|
[() => GuardrailPiiEntityFilterList, () => GuardrailRegexFilterList]
|
|
25620
25635
|
];
|
|
25621
|
-
var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [
|
|
25636
|
+
var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [_gIu, _gV, _tr, _sPM], [0, 0, 0, 0]];
|
|
25622
25637
|
var GuardrailTextBlock = [3, n04, _GTB, 0, [_te, _q], [0, 64 | 0]];
|
|
25623
25638
|
var GuardrailTextCharactersCoverage = [3, n04, _GTCC, 0, [_gu, _to], [1, 1]];
|
|
25624
25639
|
var GuardrailTopic = [3, n04, _GT, 0, [_n, _t, _a16, _de], [0, 0, 0, 2]];
|
|
@@ -25673,7 +25688,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25673
25688
|
n04,
|
|
25674
25689
|
_IMR,
|
|
25675
25690
|
0,
|
|
25676
|
-
[_bo, _cT, _ac, _mI, _tr,
|
|
25691
|
+
[_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
|
|
25677
25692
|
[
|
|
25678
25693
|
[() => Body, 16],
|
|
25679
25694
|
[
|
|
@@ -25774,7 +25789,7 @@ var require_dist_cjs66 = __commonJS({
|
|
|
25774
25789
|
n04,
|
|
25775
25790
|
_IMWRSR,
|
|
25776
25791
|
0,
|
|
25777
|
-
[_bo, _cT, _ac, _mI, _tr,
|
|
25792
|
+
[_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
|
|
25778
25793
|
[
|
|
25779
25794
|
[() => Body, 16],
|
|
25780
25795
|
[
|
|
@@ -26593,6 +26608,15 @@ var require_dist_cjs66 = __commonJS({
|
|
|
26593
26608
|
GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
|
|
26594
26609
|
NONE: "NONE"
|
|
26595
26610
|
};
|
|
26611
|
+
var GuardrailOrigin = {
|
|
26612
|
+
ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED",
|
|
26613
|
+
ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED",
|
|
26614
|
+
REQUEST: "REQUEST"
|
|
26615
|
+
};
|
|
26616
|
+
var GuardrailOwnership = {
|
|
26617
|
+
CROSS_ACCOUNT: "CROSS_ACCOUNT",
|
|
26618
|
+
SELF: "SELF"
|
|
26619
|
+
};
|
|
26596
26620
|
var GuardrailAutomatedReasoningLogicWarningType = {
|
|
26597
26621
|
ALWAYS_FALSE: "ALWAYS_FALSE",
|
|
26598
26622
|
ALWAYS_TRUE: "ALWAYS_TRUE"
|
|
@@ -26804,7 +26828,9 @@ var require_dist_cjs66 = __commonJS({
|
|
|
26804
26828
|
exports2.GuardrailConverseImageFormat = GuardrailConverseImageFormat;
|
|
26805
26829
|
exports2.GuardrailImageFormat = GuardrailImageFormat;
|
|
26806
26830
|
exports2.GuardrailManagedWordType = GuardrailManagedWordType;
|
|
26831
|
+
exports2.GuardrailOrigin = GuardrailOrigin;
|
|
26807
26832
|
exports2.GuardrailOutputScope = GuardrailOutputScope;
|
|
26833
|
+
exports2.GuardrailOwnership = GuardrailOwnership;
|
|
26808
26834
|
exports2.GuardrailPiiEntityType = GuardrailPiiEntityType;
|
|
26809
26835
|
exports2.GuardrailSensitiveInformationPolicyAction = GuardrailSensitiveInformationPolicyAction;
|
|
26810
26836
|
exports2.GuardrailStreamProcessingMode = GuardrailStreamProcessingMode;
|
|
@@ -29596,17 +29622,30 @@ var init_xmlParsingUtils = __esm({
|
|
|
29596
29622
|
|
|
29597
29623
|
// src/agent/tools.js
|
|
29598
29624
|
function createTools(configOptions) {
|
|
29599
|
-
const tools2 = {
|
|
29600
|
-
|
|
29601
|
-
|
|
29602
|
-
|
|
29603
|
-
|
|
29604
|
-
|
|
29605
|
-
|
|
29625
|
+
const tools2 = {};
|
|
29626
|
+
const isToolAllowed = configOptions.isToolAllowed || ((toolName) => {
|
|
29627
|
+
if (!configOptions.allowedTools) return true;
|
|
29628
|
+
return configOptions.allowedTools.isEnabled(toolName);
|
|
29629
|
+
});
|
|
29630
|
+
if (isToolAllowed("search")) {
|
|
29631
|
+
tools2.searchTool = searchTool(configOptions);
|
|
29632
|
+
}
|
|
29633
|
+
if (isToolAllowed("query")) {
|
|
29634
|
+
tools2.queryTool = queryTool(configOptions);
|
|
29635
|
+
}
|
|
29636
|
+
if (isToolAllowed("extract")) {
|
|
29637
|
+
tools2.extractTool = extractTool(configOptions);
|
|
29638
|
+
}
|
|
29639
|
+
if (configOptions.enableDelegate && isToolAllowed("delegate")) {
|
|
29640
|
+
tools2.delegateTool = delegateTool(configOptions);
|
|
29641
|
+
}
|
|
29642
|
+
if (configOptions.enableBash && isToolAllowed("bash")) {
|
|
29606
29643
|
tools2.bashTool = bashTool(configOptions);
|
|
29607
29644
|
}
|
|
29608
|
-
if (configOptions.allowEdit) {
|
|
29645
|
+
if (configOptions.allowEdit && isToolAllowed("edit")) {
|
|
29609
29646
|
tools2.editTool = editTool(configOptions);
|
|
29647
|
+
}
|
|
29648
|
+
if (configOptions.allowEdit && isToolAllowed("create")) {
|
|
29610
29649
|
tools2.createTool = createTool(configOptions);
|
|
29611
29650
|
}
|
|
29612
29651
|
return tools2;
|
|
@@ -82819,25 +82858,43 @@ var init_ProbeAgent = __esm({
|
|
|
82819
82858
|
* Initialize tools with configuration
|
|
82820
82859
|
*/
|
|
82821
82860
|
initializeTools() {
|
|
82861
|
+
const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
|
|
82822
82862
|
const configOptions = {
|
|
82823
82863
|
sessionId: this.sessionId,
|
|
82824
82864
|
debug: this.debug,
|
|
82825
82865
|
defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
|
|
82826
82866
|
allowedFolders: this.allowedFolders,
|
|
82827
82867
|
outline: this.outline,
|
|
82868
|
+
allowEdit: this.allowEdit,
|
|
82869
|
+
enableDelegate: this.enableDelegate,
|
|
82828
82870
|
enableBash: this.enableBash,
|
|
82829
|
-
bashConfig: this.bashConfig
|
|
82871
|
+
bashConfig: this.bashConfig,
|
|
82872
|
+
allowedTools: this.allowedTools,
|
|
82873
|
+
isToolAllowed
|
|
82830
82874
|
};
|
|
82831
82875
|
const baseTools = createTools(configOptions);
|
|
82832
82876
|
const wrappedTools = createWrappedTools(baseTools);
|
|
82833
|
-
this.toolImplementations = {
|
|
82834
|
-
|
|
82835
|
-
|
|
82836
|
-
|
|
82837
|
-
|
|
82838
|
-
|
|
82839
|
-
|
|
82840
|
-
|
|
82877
|
+
this.toolImplementations = {};
|
|
82878
|
+
if (wrappedTools.searchToolInstance && isToolAllowed("search")) {
|
|
82879
|
+
this.toolImplementations.search = wrappedTools.searchToolInstance;
|
|
82880
|
+
}
|
|
82881
|
+
if (wrappedTools.queryToolInstance && isToolAllowed("query")) {
|
|
82882
|
+
this.toolImplementations.query = wrappedTools.queryToolInstance;
|
|
82883
|
+
}
|
|
82884
|
+
if (wrappedTools.extractToolInstance && isToolAllowed("extract")) {
|
|
82885
|
+
this.toolImplementations.extract = wrappedTools.extractToolInstance;
|
|
82886
|
+
}
|
|
82887
|
+
if (this.enableDelegate && wrappedTools.delegateToolInstance && isToolAllowed("delegate")) {
|
|
82888
|
+
this.toolImplementations.delegate = wrappedTools.delegateToolInstance;
|
|
82889
|
+
}
|
|
82890
|
+
if (isToolAllowed("listFiles")) {
|
|
82891
|
+
this.toolImplementations.listFiles = listFilesToolInstance;
|
|
82892
|
+
}
|
|
82893
|
+
if (isToolAllowed("searchFiles")) {
|
|
82894
|
+
this.toolImplementations.searchFiles = searchFilesToolInstance;
|
|
82895
|
+
}
|
|
82896
|
+
if (isToolAllowed("readImage")) {
|
|
82897
|
+
this.toolImplementations.readImage = {
|
|
82841
82898
|
execute: async (params) => {
|
|
82842
82899
|
const imagePath = params.path;
|
|
82843
82900
|
if (!imagePath) {
|
|
@@ -82849,16 +82906,16 @@ var init_ProbeAgent = __esm({
|
|
|
82849
82906
|
}
|
|
82850
82907
|
return `Image loaded successfully: ${imagePath}. The image is now available for analysis in the conversation.`;
|
|
82851
82908
|
}
|
|
82852
|
-
}
|
|
82853
|
-
}
|
|
82854
|
-
if (this.enableBash && wrappedTools.bashToolInstance) {
|
|
82909
|
+
};
|
|
82910
|
+
}
|
|
82911
|
+
if (this.enableBash && wrappedTools.bashToolInstance && isToolAllowed("bash")) {
|
|
82855
82912
|
this.toolImplementations.bash = wrappedTools.bashToolInstance;
|
|
82856
82913
|
}
|
|
82857
82914
|
if (this.allowEdit) {
|
|
82858
|
-
if (wrappedTools.editToolInstance) {
|
|
82915
|
+
if (wrappedTools.editToolInstance && isToolAllowed("edit")) {
|
|
82859
82916
|
this.toolImplementations.edit = wrappedTools.editToolInstance;
|
|
82860
82917
|
}
|
|
82861
|
-
if (wrappedTools.createToolInstance) {
|
|
82918
|
+
if (wrappedTools.createToolInstance && isToolAllowed("create")) {
|
|
82862
82919
|
this.toolImplementations.create = wrappedTools.createToolInstance;
|
|
82863
82920
|
}
|
|
82864
82921
|
}
|
package/package.json
CHANGED
package/src/agent/ProbeAgent.js
CHANGED
|
@@ -420,14 +420,20 @@ export class ProbeAgent {
|
|
|
420
420
|
* Initialize tools with configuration
|
|
421
421
|
*/
|
|
422
422
|
initializeTools() {
|
|
423
|
+
const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
|
|
424
|
+
|
|
423
425
|
const configOptions = {
|
|
424
426
|
sessionId: this.sessionId,
|
|
425
427
|
debug: this.debug,
|
|
426
428
|
defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
|
|
427
429
|
allowedFolders: this.allowedFolders,
|
|
428
430
|
outline: this.outline,
|
|
431
|
+
allowEdit: this.allowEdit,
|
|
432
|
+
enableDelegate: this.enableDelegate,
|
|
429
433
|
enableBash: this.enableBash,
|
|
430
|
-
bashConfig: this.bashConfig
|
|
434
|
+
bashConfig: this.bashConfig,
|
|
435
|
+
allowedTools: this.allowedTools,
|
|
436
|
+
isToolAllowed
|
|
431
437
|
};
|
|
432
438
|
|
|
433
439
|
// Create base tools
|
|
@@ -436,15 +442,33 @@ export class ProbeAgent {
|
|
|
436
442
|
// Create wrapped tools with event emission
|
|
437
443
|
const wrappedTools = createWrappedTools(baseTools);
|
|
438
444
|
|
|
439
|
-
// Store tool instances for execution
|
|
440
|
-
this.toolImplementations = {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
445
|
+
// Store tool instances for execution (respect allowedTools + feature flags)
|
|
446
|
+
this.toolImplementations = {};
|
|
447
|
+
|
|
448
|
+
if (wrappedTools.searchToolInstance && isToolAllowed('search')) {
|
|
449
|
+
this.toolImplementations.search = wrappedTools.searchToolInstance;
|
|
450
|
+
}
|
|
451
|
+
if (wrappedTools.queryToolInstance && isToolAllowed('query')) {
|
|
452
|
+
this.toolImplementations.query = wrappedTools.queryToolInstance;
|
|
453
|
+
}
|
|
454
|
+
if (wrappedTools.extractToolInstance && isToolAllowed('extract')) {
|
|
455
|
+
this.toolImplementations.extract = wrappedTools.extractToolInstance;
|
|
456
|
+
}
|
|
457
|
+
if (this.enableDelegate && wrappedTools.delegateToolInstance && isToolAllowed('delegate')) {
|
|
458
|
+
this.toolImplementations.delegate = wrappedTools.delegateToolInstance;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
// File browsing tools
|
|
462
|
+
if (isToolAllowed('listFiles')) {
|
|
463
|
+
this.toolImplementations.listFiles = listFilesToolInstance;
|
|
464
|
+
}
|
|
465
|
+
if (isToolAllowed('searchFiles')) {
|
|
466
|
+
this.toolImplementations.searchFiles = searchFilesToolInstance;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
// Image loading tool
|
|
470
|
+
if (isToolAllowed('readImage')) {
|
|
471
|
+
this.toolImplementations.readImage = {
|
|
448
472
|
execute: async (params) => {
|
|
449
473
|
const imagePath = params.path;
|
|
450
474
|
if (!imagePath) {
|
|
@@ -460,20 +484,20 @@ export class ProbeAgent {
|
|
|
460
484
|
|
|
461
485
|
return `Image loaded successfully: ${imagePath}. The image is now available for analysis in the conversation.`;
|
|
462
486
|
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
487
|
+
};
|
|
488
|
+
}
|
|
465
489
|
|
|
466
|
-
// Add bash tool if enabled
|
|
467
|
-
if (this.enableBash && wrappedTools.bashToolInstance) {
|
|
490
|
+
// Add bash tool if enabled and allowed
|
|
491
|
+
if (this.enableBash && wrappedTools.bashToolInstance && isToolAllowed('bash')) {
|
|
468
492
|
this.toolImplementations.bash = wrappedTools.bashToolInstance;
|
|
469
493
|
}
|
|
470
494
|
|
|
471
|
-
// Add edit and create tools if enabled
|
|
495
|
+
// Add edit and create tools if enabled and allowed
|
|
472
496
|
if (this.allowEdit) {
|
|
473
|
-
if (wrappedTools.editToolInstance) {
|
|
497
|
+
if (wrappedTools.editToolInstance && isToolAllowed('edit')) {
|
|
474
498
|
this.toolImplementations.edit = wrappedTools.editToolInstance;
|
|
475
499
|
}
|
|
476
|
-
if (wrappedTools.createToolInstance) {
|
|
500
|
+
if (wrappedTools.createToolInstance && isToolAllowed('create')) {
|
|
477
501
|
this.toolImplementations.create = wrappedTools.createToolInstance;
|
|
478
502
|
}
|
|
479
503
|
}
|
package/src/agent/tools.js
CHANGED
|
@@ -31,21 +31,39 @@ import { processXmlWithThinkingAndRecovery } from './xmlParsingUtils.js';
|
|
|
31
31
|
|
|
32
32
|
// Create configured tool instances
|
|
33
33
|
export function createTools(configOptions) {
|
|
34
|
-
const tools = {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
const tools = {};
|
|
35
|
+
|
|
36
|
+
const isToolAllowed =
|
|
37
|
+
configOptions.isToolAllowed ||
|
|
38
|
+
((toolName) => {
|
|
39
|
+
if (!configOptions.allowedTools) return true;
|
|
40
|
+
return configOptions.allowedTools.isEnabled(toolName);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Core tools
|
|
44
|
+
if (isToolAllowed('search')) {
|
|
45
|
+
tools.searchTool = searchTool(configOptions);
|
|
46
|
+
}
|
|
47
|
+
if (isToolAllowed('query')) {
|
|
48
|
+
tools.queryTool = queryTool(configOptions);
|
|
49
|
+
}
|
|
50
|
+
if (isToolAllowed('extract')) {
|
|
51
|
+
tools.extractTool = extractTool(configOptions);
|
|
52
|
+
}
|
|
53
|
+
if (configOptions.enableDelegate && isToolAllowed('delegate')) {
|
|
54
|
+
tools.delegateTool = delegateTool(configOptions);
|
|
55
|
+
}
|
|
40
56
|
|
|
41
57
|
// Add bash tool if enabled
|
|
42
|
-
if (configOptions.enableBash) {
|
|
58
|
+
if (configOptions.enableBash && isToolAllowed('bash')) {
|
|
43
59
|
tools.bashTool = bashTool(configOptions);
|
|
44
60
|
}
|
|
45
61
|
|
|
46
62
|
// Add edit and create tools if enabled
|
|
47
|
-
if (configOptions.allowEdit) {
|
|
63
|
+
if (configOptions.allowEdit && isToolAllowed('edit')) {
|
|
48
64
|
tools.editTool = editTool(configOptions);
|
|
65
|
+
}
|
|
66
|
+
if (configOptions.allowEdit && isToolAllowed('create')) {
|
|
49
67
|
tools.createTool = createTool(configOptions);
|
|
50
68
|
}
|
|
51
69
|
|
|
@@ -199,4 +217,3 @@ export function parseXmlToolCallWithThinking(xmlString, validTools) {
|
|
|
199
217
|
// Otherwise, use the original parseXmlToolCall function to parse the cleaned XML string
|
|
200
218
|
return parseXmlToolCall(cleanedXmlString, validTools);
|
|
201
219
|
}
|
|
202
|
-
|