@sinch/functions-runtime 0.6.3 → 0.7.0

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.
@@ -15640,7 +15640,7 @@ var require_mime_types = __commonJS({
15640
15640
  }
15641
15641
  return exports.types[extension2] || false;
15642
15642
  }
15643
- function populateMaps(extensions, types) {
15643
+ function populateMaps(extensions, types2) {
15644
15644
  Object.keys(db).forEach(function forEachMimeType(type) {
15645
15645
  var mime = db[type];
15646
15646
  var exts = mime.extensions;
@@ -15650,14 +15650,14 @@ var require_mime_types = __commonJS({
15650
15650
  extensions[type] = exts;
15651
15651
  for (var i = 0; i < exts.length; i++) {
15652
15652
  var extension2 = exts[i];
15653
- types[extension2] = _preferredType(extension2, types[extension2], type);
15653
+ types2[extension2] = _preferredType(extension2, types2[extension2], type);
15654
15654
  const legacyType = _preferredTypeLegacy(
15655
15655
  extension2,
15656
- types[extension2],
15656
+ types2[extension2],
15657
15657
  type
15658
15658
  );
15659
- if (legacyType !== types[extension2]) {
15660
- exports._extensionConflicts.push([extension2, legacyType, types[extension2]]);
15659
+ if (legacyType !== types2[extension2]) {
15660
+ exports._extensionConflicts.push([extension2, legacyType, types2[extension2]]);
15661
15661
  }
15662
15662
  }
15663
15663
  });
@@ -15763,23 +15763,23 @@ var require_type_is = __commonJS({
15763
15763
  module.exports.match = mimeMatch;
15764
15764
  function typeis(value, types_) {
15765
15765
  var i;
15766
- var types = types_;
15766
+ var types2 = types_;
15767
15767
  var val = tryNormalizeType(value);
15768
15768
  if (!val) {
15769
15769
  return false;
15770
15770
  }
15771
- if (types && !Array.isArray(types)) {
15772
- types = new Array(arguments.length - 1);
15773
- for (i = 0; i < types.length; i++) {
15774
- types[i] = arguments[i + 1];
15771
+ if (types2 && !Array.isArray(types2)) {
15772
+ types2 = new Array(arguments.length - 1);
15773
+ for (i = 0; i < types2.length; i++) {
15774
+ types2[i] = arguments[i + 1];
15775
15775
  }
15776
15776
  }
15777
- if (!types || !types.length) {
15777
+ if (!types2 || !types2.length) {
15778
15778
  return val;
15779
15779
  }
15780
15780
  var type;
15781
- for (i = 0; i < types.length; i++) {
15782
- if (mimeMatch(normalize(type = types[i]), val)) {
15781
+ for (i = 0; i < types2.length; i++) {
15782
+ if (mimeMatch(normalize(type = types2[i]), val)) {
15783
15783
  return type[0] === "+" || type.indexOf("*") !== -1 ? val : type;
15784
15784
  }
15785
15785
  }
@@ -15790,9 +15790,9 @@ var require_type_is = __commonJS({
15790
15790
  }
15791
15791
  function typeofrequest(req, types_) {
15792
15792
  if (!hasbody(req)) return null;
15793
- var types = arguments.length > 2 ? Array.prototype.slice.call(arguments, 1) : types_;
15793
+ var types2 = arguments.length > 2 ? Array.prototype.slice.call(arguments, 1) : types_;
15794
15794
  var value = req.headers["content-type"];
15795
- return typeis(value, types);
15795
+ return typeis(value, types2);
15796
15796
  }
15797
15797
  function normalize(type) {
15798
15798
  if (typeof type !== "string") {
@@ -16315,7 +16315,7 @@ var require_object_inspect = __commonJS({
16315
16315
  } else if (indexOf(seen, obj) >= 0) {
16316
16316
  return "[Circular]";
16317
16317
  }
16318
- function inspect(value, from, noIndent) {
16318
+ function inspect3(value, from, noIndent) {
16319
16319
  if (from) {
16320
16320
  seen = $arrSlice.call(seen);
16321
16321
  seen.push(from);
@@ -16333,7 +16333,7 @@ var require_object_inspect = __commonJS({
16333
16333
  }
16334
16334
  if (typeof obj === "function" && !isRegExp2(obj)) {
16335
16335
  var name = nameOf(obj);
16336
- var keys = arrObjKeys(obj, inspect);
16336
+ var keys = arrObjKeys(obj, inspect3);
16337
16337
  return "[Function" + (name ? ": " + name : " (anonymous)") + "]" + (keys.length > 0 ? " { " + $join.call(keys, ", ") + " }" : "");
16338
16338
  }
16339
16339
  if (isSymbol(obj)) {
@@ -16357,16 +16357,16 @@ var require_object_inspect = __commonJS({
16357
16357
  if (obj.length === 0) {
16358
16358
  return "[]";
16359
16359
  }
16360
- var xs = arrObjKeys(obj, inspect);
16360
+ var xs = arrObjKeys(obj, inspect3);
16361
16361
  if (indent && !singleLineValues(xs)) {
16362
16362
  return "[" + indentedJoin(xs, indent) + "]";
16363
16363
  }
16364
16364
  return "[ " + $join.call(xs, ", ") + " ]";
16365
16365
  }
16366
16366
  if (isError(obj)) {
16367
- var parts = arrObjKeys(obj, inspect);
16367
+ var parts = arrObjKeys(obj, inspect3);
16368
16368
  if (!("cause" in Error.prototype) && "cause" in obj && !isEnumerable.call(obj, "cause")) {
16369
- return "{ [" + String(obj) + "] " + $join.call($concat.call("[cause]: " + inspect(obj.cause), parts), ", ") + " }";
16369
+ return "{ [" + String(obj) + "] " + $join.call($concat.call("[cause]: " + inspect3(obj.cause), parts), ", ") + " }";
16370
16370
  }
16371
16371
  if (parts.length === 0) {
16372
16372
  return "[" + String(obj) + "]";
@@ -16384,7 +16384,7 @@ var require_object_inspect = __commonJS({
16384
16384
  var mapParts = [];
16385
16385
  if (mapForEach) {
16386
16386
  mapForEach.call(obj, function(value, key) {
16387
- mapParts.push(inspect(key, obj, true) + " => " + inspect(value, obj));
16387
+ mapParts.push(inspect3(key, obj, true) + " => " + inspect3(value, obj));
16388
16388
  });
16389
16389
  }
16390
16390
  return collectionOf("Map", mapSize.call(obj), mapParts, indent);
@@ -16393,7 +16393,7 @@ var require_object_inspect = __commonJS({
16393
16393
  var setParts = [];
16394
16394
  if (setForEach) {
16395
16395
  setForEach.call(obj, function(value) {
16396
- setParts.push(inspect(value, obj));
16396
+ setParts.push(inspect3(value, obj));
16397
16397
  });
16398
16398
  }
16399
16399
  return collectionOf("Set", setSize.call(obj), setParts, indent);
@@ -16408,16 +16408,16 @@ var require_object_inspect = __commonJS({
16408
16408
  return weakCollectionOf("WeakRef");
16409
16409
  }
16410
16410
  if (isNumber2(obj)) {
16411
- return markBoxed(inspect(Number(obj)));
16411
+ return markBoxed(inspect3(Number(obj)));
16412
16412
  }
16413
16413
  if (isBigInt(obj)) {
16414
- return markBoxed(inspect(bigIntValueOf.call(obj)));
16414
+ return markBoxed(inspect3(bigIntValueOf.call(obj)));
16415
16415
  }
16416
16416
  if (isBoolean2(obj)) {
16417
16417
  return markBoxed(booleanValueOf.call(obj));
16418
16418
  }
16419
16419
  if (isString2(obj)) {
16420
- return markBoxed(inspect(String(obj)));
16420
+ return markBoxed(inspect3(String(obj)));
16421
16421
  }
16422
16422
  if (typeof window !== "undefined" && obj === window) {
16423
16423
  return "{ [object Window] }";
@@ -16426,7 +16426,7 @@ var require_object_inspect = __commonJS({
16426
16426
  return "{ [object globalThis] }";
16427
16427
  }
16428
16428
  if (!isDate2(obj) && !isRegExp2(obj)) {
16429
- var ys = arrObjKeys(obj, inspect);
16429
+ var ys = arrObjKeys(obj, inspect3);
16430
16430
  var isPlainObject3 = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
16431
16431
  var protoTag = obj instanceof Object ? "" : "null prototype";
16432
16432
  var stringTag = !isPlainObject3 && toStringTag2 && Object(obj) === obj && toStringTag2 in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? "Object" : "";
@@ -16680,13 +16680,13 @@ var require_object_inspect = __commonJS({
16680
16680
  var lineJoiner = "\n" + indent.prev + indent.base;
16681
16681
  return lineJoiner + $join.call(xs, "," + lineJoiner) + "\n" + indent.prev;
16682
16682
  }
16683
- function arrObjKeys(obj, inspect) {
16683
+ function arrObjKeys(obj, inspect3) {
16684
16684
  var isArr = isArray2(obj);
16685
16685
  var xs = [];
16686
16686
  if (isArr) {
16687
16687
  xs.length = obj.length;
16688
16688
  for (var i = 0; i < obj.length; i++) {
16689
- xs[i] = has(obj, i) ? inspect(obj[i], obj) : "";
16689
+ xs[i] = has(obj, i) ? inspect3(obj[i], obj) : "";
16690
16690
  }
16691
16691
  }
16692
16692
  var syms = typeof gOPS === "function" ? gOPS(obj) : [];
@@ -16707,15 +16707,15 @@ var require_object_inspect = __commonJS({
16707
16707
  if (hasShammedSymbols && symMap["$" + key] instanceof Symbol) {
16708
16708
  continue;
16709
16709
  } else if ($test.call(/[^\w$]/, key)) {
16710
- xs.push(inspect(key, obj) + ": " + inspect(obj[key], obj));
16710
+ xs.push(inspect3(key, obj) + ": " + inspect3(obj[key], obj));
16711
16711
  } else {
16712
- xs.push(key + ": " + inspect(obj[key], obj));
16712
+ xs.push(key + ": " + inspect3(obj[key], obj));
16713
16713
  }
16714
16714
  }
16715
16715
  if (typeof gOPS === "function") {
16716
16716
  for (var j = 0; j < syms.length; j++) {
16717
16717
  if (isEnumerable.call(obj, syms[j])) {
16718
- xs.push("[" + inspect(syms[j]) + "]: " + inspect(obj[syms[j]], obj));
16718
+ xs.push("[" + inspect3(syms[j]) + "]: " + inspect3(obj[syms[j]], obj));
16719
16719
  }
16720
16720
  }
16721
16721
  }
@@ -16728,7 +16728,7 @@ var require_object_inspect = __commonJS({
16728
16728
  var require_side_channel_list = __commonJS({
16729
16729
  "../../node_modules/side-channel-list/index.js"(exports, module) {
16730
16730
  "use strict";
16731
- var inspect = require_object_inspect();
16731
+ var inspect3 = require_object_inspect();
16732
16732
  var $TypeError = require_type();
16733
16733
  var listGetNode = function(list, key, isDelete) {
16734
16734
  var prev = list;
@@ -16782,7 +16782,7 @@ var require_side_channel_list = __commonJS({
16782
16782
  var channel = {
16783
16783
  assert: function(key) {
16784
16784
  if (!channel.has(key)) {
16785
- throw new $TypeError("Side channel does not contain " + inspect(key));
16785
+ throw new $TypeError("Side channel does not contain " + inspect3(key));
16786
16786
  }
16787
16787
  },
16788
16788
  "delete": function(key) {
@@ -17642,7 +17642,7 @@ var require_side_channel_map = __commonJS({
17642
17642
  "use strict";
17643
17643
  var GetIntrinsic = require_get_intrinsic();
17644
17644
  var callBound = require_call_bound();
17645
- var inspect = require_object_inspect();
17645
+ var inspect3 = require_object_inspect();
17646
17646
  var $TypeError = require_type();
17647
17647
  var $Map = GetIntrinsic("%Map%", true);
17648
17648
  var $mapGet = callBound("Map.prototype.get", true);
@@ -17656,7 +17656,7 @@ var require_side_channel_map = __commonJS({
17656
17656
  var channel = {
17657
17657
  assert: function(key) {
17658
17658
  if (!channel.has(key)) {
17659
- throw new $TypeError("Side channel does not contain " + inspect(key));
17659
+ throw new $TypeError("Side channel does not contain " + inspect3(key));
17660
17660
  }
17661
17661
  },
17662
17662
  "delete": function(key) {
@@ -17698,7 +17698,7 @@ var require_side_channel_weakmap = __commonJS({
17698
17698
  "use strict";
17699
17699
  var GetIntrinsic = require_get_intrinsic();
17700
17700
  var callBound = require_call_bound();
17701
- var inspect = require_object_inspect();
17701
+ var inspect3 = require_object_inspect();
17702
17702
  var getSideChannelMap = require_side_channel_map();
17703
17703
  var $TypeError = require_type();
17704
17704
  var $WeakMap = GetIntrinsic("%WeakMap%", true);
@@ -17714,7 +17714,7 @@ var require_side_channel_weakmap = __commonJS({
17714
17714
  var channel = {
17715
17715
  assert: function(key) {
17716
17716
  if (!channel.has(key)) {
17717
- throw new $TypeError("Side channel does not contain " + inspect(key));
17717
+ throw new $TypeError("Side channel does not contain " + inspect3(key));
17718
17718
  }
17719
17719
  },
17720
17720
  "delete": function(key) {
@@ -17770,7 +17770,7 @@ var require_side_channel = __commonJS({
17770
17770
  "../../node_modules/side-channel/index.js"(exports, module) {
17771
17771
  "use strict";
17772
17772
  var $TypeError = require_type();
17773
- var inspect = require_object_inspect();
17773
+ var inspect3 = require_object_inspect();
17774
17774
  var getSideChannelList = require_side_channel_list();
17775
17775
  var getSideChannelMap = require_side_channel_map();
17776
17776
  var getSideChannelWeakMap = require_side_channel_weakmap();
@@ -17780,7 +17780,7 @@ var require_side_channel = __commonJS({
17780
17780
  var channel = {
17781
17781
  assert: function(key) {
17782
17782
  if (!channel.has(key)) {
17783
- throw new $TypeError("Side channel does not contain " + inspect(key));
17783
+ throw new $TypeError("Side channel does not contain " + inspect3(key));
17784
17784
  }
17785
17785
  },
17786
17786
  "delete": function(key) {
@@ -19320,7 +19320,7 @@ var require_mime_types2 = __commonJS({
19320
19320
  }
19321
19321
  return exports.types[extension2] || false;
19322
19322
  }
19323
- function populateMaps(extensions, types) {
19323
+ function populateMaps(extensions, types2) {
19324
19324
  Object.keys(db).forEach(function forEachMimeType(type) {
19325
19325
  var mime = db[type];
19326
19326
  var exts = mime.extensions;
@@ -19330,14 +19330,14 @@ var require_mime_types2 = __commonJS({
19330
19330
  extensions[type] = exts;
19331
19331
  for (var i = 0; i < exts.length; i++) {
19332
19332
  var extension2 = exts[i];
19333
- types[extension2] = _preferredType(extension2, types[extension2], type);
19333
+ types2[extension2] = _preferredType(extension2, types2[extension2], type);
19334
19334
  const legacyType = _preferredTypeLegacy(
19335
19335
  extension2,
19336
- types[extension2],
19336
+ types2[extension2],
19337
19337
  type
19338
19338
  );
19339
- if (legacyType !== types[extension2]) {
19340
- exports._extensionConflicts.push([extension2, legacyType, types[extension2]]);
19339
+ if (legacyType !== types2[extension2]) {
19340
+ exports._extensionConflicts.push([extension2, legacyType, types2[extension2]]);
19341
19341
  }
19342
19342
  }
19343
19343
  });
@@ -20206,8 +20206,8 @@ var require_utils3 = __commonJS({
20206
20206
  exports.normalizeType = function(type) {
20207
20207
  return ~type.indexOf("/") ? acceptParams(type) : { value: mime.lookup(type) || "application/octet-stream", params: {} };
20208
20208
  };
20209
- exports.normalizeTypes = function(types) {
20210
- return types.map(exports.normalizeType);
20209
+ exports.normalizeTypes = function(types2) {
20210
+ return types2.map(exports.normalizeType);
20211
20211
  };
20212
20212
  function acceptParams(str) {
20213
20213
  var length = str.length;
@@ -20781,7 +20781,7 @@ var require_layer = __commonJS({
20781
20781
  this.params = void 0;
20782
20782
  this.path = void 0;
20783
20783
  this.slash = path7 === "/" && opts.end === false;
20784
- function matcher(_path) {
20784
+ function matcher2(_path) {
20785
20785
  if (_path instanceof RegExp) {
20786
20786
  const keys = [];
20787
20787
  let name = 0;
@@ -20819,7 +20819,7 @@ var require_layer = __commonJS({
20819
20819
  decode: decodeParam
20820
20820
  });
20821
20821
  }
20822
- this.matchers = Array.isArray(path7) ? path7.map(matcher) : [matcher(path7)];
20822
+ this.matchers = Array.isArray(path7) ? path7.map(matcher2) : [matcher2(path7)];
20823
20823
  }
20824
20824
  Layer.prototype.handleError = function handleError(error, req, res, next) {
20825
20825
  const fn = this.handle;
@@ -22312,7 +22312,7 @@ var require_mime_types3 = __commonJS({
22312
22312
  }
22313
22313
  return exports.types[extension2] || false;
22314
22314
  }
22315
- function populateMaps(extensions, types) {
22315
+ function populateMaps(extensions, types2) {
22316
22316
  Object.keys(db).forEach(function forEachMimeType(type) {
22317
22317
  var mime = db[type];
22318
22318
  var exts = mime.extensions;
@@ -22322,14 +22322,14 @@ var require_mime_types3 = __commonJS({
22322
22322
  extensions[type] = exts;
22323
22323
  for (var i = 0; i < exts.length; i++) {
22324
22324
  var extension2 = exts[i];
22325
- types[extension2] = _preferredType(extension2, types[extension2], type);
22325
+ types2[extension2] = _preferredType(extension2, types2[extension2], type);
22326
22326
  const legacyType = _preferredTypeLegacy(
22327
22327
  extension2,
22328
- types[extension2],
22328
+ types2[extension2],
22329
22329
  type
22330
22330
  );
22331
- if (legacyType !== types[extension2]) {
22332
- exports._extensionConflicts.push([extension2, legacyType, types[extension2]]);
22331
+ if (legacyType !== types2[extension2]) {
22332
+ exports._extensionConflicts.push([extension2, legacyType, types2[extension2]]);
22333
22333
  }
22334
22334
  }
22335
22335
  });
@@ -22366,23 +22366,23 @@ var require_accepts = __commonJS({
22366
22366
  this.negotiator = new Negotiator(req);
22367
22367
  }
22368
22368
  Accepts.prototype.type = Accepts.prototype.types = function(types_) {
22369
- var types = types_;
22370
- if (types && !Array.isArray(types)) {
22371
- types = new Array(arguments.length);
22372
- for (var i = 0; i < types.length; i++) {
22373
- types[i] = arguments[i];
22369
+ var types2 = types_;
22370
+ if (types2 && !Array.isArray(types2)) {
22371
+ types2 = new Array(arguments.length);
22372
+ for (var i = 0; i < types2.length; i++) {
22373
+ types2[i] = arguments[i];
22374
22374
  }
22375
22375
  }
22376
- if (!types || types.length === 0) {
22376
+ if (!types2 || types2.length === 0) {
22377
22377
  return this.negotiator.mediaTypes();
22378
22378
  }
22379
22379
  if (!this.headers.accept) {
22380
- return types[0];
22380
+ return types2[0];
22381
22381
  }
22382
- var mimes = types.map(extToMime);
22382
+ var mimes = types2.map(extToMime);
22383
22383
  var accepts = this.negotiator.mediaTypes(mimes.filter(validMime));
22384
22384
  var first = accepts[0];
22385
- return first ? types[mimes.indexOf(first)] : false;
22385
+ return first ? types2[mimes.indexOf(first)] : false;
22386
22386
  };
22387
22387
  Accepts.prototype.encoding = Accepts.prototype.encodings = function(encodings_) {
22388
22388
  var encodings = encodings_;
@@ -22643,9 +22643,9 @@ var require_request = __commonJS({
22643
22643
  var querystring = parse2(this).query;
22644
22644
  return queryparse(querystring);
22645
22645
  });
22646
- req.is = function is(types) {
22647
- var arr = types;
22648
- if (!Array.isArray(types)) {
22646
+ req.is = function is(types2) {
22647
+ var arr = types2;
22648
+ if (!Array.isArray(types2)) {
22649
22649
  arr = new Array(arguments.length);
22650
22650
  for (var i = 0; i < arr.length; i++) {
22651
22651
  arr[i] = arguments[i];
@@ -23192,7 +23192,7 @@ var require_mime_types4 = __commonJS({
23192
23192
  }
23193
23193
  return exports.types[extension2] || false;
23194
23194
  }
23195
- function populateMaps(extensions, types) {
23195
+ function populateMaps(extensions, types2) {
23196
23196
  Object.keys(db).forEach(function forEachMimeType(type) {
23197
23197
  var mime = db[type];
23198
23198
  var exts = mime.extensions;
@@ -23202,14 +23202,14 @@ var require_mime_types4 = __commonJS({
23202
23202
  extensions[type] = exts;
23203
23203
  for (var i = 0; i < exts.length; i++) {
23204
23204
  var extension2 = exts[i];
23205
- types[extension2] = _preferredType(extension2, types[extension2], type);
23205
+ types2[extension2] = _preferredType(extension2, types2[extension2], type);
23206
23206
  const legacyType = _preferredTypeLegacy(
23207
23207
  extension2,
23208
- types[extension2],
23208
+ types2[extension2],
23209
23209
  type
23210
23210
  );
23211
- if (legacyType !== types[extension2]) {
23212
- exports._extensionConflicts.push([extension2, legacyType, types[extension2]]);
23211
+ if (legacyType !== types2[extension2]) {
23212
+ exports._extensionConflicts.push([extension2, legacyType, types2[extension2]]);
23213
23213
  }
23214
23214
  }
23215
23215
  });
@@ -44303,7 +44303,7 @@ var require_mime_types5 = __commonJS({
44303
44303
  }
44304
44304
  return exports.types[extension2] || false;
44305
44305
  }
44306
- function populateMaps(extensions, types) {
44306
+ function populateMaps(extensions, types2) {
44307
44307
  var preference = ["nginx", "apache", void 0, "iana"];
44308
44308
  Object.keys(db).forEach(function forEachMimeType(type) {
44309
44309
  var mime = db[type];
@@ -44314,14 +44314,14 @@ var require_mime_types5 = __commonJS({
44314
44314
  extensions[type] = exts;
44315
44315
  for (var i = 0; i < exts.length; i++) {
44316
44316
  var extension2 = exts[i];
44317
- if (types[extension2]) {
44318
- var from = preference.indexOf(db[types[extension2]].source);
44317
+ if (types2[extension2]) {
44318
+ var from = preference.indexOf(db[types2[extension2]].source);
44319
44319
  var to = preference.indexOf(mime.source);
44320
- if (types[extension2] !== "application/octet-stream" && (from > to || from === to && types[extension2].substr(0, 12) === "application/")) {
44320
+ if (types2[extension2] !== "application/octet-stream" && (from > to || from === to && types2[extension2].substr(0, 12) === "application/")) {
44321
44321
  continue;
44322
44322
  }
44323
44323
  }
44324
- types[extension2] = type;
44324
+ types2[extension2] = type;
44325
44325
  }
44326
44326
  });
44327
44327
  }
@@ -59157,7 +59157,9 @@ function createConnectAgentAction(provider, agentId, options) {
59157
59157
  transport,
59158
59158
  ...options?.cli && { cli: options.cli },
59159
59159
  ...options?.maxDuration !== void 0 && { maxDuration: options.maxDuration },
59160
- ...options?.suppressCallbacks !== void 0 && { suppressCallbacks: options.suppressCallbacks },
59160
+ ...options?.suppressCallbacks !== void 0 && {
59161
+ suppressCallbacks: options.suppressCallbacks
59162
+ },
59161
59163
  ...callHeaders2 && { callHeaders: callHeaders2 }
59162
59164
  };
59163
59165
  }
@@ -59886,7 +59888,8 @@ var UniversalConfig = class {
59886
59888
  secrets: {},
59887
59889
  hasApplicationCredentials: !!this.getApplicationCredentials()
59888
59890
  };
59889
- for (const [key, value] of Object.entries(this.env)) {
59891
+ for (const key of Object.getOwnPropertyNames(this.env)) {
59892
+ const value = this.env[key];
59890
59893
  if (secretKeys.some((secretKey) => key.includes(secretKey))) {
59891
59894
  summary.secrets[key] = value ? "[REDACTED]" : "[NOT SET]";
59892
59895
  } else if (["NODE_ENV", "PORT", "SINCH_REGION"].includes(key)) {
@@ -60794,7 +60797,12 @@ var CommandBuilder = class {
60794
60797
  return this.push(bridgeStep(agentEndpoint(target), options2, STREAM_AGENT_LEG));
60795
60798
  }
60796
60799
  const { headers, transport, host, port, ...options } = sipOptions;
60797
- const address = sipAgentAddress(target, numberOrOptions, { headers, transport, host, port });
60800
+ const address = sipAgentAddress(target, numberOrOptions, {
60801
+ headers,
60802
+ transport,
60803
+ host,
60804
+ port
60805
+ });
60798
60806
  return this.push(bridgeStep((scope) => address(scope?.event), options, SIP_AGENT_LEG));
60799
60807
  }
60800
60808
  /**
@@ -61563,7 +61571,12 @@ var Client = class {
61563
61571
  return this.transferTo(target, endpoint, numberOrOptions ?? {});
61564
61572
  }
61565
61573
  const { headers, transport, host, port, ...options } = sipOptions;
61566
- const address = sipAgentAddress(agent, numberOrOptions, { headers, transport, host, port });
61574
+ const address = sipAgentAddress(agent, numberOrOptions, {
61575
+ headers,
61576
+ transport,
61577
+ host,
61578
+ port
61579
+ });
61567
61580
  return this.transferTo(target, address, options, DEFAULT_AGENT_MAX_DURATION);
61568
61581
  }
61569
61582
  async transferTo(target, to, options, maxDuration) {
@@ -61755,8 +61768,261 @@ function connectAgent(provider, number, options = {}) {
61755
61768
  };
61756
61769
  }
61757
61770
 
61771
+ // ../runtime-shared/dist/security/context-secrets.js
61772
+ import { inspect } from "util";
61773
+ var HIDDEN_ENV_KEYS = [
61774
+ "PROJECT_ID_API_KEY",
61775
+ "PROJECT_ID_API_SECRET",
61776
+ "VOICE_APPLICATION_KEY",
61777
+ "VOICE_APPLICATION_SECRET",
61778
+ "VOICE_SERVICE_SECRET",
61779
+ "CONVERSATION_WEBHOOK_SECRET",
61780
+ "ADMIN_USER",
61781
+ "ADMIN_PASSWORD"
61782
+ ];
61783
+ var HIDDEN_ENV_PATTERN = /SECRET|TOKEN|PASS|PRIVATE|CREDENTIAL|AUTH|APIKEY|ACCESS_KEY|DSN|CONNECTION_STRING|_URL|_URI|_KEY$|_KEY_ID$|^(?!(?:OLD)?PWD$).*PWD/i;
61784
+ var VISIBLE_ENV_KEYS = /* @__PURE__ */ new Set([
61785
+ "API_URL",
61786
+ "SINCH_API_URL",
61787
+ "FUNCTION_URL",
61788
+ "STREAM_URL",
61789
+ "TUNNEL_GATEWAY_URL"
61790
+ ]);
61791
+ var hiddenKeys = new Set(HIDDEN_ENV_KEYS);
61792
+ var functionEnvs = /* @__PURE__ */ new WeakSet();
61793
+ var OPAQUE = /* @__PURE__ */ Symbol("sinch.opaque");
61794
+ function isHiddenEnvKey(key) {
61795
+ return hiddenKeys.has(key) || !VISIBLE_ENV_KEYS.has(key) && HIDDEN_ENV_PATTERN.test(key);
61796
+ }
61797
+ function createFunctionEnv(source) {
61798
+ const env = {};
61799
+ for (const key of Object.keys(source)) {
61800
+ Object.defineProperty(env, key, {
61801
+ value: source[key],
61802
+ enumerable: !isHiddenEnvKey(key),
61803
+ writable: true,
61804
+ configurable: true
61805
+ });
61806
+ }
61807
+ functionEnvs.add(env);
61808
+ return env;
61809
+ }
61810
+ function makeOpaque(target, label) {
61811
+ if (target === null || typeof target !== "object" && typeof target !== "function")
61812
+ return;
61813
+ if (Object.prototype.hasOwnProperty.call(target, OPAQUE) || !Object.isExtensible(target))
61814
+ return;
61815
+ const tag = `[${label}]`;
61816
+ Object.defineProperties(target, {
61817
+ [OPAQUE]: { value: true },
61818
+ toJSON: { value: () => tag, configurable: true, writable: true },
61819
+ [inspect.custom]: { value: () => tag, configurable: true, writable: true }
61820
+ });
61821
+ }
61822
+ var HOLDER_SEARCH_DEPTH = 4;
61823
+ var API_CLIENT_SEARCH_DEPTH = 8;
61824
+ var SDK_CREDENTIAL_FIELDS = /* @__PURE__ */ new Set([
61825
+ "keyId",
61826
+ "keySecret",
61827
+ "applicationKey",
61828
+ "applicationSecret",
61829
+ "applicationId",
61830
+ "apiToken",
61831
+ "mailgunApiKey",
61832
+ "userName",
61833
+ "password",
61834
+ "token"
61835
+ ]);
61836
+ var searchedClients = /* @__PURE__ */ new WeakSet();
61837
+ var guardedLazyClients = /* @__PURE__ */ new WeakSet();
61838
+ var wrappedSetCredentials = /* @__PURE__ */ new WeakSet();
61839
+ function isObject(value) {
61840
+ return typeof value === "object" && value !== null;
61841
+ }
61842
+ function canDefine(obj, key) {
61843
+ const descriptor = Object.getOwnPropertyDescriptor(obj, key);
61844
+ return descriptor ? descriptor.configurable === true : Object.isExtensible(obj);
61845
+ }
61846
+ function dataValues(obj) {
61847
+ return Object.values(Object.getOwnPropertyDescriptors(obj)).filter((descriptor) => "value" in descriptor).map((descriptor) => descriptor.value);
61848
+ }
61849
+ function isCredentialField(key, value, secrets) {
61850
+ return SDK_CREDENTIAL_FIELDS.has(key) || typeof value === "string" && secrets.has(value);
61851
+ }
61852
+ function hideCredentialFields(obj, secrets) {
61853
+ let found = false;
61854
+ for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(obj))) {
61855
+ if (!("value" in descriptor) || !isCredentialField(key, descriptor.value, secrets))
61856
+ continue;
61857
+ found = true;
61858
+ if (descriptor.enumerable && descriptor.configurable) {
61859
+ Object.defineProperty(obj, key, { enumerable: false });
61860
+ }
61861
+ }
61862
+ if (found)
61863
+ makeOpaque(obj, "Sinch credentials");
61864
+ return found;
61865
+ }
61866
+ function revealCredentialFields(obj, secrets) {
61867
+ for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(obj))) {
61868
+ if (!("value" in descriptor) || descriptor.enumerable || !descriptor.configurable)
61869
+ continue;
61870
+ if (isCredentialField(key, descriptor.value, secrets)) {
61871
+ Object.defineProperty(obj, key, { enumerable: true });
61872
+ }
61873
+ }
61874
+ }
61875
+ function isLazyClient(obj) {
61876
+ const config = Object.getOwnPropertyDescriptor(obj, "sharedConfig");
61877
+ return typeof obj.getApiClient === "function" && (isObject(config?.value) || typeof config?.get === "function");
61878
+ }
61879
+ function isOAuth2Plugin(obj) {
61880
+ const plugin = obj;
61881
+ return typeof plugin.getOAuth2Token === "function" && typeof plugin.invalidateToken === "function";
61882
+ }
61883
+ function hideCredentialsBelow(obj, secrets, depth, maxDepth, seen) {
61884
+ if (depth > maxDepth || seen.has(obj))
61885
+ return;
61886
+ seen.add(obj);
61887
+ if (isOAuth2Plugin(obj) && !Object.prototype.hasOwnProperty.call(obj, "token") && canDefine(obj, "token")) {
61888
+ Object.defineProperty(obj, "token", {
61889
+ value: void 0,
61890
+ enumerable: false,
61891
+ writable: true,
61892
+ configurable: true
61893
+ });
61894
+ }
61895
+ hideCredentialFields(obj, secrets);
61896
+ for (const value of dataValues(obj)) {
61897
+ if (isObject(value))
61898
+ hideCredentialsBelow(value, secrets, depth + 1, maxDepth, seen);
61899
+ }
61900
+ }
61901
+ function protectApiClient(client, secrets) {
61902
+ if (!isObject(client))
61903
+ return;
61904
+ makeOpaque(client, "Sinch API client");
61905
+ hideCredentialsBelow(client, secrets, 0, API_CLIENT_SEARCH_DEPTH, /* @__PURE__ */ new Set());
61906
+ }
61907
+ function guardLazyClient(lazy, secrets) {
61908
+ if (guardedLazyClients.has(lazy))
61909
+ return;
61910
+ guardedLazyClients.add(lazy);
61911
+ let config = lazy.sharedConfig;
61912
+ let apiClient = lazy.apiFetchClient;
61913
+ if (isObject(config))
61914
+ hideCredentialFields(config, secrets);
61915
+ protectApiClient(apiClient, secrets);
61916
+ if (!canDefine(lazy, "sharedConfig") || !canDefine(lazy, "apiFetchClient"))
61917
+ return;
61918
+ Object.defineProperties(lazy, {
61919
+ sharedConfig: {
61920
+ get: () => config,
61921
+ set: (next) => {
61922
+ if (!isObject(next)) {
61923
+ config = next;
61924
+ return;
61925
+ }
61926
+ config = Object.create(Object.getPrototypeOf(next), Object.getOwnPropertyDescriptors(next));
61927
+ hideCredentialFields(config, secrets);
61928
+ },
61929
+ enumerable: true,
61930
+ configurable: true
61931
+ },
61932
+ apiFetchClient: {
61933
+ get: () => apiClient,
61934
+ set: (next) => {
61935
+ apiClient = next;
61936
+ protectApiClient(next, secrets);
61937
+ },
61938
+ enumerable: false,
61939
+ configurable: true
61940
+ }
61941
+ });
61942
+ }
61943
+ function keepCredentialsForSetCredentials(owner, lazies, secrets) {
61944
+ const original = owner.setCredentials;
61945
+ if (typeof original !== "function" || wrappedSetCredentials.has(owner))
61946
+ return;
61947
+ if (!canDefine(owner, "setCredentials"))
61948
+ return;
61949
+ wrappedSetCredentials.add(owner);
61950
+ Object.defineProperty(owner, "setCredentials", {
61951
+ value: function setCredentials(...args) {
61952
+ const configs = lazies.map((lazy) => lazy.sharedConfig).filter(isObject);
61953
+ for (const config of configs)
61954
+ revealCredentialFields(config, secrets);
61955
+ try {
61956
+ return original.apply(this, args);
61957
+ } finally {
61958
+ for (const config of configs)
61959
+ hideCredentialFields(config, secrets);
61960
+ }
61961
+ },
61962
+ enumerable: false,
61963
+ writable: true,
61964
+ configurable: true
61965
+ });
61966
+ }
61967
+ function guardSdkObjects(obj, secrets, lazies, depth, seen) {
61968
+ if (depth > HOLDER_SEARCH_DEPTH || seen.has(obj))
61969
+ return;
61970
+ seen.add(obj);
61971
+ if (isLazyClient(obj)) {
61972
+ lazies.push(obj);
61973
+ guardLazyClient(obj, secrets);
61974
+ return;
61975
+ }
61976
+ keepCredentialsForSetCredentials(obj, lazies, secrets);
61977
+ hideCredentialFields(obj, secrets);
61978
+ for (const value of dataValues(obj)) {
61979
+ if (isObject(value))
61980
+ guardSdkObjects(value, secrets, lazies, depth + 1, seen);
61981
+ }
61982
+ }
61983
+ function protectSdkClient(client, label, secrets) {
61984
+ if (!isObject(client) || searchedClients.has(client))
61985
+ return;
61986
+ searchedClients.add(client);
61987
+ makeOpaque(client, label);
61988
+ for (const member of dataValues(client)) {
61989
+ if (isObject(member))
61990
+ makeOpaque(member, label);
61991
+ }
61992
+ guardSdkObjects(client, secrets(), [], 0, /* @__PURE__ */ new Set());
61993
+ }
61994
+ function hiddenValues(env) {
61995
+ const values = /* @__PURE__ */ new Set();
61996
+ for (const key of env ? Object.getOwnPropertyNames(env) : []) {
61997
+ const value = env?.[key];
61998
+ if (value && isHiddenEnvKey(key))
61999
+ values.add(value);
62000
+ }
62001
+ return values;
62002
+ }
62003
+ function protectContext(context, v1) {
62004
+ const ctx = context;
62005
+ const original = ctx.env;
62006
+ if (original && !functionEnvs.has(original)) {
62007
+ const env = createFunctionEnv(original);
62008
+ ctx.env = env;
62009
+ if (ctx.config && ctx.config.variables === original) {
62010
+ ctx.config.variables = env;
62011
+ }
62012
+ }
62013
+ let secrets;
62014
+ const credentialValues = () => secrets ??= hiddenValues(ctx.env);
62015
+ protectSdkClient(ctx.conversation, "Sinch Conversation client", credentialValues);
62016
+ protectSdkClient(ctx.sms, "Sinch SMS client", credentialValues);
62017
+ protectSdkClient(ctx.numbers, "Sinch Numbers client", credentialValues);
62018
+ protectSdkClient(v1, "Sinch Voice v1 client", credentialValues);
62019
+ makeOpaque(ctx.cache, "Function cache");
62020
+ makeOpaque(ctx.storage, "Function storage");
62021
+ }
62022
+
61758
62023
  // ../runtime-shared/dist/voice/client.js
61759
62024
  function attachVoiceClient(context, v1) {
62025
+ protectContext(context, v1);
61760
62026
  attachConfigAccessors(context);
61761
62027
  let client;
61762
62028
  Object.defineProperty(context, "voice", {
@@ -62278,6 +62544,238 @@ function createSecurityOptions(config) {
62278
62544
  };
62279
62545
  }
62280
62546
 
62547
+ // ../runtime-shared/dist/security/redact.js
62548
+ import { inspect as inspect2 } from "util";
62549
+ var REDACTED2 = "[REDACTED]";
62550
+ var MIN_SECRET_LENGTH = 8;
62551
+ var BASIC_AUTH_PAIRS = [
62552
+ ["PROJECT_ID_API_KEY", "PROJECT_ID_API_SECRET"],
62553
+ ["VOICE_APPLICATION_KEY", "VOICE_APPLICATION_SECRET"],
62554
+ ["ADMIN_USER", "ADMIN_PASSWORD"]
62555
+ ];
62556
+ var MAX_PATTERN_SOURCE = 16 * 1024;
62557
+ var MAX_PATTERN_NEEDLE = 1024;
62558
+ var matcher = null;
62559
+ function escapeRegExp(text) {
62560
+ return text.replace(/[\\^$.*+?()[\]{}|/-]/g, "\\$&");
62561
+ }
62562
+ function percentEncodedForms(value) {
62563
+ const component = encodeURIComponent(value);
62564
+ const strict = component.replace(/[!'()*]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
62565
+ const form = new URLSearchParams([["", value]]).toString().slice(1);
62566
+ return [component, strict, form].flatMap((encoded) => [
62567
+ encoded,
62568
+ encoded.replace(/%[0-9A-F]{2}/g, (hex) => hex.toLowerCase())
62569
+ ]);
62570
+ }
62571
+ function buildSecretNeedles(env) {
62572
+ const needles = /* @__PURE__ */ new Set();
62573
+ const add = (text) => {
62574
+ if (text.length >= MIN_SECRET_LENGTH)
62575
+ needles.add(text);
62576
+ };
62577
+ const addQuotedForms = (text) => {
62578
+ add(text);
62579
+ add(JSON.stringify(text).slice(1, -1));
62580
+ add(inspect2(text).slice(1, -1));
62581
+ };
62582
+ for (const key of Object.getOwnPropertyNames(env)) {
62583
+ const value = env[key];
62584
+ if (typeof value !== "string" || value.length < MIN_SECRET_LENGTH || !isHiddenEnvKey(key)) {
62585
+ continue;
62586
+ }
62587
+ addQuotedForms(value);
62588
+ for (const form of percentEncodedForms(value))
62589
+ add(form);
62590
+ for (const line of value.split(/\r?\n|(?:\\r)?\\n/))
62591
+ addQuotedForms(line.trim());
62592
+ }
62593
+ for (const [userKey, secretKey] of BASIC_AUTH_PAIRS) {
62594
+ const user = env[userKey];
62595
+ const secret = env[secretKey];
62596
+ if (user && secret)
62597
+ add(Buffer.from(`${user}:${secret}`).toString("base64"));
62598
+ }
62599
+ const sessions = collectCredentials2({
62600
+ authKey: env.PROJECT_ID_API_KEY,
62601
+ authSecret: env.PROJECT_ID_API_SECRET,
62602
+ adminUser: env.ADMIN_USER,
62603
+ adminPassword: env.ADMIN_PASSWORD
62604
+ });
62605
+ for (const { user, password } of sessions)
62606
+ add(sessionToken(user, password));
62607
+ return [...needles].sort((a, b) => b.length - a.length);
62608
+ }
62609
+ function configureSecretRedaction(env) {
62610
+ const needles = buildSecretNeedles(env);
62611
+ if (needles.length === 0) {
62612
+ matcher = null;
62613
+ return;
62614
+ }
62615
+ const patterns = [];
62616
+ const literals = [];
62617
+ let group = [];
62618
+ let groupSource = 0;
62619
+ const closeGroup = () => {
62620
+ if (group.length === 0)
62621
+ return;
62622
+ const alternation = group.join("|");
62623
+ patterns.push({
62624
+ any: new RegExp(alternation),
62625
+ starts: new RegExp(`(?=(${alternation}))`, "g")
62626
+ });
62627
+ group = [];
62628
+ groupSource = 0;
62629
+ };
62630
+ for (const needle of needles) {
62631
+ const source = escapeRegExp(needle);
62632
+ if (needle.length > MAX_PATTERN_NEEDLE) {
62633
+ literals.push(needle);
62634
+ continue;
62635
+ }
62636
+ if (groupSource + source.length + 1 > MAX_PATTERN_SOURCE)
62637
+ closeGroup();
62638
+ group.push(source);
62639
+ groupSource += source.length + 1;
62640
+ }
62641
+ closeGroup();
62642
+ matcher = {
62643
+ patterns,
62644
+ literals,
62645
+ shortest: needles[needles.length - 1].length,
62646
+ longest: needles[0].length,
62647
+ longestBytes: Math.max(...needles.map((needle) => Buffer.byteLength(needle)))
62648
+ };
62649
+ }
62650
+ function findSpans(m, text) {
62651
+ const found = [];
62652
+ for (const pattern of m.patterns) {
62653
+ if (!pattern.any.test(text))
62654
+ continue;
62655
+ for (const match of text.matchAll(pattern.starts)) {
62656
+ found.push([match.index, match.index + match[1].length]);
62657
+ }
62658
+ }
62659
+ for (const needle of m.literals) {
62660
+ for (let at = text.indexOf(needle); at !== -1; at = text.indexOf(needle, at + 1)) {
62661
+ found.push([at, at + needle.length]);
62662
+ }
62663
+ }
62664
+ if (found.length === 0)
62665
+ return found;
62666
+ found.sort((a, b) => a[0] - b[0]);
62667
+ const merged = [found[0]];
62668
+ for (const [start, end] of found) {
62669
+ const last = merged[merged.length - 1];
62670
+ if (start <= last[1])
62671
+ last[1] = Math.max(last[1], end);
62672
+ else
62673
+ merged.push([start, end]);
62674
+ }
62675
+ return merged;
62676
+ }
62677
+ function redactSecrets(text) {
62678
+ const m = matcher;
62679
+ if (!m || text.length < m.shortest)
62680
+ return text;
62681
+ let spans;
62682
+ try {
62683
+ spans = findSpans(m, text);
62684
+ } catch {
62685
+ return REDACTED2;
62686
+ }
62687
+ if (spans.length === 0)
62688
+ return text;
62689
+ let out = "";
62690
+ let copied = 0;
62691
+ for (const [start, end] of spans) {
62692
+ out += text.slice(copied, start) + REDACTED2;
62693
+ copied = end;
62694
+ }
62695
+ return out + text.slice(copied);
62696
+ }
62697
+ function redactAsText(value) {
62698
+ if (value === void 0 || value === null)
62699
+ return value;
62700
+ if (typeof value === "string")
62701
+ return redactSecrets(value);
62702
+ let text;
62703
+ try {
62704
+ text = JSON.stringify(value);
62705
+ } catch {
62706
+ }
62707
+ try {
62708
+ text ??= String(value);
62709
+ } catch {
62710
+ return REDACTED2;
62711
+ }
62712
+ return redactSecrets(text);
62713
+ }
62714
+ function secretLookaheadBytes() {
62715
+ return matcher ? matcher.longestBytes : 0;
62716
+ }
62717
+ function safeCut(prefix, continuation) {
62718
+ const m = matcher;
62719
+ if (!m || continuation.length === 0)
62720
+ return prefix;
62721
+ try {
62722
+ const cut = prefix.length;
62723
+ const after = continuation.slice(0, m.longest - 1);
62724
+ for (let reach = m.longest; ; reach *= 2) {
62725
+ const from = Math.max(0, cut - reach);
62726
+ const crossing = findSpans(m, prefix.slice(from) + after).find(([start, end]) => start < cut - from && end > cut - from);
62727
+ if (!crossing)
62728
+ return prefix;
62729
+ if (from === 0 || crossing[0] >= m.longest)
62730
+ return prefix.slice(0, from + crossing[0]);
62731
+ }
62732
+ } catch {
62733
+ return "";
62734
+ }
62735
+ }
62736
+ var wrappedStreams = /* @__PURE__ */ new WeakSet();
62737
+ function isTextEncoding(encoding) {
62738
+ return typeof encoding !== "string" || !/^(hex|base64|base64url)$/i.test(encoding);
62739
+ }
62740
+ function redactBytes(bytes) {
62741
+ const text = bytes.toString("utf8");
62742
+ const redacted = redactSecrets(text);
62743
+ return redacted === text ? void 0 : Buffer.from(redacted, "utf8");
62744
+ }
62745
+ function redactChunk(chunk, encoding) {
62746
+ if (!matcher)
62747
+ return chunk;
62748
+ if (typeof chunk === "string") {
62749
+ if (isTextEncoding(encoding))
62750
+ return redactSecrets(chunk);
62751
+ const notation = encoding;
62752
+ return redactBytes(Buffer.from(chunk, notation))?.toString(notation) ?? chunk;
62753
+ }
62754
+ if (ArrayBuffer.isView(chunk)) {
62755
+ return redactBytes(Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)) ?? chunk;
62756
+ }
62757
+ return chunk;
62758
+ }
62759
+ function wrapStreamWrite(stream5) {
62760
+ if (wrappedStreams.has(stream5))
62761
+ return;
62762
+ wrappedStreams.add(stream5);
62763
+ const write = stream5.write;
62764
+ stream5.write = function(chunk, ...rest) {
62765
+ let safe;
62766
+ try {
62767
+ safe = redactChunk(chunk, rest[0]);
62768
+ } catch {
62769
+ safe = typeof chunk === "string" ? REDACTED2 : Buffer.from(REDACTED2);
62770
+ }
62771
+ return write.call(this, safe, ...rest);
62772
+ };
62773
+ }
62774
+ function installStdioRedaction() {
62775
+ wrapStreamWrite(process.stdout);
62776
+ wrapStreamWrite(process.stderr);
62777
+ }
62778
+
62281
62779
  // ../runtime-shared/dist/security/voice-signature.js
62282
62780
  import { createHash, createHmac as createHmac2, timingSafeEqual as timingSafeEqual3 } from "crypto";
62283
62781
  var VOICE_TIMESTAMP_SKEW_MS = 5 * 60 * 1e3;
@@ -62475,6 +62973,52 @@ function safeToolOutput(value) {
62475
62973
  }
62476
62974
  }
62477
62975
 
62976
+ // ../runtime-shared/dist/host/exports.js
62977
+ import { types } from "util";
62978
+ var fnToString = Function.prototype.toString;
62979
+ var fnBind = Function.prototype.bind;
62980
+ var OBJECT_PROTOTYPE_NAMES = new Set(Object.getOwnPropertyNames(Object.prototype));
62981
+ function isAuthorClassPrototype(proto) {
62982
+ if (types.isProxy(proto))
62983
+ return false;
62984
+ const ctor = Object.getOwnPropertyDescriptor(proto, "constructor")?.value;
62985
+ if (typeof ctor !== "function" || types.isProxy(ctor))
62986
+ return false;
62987
+ if (Object.getOwnPropertyDescriptor(ctor, "prototype")?.value !== proto)
62988
+ return false;
62989
+ if (!/^class\b/.test(fnToString.call(ctor)))
62990
+ return false;
62991
+ const name = Object.getOwnPropertyDescriptor(ctor, "name")?.value;
62992
+ return !(typeof name === "string" && Object.getOwnPropertyDescriptor(globalThis, name)?.value === ctor);
62993
+ }
62994
+ function findExport(target, name) {
62995
+ if (OBJECT_PROTOTYPE_NAMES.has(name))
62996
+ return void 0;
62997
+ if (Object.hasOwn(target, name)) {
62998
+ const value = target[name];
62999
+ return typeof value === "function" ? fnBind.call(value, target) : void 0;
63000
+ }
63001
+ if (types.isProxy(target))
63002
+ return void 0;
63003
+ for (let proto = Object.getPrototypeOf(target); proto !== null && isAuthorClassPrototype(proto); proto = Object.getPrototypeOf(proto)) {
63004
+ const descriptor = Object.getOwnPropertyDescriptor(proto, name);
63005
+ if (descriptor) {
63006
+ return typeof descriptor.value === "function" ? fnBind.call(descriptor.value, target) : void 0;
63007
+ }
63008
+ }
63009
+ return void 0;
63010
+ }
63011
+ function listExports(target) {
63012
+ const candidates = new Set(Object.keys(target));
63013
+ if (!types.isProxy(target)) {
63014
+ for (let proto = Object.getPrototypeOf(target); proto !== null && isAuthorClassPrototype(proto); proto = Object.getPrototypeOf(proto)) {
63015
+ for (const name of Object.getOwnPropertyNames(proto))
63016
+ candidates.add(name);
63017
+ }
63018
+ }
63019
+ return [...candidates].filter((name) => findExport(target, name) !== void 0);
63020
+ }
63021
+
62478
63022
  // ../runtime-shared/dist/host/app.js
62479
63023
  import { createRequire } from "module";
62480
63024
  import { pathToFileURL } from "url";
@@ -62720,8 +63264,10 @@ function buildBaseContext(req, config = {}) {
62720
63264
  }
62721
63265
  };
62722
63266
  }
63267
+ var ExportNotFoundError = class extends Error {
63268
+ };
62723
63269
  async function handleVoiceV1Callback(functionName, userFunction, context, callbackData, logger) {
62724
- const handler = userFunction[functionName];
63270
+ const handler = findExport(userFunction, functionName);
62725
63271
  if (!handler || typeof handler !== "function") {
62726
63272
  if (functionName === "ice") {
62727
63273
  throw new Error(`Voice callback 'ice' not found \u2014 export an ice() function in function.ts`);
@@ -62767,7 +63313,7 @@ async function handleVoiceV1Callback(functionName, userFunction, context, callba
62767
63313
  return formatSvamlResponse(result2, functionName);
62768
63314
  }
62769
63315
  async function handleVoiceWebhook(userFunction, context, event, request, logger) {
62770
- const handler = userFunction[VOICE_WEBHOOK_HANDLER];
63316
+ const handler = findExport(userFunction, VOICE_WEBHOOK_HANDLER);
62771
63317
  if (!handler || typeof handler !== "function") {
62772
63318
  throw new Error(`No export '${VOICE_WEBHOOK_HANDLER}' found for Voice v2 event '${event?.event}'. Export one built with onCall({ incoming: ... }), or drop VOICE_SERVICE_ID to stay on the v1 ice/ace/pie/dice callbacks.`);
62773
63319
  }
@@ -62782,20 +63328,24 @@ async function handleVoiceWebhook(userFunction, context, event, request, logger)
62782
63328
  return formatCustomResponse(result2);
62783
63329
  }
62784
63330
  const body = await context.voice.onCall({ fallback: () => result2 })(event);
62785
- return body === void 0 ? { statusCode: 204 } : { statusCode: 200, headers: { "Content-Type": "application/json" }, body: stringify(body) };
63331
+ return body === void 0 ? { statusCode: 204 } : {
63332
+ statusCode: 200,
63333
+ headers: { "Content-Type": "application/json" },
63334
+ body: stringify(body)
63335
+ };
62786
63336
  }
62787
63337
  function isVoiceResult(result2) {
62788
63338
  return Array.isArray(result2) || result2 instanceof CommandBuilder || typeof result2 === "object" && Array.isArray(result2.commands);
62789
63339
  }
62790
63340
  async function handleCustomEndpoint(functionName, userFunction, context, request, logger) {
62791
- let handler = userFunction[functionName];
63341
+ let handler = findExport(userFunction, functionName);
62792
63342
  if ((!handler || typeof handler !== "function") && functionName === "default") {
62793
- handler = userFunction["home"];
63343
+ handler = findExport(userFunction, "home");
62794
63344
  }
62795
63345
  if (!handler || typeof handler !== "function") {
62796
- const available = Object.keys(userFunction).filter((k) => typeof userFunction[k] === "function");
63346
+ const available = listExports(userFunction);
62797
63347
  const pathHint = functionName.endsWith("Webhook") ? `/webhook/${functionName.replace("Webhook", "")}` : `/${functionName}`;
62798
- throw new Error(`No export '${functionName}' found for path ${pathHint}. Available exports: [${available.join(", ")}]. Custom endpoints require a named export matching the last path segment.`);
63348
+ throw new ExportNotFoundError(`No export '${functionName}' found for path ${pathHint}. Available exports: [${available.join(", ")}]. Custom endpoints require a named export matching the last path segment.`);
62799
63349
  }
62800
63350
  const result2 = await handler(context, request);
62801
63351
  if (logger) {
@@ -62881,7 +63431,12 @@ function setupRequestHandler(app, options = {}) {
62881
63431
  }, buildContext = (req) => attachVoiceClient(buildBaseContext(req)), logger = console.log, landingPageEnabled = true, authConfig, authKey, authSecret, adminUser, adminPassword, onRequestStart = () => {
62882
63432
  }, onRequestEnd = () => {
62883
63433
  } } = options;
62884
- const credentials = collectCredentials2({ authKey, authSecret, adminUser, adminPassword });
63434
+ const credentials = collectCredentials2({
63435
+ authKey,
63436
+ authSecret,
63437
+ adminUser,
63438
+ adminPassword
63439
+ });
62885
63440
  const functionDisplayName = process.env.FUNCTION_NAME || "Sinch Function";
62886
63441
  app.use("/{*splat}", async (req, res) => {
62887
63442
  const startTime = Date.now();
@@ -62894,7 +63449,7 @@ function setupRequestHandler(app, options = {}) {
62894
63449
  const functionName = extractFunctionName(req.originalUrl, req.body);
62895
63450
  logger(`[${(/* @__PURE__ */ new Date()).toISOString()}] ${req.method} ${req.path} -> ${functionName}`);
62896
63451
  const userFunction = await Promise.resolve(loadUserFunction());
62897
- const hasAuthorExport = (name) => typeof userFunction[name] === "function";
63452
+ const hasAuthorExport = (name) => typeof findExport(userFunction, name) === "function";
62898
63453
  if (functionName === "login" && !hasAuthorExport("login")) {
62899
63454
  if (req.method === "GET") {
62900
63455
  handleLoginPageRequest(req, res, { credentials, functionName: functionDisplayName });
@@ -62961,7 +63516,10 @@ function setupRequestHandler(app, options = {}) {
62961
63516
  }
62962
63517
  }
62963
63518
  if (functionName === VOICE_WEBHOOK_HANDLER && isVoiceWebhook(req.body)) {
62964
- const verdict = verifyVoiceWebhook(buildVoiceSignedRequest(req), { mode: protectionMode, isDevelopment: isDev });
63519
+ const verdict = verifyVoiceWebhook(buildVoiceSignedRequest(req), {
63520
+ mode: protectionMode,
63521
+ isDevelopment: isDev
63522
+ });
62965
63523
  if (!verdict.valid) {
62966
63524
  logger(`[SECURITY] Voice v2 webhook signature validation failed: ${verdict.reason}`);
62967
63525
  res.status(401).json({ error: "Invalid webhook signature" });
@@ -63030,17 +63588,22 @@ function setupRequestHandler(app, options = {}) {
63030
63588
  stack: error.stack,
63031
63589
  function: extractFunctionName(req.originalUrl, req.body)
63032
63590
  });
63033
- res.status(500).json({
63034
- error: "Internal server error",
63035
- message: error.message,
63036
- ...process.env.NODE_ENV === "development" && { stack: error.stack }
63037
- });
63591
+ if (error instanceof ExportNotFoundError) {
63592
+ res.status(404).json({ error: "Not found", message: error.message });
63593
+ } else {
63594
+ const { message, stack } = error ?? {};
63595
+ res.status(500).json({
63596
+ error: "Internal server error",
63597
+ message: redactAsText(message),
63598
+ ...process.env.NODE_ENV === "development" && { stack: redactAsText(stack) }
63599
+ });
63600
+ }
63038
63601
  onRequestEnd({
63039
63602
  functionName: extractFunctionName(req.originalUrl, req.body),
63040
63603
  req,
63041
63604
  error,
63042
63605
  duration,
63043
- statusCode: 500
63606
+ statusCode: error instanceof ExportNotFoundError ? 404 : 500
63044
63607
  });
63045
63608
  }
63046
63609
  });
@@ -63855,9 +64418,9 @@ function closeAnyState(ws) {
63855
64418
  function sanitizeVendorError(err) {
63856
64419
  const message = err instanceof Error ? err.message : String(err);
63857
64420
  const code = err?.code;
63858
- return { message: redactSecrets(message), ...code ? { code } : {} };
64421
+ return { message: redactSecrets2(message), ...code ? { code } : {} };
63859
64422
  }
63860
- function redactSecrets(message) {
64423
+ function redactSecrets2(message) {
63861
64424
  return message.replace(/([?&](?:key|api_key|apikey|token)=)[^&\s"']+/gi, "$1[REDACTED]").replace(/(authorization:?\s*(?:bearer|token)\s+)\S+/gi, "$1[REDACTED]");
63862
64425
  }
63863
64426
 
@@ -63873,7 +64436,12 @@ function providerOptionsFor(options) {
63873
64436
  return options.providerOptions?.["deepgram"] ?? {};
63874
64437
  }
63875
64438
  function encodeTools(tools) {
63876
- return tools.map((t) => ({ name: t.name, description: t.description, parameters: t.parameters, defer_until_eot: true }));
64439
+ return tools.map((t) => ({
64440
+ name: t.name,
64441
+ description: t.description,
64442
+ parameters: t.parameters,
64443
+ defer_until_eot: true
64444
+ }));
63877
64445
  }
63878
64446
  async function dispatchToolCall(fn, tools, ctx, dgWs, callbacks, session) {
63879
64447
  const start = Date.now();
@@ -63957,7 +64525,10 @@ function buildSettingsFrame(options) {
63957
64525
  }
63958
64526
  },
63959
64527
  think: {
63960
- provider: { type: dg.llmProvider ?? DEFAULT_LLM_PROVIDER, model: dg.llmModel ?? DEFAULT_LLM_MODEL },
64528
+ provider: {
64529
+ type: dg.llmProvider ?? DEFAULT_LLM_PROVIDER,
64530
+ model: dg.llmModel ?? DEFAULT_LLM_MODEL
64531
+ },
63961
64532
  prompt: options.prompt,
63962
64533
  functions: encodeTools(options.tools ?? [])
63963
64534
  },
@@ -63979,7 +64550,9 @@ function createDeepgramAdapter(webSocketClient) {
63979
64550
  throw new Error("realtimeAgent: provider 'deepgram' needs DEEPGRAM_API_KEY \u2014 set it as a function secret.");
63980
64551
  }
63981
64552
  const WebSocketClient = webSocketClient ?? loadWebSocketClient("deepgram");
63982
- const dgWs = new WebSocketClient(DEEPGRAM_URL, { headers: { Authorization: `Token ${apiKey}` } });
64553
+ const dgWs = new WebSocketClient(DEEPGRAM_URL, {
64554
+ headers: { Authorization: `Token ${apiKey}` }
64555
+ });
63983
64556
  const bytesPerMs = (options.audio === "wideband" ? 16e3 : 8e3) * 2 / 1e3;
63984
64557
  const session = {
63985
64558
  ws: dgWs,
@@ -64046,7 +64619,9 @@ function createDeepgramAdapter(webSocketClient) {
64046
64619
  return;
64047
64620
  }
64048
64621
  if (isOversizedFrame(raw)) {
64049
- callbacks.onError({ message: "Received an oversized text frame from Deepgram \u2014 dropped" });
64622
+ callbacks.onError({
64623
+ message: "Received an oversized text frame from Deepgram \u2014 dropped"
64624
+ });
64050
64625
  return;
64051
64626
  }
64052
64627
  const msg = parseVendorFrame(raw);
@@ -64074,7 +64649,11 @@ function createDeepgramAdapter(webSocketClient) {
64074
64649
  for (const fn of functions) {
64075
64650
  void dispatchToolCall(fn, tools, ctx, dgWs, callbacks, session).catch((err) => {
64076
64651
  const sanitized = sanitizeVendorError(err);
64077
- callbacks.onError({ message: sanitized.message, code: sanitized.code, raw: sanitized });
64652
+ callbacks.onError({
64653
+ message: sanitized.message,
64654
+ code: sanitized.code,
64655
+ raw: sanitized
64656
+ });
64078
64657
  });
64079
64658
  }
64080
64659
  break;
@@ -64362,7 +64941,10 @@ function builtInTools(hangupEnabled, transferNumber, ctx) {
64362
64941
  type: "object",
64363
64942
  properties: {
64364
64943
  reason: { type: "string", description: "Why the call is being transferred." },
64365
- summary: { type: "string", description: "A brief summary of the call so far, for the human." }
64944
+ summary: {
64945
+ type: "string",
64946
+ description: "A brief summary of the call so far, for the human."
64947
+ }
64366
64948
  },
64367
64949
  required: ["reason", "summary"]
64368
64950
  },
@@ -64423,7 +65005,12 @@ function providerOptionsFor2(options) {
64423
65005
  return options.providerOptions?.["openai"] ?? {};
64424
65006
  }
64425
65007
  function encodeResponsesTools(tools) {
64426
- return tools.map((t) => ({ type: "function", name: t.name, description: t.description, parameters: t.parameters }));
65008
+ return tools.map((t) => ({
65009
+ type: "function",
65010
+ name: t.name,
65011
+ description: t.description,
65012
+ parameters: t.parameters
65013
+ }));
64427
65014
  }
64428
65015
  function buildInstructions(options) {
64429
65016
  if (!options.greeting)
@@ -64520,7 +65107,9 @@ function createOpenAiAdapter(webSocketClient) {
64520
65107
  throw new Error("realtimeAgent: provider 'openai' needs OPENAI_API_KEY \u2014 set it as a function secret.");
64521
65108
  }
64522
65109
  const WebSocketClient = webSocketClient ?? loadWebSocketClient("openai");
64523
- const vendorWs = new WebSocketClient(GPT_LIVE_URL, { headers: { Authorization: `Bearer ${apiKey}` } });
65110
+ const vendorWs = new WebSocketClient(GPT_LIVE_URL, {
65111
+ headers: { Authorization: `Bearer ${apiKey}` }
65112
+ });
64524
65113
  const session = {
64525
65114
  ws: vendorWs,
64526
65115
  ready: false,
@@ -64626,7 +65215,14 @@ function createOpenAiAdapter(webSocketClient) {
64626
65215
  session.lastDelegationId = void 0;
64627
65216
  }
64628
65217
  if (text)
64629
- callbacks.onTurn({ role: "agent", text, timestamp: (/* @__PURE__ */ new Date()).toISOString(), playbackStartAt, playbackEndAt, delegationMs });
65218
+ callbacks.onTurn({
65219
+ role: "agent",
65220
+ text,
65221
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
65222
+ playbackStartAt,
65223
+ playbackEndAt,
65224
+ delegationMs
65225
+ });
64630
65226
  };
64631
65227
  const scheduleAgentTurnFlush = () => {
64632
65228
  if (session.agentTurnTimer !== void 0)
@@ -64645,7 +65241,13 @@ function createOpenAiAdapter(webSocketClient) {
64645
65241
  const text = session.pendingUserTurnText;
64646
65242
  session.pendingUserTurnText = "";
64647
65243
  if (text)
64648
- callbacks.onTurn({ role: "user", text, timestamp: (/* @__PURE__ */ new Date()).toISOString(), speechStartAt, speechEndAt });
65244
+ callbacks.onTurn({
65245
+ role: "user",
65246
+ text,
65247
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
65248
+ speechStartAt,
65249
+ speechEndAt
65250
+ });
64649
65251
  };
64650
65252
  const scheduleUserTurnFlush = () => {
64651
65253
  if (session.userTurnTimer !== void 0)
@@ -64692,7 +65294,9 @@ function createOpenAiAdapter(webSocketClient) {
64692
65294
  };
64693
65295
  vendorWs.on("message", (raw) => {
64694
65296
  if (isOversizedFrame(raw)) {
64695
- callbacks.onError({ message: "Received an oversized frame from OpenAI GPT-Live \u2014 dropped" });
65297
+ callbacks.onError({
65298
+ message: "Received an oversized frame from OpenAI GPT-Live \u2014 dropped"
65299
+ });
64696
65300
  return;
64697
65301
  }
64698
65302
  const msg = parseVendorFrame(raw);
@@ -64719,7 +65323,9 @@ function createOpenAiAdapter(webSocketClient) {
64719
65323
  case "session.output_audio.delta": {
64720
65324
  const mulaw = safeBase64ToBuffer(msg["delta"]);
64721
65325
  if (!mulaw) {
64722
- callbacks.onError({ message: "Received a malformed audio delta from OpenAI GPT-Live" });
65326
+ callbacks.onError({
65327
+ message: "Received a malformed audio delta from OpenAI GPT-Live"
65328
+ });
64723
65329
  break;
64724
65330
  }
64725
65331
  const pcm8k = mulawToPcm16(mulaw);
@@ -64852,7 +65458,11 @@ function createOpenAiAdapter(webSocketClient) {
64852
65458
  }
64853
65459
  case "error": {
64854
65460
  const err = msg["error"];
64855
- callbacks.onError({ message: err?.message ?? "OpenAI GPT-Live error", code: err?.code, raw: msg });
65461
+ callbacks.onError({
65462
+ message: err?.message ?? "OpenAI GPT-Live error",
65463
+ code: err?.code,
65464
+ raw: msg
65465
+ });
64856
65466
  if (!settled) {
64857
65467
  settle2(() => reject(new Error(err?.message ?? "realtimeAgent: OpenAI GPT-Live error before session.started")));
64858
65468
  closeAnyState(vendorWs);
@@ -64914,7 +65524,12 @@ var VENDOR_RATE2 = 8e3;
64914
65524
  var MULAW_BYTES_PER_MS = 8;
64915
65525
  var HANDSHAKE_TIMEOUT_MS3 = 1e4;
64916
65526
  function encodeTools2(tools) {
64917
- return tools.map((t) => ({ type: "function", name: t.name, description: t.description, parameters: t.parameters }));
65527
+ return tools.map((t) => ({
65528
+ type: "function",
65529
+ name: t.name,
65530
+ description: t.description,
65531
+ parameters: t.parameters
65532
+ }));
64918
65533
  }
64919
65534
  async function dispatchToolCall3(callId, name, rawArgs, tools, ctx, vendorWs, callbacks) {
64920
65535
  const start = Date.now();
@@ -65073,7 +65688,9 @@ function createOpenAiCompatibleAdapter(config, webSocketClient) {
65073
65688
  };
65074
65689
  vendorWs.on("message", (raw) => {
65075
65690
  if (isOversizedFrame(raw)) {
65076
- callbacks.onError({ message: `Received an oversized frame from ${config.provider} \u2014 dropped` });
65691
+ callbacks.onError({
65692
+ message: `Received an oversized frame from ${config.provider} \u2014 dropped`
65693
+ });
65077
65694
  return;
65078
65695
  }
65079
65696
  const msg = parseVendorFrame(raw);
@@ -65106,7 +65723,9 @@ function createOpenAiCompatibleAdapter(config, webSocketClient) {
65106
65723
  }
65107
65724
  const mulaw = safeBase64ToBuffer(msg["delta"]);
65108
65725
  if (!mulaw) {
65109
- callbacks.onError({ message: `Received a malformed audio delta from ${config.provider}` });
65726
+ callbacks.onError({
65727
+ message: `Received a malformed audio delta from ${config.provider}`
65728
+ });
65110
65729
  break;
65111
65730
  }
65112
65731
  session.bytesSentForItem += mulaw.length;
@@ -65142,7 +65761,10 @@ function createOpenAiCompatibleAdapter(config, webSocketClient) {
65142
65761
  if (usage) {
65143
65762
  session.totalInputTokens += usage.input_tokens ?? 0;
65144
65763
  session.totalOutputTokens += usage.output_tokens ?? 0;
65145
- callbacks.onUsage?.({ inputTokens: session.totalInputTokens, outputTokens: session.totalOutputTokens });
65764
+ callbacks.onUsage?.({
65765
+ inputTokens: session.totalInputTokens,
65766
+ outputTokens: session.totalOutputTokens
65767
+ });
65146
65768
  }
65147
65769
  closeResponse();
65148
65770
  break;
@@ -65268,7 +65890,10 @@ function buildGrokSession(options, tools) {
65268
65890
  // that field.
65269
65891
  input: {
65270
65892
  format: { type: "audio/pcmu" },
65271
- transcription: { model: "grok-transcribe", language_hint: options.language ?? DEFAULT_LANGUAGE }
65893
+ transcription: {
65894
+ model: "grok-transcribe",
65895
+ language_hint: options.language ?? DEFAULT_LANGUAGE
65896
+ }
65272
65897
  },
65273
65898
  output: { format: { type: "audio/pcmu" } }
65274
65899
  },
@@ -65312,7 +65937,11 @@ function flushPendingTurns(session, callbacks) {
65312
65937
  }
65313
65938
  function flushPendingAgentTurn(session, callbacks) {
65314
65939
  if (session.pendingAgentText) {
65315
- callbacks.onTurn({ role: "agent", text: session.pendingAgentText, timestamp: (/* @__PURE__ */ new Date()).toISOString() });
65940
+ callbacks.onTurn({
65941
+ role: "agent",
65942
+ text: session.pendingAgentText,
65943
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
65944
+ });
65316
65945
  session.pendingAgentText = "";
65317
65946
  }
65318
65947
  }
@@ -65332,7 +65961,10 @@ function toGeminiSchema(schema) {
65332
65961
  if (schema["enum"])
65333
65962
  out["enum"] = schema["enum"];
65334
65963
  if (kind === "object" && schema["properties"] && typeof schema["properties"] === "object") {
65335
- out["properties"] = Object.fromEntries(Object.entries(schema["properties"]).map(([k, v]) => [k, toGeminiSchema(v)]));
65964
+ out["properties"] = Object.fromEntries(Object.entries(schema["properties"]).map(([k, v]) => [
65965
+ k,
65966
+ toGeminiSchema(v)
65967
+ ]));
65336
65968
  if (Array.isArray(schema["required"]))
65337
65969
  out["required"] = schema["required"];
65338
65970
  }
@@ -65367,7 +65999,9 @@ function buildSetupMessage(options, model, tools, resumptionHandle) {
65367
65999
  // own default voice.
65368
66000
  speechConfig: {
65369
66001
  languageCode: options.language ?? DEFAULT_LANGUAGE,
65370
- ...options.voice && { voiceConfig: { prebuiltVoiceConfig: { voiceName: options.voice } } }
66002
+ ...options.voice && {
66003
+ voiceConfig: { prebuiltVoiceConfig: { voiceName: options.voice } }
66004
+ }
65371
66005
  }
65372
66006
  },
65373
66007
  systemInstruction: { parts: [{ text: options.prompt }] },
@@ -65375,7 +66009,11 @@ function buildSetupMessage(options, model, tools, resumptionHandle) {
65375
66009
  inputAudioTranscription: {},
65376
66010
  outputAudioTranscription: {},
65377
66011
  realtimeInputConfig: {
65378
- automaticActivityDetection: { disabled: false, silenceDurationMs: 500, prefixPaddingMs: 20 },
66012
+ automaticActivityDetection: {
66013
+ disabled: false,
66014
+ silenceDurationMs: 500,
66015
+ prefixPaddingMs: 20
66016
+ },
65379
66017
  activityHandling: "START_OF_ACTIVITY_INTERRUPTS"
65380
66018
  },
65381
66019
  // A phone call routinely outlives the Live API's 15-minute audio-only session window (see
@@ -65403,7 +66041,13 @@ async function dispatchToolCall4(fc, tools, ctx, session, callbacks) {
65403
66041
  error = err instanceof Error ? err.message : String(err);
65404
66042
  }
65405
66043
  }
65406
- callbacks.onToolCall({ name: fc.name, args: fc.args, result: result2, error, latencyMs: Date.now() - start });
66044
+ callbacks.onToolCall({
66045
+ name: fc.name,
66046
+ args: fc.args,
66047
+ result: result2,
66048
+ error,
66049
+ latencyMs: Date.now() - start
66050
+ });
65407
66051
  if (session.cancelledCallIds.delete(fc.id))
65408
66052
  return;
65409
66053
  if (session.ws.readyState !== session.ws.OPEN)
@@ -65412,14 +66056,20 @@ async function dispatchToolCall4(fc, tools, ctx, session, callbacks) {
65412
66056
  session.ws.send(JSON.stringify({
65413
66057
  toolResponse: {
65414
66058
  // The structured result object itself, not a JSON-encoded string — see the file header.
65415
- functionResponses: [{ id: fc.id, name: fc.name, response: error ? { error } : result2 ?? {} }]
66059
+ functionResponses: [
66060
+ { id: fc.id, name: fc.name, response: error ? { error } : result2 ?? {} }
66061
+ ]
65416
66062
  }
65417
66063
  }));
65418
66064
  } catch {
65419
66065
  session.ws.send(JSON.stringify({
65420
66066
  toolResponse: {
65421
66067
  functionResponses: [
65422
- { id: fc.id, name: fc.name, response: { error: "realtimeAgent: tool result could not be serialized" } }
66068
+ {
66069
+ id: fc.id,
66070
+ name: fc.name,
66071
+ response: { error: "realtimeAgent: tool result could not be serialized" }
66072
+ }
65423
66073
  ]
65424
66074
  }
65425
66075
  }));
@@ -65462,7 +66112,11 @@ function createGeminiAdapter(webSocketClient) {
65462
66112
  let greeted = false;
65463
66113
  const sendRealtimeAudio = (pcm) => {
65464
66114
  const pcm16k = session.resamplerIn.push(pcm);
65465
- session.ws.send(JSON.stringify({ realtimeInput: { audio: { data: pcm16k.toString("base64"), mimeType: "audio/pcm;rate=16000" } } }));
66115
+ session.ws.send(JSON.stringify({
66116
+ realtimeInput: {
66117
+ audio: { data: pcm16k.toString("base64"), mimeType: "audio/pcm;rate=16000" }
66118
+ }
66119
+ }));
65466
66120
  };
65467
66121
  const flushBufferedAudio = () => {
65468
66122
  const chunks = session.audioBuffer;
@@ -65520,7 +66174,9 @@ function createGeminiAdapter(webSocketClient) {
65520
66174
  });
65521
66175
  liveWs.on("message", (raw) => {
65522
66176
  if (isOversizedFrame(raw)) {
65523
- callbacks.onError({ message: "Received an oversized frame from Gemini Live \u2014 dropped" });
66177
+ callbacks.onError({
66178
+ message: "Received an oversized frame from Gemini Live \u2014 dropped"
66179
+ });
65524
66180
  return;
65525
66181
  }
65526
66182
  const msg = parseVendorFrame(raw);
@@ -65565,21 +66221,27 @@ function createGeminiAdapter(webSocketClient) {
65565
66221
  if (Array.isArray(parts)) {
65566
66222
  for (const part of parts) {
65567
66223
  if (!isPlainObject(part)) {
65568
- callbacks.onError({ message: "Received a malformed audio part from Gemini Live" });
66224
+ callbacks.onError({
66225
+ message: "Received a malformed audio part from Gemini Live"
66226
+ });
65569
66227
  continue;
65570
66228
  }
65571
66229
  const inlineData = part["inlineData"];
65572
66230
  const data = isPlainObject(inlineData) ? inlineData["data"] : void 0;
65573
66231
  const pcm24k = safeBase64ToBuffer(data);
65574
66232
  if (data && !pcm24k) {
65575
- callbacks.onError({ message: "Received a malformed audio part from Gemini Live" });
66233
+ callbacks.onError({
66234
+ message: "Received a malformed audio part from Gemini Live"
66235
+ });
65576
66236
  continue;
65577
66237
  }
65578
66238
  if (pcm24k)
65579
66239
  callbacks.onAudioOut(session.resamplerOut.push(pcm24k));
65580
66240
  }
65581
66241
  } else if (parts !== void 0) {
65582
- callbacks.onError({ message: "Received a malformed modelTurn from Gemini Live \u2014 parts was not an array" });
66242
+ callbacks.onError({
66243
+ message: "Received a malformed modelTurn from Gemini Live \u2014 parts was not an array"
66244
+ });
65583
66245
  }
65584
66246
  if (content.interimInputTranscription?.text && !session.speechStartReported) {
65585
66247
  session.speechStartReported = true;
@@ -65604,12 +66266,18 @@ function createGeminiAdapter(webSocketClient) {
65604
66266
  if (Array.isArray(functionCalls)) {
65605
66267
  for (const fc of functionCalls) {
65606
66268
  if (!isPlainObject(fc) || typeof fc["id"] !== "string" || typeof fc["name"] !== "string") {
65607
- callbacks.onError({ message: "Received a malformed function call from Gemini Live" });
66269
+ callbacks.onError({
66270
+ message: "Received a malformed function call from Gemini Live"
66271
+ });
65608
66272
  continue;
65609
66273
  }
65610
66274
  void dispatchToolCall4({ id: fc["id"], name: fc["name"], args: fc["args"] }, tools, ctx, session, callbacks).catch((err) => {
65611
66275
  const sanitized = sanitizeVendorError(err);
65612
- callbacks.onError({ message: sanitized.message, code: sanitized.code, raw: sanitized });
66276
+ callbacks.onError({
66277
+ message: sanitized.message,
66278
+ code: sanitized.code,
66279
+ raw: sanitized
66280
+ });
65613
66281
  });
65614
66282
  }
65615
66283
  } else if (functionCalls !== void 0) {
@@ -65630,7 +66298,10 @@ function createGeminiAdapter(webSocketClient) {
65630
66298
  });
65631
66299
  }
65632
66300
  if (msg["goAway"] !== void 0) {
65633
- callbacks.onError({ message: "Gemini Live sent goAway \u2014 session will close soon", raw: msg["goAway"] });
66301
+ callbacks.onError({
66302
+ message: "Gemini Live sent goAway \u2014 session will close soon",
66303
+ raw: msg["goAway"]
66304
+ });
65634
66305
  }
65635
66306
  });
65636
66307
  liveWs.on("error", (err) => {
@@ -65688,7 +66359,11 @@ function createGeminiAdapter(webSocketClient) {
65688
66359
  return;
65689
66360
  }
65690
66361
  const pcm16k = s.resamplerIn.push(pcm);
65691
- s.ws.send(JSON.stringify({ realtimeInput: { audio: { data: pcm16k.toString("base64"), mimeType: "audio/pcm;rate=16000" } } }));
66362
+ s.ws.send(JSON.stringify({
66363
+ realtimeInput: {
66364
+ audio: { data: pcm16k.toString("base64"), mimeType: "audio/pcm;rate=16000" }
66365
+ }
66366
+ }));
65692
66367
  },
65693
66368
  clear() {
65694
66369
  },
@@ -65814,7 +66489,12 @@ function toResponsesInput(input) {
65814
66489
  return { type: "function_call_output", call_id: turn.toolCallId, output: turn.output };
65815
66490
  }
65816
66491
  if (turn.role === "tool_call") {
65817
- return { type: "function_call", call_id: turn.id, name: turn.name, arguments: JSON.stringify(turn.arguments ?? {}) };
66492
+ return {
66493
+ type: "function_call",
66494
+ call_id: turn.id,
66495
+ name: turn.name,
66496
+ arguments: JSON.stringify(turn.arguments ?? {})
66497
+ };
65818
66498
  }
65819
66499
  return { role: turn.role, content: turn.content };
65820
66500
  });
@@ -65870,7 +66550,12 @@ function createResponsesEventState(callbacks) {
65870
66550
  let functionCallDetected = false;
65871
66551
  const dispatch = (entry, finalArgs) => {
65872
66552
  const { value, error } = parseToolArgs(finalArgs);
65873
- callbacks.onToolCall({ id: entry.callId, name: entry.name, arguments: value, ...error && { argsError: error } });
66553
+ callbacks.onToolCall({
66554
+ id: entry.callId,
66555
+ name: entry.name,
66556
+ arguments: value,
66557
+ ...error && { argsError: error }
66558
+ });
65874
66559
  };
65875
66560
  return {
65876
66561
  feedEvent(event) {
@@ -65891,7 +66576,12 @@ function createResponsesEventState(callbacks) {
65891
66576
  case "response.output_item.added": {
65892
66577
  const item = event["item"];
65893
66578
  if (item?.type === "function_call" && item.id && item.name) {
65894
- toolCalls.set(item.id, { callId: item.call_id ?? item.id, name: item.name, args: "", dispatched: false });
66579
+ toolCalls.set(item.id, {
66580
+ callId: item.call_id ?? item.id,
66581
+ name: item.name,
66582
+ args: "",
66583
+ dispatched: false
66584
+ });
65895
66585
  if (!functionCallDetected) {
65896
66586
  functionCallDetected = true;
65897
66587
  callbacks.onFunctionCallDetected?.(item.name);
@@ -65928,7 +66618,10 @@ function createResponsesEventState(callbacks) {
65928
66618
  const flushed = sentences.flush();
65929
66619
  if (flushed)
65930
66620
  callbacks.onSentence(flushed);
65931
- const usage = response?.usage ? { inputTokens: response.usage.input_tokens, outputTokens: response.usage.output_tokens } : void 0;
66621
+ const usage = response?.usage ? {
66622
+ inputTokens: response.usage.input_tokens,
66623
+ outputTokens: response.usage.output_tokens
66624
+ } : void 0;
65932
66625
  return { text, responseId, usage };
65933
66626
  }
65934
66627
  case "response.failed": {
@@ -66012,7 +66705,9 @@ var RawResponsesWs = class {
66012
66705
  errorHandlers = [];
66013
66706
  constructor(apiKey, baseUrl) {
66014
66707
  const WebSocketClient = loadWebSocketClient("voice-relay");
66015
- this.socket = new WebSocketClient(buildResponsesWsUrl(baseUrl), { headers: { Authorization: `Bearer ${apiKey}` } });
66708
+ this.socket = new WebSocketClient(buildResponsesWsUrl(baseUrl), {
66709
+ headers: { Authorization: `Bearer ${apiKey}` }
66710
+ });
66016
66711
  this.socket.on("message", (data) => {
66017
66712
  let event;
66018
66713
  try {
@@ -66436,7 +67131,9 @@ function attach(options, pendingByCallId, transferredCallIds, call) {
66436
67131
  usage.outputTokens = (usage.outputTokens ?? 0) + (result2.usage.outputTokens ?? 0);
66437
67132
  }
66438
67133
  call.send("", { last: true });
66439
- const roundItems = [...newInput];
67134
+ const roundItems = [
67135
+ ...newInput
67136
+ ];
66440
67137
  let agentEntry;
66441
67138
  if (result2.text) {
66442
67139
  agentEntry = { role: "agent", text: result2.text, timestamp: (/* @__PURE__ */ new Date()).toISOString() };
@@ -66462,7 +67159,12 @@ function attach(options, pendingByCallId, transferredCallIds, call) {
66462
67159
  previousResponseId = result2.responseId ?? previousResponseId;
66463
67160
  const nextInput = inFlight.map((f, i) => {
66464
67161
  if (!chainingEnabled) {
66465
- roundItems.push({ role: "tool_call", id: f.call.id, name: f.call.name, arguments: f.call.arguments });
67162
+ roundItems.push({
67163
+ role: "tool_call",
67164
+ id: f.call.id,
67165
+ name: f.call.name,
67166
+ arguments: f.call.arguments
67167
+ });
66466
67168
  }
66467
67169
  const outcome = outcomes[i];
66468
67170
  return {
@@ -66586,7 +67288,14 @@ async function resolvePerCallOptions(options, call, context, ctx) {
66586
67288
  if (offersHangup(tools)) {
66587
67289
  resolvedPrompt += options.provider === "openai" ? DELEGATED_CALL_TERMINATION_INSTRUCTIONS : CALL_TERMINATION_INSTRUCTIONS;
66588
67290
  }
66589
- return { ...rest, prompt: resolvedPrompt, greeting, voice, tools, language: language ?? DEFAULT_LANGUAGE };
67291
+ return {
67292
+ ...rest,
67293
+ prompt: resolvedPrompt,
67294
+ greeting,
67295
+ voice,
67296
+ tools,
67297
+ language: language ?? DEFAULT_LANGUAGE
67298
+ };
66590
67299
  }
66591
67300
  function realtimeAgent(options) {
66592
67301
  if (!options.provider) {
@@ -66770,7 +67479,11 @@ function realtimeAgent(options) {
66770
67479
  });
66771
67480
  },
66772
67481
  onTurn(turn) {
66773
- const entry = { role: turn.role, text: turn.text, timestamp: turn.timestamp };
67482
+ const entry = {
67483
+ role: turn.role,
67484
+ text: turn.text,
67485
+ timestamp: turn.timestamp
67486
+ };
66774
67487
  if (turn.role === "user") {
66775
67488
  flushPendingStreamLog();
66776
67489
  lastUserTurnAt = Date.now();
@@ -67429,7 +68142,7 @@ function semver_compare_default(a, b) {
67429
68142
 
67430
68143
  // ../../node_modules/libphonenumber-js/es6/helpers/isObject.js
67431
68144
  var objectConstructor = {}.constructor;
67432
- function isObject(object) {
68145
+ function isObject2(object) {
67433
68146
  return object !== void 0 && object !== null && object.constructor === objectConstructor;
67434
68147
  }
67435
68148
 
@@ -67837,7 +68550,7 @@ var NumberingPlan = /* @__PURE__ */ (function() {
67837
68550
  }
67838
68551
  }, {
67839
68552
  key: "types",
67840
- value: function types() {
68553
+ value: function types2() {
67841
68554
  return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
67842
68555
  }
67843
68556
  }, {
@@ -67934,36 +68647,36 @@ var Type = /* @__PURE__ */ (function() {
67934
68647
  }
67935
68648
  }]);
67936
68649
  })();
67937
- function getType(types, type) {
68650
+ function getType(types2, type) {
67938
68651
  switch (type) {
67939
68652
  case "FIXED_LINE":
67940
- return types[0];
68653
+ return types2[0];
67941
68654
  case "MOBILE":
67942
- return types[1];
68655
+ return types2[1];
67943
68656
  case "TOLL_FREE":
67944
- return types[2];
68657
+ return types2[2];
67945
68658
  case "PREMIUM_RATE":
67946
- return types[3];
68659
+ return types2[3];
67947
68660
  case "PERSONAL_NUMBER":
67948
- return types[4];
68661
+ return types2[4];
67949
68662
  case "VOICEMAIL":
67950
- return types[5];
68663
+ return types2[5];
67951
68664
  case "UAN":
67952
- return types[6];
68665
+ return types2[6];
67953
68666
  case "PAGER":
67954
- return types[7];
68667
+ return types2[7];
67955
68668
  case "VOIP":
67956
- return types[8];
68669
+ return types2[8];
67957
68670
  case "SHARED_COST":
67958
- return types[9];
68671
+ return types2[9];
67959
68672
  }
67960
68673
  }
67961
68674
  function validateMetadata(metadata) {
67962
68675
  if (!metadata) {
67963
68676
  throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");
67964
68677
  }
67965
- if (!isObject(metadata) || !isObject(metadata.countries)) {
67966
- throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(isObject(metadata) ? "an object of shape: { " + Object.keys(metadata).join(", ") + " }" : "a " + typeOf(metadata) + ": " + metadata, "."));
68678
+ if (!isObject2(metadata) || !isObject2(metadata.countries)) {
68679
+ throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(isObject2(metadata) ? "an object of shape: { " + Object.keys(metadata).join(", ") + " }" : "a " + typeOf(metadata) + ": " + metadata, "."));
67967
68680
  }
67968
68681
  }
67969
68682
  var typeOf = function typeOf2(_) {
@@ -68816,7 +69529,7 @@ var PhoneNumber = /* @__PURE__ */ (function() {
68816
69529
  if (countryOrCountryCallingCode[0] === "+" && !nationalNumber) {
68817
69530
  throw new TypeError("`metadata` argument not passed");
68818
69531
  }
68819
- if (isObject(nationalNumber) && isObject(nationalNumber.countries)) {
69532
+ if (isObject2(nationalNumber) && isObject2(nationalNumber.countries)) {
68820
69533
  metadata = nationalNumber;
68821
69534
  var e164Number = countryOrCountryCallingCode;
68822
69535
  if (!E164_NUMBER_REGEXP.test(e164Number)) {
@@ -69629,7 +70342,7 @@ function normalizeArguments(args) {
69629
70342
  defaultCountry: arg_2
69630
70343
  }, options);
69631
70344
  }
69632
- } else if (isObject(arg_2)) {
70345
+ } else if (isObject2(arg_2)) {
69633
70346
  if (arg_3) {
69634
70347
  options = arg_2;
69635
70348
  metadata = arg_3;
@@ -70152,7 +70865,7 @@ function isArrayBufferView(val) {
70152
70865
  var isString = typeOfTest("string");
70153
70866
  var isFunction = typeOfTest("function");
70154
70867
  var isNumber = typeOfTest("number");
70155
- var isObject2 = (thing) => thing !== null && typeof thing === "object";
70868
+ var isObject3 = (thing) => thing !== null && typeof thing === "object";
70156
70869
  var isBoolean = (thing) => thing === true || thing === false;
70157
70870
  var isPlainObject2 = (val) => {
70158
70871
  if (kindOf(val) !== "object") {
@@ -70162,7 +70875,7 @@ var isPlainObject2 = (val) => {
70162
70875
  return (prototype2 === null || prototype2 === Object.prototype || Object.getPrototypeOf(prototype2) === null) && !(toStringTag in val) && !(iterator in val);
70163
70876
  };
70164
70877
  var isEmptyObject = (val) => {
70165
- if (!isObject2(val) || isBuffer(val)) {
70878
+ if (!isObject3(val) || isBuffer(val)) {
70166
70879
  return false;
70167
70880
  }
70168
70881
  try {
@@ -70179,7 +70892,7 @@ var isReactNativeBlob = (value) => {
70179
70892
  var isReactNative = (formData) => formData && typeof formData.getParts !== "undefined";
70180
70893
  var isBlob2 = kindOfTest("Blob");
70181
70894
  var isFileList = kindOfTest("FileList");
70182
- var isStream = (val) => isObject2(val) && isFunction(val.pipe);
70895
+ var isStream = (val) => isObject3(val) && isFunction(val.pipe);
70183
70896
  function getGlobal() {
70184
70897
  if (typeof globalThis !== "undefined") return globalThis;
70185
70898
  if (typeof self !== "undefined") return self;
@@ -70451,7 +71164,7 @@ function isSpecCompliantForm(thing) {
70451
71164
  var toJSONObject = (obj) => {
70452
71165
  const stack = new Array(10);
70453
71166
  const visit = (source, i) => {
70454
- if (isObject2(source)) {
71167
+ if (isObject3(source)) {
70455
71168
  if (stack.indexOf(source) >= 0) {
70456
71169
  return;
70457
71170
  }
@@ -70474,7 +71187,7 @@ var toJSONObject = (obj) => {
70474
71187
  return visit(obj, 0);
70475
71188
  };
70476
71189
  var isAsyncFn = kindOfTest("AsyncFunction");
70477
- var isThenable = (thing) => thing && (isObject2(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
71190
+ var isThenable = (thing) => thing && (isObject3(thing) || isFunction(thing)) && isFunction(thing.then) && isFunction(thing.catch);
70478
71191
  var _setImmediate = ((setImmediateSupported, postMessageSupported) => {
70479
71192
  if (setImmediateSupported) {
70480
71193
  return setImmediate;
@@ -70506,7 +71219,7 @@ var utils_default = {
70506
71219
  isString,
70507
71220
  isNumber,
70508
71221
  isBoolean,
70509
- isObject: isObject2,
71222
+ isObject: isObject3,
70510
71223
  isPlainObject: isPlainObject2,
70511
71224
  isEmptyObject,
70512
71225
  isReadableStream,
@@ -70740,22 +71453,22 @@ var AxiosHeaders = class {
70740
71453
  }
70741
71454
  }
70742
71455
  }
70743
- has(header, matcher) {
71456
+ has(header, matcher2) {
70744
71457
  header = normalizeHeader(header);
70745
71458
  if (header) {
70746
71459
  const key = utils_default.findKey(this, header);
70747
- return !!(key && this[key] !== void 0 && (!matcher || matchHeaderValue(this, this[key], key, matcher)));
71460
+ return !!(key && this[key] !== void 0 && (!matcher2 || matchHeaderValue(this, this[key], key, matcher2)));
70748
71461
  }
70749
71462
  return false;
70750
71463
  }
70751
- delete(header, matcher) {
71464
+ delete(header, matcher2) {
70752
71465
  const self2 = this;
70753
71466
  let deleted = false;
70754
71467
  function deleteHeader(_header) {
70755
71468
  _header = normalizeHeader(_header);
70756
71469
  if (_header) {
70757
71470
  const key = utils_default.findKey(self2, _header);
70758
- if (key && (!matcher || matchHeaderValue(self2, self2[key], key, matcher))) {
71471
+ if (key && (!matcher2 || matchHeaderValue(self2, self2[key], key, matcher2))) {
70759
71472
  delete self2[key];
70760
71473
  deleted = true;
70761
71474
  }
@@ -70768,13 +71481,13 @@ var AxiosHeaders = class {
70768
71481
  }
70769
71482
  return deleted;
70770
71483
  }
70771
- clear(matcher) {
71484
+ clear(matcher2) {
70772
71485
  const keys = Object.keys(this);
70773
71486
  let i = keys.length;
70774
71487
  let deleted = false;
70775
71488
  while (i--) {
70776
71489
  const key = keys[i];
70777
- if (!matcher || matchHeaderValue(this, this[key], key, matcher, true)) {
71490
+ if (!matcher2 || matchHeaderValue(this, this[key], key, matcher2, true)) {
70778
71491
  delete this[key];
70779
71492
  deleted = true;
70780
71493
  }
@@ -70868,7 +71581,7 @@ utils_default.freezeMethods(AxiosHeaders);
70868
71581
  var AxiosHeaders_default = AxiosHeaders;
70869
71582
 
70870
71583
  // ../../node_modules/axios/lib/core/AxiosError.js
70871
- var REDACTED2 = "[REDACTED ****]";
71584
+ var REDACTED3 = "[REDACTED ****]";
70872
71585
  function hasOwnOrPrototypeToJSON(source) {
70873
71586
  if (utils_default.hasOwnProp(source, "toJSON")) {
70874
71587
  return true;
@@ -70909,7 +71622,7 @@ function redactConfig(config, redactKeys) {
70909
71622
  }
70910
71623
  result2 = /* @__PURE__ */ Object.create(null);
70911
71624
  for (const [key, value] of Object.entries(source)) {
70912
- const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED2 : visit(value);
71625
+ const reducedValue = lowerKeys.has(key.toLowerCase()) ? REDACTED3 : visit(value);
70913
71626
  if (!utils_default.isUndefined(reducedValue)) {
70914
71627
  result2[key] = reducedValue;
70915
71628
  }
@@ -74609,6 +75322,7 @@ async function configureConversationWebhooks(webhookUrl, config) {
74609
75322
  const hmacSecret = randomBytes(32).toString("hex");
74610
75323
  process.env.CONVERSATION_WEBHOOK_SECRET = hmacSecret;
74611
75324
  resetSinchClients();
75325
+ configureSecretRedaction(process.env);
74612
75326
  await sinchClient.conversation.webhooks.update({
74613
75327
  webhook_id: deployedWebhook.id,
74614
75328
  webhookUpdateRequestBody: {
@@ -74621,7 +75335,10 @@ async function configureConversationWebhooks(webhookUrl, config) {
74621
75335
  console.log("\u{1F512} HMAC secret configured for webhook signature validation");
74622
75336
  console.log("\u{1F4AC} Send a message to your Conversation app to test!");
74623
75337
  } catch (error) {
74624
- console.log("\u26A0\uFE0F Could not configure Conversation webhooks:", error instanceof Error ? error.message : error);
75338
+ console.log(
75339
+ "\u26A0\uFE0F Could not configure Conversation webhooks:",
75340
+ error instanceof Error ? error.message : error
75341
+ );
74625
75342
  }
74626
75343
  }
74627
75344
  async function cleanupConversationWebhook(config) {
@@ -74661,7 +75378,10 @@ async function cleanupConversationWebhook(config) {
74661
75378
  delete process.env.CONVERSATION_WEBHOOK_SECRET;
74662
75379
  resetSinchClients();
74663
75380
  } catch (error) {
74664
- console.log("\u26A0\uFE0F Could not restore Conversation webhook:", error instanceof Error ? error.message : error);
75381
+ console.log(
75382
+ "\u26A0\uFE0F Could not restore Conversation webhook:",
75383
+ error instanceof Error ? error.message : error
75384
+ );
74665
75385
  }
74666
75386
  }
74667
75387
  async function configureElevenLabs() {
@@ -74676,7 +75396,10 @@ async function configureElevenLabs() {
74676
75396
  console.log("\u{1F916} ElevenLabs auto-configuration enabled");
74677
75397
  console.log(` Agent ID: ${agentId}`);
74678
75398
  } catch (error) {
74679
- console.log("\u26A0\uFE0F Could not configure ElevenLabs:", error instanceof Error ? error.message : error);
75399
+ console.log(
75400
+ "\u26A0\uFE0F Could not configure ElevenLabs:",
75401
+ error instanceof Error ? error.message : error
75402
+ );
74680
75403
  }
74681
75404
  }
74682
75405
  var VOICE_V2_HOST = "https://voice.api.sinch.com";
@@ -75263,9 +75986,16 @@ var TunnelClient = class {
75263
75986
  }
75264
75987
  this.ws?.send(JSON.stringify(responseMessage));
75265
75988
  } catch (error) {
75266
- console.error(`Error forwarding request: ${error.message} (${error.response?.status || "no response"})`);
75989
+ console.error(
75990
+ `Error forwarding request: ${error.message} (${error.response?.status || "no response"})`
75991
+ );
75267
75992
  if (verbose && error.response?.data) {
75268
- console.error(` \u2192 Error body: ${typeof error.response.data === "string" ? error.response.data : JSON.stringify(error.response.data)}`.substring(0, 2e3));
75993
+ console.error(
75994
+ ` \u2192 Error body: ${typeof error.response.data === "string" ? error.response.data : JSON.stringify(error.response.data)}`.substring(
75995
+ 0,
75996
+ 2e3
75997
+ )
75998
+ );
75269
75999
  }
75270
76000
  const errorResponse = {
75271
76001
  type: "response",
@@ -75310,7 +76040,10 @@ var TunnelClient = class {
75310
76040
  await this.configureVoiceWebhooks();
75311
76041
  }
75312
76042
  if (autoConfigConversation && process.env.CONVERSATION_APP_ID) {
75313
- await configureConversationWebhooks(this.buildTunnelUrl("/webhook/conversation"), this.webhookConfig);
76043
+ await configureConversationWebhooks(
76044
+ this.buildTunnelUrl("/webhook/conversation"),
76045
+ this.webhookConfig
76046
+ );
75314
76047
  }
75315
76048
  if (process.env.ELEVENLABS_AUTO_CONFIGURE === "true") {
75316
76049
  await configureElevenLabs();
@@ -75610,11 +76343,9 @@ var macKeychain = {
75610
76343
  },
75611
76344
  async deletePassword(service, account) {
75612
76345
  try {
75613
- await execFileAsync(
75614
- "security",
75615
- ["delete-generic-password", "-s", service, "-a", account],
75616
- { timeout: 15e3 }
75617
- );
76346
+ await execFileAsync("security", ["delete-generic-password", "-s", service, "-a", account], {
76347
+ timeout: 15e3
76348
+ });
75618
76349
  return true;
75619
76350
  } catch {
75620
76351
  return false;
@@ -75679,11 +76410,9 @@ var linuxKeychain = {
75679
76410
  },
75680
76411
  async deletePassword(service, account) {
75681
76412
  try {
75682
- await execFileAsync(
75683
- "secret-tool",
75684
- ["clear", "service", service, "account", account],
75685
- { timeout: 15e3 }
75686
- );
76413
+ await execFileAsync("secret-tool", ["clear", "service", service, "account", account], {
76414
+ timeout: 15e3
76415
+ });
75687
76416
  return true;
75688
76417
  } catch (err) {
75689
76418
  debugKeychain("clear", err);
@@ -76044,6 +76773,12 @@ export {
76044
76773
  shouldValidateWebhook,
76045
76774
  getProtectionMode,
76046
76775
  createSecurityOptions,
76776
+ configureSecretRedaction,
76777
+ redactSecrets,
76778
+ redactAsText,
76779
+ secretLookaheadBytes,
76780
+ safeCut,
76781
+ installStdioRedaction,
76047
76782
  VOICE_TIMESTAMP_SKEW_MS,
76048
76783
  VOICE_MISSING_SECRET_WARNING,
76049
76784
  validateVoiceSignature,
@@ -76419,4 +77154,4 @@ serve-static/index.js:
76419
77154
  * MIT Licensed
76420
77155
  *)
76421
77156
  */
76422
- //# sourceMappingURL=chunk-H2JZGXXT.js.map
77157
+ //# sourceMappingURL=chunk-DLBCKZ6X.js.map