@probelabs/probe 0.6.0-rc318 → 0.6.0-rc320

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.
@@ -20254,18 +20254,6 @@ var init_toUint8Array = __esm({
20254
20254
  }
20255
20255
  });
20256
20256
 
20257
- // node_modules/@smithy/core/dist-es/submodules/protocols/collect-stream-body.js
20258
- var init_collect_stream_body = __esm({
20259
- "node_modules/@smithy/core/dist-es/submodules/protocols/collect-stream-body.js"() {
20260
- }
20261
- });
20262
-
20263
- // node_modules/@smithy/core/dist-es/submodules/protocols/extended-encode-uri-component.js
20264
- var init_extended_encode_uri_component = __esm({
20265
- "node_modules/@smithy/core/dist-es/submodules/protocols/extended-encode-uri-component.js"() {
20266
- }
20267
- });
20268
-
20269
20257
  // node_modules/@smithy/types/dist-cjs/index.js
20270
20258
  var require_dist_cjs4 = __commonJS({
20271
20259
  "node_modules/@smithy/types/dist-cjs/index.js"(exports2) {
@@ -20353,19 +20341,44 @@ var require_dist_cjs4 = __commonJS({
20353
20341
  }
20354
20342
  });
20355
20343
 
20356
- // node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js
20344
+ // node_modules/@smithy/core/dist-es/submodules/transport/getSmithyContext.js
20357
20345
  var import_types, getSmithyContext;
20358
20346
  var init_getSmithyContext = __esm({
20359
- "node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js"() {
20347
+ "node_modules/@smithy/core/dist-es/submodules/transport/getSmithyContext.js"() {
20360
20348
  import_types = __toESM(require_dist_cjs4());
20361
20349
  getSmithyContext = (context) => context[import_types.SMITHY_CONTEXT_KEY] || (context[import_types.SMITHY_CONTEXT_KEY] = {});
20362
20350
  }
20363
20351
  });
20364
20352
 
20365
- // node_modules/@smithy/core/dist-es/submodules/client/util-middleware/normalizeProvider.js
20353
+ // node_modules/@smithy/core/dist-es/submodules/transport/httpResponse.js
20354
+ var HttpResponse;
20355
+ var init_httpResponse = __esm({
20356
+ "node_modules/@smithy/core/dist-es/submodules/transport/httpResponse.js"() {
20357
+ HttpResponse = class {
20358
+ statusCode;
20359
+ reason;
20360
+ headers;
20361
+ body;
20362
+ constructor(options) {
20363
+ this.statusCode = options.statusCode;
20364
+ this.reason = options.reason;
20365
+ this.headers = options.headers || {};
20366
+ this.body = options.body;
20367
+ }
20368
+ static isInstance(response) {
20369
+ if (!response)
20370
+ return false;
20371
+ const resp = response;
20372
+ return typeof resp.statusCode === "number" && typeof resp.headers === "object";
20373
+ }
20374
+ };
20375
+ }
20376
+ });
20377
+
20378
+ // node_modules/@smithy/core/dist-es/submodules/transport/normalizeProvider.js
20366
20379
  var normalizeProvider;
20367
20380
  var init_normalizeProvider = __esm({
20368
- "node_modules/@smithy/core/dist-es/submodules/client/util-middleware/normalizeProvider.js"() {
20381
+ "node_modules/@smithy/core/dist-es/submodules/transport/normalizeProvider.js"() {
20369
20382
  normalizeProvider = (input) => {
20370
20383
  if (typeof input === "function")
20371
20384
  return input;
@@ -20375,11 +20388,150 @@ var init_normalizeProvider = __esm({
20375
20388
  }
20376
20389
  });
20377
20390
 
20378
- // node_modules/@smithy/core/dist-es/submodules/client/index.js
20379
- var init_client = __esm({
20380
- "node_modules/@smithy/core/dist-es/submodules/client/index.js"() {
20391
+ // node_modules/@smithy/core/dist-es/submodules/transport/parseQueryString.js
20392
+ function parseQueryString(querystring) {
20393
+ const query2 = {};
20394
+ querystring = querystring.replace(/^\?/, "");
20395
+ if (querystring) {
20396
+ for (const pair of querystring.split("&")) {
20397
+ let [key, value = null] = pair.split("=");
20398
+ key = decodeURIComponent(key);
20399
+ if (value) {
20400
+ value = decodeURIComponent(value);
20401
+ }
20402
+ if (!(key in query2)) {
20403
+ query2[key] = value;
20404
+ } else if (Array.isArray(query2[key])) {
20405
+ query2[key].push(value);
20406
+ } else {
20407
+ query2[key] = [query2[key], value];
20408
+ }
20409
+ }
20410
+ }
20411
+ return query2;
20412
+ }
20413
+ var init_parseQueryString = __esm({
20414
+ "node_modules/@smithy/core/dist-es/submodules/transport/parseQueryString.js"() {
20415
+ }
20416
+ });
20417
+
20418
+ // node_modules/@smithy/core/dist-es/submodules/transport/parseUrl.js
20419
+ var parseUrl;
20420
+ var init_parseUrl = __esm({
20421
+ "node_modules/@smithy/core/dist-es/submodules/transport/parseUrl.js"() {
20422
+ init_parseQueryString();
20423
+ parseUrl = (url2) => {
20424
+ if (typeof url2 === "string") {
20425
+ return parseUrl(new URL(url2));
20426
+ }
20427
+ const { hostname: hostname2, pathname, port, protocol, search: search2 } = url2;
20428
+ let query2;
20429
+ if (search2) {
20430
+ query2 = parseQueryString(search2);
20431
+ }
20432
+ return {
20433
+ hostname: hostname2,
20434
+ port: port ? parseInt(port) : void 0,
20435
+ protocol,
20436
+ path: pathname,
20437
+ query: query2
20438
+ };
20439
+ };
20440
+ }
20441
+ });
20442
+
20443
+ // node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js
20444
+ var toEndpointV1;
20445
+ var init_toEndpointV1 = __esm({
20446
+ "node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js"() {
20447
+ init_parseUrl();
20448
+ toEndpointV1 = (endpoint) => {
20449
+ if (typeof endpoint === "object") {
20450
+ if ("url" in endpoint) {
20451
+ const v1Endpoint = parseUrl(endpoint.url);
20452
+ if (endpoint.headers) {
20453
+ v1Endpoint.headers = {};
20454
+ for (const name15 in endpoint.headers) {
20455
+ v1Endpoint.headers[name15.toLowerCase()] = endpoint.headers[name15].join(", ");
20456
+ }
20457
+ }
20458
+ return v1Endpoint;
20459
+ }
20460
+ return endpoint;
20461
+ }
20462
+ return parseUrl(endpoint);
20463
+ };
20464
+ }
20465
+ });
20466
+
20467
+ // node_modules/@smithy/core/dist-es/submodules/transport/index.js
20468
+ var init_transport = __esm({
20469
+ "node_modules/@smithy/core/dist-es/submodules/transport/index.js"() {
20381
20470
  init_getSmithyContext();
20471
+ init_httpResponse();
20382
20472
  init_normalizeProvider();
20473
+ init_toEndpointV1();
20474
+ }
20475
+ });
20476
+
20477
+ // node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js
20478
+ var deserializerMiddleware, findHeader;
20479
+ var init_deserializerMiddleware = __esm({
20480
+ "node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js"() {
20481
+ init_transport();
20482
+ deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
20483
+ const { response } = await next(args);
20484
+ try {
20485
+ const parsed = await deserializer(response, options);
20486
+ return {
20487
+ response,
20488
+ output: parsed
20489
+ };
20490
+ } catch (error40) {
20491
+ Object.defineProperty(error40, "$response", {
20492
+ value: response,
20493
+ enumerable: false,
20494
+ writable: false,
20495
+ configurable: false
20496
+ });
20497
+ if (!("$metadata" in error40)) {
20498
+ const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
20499
+ try {
20500
+ error40.message += "\n " + hint;
20501
+ } catch (e) {
20502
+ if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
20503
+ console.warn(hint);
20504
+ } else {
20505
+ context.logger?.warn?.(hint);
20506
+ }
20507
+ }
20508
+ if (typeof error40.$responseBodyText !== "undefined") {
20509
+ if (error40.$response) {
20510
+ error40.$response.body = error40.$responseBodyText;
20511
+ }
20512
+ }
20513
+ try {
20514
+ if (HttpResponse.isInstance(response)) {
20515
+ const { headers = {} } = response;
20516
+ const headerEntries = Object.entries(headers);
20517
+ error40.$metadata = {
20518
+ httpStatusCode: response.statusCode,
20519
+ requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
20520
+ extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
20521
+ cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
20522
+ };
20523
+ }
20524
+ } catch (e) {
20525
+ }
20526
+ }
20527
+ throw error40;
20528
+ }
20529
+ };
20530
+ findHeader = (pattern, headers) => {
20531
+ return (headers.find(([k]) => {
20532
+ return k.match(pattern);
20533
+ }) || [void 0, void 0])[1];
20534
+ };
20383
20535
  }
20384
20536
  });
20385
20537
 
@@ -20812,6 +20964,13 @@ var init_configLoader = __esm({
20812
20964
  }
20813
20965
  });
20814
20966
 
20967
+ // node_modules/@smithy/core/dist-es/submodules/client/index.js
20968
+ var init_client = __esm({
20969
+ "node_modules/@smithy/core/dist-es/submodules/client/index.js"() {
20970
+ init_transport();
20971
+ }
20972
+ });
20973
+
20815
20974
  // node_modules/@smithy/core/dist-es/submodules/config/index.js
20816
20975
  var init_config = __esm({
20817
20976
  "node_modules/@smithy/core/dist-es/submodules/config/index.js"() {
@@ -20969,34 +21128,10 @@ var init_createConfigValueProvider = __esm({
20969
21128
  }
20970
21129
  });
20971
21130
 
20972
- // node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js
20973
- var toEndpointV1;
20974
- var init_toEndpointV1 = __esm({
20975
- "node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js"() {
20976
- init_protocols();
20977
- toEndpointV1 = (endpoint) => {
20978
- if (typeof endpoint === "object") {
20979
- if ("url" in endpoint) {
20980
- const v1Endpoint = parseUrl(endpoint.url);
20981
- if (endpoint.headers) {
20982
- v1Endpoint.headers = {};
20983
- for (const name15 in endpoint.headers) {
20984
- v1Endpoint.headers[name15.toLowerCase()] = endpoint.headers[name15].join(", ");
20985
- }
20986
- }
20987
- return v1Endpoint;
20988
- }
20989
- return endpoint;
20990
- }
20991
- return parseUrl(endpoint);
20992
- };
20993
- }
20994
- });
20995
-
20996
21131
  // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js
20997
21132
  var init_toEndpointV12 = __esm({
20998
21133
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js"() {
20999
- init_toEndpointV1();
21134
+ init_transport();
21000
21135
  }
21001
21136
  });
21002
21137
 
@@ -21182,7 +21317,7 @@ function bindResolveEndpointConfig(getEndpointFromConfig2) {
21182
21317
  }
21183
21318
  var init_resolveEndpointConfig = __esm({
21184
21319
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js"() {
21185
- init_client();
21320
+ init_transport();
21186
21321
  init_toEndpointV12();
21187
21322
  }
21188
21323
  });
@@ -21251,7 +21386,7 @@ var init_endpoints = __esm({
21251
21386
  init_endpointMiddleware();
21252
21387
  init_getEndpointPlugin();
21253
21388
  init_resolveEndpointConfig();
21254
- init_toEndpointV1();
21389
+ init_transport();
21255
21390
  init_types2();
21256
21391
  getEndpointFromInstructions = bindGetEndpointFromInstructions(getEndpointFromConfig);
21257
21392
  resolveEndpointConfig = bindResolveEndpointConfig(getEndpointFromConfig);
@@ -21260,231 +21395,6 @@ var init_endpoints = __esm({
21260
21395
  }
21261
21396
  });
21262
21397
 
21263
- // node_modules/@smithy/core/dist-es/submodules/protocols/SerdeContext.js
21264
- var init_SerdeContext = __esm({
21265
- "node_modules/@smithy/core/dist-es/submodules/protocols/SerdeContext.js"() {
21266
- }
21267
- });
21268
-
21269
- // node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpResponse.js
21270
- var HttpResponse;
21271
- var init_httpResponse = __esm({
21272
- "node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpResponse.js"() {
21273
- HttpResponse = class {
21274
- statusCode;
21275
- reason;
21276
- headers;
21277
- body;
21278
- constructor(options) {
21279
- this.statusCode = options.statusCode;
21280
- this.reason = options.reason;
21281
- this.headers = options.headers || {};
21282
- this.body = options.body;
21283
- }
21284
- static isInstance(response) {
21285
- if (!response)
21286
- return false;
21287
- const resp = response;
21288
- return typeof resp.statusCode === "number" && typeof resp.headers === "object";
21289
- }
21290
- };
21291
- }
21292
- });
21293
-
21294
- // node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js
21295
- var init_HttpProtocol = __esm({
21296
- "node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js"() {
21297
- }
21298
- });
21299
-
21300
- // node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js
21301
- var init_HttpBindingProtocol = __esm({
21302
- "node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js"() {
21303
- }
21304
- });
21305
-
21306
- // node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js
21307
- var init_RpcProtocol = __esm({
21308
- "node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js"() {
21309
- }
21310
- });
21311
-
21312
- // node_modules/@smithy/core/dist-es/submodules/protocols/resolve-path.js
21313
- var init_resolve_path = __esm({
21314
- "node_modules/@smithy/core/dist-es/submodules/protocols/resolve-path.js"() {
21315
- }
21316
- });
21317
-
21318
- // node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js
21319
- var init_requestBuilder = __esm({
21320
- "node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js"() {
21321
- }
21322
- });
21323
-
21324
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js
21325
- var init_determineTimestampFormat = __esm({
21326
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js"() {
21327
- }
21328
- });
21329
-
21330
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js
21331
- var init_FromStringShapeDeserializer = __esm({
21332
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js"() {
21333
- }
21334
- });
21335
-
21336
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js
21337
- var init_HttpInterceptingShapeDeserializer = __esm({
21338
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js"() {
21339
- }
21340
- });
21341
-
21342
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js
21343
- var init_ToStringShapeSerializer = __esm({
21344
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js"() {
21345
- }
21346
- });
21347
-
21348
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js
21349
- var init_HttpInterceptingShapeSerializer = __esm({
21350
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js"() {
21351
- }
21352
- });
21353
-
21354
- // node_modules/@smithy/core/dist-es/submodules/protocols/querystring-parser/parseQueryString.js
21355
- function parseQueryString(querystring) {
21356
- const query2 = {};
21357
- querystring = querystring.replace(/^\?/, "");
21358
- if (querystring) {
21359
- for (const pair of querystring.split("&")) {
21360
- let [key, value = null] = pair.split("=");
21361
- key = decodeURIComponent(key);
21362
- if (value) {
21363
- value = decodeURIComponent(value);
21364
- }
21365
- if (!(key in query2)) {
21366
- query2[key] = value;
21367
- } else if (Array.isArray(query2[key])) {
21368
- query2[key].push(value);
21369
- } else {
21370
- query2[key] = [query2[key], value];
21371
- }
21372
- }
21373
- }
21374
- return query2;
21375
- }
21376
- var init_parseQueryString = __esm({
21377
- "node_modules/@smithy/core/dist-es/submodules/protocols/querystring-parser/parseQueryString.js"() {
21378
- }
21379
- });
21380
-
21381
- // node_modules/@smithy/core/dist-es/submodules/protocols/url-parser/parseUrl.js
21382
- var parseUrl;
21383
- var init_parseUrl = __esm({
21384
- "node_modules/@smithy/core/dist-es/submodules/protocols/url-parser/parseUrl.js"() {
21385
- init_parseQueryString();
21386
- parseUrl = (url2) => {
21387
- if (typeof url2 === "string") {
21388
- return parseUrl(new URL(url2));
21389
- }
21390
- const { hostname: hostname2, pathname, port, protocol, search: search2 } = url2;
21391
- let query2;
21392
- if (search2) {
21393
- query2 = parseQueryString(search2);
21394
- }
21395
- return {
21396
- hostname: hostname2,
21397
- port: port ? parseInt(port) : void 0,
21398
- protocol,
21399
- path: pathname,
21400
- query: query2
21401
- };
21402
- };
21403
- }
21404
- });
21405
-
21406
- // node_modules/@smithy/core/dist-es/submodules/protocols/index.js
21407
- var init_protocols = __esm({
21408
- "node_modules/@smithy/core/dist-es/submodules/protocols/index.js"() {
21409
- init_collect_stream_body();
21410
- init_extended_encode_uri_component();
21411
- init_HttpBindingProtocol();
21412
- init_HttpProtocol();
21413
- init_RpcProtocol();
21414
- init_requestBuilder();
21415
- init_resolve_path();
21416
- init_FromStringShapeDeserializer();
21417
- init_HttpInterceptingShapeDeserializer();
21418
- init_HttpInterceptingShapeSerializer();
21419
- init_ToStringShapeSerializer();
21420
- init_determineTimestampFormat();
21421
- init_SerdeContext();
21422
- init_httpResponse();
21423
- init_parseUrl();
21424
- }
21425
- });
21426
-
21427
- // node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js
21428
- var deserializerMiddleware, findHeader;
21429
- var init_deserializerMiddleware = __esm({
21430
- "node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js"() {
21431
- init_protocols();
21432
- deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
21433
- const { response } = await next(args);
21434
- try {
21435
- const parsed = await deserializer(response, options);
21436
- return {
21437
- response,
21438
- output: parsed
21439
- };
21440
- } catch (error40) {
21441
- Object.defineProperty(error40, "$response", {
21442
- value: response,
21443
- enumerable: false,
21444
- writable: false,
21445
- configurable: false
21446
- });
21447
- if (!("$metadata" in error40)) {
21448
- const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
21449
- try {
21450
- error40.message += "\n " + hint;
21451
- } catch (e) {
21452
- if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
21453
- console.warn(hint);
21454
- } else {
21455
- context.logger?.warn?.(hint);
21456
- }
21457
- }
21458
- if (typeof error40.$responseBodyText !== "undefined") {
21459
- if (error40.$response) {
21460
- error40.$response.body = error40.$responseBodyText;
21461
- }
21462
- }
21463
- try {
21464
- if (HttpResponse.isInstance(response)) {
21465
- const { headers = {} } = response;
21466
- const headerEntries = Object.entries(headers);
21467
- error40.$metadata = {
21468
- httpStatusCode: response.statusCode,
21469
- requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
21470
- extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
21471
- cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
21472
- };
21473
- }
21474
- } catch (e) {
21475
- }
21476
- }
21477
- throw error40;
21478
- }
21479
- };
21480
- findHeader = (pattern, headers) => {
21481
- return (headers.find(([k]) => {
21482
- return k.match(pattern);
21483
- }) || [void 0, void 0])[1];
21484
- };
21485
- }
21486
- });
21487
-
21488
21398
  // node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/serializerMiddleware.js
21489
21399
  var serializerMiddleware;
21490
21400
  var init_serializerMiddleware = __esm({
@@ -24183,32 +24093,62 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
24183
24093
  const output = part.output;
24184
24094
  switch (output.type) {
24185
24095
  case "content": {
24186
- toolResultContent = output.value.map((contentPart) => {
24187
- switch (contentPart.type) {
24188
- case "text":
24189
- return { text: contentPart.text };
24190
- case "image-data":
24191
- if (!contentPart.mediaType.startsWith("image/")) {
24096
+ toolResultContent = await Promise.all(
24097
+ output.value.map(async (contentPart) => {
24098
+ switch (contentPart.type) {
24099
+ case "text":
24100
+ return { text: contentPart.text };
24101
+ case "image-data": {
24102
+ return {
24103
+ image: {
24104
+ format: getBedrockImageFormat(
24105
+ contentPart.mediaType
24106
+ ),
24107
+ source: {
24108
+ bytes: convertToBase64(contentPart.data)
24109
+ }
24110
+ }
24111
+ };
24112
+ }
24113
+ case "file-data": {
24114
+ if (!contentPart.mediaType.startsWith("image/")) {
24115
+ const enableCitations = await shouldEnableCitations(
24116
+ contentPart.providerOptions
24117
+ );
24118
+ return {
24119
+ document: {
24120
+ format: getBedrockDocumentFormat(
24121
+ contentPart.mediaType
24122
+ ),
24123
+ name: "filename" in contentPart && contentPart.filename ? stripFileExtension(contentPart.filename) : generateDocumentName(),
24124
+ source: {
24125
+ bytes: convertToBase64(contentPart.data)
24126
+ },
24127
+ ...enableCitations && {
24128
+ citations: { enabled: true }
24129
+ }
24130
+ }
24131
+ };
24132
+ }
24133
+ return {
24134
+ image: {
24135
+ format: getBedrockImageFormat(
24136
+ contentPart.mediaType
24137
+ ),
24138
+ source: {
24139
+ bytes: convertToBase64(contentPart.data)
24140
+ }
24141
+ }
24142
+ };
24143
+ }
24144
+ default: {
24192
24145
  throw new UnsupportedFunctionalityError({
24193
- functionality: `media type: ${contentPart.mediaType}`
24146
+ functionality: `unsupported tool content part type: ${contentPart.type}`
24194
24147
  });
24195
24148
  }
24196
- const format2 = getBedrockImageFormat(
24197
- contentPart.mediaType
24198
- );
24199
- return {
24200
- image: {
24201
- format: format2,
24202
- source: { bytes: contentPart.data }
24203
- }
24204
- };
24205
- default: {
24206
- throw new UnsupportedFunctionalityError({
24207
- functionality: `unsupported tool content part type: ${contentPart.type}`
24208
- });
24209
24149
  }
24210
- }
24211
- });
24150
+ })
24151
+ );
24212
24152
  break;
24213
24153
  }
24214
24154
  case "text":
@@ -25994,7 +25934,7 @@ var init_dist3 = __esm({
25994
25934
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
25995
25935
  preview: external_exports.unknown().optional()
25996
25936
  });
25997
- VERSION2 = true ? "4.0.107" : "0.0.0-test";
25937
+ VERSION2 = true ? "4.0.111" : "0.0.0-test";
25998
25938
  bedrockRerankingResponseSchema = lazySchema(
25999
25939
  () => zodSchema(
26000
25940
  external_exports.object({
@@ -32567,8 +32507,9 @@ Change your strategy:${scopeHint}
32567
32507
  }
32568
32508
  }
32569
32509
  const delegatePath = searchPath || "";
32510
+ const samePathDelegations = previousDelegations.filter((d) => d.path === delegatePath);
32570
32511
  let effectiveQuery = searchQuery;
32571
- if (previousDelegations.length > 0) {
32512
+ if (samePathDelegations.length > 0) {
32572
32513
  const dedupProvider = options.searchDelegateProvider || process.env.PROBE_SEARCH_DELEGATE_PROVIDER || options.provider || process.env.FORCE_PROVIDER || null;
32573
32514
  const dedupModelName = options.searchDelegateModel || process.env.PROBE_SEARCH_DELEGATE_MODEL || options.model || process.env.MODEL_NAME || null;
32574
32515
  if (cachedDedupModel === void 0) {
@@ -32582,14 +32523,14 @@ Change your strategy:${scopeHint}
32582
32523
  }
32583
32524
  const dedupSpanAttrs = {
32584
32525
  "dedup.query": searchQuery,
32585
- "dedup.previous_count": String(previousDelegations.length),
32586
- "dedup.previous_queries": previousDelegations.map((d) => d.query).join(" | "),
32526
+ "dedup.previous_count": String(samePathDelegations.length),
32527
+ "dedup.previous_queries": samePathDelegations.map((d) => d.query).join(" | "),
32587
32528
  "dedup.provider": dedupProvider || "",
32588
32529
  "dedup.model": dedupModelName || "",
32589
32530
  "dedup.model_available": cachedDedupModel ? "true" : "false"
32590
32531
  };
32591
32532
  const dedup = options.tracer?.withSpan ? await options.tracer.withSpan("search.delegate.dedup", async () => {
32592
- return await checkDelegateDedup(searchQuery, previousDelegations, cachedDedupModel, debug);
32533
+ return await checkDelegateDedup(searchQuery, samePathDelegations, cachedDedupModel, debug);
32593
32534
  }, dedupSpanAttrs, (span, result) => {
32594
32535
  span.setAttributes({
32595
32536
  "dedup.action": result.action,
@@ -32597,12 +32538,12 @@ Change your strategy:${scopeHint}
32597
32538
  "dedup.rewritten": result.rewritten || "",
32598
32539
  "dedup.error": result.error || ""
32599
32540
  });
32600
- }) : await checkDelegateDedup(searchQuery, previousDelegations, cachedDedupModel, debug);
32541
+ }) : await checkDelegateDedup(searchQuery, samePathDelegations, cachedDedupModel, debug);
32601
32542
  if (debug) {
32602
32543
  console.error(`[DEDUP-LLM] Query: "${searchQuery}" \u2192 ${dedup.action}: ${dedup.reason}${dedup.rewritten ? ` \u2192 "${dedup.rewritten}"` : ""}`);
32603
32544
  }
32604
32545
  if (dedup.action === "block") {
32605
- const prevQueries = previousDelegations.map((d) => `"${d.query}"`).join(", ");
32546
+ const prevQueries = samePathDelegations.map((d) => `"${d.query}"`).join(", ");
32606
32547
  return `DELEGATE BLOCKED: "${searchQuery}" is semantically duplicate of previous delegation(s) [${prevQueries}]. ${dedup.reason}
32607
32548
 
32608
32549
  Do NOT re-delegate the same concept. Use extract() on files already found, or synthesize your answer from existing results.`;
@@ -46244,7 +46185,7 @@ var require_brace_expansion = __commonJS({
46244
46185
  }
46245
46186
  var pad = n.some(isPadded);
46246
46187
  N = [];
46247
- for (var i = x; test(i, y); i += incr) {
46188
+ for (var i = x; test(i, y) && N.length < max; i += incr) {
46248
46189
  var c;
46249
46190
  if (isAlphaSequence) {
46250
46191
  c = String.fromCharCode(i);
@@ -94545,11 +94486,11 @@ function createHttpTransport(url2) {
94545
94486
  }
94546
94487
  };
94547
94488
  }
94548
- var import_client3, import_stdio, import_sse, import_websocket, MCPClientManager;
94489
+ var import_client2, import_stdio, import_sse, import_websocket, MCPClientManager;
94549
94490
  var init_client2 = __esm({
94550
94491
  "src/agent/mcp/client.js"() {
94551
94492
  "use strict";
94552
- import_client3 = require("@modelcontextprotocol/sdk/client/index.js");
94493
+ import_client2 = require("@modelcontextprotocol/sdk/client/index.js");
94553
94494
  import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
94554
94495
  import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
94555
94496
  import_websocket = require("@modelcontextprotocol/sdk/client/websocket.js");
@@ -94660,7 +94601,7 @@ var init_client2 = __esm({
94660
94601
  console.error(`[MCP DEBUG] Connecting to ${name15} via ${serverConfig.transport}...`);
94661
94602
  }
94662
94603
  const transport = createTransport(serverConfig);
94663
- const client = new import_client3.Client(
94604
+ const client = new import_client2.Client(
94664
94605
  {
94665
94606
  name: `probe-client-${name15}`,
94666
94607
  version: "1.0.0"
@@ -105249,7 +105190,8 @@ __export(ProbeAgent_exports, {
105249
105190
  ENGINE_ACTIVITY_TIMEOUT_MIN: () => ENGINE_ACTIVITY_TIMEOUT_MIN,
105250
105191
  ProbeAgent: () => ProbeAgent,
105251
105192
  debugLogToolResults: () => debugLogToolResults,
105252
- debugTruncate: () => debugTruncate
105193
+ debugTruncate: () => debugTruncate,
105194
+ sanitizeToolInputSchema: () => sanitizeToolInputSchema
105253
105195
  });
105254
105196
  module.exports = __toCommonJS(ProbeAgent_exports);
105255
105197
  function debugTruncate(s, limit = 200) {
@@ -105265,6 +105207,66 @@ function debugLogToolResults(toolResults) {
105265
105207
  console.log(`[DEBUG] tool: ${tr.toolName} | args: ${debugTruncate(argsStr)} | result: ${debugTruncate(resultStr)}`);
105266
105208
  }
105267
105209
  }
105210
+ function isPlainJsonSchemaObject(value) {
105211
+ return value && typeof value === "object" && !Array.isArray(value) && !value._def;
105212
+ }
105213
+ function sanitizeRequiredFieldsInJsonSchema(schema) {
105214
+ if (!isPlainJsonSchemaObject(schema)) {
105215
+ return;
105216
+ }
105217
+ if (Array.isArray(schema.required) && isPlainJsonSchemaObject(schema.properties)) {
105218
+ const propertyNames = new Set(Object.keys(schema.properties));
105219
+ const filteredRequired = schema.required.filter((name15) => propertyNames.has(name15));
105220
+ if (filteredRequired.length > 0) {
105221
+ schema.required = filteredRequired;
105222
+ } else {
105223
+ delete schema.required;
105224
+ }
105225
+ }
105226
+ const visitSchemaMap = (schemaMap) => {
105227
+ if (!isPlainJsonSchemaObject(schemaMap)) return;
105228
+ for (const childSchema of Object.values(schemaMap)) {
105229
+ sanitizeRequiredFieldsInJsonSchema(childSchema);
105230
+ }
105231
+ };
105232
+ visitSchemaMap(schema.properties);
105233
+ visitSchemaMap(schema.patternProperties);
105234
+ visitSchemaMap(schema.definitions);
105235
+ visitSchemaMap(schema.$defs);
105236
+ visitSchemaMap(schema.dependentSchemas);
105237
+ if (isPlainJsonSchemaObject(schema.items)) {
105238
+ sanitizeRequiredFieldsInJsonSchema(schema.items);
105239
+ } else if (Array.isArray(schema.items)) {
105240
+ for (const itemSchema of schema.items) {
105241
+ sanitizeRequiredFieldsInJsonSchema(itemSchema);
105242
+ }
105243
+ }
105244
+ for (const keyword of ["allOf", "anyOf", "oneOf"]) {
105245
+ if (Array.isArray(schema[keyword])) {
105246
+ for (const childSchema of schema[keyword]) {
105247
+ sanitizeRequiredFieldsInJsonSchema(childSchema);
105248
+ }
105249
+ }
105250
+ }
105251
+ if (isPlainJsonSchemaObject(schema.not)) {
105252
+ sanitizeRequiredFieldsInJsonSchema(schema.not);
105253
+ }
105254
+ if (isPlainJsonSchemaObject(schema.additionalProperties)) {
105255
+ sanitizeRequiredFieldsInJsonSchema(schema.additionalProperties);
105256
+ }
105257
+ }
105258
+ function sanitizeToolInputSchema(schema) {
105259
+ if (!isPlainJsonSchemaObject(schema)) {
105260
+ return schema;
105261
+ }
105262
+ try {
105263
+ const clonedSchema = JSON.parse(JSON.stringify(schema));
105264
+ sanitizeRequiredFieldsInJsonSchema(clonedSchema);
105265
+ return clonedSchema;
105266
+ } catch {
105267
+ return schema;
105268
+ }
105269
+ }
105268
105270
  var import_dotenv2, import_ai6, import_crypto9, import_events4, import_fs15, import_promises7, import_path18, ENGINE_ACTIVITY_TIMEOUT_DEFAULT, ENGINE_ACTIVITY_TIMEOUT_MIN, ENGINE_ACTIVITY_TIMEOUT_MAX, MAX_TOOL_ITERATIONS, MAX_HISTORY_MESSAGES, MAX_IMAGE_FILE_SIZE, MAX_DOCUMENT_FILE_SIZE, ProbeAgent;
105269
105271
  var init_ProbeAgent = __esm({
105270
105272
  "src/agent/ProbeAgent.js"() {
@@ -106682,7 +106684,8 @@ var init_ProbeAgent = __esm({
106682
106684
  const nativeTools = {};
106683
106685
  const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
106684
106686
  const wrapTool = (toolName, schema, description, executeFn) => {
106685
- const resolvedSchema = schema && schema._def ? schema : (0, import_ai6.jsonSchema)(schema);
106687
+ const sanitizedSchema = sanitizeToolInputSchema(schema);
106688
+ const resolvedSchema = sanitizedSchema && sanitizedSchema._def ? sanitizedSchema : (0, import_ai6.jsonSchema)(sanitizedSchema);
106686
106689
  return (0, import_ai6.tool)({
106687
106690
  description,
106688
106691
  inputSchema: resolvedSchema,
@@ -106840,8 +106843,9 @@ var init_ProbeAgent = __esm({
106840
106843
  if (this.mcpBridge && !options._disableTools) {
106841
106844
  const mcpTools = this.mcpBridge.getVercelTools(this._filterMcpTools(this.mcpBridge.getToolNames()));
106842
106845
  for (const [name15, mcpTool] of Object.entries(mcpTools)) {
106843
- const mcpSchema = mcpTool.inputSchema || mcpTool.parameters;
106844
- const wrappedSchema = mcpSchema && mcpSchema._def ? mcpSchema : (0, import_ai6.jsonSchema)(mcpSchema || { type: "object", properties: {} });
106846
+ const mcpSchema = mcpTool.inputSchema || mcpTool.parameters || { type: "object", properties: {} };
106847
+ const sanitizedSchema = sanitizeToolInputSchema(mcpSchema);
106848
+ const wrappedSchema = sanitizedSchema && sanitizedSchema._def ? sanitizedSchema : (0, import_ai6.jsonSchema)(sanitizedSchema);
106845
106849
  nativeTools[name15] = (0, import_ai6.tool)({
106846
106850
  description: mcpTool.description || `MCP tool: ${name15}`,
106847
106851
  inputSchema: wrappedSchema,
@@ -109850,7 +109854,8 @@ init_ProbeAgent();
109850
109854
  ENGINE_ACTIVITY_TIMEOUT_MIN,
109851
109855
  ProbeAgent,
109852
109856
  debugLogToolResults,
109853
- debugTruncate
109857
+ debugTruncate,
109858
+ sanitizeToolInputSchema
109854
109859
  });
109855
109860
  /*! Bundled license information:
109856
109861