@suveren/gateway 0.2.2 → 0.2.4

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 (36) hide show
  1. package/dist/control-plane/index.mjs +2 -2
  2. package/dist/mcp-server/http.mjs +48 -17
  3. package/dist/ui/assets/{index-C0DMnnek.js → index-CIhRJ6MD.js} +23 -22
  4. package/dist/ui/index.html +1 -1
  5. package/dist/ui/mockups/intent-redesign.html +1 -1
  6. package/node_modules/@hap/core/dist/index.d.mts +36 -1
  7. package/node_modules/@hap/core/dist/index.d.ts +36 -1
  8. package/node_modules/@hap/core/dist/index.js +28 -1
  9. package/node_modules/@hap/core/dist/index.mjs +27 -1
  10. package/node_modules/@hap/core/package.json +12 -11
  11. package/node_modules/@hap/core/src/attestation.ts +4 -1
  12. package/node_modules/@hap/core/src/canonicalize.ts +65 -0
  13. package/node_modules/@hap/core/src/index.ts +1 -0
  14. package/node_modules/eventsource-parser/README.md +31 -0
  15. package/node_modules/eventsource-parser/dist/index.cjs +21 -10
  16. package/node_modules/eventsource-parser/dist/index.cjs.map +1 -1
  17. package/node_modules/eventsource-parser/dist/index.d.cts +33 -10
  18. package/node_modules/eventsource-parser/dist/index.d.ts +33 -10
  19. package/node_modules/eventsource-parser/dist/index.js +21 -10
  20. package/node_modules/eventsource-parser/dist/index.js.map +1 -1
  21. package/node_modules/eventsource-parser/dist/stream.cjs +4 -3
  22. package/node_modules/eventsource-parser/dist/stream.cjs.map +1 -1
  23. package/node_modules/eventsource-parser/dist/stream.d.cts +16 -3
  24. package/node_modules/eventsource-parser/dist/stream.d.ts +16 -3
  25. package/node_modules/eventsource-parser/dist/stream.js +4 -3
  26. package/node_modules/eventsource-parser/dist/stream.js.map +1 -1
  27. package/node_modules/eventsource-parser/package.json +8 -8
  28. package/node_modules/eventsource-parser/src/errors.ts +1 -1
  29. package/node_modules/eventsource-parser/src/index.ts +6 -1
  30. package/node_modules/eventsource-parser/src/parse.ts +55 -13
  31. package/node_modules/eventsource-parser/src/stream.ts +24 -5
  32. package/node_modules/eventsource-parser/src/types.ts +25 -0
  33. package/node_modules/hasown/CHANGELOG.md +7 -0
  34. package/node_modules/hasown/index.d.ts +0 -1
  35. package/node_modules/hasown/package.json +4 -5
  36. package/package.json +2 -2
@@ -31,6 +31,17 @@ export interface StreamOptions {
31
31
  * @param comment - The comment encountered in the stream.
32
32
  */
33
33
  onComment?: ((comment: string) => void) | undefined
34
+
35
+ /**
36
+ * Maximum number of characters the parser is allowed to buffer across calls to `feed()`.
37
+ * See {@link ParserConfig.maxBufferSize} for details.
38
+ *
39
+ * When the limit is exceeded, the stream is always errored (regardless of the `onError`
40
+ * setting) since the underlying parser is unrecoverable without a `reset()`.
41
+ *
42
+ * @defaultValue `undefined` (unbounded)
43
+ */
44
+ maxBufferSize?: number | undefined
34
45
  }
35
46
 
36
47
  /**
@@ -49,13 +60,13 @@ export interface StreamOptions {
49
60
  * const eventStream =
50
61
  * response.body
51
62
  * .pipeThrough(new TextDecoderStream())
52
- * .pipeThrough(new EventSourceParserStream({terminateOnError: true}))
63
+ * .pipeThrough(new EventSourceParserStream({onError: 'terminate'}))
53
64
  * ```
54
65
  *
55
66
  * @public
56
67
  */
57
68
  export class EventSourceParserStream extends TransformStream<string, EventSourceMessage> {
58
- constructor({onError, onRetry, onComment}: StreamOptions = {}) {
69
+ constructor({onError, onRetry, onComment, maxBufferSize}: StreamOptions = {}) {
59
70
  let parser!: EventSourceParser
60
71
 
61
72
  super({
@@ -65,16 +76,24 @@ export class EventSourceParserStream extends TransformStream<string, EventSource
65
76
  controller.enqueue(event)
66
77
  },
67
78
  onError(error) {
68
- if (onError === 'terminate') {
69
- controller.error(error)
70
- } else if (typeof onError === 'function') {
79
+ if (typeof onError === 'function') {
71
80
  onError(error)
72
81
  }
73
82
 
83
+ // `max-buffer-size-exceeded` is fatal — the parser is unusable until
84
+ // `reset()`, which the stream wrapper has no way to call. Always
85
+ // terminate the stream in that case so consumers see the meaningful
86
+ // `ParseError` instead of an opaque "cannot feed terminated parser"
87
+ // throw from the next chunk.
88
+ if (onError === 'terminate' || error.type === 'max-buffer-size-exceeded') {
89
+ controller.error(error)
90
+ }
91
+
74
92
  // Ignore by default
75
93
  },
76
94
  onRetry,
77
95
  onComment,
96
+ maxBufferSize,
78
97
  })
79
98
  },
80
99
  transform(chunk) {
@@ -95,3 +95,28 @@ export interface ParserCallbacks {
95
95
  */
96
96
  onError?: ((error: ParseError) => void) | undefined
97
97
  }
98
+
99
+ /**
100
+ * Configuration accepted by {@link createParser}. Extends {@link ParserCallbacks} with
101
+ * additional options that control parser behavior.
102
+ *
103
+ * @public
104
+ */
105
+ export interface ParserConfig extends ParserCallbacks {
106
+ /**
107
+ * Maximum number of characters the parser is allowed to buffer across calls to `feed()`.
108
+ *
109
+ * Two unbounded surfaces exist in a streaming SSE parser:
110
+ * - A partial line that has not yet been terminated by `\n`, `\r`, or `\r\n`.
111
+ * - A multi-line event whose terminating blank line has not yet arrived (each `data:`
112
+ * field gets appended to the buffered event).
113
+ *
114
+ * When the combined size of these buffers exceeds `maxBufferSize`, the parser emits a
115
+ * `ParseError` with `type: 'max-buffer-size-exceeded'` to `onError` and becomes
116
+ * terminated — subsequent calls to `feed()` will throw until `reset()` is called.
117
+ * This protects against unbounded memory growth from malformed or malicious streams.
118
+ *
119
+ * @defaultValue `undefined` (unbounded)
120
+ */
121
+ maxBufferSize?: number | undefined
122
+ }
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v2.0.4](https://github.com/inspect-js/hasOwn/compare/v2.0.3...v2.0.4) - 2026-05-28
9
+
10
+ ### Commits
11
+
12
+ - [types] drop the dead key-narrowing overload [`fdab00e`](https://github.com/inspect-js/hasOwn/commit/fdab00e2703e65411424e19bf86a7e72a8f10da9)
13
+ - [Dev Deps] update `@ljharb/eslint-config`, `auto-changelog`, `eslint` [`91f6247`](https://github.com/inspect-js/hasOwn/commit/91f624768dd0f7db0d019b89d4d86bd66e20ec30)
14
+
8
15
  ## [v2.0.3](https://github.com/inspect-js/hasOwn/compare/v2.0.2...v2.0.3) - 2026-04-17
9
16
 
10
17
  ### Commits
@@ -1,4 +1,3 @@
1
- declare function hasOwn<O, K extends PropertyKey>(o: O, p: K): p is K & keyof O;
2
1
  declare function hasOwn<O, K extends PropertyKey, V = unknown>(o: O, p: K): o is O & Record<K, V>;
3
2
 
4
3
  export = hasOwn;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hasown",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "A robust, ES3 compatible, \"has own property\" predicate.",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -52,13 +52,12 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@arethetypeswrong/cli": "^0.18.2",
55
- "@ljharb/eslint-config": "^22.2.2",
55
+ "@ljharb/eslint-config": "^22.2.3",
56
56
  "@ljharb/tsconfig": "^0.3.2",
57
57
  "@types/function-bind": "^1.1.10",
58
58
  "@types/tape": "^5.8.1",
59
- "auto-changelog": "^2.5.0",
60
- "encoding": "^0.1.13",
61
- "eslint": "^10.2.0",
59
+ "auto-changelog": "^2.5.1",
60
+ "eslint": "^10.4.0",
62
61
  "evalmd": "^0.0.19",
63
62
  "in-publish": "^2.0.1",
64
63
  "jiti": "^0.0.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suveren/gateway",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
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",
@@ -26,7 +26,7 @@
26
26
  "@hpke/core": "^1.9.0",
27
27
  "express": "^4.18.0",
28
28
  "http-proxy-middleware": "^3.0.0",
29
- "@hap/core": "npm:@humanagencyp/hap-core@^0.4.6",
29
+ "@hap/core": "npm:@humanagencyp/hap-core@^0.5.0",
30
30
  "@modelcontextprotocol/sdk": "^1.12.1",
31
31
  "zod": "^3.22.0"
32
32
  },