@openclaw/discord 2026.9.1 → 2026.9.2

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 (138) hide show
  1. package/dist/action-runtime-api.js +1 -1
  2. package/dist/{activities-api-E-segZn6.js → activities-api-CTcGq3Hf.js} +4 -4
  3. package/dist/activities-api.js +1 -1
  4. package/dist/{allow-list-C2JuH-R0.js → allow-list-DBTtR2dz.js} +3 -29
  5. package/dist/api.js +12 -12
  6. package/dist/{approval-handler.runtime-CW5k3mSa.js → approval-handler.runtime-DUSe5fyH.js} +5 -5
  7. package/dist/{audit-B9rydv5a.js → audit-DpPfwoJM.js} +4 -4
  8. package/dist/{channel-D93LnbTE.js → channel-BHajPgwR.js} +16 -16
  9. package/dist/{channel-actions.runtime-DMFv4doE.js → channel-actions.runtime-DS8pXo0S.js} +29 -32
  10. package/dist/channel-plugin-api.js +1 -1
  11. package/dist/{channel.setup-DTL7kPOM.js → channel.setup-BWmMe1tT.js} +3 -3
  12. package/dist/command-owners-D78sAoOz.js +10 -0
  13. package/dist/{components-DmXYIQ26.js → components-BimX47Mq.js} +1 -1
  14. package/dist/{conversation-binding-route-24afmvEC.js → conversation-binding-route-DuR5NGIx.js} +1 -1
  15. package/dist/{directory-config-BD4YL7wT.js → directory-config-CD2v2Szs.js} +1 -1
  16. package/dist/directory-contract-api.js +1 -1
  17. package/dist/{directory-live-BrFVc1Ds.js → directory-live-DaJzWJ2N.js} +2 -2
  18. package/dist/{doctor-BUB41_lr.js → doctor-D4HH1inA.js} +6 -3
  19. package/dist/doctor-contract-api.js +28 -26
  20. package/dist/{handle-action.guild-admin-B0egstYq.js → handle-action.guild-admin-4We6wWQU.js} +6 -3
  21. package/dist/index.js +1 -1
  22. package/dist/{ingress-identity-BCzfPPYM.js → ingress-identity-XNmW-mZS.js} +1 -1
  23. package/dist/{message-handler-Qdw9c0j4.js → message-handler-DhgBabyU.js} +52 -65
  24. package/dist/{message-handler.preflight-Dxi2yBfR.js → message-handler.preflight-oZ7dQCd0.js} +12 -12
  25. package/dist/{message-handler.process-BYDjtxZJ.js → message-handler.process-BzCYf1pa.js} +14 -14
  26. package/dist/{message-text-BRVqYm-t.js → message-text-DK4NnBg-.js} +1 -1
  27. package/dist/{outbound-adapter-DEhthWTk.js → outbound-adapter-CtggmGh9.js} +6 -6
  28. package/dist/{outbound-components-DehyxvA4.js → outbound-components-Dn8SJWMS.js} +3 -3
  29. package/dist/{outbound-session-route-BFGRF9fE.js → outbound-session-route-Q_HEusBQ.js} +5 -6
  30. package/dist/{owner-access-yc1sX7Gx.js → owner-access-Cp8r6Ipf.js} +3 -2
  31. package/dist/{pluralkit-XmmAHoV6.js → pluralkit-BY75YcK0.js} +1 -1
  32. package/dist/{provider-session.runtime-BA2BPyZ4.js → provider-session.runtime-BL2lHBH7.js} +3 -3
  33. package/dist/{provider-DuDtKbF8.js → provider-uKmmrDM4.js} +28 -28
  34. package/dist/provider.runtime-C-IkWF2w.js +2 -0
  35. package/dist/{realtime-session.runtime-DgSbX6ay.js → realtime-session.runtime-CGYm1t_0.js} +705 -295
  36. package/dist/{resolve-allowlist-common-BJ5UZNNT.js → resolve-allowlist-common-sKIKy-cF.js} +1 -1
  37. package/dist/{resolve-channels-CYseD5Uw.js → resolve-channels-CoiMlWy0.js} +3 -3
  38. package/dist/{resolve-users-DrmhDrqm.js → resolve-users-DJpiokfW.js} +2 -2
  39. package/dist/{retry-BNCxiyyR.js → retry-DQt1zDgH.js} +238 -184
  40. package/dist/{runtime-DB7Fb6AU.js → runtime-BHsdEdr5.js} +1 -1
  41. package/dist/{runtime-BbWNtfyq.js → runtime-Ghtfh5ZA.js} +32 -24
  42. package/dist/runtime-api.js +18 -18
  43. package/dist/{send-BnTEIeLE.js → send-CZeWKUiA.js} +3 -3
  44. package/dist/{send.components-BWVEcjRP.js → send.components-BG5IDABj.js} +4 -4
  45. package/dist/{send.outbound-b5xwHTlL.js → send.outbound-DHuFUL6W.js} +10 -44
  46. package/dist/{send.shared-5vxBTagO.js → send.shared-B0n_fWzu.js} +62 -141
  47. package/dist/{sender-identity-Dt0imZyY.js → sender-identity-B8Ncfi63.js} +1 -1
  48. package/dist/setup-plugin-api.js +1 -1
  49. package/dist/{shared-BSJWHEMA.js → shared-C3dKun_X.js} +6 -3
  50. package/dist/{subagent-hooks-IzQKX4RQ.js → subagent-hooks-ZoQXEI1E.js} +2 -2
  51. package/dist/subagent-hooks-api.js +1 -1
  52. package/dist/{system-events-BOiDS8b3.js → system-events-DFF_awl7.js} +2 -2
  53. package/dist/{target-resolver-BVI8xSSC.js → target-resolver-DLtHDwMK.js} +2 -2
  54. package/dist/targets-BObRyaKX.js +3 -0
  55. package/dist/{thread-bindings-D7mcaXQC.js → thread-bindings-DKvsNjQR.js} +5 -5
  56. package/dist/{thread-bindings.manager-B1oySiVc.js → thread-bindings.manager-pbbRT5gb.js} +5 -5
  57. package/dist/{thread-bindings.session-updates-CC7HoQvt.js → thread-bindings.session-updates-t6jeFB1-.js} +1 -1
  58. package/dist/{thread-bindings.state-D8OMdk4O.js → thread-bindings.state-DtgOqsbX.js} +34 -1
  59. package/dist/{threading-OQnL-0Zx.js → threading-BCx49X-6.js} +3 -3
  60. package/dist/{transcripts-source-D8lH7AkN.js → transcripts-source-Dc6Nnli5.js} +48 -5
  61. package/dist/transcripts-source-api.js +1 -1
  62. package/dist/{typing-C9q0AQMb.js → typing-CuopV-Hi.js} +1 -1
  63. package/dist/{voice-runtime-Dfhjh1tV.js → voice-runtime-BQnILUbG.js} +82 -35
  64. package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
  65. package/node_modules/@discordjs/voice/node_modules/@types/node/buffer.buffer.d.ts +5 -5
  66. package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +2 -2
  67. package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +16 -0
  68. package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +10 -2
  69. package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
  70. package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +52 -0
  71. package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +210 -28
  72. package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +6 -2
  73. package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +36 -0
  74. package/node_modules/typebox/build/format/json_pointer.d.mts +2 -2
  75. package/node_modules/typebox/build/format/json_pointer.mjs +2 -2
  76. package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +2 -2
  77. package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +2 -2
  78. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  79. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  80. package/node_modules/typebox/build/system/memory/assign.mjs +2 -1
  81. package/node_modules/typebox/build/system/memory/create.mjs +3 -4
  82. package/node_modules/typebox/build/system/memory/discard.mjs +2 -2
  83. package/node_modules/typebox/build/system/memory/freeze.d.mts +4 -0
  84. package/node_modules/typebox/build/system/memory/freeze.mjs +6 -0
  85. package/node_modules/typebox/build/system/memory/update.mjs +3 -2
  86. package/node_modules/typebox/package.json +1 -1
  87. package/node_modules/undici/docs/docs/api/Client.md +4 -0
  88. package/node_modules/undici/docs/docs/api/EnvHttpProxyAgent.md +3 -2
  89. package/node_modules/undici/docs/docs/api/EventSource.md +4 -0
  90. package/node_modules/undici/docs/docs/api/Interceptors.md +7 -3
  91. package/node_modules/undici/docs/docs/api/Socks5ProxyAgent.md +7 -1
  92. package/node_modules/undici/lib/cache/memory-cache-store.js +2 -2
  93. package/node_modules/undici/lib/core/symbols.js +2 -0
  94. package/node_modules/undici/lib/dispatcher/agent.js +7 -2
  95. package/node_modules/undici/lib/dispatcher/balanced-pool.js +7 -4
  96. package/node_modules/undici/lib/dispatcher/client-h1.js +12 -4
  97. package/node_modules/undici/lib/dispatcher/client-h2.js +43 -3
  98. package/node_modules/undici/lib/dispatcher/client.js +3 -2
  99. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +13 -1
  100. package/node_modules/undici/lib/dispatcher/dispatcher.js +15 -1
  101. package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +3 -0
  102. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +10 -3
  103. package/node_modules/undici/lib/dispatcher/proxy-agent.js +18 -1
  104. package/node_modules/undici/lib/dispatcher/retry-agent.js +3 -0
  105. package/node_modules/undici/lib/dispatcher/round-robin-pool.js +1 -1
  106. package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +91 -21
  107. package/node_modules/undici/lib/handler/cache-handler.js +29 -5
  108. package/node_modules/undici/lib/handler/decorator-handler.js +7 -1
  109. package/node_modules/undici/lib/handler/deduplication-handler.js +12 -6
  110. package/node_modules/undici/lib/handler/redirect-handler.js +21 -4
  111. package/node_modules/undici/lib/handler/retry-handler.js +148 -30
  112. package/node_modules/undici/lib/interceptor/cache.js +65 -12
  113. package/node_modules/undici/lib/interceptor/decompress.js +115 -13
  114. package/node_modules/undici/lib/interceptor/deduplicate.js +5 -4
  115. package/node_modules/undici/lib/interceptor/dns.js +7 -0
  116. package/node_modules/undici/lib/interceptor/dump.js +10 -23
  117. package/node_modules/undici/lib/mock/mock-agent.js +13 -1
  118. package/node_modules/undici/lib/mock/mock-utils.js +11 -10
  119. package/node_modules/undici/lib/util/cache.js +45 -3
  120. package/node_modules/undici/lib/web/cookies/parse.js +150 -147
  121. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +28 -1
  122. package/node_modules/undici/lib/web/eventsource/eventsource.js +13 -3
  123. package/node_modules/undici/lib/web/fetch/index.js +6 -0
  124. package/node_modules/undici/lib/web/fetch/request.js +2 -3
  125. package/node_modules/undici/lib/web/fetch/util.js +6 -1
  126. package/node_modules/undici/lib/web/webidl/index.js +3 -3
  127. package/node_modules/undici/lib/web/websocket/connection.js +1 -1
  128. package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
  129. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
  130. package/node_modules/undici/package.json +3 -3
  131. package/node_modules/undici/types/client.d.ts +10 -0
  132. package/node_modules/undici/types/interceptors.d.ts +2 -0
  133. package/node_modules/undici/types/mock-agent.d.ts +11 -10
  134. package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -0
  135. package/openclaw.plugin.json +1 -2
  136. package/package.json +6 -6
  137. package/dist/provider.runtime-Db8YwZBv.js +0 -2
  138. package/dist/targets-DbxVbq8k.js +0 -3
@@ -3,7 +3,7 @@
3
3
  const diagnosticsChannel = require('node:diagnostics_channel')
4
4
  const util = require('../core/util')
5
5
  const DeduplicationHandler = require('../handler/deduplication-handler')
6
- const { normalizeHeaders, makeCacheKey, makeDeduplicationKey } = require('../util/cache.js')
6
+ const { getInterceptorOrigin, normalizeHeaders, makeCacheKey, makeDeduplicationKey } = require('../util/cache.js')
7
7
 
8
8
  const pendingRequestsChannel = diagnosticsChannel.channel('undici:request:pending-requests')
9
9
 
@@ -57,9 +57,10 @@ module.exports = (opts = {}) => {
57
57
  */
58
58
  const pendingRequests = new Map()
59
59
 
60
- return dispatch => {
60
+ return (dispatch, interceptorOrigin) => {
61
61
  return (opts, handler) => {
62
- if (opts.upgrade || methods.includes(opts.method) === false) {
62
+ const requestOrigin = getInterceptorOrigin(opts, interceptorOrigin)
63
+ if (!requestOrigin || opts.upgrade || methods.includes(opts.method) === false) {
63
64
  return dispatch(opts, handler)
64
65
  }
65
66
 
@@ -77,7 +78,7 @@ module.exports = (opts = {}) => {
77
78
  }
78
79
  }
79
80
 
80
- const cacheKey = makeCacheKey(opts)
81
+ const cacheKey = makeCacheKey(opts, requestOrigin)
81
82
  const dedupeKey = makeDeduplicationKey(cacheKey, excludeHeaderNamesSet)
82
83
 
83
84
  // Check if there's already a pending request for this key
@@ -3,6 +3,7 @@ const { isIP } = require('node:net')
3
3
  const { lookup } = require('node:dns')
4
4
  const DecoratorHandler = require('../handler/decorator-handler')
5
5
  const { InvalidArgumentError, InformationalError } = require('../core/errors')
6
+ const { kRequestOrigin } = require('../core/symbols')
6
7
  const maxInt = Math.pow(2, 31) - 1
7
8
 
8
9
  function hasSafeIterator (headers) {
@@ -434,6 +435,9 @@ class DNSDispatchHandler extends DecoratorHandler {
434
435
  origin: `${this.#origin.protocol}//${
435
436
  ip.family === 6 ? `[${ip.address}]` : ip.address
436
437
  }${port}`,
438
+ [kRequestOrigin]: this.#opts[kRequestOrigin] === undefined
439
+ ? this.#origin
440
+ : this.#opts[kRequestOrigin],
437
441
  headers: withHostHeader(this.#origin.host, this.#opts.headers)
438
442
  }
439
443
  this.#dispatch(dispatchOpts, this)
@@ -557,6 +561,9 @@ module.exports = interceptorOpts => {
557
561
  ...origDispatchOpts,
558
562
  servername: origin.hostname, // For SNI on TLS
559
563
  origin: newOrigin.origin,
564
+ [kRequestOrigin]: origDispatchOpts[kRequestOrigin] === undefined
565
+ ? origin
566
+ : origDispatchOpts[kRequestOrigin],
560
567
  headers: withHostHeader(origin.host, origDispatchOpts.headers)
561
568
  }
562
569
 
@@ -7,7 +7,6 @@ class DumpHandler extends DecoratorHandler {
7
7
  #maxSize = 1024 * 1024
8
8
  #dumped = false
9
9
  #size = 0
10
- #controller = null
11
10
  aborted = false
12
11
  reason = false
13
12
 
@@ -29,7 +28,6 @@ class DumpHandler extends DecoratorHandler {
29
28
 
30
29
  onRequestStart (controller, context) {
31
30
  controller.abort = this.#abort.bind(this)
32
- this.#controller = controller
33
31
 
34
32
  return super.onRequestStart(controller, context)
35
33
  }
@@ -53,43 +51,32 @@ class DumpHandler extends DecoratorHandler {
53
51
  }
54
52
 
55
53
  onResponseError (controller, err) {
56
- if (this.#dumped) {
57
- return
58
- }
59
-
60
- // On network errors before connect, controller will be null
61
- err = this.#controller?.reason ?? err
62
-
63
- super.onResponseError(controller, err)
54
+ super.onResponseError(controller, this.aborted === true ? this.reason : err)
64
55
  }
65
56
 
66
57
  onResponseData (controller, chunk) {
67
58
  this.#size = this.#size + chunk.length
68
59
 
69
- if (this.#size >= this.#maxSize) {
70
- this.#dumped = true
60
+ if (this.#size > this.#maxSize) {
61
+ throw new RequestAbortedError(
62
+ `Response size (${this.#size}) larger than maxSize (${this.#maxSize})`
63
+ )
64
+ }
71
65
 
72
- if (this.aborted === true) {
73
- super.onResponseError(controller, this.reason)
74
- } else {
75
- super.onResponseEnd(controller, {})
76
- }
66
+ if (this.#size === this.#maxSize) {
67
+ this.#dumped = true
77
68
  }
78
69
 
79
70
  return true
80
71
  }
81
72
 
82
73
  onResponseEnd (controller, trailers) {
83
- if (this.#dumped) {
84
- return
85
- }
86
-
87
- if (this.#controller.aborted === true) {
74
+ if (this.aborted === true) {
88
75
  super.onResponseError(controller, this.reason)
89
76
  return
90
77
  }
91
78
 
92
- super.onResponseEnd(controller, trailers)
79
+ super.onResponseEnd(controller, this.#dumped ? {} : trailers)
93
80
  }
94
81
  }
95
82
 
@@ -73,7 +73,7 @@ class MockAgent extends Dispatcher {
73
73
  opts.origin = normalizeOrigin(opts.origin)
74
74
 
75
75
  // Call MockAgent.get to perform additional setup before dispatching as normal
76
- this.get(opts.origin)
76
+ const mockDispatcher = this.get(opts.origin)
77
77
 
78
78
  this[kMockAgentAddCallHistoryLog](opts)
79
79
 
@@ -81,6 +81,18 @@ class MockAgent extends Dispatcher {
81
81
 
82
82
  const dispatchOpts = { ...opts }
83
83
 
84
+ // Agent keeps HTTP/1.1-only dispatchers under a separate key. Legacy
85
+ // global dispatcher consumers use that path, so mirror the mock dispatches
86
+ // before delegating to the internal Agent.
87
+ if (dispatchOpts.allowH2 === false) {
88
+ const http1OnlyKey = `${dispatchOpts.origin}#http1-only`
89
+ if (!this[kClients].has(http1OnlyKey)) {
90
+ const http1OnlyDispatcher = this[kFactory](dispatchOpts.origin)
91
+ http1OnlyDispatcher[kDispatches] = mockDispatcher[kDispatches]
92
+ this[kMockAgentSet](http1OnlyKey, http1OnlyDispatcher)
93
+ }
94
+ }
95
+
84
96
  if (acceptNonStandardSearchParameters && dispatchOpts.path) {
85
97
  const [path, searchParams] = dispatchOpts.path.split('?')
86
98
  const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters)
@@ -333,8 +333,7 @@ function mockDispatch (opts, handler) {
333
333
  handler.onResponseError(null, new InvalidArgumentError('reply options callback must return an object'))
334
334
  return
335
335
  }
336
- mockDispatch.data = { ...responseDefaults, ...resolvedData }
337
- dispatchMockReply(mockDispatches, mockDispatch, key, opts, handler)
336
+ dispatchMockReply(mockDispatches, mockDispatch, key, opts, handler, { ...responseDefaults, ...resolvedData })
338
337
  },
339
338
  (error) => {
340
339
  handler.onResponseError(null, error)
@@ -347,7 +346,7 @@ function mockDispatch (opts, handler) {
347
346
  throw new InvalidArgumentError('reply options callback must return an object')
348
347
  }
349
348
 
350
- mockDispatch.data = { ...responseDefaults, ...callbackResult }
349
+ return dispatchMockReply(mockDispatches, mockDispatch, key, opts, handler, { ...responseDefaults, ...callbackResult })
351
350
  }
352
351
 
353
352
  return dispatchMockReply(mockDispatches, mockDispatch, key, opts, handler)
@@ -356,9 +355,13 @@ function mockDispatch (opts, handler) {
356
355
  /**
357
356
  * Replies to a request once the mock dispatch data is fully resolved
358
357
  */
359
- function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
360
- // Parse mockDispatch data
361
- const { data: response, delay } = mockDispatch
358
+ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler, resolvedResponse) {
359
+ // Parse mockDispatch data. When a reply callback has already been resolved
360
+ // in mockDispatch() (i.e. no body lifecycle hooks are involved), the resolved
361
+ // response is passed in here, leaving mockDispatch.data untouched so the
362
+ // callback can be re-invoked for persistent / times() replies.
363
+ const { data: responseData, delay } = mockDispatch
364
+ const response = resolvedResponse ?? responseData
362
365
 
363
366
  // If specified, trigger dispatch error
364
367
  if (response.error !== null) {
@@ -454,8 +457,7 @@ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
454
457
  handler.onResponseError(null, new InvalidArgumentError('reply options callback must return an object'))
455
458
  return
456
459
  }
457
- mockDispatch.data = { ...responseDefaults, ...resolvedData }
458
- handleReply(dispatches, mockDispatch.data)
460
+ handleReply(dispatches, { ...responseDefaults, ...resolvedData })
459
461
  },
460
462
  (err) => {
461
463
  handler.onResponseError(null, err)
@@ -468,8 +470,7 @@ function dispatchMockReply (mockDispatches, mockDispatch, key, opts, handler) {
468
470
  throw new InvalidArgumentError('reply options callback must return an object')
469
471
  }
470
472
 
471
- mockDispatch.data = { ...responseDefaults, ...callbackResult }
472
- handleReply(dispatches, mockDispatch.data)
473
+ handleReply(dispatches, { ...responseDefaults, ...callbackResult })
473
474
  return
474
475
  }
475
476
 
@@ -8,6 +8,7 @@ const {
8
8
  } = require('../core/util')
9
9
 
10
10
  const { serializePathWithQuery } = require('../core/util')
11
+ const { kRequestOrigin } = require('../core/symbols')
11
12
 
12
13
  const MAX_DELTA_SECONDS = 2147483647
13
14
  const RESTRICTIVE_DIRECTIVE_NAMES = ['no-store', 'private', 'no-cache']
@@ -147,8 +148,47 @@ function getMalformedRestrictiveDirectiveName (key) {
147
148
  /**
148
149
  * @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
149
150
  */
150
- function makeCacheKey (opts) {
151
- const origin = opts.origin ? opts.origin.toString() : ''
151
+ function getRequestOrigin (opts) {
152
+ const origin = opts[kRequestOrigin] === undefined
153
+ ? opts.origin
154
+ : opts[kRequestOrigin]
155
+ return typeof origin === 'string' || origin instanceof URL
156
+ ? origin
157
+ : null
158
+ }
159
+
160
+ /**
161
+ * @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
162
+ * @param {string|null|undefined} interceptorOrigin
163
+ */
164
+ function getInterceptorOrigin (opts, interceptorOrigin) {
165
+ const requestOrigin = getRequestOrigin(opts)
166
+ if (interceptorOrigin === undefined) {
167
+ return requestOrigin
168
+ }
169
+ if (interceptorOrigin === null) {
170
+ return null
171
+ }
172
+ if (requestOrigin) {
173
+ try {
174
+ if (new URL(requestOrigin).origin !== interceptorOrigin) {
175
+ return null
176
+ }
177
+ } catch {
178
+ return interceptorOrigin
179
+ }
180
+ }
181
+ return interceptorOrigin
182
+ }
183
+
184
+ /**
185
+ * @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
186
+ * @param {string|URL|null} [origin]
187
+ */
188
+ function makeCacheKey (opts, origin = getRequestOrigin(opts)) {
189
+ if (!origin) {
190
+ throw new Error('opts.origin is undefined')
191
+ }
152
192
 
153
193
  let fullPath = opts.path || '/'
154
194
 
@@ -157,7 +197,7 @@ function makeCacheKey (opts) {
157
197
  }
158
198
 
159
199
  return {
160
- origin,
200
+ origin: origin.toString(),
161
201
  method: opts.method,
162
202
  path: fullPath,
163
203
  headers: opts.headers
@@ -700,6 +740,8 @@ function makeDeduplicationKey (cacheKey, excludeHeaders) {
700
740
  }
701
741
 
702
742
  module.exports = {
743
+ getInterceptorOrigin,
744
+ getRequestOrigin,
703
745
  makeCacheKey,
704
746
  normalizeHeaders,
705
747
  assertCacheKey,