@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.
@@ -11080,6 +11080,50 @@ var init_ConfigurableSerdeContext = __esm({
11080
11080
  }
11081
11081
  });
11082
11082
 
11083
+ // node_modules/@aws-sdk/core/dist-es/submodules/protocols/structIterator.js
11084
+ function* serializingStructIterator(ns, sourceObject) {
11085
+ if (ns.isUnitSchema()) {
11086
+ return;
11087
+ }
11088
+ const struct2 = ns.getSchema();
11089
+ for (let i4 = 0; i4 < struct2[4].length; ++i4) {
11090
+ const key = struct2[4][i4];
11091
+ const memberNs = new NormalizedSchema([struct2[5][i4], 0], key);
11092
+ if (!(key in sourceObject) && !memberNs.isIdempotencyToken()) {
11093
+ continue;
11094
+ }
11095
+ yield [key, memberNs];
11096
+ }
11097
+ }
11098
+ function* deserializingStructIterator(ns, sourceObject, nameTrait) {
11099
+ if (ns.isUnitSchema()) {
11100
+ return;
11101
+ }
11102
+ const struct2 = ns.getSchema();
11103
+ let keysRemaining = Object.keys(sourceObject).length;
11104
+ for (let i4 = 0; i4 < struct2[4].length; ++i4) {
11105
+ if (keysRemaining === 0) {
11106
+ break;
11107
+ }
11108
+ const key = struct2[4][i4];
11109
+ const memberNs = new NormalizedSchema([struct2[5][i4], 0], key);
11110
+ let serializationKey = key;
11111
+ if (nameTrait) {
11112
+ serializationKey = memberNs.getMergedTraits()[nameTrait] ?? key;
11113
+ }
11114
+ if (!(serializationKey in sourceObject)) {
11115
+ continue;
11116
+ }
11117
+ yield [key, memberNs];
11118
+ keysRemaining -= 1;
11119
+ }
11120
+ }
11121
+ var init_structIterator = __esm({
11122
+ "node_modules/@aws-sdk/core/dist-es/submodules/protocols/structIterator.js"() {
11123
+ init_schema();
11124
+ }
11125
+ });
11126
+
11083
11127
  // node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/jsonReviver.js
11084
11128
  function jsonReviver(key, value, context) {
11085
11129
  if (context?.source) {
@@ -11182,6 +11226,7 @@ var init_JsonShapeDeserializer = __esm({
11182
11226
  init_serde();
11183
11227
  import_util_base644 = __toESM(require_dist_cjs12());
11184
11228
  init_ConfigurableSerdeContext();
11229
+ init_structIterator();
11185
11230
  init_jsonReviver();
11186
11231
  init_parseJsonBody();
11187
11232
  JsonShapeDeserializer = class extends SerdeContextConfig {
@@ -11221,7 +11266,7 @@ var init_JsonShapeDeserializer = __esm({
11221
11266
  return out;
11222
11267
  } else if (ns.isStructSchema() && isObject2) {
11223
11268
  const out = {};
11224
- for (const [memberName, memberSchema] of ns.structIterator()) {
11269
+ for (const [memberName, memberSchema] of deserializingStructIterator(ns, value, this.settings.jsonName ? "jsonName" : false)) {
11225
11270
  const fromKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
11226
11271
  const deserializedValue = this._read(memberSchema, value[fromKey]);
11227
11272
  if (deserializedValue != null) {
@@ -11360,6 +11405,7 @@ var init_JsonShapeSerializer = __esm({
11360
11405
  init_serde();
11361
11406
  import_util_base645 = __toESM(require_dist_cjs12());
11362
11407
  init_ConfigurableSerdeContext();
11408
+ init_structIterator();
11363
11409
  init_jsonReplacer();
11364
11410
  JsonShapeSerializer = class extends SerdeContextConfig {
11365
11411
  settings;
@@ -11413,10 +11459,10 @@ var init_JsonShapeSerializer = __esm({
11413
11459
  return out;
11414
11460
  } else if (ns.isStructSchema() && isObject2) {
11415
11461
  const out = {};
11416
- for (const [memberName, memberSchema] of ns.structIterator()) {
11417
- const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
11462
+ for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
11418
11463
  const serializableValue = this._write(memberSchema, value[memberName], ns);
11419
11464
  if (serializableValue !== void 0) {
11465
+ const targetKey = this.settings.jsonName ? memberSchema.getMergedTraits().jsonName ?? memberName : memberName;
11420
11466
  out[targetKey] = serializableValue;
11421
11467
  }
11422
11468
  }
@@ -12833,6 +12879,7 @@ var init_QueryShapeSerializer = __esm({
12833
12879
  import_smithy_client5 = __toESM(require_dist_cjs27());
12834
12880
  import_util_base646 = __toESM(require_dist_cjs12());
12835
12881
  init_ConfigurableSerdeContext();
12882
+ init_structIterator();
12836
12883
  QueryShapeSerializer = class extends SerdeContextConfig {
12837
12884
  settings;
12838
12885
  buffer;
@@ -12932,7 +12979,7 @@ var init_QueryShapeSerializer = __esm({
12932
12979
  }
12933
12980
  } else if (ns.isStructSchema()) {
12934
12981
  if (value && typeof value === "object") {
12935
- for (const [memberName, member2] of ns.structIterator()) {
12982
+ for (const [memberName, member2] of serializingStructIterator(ns, value)) {
12936
12983
  if (value[memberName] == null && !member2.isIdempotencyToken()) {
12937
12984
  continue;
12938
12985
  }
@@ -13208,6 +13255,7 @@ var init_XmlShapeSerializer = __esm({
13208
13255
  import_smithy_client7 = __toESM(require_dist_cjs27());
13209
13256
  import_util_base647 = __toESM(require_dist_cjs12());
13210
13257
  init_ConfigurableSerdeContext();
13258
+ init_structIterator();
13211
13259
  XmlShapeSerializer = class extends SerdeContextConfig {
13212
13260
  settings;
13213
13261
  stringBuffer;
@@ -13259,7 +13307,7 @@ var init_XmlShapeSerializer = __esm({
13259
13307
  }
13260
13308
  const structXmlNode = import_xml_builder3.XmlNode.of(name14);
13261
13309
  const [xmlnsAttr, xmlns] = this.getXmlnsAttribute(ns, parentXmlns);
13262
- for (const [memberName, memberSchema] of ns.structIterator()) {
13310
+ for (const [memberName, memberSchema] of serializingStructIterator(ns, value)) {
13263
13311
  const val = value[memberName];
13264
13312
  if (val != null || memberSchema.isIdempotencyToken()) {
13265
13313
  if (memberSchema.getMergedTraits().xmlAttribute) {
@@ -17003,7 +17051,7 @@ var require_package2 = __commonJS({
17003
17051
  module2.exports = {
17004
17052
  name: "@aws-sdk/client-bedrock-runtime",
17005
17053
  description: "AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",
17006
- version: "3.936.0",
17054
+ version: "3.940.0",
17007
17055
  scripts: {
17008
17056
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
17009
17057
  "build:cjs": "node ../../scripts/compilation/inline client-bedrock-runtime",
@@ -17022,21 +17070,21 @@ var require_package2 = __commonJS({
17022
17070
  dependencies: {
17023
17071
  "@aws-crypto/sha256-browser": "5.2.0",
17024
17072
  "@aws-crypto/sha256-js": "5.2.0",
17025
- "@aws-sdk/core": "3.936.0",
17026
- "@aws-sdk/credential-provider-node": "3.936.0",
17073
+ "@aws-sdk/core": "3.940.0",
17074
+ "@aws-sdk/credential-provider-node": "3.940.0",
17027
17075
  "@aws-sdk/eventstream-handler-node": "3.936.0",
17028
17076
  "@aws-sdk/middleware-eventstream": "3.936.0",
17029
17077
  "@aws-sdk/middleware-host-header": "3.936.0",
17030
17078
  "@aws-sdk/middleware-logger": "3.936.0",
17031
17079
  "@aws-sdk/middleware-recursion-detection": "3.936.0",
17032
- "@aws-sdk/middleware-user-agent": "3.936.0",
17080
+ "@aws-sdk/middleware-user-agent": "3.940.0",
17033
17081
  "@aws-sdk/middleware-websocket": "3.936.0",
17034
17082
  "@aws-sdk/region-config-resolver": "3.936.0",
17035
- "@aws-sdk/token-providers": "3.936.0",
17083
+ "@aws-sdk/token-providers": "3.940.0",
17036
17084
  "@aws-sdk/types": "3.936.0",
17037
17085
  "@aws-sdk/util-endpoints": "3.936.0",
17038
17086
  "@aws-sdk/util-user-agent-browser": "3.936.0",
17039
- "@aws-sdk/util-user-agent-node": "3.936.0",
17087
+ "@aws-sdk/util-user-agent-node": "3.940.0",
17040
17088
  "@smithy/config-resolver": "^4.4.3",
17041
17089
  "@smithy/core": "^3.18.5",
17042
17090
  "@smithy/eventstream-serde-browser": "^4.2.5",
@@ -17783,7 +17831,7 @@ var init_package = __esm({
17783
17831
  "node_modules/@aws-sdk/nested-clients/package.json"() {
17784
17832
  package_default = {
17785
17833
  name: "@aws-sdk/nested-clients",
17786
- version: "3.936.0",
17834
+ version: "3.940.0",
17787
17835
  description: "Nested clients for AWS SDK packages.",
17788
17836
  main: "./dist-cjs/index.js",
17789
17837
  module: "./dist-es/index.js",
@@ -17812,16 +17860,16 @@ var init_package = __esm({
17812
17860
  dependencies: {
17813
17861
  "@aws-crypto/sha256-browser": "5.2.0",
17814
17862
  "@aws-crypto/sha256-js": "5.2.0",
17815
- "@aws-sdk/core": "3.936.0",
17863
+ "@aws-sdk/core": "3.940.0",
17816
17864
  "@aws-sdk/middleware-host-header": "3.936.0",
17817
17865
  "@aws-sdk/middleware-logger": "3.936.0",
17818
17866
  "@aws-sdk/middleware-recursion-detection": "3.936.0",
17819
- "@aws-sdk/middleware-user-agent": "3.936.0",
17867
+ "@aws-sdk/middleware-user-agent": "3.940.0",
17820
17868
  "@aws-sdk/region-config-resolver": "3.936.0",
17821
17869
  "@aws-sdk/types": "3.936.0",
17822
17870
  "@aws-sdk/util-endpoints": "3.936.0",
17823
17871
  "@aws-sdk/util-user-agent-browser": "3.936.0",
17824
- "@aws-sdk/util-user-agent-node": "3.936.0",
17872
+ "@aws-sdk/util-user-agent-node": "3.940.0",
17825
17873
  "@smithy/config-resolver": "^4.4.3",
17826
17874
  "@smithy/core": "^3.18.5",
17827
17875
  "@smithy/fetch-http-handler": "^5.3.6",
@@ -19213,7 +19261,7 @@ var require_package3 = __commonJS({
19213
19261
  module2.exports = {
19214
19262
  name: "@aws-sdk/client-sso",
19215
19263
  description: "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native",
19216
- version: "3.936.0",
19264
+ version: "3.940.0",
19217
19265
  scripts: {
19218
19266
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
19219
19267
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -19232,16 +19280,16 @@ var require_package3 = __commonJS({
19232
19280
  dependencies: {
19233
19281
  "@aws-crypto/sha256-browser": "5.2.0",
19234
19282
  "@aws-crypto/sha256-js": "5.2.0",
19235
- "@aws-sdk/core": "3.936.0",
19283
+ "@aws-sdk/core": "3.940.0",
19236
19284
  "@aws-sdk/middleware-host-header": "3.936.0",
19237
19285
  "@aws-sdk/middleware-logger": "3.936.0",
19238
19286
  "@aws-sdk/middleware-recursion-detection": "3.936.0",
19239
- "@aws-sdk/middleware-user-agent": "3.936.0",
19287
+ "@aws-sdk/middleware-user-agent": "3.940.0",
19240
19288
  "@aws-sdk/region-config-resolver": "3.936.0",
19241
19289
  "@aws-sdk/types": "3.936.0",
19242
19290
  "@aws-sdk/util-endpoints": "3.936.0",
19243
19291
  "@aws-sdk/util-user-agent-browser": "3.936.0",
19244
- "@aws-sdk/util-user-agent-node": "3.936.0",
19292
+ "@aws-sdk/util-user-agent-node": "3.940.0",
19245
19293
  "@smithy/config-resolver": "^4.4.3",
19246
19294
  "@smithy/core": "^3.18.5",
19247
19295
  "@smithy/fetch-http-handler": "^5.3.6",
@@ -23276,6 +23324,7 @@ var require_dist_cjs66 = __commonJS({
23276
23324
  var _A2 = "Accept";
23277
23325
  var _ADE3 = "AccessDeniedException";
23278
23326
  var _AG = "ApplyGuardrail";
23327
+ var _AGD = "AppliedGuardrailDetails";
23279
23328
  var _AGR = "ApplyGuardrailRequest";
23280
23329
  var _AGRp = "ApplyGuardrailResponse";
23281
23330
  var _AIM = "AsyncInvokeMessage";
@@ -23491,6 +23540,7 @@ var require_dist_cjs66 = __commonJS({
23491
23540
  var _XABST = "X-Amzn-Bedrock-Service-Tier";
23492
23541
  var _XABT = "X-Amzn-Bedrock-Trace";
23493
23542
  var _a16 = "action";
23543
+ var _aGD = "appliedGuardrailDetails";
23494
23544
  var _aIS = "asyncInvokeSummaries";
23495
23545
  var _aMRF = "additionalModelRequestFields";
23496
23546
  var _aMRFP = "additionalModelResponseFieldPaths";
@@ -23554,10 +23604,14 @@ var require_dist_cjs66 = __commonJS({
23554
23604
  var _fi = "findings";
23555
23605
  var _fil = "filters";
23556
23606
  var _g = "guardrail";
23607
+ var _gA = "guardrailArn";
23557
23608
  var _gC = "guardrailCoverage";
23558
23609
  var _gCu = "guardrailConfig";
23559
23610
  var _gCua = "guardContent";
23560
- var _gI = "guardrailIdentifier";
23611
+ var _gI = "guardrailId";
23612
+ var _gIu = "guardrailIdentifier";
23613
+ var _gO = "guardrailOrigin";
23614
+ var _gOu = "guardrailOwnership";
23561
23615
  var _gPL = "guardrailProcessingLatency";
23562
23616
  var _gV = "guardrailVersion";
23563
23617
  var _gu = "guarded";
@@ -23728,12 +23782,20 @@ var require_dist_cjs66 = __commonJS({
23728
23782
  ];
23729
23783
  schema.TypeRegistry.for(n04).registerError(AccessDeniedException5, AccessDeniedException$1);
23730
23784
  var AnyToolChoice = [3, n04, _ATC, 0, [], []];
23785
+ var AppliedGuardrailDetails = [
23786
+ 3,
23787
+ n04,
23788
+ _AGD,
23789
+ 0,
23790
+ [_gI, _gV, _gA, _gO, _gOu],
23791
+ [0, 0, 0, 64 | 0, 0]
23792
+ ];
23731
23793
  var ApplyGuardrailRequest = [
23732
23794
  3,
23733
23795
  n04,
23734
23796
  _AGR,
23735
23797
  0,
23736
- [_gI, _gV, _s4, _co3, _oS],
23798
+ [_gIu, _gV, _s4, _co3, _oS],
23737
23799
  [[0, 1], [0, 1], 0, [() => GuardrailContentBlockList, 0], 0]
23738
23800
  ];
23739
23801
  var ApplyGuardrailResponse = [
@@ -23963,7 +24025,7 @@ var require_dist_cjs66 = __commonJS({
23963
24025
  n04,
23964
24026
  _GA,
23965
24027
  0,
23966
- [_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM],
24028
+ [_tP, _cP, _wP, _sIP, _cGP, _aRP, _iM, _aGD],
23967
24029
  [
23968
24030
  () => GuardrailTopicPolicyAssessment,
23969
24031
  () => GuardrailContentPolicyAssessment,
@@ -23971,7 +24033,8 @@ var require_dist_cjs66 = __commonJS({
23971
24033
  () => GuardrailSensitiveInformationPolicyAssessment,
23972
24034
  () => GuardrailContextualGroundingPolicyAssessment,
23973
24035
  [() => GuardrailAutomatedReasoningPolicyAssessment, 0],
23974
- () => GuardrailInvocationMetrics
24036
+ () => GuardrailInvocationMetrics,
24037
+ () => AppliedGuardrailDetails
23975
24038
  ]
23976
24039
  ];
23977
24040
  var GuardrailAutomatedReasoningImpossibleFinding = [
@@ -24103,7 +24166,7 @@ var require_dist_cjs66 = __commonJS({
24103
24166
  [() => GuardrailAutomatedReasoningLogicWarning, 0]
24104
24167
  ]
24105
24168
  ];
24106
- var GuardrailConfiguration = [3, n04, _GC, 0, [_gI, _gV, _tr], [0, 0, 0]];
24169
+ var GuardrailConfiguration = [3, n04, _GC, 0, [_gIu, _gV, _tr], [0, 0, 0]];
24107
24170
  var GuardrailContentFilter = [3, n04, _GCF, 0, [_t, _conf, _fS, _a16, _de], [0, 0, 0, 0, 2]];
24108
24171
  var GuardrailContentPolicyAssessment = [
24109
24172
  3,
@@ -24176,7 +24239,7 @@ var require_dist_cjs66 = __commonJS({
24176
24239
  [_pE, _re],
24177
24240
  [() => GuardrailPiiEntityFilterList, () => GuardrailRegexFilterList]
24178
24241
  ];
24179
- var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [_gI, _gV, _tr, _sPM], [0, 0, 0, 0]];
24242
+ var GuardrailStreamConfiguration = [3, n04, _GSC, 0, [_gIu, _gV, _tr, _sPM], [0, 0, 0, 0]];
24180
24243
  var GuardrailTextBlock = [3, n04, _GTB, 0, [_te, _q], [0, 64 | 0]];
24181
24244
  var GuardrailTextCharactersCoverage = [3, n04, _GTCC, 0, [_gu, _to], [1, 1]];
24182
24245
  var GuardrailTopic = [3, n04, _GT, 0, [_n, _t, _a16, _de], [0, 0, 0, 2]];
@@ -24231,7 +24294,7 @@ var require_dist_cjs66 = __commonJS({
24231
24294
  n04,
24232
24295
  _IMR,
24233
24296
  0,
24234
- [_bo, _cT, _ac, _mI, _tr, _gI, _gV, _pCL, _sTe],
24297
+ [_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
24235
24298
  [
24236
24299
  [() => Body, 16],
24237
24300
  [
@@ -24332,7 +24395,7 @@ var require_dist_cjs66 = __commonJS({
24332
24395
  n04,
24333
24396
  _IMWRSR,
24334
24397
  0,
24335
- [_bo, _cT, _ac, _mI, _tr, _gI, _gV, _pCL, _sTe],
24398
+ [_bo, _cT, _ac, _mI, _tr, _gIu, _gV, _pCL, _sTe],
24336
24399
  [
24337
24400
  [() => Body, 16],
24338
24401
  [
@@ -25151,6 +25214,15 @@ var require_dist_cjs66 = __commonJS({
25151
25214
  GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
25152
25215
  NONE: "NONE"
25153
25216
  };
25217
+ var GuardrailOrigin = {
25218
+ ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED",
25219
+ ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED",
25220
+ REQUEST: "REQUEST"
25221
+ };
25222
+ var GuardrailOwnership = {
25223
+ CROSS_ACCOUNT: "CROSS_ACCOUNT",
25224
+ SELF: "SELF"
25225
+ };
25154
25226
  var GuardrailAutomatedReasoningLogicWarningType = {
25155
25227
  ALWAYS_FALSE: "ALWAYS_FALSE",
25156
25228
  ALWAYS_TRUE: "ALWAYS_TRUE"
@@ -25362,7 +25434,9 @@ var require_dist_cjs66 = __commonJS({
25362
25434
  exports2.GuardrailConverseImageFormat = GuardrailConverseImageFormat;
25363
25435
  exports2.GuardrailImageFormat = GuardrailImageFormat;
25364
25436
  exports2.GuardrailManagedWordType = GuardrailManagedWordType;
25437
+ exports2.GuardrailOrigin = GuardrailOrigin;
25365
25438
  exports2.GuardrailOutputScope = GuardrailOutputScope;
25439
+ exports2.GuardrailOwnership = GuardrailOwnership;
25366
25440
  exports2.GuardrailPiiEntityType = GuardrailPiiEntityType;
25367
25441
  exports2.GuardrailSensitiveInformationPolicyAction = GuardrailSensitiveInformationPolicyAction;
25368
25442
  exports2.GuardrailStreamProcessingMode = GuardrailStreamProcessingMode;
@@ -28025,7 +28099,27 @@ var init_HookManager = __esm({
28025
28099
  });
28026
28100
 
28027
28101
  // src/agent/imageConfig.js
28028
- var SUPPORTED_IMAGE_EXTENSIONS, IMAGE_MIME_TYPES;
28102
+ function isFormatSupportedByProvider(extension, provider) {
28103
+ if (!extension || typeof extension !== "string") {
28104
+ return false;
28105
+ }
28106
+ if (extension.includes("/") || extension.includes("\\") || extension.includes("..")) {
28107
+ return false;
28108
+ }
28109
+ const ext2 = extension.toLowerCase();
28110
+ if (!SUPPORTED_IMAGE_EXTENSIONS.includes(ext2)) {
28111
+ return false;
28112
+ }
28113
+ if (!provider || typeof provider !== "string") {
28114
+ return true;
28115
+ }
28116
+ const unsupportedFormats = PROVIDER_UNSUPPORTED_FORMATS[provider];
28117
+ if (unsupportedFormats && unsupportedFormats.includes(ext2)) {
28118
+ return false;
28119
+ }
28120
+ return true;
28121
+ }
28122
+ var SUPPORTED_IMAGE_EXTENSIONS, IMAGE_MIME_TYPES, PROVIDER_UNSUPPORTED_FORMATS;
28029
28123
  var init_imageConfig = __esm({
28030
28124
  "src/agent/imageConfig.js"() {
28031
28125
  "use strict";
@@ -28038,6 +28132,10 @@ var init_imageConfig = __esm({
28038
28132
  "bmp": "image/bmp",
28039
28133
  "svg": "image/svg+xml"
28040
28134
  };
28135
+ PROVIDER_UNSUPPORTED_FORMATS = {
28136
+ "google": ["svg"]
28137
+ // Google Gemini doesn't support image/svg+xml
28138
+ };
28041
28139
  }
28042
28140
  });
28043
28141
 
@@ -41186,7 +41284,7 @@ var init_esm4 = __esm({
41186
41284
  *
41187
41285
  * @internal
41188
41286
  */
41189
- constructor(cwd = process.cwd(), pathImpl, sep3, { nocase, childrenCacheSize = 16 * 1024, fs: fs8 = defaultFS } = {}) {
41287
+ constructor(cwd = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs8 = defaultFS } = {}) {
41190
41288
  this.#fs = fsFromOption(fs8);
41191
41289
  if (cwd instanceof URL || cwd.startsWith("file://")) {
41192
41290
  cwd = (0, import_node_url.fileURLToPath)(cwd);
@@ -41197,7 +41295,7 @@ var init_esm4 = __esm({
41197
41295
  this.#resolveCache = new ResolveCache();
41198
41296
  this.#resolvePosixCache = new ResolveCache();
41199
41297
  this.#children = new ChildrenCache(childrenCacheSize);
41200
- const split = cwdPath.substring(this.rootPath.length).split(sep3);
41298
+ const split = cwdPath.substring(this.rootPath.length).split(sep4);
41201
41299
  if (split.length === 1 && !split[0]) {
41202
41300
  split.pop();
41203
41301
  }
@@ -43363,17 +43461,30 @@ var init_xmlParsingUtils = __esm({
43363
43461
 
43364
43462
  // src/agent/tools.js
43365
43463
  function createTools(configOptions) {
43366
- const tools2 = {
43367
- searchTool: searchTool(configOptions),
43368
- queryTool: queryTool(configOptions),
43369
- extractTool: extractTool(configOptions),
43370
- delegateTool: delegateTool(configOptions)
43371
- };
43372
- if (configOptions.enableBash) {
43464
+ const tools2 = {};
43465
+ const isToolAllowed = configOptions.isToolAllowed || ((toolName) => {
43466
+ if (!configOptions.allowedTools) return true;
43467
+ return configOptions.allowedTools.isEnabled(toolName);
43468
+ });
43469
+ if (isToolAllowed("search")) {
43470
+ tools2.searchTool = searchTool(configOptions);
43471
+ }
43472
+ if (isToolAllowed("query")) {
43473
+ tools2.queryTool = queryTool(configOptions);
43474
+ }
43475
+ if (isToolAllowed("extract")) {
43476
+ tools2.extractTool = extractTool(configOptions);
43477
+ }
43478
+ if (configOptions.enableDelegate && isToolAllowed("delegate")) {
43479
+ tools2.delegateTool = delegateTool(configOptions);
43480
+ }
43481
+ if (configOptions.enableBash && isToolAllowed("bash")) {
43373
43482
  tools2.bashTool = bashTool(configOptions);
43374
43483
  }
43375
- if (configOptions.allowEdit) {
43484
+ if (configOptions.allowEdit && isToolAllowed("edit")) {
43376
43485
  tools2.editTool = editTool(configOptions);
43486
+ }
43487
+ if (configOptions.allowEdit && isToolAllowed("create")) {
43377
43488
  tools2.createTool = createTool(configOptions);
43378
43489
  }
43379
43490
  return tools2;
@@ -62101,7 +62212,7 @@ var init_graph_builder = __esm({
62101
62212
  applyLinkStyles() {
62102
62213
  if (!this.pendingLinkStyles.length || !this.edges.length)
62103
62214
  return;
62104
- const normalize2 = (s4) => {
62215
+ const normalize3 = (s4) => {
62105
62216
  const out = {};
62106
62217
  for (const [kRaw, vRaw] of Object.entries(s4)) {
62107
62218
  const k4 = kRaw.trim().toLowerCase();
@@ -62122,7 +62233,7 @@ var init_graph_builder = __esm({
62122
62233
  return out;
62123
62234
  };
62124
62235
  for (const cmd of this.pendingLinkStyles) {
62125
- const style = normalize2(cmd.props);
62236
+ const style = normalize3(cmd.props);
62126
62237
  for (const idx of cmd.indices) {
62127
62238
  if (idx >= 0 && idx < this.edges.length) {
62128
62239
  const e4 = this.edges[idx];
@@ -69214,7 +69325,7 @@ var require_bk = __commonJS({
69214
69325
  return xs;
69215
69326
  }
69216
69327
  function buildBlockGraph(g4, layering, root2, reverseSep) {
69217
- var blockGraph = new Graph(), graphLabel = g4.graph(), sepFn = sep3(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
69328
+ var blockGraph = new Graph(), graphLabel = g4.graph(), sepFn = sep4(graphLabel.nodesep, graphLabel.edgesep, reverseSep);
69218
69329
  _.forEach(layering, function(layer) {
69219
69330
  var u4;
69220
69331
  _.forEach(layer, function(v4) {
@@ -69304,7 +69415,7 @@ var require_bk = __commonJS({
69304
69415
  alignCoordinates(xss, smallestWidth);
69305
69416
  return balance(xss, g4.graph().align);
69306
69417
  }
69307
- function sep3(nodeSep, edgeSep, reverseSep) {
69418
+ function sep4(nodeSep, edgeSep, reverseSep) {
69308
69419
  return function(g4, v4, w4) {
69309
69420
  var vLabel = g4.node(v4);
69310
69421
  var wLabel = g4.node(w4);
@@ -69389,7 +69500,7 @@ var require_layout = __commonJS({
69389
69500
  "use strict";
69390
69501
  var _ = require_lodash2();
69391
69502
  var acyclic = require_acyclic();
69392
- var normalize2 = require_normalize();
69503
+ var normalize3 = require_normalize();
69393
69504
  var rank = require_rank();
69394
69505
  var normalizeRanks = require_util().normalizeRanks;
69395
69506
  var parentDummyChains = require_parent_dummy_chains();
@@ -69451,7 +69562,7 @@ var require_layout = __commonJS({
69451
69562
  removeEdgeLabelProxies(g4);
69452
69563
  });
69453
69564
  time2(" normalize.run", function() {
69454
- normalize2.run(g4);
69565
+ normalize3.run(g4);
69455
69566
  });
69456
69567
  time2(" parentDummyChains", function() {
69457
69568
  parentDummyChains(g4);
@@ -69478,7 +69589,7 @@ var require_layout = __commonJS({
69478
69589
  removeBorderNodes(g4);
69479
69590
  });
69480
69591
  time2(" normalize.undo", function() {
69481
- normalize2.undo(g4);
69592
+ normalize3.undo(g4);
69482
69593
  });
69483
69594
  time2(" fixupEdgeLabelCoords", function() {
69484
69595
  fixupEdgeLabelCoords(g4);
@@ -75849,8 +75960,8 @@ var require_resolve = __commonJS({
75849
75960
  }
75850
75961
  return count;
75851
75962
  }
75852
- function getFullPath(resolver, id = "", normalize2) {
75853
- if (normalize2 !== false)
75963
+ function getFullPath(resolver, id = "", normalize3) {
75964
+ if (normalize3 !== false)
75854
75965
  id = normalizeId(id);
75855
75966
  const p4 = resolver.parse(id);
75856
75967
  return _getFullPath(resolver, p4);
@@ -77190,7 +77301,7 @@ var require_fast_uri = __commonJS({
77190
77301
  "use strict";
77191
77302
  var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
77192
77303
  var { SCHEMES, getSchemeHandler } = require_schemes();
77193
- function normalize2(uri, options) {
77304
+ function normalize3(uri, options) {
77194
77305
  if (typeof uri === "string") {
77195
77306
  uri = /** @type {T} */
77196
77307
  serialize(parse6(uri, options), options);
@@ -77426,7 +77537,7 @@ var require_fast_uri = __commonJS({
77426
77537
  }
77427
77538
  var fastUri = {
77428
77539
  SCHEMES,
77429
- normalize: normalize2,
77540
+ normalize: normalize3,
77430
77541
  resolve: resolve5,
77431
77542
  resolveComponent,
77432
77543
  equal,
@@ -85077,46 +85188,72 @@ var init_ProbeAgent = __esm({
85077
85188
  * Initialize tools with configuration
85078
85189
  */
85079
85190
  initializeTools() {
85191
+ const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
85080
85192
  const configOptions = {
85081
85193
  sessionId: this.sessionId,
85082
85194
  debug: this.debug,
85083
85195
  defaultPath: this.allowedFolders.length > 0 ? this.allowedFolders[0] : process.cwd(),
85084
85196
  allowedFolders: this.allowedFolders,
85085
85197
  outline: this.outline,
85198
+ allowEdit: this.allowEdit,
85199
+ enableDelegate: this.enableDelegate,
85086
85200
  enableBash: this.enableBash,
85087
- bashConfig: this.bashConfig
85201
+ bashConfig: this.bashConfig,
85202
+ allowedTools: this.allowedTools,
85203
+ isToolAllowed
85088
85204
  };
85089
85205
  const baseTools = createTools(configOptions);
85090
85206
  const wrappedTools = createWrappedTools(baseTools);
85091
- this.toolImplementations = {
85092
- search: wrappedTools.searchToolInstance,
85093
- query: wrappedTools.queryToolInstance,
85094
- extract: wrappedTools.extractToolInstance,
85095
- delegate: wrappedTools.delegateToolInstance,
85096
- listFiles: listFilesToolInstance,
85097
- searchFiles: searchFilesToolInstance,
85098
- readImage: {
85207
+ this.toolImplementations = {};
85208
+ if (wrappedTools.searchToolInstance && isToolAllowed("search")) {
85209
+ this.toolImplementations.search = wrappedTools.searchToolInstance;
85210
+ }
85211
+ if (wrappedTools.queryToolInstance && isToolAllowed("query")) {
85212
+ this.toolImplementations.query = wrappedTools.queryToolInstance;
85213
+ }
85214
+ if (wrappedTools.extractToolInstance && isToolAllowed("extract")) {
85215
+ this.toolImplementations.extract = wrappedTools.extractToolInstance;
85216
+ }
85217
+ if (this.enableDelegate && wrappedTools.delegateToolInstance && isToolAllowed("delegate")) {
85218
+ this.toolImplementations.delegate = wrappedTools.delegateToolInstance;
85219
+ }
85220
+ if (isToolAllowed("listFiles")) {
85221
+ this.toolImplementations.listFiles = listFilesToolInstance;
85222
+ }
85223
+ if (isToolAllowed("searchFiles")) {
85224
+ this.toolImplementations.searchFiles = searchFilesToolInstance;
85225
+ }
85226
+ if (isToolAllowed("readImage")) {
85227
+ this.toolImplementations.readImage = {
85099
85228
  execute: async (params) => {
85100
85229
  const imagePath = params.path;
85101
85230
  if (!imagePath) {
85102
85231
  throw new Error("Image path is required");
85103
85232
  }
85233
+ const filename = (0, import_path12.basename)(imagePath);
85234
+ const extension = filename.toLowerCase().split(".").pop();
85235
+ if (!extension || !SUPPORTED_IMAGE_EXTENSIONS.includes(extension)) {
85236
+ throw new Error(`Invalid or unsupported image extension: ${extension}. Supported formats: ${SUPPORTED_IMAGE_EXTENSIONS.join(", ")}`);
85237
+ }
85238
+ if (this.apiType && !isFormatSupportedByProvider(extension, this.apiType)) {
85239
+ 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.`);
85240
+ }
85104
85241
  const loaded = await this.loadImageIfValid(imagePath);
85105
85242
  if (!loaded) {
85106
85243
  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.`);
85107
85244
  }
85108
85245
  return `Image loaded successfully: ${imagePath}. The image is now available for analysis in the conversation.`;
85109
85246
  }
85110
- }
85111
- };
85112
- if (this.enableBash && wrappedTools.bashToolInstance) {
85247
+ };
85248
+ }
85249
+ if (this.enableBash && wrappedTools.bashToolInstance && isToolAllowed("bash")) {
85113
85250
  this.toolImplementations.bash = wrappedTools.bashToolInstance;
85114
85251
  }
85115
85252
  if (this.allowEdit) {
85116
- if (wrappedTools.editToolInstance) {
85253
+ if (wrappedTools.editToolInstance && isToolAllowed("edit")) {
85117
85254
  this.toolImplementations.edit = wrappedTools.editToolInstance;
85118
85255
  }
85119
- if (wrappedTools.createToolInstance) {
85256
+ if (wrappedTools.createToolInstance && isToolAllowed("create")) {
85120
85257
  this.toolImplementations.create = wrappedTools.createToolInstance;
85121
85258
  }
85122
85259
  }
@@ -85719,12 +85856,16 @@ var init_ProbeAgent = __esm({
85719
85856
  let absolutePath;
85720
85857
  let isPathAllowed2 = false;
85721
85858
  if ((0, import_path12.isAbsolute)(imagePath)) {
85722
- absolutePath = imagePath;
85723
- isPathAllowed2 = allowedDirs.some((dir) => absolutePath.startsWith((0, import_path12.resolve)(dir)));
85859
+ absolutePath = (0, import_path12.normalize)((0, import_path12.resolve)(imagePath));
85860
+ isPathAllowed2 = allowedDirs.some((dir) => {
85861
+ const normalizedDir = (0, import_path12.normalize)((0, import_path12.resolve)(dir));
85862
+ return absolutePath === normalizedDir || absolutePath.startsWith(normalizedDir + import_path12.sep);
85863
+ });
85724
85864
  } else {
85725
85865
  for (const dir of allowedDirs) {
85726
- const resolvedPath2 = (0, import_path12.resolve)(dir, imagePath);
85727
- if (resolvedPath2.startsWith((0, import_path12.resolve)(dir))) {
85866
+ const normalizedDir = (0, import_path12.normalize)((0, import_path12.resolve)(dir));
85867
+ const resolvedPath2 = (0, import_path12.normalize)((0, import_path12.resolve)(dir, imagePath));
85868
+ if (resolvedPath2 === normalizedDir || resolvedPath2.startsWith(normalizedDir + import_path12.sep)) {
85728
85869
  absolutePath = resolvedPath2;
85729
85870
  isPathAllowed2 = true;
85730
85871
  break;
@@ -86732,8 +86873,8 @@ ${toolResultContent}
86732
86873
  // Pass parent session ID for tracking
86733
86874
  path: this.searchPath,
86734
86875
  // Inherit search path
86735
- provider: this.provider,
86736
- // Inherit AI provider
86876
+ provider: this.apiType,
86877
+ // Inherit AI provider (string identifier)
86737
86878
  model: this.model,
86738
86879
  // Inherit model
86739
86880
  debug: this.debug,
@@ -86742,7 +86883,7 @@ ${toolResultContent}
86742
86883
  if (this.debug) {
86743
86884
  console.log(`[DEBUG] Executing delegate tool at iteration ${currentIteration}/${maxIterations}`);
86744
86885
  console.log(`[DEBUG] Parent session: ${this.sessionId}`);
86745
- console.log(`[DEBUG] Inherited config: path=${this.searchPath}, provider=${this.provider}, model=${this.model}`);
86886
+ console.log(`[DEBUG] Inherited config: path=${this.searchPath}, provider=${this.apiType}, model=${this.model}`);
86746
86887
  console.log(`[DEBUG] Delegate task: ${toolParams.task?.substring(0, 100)}...`);
86747
86888
  }
86748
86889
  if (this.tracer) {
@@ -86809,9 +86950,6 @@ ${toolResultContent}
86809
86950
  role: "user",
86810
86951
  content: toolResultMessage
86811
86952
  });
86812
- if (toolResultContent) {
86813
- await this.processImageReferences(toolResultContent);
86814
- }
86815
86953
  if (this.debug) {
86816
86954
  console.log(`[DEBUG] Tool ${toolName} executed successfully. Result length: ${typeof toolResult === "string" ? toolResult.length : JSON.stringify(toolResult).length}`);
86817
86955
  }