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
  'use strict';
3
3
 
4
4
  /**
@@ -269,16 +269,16 @@ const G = getGlobal();
269
269
  const FormDataCtor = typeof G.FormData !== 'undefined' ? G.FormData : undefined;
270
270
 
271
271
  const isFormData = (thing) => {
272
- let kind;
273
- return thing && (
274
- (FormDataCtor && thing instanceof FormDataCtor) || (
275
- isFunction$1(thing.append) && (
276
- (kind = kindOf(thing)) === 'formdata' ||
277
- // detect form-data instance
278
- (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')
279
- )
280
- )
281
- );
272
+ if (!thing) return false;
273
+ if (FormDataCtor && thing instanceof FormDataCtor) return true;
274
+ // Reject plain objects inheriting directly from Object.prototype so prototype-pollution gadgets can't spoof FormData (GHSA-6chq-wfr3-2hj9).
275
+ const proto = getPrototypeOf(thing);
276
+ if (!proto || proto === Object.prototype) return false;
277
+ if (!isFunction$1(thing.append)) return false;
278
+ const kind = kindOf(thing);
279
+ return kind === 'formdata' ||
280
+ // detect form-data instance
281
+ (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]');
282
282
  };
283
283
 
284
284
  /**
@@ -945,40 +945,40 @@ class AxiosError extends Error {
945
945
  return axiosError;
946
946
  }
947
947
 
948
- /**
949
- * Create an Error with the specified message, config, error code, request and response.
950
- *
951
- * @param {string} message The error message.
952
- * @param {string} [code] The error code (for example, 'ECONNABORTED').
953
- * @param {Object} [config] The config.
954
- * @param {Object} [request] The request.
955
- * @param {Object} [response] The response.
956
- *
957
- * @returns {Error} The created error.
958
- */
959
- constructor(message, code, config, request, response) {
960
- super(message);
961
-
962
- // Make message enumerable to maintain backward compatibility
963
- // The native Error constructor sets message as non-enumerable,
964
- // but axios < v1.13.3 had it as enumerable
965
- Object.defineProperty(this, 'message', {
966
- value: message,
967
- enumerable: true,
968
- writable: true,
969
- configurable: true
970
- });
971
-
972
- this.name = 'AxiosError';
973
- this.isAxiosError = true;
974
- code && (this.code = code);
975
- config && (this.config = config);
976
- request && (this.request = request);
977
- if (response) {
978
- this.response = response;
979
- this.status = response.status;
980
- }
948
+ /**
949
+ * Create an Error with the specified message, config, error code, request and response.
950
+ *
951
+ * @param {string} message The error message.
952
+ * @param {string} [code] The error code (for example, 'ECONNABORTED').
953
+ * @param {Object} [config] The config.
954
+ * @param {Object} [request] The request.
955
+ * @param {Object} [response] The response.
956
+ *
957
+ * @returns {Error} The created error.
958
+ */
959
+ constructor(message, code, config, request, response) {
960
+ super(message);
961
+
962
+ // Make message enumerable to maintain backward compatibility
963
+ // The native Error constructor sets message as non-enumerable,
964
+ // but axios < v1.13.3 had it as enumerable
965
+ Object.defineProperty(this, 'message', {
966
+ value: message,
967
+ enumerable: true,
968
+ writable: true,
969
+ configurable: true,
970
+ });
971
+
972
+ this.name = 'AxiosError';
973
+ this.isAxiosError = true;
974
+ code && (this.code = code);
975
+ config && (this.config = config);
976
+ request && (this.request = request);
977
+ if (response) {
978
+ this.response = response;
979
+ this.status = response.status;
981
980
  }
981
+ }
982
982
 
983
983
  toJSON() {
984
984
  return {
@@ -1014,6 +1014,7 @@ AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST';
1014
1014
  AxiosError.ERR_CANCELED = 'ERR_CANCELED';
1015
1015
  AxiosError.ERR_NOT_SUPPORT = 'ERR_NOT_SUPPORT';
1016
1016
  AxiosError.ERR_INVALID_URL = 'ERR_INVALID_URL';
1017
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED = 'ERR_FORM_DATA_DEPTH_EXCEEDED';
1017
1018
 
1018
1019
  // eslint-disable-next-line strict
1019
1020
  var httpAdapter = null;
@@ -1128,6 +1129,7 @@ function toFormData(obj, formData, options) {
1128
1129
  const dots = options.dots;
1129
1130
  const indexes = options.indexes;
1130
1131
  const _Blob = options.Blob || (typeof Blob !== 'undefined' && Blob);
1132
+ const maxDepth = options.maxDepth === undefined ? 100 : options.maxDepth;
1131
1133
  const useBlob = _Blob && utils$1.isSpecCompliantForm(formData);
1132
1134
 
1133
1135
  if (!utils$1.isFunction(visitor)) {
@@ -1220,9 +1222,16 @@ function toFormData(obj, formData, options) {
1220
1222
  isVisitable,
1221
1223
  });
1222
1224
 
1223
- function build(value, path) {
1225
+ function build(value, path, depth = 0) {
1224
1226
  if (utils$1.isUndefined(value)) return;
1225
1227
 
1228
+ if (depth > maxDepth) {
1229
+ throw new AxiosError(
1230
+ 'Object is too deeply nested (' + depth + ' levels). Max depth: ' + maxDepth,
1231
+ AxiosError.ERR_FORM_DATA_DEPTH_EXCEEDED
1232
+ );
1233
+ }
1234
+
1226
1235
  if (stack.indexOf(value) !== -1) {
1227
1236
  throw Error('Circular reference detected in ' + path.join('.'));
1228
1237
  }
@@ -1235,7 +1244,7 @@ function toFormData(obj, formData, options) {
1235
1244
  visitor.call(formData, el, utils$1.isString(key) ? key.trim() : key, path, exposedHelpers);
1236
1245
 
1237
1246
  if (result === true) {
1238
- build(el, path ? path.concat(key) : [key]);
1247
+ build(el, path ? path.concat(key) : [key], depth + 1);
1239
1248
  }
1240
1249
  });
1241
1250
 
@@ -1267,9 +1276,8 @@ function encode$1(str) {
1267
1276
  ')': '%29',
1268
1277
  '~': '%7E',
1269
1278
  '%20': '+',
1270
- '%00': '\x00',
1271
1279
  };
1272
- return encodeURIComponent(str).replace(/[!'()~]|%20|%00/g, function replacer(match) {
1280
+ return encodeURIComponent(str).replace(/[!'()~]|%20/g, function replacer(match) {
1273
1281
  return charMap[match];
1274
1282
  });
1275
1283
  }
@@ -1589,7 +1597,9 @@ function formDataToJSON(formData) {
1589
1597
 
1590
1598
  if (isLast) {
1591
1599
  if (utils$1.hasOwnProp(target, name)) {
1592
- target[name] = [target[name], value];
1600
+ target[name] = utils$1.isArray(target[name])
1601
+ ? target[name].concat(value)
1602
+ : [target[name], value];
1593
1603
  } else {
1594
1604
  target[name] = value;
1595
1605
  }
@@ -1623,6 +1633,8 @@ function formDataToJSON(formData) {
1623
1633
  return null;
1624
1634
  }
1625
1635
 
1636
+ const own = (obj, key) => (obj != null && utils$1.hasOwnProp(obj, key) ? obj[key] : undefined);
1637
+
1626
1638
  /**
1627
1639
  * It takes a string, tries to parse it, and if it fails, it returns the stringified version
1628
1640
  * of the input
@@ -1690,20 +1702,22 @@ const defaults = {
1690
1702
  let isFileList;
1691
1703
 
1692
1704
  if (isObjectPayload) {
1705
+ const formSerializer = own(this, 'formSerializer');
1693
1706
  if (contentType.indexOf('application/x-www-form-urlencoded') > -1) {
1694
- return toURLEncodedForm(data, this.formSerializer).toString();
1707
+ return toURLEncodedForm(data, formSerializer).toString();
1695
1708
  }
1696
1709
 
1697
1710
  if (
1698
1711
  (isFileList = utils$1.isFileList(data)) ||
1699
1712
  contentType.indexOf('multipart/form-data') > -1
1700
1713
  ) {
1701
- const _FormData = this.env && this.env.FormData;
1714
+ const env = own(this, 'env');
1715
+ const _FormData = env && env.FormData;
1702
1716
 
1703
1717
  return toFormData(
1704
1718
  isFileList ? { 'files[]': data } : data,
1705
1719
  _FormData && new _FormData(),
1706
- this.formSerializer
1720
+ formSerializer
1707
1721
  );
1708
1722
  }
1709
1723
  }
@@ -1719,9 +1733,10 @@ const defaults = {
1719
1733
 
1720
1734
  transformResponse: [
1721
1735
  function transformResponse(data) {
1722
- const transitional = this.transitional || defaults.transitional;
1736
+ const transitional = own(this, 'transitional') || defaults.transitional;
1723
1737
  const forcedJSONParsing = transitional && transitional.forcedJSONParsing;
1724
- const JSONRequested = this.responseType === 'json';
1738
+ const responseType = own(this, 'responseType');
1739
+ const JSONRequested = responseType === 'json';
1725
1740
 
1726
1741
  if (utils$1.isResponse(data) || utils$1.isReadableStream(data)) {
1727
1742
  return data;
@@ -1730,17 +1745,17 @@ const defaults = {
1730
1745
  if (
1731
1746
  data &&
1732
1747
  utils$1.isString(data) &&
1733
- ((forcedJSONParsing && !this.responseType) || JSONRequested)
1748
+ ((forcedJSONParsing && !responseType) || JSONRequested)
1734
1749
  ) {
1735
1750
  const silentJSONParsing = transitional && transitional.silentJSONParsing;
1736
1751
  const strictJSONParsing = !silentJSONParsing && JSONRequested;
1737
1752
 
1738
1753
  try {
1739
- return JSON.parse(data, this.parseReviver);
1754
+ return JSON.parse(data, own(this, 'parseReviver'));
1740
1755
  } catch (e) {
1741
1756
  if (strictJSONParsing) {
1742
1757
  if (e.name === 'SyntaxError') {
1743
- throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, this.response);
1758
+ throw AxiosError.from(e, AxiosError.ERR_BAD_RESPONSE, this, null, own(this, 'response'));
1744
1759
  }
1745
1760
  throw e;
1746
1761
  }
@@ -1852,41 +1867,41 @@ var parseHeaders = (rawHeaders) => {
1852
1867
 
1853
1868
  const $internals = Symbol('internals');
1854
1869
 
1855
- const isValidHeaderValue = (value) => !/[\r\n]/.test(value);
1870
+ const INVALID_HEADER_VALUE_CHARS_RE = /[^\x09\x20-\x7E\x80-\xFF]/g;
1856
1871
 
1857
- function assertValidHeaderValue(value, header) {
1858
- if (value === false || value == null) {
1859
- return;
1860
- }
1861
-
1862
- if (utils$1.isArray(value)) {
1863
- value.forEach((v) => assertValidHeaderValue(v, header));
1864
- return;
1865
- }
1872
+ function trimSPorHTAB(str) {
1873
+ let start = 0;
1874
+ let end = str.length;
1866
1875
 
1867
- if (!isValidHeaderValue(String(value))) {
1868
- throw new Error(`Invalid character in header content ["${header}"]`);
1869
- }
1870
- }
1876
+ while (start < end) {
1877
+ const code = str.charCodeAt(start);
1871
1878
 
1872
- function normalizeHeader(header) {
1873
- return header && String(header).trim().toLowerCase();
1874
- }
1879
+ if (code !== 0x09 && code !== 0x20) {
1880
+ break;
1881
+ }
1875
1882
 
1876
- function stripTrailingCRLF(str) {
1877
- let end = str.length;
1883
+ start += 1;
1884
+ }
1878
1885
 
1879
- while (end > 0) {
1880
- const charCode = str.charCodeAt(end - 1);
1886
+ while (end > start) {
1887
+ const code = str.charCodeAt(end - 1);
1881
1888
 
1882
- if (charCode !== 10 && charCode !== 13) {
1889
+ if (code !== 0x09 && code !== 0x20) {
1883
1890
  break;
1884
1891
  }
1885
1892
 
1886
1893
  end -= 1;
1887
1894
  }
1888
1895
 
1889
- return end === str.length ? str : str.slice(0, end);
1896
+ return start === 0 && end === str.length ? str : str.slice(start, end);
1897
+ }
1898
+
1899
+ function normalizeHeader(header) {
1900
+ return header && String(header).trim().toLowerCase();
1901
+ }
1902
+
1903
+ function sanitizeHeaderValue(str) {
1904
+ return trimSPorHTAB(str.replace(INVALID_HEADER_VALUE_CHARS_RE, ''));
1890
1905
  }
1891
1906
 
1892
1907
  function normalizeValue(value) {
@@ -1894,7 +1909,7 @@ function normalizeValue(value) {
1894
1909
  return value;
1895
1910
  }
1896
1911
 
1897
- return utils$1.isArray(value) ? value.map(normalizeValue) : stripTrailingCRLF(String(value));
1912
+ return utils$1.isArray(value) ? value.map(normalizeValue) : sanitizeHeaderValue(String(value));
1898
1913
  }
1899
1914
 
1900
1915
  function parseTokens(str) {
@@ -1976,7 +1991,6 @@ class AxiosHeaders {
1976
1991
  _rewrite === true ||
1977
1992
  (_rewrite === undefined && self[key] !== false)
1978
1993
  ) {
1979
- assertValidHeaderValue(_value, _header);
1980
1994
  self[key || _header] = normalizeValue(_value);
1981
1995
  }
1982
1996
  }
@@ -2399,13 +2413,13 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2399
2413
  const _speedometer = speedometer(50, 250);
2400
2414
 
2401
2415
  return throttle((e) => {
2402
- const loaded = e.loaded;
2416
+ const rawLoaded = e.loaded;
2403
2417
  const total = e.lengthComputable ? e.total : undefined;
2404
- const progressBytes = loaded - bytesNotified;
2418
+ const loaded = total != null ? Math.min(rawLoaded, total) : rawLoaded;
2419
+ const progressBytes = Math.max(0, loaded - bytesNotified);
2405
2420
  const rate = _speedometer(progressBytes);
2406
- const inRange = loaded <= total;
2407
2421
 
2408
- bytesNotified = loaded;
2422
+ bytesNotified = Math.max(bytesNotified, loaded);
2409
2423
 
2410
2424
  const data = {
2411
2425
  loaded,
@@ -2413,7 +2427,7 @@ const progressEventReducer = (listener, isDownloadStream, freq = 3) => {
2413
2427
  progress: total ? loaded / total : undefined,
2414
2428
  bytes: progressBytes,
2415
2429
  rate: rate ? rate : undefined,
2416
- estimated: rate && total && inRange ? (total - loaded) / rate : undefined,
2430
+ estimated: rate && total ? (total - loaded) / rate : undefined,
2417
2431
  event: e,
2418
2432
  lengthComputable: total != null,
2419
2433
  [isDownloadStream ? 'download' : 'upload']: true,
@@ -2547,7 +2561,7 @@ function combineURLs(baseURL, relativeURL) {
2547
2561
  */
2548
2562
  function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
2549
2563
  let isRelativeUrl = !isAbsoluteURL(requestedURL);
2550
- if (baseURL && (isRelativeUrl || allowAbsoluteUrls == false)) {
2564
+ if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
2551
2565
  return combineURLs(baseURL, requestedURL);
2552
2566
  }
2553
2567
  return requestedURL;
@@ -2606,9 +2620,9 @@ function mergeConfig(config1, config2) {
2606
2620
 
2607
2621
  // eslint-disable-next-line consistent-return
2608
2622
  function mergeDirectKeys(a, b, prop) {
2609
- if (prop in config2) {
2623
+ if (utils$1.hasOwnProp(config2, prop)) {
2610
2624
  return getMergedValue(a, b);
2611
- } else if (prop in config1) {
2625
+ } else if (utils$1.hasOwnProp(config1, prop)) {
2612
2626
  return getMergedValue(undefined, a);
2613
2627
  }
2614
2628
  }
@@ -2649,7 +2663,9 @@ function mergeConfig(config1, config2) {
2649
2663
  utils$1.forEach(Object.keys({ ...config1, ...config2 }), function computeConfigValue(prop) {
2650
2664
  if (prop === '__proto__' || prop === 'constructor' || prop === 'prototype') return;
2651
2665
  const merge = utils$1.hasOwnProp(mergeMap, prop) ? mergeMap[prop] : mergeDeepProperties;
2652
- const configValue = merge(config1[prop], config2[prop], prop);
2666
+ const a = utils$1.hasOwnProp(config1, prop) ? config1[prop] : undefined;
2667
+ const b = utils$1.hasOwnProp(config2, prop) ? config2[prop] : undefined;
2668
+ const configValue = merge(a, b, prop);
2653
2669
  (utils$1.isUndefined(configValue) && merge !== mergeDirectKeys) || (config[prop] = configValue);
2654
2670
  });
2655
2671
 
@@ -2703,10 +2719,18 @@ var resolveConfig = (config) => {
2703
2719
  // Specifically not if we're in a web worker, or react-native.
2704
2720
 
2705
2721
  if (platform.hasStandardBrowserEnv) {
2706
- withXSRFToken && utils$1.isFunction(withXSRFToken) && (withXSRFToken = withXSRFToken(newConfig));
2722
+ if (utils$1.isFunction(withXSRFToken)) {
2723
+ withXSRFToken = withXSRFToken(newConfig);
2724
+ }
2707
2725
 
2708
- if (withXSRFToken || (withXSRFToken !== false && isURLSameOrigin(newConfig.url))) {
2709
- // Add xsrf header
2726
+ // Strict boolean check prevents proto-pollution gadgets (e.g. Object.prototype.withXSRFToken = 1)
2727
+ // and misconfigurations (e.g. "false") from short-circuiting the same-origin check and leaking
2728
+ // the XSRF token cross-origin. See GHSA-xx6v-rp6x-q39c.
2729
+ const shouldSendXSRF =
2730
+ withXSRFToken === true ||
2731
+ (withXSRFToken == null && isURLSameOrigin(newConfig.url));
2732
+
2733
+ if (shouldSendXSRF) {
2710
2734
  const xsrfValue = xsrfHeaderName && xsrfCookieName && cookies.read(xsrfCookieName);
2711
2735
 
2712
2736
  if (xsrfValue) {
@@ -3125,18 +3149,20 @@ const factory = (env) => {
3125
3149
  test(() => {
3126
3150
  let duplexAccessed = false;
3127
3151
 
3128
- const body = new ReadableStream$1();
3129
-
3130
- const hasContentType = new Request(platform.origin, {
3131
- body,
3152
+ const request = new Request(platform.origin, {
3153
+ body: new ReadableStream$1(),
3132
3154
  method: 'POST',
3133
3155
  get duplex() {
3134
3156
  duplexAccessed = true;
3135
3157
  return 'half';
3136
3158
  },
3137
- }).headers.has('Content-Type');
3159
+ });
3138
3160
 
3139
- body.cancel();
3161
+ const hasContentType = request.headers.has('Content-Type');
3162
+
3163
+ if (request.body != null) {
3164
+ request.body.cancel();
3165
+ }
3140
3166
 
3141
3167
  return duplexAccessed && !hasContentType;
3142
3168
  });
@@ -3280,6 +3306,19 @@ const factory = (env) => {
3280
3306
  // see https://github.com/cloudflare/workerd/issues/902
3281
3307
  const isCredentialsSupported = isRequestSupported && 'credentials' in Request.prototype;
3282
3308
 
3309
+ // If data is FormData and Content-Type is multipart/form-data without boundary,
3310
+ // delete it so fetch can set it correctly with the boundary
3311
+ if (utils$1.isFormData(data)) {
3312
+ const contentType = headers.getContentType();
3313
+ if (
3314
+ contentType &&
3315
+ /^multipart\/form-data/i.test(contentType) &&
3316
+ !/boundary=/i.test(contentType)
3317
+ ) {
3318
+ headers.delete('content-type');
3319
+ }
3320
+ }
3321
+
3283
3322
  const resolvedOptions = {
3284
3323
  ...fetchOptions,
3285
3324
  signal: composedSignal,
@@ -3588,7 +3627,7 @@ function dispatchRequest(config) {
3588
3627
  );
3589
3628
  }
3590
3629
 
3591
- const VERSION = "1.15.0";
3630
+ const VERSION = "1.15.1";
3592
3631
 
3593
3632
  const validators$1 = {};
3594
3633