@probelabs/probe 0.6.0-rc319 → 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.
package/cjs/index.cjs CHANGED
@@ -22183,18 +22183,6 @@ var init_toUint8Array = __esm({
22183
22183
  }
22184
22184
  });
22185
22185
 
22186
- // node_modules/@smithy/core/dist-es/submodules/protocols/collect-stream-body.js
22187
- var init_collect_stream_body = __esm({
22188
- "node_modules/@smithy/core/dist-es/submodules/protocols/collect-stream-body.js"() {
22189
- }
22190
- });
22191
-
22192
- // node_modules/@smithy/core/dist-es/submodules/protocols/extended-encode-uri-component.js
22193
- var init_extended_encode_uri_component = __esm({
22194
- "node_modules/@smithy/core/dist-es/submodules/protocols/extended-encode-uri-component.js"() {
22195
- }
22196
- });
22197
-
22198
22186
  // node_modules/@smithy/types/dist-cjs/index.js
22199
22187
  var require_dist_cjs4 = __commonJS({
22200
22188
  "node_modules/@smithy/types/dist-cjs/index.js"(exports2) {
@@ -22282,19 +22270,44 @@ var require_dist_cjs4 = __commonJS({
22282
22270
  }
22283
22271
  });
22284
22272
 
22285
- // node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js
22273
+ // node_modules/@smithy/core/dist-es/submodules/transport/getSmithyContext.js
22286
22274
  var import_types, getSmithyContext;
22287
22275
  var init_getSmithyContext = __esm({
22288
- "node_modules/@smithy/core/dist-es/submodules/client/util-middleware/getSmithyContext.js"() {
22276
+ "node_modules/@smithy/core/dist-es/submodules/transport/getSmithyContext.js"() {
22289
22277
  import_types = __toESM(require_dist_cjs4());
22290
22278
  getSmithyContext = (context) => context[import_types.SMITHY_CONTEXT_KEY] || (context[import_types.SMITHY_CONTEXT_KEY] = {});
22291
22279
  }
22292
22280
  });
22293
22281
 
22294
- // node_modules/@smithy/core/dist-es/submodules/client/util-middleware/normalizeProvider.js
22282
+ // node_modules/@smithy/core/dist-es/submodules/transport/httpResponse.js
22283
+ var HttpResponse;
22284
+ var init_httpResponse = __esm({
22285
+ "node_modules/@smithy/core/dist-es/submodules/transport/httpResponse.js"() {
22286
+ HttpResponse = class {
22287
+ statusCode;
22288
+ reason;
22289
+ headers;
22290
+ body;
22291
+ constructor(options) {
22292
+ this.statusCode = options.statusCode;
22293
+ this.reason = options.reason;
22294
+ this.headers = options.headers || {};
22295
+ this.body = options.body;
22296
+ }
22297
+ static isInstance(response) {
22298
+ if (!response)
22299
+ return false;
22300
+ const resp = response;
22301
+ return typeof resp.statusCode === "number" && typeof resp.headers === "object";
22302
+ }
22303
+ };
22304
+ }
22305
+ });
22306
+
22307
+ // node_modules/@smithy/core/dist-es/submodules/transport/normalizeProvider.js
22295
22308
  var normalizeProvider;
22296
22309
  var init_normalizeProvider = __esm({
22297
- "node_modules/@smithy/core/dist-es/submodules/client/util-middleware/normalizeProvider.js"() {
22310
+ "node_modules/@smithy/core/dist-es/submodules/transport/normalizeProvider.js"() {
22298
22311
  normalizeProvider = (input) => {
22299
22312
  if (typeof input === "function")
22300
22313
  return input;
@@ -22304,11 +22317,150 @@ var init_normalizeProvider = __esm({
22304
22317
  }
22305
22318
  });
22306
22319
 
22307
- // node_modules/@smithy/core/dist-es/submodules/client/index.js
22308
- var init_client = __esm({
22309
- "node_modules/@smithy/core/dist-es/submodules/client/index.js"() {
22320
+ // node_modules/@smithy/core/dist-es/submodules/transport/parseQueryString.js
22321
+ function parseQueryString(querystring) {
22322
+ const query2 = {};
22323
+ querystring = querystring.replace(/^\?/, "");
22324
+ if (querystring) {
22325
+ for (const pair of querystring.split("&")) {
22326
+ let [key, value = null] = pair.split("=");
22327
+ key = decodeURIComponent(key);
22328
+ if (value) {
22329
+ value = decodeURIComponent(value);
22330
+ }
22331
+ if (!(key in query2)) {
22332
+ query2[key] = value;
22333
+ } else if (Array.isArray(query2[key])) {
22334
+ query2[key].push(value);
22335
+ } else {
22336
+ query2[key] = [query2[key], value];
22337
+ }
22338
+ }
22339
+ }
22340
+ return query2;
22341
+ }
22342
+ var init_parseQueryString = __esm({
22343
+ "node_modules/@smithy/core/dist-es/submodules/transport/parseQueryString.js"() {
22344
+ }
22345
+ });
22346
+
22347
+ // node_modules/@smithy/core/dist-es/submodules/transport/parseUrl.js
22348
+ var parseUrl;
22349
+ var init_parseUrl = __esm({
22350
+ "node_modules/@smithy/core/dist-es/submodules/transport/parseUrl.js"() {
22351
+ init_parseQueryString();
22352
+ parseUrl = (url2) => {
22353
+ if (typeof url2 === "string") {
22354
+ return parseUrl(new URL(url2));
22355
+ }
22356
+ const { hostname: hostname2, pathname, port, protocol, search: search2 } = url2;
22357
+ let query2;
22358
+ if (search2) {
22359
+ query2 = parseQueryString(search2);
22360
+ }
22361
+ return {
22362
+ hostname: hostname2,
22363
+ port: port ? parseInt(port) : void 0,
22364
+ protocol,
22365
+ path: pathname,
22366
+ query: query2
22367
+ };
22368
+ };
22369
+ }
22370
+ });
22371
+
22372
+ // node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js
22373
+ var toEndpointV1;
22374
+ var init_toEndpointV1 = __esm({
22375
+ "node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js"() {
22376
+ init_parseUrl();
22377
+ toEndpointV1 = (endpoint) => {
22378
+ if (typeof endpoint === "object") {
22379
+ if ("url" in endpoint) {
22380
+ const v1Endpoint = parseUrl(endpoint.url);
22381
+ if (endpoint.headers) {
22382
+ v1Endpoint.headers = {};
22383
+ for (const name15 in endpoint.headers) {
22384
+ v1Endpoint.headers[name15.toLowerCase()] = endpoint.headers[name15].join(", ");
22385
+ }
22386
+ }
22387
+ return v1Endpoint;
22388
+ }
22389
+ return endpoint;
22390
+ }
22391
+ return parseUrl(endpoint);
22392
+ };
22393
+ }
22394
+ });
22395
+
22396
+ // node_modules/@smithy/core/dist-es/submodules/transport/index.js
22397
+ var init_transport = __esm({
22398
+ "node_modules/@smithy/core/dist-es/submodules/transport/index.js"() {
22310
22399
  init_getSmithyContext();
22400
+ init_httpResponse();
22311
22401
  init_normalizeProvider();
22402
+ init_toEndpointV1();
22403
+ }
22404
+ });
22405
+
22406
+ // node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js
22407
+ var deserializerMiddleware, findHeader;
22408
+ var init_deserializerMiddleware = __esm({
22409
+ "node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js"() {
22410
+ init_transport();
22411
+ deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
22412
+ const { response } = await next(args);
22413
+ try {
22414
+ const parsed = await deserializer(response, options);
22415
+ return {
22416
+ response,
22417
+ output: parsed
22418
+ };
22419
+ } catch (error40) {
22420
+ Object.defineProperty(error40, "$response", {
22421
+ value: response,
22422
+ enumerable: false,
22423
+ writable: false,
22424
+ configurable: false
22425
+ });
22426
+ if (!("$metadata" in error40)) {
22427
+ const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
22428
+ try {
22429
+ error40.message += "\n " + hint;
22430
+ } catch (e) {
22431
+ if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
22432
+ console.warn(hint);
22433
+ } else {
22434
+ context.logger?.warn?.(hint);
22435
+ }
22436
+ }
22437
+ if (typeof error40.$responseBodyText !== "undefined") {
22438
+ if (error40.$response) {
22439
+ error40.$response.body = error40.$responseBodyText;
22440
+ }
22441
+ }
22442
+ try {
22443
+ if (HttpResponse.isInstance(response)) {
22444
+ const { headers = {} } = response;
22445
+ const headerEntries = Object.entries(headers);
22446
+ error40.$metadata = {
22447
+ httpStatusCode: response.statusCode,
22448
+ requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
22449
+ extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
22450
+ cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
22451
+ };
22452
+ }
22453
+ } catch (e) {
22454
+ }
22455
+ }
22456
+ throw error40;
22457
+ }
22458
+ };
22459
+ findHeader = (pattern, headers) => {
22460
+ return (headers.find(([k]) => {
22461
+ return k.match(pattern);
22462
+ }) || [void 0, void 0])[1];
22463
+ };
22312
22464
  }
22313
22465
  });
22314
22466
 
@@ -22741,6 +22893,13 @@ var init_configLoader = __esm({
22741
22893
  }
22742
22894
  });
22743
22895
 
22896
+ // node_modules/@smithy/core/dist-es/submodules/client/index.js
22897
+ var init_client = __esm({
22898
+ "node_modules/@smithy/core/dist-es/submodules/client/index.js"() {
22899
+ init_transport();
22900
+ }
22901
+ });
22902
+
22744
22903
  // node_modules/@smithy/core/dist-es/submodules/config/index.js
22745
22904
  var init_config = __esm({
22746
22905
  "node_modules/@smithy/core/dist-es/submodules/config/index.js"() {
@@ -22898,34 +23057,10 @@ var init_createConfigValueProvider = __esm({
22898
23057
  }
22899
23058
  });
22900
23059
 
22901
- // node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js
22902
- var toEndpointV1;
22903
- var init_toEndpointV1 = __esm({
22904
- "node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js"() {
22905
- init_protocols();
22906
- toEndpointV1 = (endpoint) => {
22907
- if (typeof endpoint === "object") {
22908
- if ("url" in endpoint) {
22909
- const v1Endpoint = parseUrl(endpoint.url);
22910
- if (endpoint.headers) {
22911
- v1Endpoint.headers = {};
22912
- for (const name15 in endpoint.headers) {
22913
- v1Endpoint.headers[name15.toLowerCase()] = endpoint.headers[name15].join(", ");
22914
- }
22915
- }
22916
- return v1Endpoint;
22917
- }
22918
- return endpoint;
22919
- }
22920
- return parseUrl(endpoint);
22921
- };
22922
- }
22923
- });
22924
-
22925
23060
  // node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js
22926
23061
  var init_toEndpointV12 = __esm({
22927
23062
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/adaptors/toEndpointV1.js"() {
22928
- init_toEndpointV1();
23063
+ init_transport();
22929
23064
  }
22930
23065
  });
22931
23066
 
@@ -23111,7 +23246,7 @@ function bindResolveEndpointConfig(getEndpointFromConfig2) {
23111
23246
  }
23112
23247
  var init_resolveEndpointConfig = __esm({
23113
23248
  "node_modules/@smithy/core/dist-es/submodules/endpoints/middleware-endpoint/resolveEndpointConfig.js"() {
23114
- init_client();
23249
+ init_transport();
23115
23250
  init_toEndpointV12();
23116
23251
  }
23117
23252
  });
@@ -23180,7 +23315,7 @@ var init_endpoints = __esm({
23180
23315
  init_endpointMiddleware();
23181
23316
  init_getEndpointPlugin();
23182
23317
  init_resolveEndpointConfig();
23183
- init_toEndpointV1();
23318
+ init_transport();
23184
23319
  init_types2();
23185
23320
  getEndpointFromInstructions = bindGetEndpointFromInstructions(getEndpointFromConfig);
23186
23321
  resolveEndpointConfig = bindResolveEndpointConfig(getEndpointFromConfig);
@@ -23189,231 +23324,6 @@ var init_endpoints = __esm({
23189
23324
  }
23190
23325
  });
23191
23326
 
23192
- // node_modules/@smithy/core/dist-es/submodules/protocols/SerdeContext.js
23193
- var init_SerdeContext = __esm({
23194
- "node_modules/@smithy/core/dist-es/submodules/protocols/SerdeContext.js"() {
23195
- }
23196
- });
23197
-
23198
- // node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpResponse.js
23199
- var HttpResponse;
23200
- var init_httpResponse = __esm({
23201
- "node_modules/@smithy/core/dist-es/submodules/protocols/protocol-http/httpResponse.js"() {
23202
- HttpResponse = class {
23203
- statusCode;
23204
- reason;
23205
- headers;
23206
- body;
23207
- constructor(options) {
23208
- this.statusCode = options.statusCode;
23209
- this.reason = options.reason;
23210
- this.headers = options.headers || {};
23211
- this.body = options.body;
23212
- }
23213
- static isInstance(response) {
23214
- if (!response)
23215
- return false;
23216
- const resp = response;
23217
- return typeof resp.statusCode === "number" && typeof resp.headers === "object";
23218
- }
23219
- };
23220
- }
23221
- });
23222
-
23223
- // node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js
23224
- var init_HttpProtocol = __esm({
23225
- "node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js"() {
23226
- }
23227
- });
23228
-
23229
- // node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js
23230
- var init_HttpBindingProtocol = __esm({
23231
- "node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js"() {
23232
- }
23233
- });
23234
-
23235
- // node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js
23236
- var init_RpcProtocol = __esm({
23237
- "node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js"() {
23238
- }
23239
- });
23240
-
23241
- // node_modules/@smithy/core/dist-es/submodules/protocols/resolve-path.js
23242
- var init_resolve_path = __esm({
23243
- "node_modules/@smithy/core/dist-es/submodules/protocols/resolve-path.js"() {
23244
- }
23245
- });
23246
-
23247
- // node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js
23248
- var init_requestBuilder = __esm({
23249
- "node_modules/@smithy/core/dist-es/submodules/protocols/requestBuilder.js"() {
23250
- }
23251
- });
23252
-
23253
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js
23254
- var init_determineTimestampFormat = __esm({
23255
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/determineTimestampFormat.js"() {
23256
- }
23257
- });
23258
-
23259
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js
23260
- var init_FromStringShapeDeserializer = __esm({
23261
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/FromStringShapeDeserializer.js"() {
23262
- }
23263
- });
23264
-
23265
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js
23266
- var init_HttpInterceptingShapeDeserializer = __esm({
23267
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeDeserializer.js"() {
23268
- }
23269
- });
23270
-
23271
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js
23272
- var init_ToStringShapeSerializer = __esm({
23273
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/ToStringShapeSerializer.js"() {
23274
- }
23275
- });
23276
-
23277
- // node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js
23278
- var init_HttpInterceptingShapeSerializer = __esm({
23279
- "node_modules/@smithy/core/dist-es/submodules/protocols/serde/HttpInterceptingShapeSerializer.js"() {
23280
- }
23281
- });
23282
-
23283
- // node_modules/@smithy/core/dist-es/submodules/protocols/querystring-parser/parseQueryString.js
23284
- function parseQueryString(querystring) {
23285
- const query2 = {};
23286
- querystring = querystring.replace(/^\?/, "");
23287
- if (querystring) {
23288
- for (const pair of querystring.split("&")) {
23289
- let [key, value = null] = pair.split("=");
23290
- key = decodeURIComponent(key);
23291
- if (value) {
23292
- value = decodeURIComponent(value);
23293
- }
23294
- if (!(key in query2)) {
23295
- query2[key] = value;
23296
- } else if (Array.isArray(query2[key])) {
23297
- query2[key].push(value);
23298
- } else {
23299
- query2[key] = [query2[key], value];
23300
- }
23301
- }
23302
- }
23303
- return query2;
23304
- }
23305
- var init_parseQueryString = __esm({
23306
- "node_modules/@smithy/core/dist-es/submodules/protocols/querystring-parser/parseQueryString.js"() {
23307
- }
23308
- });
23309
-
23310
- // node_modules/@smithy/core/dist-es/submodules/protocols/url-parser/parseUrl.js
23311
- var parseUrl;
23312
- var init_parseUrl = __esm({
23313
- "node_modules/@smithy/core/dist-es/submodules/protocols/url-parser/parseUrl.js"() {
23314
- init_parseQueryString();
23315
- parseUrl = (url2) => {
23316
- if (typeof url2 === "string") {
23317
- return parseUrl(new URL(url2));
23318
- }
23319
- const { hostname: hostname2, pathname, port, protocol, search: search2 } = url2;
23320
- let query2;
23321
- if (search2) {
23322
- query2 = parseQueryString(search2);
23323
- }
23324
- return {
23325
- hostname: hostname2,
23326
- port: port ? parseInt(port) : void 0,
23327
- protocol,
23328
- path: pathname,
23329
- query: query2
23330
- };
23331
- };
23332
- }
23333
- });
23334
-
23335
- // node_modules/@smithy/core/dist-es/submodules/protocols/index.js
23336
- var init_protocols = __esm({
23337
- "node_modules/@smithy/core/dist-es/submodules/protocols/index.js"() {
23338
- init_collect_stream_body();
23339
- init_extended_encode_uri_component();
23340
- init_HttpBindingProtocol();
23341
- init_HttpProtocol();
23342
- init_RpcProtocol();
23343
- init_requestBuilder();
23344
- init_resolve_path();
23345
- init_FromStringShapeDeserializer();
23346
- init_HttpInterceptingShapeDeserializer();
23347
- init_HttpInterceptingShapeSerializer();
23348
- init_ToStringShapeSerializer();
23349
- init_determineTimestampFormat();
23350
- init_SerdeContext();
23351
- init_httpResponse();
23352
- init_parseUrl();
23353
- }
23354
- });
23355
-
23356
- // node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js
23357
- var deserializerMiddleware, findHeader;
23358
- var init_deserializerMiddleware = __esm({
23359
- "node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/deserializerMiddleware.js"() {
23360
- init_protocols();
23361
- deserializerMiddleware = (options, deserializer) => (next, context) => async (args) => {
23362
- const { response } = await next(args);
23363
- try {
23364
- const parsed = await deserializer(response, options);
23365
- return {
23366
- response,
23367
- output: parsed
23368
- };
23369
- } catch (error40) {
23370
- Object.defineProperty(error40, "$response", {
23371
- value: response,
23372
- enumerable: false,
23373
- writable: false,
23374
- configurable: false
23375
- });
23376
- if (!("$metadata" in error40)) {
23377
- const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`;
23378
- try {
23379
- error40.message += "\n " + hint;
23380
- } catch (e) {
23381
- if (!context.logger || context.logger?.constructor?.name === "NoOpLogger") {
23382
- console.warn(hint);
23383
- } else {
23384
- context.logger?.warn?.(hint);
23385
- }
23386
- }
23387
- if (typeof error40.$responseBodyText !== "undefined") {
23388
- if (error40.$response) {
23389
- error40.$response.body = error40.$responseBodyText;
23390
- }
23391
- }
23392
- try {
23393
- if (HttpResponse.isInstance(response)) {
23394
- const { headers = {} } = response;
23395
- const headerEntries = Object.entries(headers);
23396
- error40.$metadata = {
23397
- httpStatusCode: response.statusCode,
23398
- requestId: findHeader(/^x-[\w-]+-request-?id$/, headerEntries),
23399
- extendedRequestId: findHeader(/^x-[\w-]+-id-2$/, headerEntries),
23400
- cfId: findHeader(/^x-[\w-]+-cf-id$/, headerEntries)
23401
- };
23402
- }
23403
- } catch (e) {
23404
- }
23405
- }
23406
- throw error40;
23407
- }
23408
- };
23409
- findHeader = (pattern, headers) => {
23410
- return (headers.find(([k]) => {
23411
- return k.match(pattern);
23412
- }) || [void 0, void 0])[1];
23413
- };
23414
- }
23415
- });
23416
-
23417
23327
  // node_modules/@smithy/core/dist-es/submodules/serde/middleware-serde/serializerMiddleware.js
23418
23328
  var serializerMiddleware;
23419
23329
  var init_serializerMiddleware = __esm({
@@ -26112,32 +26022,62 @@ async function convertToBedrockChatMessages(prompt, isMistral = false) {
26112
26022
  const output = part.output;
26113
26023
  switch (output.type) {
26114
26024
  case "content": {
26115
- toolResultContent = output.value.map((contentPart) => {
26116
- switch (contentPart.type) {
26117
- case "text":
26118
- return { text: contentPart.text };
26119
- case "image-data":
26120
- if (!contentPart.mediaType.startsWith("image/")) {
26025
+ toolResultContent = await Promise.all(
26026
+ output.value.map(async (contentPart) => {
26027
+ switch (contentPart.type) {
26028
+ case "text":
26029
+ return { text: contentPart.text };
26030
+ case "image-data": {
26031
+ return {
26032
+ image: {
26033
+ format: getBedrockImageFormat(
26034
+ contentPart.mediaType
26035
+ ),
26036
+ source: {
26037
+ bytes: convertToBase64(contentPart.data)
26038
+ }
26039
+ }
26040
+ };
26041
+ }
26042
+ case "file-data": {
26043
+ if (!contentPart.mediaType.startsWith("image/")) {
26044
+ const enableCitations = await shouldEnableCitations(
26045
+ contentPart.providerOptions
26046
+ );
26047
+ return {
26048
+ document: {
26049
+ format: getBedrockDocumentFormat(
26050
+ contentPart.mediaType
26051
+ ),
26052
+ name: "filename" in contentPart && contentPart.filename ? stripFileExtension(contentPart.filename) : generateDocumentName(),
26053
+ source: {
26054
+ bytes: convertToBase64(contentPart.data)
26055
+ },
26056
+ ...enableCitations && {
26057
+ citations: { enabled: true }
26058
+ }
26059
+ }
26060
+ };
26061
+ }
26062
+ return {
26063
+ image: {
26064
+ format: getBedrockImageFormat(
26065
+ contentPart.mediaType
26066
+ ),
26067
+ source: {
26068
+ bytes: convertToBase64(contentPart.data)
26069
+ }
26070
+ }
26071
+ };
26072
+ }
26073
+ default: {
26121
26074
  throw new UnsupportedFunctionalityError({
26122
- functionality: `media type: ${contentPart.mediaType}`
26075
+ functionality: `unsupported tool content part type: ${contentPart.type}`
26123
26076
  });
26124
26077
  }
26125
- const format2 = getBedrockImageFormat(
26126
- contentPart.mediaType
26127
- );
26128
- return {
26129
- image: {
26130
- format: format2,
26131
- source: { bytes: contentPart.data }
26132
- }
26133
- };
26134
- default: {
26135
- throw new UnsupportedFunctionalityError({
26136
- functionality: `unsupported tool content part type: ${contentPart.type}`
26137
- });
26138
26078
  }
26139
- }
26140
- });
26079
+ })
26080
+ );
26141
26081
  break;
26142
26082
  }
26143
26083
  case "text":
@@ -27923,7 +27863,7 @@ var init_dist3 = __esm({
27923
27863
  details: external_exports.record(external_exports.string(), external_exports.unknown()).optional(),
27924
27864
  preview: external_exports.unknown().optional()
27925
27865
  });
27926
- VERSION2 = true ? "4.0.107" : "0.0.0-test";
27866
+ VERSION2 = true ? "4.0.111" : "0.0.0-test";
27927
27867
  bedrockRerankingResponseSchema = lazySchema(
27928
27868
  () => zodSchema(
27929
27869
  external_exports.object({
@@ -32582,7 +32522,7 @@ var require_brace_expansion = __commonJS({
32582
32522
  }
32583
32523
  var pad = n.some(isPadded);
32584
32524
  N = [];
32585
- for (var i = x; test(i, y); i += incr) {
32525
+ for (var i = x; test(i, y) && N.length < max; i += incr) {
32586
32526
  var c;
32587
32527
  if (isAlphaSequence) {
32588
32528
  c = String.fromCharCode(i);
@@ -78688,11 +78628,11 @@ function createHttpTransport(url2) {
78688
78628
  }
78689
78629
  };
78690
78630
  }
78691
- var import_client3, import_stdio, import_sse, import_websocket, MCPClientManager;
78631
+ var import_client2, import_stdio, import_sse, import_websocket, MCPClientManager;
78692
78632
  var init_client2 = __esm({
78693
78633
  "src/agent/mcp/client.js"() {
78694
78634
  "use strict";
78695
- import_client3 = require("@modelcontextprotocol/sdk/client/index.js");
78635
+ import_client2 = require("@modelcontextprotocol/sdk/client/index.js");
78696
78636
  import_stdio = require("@modelcontextprotocol/sdk/client/stdio.js");
78697
78637
  import_sse = require("@modelcontextprotocol/sdk/client/sse.js");
78698
78638
  import_websocket = require("@modelcontextprotocol/sdk/client/websocket.js");
@@ -78803,7 +78743,7 @@ var init_client2 = __esm({
78803
78743
  console.error(`[MCP DEBUG] Connecting to ${name15} via ${serverConfig.transport}...`);
78804
78744
  }
78805
78745
  const transport = createTransport(serverConfig);
78806
- const client = new import_client3.Client(
78746
+ const client = new import_client2.Client(
78807
78747
  {
78808
78748
  name: `probe-client-${name15}`,
78809
78749
  version: "1.0.0"
@@ -101739,7 +101679,8 @@ __export(ProbeAgent_exports, {
101739
101679
  ENGINE_ACTIVITY_TIMEOUT_MIN: () => ENGINE_ACTIVITY_TIMEOUT_MIN,
101740
101680
  ProbeAgent: () => ProbeAgent,
101741
101681
  debugLogToolResults: () => debugLogToolResults,
101742
- debugTruncate: () => debugTruncate
101682
+ debugTruncate: () => debugTruncate,
101683
+ sanitizeToolInputSchema: () => sanitizeToolInputSchema
101743
101684
  });
101744
101685
  function debugTruncate(s, limit = 200) {
101745
101686
  if (s.length <= limit) return s;
@@ -101754,6 +101695,66 @@ function debugLogToolResults(toolResults) {
101754
101695
  console.log(`[DEBUG] tool: ${tr.toolName} | args: ${debugTruncate(argsStr)} | result: ${debugTruncate(resultStr)}`);
101755
101696
  }
101756
101697
  }
101698
+ function isPlainJsonSchemaObject(value) {
101699
+ return value && typeof value === "object" && !Array.isArray(value) && !value._def;
101700
+ }
101701
+ function sanitizeRequiredFieldsInJsonSchema(schema) {
101702
+ if (!isPlainJsonSchemaObject(schema)) {
101703
+ return;
101704
+ }
101705
+ if (Array.isArray(schema.required) && isPlainJsonSchemaObject(schema.properties)) {
101706
+ const propertyNames = new Set(Object.keys(schema.properties));
101707
+ const filteredRequired = schema.required.filter((name15) => propertyNames.has(name15));
101708
+ if (filteredRequired.length > 0) {
101709
+ schema.required = filteredRequired;
101710
+ } else {
101711
+ delete schema.required;
101712
+ }
101713
+ }
101714
+ const visitSchemaMap = (schemaMap) => {
101715
+ if (!isPlainJsonSchemaObject(schemaMap)) return;
101716
+ for (const childSchema of Object.values(schemaMap)) {
101717
+ sanitizeRequiredFieldsInJsonSchema(childSchema);
101718
+ }
101719
+ };
101720
+ visitSchemaMap(schema.properties);
101721
+ visitSchemaMap(schema.patternProperties);
101722
+ visitSchemaMap(schema.definitions);
101723
+ visitSchemaMap(schema.$defs);
101724
+ visitSchemaMap(schema.dependentSchemas);
101725
+ if (isPlainJsonSchemaObject(schema.items)) {
101726
+ sanitizeRequiredFieldsInJsonSchema(schema.items);
101727
+ } else if (Array.isArray(schema.items)) {
101728
+ for (const itemSchema of schema.items) {
101729
+ sanitizeRequiredFieldsInJsonSchema(itemSchema);
101730
+ }
101731
+ }
101732
+ for (const keyword of ["allOf", "anyOf", "oneOf"]) {
101733
+ if (Array.isArray(schema[keyword])) {
101734
+ for (const childSchema of schema[keyword]) {
101735
+ sanitizeRequiredFieldsInJsonSchema(childSchema);
101736
+ }
101737
+ }
101738
+ }
101739
+ if (isPlainJsonSchemaObject(schema.not)) {
101740
+ sanitizeRequiredFieldsInJsonSchema(schema.not);
101741
+ }
101742
+ if (isPlainJsonSchemaObject(schema.additionalProperties)) {
101743
+ sanitizeRequiredFieldsInJsonSchema(schema.additionalProperties);
101744
+ }
101745
+ }
101746
+ function sanitizeToolInputSchema(schema) {
101747
+ if (!isPlainJsonSchemaObject(schema)) {
101748
+ return schema;
101749
+ }
101750
+ try {
101751
+ const clonedSchema = JSON.parse(JSON.stringify(schema));
101752
+ sanitizeRequiredFieldsInJsonSchema(clonedSchema);
101753
+ return clonedSchema;
101754
+ } catch {
101755
+ return schema;
101756
+ }
101757
+ }
101757
101758
  var import_dotenv, import_ai4, import_crypto8, import_events4, import_fs11, import_promises7, import_path16, 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;
101758
101759
  var init_ProbeAgent = __esm({
101759
101760
  "src/agent/ProbeAgent.js"() {
@@ -103172,7 +103173,8 @@ var init_ProbeAgent = __esm({
103172
103173
  const nativeTools = {};
103173
103174
  const isToolAllowed = (toolName) => this.allowedTools.isEnabled(toolName);
103174
103175
  const wrapTool = (toolName, schema, description, executeFn) => {
103175
- const resolvedSchema = schema && schema._def ? schema : (0, import_ai4.jsonSchema)(schema);
103176
+ const sanitizedSchema = sanitizeToolInputSchema(schema);
103177
+ const resolvedSchema = sanitizedSchema && sanitizedSchema._def ? sanitizedSchema : (0, import_ai4.jsonSchema)(sanitizedSchema);
103176
103178
  return (0, import_ai4.tool)({
103177
103179
  description,
103178
103180
  inputSchema: resolvedSchema,
@@ -103330,8 +103332,9 @@ var init_ProbeAgent = __esm({
103330
103332
  if (this.mcpBridge && !options._disableTools) {
103331
103333
  const mcpTools = this.mcpBridge.getVercelTools(this._filterMcpTools(this.mcpBridge.getToolNames()));
103332
103334
  for (const [name15, mcpTool] of Object.entries(mcpTools)) {
103333
- const mcpSchema = mcpTool.inputSchema || mcpTool.parameters;
103334
- const wrappedSchema = mcpSchema && mcpSchema._def ? mcpSchema : (0, import_ai4.jsonSchema)(mcpSchema || { type: "object", properties: {} });
103335
+ const mcpSchema = mcpTool.inputSchema || mcpTool.parameters || { type: "object", properties: {} };
103336
+ const sanitizedSchema = sanitizeToolInputSchema(mcpSchema);
103337
+ const wrappedSchema = sanitizedSchema && sanitizedSchema._def ? sanitizedSchema : (0, import_ai4.jsonSchema)(sanitizedSchema);
103335
103338
  nativeTools[name15] = (0, import_ai4.tool)({
103336
103339
  description: mcpTool.description || `MCP tool: ${name15}`,
103337
103340
  inputSchema: wrappedSchema,