agent-relay 4.0.30 → 4.0.32

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.
Files changed (158) hide show
  1. package/README.md +88 -48
  2. package/bin/agent-relay-broker-darwin-arm64 +0 -0
  3. package/bin/agent-relay-broker-darwin-x64 +0 -0
  4. package/bin/agent-relay-broker-linux-arm64 +0 -0
  5. package/bin/agent-relay-broker-linux-x64 +0 -0
  6. package/dist/index.cjs +309 -129
  7. package/dist/src/cli/bootstrap.d.ts +2 -1
  8. package/dist/src/cli/bootstrap.d.ts.map +1 -1
  9. package/dist/src/cli/bootstrap.js +223 -17
  10. package/dist/src/cli/bootstrap.js.map +1 -1
  11. package/dist/src/cli/commands/agent-management.d.ts.map +1 -1
  12. package/dist/src/cli/commands/agent-management.js +1 -3
  13. package/dist/src/cli/commands/agent-management.js.map +1 -1
  14. package/dist/src/cli/commands/auth.d.ts.map +1 -1
  15. package/dist/src/cli/commands/auth.js +32 -3
  16. package/dist/src/cli/commands/auth.js.map +1 -1
  17. package/dist/src/cli/commands/cloud.d.ts.map +1 -1
  18. package/dist/src/cli/commands/cloud.js +242 -144
  19. package/dist/src/cli/commands/cloud.js.map +1 -1
  20. package/dist/src/cli/commands/core.d.ts.map +1 -1
  21. package/dist/src/cli/commands/core.js +11 -6
  22. package/dist/src/cli/commands/core.js.map +1 -1
  23. package/dist/src/cli/commands/messaging.d.ts.map +1 -1
  24. package/dist/src/cli/commands/messaging.js +1 -3
  25. package/dist/src/cli/commands/messaging.js.map +1 -1
  26. package/dist/src/cli/commands/monitoring.d.ts.map +1 -1
  27. package/dist/src/cli/commands/monitoring.js +5 -4
  28. package/dist/src/cli/commands/monitoring.js.map +1 -1
  29. package/dist/src/cli/commands/on.d.ts.map +1 -1
  30. package/dist/src/cli/commands/on.js +1 -3
  31. package/dist/src/cli/commands/on.js.map +1 -1
  32. package/dist/src/cli/commands/setup.d.ts.map +1 -1
  33. package/dist/src/cli/commands/setup.js +62 -7
  34. package/dist/src/cli/commands/setup.js.map +1 -1
  35. package/dist/src/cli/commands/swarm.d.ts.map +1 -1
  36. package/dist/src/cli/commands/swarm.js +34 -4
  37. package/dist/src/cli/commands/swarm.js.map +1 -1
  38. package/dist/src/cli/index.js +9 -1
  39. package/dist/src/cli/index.js.map +1 -1
  40. package/dist/src/cli/lib/exit.d.ts +49 -0
  41. package/dist/src/cli/lib/exit.d.ts.map +1 -0
  42. package/dist/src/cli/lib/exit.js +73 -0
  43. package/dist/src/cli/lib/exit.js.map +1 -0
  44. package/dist/src/cli/lib/telemetry-helpers.d.ts +20 -0
  45. package/dist/src/cli/lib/telemetry-helpers.d.ts.map +1 -0
  46. package/dist/src/cli/lib/telemetry-helpers.js +31 -0
  47. package/dist/src/cli/lib/telemetry-helpers.js.map +1 -0
  48. package/node_modules/@agent-relay/cloud/package.json +2 -2
  49. package/node_modules/@agent-relay/config/package.json +1 -1
  50. package/node_modules/@agent-relay/hooks/package.json +4 -4
  51. package/node_modules/@agent-relay/sdk/README.md +3 -0
  52. package/node_modules/@agent-relay/sdk/dist/relay.d.ts +16 -0
  53. package/node_modules/@agent-relay/sdk/dist/relay.d.ts.map +1 -1
  54. package/node_modules/@agent-relay/sdk/dist/relay.js +83 -0
  55. package/node_modules/@agent-relay/sdk/dist/relay.js.map +1 -1
  56. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.d.ts +62 -12
  57. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.d.ts.map +1 -1
  58. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js +137 -47
  59. package/node_modules/@agent-relay/sdk/dist/workflows/file-db.js.map +1 -1
  60. package/node_modules/@agent-relay/sdk/package.json +2 -2
  61. package/node_modules/@agent-relay/telemetry/dist/client.d.ts +14 -2
  62. package/node_modules/@agent-relay/telemetry/dist/client.d.ts.map +1 -1
  63. package/node_modules/@agent-relay/telemetry/dist/client.js +22 -4
  64. package/node_modules/@agent-relay/telemetry/dist/client.js.map +1 -1
  65. package/node_modules/@agent-relay/telemetry/dist/events.d.ts +217 -10
  66. package/node_modules/@agent-relay/telemetry/dist/events.d.ts.map +1 -1
  67. package/node_modules/@agent-relay/telemetry/dist/events.js +11 -0
  68. package/node_modules/@agent-relay/telemetry/dist/events.js.map +1 -1
  69. package/node_modules/@agent-relay/telemetry/dist/index.d.ts +2 -2
  70. package/node_modules/@agent-relay/telemetry/dist/index.d.ts.map +1 -1
  71. package/node_modules/@agent-relay/telemetry/dist/index.js.map +1 -1
  72. package/node_modules/@agent-relay/telemetry/package.json +2 -2
  73. package/node_modules/@agent-relay/trajectory/package.json +2 -2
  74. package/node_modules/@agent-relay/user-directory/package.json +2 -2
  75. package/node_modules/@agent-relay/utils/package.json +2 -2
  76. package/node_modules/@relaycast/sdk/dist/version.d.ts +1 -1
  77. package/node_modules/@relaycast/sdk/dist/version.js +1 -1
  78. package/node_modules/@relaycast/sdk/node_modules/@relaycast/types/package.json +1 -1
  79. package/node_modules/@relaycast/sdk/package.json +2 -2
  80. package/node_modules/agent-trajectories/dist/{chunk-2XT3DOJC.js → chunk-27AQPWHK.js} +136 -72
  81. package/node_modules/agent-trajectories/dist/chunk-27AQPWHK.js.map +1 -0
  82. package/node_modules/agent-trajectories/dist/cli/index.js +135 -71
  83. package/node_modules/agent-trajectories/dist/cli/index.js.map +1 -1
  84. package/node_modules/agent-trajectories/dist/{index-thTh5iI8.d.ts → index-C7XhwsoN.d.ts} +24 -0
  85. package/node_modules/agent-trajectories/dist/index.d.ts +2 -2
  86. package/node_modules/agent-trajectories/dist/index.js +1 -1
  87. package/node_modules/agent-trajectories/dist/sdk/index.d.ts +1 -1
  88. package/node_modules/agent-trajectories/dist/sdk/index.js +1 -1
  89. package/node_modules/agent-trajectories/package.json +1 -1
  90. package/node_modules/axios/CHANGELOG.md +166 -0
  91. package/node_modules/axios/README.md +210 -204
  92. package/node_modules/axios/dist/axios.js +92 -63
  93. package/node_modules/axios/dist/axios.js.map +1 -1
  94. package/node_modules/axios/dist/axios.min.js +2 -2
  95. package/node_modules/axios/dist/axios.min.js.map +1 -1
  96. package/node_modules/axios/dist/browser/axios.cjs +140 -101
  97. package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
  98. package/node_modules/axios/dist/esm/axios.js +140 -101
  99. package/node_modules/axios/dist/esm/axios.js.map +1 -1
  100. package/node_modules/axios/dist/esm/axios.min.js +2 -2
  101. package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
  102. package/node_modules/axios/dist/node/axios.cjs +199 -75
  103. package/node_modules/axios/dist/node/axios.cjs.map +1 -1
  104. package/node_modules/axios/index.d.cts +14 -28
  105. package/node_modules/axios/index.d.ts +132 -226
  106. package/node_modules/axios/lib/adapters/fetch.js +21 -6
  107. package/node_modules/axios/lib/adapters/http.js +88 -6
  108. package/node_modules/axios/lib/core/AxiosError.js +34 -33
  109. package/node_modules/axios/lib/core/AxiosHeaders.js +24 -25
  110. package/node_modules/axios/lib/core/buildFullPath.js +1 -1
  111. package/node_modules/axios/lib/core/mergeConfig.js +5 -3
  112. package/node_modules/axios/lib/defaults/index.js +13 -8
  113. package/node_modules/axios/lib/env/data.js +1 -1
  114. package/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +1 -2
  115. package/node_modules/axios/lib/helpers/formDataToJSON.js +3 -1
  116. package/node_modules/axios/lib/helpers/formDataToStream.js +2 -1
  117. package/node_modules/axios/lib/helpers/progressEventReducer.js +5 -5
  118. package/node_modules/axios/lib/helpers/resolveConfig.js +11 -3
  119. package/node_modules/axios/lib/helpers/shouldBypassProxy.js +48 -1
  120. package/node_modules/axios/lib/helpers/toFormData.js +10 -2
  121. package/node_modules/axios/lib/utils.js +10 -10
  122. package/node_modules/axios/package.json +4 -4
  123. package/package.json +9 -9
  124. package/packages/cloud/package.json +2 -2
  125. package/packages/config/package.json +1 -1
  126. package/packages/hooks/package.json +4 -4
  127. package/packages/sdk/README.md +3 -0
  128. package/packages/sdk/dist/relay.d.ts +16 -0
  129. package/packages/sdk/dist/relay.d.ts.map +1 -1
  130. package/packages/sdk/dist/relay.js +83 -0
  131. package/packages/sdk/dist/relay.js.map +1 -1
  132. package/packages/sdk/dist/workflows/file-db.d.ts +62 -12
  133. package/packages/sdk/dist/workflows/file-db.d.ts.map +1 -1
  134. package/packages/sdk/dist/workflows/file-db.js +137 -47
  135. package/packages/sdk/dist/workflows/file-db.js.map +1 -1
  136. package/packages/sdk/package.json +2 -2
  137. package/packages/telemetry/dist/client.d.ts +14 -2
  138. package/packages/telemetry/dist/client.d.ts.map +1 -1
  139. package/packages/telemetry/dist/client.js +22 -4
  140. package/packages/telemetry/dist/client.js.map +1 -1
  141. package/packages/telemetry/dist/events.d.ts +217 -10
  142. package/packages/telemetry/dist/events.d.ts.map +1 -1
  143. package/packages/telemetry/dist/events.js +11 -0
  144. package/packages/telemetry/dist/events.js.map +1 -1
  145. package/packages/telemetry/dist/index.d.ts +2 -2
  146. package/packages/telemetry/dist/index.d.ts.map +1 -1
  147. package/packages/telemetry/dist/index.js.map +1 -1
  148. package/packages/telemetry/package.json +2 -2
  149. package/packages/trajectory/package.json +2 -2
  150. package/packages/user-directory/package.json +2 -2
  151. package/packages/utils/package.json +2 -2
  152. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.d.ts +0 -12
  153. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/index.js +0 -17
  154. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/license +0 -9
  155. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/package.json +0 -43
  156. package/node_modules/@clack/prompts/node_modules/is-unicode-supported/readme.md +0 -35
  157. package/node_modules/agent-trajectories/dist/chunk-2XT3DOJC.js.map +0 -1
  158. package/node_modules/color-convert/CHANGELOG.md +0 -54
@@ -1,4 +1,4 @@
1
- /*! Axios v1.15.0 Copyright (c) 2026 Matt Zabriskie and contributors */
1
+ /*! Axios v1.15.1 Copyright (c) 2026 Matt Zabriskie and contributors */
2
2
  /**
3
3
  * Create a bound version of a function with a specified `this` context
4
4
  *
@@ -267,16 +267,16 @@ const G = getGlobal();
267
267
  const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
268
268
 
269
269
  const isFormData = (thing) => {
270
- let kind;
271
- return thing && (
272
- (FormDataCtor && thing instanceof FormDataCtor) || (
273
- isFunction$1(thing.append) && (
274
- (kind = kindOf(thing)) === 'formdata' ||
275
- // detect form-data instance
276
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
277
- )
278
- )
279
- );
270
+ if (!thing) return false;
271
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
272
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
273
+ const proto = getPrototypeOf(thing);
274
+ if (!proto || proto === Object.prototype) return false;
275
+ if (!isFunction$1(thing.append)) return false;
276
+ const kind = kindOf(thing);
277
+ return kind === 'formdata' ||
278
+ // detect form-data instance
279
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]');
280
280
  };
281
281
 
282
282
  /**
@@ -943,40 +943,40 @@ let AxiosError$1 = class AxiosError extends Error {
943
943
  return axiosError;
944
944
  }
945
945
 
946
- /**
947
- * Create an Error with the specified message, config, error code, request and response.
948
- *
949
- * @param {string} message The error message.
950
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
951
- * @param {Object} [config] The config.
952
- * @param {Object} [request] The request.
953
- * @param {Object} [response] The response.
954
- *
955
- * @returns {Error} The created error.
956
- */
957
- constructor(message, code, config, request, response) {
958
- super(message);
959
-
960
- // Make message enumerable to maintain backward compatibility
961
- // The native Error constructor sets message as non-enumerable,
962
- // but axios < v1.13.3 had it as enumerable
963
- Object.defineProperty(this, 'message', {
964
- value: message,
965
- enumerable: true,
966
- writable: true,
967
- configurable: true
968
- });
969
-
970
- this.name = 'AxiosError';
971
- this.isAxiosError = true;
972
- code && (this.code = code);
973
- config && (this.config = config);
974
- request && (this.request = request);
975
- if (response) {
976
- this.response = response;
977
- this.status = response.status;
978
- }
946
+ /**
947
+ * Create an Error with the specified message, config, error code, request and response.
948
+ *
949
+ * @param {string} message The error message.
950
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
951
+ * @param {Object} [config] The config.
952
+ * @param {Object} [request] The request.
953
+ * @param {Object} [response] The response.
954
+ *
955
+ * @returns {Error} The created error.
956
+ */
957
+ constructor(message, code, config, request, response) {
958
+ super(message);
959
+
960
+ // Make message enumerable to maintain backward compatibility
961
+ // The native Error constructor sets message as non-enumerable,
962
+ // but axios < v1.13.3 had it as enumerable
963
+ Object.defineProperty(this, 'message', {
964
+ value: message,
965
+ enumerable: true,
966
+ writable: true,
967
+ configurable: true,
968
+ });
969
+
970
+ this.name = 'AxiosError';
971
+ this.isAxiosError = true;
972
+ code && (this.code = code);
973
+ config && (this.config = config);
974
+ request && (this.request = request);
975
+ if (response) {
976
+ this.response = response;
977
+ this.status = response.status;
979
978
  }
979
+ }
980
980
 
981
981
  toJSON() {
982
982
  return {
@@ -1012,6 +1012,7 @@ AxiosError$1.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1012
1012
  AxiosError$1.ERR_CANCELED = 'ERR_CANCELED';
1013
1013
  AxiosError$1.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1014
1014
  AxiosError$1.ERR_INVALID_URL = 'ERR_INVALID_URL';
1015
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1015
1016
 
1016
1017
  // eslint-disable-next-line strict
1017
1018
  var httpAdapter = null;
@@ -1126,6 +1127,7 @@ function toFormData$1(obj, formData, options) {
1126
1127
  const dots = options.dots;
1127
1128
  const indexes = options.indexes;
1128
1129
  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1130
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1129
1131
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1130
1132
 
1131
1133
  if (!utils$1.isFunction(visitor)) {
@@ -1218,9 +1220,16 @@ function toFormData$1(obj, formData, options) {
1218
1220
  isVisitable,
1219
1221
  });
1220
1222
 
1221
- function build(value, path) {
1223
+ function build(value, path, depth = 0) {
1222
1224
  if (utils$1.isUndefined(value)) return;
1223
1225
 
1226
+ if (depth > maxDepth) {
1227
+ throw new AxiosError$1(
1228
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1229
+ AxiosError$1.ERR_FORM_DATA_DEPTH_EXCEEDED
1230
+ );
1231
+ }
1232
+
1224
1233
  if (stack.indexOf(value) !== -1) {
1225
1234
  throw Error('Circular reference detected in ' + path.join('.'));
1226
1235
  }
@@ -1233,7 +1242,7 @@ function toFormData$1(obj, formData, options) {
1233
1242
  visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1234
1243
 
1235
1244
  if (result === true) {
1236
- build(el, path ? path.concat(key) : [key]);
1245
+ build(el, path ? path.concat(key) : [key], depth + 1);
1237
1246
  }
1238
1247
  });
1239
1248
 
@@ -1265,9 +1274,8 @@ function encode$1(str) {
1265
1274
  ')': '%29',
1266
1275
  '~': '%7E',
1267
1276
  '%20': '+',
1268
- '%00': '\x00',
1269
1277
  };
1270
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1278
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
1271
1279
  return charMap[match];
1272
1280
  });
1273
1281
  }
@@ -1587,7 +1595,9 @@ function formDataToJSON(formData) {
1587
1595
 
1588
1596
  if (isLast) {
1589
1597
  if (utils$1.hasOwnProp(target, name)) {
1590
- target[name] = [target[name], value];
1598
+ target[name] = utils$1.isArray(target[name])
1599
+ ? target[name].concat(value)
1600
+ : [target[name], value];
1591
1601
  } else {
1592
1602
  target[name] = value;
1593
1603
  }
@@ -1621,6 +1631,8 @@ function formDataToJSON(formData) {
1621
1631
  return null;
1622
1632
  }
1623
1633
 
1634
+ const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
1635
+
1624
1636
  /**
1625
1637
  * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1626
1638
  * of the input
@@ -1688,20 +1700,22 @@ const defaults = {
1688
1700
  let isFileList;
1689
1701
 
1690
1702
  if (isObjectPayload) {
1703
+ const formSerializer = own(this, 'formSerializer');
1691
1704
  if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1692
- return toURLEncodedForm(data, this.formSerializer).toString();
1705
+ return toURLEncodedForm(data, formSerializer).toString();
1693
1706
  }
1694
1707
 
1695
1708
  if (
1696
1709
  (isFileList = utils$1.isFileList(data)) ||
1697
1710
  contentType.indexOf('multipart/form-data') > -1
1698
1711
  ) {
1699
- const _FormData = this.env && this.env.FormData;
1712
+ const env = own(this, 'env');
1713
+ const _FormData = env && env.FormData;
1700
1714
 
1701
1715
  return toFormData$1(
1702
1716
  isFileList ? { 'files[]': data } : data,
1703
1717
  _FormData && new _FormData(),
1704
- this.formSerializer
1718
+ formSerializer
1705
1719
  );
1706
1720
  }
1707
1721
  }
@@ -1717,9 +1731,10 @@ const defaults = {
1717
1731
 
1718
1732
  transformResponse: [
1719
1733
  function transformResponse(data) {
1720
- const transitional = this.transitional || defaults.transitional;
1734
+ const transitional = own(this, 'transitional') || defaults.transitional;
1721
1735
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1722
- const JSONRequested = this.responseType === 'json';
1736
+ const responseType = own(this, 'responseType');
1737
+ const JSONRequested = responseType === 'json';
1723
1738
 
1724
1739
  if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1725
1740
  return data;
@@ -1728,17 +1743,17 @@ const defaults = {
1728
1743
  if (
1729
1744
  data &&
1730
1745
  utils$1.isString(data) &&
1731
- ((forcedJSONParsing && !this.responseType) || JSONRequested)
1746
+ ((forcedJSONParsing && !responseType) || JSONRequested)
1732
1747
  ) {
1733
1748
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
1734
1749
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
1735
1750
 
1736
1751
  try {
1737
- return JSON.parse(data, this.parseReviver);
1752
+ return JSON.parse(data, own(this, 'parseReviver'));
1738
1753
  } catch (e) {
1739
1754
  if (strictJSONParsing) {
1740
1755
  if (e.name === 'SyntaxError') {
1741
- throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, this.response);
1756
+ throw AxiosError$1.from(e, AxiosError$1.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
1742
1757
  }
1743
1758
  throw e;
1744
1759
  }
@@ -1850,41 +1865,41 @@ var parseHeaders = (rawHeaders) => {
1850
1865
 
1851
1866
  const $internals = Symbol('internals');
1852
1867
 
1853
- const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
1868
+ const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1854
1869
 
1855
- function assertValidHeaderValue(value, header) {
1856
- if (value === false || value == null) {
1857
- return;
1858
- }
1859
-
1860
- if (utils$1.isArray(value)) {
1861
- value.forEach((v) => assertValidHeaderValue(v, header));
1862
- return;
1863
- }
1870
+ function trimSPorHTAB(str) {
1871
+ let start = 0;
1872
+ let end = str.length;
1864
1873
 
1865
- if (!isValidHeaderValue(String(value))) {
1866
- throw new Error(`Invalid character in header content ["${header}"]`);
1867
- }
1868
- }
1874
+ while (start < end) {
1875
+ const code = str.charCodeAt(start);
1869
1876
 
1870
- function normalizeHeader(header) {
1871
- return header && String(header).trim().toLowerCase();
1872
- }
1877
+ if (code !== 0x09 && code !== 0x20) {
1878
+ break;
1879
+ }
1873
1880
 
1874
- function stripTrailingCRLF(str) {
1875
- let end = str.length;
1881
+ start += 1;
1882
+ }
1876
1883
 
1877
- while (end > 0) {
1878
- const charCode = str.charCodeAt(end - 1);
1884
+ while (end > start) {
1885
+ const code = str.charCodeAt(end - 1);
1879
1886
 
1880
- if (charCode !== 10 && charCode !== 13) {
1887
+ if (code !== 0x09 && code !== 0x20) {
1881
1888
  break;
1882
1889
  }
1883
1890
 
1884
1891
  end -= 1;
1885
1892
  }
1886
1893
 
1887
- return end === str.length ? str : str.slice(0, end);
1894
+ return start === 0 && end === str.length ? str : str.slice(start, end);
1895
+ }
1896
+
1897
+ function normalizeHeader(header) {
1898
+ return header && String(header).trim().toLowerCase();
1899
+ }
1900
+
1901
+ function sanitizeHeaderValue(str) {
1902
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1888
1903
  }
1889
1904
 
1890
1905
  function normalizeValue(value) {
@@ -1892,7 +1907,7 @@ function normalizeValue(value) {
1892
1907
  return value;
1893
1908
  }
1894
1909
 
1895
- return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
1910
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1896
1911
  }
1897
1912
 
1898
1913
  function parseTokens(str) {
@@ -1974,7 +1989,6 @@ let AxiosHeaders$1 = class AxiosHeaders {
1974
1989
  _rewrite === true ||
1975
1990
  (_rewrite === undefined && self[key] !== false)
1976
1991
  ) {
1977
- assertValidHeaderValue(_value, _header);
1978
1992
  self[key || _header] = normalizeValue(_value);
1979
1993
  }
1980
1994
  }
@@ -2397,13 +2411,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2397
2411
  const _speedometer = speedometer(50, 250);
2398
2412
 
2399
2413
  return throttle((e) => {
2400
- const loaded = e.loaded;
2414
+ const rawLoaded = e.loaded;
2401
2415
  const total = e.lengthComputable ? e.total : undefined;
2402
- const progressBytes = loaded - bytesNotified;
2416
+ const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
2417
+ const progressBytes = Math.max(0, loaded - bytesNotified);
2403
2418
  const rate = _speedometer(progressBytes);
2404
- const inRange = loaded <= total;
2405
2419
 
2406
- bytesNotified = loaded;
2420
+ bytesNotified = Math.max(bytesNotified, loaded);
2407
2421
 
2408
2422
  const data = {
2409
2423
  loaded,
@@ -2411,7 +2425,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2411
2425
  progress: total ? loaded / total : undefined,
2412
2426
  bytes: progressBytes,
2413
2427
  rate: rate ? rate : undefined,
2414
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2428
+ estimated: rate && total ? (total - loaded) / rate : undefined,
2415
2429
  event: e,
2416
2430
  lengthComputable: total != null,
2417
2431
  [isDownloadStream ? 'download' : 'upload']: true,
@@ -2545,7 +2559,7 @@ function combineURLs(baseURL, relativeURL) {
2545
2559
  */
2546
2560
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2547
2561
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2548
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2562
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2549
2563
  return combineURLs(baseURL, requestedURL);
2550
2564
  }
2551
2565
  return requestedURL;
@@ -2604,9 +2618,9 @@ function mergeConfig$1(config1, config2) {
2604
2618
 
2605
2619
  // eslint-disable-next-line consistent-return
2606
2620
  function mergeDirectKeys(a, b, prop) {
2607
- if (prop in config2) {
2621
+ if (utils$1.hasOwnProp(config2, prop)) {
2608
2622
  return getMergedValue(a, b);
2609
- } else if (prop in config1) {
2623
+ } else if (utils$1.hasOwnProp(config1, prop)) {
2610
2624
  return getMergedValue(undefined, a);
2611
2625
  }
2612
2626
  }
@@ -2647,7 +2661,9 @@ function mergeConfig$1(config1, config2) {
2647
2661
  utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2648
2662
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
2649
2663
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2650
- const configValue = merge(config1[prop], config2[prop], prop);
2664
+ const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
2665
+ const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
2666
+ const configValue = merge(a, b, prop);
2651
2667
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2652
2668
  });
2653
2669
 
@@ -2701,10 +2717,18 @@ var resolveConfig = (config) => {
2701
2717
  // Specifically not if we're in a web worker, or react-native.
2702
2718
 
2703
2719
  if (platform.hasStandardBrowserEnv) {
2704
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2720
+ if (utils$1.isFunction(withXSRFToken)) {
2721
+ withXSRFToken = withXSRFToken(newConfig);
2722
+ }
2705
2723
 
2706
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
2707
- // Add xsrf header
2724
+ // Strict boolean check prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
2725
+ // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
2726
+ // the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
2727
+ const shouldSendXSRF =
2728
+ withXSRFToken === true ||
2729
+ (withXSRFToken == null && isURLSameOrigin(newConfig.url));
2730
+
2731
+ if (shouldSendXSRF) {
2708
2732
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2709
2733
 
2710
2734
  if (xsrfValue) {
@@ -3123,18 +3147,20 @@ const factory = (env) => {
3123
3147
  test(() => {
3124
3148
  let duplexAccessed = false;
3125
3149
 
3126
- const body = new ReadableStream$1();
3127
-
3128
- const hasContentType = new Request(platform.origin, {
3129
- body,
3150
+ const request = new Request(platform.origin, {
3151
+ body: new ReadableStream$1(),
3130
3152
  method: 'POST',
3131
3153
  get duplex() {
3132
3154
  duplexAccessed = true;
3133
3155
  return 'half';
3134
3156
  },
3135
- }).headers.has('Content-Type');
3157
+ });
3136
3158
 
3137
- body.cancel();
3159
+ const hasContentType = request.headers.has('Content-Type');
3160
+
3161
+ if (request.body != null) {
3162
+ request.body.cancel();
3163
+ }
3138
3164
 
3139
3165
  return duplexAccessed && !hasContentType;
3140
3166
  });
@@ -3278,6 +3304,19 @@ const factory = (env) => {
3278
3304
  // see https://github.com/cloudflare/workerd/issues/902
3279
3305
  const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
3280
3306
 
3307
+ // If data is FormData and Content-Type is multipart/form-data without boundary,
3308
+ // delete it so fetch can set it correctly with the boundary
3309
+ if (utils$1.isFormData(data)) {
3310
+ const contentType = headers.getContentType();
3311
+ if (
3312
+ contentType &&
3313
+ /^multipart\/form-data/i.test(contentType) &&
3314
+ !/boundary=/i.test(contentType)
3315
+ ) {
3316
+ headers.delete('content-type');
3317
+ }
3318
+ }
3319
+
3281
3320
  const resolvedOptions = {
3282
3321
  ...fetchOptions,
3283
3322
  signal: composedSignal,
@@ -3586,7 +3625,7 @@ function dispatchRequest(config) {
3586
3625
  );
3587
3626
  }
3588
3627
 
3589
- const VERSION$1 = "1.15.0";
3628
+ const VERSION$1 = "1.15.1";
3590
3629
 
3591
3630
  const validators$1 = {};
3592
3631