@openclaw/slack 2026.9.8 → 2026.10.1-beta.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 (103) hide show
  1. package/dist/.setup/{account-inspect-DWBXpER6.mjs → account-inspect-Cs-7DXXW.mjs} +1 -1
  2. package/dist/.setup/{accounts-D_N9IqNA.mjs → accounts-CDgkV7Cm.mjs} +4 -16
  3. package/dist/.setup/{action-runtime-DfWvuiZd.mjs → action-runtime-DJ1daRAZ.mjs} +5 -7
  4. package/dist/.setup/action-runtime.runtime-CdWL2mLC.mjs +2 -0
  5. package/dist/.setup/{actions-Df0CzcDl.mjs → actions-DDoAJnrH.mjs} +16 -35
  6. package/dist/.setup/{approval-handler.runtime-Ed6Sw5VK.mjs → approval-handler.runtime-BcE_shWc.mjs} +5 -5
  7. package/dist/.setup/{approval-message-updates-BadvtA7R.mjs → approval-message-updates-EgKGmFXx.mjs} +1 -1
  8. package/dist/.setup/{channel-C7bgPSTE.mjs → channel-DgKSu8Iv.mjs} +46 -48
  9. package/dist/.setup/{channel-type-ClOttrZ5.mjs → channel-type-B9zYYzBU.mjs} +4 -4
  10. package/dist/.setup/{channel.setup-Dh2jzAjN.mjs → channel.setup-BYIlwbQ7.mjs} +27 -27
  11. package/dist/.setup/{config-schema-BZCxmHKG.mjs → config-schema-BH0K9-Um.mjs} +4 -0
  12. package/dist/.setup/{directory-config-BOUWH3hR.mjs → directory-config-B_by7zrc.mjs} +2 -2
  13. package/dist/.setup/{directory-live-B2O4B_Ho.mjs → directory-live-C48wazJt.mjs} +3 -3
  14. package/dist/.setup/{doctor-contract-CRN1Z_c7.mjs → doctor-contract-Cd4-VzIM.mjs} +28 -28
  15. package/dist/.setup/{message-tool-api-Cu4lwlGy.mjs → message-tool-api-CcjLPN3v.mjs} +2 -2
  16. package/dist/.setup/{monitor-BPVfkumU.mjs → monitor-BuYBDmm7.mjs} +190 -315
  17. package/dist/.setup/{outbound-adapter-Bv48XUjq.mjs → outbound-adapter-BZFkK-mw.mjs} +6 -17
  18. package/dist/.setup/{pipeline.runtime-B1H63Frf.mjs → pipeline.runtime-CIepKmZt.mjs} +241 -247
  19. package/dist/.setup/{policy-D-jfM174.mjs → policy-KKTqEiDv.mjs} +12 -22
  20. package/dist/.setup/{probe-B2Y9qc_z.mjs → probe-BVlJ3dp0.mjs} +4 -7
  21. package/dist/.setup/{relay-source-BpKdjsll.mjs → relay-source-CC3h6M7y.mjs} +2 -2
  22. package/dist/.setup/{replies-BAnUtr2f.mjs → replies-DHbuthIR.mjs} +12 -26
  23. package/dist/.setup/{reply-blocks-SE1kTE3I.mjs → reply-blocks-CKnO4BSG.mjs} +4 -29
  24. package/dist/.setup/{resolve-channels-XXBn8UU_.mjs → resolve-channels-HR0TgArR.mjs} +2 -2
  25. package/dist/.setup/{resolve-users-DW0ngD03.mjs → resolve-users-BNYBhF0q.mjs} +4 -4
  26. package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
  27. package/dist/.setup/{scopes-CasuDvaa.mjs → scopes-DrDbyUH2.mjs} +1 -1
  28. package/dist/.setup/secret-contract-B-Qm6aQQ.mjs +65 -0
  29. package/dist/.setup/{secret-contract-api-Dp6290Vg.mjs → secret-contract-api-DmUVxIRs.mjs} +1 -1
  30. package/dist/.setup/{security-audit-BqDc-6VL.mjs → security-audit-C1nOGzJa.mjs} +1 -1
  31. package/dist/.setup/{send-BOVLQi3n.mjs → send-CgPI3Zj8.mjs} +22 -53
  32. package/dist/.setup/{session-status-DscajIsd.mjs → session-status-D46GHwOV.mjs} +39 -49
  33. package/dist/.setup/{setup-plugin-api-DTtbTKNk.mjs → setup-plugin-api-ZrHs0N4U.mjs} +1 -1
  34. package/dist/.setup/{setup-surface-Dn7QgWRE.mjs → setup-surface-83lxvE2y.mjs} +10 -13
  35. package/dist/.setup/{shared-qau-uDGl.mjs → shared-VtmYNj-v.mjs} +53 -57
  36. package/dist/.setup/{slash-dispatch.runtime--AEzLVBF.mjs → slash-dispatch.runtime-gBj_uaLM.mjs} +1 -1
  37. package/dist/account-inspect-api.js +1 -1
  38. package/dist/api.js +13 -13
  39. package/dist/channel-config-api.js +1 -1
  40. package/dist/channel-plugin-api.js +1 -1
  41. package/dist/control-ui/2f4b1e827be6b68ced2ea0d8b7da8529a4eafbe72be27ee37e1064bdd530ec10/index.js +1 -0
  42. package/dist/directory-contract-api.js +1 -1
  43. package/dist/doctor-contract-api.js +1 -1
  44. package/dist/message-tool-api.js +1 -1
  45. package/dist/runtime-api.js +10 -10
  46. package/dist/secret-contract-api.js +1 -1
  47. package/dist/security-contract-api.js +1 -1
  48. package/dist/setup-entry.js +2 -2
  49. package/dist/setup-plugin-api.js +1 -1
  50. package/node_modules/undici/README.md +10 -1
  51. package/node_modules/undici/docs/docs/api/Agent.md +8 -8
  52. package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
  53. package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
  54. package/node_modules/undici/docs/docs/api/Errors.md +25 -0
  55. package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
  56. package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
  57. package/node_modules/undici/docs/docs/api/Pool.md +5 -6
  58. package/node_modules/undici/docs/docs/index.md +10 -1
  59. package/node_modules/undici/lib/api/readable.js +1 -2
  60. package/node_modules/undici/lib/core/request.js +23 -2
  61. package/node_modules/undici/lib/core/util.js +0 -39
  62. package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
  63. package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
  64. package/node_modules/undici/lib/dispatcher/client.js +6 -1
  65. package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
  66. package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
  67. package/node_modules/undici/lib/dispatcher/pool.js +90 -7
  68. package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
  69. package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
  70. package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
  71. package/node_modules/undici/lib/handler/retry-handler.js +72 -13
  72. package/node_modules/undici/lib/interceptor/cache.js +4 -1
  73. package/node_modules/undici/lib/interceptor/decompress.js +236 -69
  74. package/node_modules/undici/lib/web/cache/cache.js +17 -8
  75. package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
  76. package/node_modules/undici/lib/web/cookies/index.js +19 -7
  77. package/node_modules/undici/lib/web/cookies/util.js +3 -1
  78. package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
  79. package/node_modules/undici/lib/web/fetch/body.js +22 -15
  80. package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
  81. package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
  82. package/node_modules/undici/lib/web/fetch/headers.js +34 -31
  83. package/node_modules/undici/lib/web/fetch/index.js +46 -25
  84. package/node_modules/undici/lib/web/fetch/request.js +74 -79
  85. package/node_modules/undici/lib/web/fetch/response.js +43 -44
  86. package/node_modules/undici/lib/web/fetch/util.js +7 -7
  87. package/node_modules/undici/lib/web/infra/index.js +16 -1
  88. package/node_modules/undici/lib/web/webidl/index.js +2 -14
  89. package/node_modules/undici/lib/web/websocket/connection.js +33 -12
  90. package/node_modules/undici/lib/web/websocket/events.js +43 -26
  91. package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
  92. package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
  93. package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
  94. package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
  95. package/node_modules/undici/package.json +1 -1
  96. package/node_modules/undici/types/diagnostics-channel.d.ts +2 -1
  97. package/node_modules/undici/types/interceptors.d.ts +1 -1
  98. package/node_modules/undici/types/webidl.d.ts +13 -7
  99. package/openclaw.plugin.json +4 -1
  100. package/package.json +14 -6
  101. package/dist/.setup/action-runtime.runtime-Ck4bAWOX.mjs +0 -2
  102. package/dist/.setup/secret-contract-BaZcu6P_.mjs +0 -82
  103. package/dist/.setup/streaming-compat-C5Wut626.mjs +0 -62
@@ -191,6 +191,8 @@ class EventSource extends EventTarget {
191
191
  * @readonly
192
192
  */
193
193
  get readyState () {
194
+ webidl.brandCheck(this, webidl.is.EventSource)
195
+
194
196
  return this.#readyState
195
197
  }
196
198
 
@@ -200,6 +202,8 @@ class EventSource extends EventTarget {
200
202
  * @returns {string}
201
203
  */
202
204
  get url () {
205
+ webidl.brandCheck(this, webidl.is.EventSource)
206
+
203
207
  return this.#url
204
208
  }
205
209
 
@@ -208,6 +212,8 @@ class EventSource extends EventTarget {
208
212
  * instantiated with CORS credentials set (true), or not (false, the default).
209
213
  */
210
214
  get withCredentials () {
215
+ webidl.brandCheck(this, webidl.is.EventSource)
216
+
211
217
  return this.#withCredentials
212
218
  }
213
219
 
@@ -363,7 +369,7 @@ class EventSource extends EventTarget {
363
369
  * CLOSED.
364
370
  */
365
371
  close () {
366
- webidl.brandCheck(this, EventSource)
372
+ webidl.brandCheck(this, webidl.is.EventSource)
367
373
 
368
374
  if (this.#readyState === CLOSED) return
369
375
  this.#readyState = CLOSED
@@ -372,10 +378,14 @@ class EventSource extends EventTarget {
372
378
  }
373
379
 
374
380
  get onopen () {
381
+ webidl.brandCheck(this, webidl.is.EventSource)
382
+
375
383
  return this.#events.open
376
384
  }
377
385
 
378
386
  set onopen (fn) {
387
+ webidl.brandCheck(this, webidl.is.EventSource)
388
+
379
389
  if (this.#events.open) {
380
390
  this.removeEventListener('open', this.#events.open)
381
391
  }
@@ -391,10 +401,14 @@ class EventSource extends EventTarget {
391
401
  }
392
402
 
393
403
  get onmessage () {
404
+ webidl.brandCheck(this, webidl.is.EventSource)
405
+
394
406
  return this.#events.message
395
407
  }
396
408
 
397
409
  set onmessage (fn) {
410
+ webidl.brandCheck(this, webidl.is.EventSource)
411
+
398
412
  if (this.#events.message) {
399
413
  this.removeEventListener('message', this.#events.message)
400
414
  }
@@ -410,10 +424,14 @@ class EventSource extends EventTarget {
410
424
  }
411
425
 
412
426
  get onerror () {
427
+ webidl.brandCheck(this, webidl.is.EventSource)
428
+
413
429
  return this.#events.error
414
430
  }
415
431
 
416
432
  set onerror (fn) {
433
+ webidl.brandCheck(this, webidl.is.EventSource)
434
+
417
435
  if (this.#events.error) {
418
436
  this.removeEventListener('error', this.#events.error)
419
437
  }
@@ -427,6 +445,12 @@ class EventSource extends EventTarget {
427
445
  this.#events.error = null
428
446
  }
429
447
  }
448
+
449
+ static {
450
+ webidl.is.EventSource = (arg) => {
451
+ return arg != null && typeof arg === 'object' && #events in arg
452
+ }
453
+ }
430
454
  }
431
455
 
432
456
  const constantsPropertyDescriptors = {
@@ -2,7 +2,6 @@
2
2
 
3
3
  const util = require('../../core/util')
4
4
  const {
5
- ReadableStreamFrom,
6
5
  readableStreamClose,
7
6
  fullyReadBody,
8
7
  extractMimeType
@@ -197,8 +196,16 @@ function extractBody (object, keepalive = false) {
197
196
  )
198
197
  }
199
198
 
200
- stream =
201
- webidl.is.ReadableStream(object) ? object : ReadableStreamFrom(object)
199
+ stream = webidl.is.ReadableStream(object)
200
+ ? object
201
+ : ReadableStream.from(object).pipeThrough(new TransformStream({
202
+ transform (chunk, controller) {
203
+ const bytes = isUint8Array(chunk) ? chunk : Buffer.from(chunk)
204
+ if (bytes.byteLength) {
205
+ controller.enqueue(bytes)
206
+ }
207
+ }
208
+ }))
202
209
  }
203
210
 
204
211
  // 11. If source is a byte sequence, then set action to a
@@ -293,7 +300,7 @@ function cloneBody (body) {
293
300
  }
294
301
  }
295
302
 
296
- function bodyMixinMethods (instance, getInternalState) {
303
+ function bodyMixinMethods (brandCheck, getInternalState) {
297
304
  const methods = {
298
305
  blob () {
299
306
  // The blob() method steps are to return the result of
@@ -313,7 +320,7 @@ function bodyMixinMethods (instance, getInternalState) {
313
320
  // Return a Blob whose contents are bytes and type attribute
314
321
  // is mimeType.
315
322
  return new Blob([bytes], { type: mimeType })
316
- }, instance, getInternalState)
323
+ }, brandCheck, getInternalState)
317
324
  },
318
325
 
319
326
  arrayBuffer () {
@@ -323,19 +330,19 @@ function bodyMixinMethods (instance, getInternalState) {
323
330
  // whose contents are bytes.
324
331
  return consumeBody(this, (bytes) => {
325
332
  return new Uint8Array(bytes).buffer
326
- }, instance, getInternalState)
333
+ }, brandCheck, getInternalState)
327
334
  },
328
335
 
329
336
  text () {
330
337
  // The text() method steps are to return the result of running
331
338
  // consume body with this and UTF-8 decode.
332
- return consumeBody(this, utf8DecodeBytes, instance, getInternalState)
339
+ return consumeBody(this, utf8DecodeBytes, brandCheck, getInternalState)
333
340
  },
334
341
 
335
342
  json () {
336
343
  // The json() method steps are to return the result of running
337
344
  // consume body with this and parse JSON from bytes.
338
- return consumeBody(this, parseJSONFromBytes, instance, getInternalState)
345
+ return consumeBody(this, parseJSONFromBytes, brandCheck, getInternalState)
339
346
  },
340
347
 
341
348
  formData () {
@@ -383,7 +390,7 @@ function bodyMixinMethods (instance, getInternalState) {
383
390
  throw new TypeError(
384
391
  'Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".'
385
392
  )
386
- }, instance, getInternalState)
393
+ }, brandCheck, getInternalState)
387
394
  },
388
395
 
389
396
  bytes () {
@@ -392,7 +399,7 @@ function bodyMixinMethods (instance, getInternalState) {
392
399
  // result of creating a Uint8Array from bytes in this’s relevant realm.
393
400
  return consumeBody(this, (bytes) => {
394
401
  return new Uint8Array(bytes)
395
- }, instance, getInternalState)
402
+ }, brandCheck, getInternalState)
396
403
  },
397
404
 
398
405
  textStream () {
@@ -442,20 +449,20 @@ function bodyMixinMethods (instance, getInternalState) {
442
449
  return methods
443
450
  }
444
451
 
445
- function mixinBody (prototype, getInternalState) {
446
- Object.assign(prototype.prototype, bodyMixinMethods(prototype, getInternalState))
452
+ function mixinBody (prototype, getInternalState, brandCheck) {
453
+ Object.assign(prototype.prototype, bodyMixinMethods(brandCheck, getInternalState))
447
454
  }
448
455
 
449
456
  /**
450
457
  * @see https://fetch.spec.whatwg.org/#concept-body-consume-body
451
458
  * @param {any} object internal state
452
459
  * @param {(value: unknown) => unknown} convertBytesToJSValue
453
- * @param {any} instance
460
+ * @param {import('../../../types/webidl').WebidlIsFunction} brandCheck
454
461
  * @param {(target: any) => any} getInternalState
455
462
  */
456
- function consumeBody (object, convertBytesToJSValue, instance, getInternalState) {
463
+ function consumeBody (object, convertBytesToJSValue, brandCheck, getInternalState) {
457
464
  try {
458
- webidl.brandCheck(object, instance)
465
+ webidl.brandCheck(object, brandCheck)
459
466
  } catch (e) {
460
467
  return Promise.reject(e)
461
468
  }
@@ -1,14 +1,14 @@
1
1
  'use strict'
2
2
 
3
3
  const assert = require('node:assert')
4
- const { forgivingBase64, collectASequenceOfCodePoints, collectASequenceOfCodePointsFast, isomorphicDecode, removeASCIIWhitespace, removeChars } = require('../infra')
4
+ const { asciiLowercase, forgivingBase64, collectASequenceOfCodePoints, collectASequenceOfCodePointsFast, isomorphicDecode, removeASCIIWhitespace, removeChars } = require('../infra')
5
5
 
6
6
  const encoder = new TextEncoder()
7
7
 
8
8
  /**
9
9
  * @see https://mimesniff.spec.whatwg.org/#http-token-code-point
10
10
  */
11
- const HTTP_TOKEN_CODEPOINTS = /^[-!#$%&'*+.^_|~A-Za-z0-9]+$/u
11
+ const HTTP_TOKEN_CODEPOINTS = /^[-!#$%&'*+.^_`|~A-Za-z0-9]+$/u
12
12
  const HTTP_WHITESPACE_REGEX = /[\u000A\u000D\u0009\u0020]/u // eslint-disable-line
13
13
 
14
14
  /**
@@ -69,7 +69,7 @@ function dataURLProcessor (dataURL) {
69
69
  // 11. If mimeType ends with U+003B (;), followed by
70
70
  // zero or more U+0020 SPACE, followed by an ASCII
71
71
  // case-insensitive match for "base64", then:
72
- if (/;(?:\u0020*)base64$/ui.test(mimeType)) {
72
+ if (/;\u0020*[Bb][Aa][Ss][Ee]64$/u.test(mimeType)) {
73
73
  // 1. Let stringBody be the isomorphic decode of body.
74
74
  const stringBody = isomorphicDecode(body)
75
75
 
@@ -268,8 +268,8 @@ function parseMIMEType (input) {
268
268
  return 'failure'
269
269
  }
270
270
 
271
- const typeLowercase = type.toLowerCase()
272
- const subtypeLowercase = subtype.toLowerCase()
271
+ const typeLowercase = asciiLowercase(type)
272
+ const subtypeLowercase = asciiLowercase(subtype)
273
273
 
274
274
  // 10. Let mimeType be a new MIME type record whose type
275
275
  // is type, in ASCII lowercase, and subtype is subtype,
@@ -309,7 +309,7 @@ function parseMIMEType (input) {
309
309
 
310
310
  // 4. Set parameterName to parameterName, in ASCII
311
311
  // lowercase.
312
- parameterName = parameterName.toLowerCase()
312
+ parameterName = asciiLowercase(parameterName)
313
313
 
314
314
  // 5. If position is not past the end of input, then:
315
315
  if (position.position < input.length) {
@@ -10,6 +10,8 @@ const random = runtimeFeatures.has('crypto')
10
10
  ? require('node:crypto').randomInt
11
11
  : (max) => Math.floor(Math.random() * max)
12
12
 
13
+ let getFormDataState, setFormDataState, getFormDataBoundary
14
+
13
15
  // https://xhr.spec.whatwg.org/#formdata
14
16
  class FormData {
15
17
  #state = []
@@ -28,7 +30,7 @@ class FormData {
28
30
  }
29
31
 
30
32
  append (name, value, filename = undefined) {
31
- webidl.brandCheck(this, FormData)
33
+ webidl.brandCheck(this, webidl.is.FormData)
32
34
 
33
35
  const prefix = 'FormData.append'
34
36
  webidl.argumentLengthCheck(arguments, 2, prefix)
@@ -56,7 +58,7 @@ class FormData {
56
58
  }
57
59
 
58
60
  delete (name) {
59
- webidl.brandCheck(this, FormData)
61
+ webidl.brandCheck(this, webidl.is.FormData)
60
62
 
61
63
  const prefix = 'FormData.delete'
62
64
  webidl.argumentLengthCheck(arguments, 1, prefix)
@@ -69,7 +71,7 @@ class FormData {
69
71
  }
70
72
 
71
73
  get (name) {
72
- webidl.brandCheck(this, FormData)
74
+ webidl.brandCheck(this, webidl.is.FormData)
73
75
 
74
76
  const prefix = 'FormData.get'
75
77
  webidl.argumentLengthCheck(arguments, 1, prefix)
@@ -89,7 +91,7 @@ class FormData {
89
91
  }
90
92
 
91
93
  getAll (name) {
92
- webidl.brandCheck(this, FormData)
94
+ webidl.brandCheck(this, webidl.is.FormData)
93
95
 
94
96
  const prefix = 'FormData.getAll'
95
97
  webidl.argumentLengthCheck(arguments, 1, prefix)
@@ -106,7 +108,7 @@ class FormData {
106
108
  }
107
109
 
108
110
  has (name) {
109
- webidl.brandCheck(this, FormData)
111
+ webidl.brandCheck(this, webidl.is.FormData)
110
112
 
111
113
  const prefix = 'FormData.has'
112
114
  webidl.argumentLengthCheck(arguments, 1, prefix)
@@ -119,7 +121,7 @@ class FormData {
119
121
  }
120
122
 
121
123
  set (name, value, filename = undefined) {
122
- webidl.brandCheck(this, FormData)
124
+ webidl.brandCheck(this, webidl.is.FormData)
123
125
 
124
126
  const prefix = 'FormData.set'
125
127
  webidl.argumentLengthCheck(arguments, 2, prefix)
@@ -184,40 +186,34 @@ class FormData {
184
186
  return `FormData ${output.slice(output.indexOf(']') + 2)}`
185
187
  }
186
188
 
187
- /**
188
- * @param {FormData} formData
189
- */
190
- static getFormDataState (formData) {
191
- return formData.#state
192
- }
189
+ static {
190
+ /** @param {FormData} formData */
191
+ getFormDataState = (formData) => formData.#state
193
192
 
194
- /**
195
- * @param {FormData} formData
196
- * @param {any[]} newState
197
- */
198
- static setFormDataState (formData, newState) {
199
- formData.#state = newState
200
- }
193
+ /**
194
+ * @param {FormData} formData
195
+ * @param {any[]} newState
196
+ */
197
+ setFormDataState = (formData, newState) => {
198
+ formData.#state = newState
199
+ }
201
200
 
202
- /**
203
- * @param {FormData} formData
204
- * @returns {string | null}
205
- */
206
- static getFormDataBoundary (formData) {
207
- const boundary = formData.#boundary
208
- if (boundary != null) return boundary
201
+ /**
202
+ * @param {FormData} formData
203
+ * @returns {string | null}
204
+ */
205
+ getFormDataBoundary = (formData) => {
206
+ // eslint-disable-next-line no-return-assign
207
+ return formData.#boundary ??= `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
208
+ }
209
209
 
210
- // eslint-disable-next-line no-return-assign
211
- return formData.#boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
210
+ webidl.is.FormData = (arg) => {
211
+ return arg != null && typeof arg === 'object' && #state in arg
212
+ }
212
213
  }
213
214
  }
214
215
 
215
- const { getFormDataState, setFormDataState, getFormDataBoundary } = FormData
216
- Reflect.deleteProperty(FormData, 'getFormDataState')
217
- Reflect.deleteProperty(FormData, 'setFormDataState')
218
- Reflect.deleteProperty(FormData, 'getFormDataBoundary')
219
-
220
- iteratorMixin('FormData', FormData, getFormDataState, 'name', 'value')
216
+ iteratorMixin('FormData', FormData, getFormDataState, 'name', 'value', webidl.is.FormData)
221
217
 
222
218
  Object.defineProperties(FormData.prototype, {
223
219
  append: kEnumerableProperty,
@@ -273,6 +269,4 @@ function makeEntry (name, value, filename) {
273
269
  return { name, value }
274
270
  }
275
271
 
276
- webidl.is.FormData = webidl.util.MakeTypeAssertion(FormData)
277
-
278
272
  module.exports = { FormData, makeEntry, setFormDataState, getFormDataBoundary }
@@ -423,6 +423,8 @@ class HeadersList {
423
423
  }
424
424
  }
425
425
 
426
+ let getHeadersGuard, setHeadersGuard, getHeadersList, setHeadersList
427
+
426
428
  // https://fetch.spec.whatwg.org/#headers-class
427
429
  class Headers {
428
430
  #guard
@@ -458,7 +460,7 @@ class Headers {
458
460
 
459
461
  // https://fetch.spec.whatwg.org/#dom-headers-append
460
462
  append (name, value) {
461
- webidl.brandCheck(this, Headers)
463
+ webidl.brandCheck(this, webidl.is.Headers)
462
464
 
463
465
  webidl.argumentLengthCheck(arguments, 2, 'Headers.append')
464
466
 
@@ -471,7 +473,7 @@ class Headers {
471
473
 
472
474
  // https://fetch.spec.whatwg.org/#dom-headers-delete
473
475
  delete (name) {
474
- webidl.brandCheck(this, Headers)
476
+ webidl.brandCheck(this, webidl.is.Headers)
475
477
 
476
478
  webidl.argumentLengthCheck(arguments, 1, 'Headers.delete')
477
479
 
@@ -515,7 +517,7 @@ class Headers {
515
517
 
516
518
  // https://fetch.spec.whatwg.org/#dom-headers-get
517
519
  get (name) {
518
- webidl.brandCheck(this, Headers)
520
+ webidl.brandCheck(this, webidl.is.Headers)
519
521
 
520
522
  webidl.argumentLengthCheck(arguments, 1, 'Headers.get')
521
523
 
@@ -538,7 +540,7 @@ class Headers {
538
540
 
539
541
  // https://fetch.spec.whatwg.org/#dom-headers-has
540
542
  has (name) {
541
- webidl.brandCheck(this, Headers)
543
+ webidl.brandCheck(this, webidl.is.Headers)
542
544
 
543
545
  webidl.argumentLengthCheck(arguments, 1, 'Headers.has')
544
546
 
@@ -561,7 +563,7 @@ class Headers {
561
563
 
562
564
  // https://fetch.spec.whatwg.org/#dom-headers-set
563
565
  set (name, value) {
564
- webidl.brandCheck(this, Headers)
566
+ webidl.brandCheck(this, webidl.is.Headers)
565
567
 
566
568
  webidl.argumentLengthCheck(arguments, 2, 'Headers.set')
567
569
 
@@ -609,7 +611,7 @@ class Headers {
609
611
 
610
612
  // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie
611
613
  getSetCookie () {
612
- webidl.brandCheck(this, Headers)
614
+ webidl.brandCheck(this, webidl.is.Headers)
613
615
 
614
616
  // 1. If this’s header list does not contain `Set-Cookie`, then return « ».
615
617
  // 2. Return the values of all headers in this’s header list whose name is
@@ -630,37 +632,38 @@ class Headers {
630
632
  return `Headers ${util.formatWithOptions(options, this.#headersList.entries)}`
631
633
  }
632
634
 
633
- static getHeadersGuard (o) {
634
- return o.#guard
635
- }
635
+ static {
636
+ /** @param {Headers} headers */
637
+ getHeadersGuard = (headers) => headers.#guard
636
638
 
637
- static setHeadersGuard (o, guard) {
638
- o.#guard = guard
639
- }
639
+ /**
640
+ * @param {Headers} headers
641
+ * @param {string} guard
642
+ */
643
+ setHeadersGuard = (headers, guard) => {
644
+ headers.#guard = guard
645
+ }
640
646
 
641
- /**
642
- * @param {Headers} o
643
- */
644
- static getHeadersList (o) {
645
- return o.#headersList
646
- }
647
+ /**
648
+ * @param {Headers} headers
649
+ */
650
+ getHeadersList = (headers) => headers.#headersList
651
+
652
+ /**
653
+ * @param {Headers} target
654
+ * @param {HeadersList} list
655
+ */
656
+ setHeadersList = (target, list) => {
657
+ target.#headersList = list
658
+ }
647
659
 
648
- /**
649
- * @param {Headers} target
650
- * @param {HeadersList} list
651
- */
652
- static setHeadersList (target, list) {
653
- target.#headersList = list
660
+ webidl.is.Headers = (arg) => {
661
+ return arg != null && typeof arg === 'object' && #guard in arg
662
+ }
654
663
  }
655
664
  }
656
665
 
657
- const { getHeadersGuard, setHeadersGuard, getHeadersList, setHeadersList } = Headers
658
- Reflect.deleteProperty(Headers, 'getHeadersGuard')
659
- Reflect.deleteProperty(Headers, 'setHeadersGuard')
660
- Reflect.deleteProperty(Headers, 'getHeadersList')
661
- Reflect.deleteProperty(Headers, 'setHeadersList')
662
-
663
- iteratorMixin('Headers', Headers, headersListSortAndCombine, 0, 1)
666
+ iteratorMixin('Headers', Headers, headersListSortAndCombine, 0, 1, webidl.is.Headers)
664
667
 
665
668
  Object.defineProperties(Headers.prototype, {
666
669
  append: kEnumerableProperty,
@@ -812,11 +812,8 @@ async function mainFetch (fetchParams, recursive) {
812
812
  // https://fetch.spec.whatwg.org/#concept-scheme-fetch
813
813
  // given a fetch params fetchParams
814
814
  function schemeFetch (fetchParams) {
815
- // Note: since the connection is destroyed on redirect, which sets fetchParams to a
816
- // cancelled state, we do not want this condition to trigger *unless* there have been
817
- // no redirects. See https://github.com/nodejs/undici/issues/1776
818
815
  // 1. If fetchParams is canceled, then return the appropriate network error for fetchParams.
819
- if (isCancelled(fetchParams) && fetchParams.request.redirectCount === 0) {
816
+ if (isCancelled(fetchParams)) {
820
817
  return Promise.resolve(makeAppropriateNetworkError(fetchParams))
821
818
  }
822
819
 
@@ -1030,18 +1027,18 @@ function fetchFinale (fetchParams, response) {
1030
1027
  // `Server-Timing` from response’s internal response’s header list.
1031
1028
  // TODO
1032
1029
 
1033
- // 3. Let processResponseEndOfBody be the following steps:
1030
+ // 3. If fetchParams’s request’s destination is "document", then set fetchParams’s controller’s
1031
+ // full timing info to fetchParams’s timing info.
1032
+ if (fetchParams.request.destination === 'document') {
1033
+ fetchParams.controller.fullTimingInfo = timingInfo
1034
+ }
1035
+
1036
+ // 4. Let processResponseEndOfBody be the following steps:
1034
1037
  const processResponseEndOfBody = () => {
1035
1038
  // 1. Let unsafeEndTime be the unsafe shared current time.
1036
1039
  const unsafeEndTime = Date.now() // ?
1037
1040
 
1038
- // 2. If fetchParams’s request’s destination is "document", then set fetchParams’s controller’s
1039
- // full timing info to fetchParams’s timing info.
1040
- if (fetchParams.request.destination === 'document') {
1041
- fetchParams.controller.fullTimingInfo = timingInfo
1042
- }
1043
-
1044
- // 3. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
1041
+ // 2. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
1045
1042
  fetchParams.controller.reportTimingSteps = () => {
1046
1043
  // 1. If fetchParams’s request’s URL’s scheme is not an HTTP(S) scheme, then return.
1047
1044
  if (!urlIsHttpHttpsScheme(fetchParams.request.url)) {
@@ -1090,7 +1087,7 @@ function fetchFinale (fetchParams, response) {
1090
1087
  }
1091
1088
  }
1092
1089
 
1093
- // 4. Let processResponseEndOfBodyTask be the following steps:
1090
+ // 3. Let processResponseEndOfBodyTask be the following steps:
1094
1091
  const processResponseEndOfBodyTask = () => {
1095
1092
  // 1. Set fetchParams’s request’s done flag.
1096
1093
  fetchParams.request.done = true
@@ -1109,11 +1106,11 @@ function fetchFinale (fetchParams, response) {
1109
1106
  }
1110
1107
  }
1111
1108
 
1112
- // 5. Queue a fetch task to run processResponseEndOfBodyTask with fetchParams’s task destination
1109
+ // 4. Queue a fetch task to run processResponseEndOfBodyTask with fetchParams’s task destination
1113
1110
  queueMicrotask(() => processResponseEndOfBodyTask())
1114
1111
  }
1115
1112
 
1116
- // 4. If fetchParams’s process response is non-null, then queue a fetch task to run fetchParams’s
1113
+ // 5. If fetchParams’s process response is non-null, then queue a fetch task to run fetchParams’s
1117
1114
  // process response given response, with fetchParams’s task destination.
1118
1115
  if (fetchParams.processResponse != null) {
1119
1116
  queueMicrotask(() => {
@@ -1122,11 +1119,14 @@ function fetchFinale (fetchParams, response) {
1122
1119
  })
1123
1120
  }
1124
1121
 
1125
- // 5. Let internalResponse be response, if response is a network error; otherwise response’s internal response.
1122
+ // 6. Let internalResponse be response, if response is a network error; otherwise response’s internal response.
1126
1123
  const internalResponse = response.type === 'error' ? response : (response.internalResponse ?? response)
1127
1124
 
1128
- // 6. If internalResponse’s body is null, then run processResponseEndOfBody.
1129
- // 7. Otherwise:
1125
+ // 7. If response is a network error, then run the WebDriver BiDi fetch error steps with request.
1126
+ // Otherwise, run the WebDriver BiDi response completed steps with request and response.
1127
+
1128
+ // 8. If internalResponse’s body is null, then run processResponseEndOfBody.
1129
+ // 9. Otherwise:
1130
1130
  if (internalResponse.body == null) {
1131
1131
  processResponseEndOfBody()
1132
1132
  } else {
@@ -1144,6 +1144,27 @@ function fetchFinale (fetchParams, response) {
1144
1144
  processResponseEndOfBody()
1145
1145
  })
1146
1146
  }
1147
+
1148
+ // 10. If fetchParams’s process response consume body is non-null, then:
1149
+ if (fetchParams.processResponseConsumeBody != null) {
1150
+ // 1. Let processBody given nullOrBytes be this step: run fetchParams’s
1151
+ // process response consume body given response and nullOrBytes.
1152
+ const processBody = (nullOrBytes) => fetchParams.processResponseConsumeBody(response, nullOrBytes)
1153
+
1154
+ // 2. Let processBodyError be this step: run fetchParams’s process
1155
+ // response consume body given response and failure.
1156
+ const processBodyError = () => fetchParams.processResponseConsumeBody(response, 'failure')
1157
+
1158
+ // 3. If internalResponse’s body is null, then queue a fetch task to run
1159
+ // processBody given null, with fetchParams’s task destination.
1160
+ if (internalResponse.body == null) {
1161
+ queueMicrotask(() => processBody(null))
1162
+ } else {
1163
+ // 4. Otherwise, fully read internalResponse’s body given processBody,
1164
+ // processBodyError, and fetchParams’s task destination.
1165
+ fullyReadBody(internalResponse.body, processBody, processBodyError)
1166
+ }
1167
+ }
1147
1168
  }
1148
1169
 
1149
1170
  // https://fetch.spec.whatwg.org/#http-fetch
@@ -1219,7 +1240,7 @@ async function httpFetch (fetchParams) {
1219
1240
  // encouraged to, transmit an RST_STREAM frame.
1220
1241
  // See, https://github.com/whatwg/fetch/issues/1288
1221
1242
  if (request.redirect !== 'manual') {
1222
- fetchParams.controller.connection.destroy(undefined, false)
1243
+ fetchParams.controller.connection.destroy()
1223
1244
  }
1224
1245
 
1225
1246
  // 2. Switch on request’s redirect mode:
@@ -1828,12 +1849,10 @@ async function httpNetworkFetch (
1828
1849
  fetchParams.controller.connection = {
1829
1850
  abort: null,
1830
1851
  destroyed: false,
1831
- destroy (err, abort = true) {
1852
+ destroy (err) {
1832
1853
  if (!this.destroyed) {
1833
1854
  this.destroyed = true
1834
- if (abort) {
1835
- this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'))
1836
- }
1855
+ this.abort?.(err ?? new DOMException('The operation was aborted.', 'AbortError'))
1837
1856
  }
1838
1857
  }
1839
1858
  }
@@ -2369,7 +2388,7 @@ async function httpNetworkFetch (
2369
2388
  this.body?.push(null)
2370
2389
  },
2371
2390
 
2372
- onResponseError (_controller, error) {
2391
+ onResponseError (controller, error) {
2373
2392
  if (this.abort) {
2374
2393
  fetchParams.controller.off('terminated', this.abort)
2375
2394
  }
@@ -2388,7 +2407,9 @@ async function httpNetworkFetch (
2388
2407
 
2389
2408
  this.body?.destroy(error)
2390
2409
 
2391
- fetchParams.controller.terminate(error)
2410
+ if (!controller?.aborted) {
2411
+ fetchParams.controller.terminate(error)
2412
+ }
2392
2413
 
2393
2414
  reject(error)
2394
2415
  },