@probelabs/probe 0.6.0-rc168 → 0.6.0-rc170

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/cjs/index.cjs CHANGED
@@ -12522,6 +12522,50 @@ var init_ConfigurableSerdeContext = __esm({
12522
12522
  }
12523
12523
  });
12524
12524
 
12525
+ // node_modules/@aws-sdk/core/dist-es/submodules/protocols/structIterator.js
12526
+ function* serializingStructIterator(ns, sourceObject) {
12527
+ if (ns.isUnitSchema()) {
12528
+ return;
12529
+ }
12530
+ const struct2 = ns.getSchema();
12531
+ for (let i4 = 0; i4 < struct2[4].length; ++i4) {
12532
+ const key = struct2[4][i4];
12533
+ const memberNs = new NormalizedSchema([struct2[5][i4], 0], key);
12534
+ if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
12535
+ continue;
12536
+ }
12537
+ yield [key, memberNs];
12538
+ }
12539
+ }
12540
+ function* deserializingStructIterator(ns, sourceObject, nameTrait) {
12541
+ if (ns.isUnitSchema()) {
12542
+ return;
12543
+ }
12544
+ const struct2 = ns.getSchema();
12545
+ let keysRemaining = Object.keys(sourceObject).length;
12546
+ for (let i4 = 0; i4 < struct2[4].length; ++i4) {
12547
+ if (keysRemaining === 0) {
12548
+ break;
12549
+ }
12550
+ const key = struct2[4][i4];
12551
+ const memberNs = new NormalizedSchema([struct2[5][i4], 0], key);
12552
+ let serializationKey = key;
12553
+ if (nameTrait) {
12554
+ serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
12555
+ }
12556
+ if (!(serializationKey in sourceObject)) {
12557
+ continue;
12558
+ }
12559
+ yield [key, memberNs];
12560
+ keysRemaining -= 1;
12561
+ }
12562
+ }
12563
+ var init_structIterator = __esm({
12564
+ "node_modules/@aws-sdk/core/dist-es/submodules/protocols/structIterator.js"() {
12565
+ init_schema();
12566
+ }
12567
+ });
12568
+
12525
12569
  // node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
12526
12570
  function jsonReviver(key, value, context) {
12527
12571
  if (context?.source) {
@@ -12624,6 +12668,7 @@ var init_JsonShapeDeserializer = __esm({
12624
12668
  init_serde();
12625
12669
  import_util_base644 = __toESM(require_dist_cjs12());
12626
12670
  init_ConfigurableSerdeContext();
12671
+ init_structIterator();
12627
12672
  init_jsonReviver();
12628
12673
  init_parseJsonBody();
12629
12674
  JsonShapeDeserializer = class extends SerdeContextConfig {
@@ -12663,7 +12708,7 @@ var init_JsonShapeDeserializer = __esm({
12663
12708
  return out;
12664
12709
  } else if (ns.isStructSchema() && isObject2) {
12665
12710
  const out = {};
12666
- for (const [memberName, memberSchema] of ns.structIterator()) {
12711
+ for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
12667
12712
  const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
12668
12713
  const deserializedValue = this._read(memberSchema, value[fromKey]);
12669
12714
  if (deserializedValue != null) {
@@ -12802,6 +12847,7 @@ var init_JsonShapeSerializer = __esm({
12802
12847
  init_serde();
12803
12848
  import_util_base645 = __toESM(require_dist_cjs12());
12804
12849
  init_ConfigurableSerdeContext();
12850
+ init_structIterator();
12805
12851
  init_jsonReplacer();
12806
12852
  JsonShapeSerializer = class extends SerdeContextConfig {
12807
12853
  settings;
@@ -12855,10 +12901,10 @@ var init_JsonShapeSerializer = __esm({
12855
12901
  return out;
12856
12902
  } else if (ns.isStructSchema() && isObject2) {
12857
12903
  const out = {};
12858
- for (const [memberName, memberSchema] of ns.structIterator()) {
12859
- const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
12904
+ for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
12860
12905
  const serializableValue = this._write(memberSchema, value[memberName], ns);
12861
12906
  if (serializableValue !== void 0) {
12907
+ const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
12862
12908
  out[targetKey] = serializableValue;
12863
12909
  }
12864
12910
  }
@@ -14275,6 +14321,7 @@ var init_QueryShapeSerializer = __esm({
14275
14321
  import_smithy_client5 = __toESM(require_dist_cjs27());
14276
14322
  import_util_base646 = __toESM(require_dist_cjs12());
14277
14323
  init_ConfigurableSerdeContext();
14324
+ init_structIterator();
14278
14325
  QueryShapeSerializer = class extends SerdeContextConfig {
14279
14326
  settings;
14280
14327
  buffer;
@@ -14374,7 +14421,7 @@ var init_QueryShapeSerializer = __esm({
14374
14421
  }
14375
14422
  } else if (ns.isStructSchema()) {
14376
14423
  if (value && typeof value === "object") {
14377
- for (const [memberName, member2] of ns.structIterator()) {
14424
+ for (const [memberName, member2] of serializingStructIterator(ns, value)) {
14378
14425
  if (value[memberName] == null && !member2.isIdempotencyToken()) {
14379
14426
  continue;
14380
14427
  }
@@ -14650,6 +14697,7 @@ var init_XmlShapeSerializer = __esm({
14650
14697
  import_smithy_client7 = __toESM(require_dist_cjs27());
14651
14698
  import_util_base647 = __toESM(require_dist_cjs12());
14652
14699
  init_ConfigurableSerdeContext();
14700
+ init_structIterator();
14653
14701
  XmlShapeSerializer = class extends SerdeContextConfig {
14654
14702
  settings;
14655
14703
  stringBuffer;
@@ -14701,7 +14749,7 @@ var init_XmlShapeSerializer = __esm({
14701
14749
  }
14702
14750
  const structXmlNode = import_xml_builder3.XmlNode.of(name14);
14703
14751
  const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
14704
- for (const [memberName, memberSchema] of ns.structIterator()) {
14752
+ for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
14705
14753
  const val = value[memberName];
14706
14754
  if (val != null || memberSchema.isIdempotencyToken()) {
14707
14755
  if (memberSchema.getMergedTraits().xmlAttribute) {
@@ -18445,7 +18493,7 @@ var require_package2 = __commonJS({
18445
18493
  module2.exports = {
18446
18494
  name: "@aws-sdk/client-bedrock-runtime",
18447
18495
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
18448
- version: "3.936.0",
18496
+ version: "3.940.0",
18449
18497
  scripts: {
18450
18498
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
18451
18499
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -18464,21 +18512,21 @@ var require_package2 = __commonJS({
18464
18512
  dependencies: {
18465
18513
  "@aws-crypto/sha256-browser": "5.2.0",
18466
18514
  "@aws-crypto/sha256-js": "5.2.0",
18467
- "@aws-sdk/core": "3.936.0",
18468
- "@aws-sdk/credential-provider-node": "3.936.0",
18515
+ "@aws-sdk/core": "3.940.0",
18516
+ "@aws-sdk/credential-provider-node": "3.940.0",
18469
18517
  "@aws-sdk/eventstream-handler-node": "3.936.0",
18470
18518
  "@aws-sdk/middleware-eventstream": "3.936.0",
18471
18519
  "@aws-sdk/middleware-host-header": "3.936.0",
18472
18520
  "@aws-sdk/middleware-logger": "3.936.0",
18473
18521
  "@aws-sdk/middleware-recursion-detection": "3.936.0",
18474
- "@aws-sdk/middleware-user-agent": "3.936.0",
18522
+ "@aws-sdk/middleware-user-agent": "3.940.0",
18475
18523
  "@aws-sdk/middleware-websocket": "3.936.0",
18476
18524
  "@aws-sdk/region-config-resolver": "3.936.0",
18477
- "@aws-sdk/token-providers": "3.936.0",
18525
+ "@aws-sdk/token-providers": "3.940.0",
18478
18526
  "@aws-sdk/types": "3.936.0",
18479
18527
  "@aws-sdk/util-endpoints": "3.936.0",
18480
18528
  "@aws-sdk/util-user-agent-browser": "3.936.0",
18481
- "@aws-sdk/util-user-agent-node": "3.936.0",
18529
+ "@aws-sdk/util-user-agent-node": "3.940.0",
18482
18530
  "@smithy/config-resolver": "^4.4.3",
18483
18531
  "@smithy/core": "^3.18.5",
18484
18532
  "@smithy/eventstream-serde-browser": "^4.2.5",
@@ -19225,7 +19273,7 @@ var init_package = __esm({
19225
19273
  "node_modules/@aws-sdk/nested-clients/package.json"() {
19226
19274
  package_default = {
19227
19275
  name: "@aws-sdk/nested-clients",
19228
- version: "3.936.0",
19276
+ version: "3.940.0",
19229
19277
  description: "Nested clients for AWS SDK packages.",
19230
19278
  main: "./dist-cjs/index.js",
19231
19279
  module: "./dist-es/index.js",
@@ -19254,16 +19302,16 @@ var init_package = __esm({
19254
19302
  dependencies: {
19255
19303
  "@aws-crypto/sha256-browser": "5.2.0",
19256
19304
  "@aws-crypto/sha256-js": "5.2.0",
19257
- "@aws-sdk/core": "3.936.0",
19305
+ "@aws-sdk/core": "3.940.0",
19258
19306
  "@aws-sdk/middleware-host-header": "3.936.0",
19259
19307
  "@aws-sdk/middleware-logger": "3.936.0",
19260
19308
  "@aws-sdk/middleware-recursion-detection": "3.936.0",
19261
- "@aws-sdk/middleware-user-agent": "3.936.0",
19309
+ "@aws-sdk/middleware-user-agent": "3.940.0",
19262
19310
  "@aws-sdk/region-config-resolver": "3.936.0",
19263
19311
  "@aws-sdk/types": "3.936.0",
19264
19312
  "@aws-sdk/util-endpoints": "3.936.0",
19265
19313
  "@aws-sdk/util-user-agent-browser": "3.936.0",
19266
- "@aws-sdk/util-user-agent-node": "3.936.0",
19314
+ "@aws-sdk/util-user-agent-node": "3.940.0",
19267
19315
  "@smithy/config-resolver": "^4.4.3",
19268
19316
  "@smithy/core": "^3.18.5",
19269
19317
  "@smithy/fetch-http-handler": "^5.3.6",
@@ -20655,7 +20703,7 @@ var require_package3 = __commonJS({
20655
20703
  module2.exports = {
20656
20704
  name: "@aws-sdk/client-sso",
20657
20705
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
20658
- version: "3.936.0",
20706
+ version: "3.940.0",
20659
20707
  scripts: {
20660
20708
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
20661
20709
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -20674,16 +20722,16 @@ var require_package3 = __commonJS({
20674
20722
  dependencies: {
20675
20723
  "@aws-crypto/sha256-browser": "5.2.0",
20676
20724
  "@aws-crypto/sha256-js": "5.2.0",
20677
- "@aws-sdk/core": "3.936.0",
20725
+ "@aws-sdk/core": "3.940.0",
20678
20726
  "@aws-sdk/middleware-host-header": "3.936.0",
20679
20727
  "@aws-sdk/middleware-logger": "3.936.0",
20680
20728
  "@aws-sdk/middleware-recursion-detection": "3.936.0",
20681
- "@aws-sdk/middleware-user-agent": "3.936.0",
20729
+ "@aws-sdk/middleware-user-agent": "3.940.0",
20682
20730
  "@aws-sdk/region-config-resolver": "3.936.0",
20683
20731
  "@aws-sdk/types": "3.936.0",
20684
20732
  "@aws-sdk/util-endpoints": "3.936.0",
20685
20733
  "@aws-sdk/util-user-agent-browser": "3.936.0",
20686
- "@aws-sdk/util-user-agent-node": "3.936.0",
20734
+ "@aws-sdk/util-user-agent-node": "3.940.0",
20687
20735
  "@smithy/config-resolver": "^4.4.3",
20688
20736
  "@smithy/core": "^3.18.5",
20689
20737
  "@smithy/fetch-http-handler": "^5.3.6",
@@ -24718,6 +24766,7 @@ var require_dist_cjs66 = __commonJS({
24718
24766
  var _A2 = "Accept";
24719
24767
  var _ADE3 = "AccessDeniedException";
24720
24768
  var _AG = "ApplyGuardrail";
24769
+ var _AGD = "AppliedGuardrailDetails";
24721
24770
  var _AGR = "ApplyGuardrailRequest";
24722
24771
  var _AGRp = "ApplyGuardrailResponse";
24723
24772
  var _AIM = "AsyncInvokeMessage";
@@ -24933,6 +24982,7 @@ var require_dist_cjs66 = __commonJS({
24933
24982
  var _XABST = "X-Amzn-Bedrock-Service-Tier";
24934
24983
  var _XABT = "X-Amzn-Bedrock-Trace";
24935
24984
  var _a16 = "action";
24985
+ var _aGD = "appliedGuardrailDetails";
24936
24986
  var _aIS = "asyncInvokeSummaries";
24937
24987
  var _aMRF = "additionalModelRequestFields";
24938
24988
  var _aMRFP = "additionalModelResponseFieldPaths";
@@ -24996,10 +25046,14 @@ var require_dist_cjs66 = __commonJS({
24996
25046
  var _fi = "findings";
24997
25047
  var _fil = "filters";
24998
25048
  var _g = "guardrail";
25049
+ var _gA = "guardrailArn";
24999
25050
  var _gC = "guardrailCoverage";
25000
25051
  var _gCu = "guardrailConfig";
25001
25052
  var _gCua = "guardContent";
25002
- var _gI = "guardrailIdentifier";
25053
+ var _gI = "guardrailId";
25054
+ var _gIu = "guardrailIdentifier";
25055
+ var _gO = "guardrailOrigin";
25056
+ var _gOu = "guardrailOwnership";
25003
25057
  var _gPL = "guardrailProcessingLatency";
25004
25058
  var _gV = "guardrailVersion";
25005
25059
  var _gu = "guarded";
@@ -25170,12 +25224,20 @@ var require_dist_cjs66 = __commonJS({
25170
25224
  ];
25171
25225
  schema.TypeRegistry.for(n04).registerError(AccessDeniedException5, AccessDeniedException$1);
25172
25226
  var AnyToolChoice = [3, n04, _ATC, 0, [], []];
25227
+ var AppliedGuardrailDetails = [
25228
+ 3,
25229
+ n04,
25230
+ _AGD,
25231
+ 0,
25232
+ [_gI, _gV, _gA, _gO, _gOu],
25233
+ [0, 0, 0, 64 | 0, 0]
25234
+ ];
25173
25235
  var ApplyGuardrailRequest = [
25174
25236
  3,
25175
25237
  n04,
25176
25238
  _AGR,
25177
25239
  0,
25178
- [_gI, _gV, _s4, _co3, _oS],
25240
+ [_gIu, _gV, _s4, _co3, _oS],
25179
25241
  [[0, 1], [0, 1], 0, [() => GuardrailContentBlockList, 0], 0]
25180
25242
  ];
25181
25243
  var ApplyGuardrailResponse = [
@@ -25405,7 +25467,7 @@ var require_dist_cjs66 = __commonJS({
25405
25467
  n04,
25406
25468
  _GA,
25407
25469
  0,
25408
- [_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM],
25470
+ [_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM, _aGD],
25409
25471
  [
25410
25472
  () => GuardrailTopicPolicyAssessment,
25411
25473
  () => GuardrailContentPolicyAssessment,
@@ -25413,7 +25475,8 @@ var require_dist_cjs66 = __commonJS({
25413
25475
  () => GuardrailSensitiveInformationPolicyAssessment,
25414
25476
  () => GuardrailContextualGroundingPolicyAssessment,
25415
25477
  [() => GuardrailAutomatedReasoningPolicyAssessment, 0],
25416
- () => GuardrailInvocationMetrics
25478
+ () => GuardrailInvocationMetrics,
25479
+ () => AppliedGuardrailDetails
25417
25480
  ]
25418
25481
  ];
25419
25482
  var GuardrailAutomatedReasoningImpossibleFinding = [
@@ -25545,7 +25608,7 @@ var require_dist_cjs66 = __commonJS({
25545
25608
  [() => GuardrailAutomatedReasoningLogicWarning, 0]
25546
25609
  ]
25547
25610
  ];
25548
- var GuardrailConfiguration = [3, n04, _GC, 0, [_gI, _gV, _tr], [0, 0, 0]];
25611
+ var GuardrailConfiguration = [3, n04, _GC, 0, [_gIu, _gV, _tr], [0, 0, 0]];
25549
25612
  var GuardrailContentFilter = [3, n04, _GCF, 0, [_t, _conf, _fS, _a16, _de], [0, 0, 0, 0, 2]];
25550
25613
  var GuardrailContentPolicyAssessment = [
25551
25614
  3,
@@ -25618,7 +25681,7 @@ var require_dist_cjs66 = __commonJS({
25618
25681
  [_pE, _re],
25619
25682
  [() => GuardrailPiiEntityFilterList, () => GuardrailRegexFilterList]
25620
25683
  ];
25621
- var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [_gI, _gV, _tr, _sPM], [0, 0, 0, 0]];
25684
+ var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [_gIu, _gV, _tr, _sPM], [0, 0, 0, 0]];
25622
25685
  var GuardrailTextBlock = [3, n04, _GTB, 0, [_te, _q], [0, 64 | 0]];
25623
25686
  var GuardrailTextCharactersCoverage = [3, n04, _GTCC, 0, [_gu, _to], [1, 1]];
25624
25687
  var GuardrailTopic = [3, n04, _GT, 0, [_n, _t, _a16, _de], [0, 0, 0, 2]];
@@ -25673,7 +25736,7 @@ var require_dist_cjs66 = __commonJS({
25673
25736
  n04,
25674
25737
  _IMR,
25675
25738
  0,
25676
- [_bo, _cT, _ac, _mI, _tr, _gI, _gV, _pCL, _sTe],
25739
+ [_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
25677
25740
  [
25678
25741
  [() => Body, 16],
25679
25742
  [
@@ -25774,7 +25837,7 @@ var require_dist_cjs66 = __commonJS({
25774
25837
  n04,
25775
25838
  _IMWRSR,
25776
25839
  0,
25777
- [_bo, _cT, _ac, _mI, _tr, _gI, _gV, _pCL, _sTe],
25840
+ [_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
25778
25841
  [
25779
25842
  [() => Body, 16],
25780
25843
  [
@@ -26593,6 +26656,15 @@ var require_dist_cjs66 = __commonJS({
26593
26656
  GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
26594
26657
  NONE: "NONE"
26595
26658
  };
26659
+ var GuardrailOrigin = {
26660
+ ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED",
26661
+ ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED",
26662
+ REQUEST: "REQUEST"
26663
+ };
26664
+ var GuardrailOwnership = {
26665
+ CROSS_ACCOUNT: "CROSS_ACCOUNT",
26666
+ SELF: "SELF"
26667
+ };
26596
26668
  var GuardrailAutomatedReasoningLogicWarningType = {
26597
26669
  ALWAYS_FALSE: "ALWAYS_FALSE",
26598
26670
  ALWAYS_TRUE: "ALWAYS_TRUE"
@@ -26804,7 +26876,9 @@ var require_dist_cjs66 = __commonJS({
26804
26876
  exports2.GuardrailConverseImageFormat = GuardrailConverseImageFormat;
26805
26877
  exports2.GuardrailImageFormat = GuardrailImageFormat;
26806
26878
  exports2.GuardrailManagedWordType = GuardrailManagedWordType;
26879
+ exports2.GuardrailOrigin = GuardrailOrigin;
26807
26880
  exports2.GuardrailOutputScope = GuardrailOutputScope;
26881
+ exports2.GuardrailOwnership = GuardrailOwnership;
26808
26882
  exports2.GuardrailPiiEntityType = GuardrailPiiEntityType;
26809
26883
  exports2.GuardrailSensitiveInformationPolicyAction = GuardrailSensitiveInformationPolicyAction;
26810
26884
  exports2.GuardrailStreamProcessingMode = GuardrailStreamProcessingMode;
@@ -29467,7 +29541,27 @@ var init_HookManager = __esm({
29467
29541
  });
29468
29542
 
29469
29543
  // src/agent/imageConfig.js
29470
- var SUPPORTED_IMAGE_EXTENSIONS, IMAGE_MIME_TYPES;
29544
+ function isFormatSupportedByProvider(extension, provider) {
29545
+ if (!extension || typeof extension !== "string") {
29546
+ return false;
29547
+ }
29548
+ if (extension.includes("/") || extension.includes("\\") || extension.includes("..")) {
29549
+ return false;
29550
+ }
29551
+ const ext2 = extension.toLowerCase();
29552
+ if (!SUPPORTED_IMAGE_EXTENSIONS.includes(ext2)) {
29553
+ return false;
29554
+ }
29555
+ if (!provider || typeof provider !== "string") {
29556
+ return true;
29557
+ }
29558
+ const unsupportedFormats = PROVIDER_UNSUPPORTED_FORMATS[provider];
29559
+ if (unsupportedFormats && unsupportedFormats.includes(ext2)) {
29560
+ return false;
29561
+ }
29562
+ return true;
29563
+ }
29564
+ var SUPPORTED_IMAGE_EXTENSIONS, IMAGE_MIME_TYPES, PROVIDER_UNSUPPORTED_FORMATS;
29471
29565
  var init_imageConfig = __esm({
29472
29566
  "src/agent/imageConfig.js"() {
29473
29567
  "use strict";
@@ -29480,6 +29574,10 @@ var init_imageConfig = __esm({
29480
29574
  "bmp": "image/bmp",
29481
29575
  "svg": "image/svg+xml"
29482
29576
  };
29577
+ PROVIDER_UNSUPPORTED_FORMATS = {
29578
+ "google": ["svg"]
29579
+ // Google Gemini doesn't support image/svg+xml
29580
+ };
29483
29581
  }
29484
29582
  });
29485
29583
 
@@ -29596,17 +29694,30 @@ var init_xmlParsingUtils = __esm({
29596
29694
 
29597
29695
  // src/agent/tools.js
29598
29696
  function createTools(configOptions) {
29599
- const tools2 = {
29600
- searchTool: searchTool(configOptions),
29601
- queryTool: queryTool(configOptions),
29602
- extractTool: extractTool(configOptions),
29603
- delegateTool: delegateTool(configOptions)
29604
- };
29605
- if (configOptions.enableBash) {
29697
+ const tools2 = {};
29698
+ const isToolAllowed = configOptions.isToolAllowed || ((toolName) => {
29699
+ if (!configOptions.allowedTools) return true;
29700
+ return configOptions.allowedTools.isEnabled(toolName);
29701
+ });
29702
+ if (isToolAllowed("search")) {
29703
+ tools2.searchTool = searchTool(configOptions);
29704
+ }
29705
+ if (isToolAllowed("query")) {
29706
+ tools2.queryTool = queryTool(configOptions);
29707
+ }
29708
+ if (isToolAllowed("extract")) {
29709
+ tools2.extractTool = extractTool(configOptions);
29710
+ }
29711
+ if (configOptions.enableDelegate && isToolAllowed("delegate")) {
29712
+ tools2.delegateTool = delegateTool(configOptions);
29713
+ }
29714
+ if (configOptions.enableBash && isToolAllowed("bash")) {
29606
29715
  tools2.bashTool = bashTool(configOptions);
29607
29716
  }
29608
- if (configOptions.allowEdit) {
29717
+ if (configOptions.allowEdit && isToolAllowed("edit")) {
29609
29718
  tools2.editTool = editTool(configOptions);
29719
+ }
29720
+ if (configOptions.allowEdit && isToolAllowed("create")) {
29610
29721
  tools2.createTool = createTool(configOptions);
29611
29722
  }
29612
29723
  return tools2;
@@ -39216,7 +39327,7 @@ var init_esm4 = __esm({
39216
39327
  *
39217
39328
  * @internal
39218
39329
  */
39219
- constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs8 = defaultFS } = {}) {
39330
+ constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs8 = defaultFS } = {}) {
39220
39331
  this.#fs = fsFromOption(fs8);
39221
39332
  if (cwd instanceof URL || cwd.startsWith("file://")) {
39222
39333
  cwd = (0, import_node_url.fileURLToPath)(cwd);
@@ -39227,7 +39338,7 @@ var init_esm4 = __esm({
39227
39338
  this.#resolveCache = new ResolveCache();
39228
39339
  this.#resolvePosixCache = new ResolveCache();
39229
39340
  this.#children = new ChildrenCache(childrenCacheSize);
39230
- const split = cwdPath.substring(this.rootPath.length).split(sep3);
39341
+ const split = cwdPath.substring(this.rootPath.length).split(sep4);
39231
39342
  if (split.length === 1 && !split[0]) {
39232
39343
  split.pop();
39233
39344
  }
@@ -59843,7 +59954,7 @@ var init_graph_builder = __esm({
59843
59954
  applyLinkStyles() {
59844
59955
  if (!this.pendingLinkStyles.length || !this.edges.length)
59845
59956
  return;
59846
- const normalize2 = (s4) => {
59957
+ const normalize3 = (s4) => {
59847
59958
  const out = {};
59848
59959
  for (const [kRaw, vRaw] of Object.entries(s4)) {
59849
59960
  const k4 = kRaw.trim().toLowerCase();
@@ -59864,7 +59975,7 @@ var init_graph_builder = __esm({
59864
59975
  return out;
59865
59976
  };
59866
59977
  for (const cmd of this.pendingLinkStyles) {
59867
- const style = normalize2(cmd.props);
59978
+ const style = normalize3(cmd.props);
59868
59979
  for (const idx of cmd.indices) {
59869
59980
  if (idx >= 0 && idx < this.edges.length) {
59870
59981
  const e4 = this.edges[idx];
@@ -66956,7 +67067,7 @@ var require_bk = __commonJS({
66956
67067
  return xs;
66957
67068
  }
66958
67069
  function buildBlockGraph(g4, layering, root2, reverseSep) {
66959
- var blockGraph = new Graph(), graphLabel = g4.graph(), sepFn = sep3(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
67070
+ var blockGraph = new Graph(), graphLabel = g4.graph(), sepFn = sep4(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
66960
67071
  _.forEach(layering, function(layer) {
66961
67072
  var u4;
66962
67073
  _.forEach(layer, function(v4) {
@@ -67046,7 +67157,7 @@ var require_bk = __commonJS({
67046
67157
  alignCoordinates(xss, smallestWidth);
67047
67158
  return balance(xss, g4.graph().align);
67048
67159
  }
67049
- function sep3(nodeSep, edgeSep, reverseSep) {
67160
+ function sep4(nodeSep, edgeSep, reverseSep) {
67050
67161
  return function(g4, v4, w4) {
67051
67162
  var vLabel = g4.node(v4);
67052
67163
  var wLabel = g4.node(w4);
@@ -67131,7 +67242,7 @@ var require_layout = __commonJS({
67131
67242
  "use strict";
67132
67243
  var _ = require_lodash2();
67133
67244
  var acyclic = require_acyclic();
67134
- var normalize2 = require_normalize();
67245
+ var normalize3 = require_normalize();
67135
67246
  var rank = require_rank();
67136
67247
  var normalizeRanks = require_util().normalizeRanks;
67137
67248
  var parentDummyChains = require_parent_dummy_chains();
@@ -67193,7 +67304,7 @@ var require_layout = __commonJS({
67193
67304
  removeEdgeLabelProxies(g4);
67194
67305
  });
67195
67306
  time2(" normalize.run", function() {
67196
- normalize2.run(g4);
67307
+ normalize3.run(g4);
67197
67308
  });
67198
67309
  time2(" parentDummyChains", function() {
67199
67310
  parentDummyChains(g4);
@@ -67220,7 +67331,7 @@ var require_layout = __commonJS({
67220
67331
  removeBorderNodes(g4);
67221
67332
  });
67222
67333
  time2(" normalize.undo", function() {
67223
- normalize2.undo(g4);
67334
+ normalize3.undo(g4);
67224
67335
  });
67225
67336
  time2(" fixupEdgeLabelCoords", function() {
67226
67337
  fixupEdgeLabelCoords(g4);
@@ -73591,8 +73702,8 @@ var require_resolve = __commonJS({
73591
73702
  }
73592
73703
  return count;
73593
73704
  }
73594
- function getFullPath(resolver, id = "", normalize2) {
73595
- if (normalize2 !== false)
73705
+ function getFullPath(resolver, id = "", normalize3) {
73706
+ if (normalize3 !== false)
73596
73707
  id = normalizeId(id);
73597
73708
  const p4 = resolver.parse(id);
73598
73709
  return _getFullPath(resolver, p4);
@@ -74932,7 +75043,7 @@ var require_fast_uri = __commonJS({
74932
75043
  "use strict";
74933
75044
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
74934
75045
  var { SCHEMES, getSchemeHandler } = require_schemes();
74935
- function normalize2(uri, options) {
75046
+ function normalize3(uri, options) {
74936
75047
  if (typeof uri === "string") {
74937
75048
  uri = /** @type {T} */
74938
75049
  serialize(parse6(uri, options), options);
@@ -75168,7 +75279,7 @@ var require_fast_uri = __commonJS({
75168
75279
  }
75169
75280
  var fastUri = {
75170
75281
  SCHEMES,
75171
- normalize: normalize2,
75282
+ normalize: normalize3,
75172
75283
  resolve: resolve5,
75173
75284
  resolveComponent,
75174
75285
  equal,
@@ -82819,46 +82930,72 @@ var init_ProbeAgent = __esm({
82819
82930
  * Initialize tools with configuration
82820
82931
  */
82821
82932
  initializeTools() {
82933
+ const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
82822
82934
  const configOptions = {
82823
82935
  sessionId: this.sessionId,
82824
82936
  debug: this.debug,
82825
82937
  defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
82826
82938
  allowedFolders: this.allowedFolders,
82827
82939
  outline: this.outline,
82940
+ allowEdit: this.allowEdit,
82941
+ enableDelegate: this.enableDelegate,
82828
82942
  enableBash: this.enableBash,
82829
- bashConfig: this.bashConfig
82943
+ bashConfig: this.bashConfig,
82944
+ allowedTools: this.allowedTools,
82945
+ isToolAllowed
82830
82946
  };
82831
82947
  const baseTools = createTools(configOptions);
82832
82948
  const wrappedTools = createWrappedTools(baseTools);
82833
- this.toolImplementations = {
82834
- search: wrappedTools.searchToolInstance,
82835
- query: wrappedTools.queryToolInstance,
82836
- extract: wrappedTools.extractToolInstance,
82837
- delegate: wrappedTools.delegateToolInstance,
82838
- listFiles: listFilesToolInstance,
82839
- searchFiles: searchFilesToolInstance,
82840
- readImage: {
82949
+ this.toolImplementations = {};
82950
+ if (wrappedTools.searchToolInstance && isToolAllowed("search")) {
82951
+ this.toolImplementations.search = wrappedTools.searchToolInstance;
82952
+ }
82953
+ if (wrappedTools.queryToolInstance && isToolAllowed("query")) {
82954
+ this.toolImplementations.query = wrappedTools.queryToolInstance;
82955
+ }
82956
+ if (wrappedTools.extractToolInstance && isToolAllowed("extract")) {
82957
+ this.toolImplementations.extract = wrappedTools.extractToolInstance;
82958
+ }
82959
+ if (this.enableDelegate && wrappedTools.delegateToolInstance && isToolAllowed("delegate")) {
82960
+ this.toolImplementations.delegate = wrappedTools.delegateToolInstance;
82961
+ }
82962
+ if (isToolAllowed("listFiles")) {
82963
+ this.toolImplementations.listFiles = listFilesToolInstance;
82964
+ }
82965
+ if (isToolAllowed("searchFiles")) {
82966
+ this.toolImplementations.searchFiles = searchFilesToolInstance;
82967
+ }
82968
+ if (isToolAllowed("readImage")) {
82969
+ this.toolImplementations.readImage = {
82841
82970
  execute: async (params) => {
82842
82971
  const imagePath = params.path;
82843
82972
  if (!imagePath) {
82844
82973
  throw new Error("Image path is required");
82845
82974
  }
82975
+ const filename = (0, import_path7.basename)(imagePath);
82976
+ const extension = filename.toLowerCase().split(".").pop();
82977
+ if (!extension || !SUPPORTED_IMAGE_EXTENSIONS.includes(extension)) {
82978
+ throw new Error(`Invalid or unsupported image extension: ${extension}. Supported formats: ${SUPPORTED_IMAGE_EXTENSIONS.join(", ")}`);
82979
+ }
82980
+ if (this.apiType && !isFormatSupportedByProvider(extension, this.apiType)) {
82981
+ throw new Error(`Image format '${extension}' is not supported by the current AI provider (${this.apiType}). Try using a different image format like PNG or JPEG.`);
82982
+ }
82846
82983
  const loaded = await this.loadImageIfValid(imagePath);
82847
82984
  if (!loaded) {
82848
82985
  throw new Error(`Failed to load image: ${imagePath}. The file may not exist, be too large, have an unsupported format, or be outside allowed directories.`);
82849
82986
  }
82850
82987
  return `Image loaded successfully: ${imagePath}. The image is now available for analysis in the conversation.`;
82851
82988
  }
82852
- }
82853
- };
82854
- if (this.enableBash && wrappedTools.bashToolInstance) {
82989
+ };
82990
+ }
82991
+ if (this.enableBash && wrappedTools.bashToolInstance && isToolAllowed("bash")) {
82855
82992
  this.toolImplementations.bash = wrappedTools.bashToolInstance;
82856
82993
  }
82857
82994
  if (this.allowEdit) {
82858
- if (wrappedTools.editToolInstance) {
82995
+ if (wrappedTools.editToolInstance && isToolAllowed("edit")) {
82859
82996
  this.toolImplementations.edit = wrappedTools.editToolInstance;
82860
82997
  }
82861
- if (wrappedTools.createToolInstance) {
82998
+ if (wrappedTools.createToolInstance && isToolAllowed("create")) {
82862
82999
  this.toolImplementations.create = wrappedTools.createToolInstance;
82863
83000
  }
82864
83001
  }
@@ -83461,12 +83598,16 @@ var init_ProbeAgent = __esm({
83461
83598
  let absolutePath;
83462
83599
  let isPathAllowed2 = false;
83463
83600
  if ((0, import_path7.isAbsolute)(imagePath)) {
83464
- absolutePath = imagePath;
83465
- isPathAllowed2 = allowedDirs.some((dir) => absolutePath.startsWith((0, import_path7.resolve)(dir)));
83601
+ absolutePath = (0, import_path7.normalize)((0, import_path7.resolve)(imagePath));
83602
+ isPathAllowed2 = allowedDirs.some((dir) => {
83603
+ const normalizedDir = (0, import_path7.normalize)((0, import_path7.resolve)(dir));
83604
+ return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir + import_path7.sep);
83605
+ });
83466
83606
  } else {
83467
83607
  for (const dir of allowedDirs) {
83468
- const resolvedPath2 = (0, import_path7.resolve)(dir, imagePath);
83469
- if (resolvedPath2.startsWith((0, import_path7.resolve)(dir))) {
83608
+ const normalizedDir = (0, import_path7.normalize)((0, import_path7.resolve)(dir));
83609
+ const resolvedPath2 = (0, import_path7.normalize)((0, import_path7.resolve)(dir, imagePath));
83610
+ if (resolvedPath2 === normalizedDir || resolvedPath2.startsWith(normalizedDir + import_path7.sep)) {
83470
83611
  absolutePath = resolvedPath2;
83471
83612
  isPathAllowed2 = true;
83472
83613
  break;
@@ -84474,8 +84615,8 @@ ${toolResultContent}
84474
84615
  // Pass parent session ID for tracking
84475
84616
  path: this.searchPath,
84476
84617
  // Inherit search path
84477
- provider: this.provider,
84478
- // Inherit AI provider
84618
+ provider: this.apiType,
84619
+ // Inherit AI provider (string identifier)
84479
84620
  model: this.model,
84480
84621
  // Inherit model
84481
84622
  debug: this.debug,
@@ -84484,7 +84625,7 @@ ${toolResultContent}
84484
84625
  if (this.debug) {
84485
84626
  console.log(`[DEBUG] Executing delegate tool at iteration ${currentIteration}/${maxIterations}`);
84486
84627
  console.log(`[DEBUG] Parent session: ${this.sessionId}`);
84487
- console.log(`[DEBUG] Inherited config: path=${this.searchPath}, provider=${this.provider}, model=${this.model}`);
84628
+ console.log(`[DEBUG] Inherited config: path=${this.searchPath}, provider=${this.apiType}, model=${this.model}`);
84488
84629
  console.log(`[DEBUG] Delegate task: ${toolParams.task?.substring(0, 100)}...`);
84489
84630
  }
84490
84631
  if (this.tracer) {
@@ -84551,9 +84692,6 @@ ${toolResultContent}
84551
84692
  role: "user",
84552
84693
  content: toolResultMessage
84553
84694
  });
84554
- if (toolResultContent) {
84555
- await this.processImageReferences(toolResultContent);
84556
- }
84557
84695
  if (this.debug) {
84558
84696
  console.log(`[DEBUG] Tool ${toolName} executed successfully. Result length: ${typeof toolResult === "string" ? toolResult.length : JSON.stringify(toolResult).length}`);
84559
84697
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@probelabs/probe",
3
- "version": "0.6.0-rc168",
3
+ "version": "0.6.0-rc170",
4
4
  "description": "Node.js wrapper for the probe code search tool",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",