@suveren/gateway 0.30.0 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/content/integrations/calendar.json +3 -0
  2. package/content/integrations/crm.json +10 -0
  3. package/content/integrations/deploy-github.json +1 -0
  4. package/content/integrations/erp.json +4 -0
  5. package/content/integrations/gmail.json +4 -0
  6. package/content/integrations/linkedin.json +4 -0
  7. package/content/integrations/mail.json +1 -0
  8. package/content/integrations/mollie.json +5 -0
  9. package/content/integrations/records.json +4 -0
  10. package/dist/control-plane/index.mjs +81 -32
  11. package/dist/mcp-server/http.mjs +36 -1
  12. package/dist/ui/assets/index-B7qy0B9J.js +123 -0
  13. package/dist/ui/assets/index-DyZY5sLI.css +1 -0
  14. package/dist/ui/index.html +2 -2
  15. package/node_modules/undici/docs/docs/api/Client.md +2 -0
  16. package/node_modules/undici/lib/core/connect.js +10 -4
  17. package/node_modules/undici/lib/core/symbols.js +1 -0
  18. package/node_modules/undici/lib/dispatcher/agent.js +6 -2
  19. package/node_modules/undici/lib/dispatcher/client-h1.js +0 -2
  20. package/node_modules/undici/lib/dispatcher/client-h2.js +0 -4
  21. package/node_modules/undici/lib/dispatcher/client.js +3 -2
  22. package/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
  23. package/node_modules/undici/lib/handler/cache-handler.js +48 -0
  24. package/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
  25. package/node_modules/undici/lib/handler/redirect-handler.js +8 -1
  26. package/node_modules/undici/lib/interceptor/decompress.js +15 -5
  27. package/node_modules/undici/lib/web/cookies/index.js +3 -1
  28. package/node_modules/undici/lib/web/cookies/parse.js +138 -137
  29. package/node_modules/undici/lib/web/cookies/util.js +21 -2
  30. package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +90 -9
  31. package/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
  32. package/node_modules/undici/lib/web/fetch/index.js +3 -3
  33. package/node_modules/undici/lib/web/infra/index.js +14 -0
  34. package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
  35. package/node_modules/undici/lib/web/websocket/receiver.js +13 -0
  36. package/node_modules/undici/package.json +1 -1
  37. package/node_modules/undici/types/client.d.ts +14 -0
  38. package/package.json +1 -1
  39. package/dist/ui/assets/index-C2BnlNib.js +0 -123
  40. package/dist/ui/assets/index-DPgewsLG.css +0 -1
@@ -2215,8 +2215,6 @@ async function httpNetworkFetch (
2215
2215
  }
2216
2216
  const location = headersList.get('location', true)
2217
2217
 
2218
- this.body = new Readable({ read: resume })
2219
-
2220
2218
  const willFollow = location && request.redirect === 'follow' &&
2221
2219
  redirectStatusSet.has(status)
2222
2220
 
@@ -2234,7 +2232,7 @@ async function httpNetworkFetch (
2234
2232
  // CVE fix similar to urllib3 (GHSA-gm62-xv2j-4w53) and curl (CVE-2022-32206).
2235
2233
  const maxContentEncodings = 5
2236
2234
  if (codings.length > maxContentEncodings) {
2237
- reject(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
2235
+ this.abort(new Error(`too many content-encodings in response: ${codings.length}, maximum allowed is ${maxContentEncodings}`))
2238
2236
  return true
2239
2237
  }
2240
2238
 
@@ -2272,6 +2270,8 @@ async function httpNetworkFetch (
2272
2270
  }
2273
2271
  }
2274
2272
 
2273
+ this.body = new Readable({ read: resume })
2274
+
2275
2275
  const onError = this.onError.bind(this)
2276
2276
 
2277
2277
  resolve({
@@ -52,6 +52,19 @@ function collectASequenceOfCodePointsFast (char, input, position) {
52
52
  }
53
53
 
54
54
  const ASCII_WHITESPACE_REPLACE_REGEX = /[\u0009\u000A\u000C\u000D\u0020]/g // eslint-disable-line no-control-regex
55
+ const nonASCIIRegex = /[^\x00-\x7F]/ // eslint-disable-line no-control-regex
56
+
57
+ /**
58
+ * @param {string} str
59
+ * @returns {string}
60
+ *
61
+ * @see https://infra.spec.whatwg.org/#ascii-lowercase
62
+ */
63
+ function asciiLowercase (str) {
64
+ return nonASCIIRegex.test(str)
65
+ ? str.replace(/[A-Z]+/g, (upper) => upper.toLowerCase())
66
+ : str.toLowerCase()
67
+ }
55
68
 
56
69
  /**
57
70
  * @param {string} data
@@ -216,6 +229,7 @@ function serializeJavascriptValueToJSONString (value) {
216
229
  }
217
230
 
218
231
  module.exports = {
232
+ asciiLowercase,
219
233
  collectASequenceOfCodePoints,
220
234
  collectASequenceOfCodePointsFast,
221
235
  forgivingBase64,
@@ -2,6 +2,7 @@
2
2
 
3
3
  const assert = require('node:assert')
4
4
  const { runtimeFeatures } = require('../../util/runtime-features.js')
5
+ const { asciiLowercase } = require('../infra/index.js')
5
6
 
6
7
  /**
7
8
  * @typedef {object} Metadata
@@ -66,14 +67,12 @@ const getSRIHashAlgorithmIndex = /** @type {GetSRIHashAlgorithmIndex} */ (Map.pr
66
67
 
67
68
  /**
68
69
  * @typedef IsValidSRIHashAlgorithm
70
+ * @see https://w3c.github.io/webappsec-subresource-integrity/#valid-sri-hash-algorithm-token
69
71
  * @type {(algorithm: string) => algorithm is SRIHashAlgorithm}
70
72
  * @param {*} algorithm
71
73
  * @returns {algorithm is SRIHashAlgorithm}
72
74
  */
73
-
74
- const isValidSRIHashAlgorithm = /** @type {IsValidSRIHashAlgorithm} */ (
75
- Map.prototype.has.bind(validSRIHashAlgorithmTokenSet)
76
- )
75
+ const isValidSRIHashAlgorithm = (algorithm) => validSRIHashAlgorithmTokenSet.has(asciiLowercase(algorithm))
77
76
 
78
77
  /**
79
78
  * @param {Uint8Array} bytes
@@ -229,7 +228,8 @@ function parseMetadata (metadata) {
229
228
  // 8. Let metadata be the ordered map
230
229
  // «["alg" → algorithm, "val" → base64-value]».
231
230
  const metadata = {
232
- alg: algorithm,
231
+ // Possible spec bug?
232
+ alg: asciiLowercase(algorithm),
233
233
  val: base64Value
234
234
  }
235
235
 
@@ -244,6 +244,19 @@ class ByteParser extends Writable {
244
244
  if (isControlFrame(this.#info.opcode)) {
245
245
  this.#loop = this.parseControlFrame(body)
246
246
  this.#state = parserStates.INFO
247
+
248
+ // If the automatic PONG/CLOSE reply filled the socket's write buffer,
249
+ // stop parsing and resume on drain so a PING flood cannot grow the
250
+ // outbound queue without bound.
251
+ if (this.#loop && this.#handler.socket.writableNeedDrain) {
252
+ this.#loop = false
253
+ this.#handler.socket.once('drain', () => {
254
+ if (this.destroyed) return
255
+ this.#loop = true
256
+ this.run(callback)
257
+ })
258
+ return
259
+ }
247
260
  } else {
248
261
  if (!this.#info.compressed) {
249
262
  if (!this.writeFragments(body)) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici",
3
- "version": "7.30.0",
3
+ "version": "7.30.1",
4
4
  "description": "An HTTP/1.1 client, written from scratch for Node.js",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {
@@ -109,6 +109,8 @@ export declare namespace Client {
109
109
  pingInterval?: number;
110
110
  /** WebSocket-specific configuration options. */
111
111
  webSocket?: WebSocketOptions;
112
+ /** EventSource-specific configuration options. */
113
+ eventSource?: EventSourceOptions;
112
114
  }
113
115
  export interface SocketInfo {
114
116
  localAddress?: string
@@ -134,6 +136,18 @@ export declare namespace Client {
134
136
  */
135
137
  maxPayloadSize?: number;
136
138
  }
139
+ export interface EventSourceOptions {
140
+ /**
141
+ * Maximum total bytes of data and metadata field values retained for a
142
+ * pending EventSource event. Each unfinished line is separately bounded
143
+ * to this value plus seven syntax bytes. The number of data lines per
144
+ * event and buffered input chunks are each limited to
145
+ * min(131072, max(1024, floor(maxEventSize / 128))).
146
+ * Set to 0 to disable these limits.
147
+ * @default buffer.kStringMaxLength
148
+ */
149
+ maxEventSize?: number;
150
+ }
137
151
  }
138
152
 
139
153
  export default Client
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suveren/gateway",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Suveren gateway — local agent gateway built in compliance with the Human Agency Protocol (HAP). Runs the UI, control plane, and MCP server in one Node process.",
5
5
  "type": "module",
6
6
  "main": "server.js",