@kubb/agent 5.0.0-beta.3 → 5.0.0-beta.31

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 (156) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/server/chunks/nitro/nitro.mjs +1965 -1827
  3. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  4. package/.output/server/chunks/routes/api/health.get.mjs +1 -1
  5. package/.output/server/index.mjs +1 -1
  6. package/.output/server/node_modules/ajv/dist/2019.d.ts +1 -1
  7. package/.output/server/node_modules/ajv/dist/2019.js.map +1 -1
  8. package/.output/server/node_modules/ajv/dist/2020.d.ts +1 -1
  9. package/.output/server/node_modules/ajv/dist/2020.js.map +1 -1
  10. package/.output/server/node_modules/ajv/dist/ajv.d.ts +1 -1
  11. package/.output/server/node_modules/ajv/dist/ajv.js.map +1 -1
  12. package/.output/server/node_modules/ajv/dist/compile/index.d.ts +2 -1
  13. package/.output/server/node_modules/ajv/dist/compile/index.js +10 -3
  14. package/.output/server/node_modules/ajv/dist/compile/index.js.map +1 -1
  15. package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js +1 -1
  16. package/.output/server/node_modules/ajv/dist/compile/jtd/parse.js.map +1 -1
  17. package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js +1 -1
  18. package/.output/server/node_modules/ajv/dist/compile/jtd/serialize.js.map +1 -1
  19. package/.output/server/node_modules/ajv/dist/compile/names.d.ts +1 -0
  20. package/.output/server/node_modules/ajv/dist/compile/names.js +1 -0
  21. package/.output/server/node_modules/ajv/dist/compile/names.js.map +1 -1
  22. package/.output/server/node_modules/ajv/dist/compile/validate/index.d.ts +1 -1
  23. package/.output/server/node_modules/ajv/dist/compile/validate/index.js +18 -4
  24. package/.output/server/node_modules/ajv/dist/compile/validate/index.js.map +1 -1
  25. package/.output/server/node_modules/ajv/dist/core.d.ts +4 -0
  26. package/.output/server/node_modules/ajv/dist/core.js +15 -1
  27. package/.output/server/node_modules/ajv/dist/core.js.map +1 -1
  28. package/.output/server/node_modules/ajv/dist/draft4.d.ts +19 -0
  29. package/.output/server/node_modules/ajv/dist/draft4.js +57 -0
  30. package/.output/server/node_modules/ajv/dist/draft4.js.map +1 -0
  31. package/.output/server/node_modules/ajv/dist/refs/json-schema-draft-04.json +138 -0
  32. package/.output/server/node_modules/ajv/dist/types/index.d.ts +3 -0
  33. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +2 -1
  34. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -1
  35. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js +1 -1
  36. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -1
  37. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js +2 -1
  38. package/.output/server/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -1
  39. package/.output/server/node_modules/ajv/dist/vocabularies/code.d.ts +1 -1
  40. package/.output/server/node_modules/ajv/dist/vocabularies/code.js +10 -3
  41. package/.output/server/node_modules/ajv/dist/vocabularies/code.js.map +1 -1
  42. package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js +12 -2
  43. package/.output/server/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -1
  44. package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js +56 -21
  45. package/.output/server/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -1
  46. package/.output/server/node_modules/ajv/dist/vocabularies/draft4.d.ts +3 -0
  47. package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js +29 -0
  48. package/.output/server/node_modules/ajv/dist/vocabularies/draft4.js.map +1 -0
  49. package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js +10 -2
  50. package/.output/server/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -1
  51. package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.d.ts +3 -0
  52. package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js +26 -0
  53. package/.output/server/node_modules/ajv/dist/vocabularies/oasContext.js.map +1 -0
  54. package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js +22 -3
  55. package/.output/server/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map +1 -1
  56. package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.d.ts +12 -0
  57. package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js +43 -0
  58. package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumber.js.map +1 -0
  59. package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.d.ts +3 -0
  60. package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js +19 -0
  61. package/.output/server/node_modules/ajv/dist/vocabularies/validation/draft04/limitNumberExclusive.js.map +1 -0
  62. package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js +4 -0
  63. package/.output/server/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -1
  64. package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.d.ts +3 -0
  65. package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js +20 -0
  66. package/.output/server/node_modules/ajv/dist/vocabularies/validation/readOnly.js.map +1 -0
  67. package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js +8 -1
  68. package/.output/server/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -1
  69. package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.d.ts +3 -0
  70. package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js +20 -0
  71. package/.output/server/node_modules/ajv/dist/vocabularies/validation/writeOnly.js.map +1 -0
  72. package/.output/server/node_modules/ajv/lib/2019.ts +1 -0
  73. package/.output/server/node_modules/ajv/lib/2020.ts +1 -0
  74. package/.output/server/node_modules/ajv/lib/ajv.ts +1 -0
  75. package/.output/server/node_modules/ajv/lib/compile/index.ts +16 -3
  76. package/.output/server/node_modules/ajv/lib/compile/jtd/parse.ts +3 -1
  77. package/.output/server/node_modules/ajv/lib/compile/jtd/serialize.ts +3 -1
  78. package/.output/server/node_modules/ajv/lib/compile/names.ts +1 -0
  79. package/.output/server/node_modules/ajv/lib/compile/validate/index.ts +21 -4
  80. package/.output/server/node_modules/ajv/lib/core.ts +20 -1
  81. package/.output/server/node_modules/ajv/lib/draft4.ts +79 -0
  82. package/.output/server/node_modules/ajv/lib/refs/json-schema-draft-04.json +138 -0
  83. package/.output/server/node_modules/ajv/lib/types/index.ts +4 -0
  84. package/.output/server/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts +2 -1
  85. package/.output/server/node_modules/ajv/lib/vocabularies/applicator/allOf.ts +1 -1
  86. package/.output/server/node_modules/ajv/lib/vocabularies/applicator/properties.ts +4 -1
  87. package/.output/server/node_modules/ajv/lib/vocabularies/code.ts +10 -3
  88. package/.output/server/node_modules/ajv/lib/vocabularies/core/ref.ts +21 -5
  89. package/.output/server/node_modules/ajv/lib/vocabularies/discriminator/index.ts +69 -19
  90. package/.output/server/node_modules/ajv/lib/vocabularies/draft4.ts +32 -0
  91. package/.output/server/node_modules/ajv/lib/vocabularies/metadata.ts +10 -2
  92. package/.output/server/node_modules/ajv/lib/vocabularies/oasContext.ts +27 -0
  93. package/.output/server/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts +29 -7
  94. package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumber.ts +75 -0
  95. package/.output/server/node_modules/ajv/lib/vocabularies/validation/draft04/limitNumberExclusive.ts +26 -0
  96. package/.output/server/node_modules/ajv/lib/vocabularies/validation/index.ts +4 -0
  97. package/.output/server/node_modules/ajv/lib/vocabularies/validation/readOnly.ts +23 -0
  98. package/.output/server/node_modules/ajv/lib/vocabularies/validation/required.ts +7 -1
  99. package/.output/server/node_modules/ajv/lib/vocabularies/validation/writeOnly.ts +22 -0
  100. package/.output/server/node_modules/ajv/package.json +9 -6
  101. package/.output/server/node_modules/fflate/esm/index.mjs +87 -56
  102. package/.output/server/node_modules/fflate/package.json +12 -11
  103. package/.output/server/node_modules/jiti/LICENSE +21 -0
  104. package/.output/server/node_modules/jiti/README.md +258 -0
  105. package/.output/server/node_modules/jiti/dist/babel.cjs +257 -0
  106. package/.output/server/node_modules/jiti/dist/jiti.cjs +1 -0
  107. package/.output/server/node_modules/jiti/lib/jiti-cli.mjs +34 -0
  108. package/.output/server/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
  109. package/.output/server/node_modules/jiti/lib/jiti-native.mjs +121 -0
  110. package/.output/server/node_modules/jiti/lib/jiti-register.d.mts +1 -0
  111. package/.output/server/node_modules/jiti/lib/jiti-register.mjs +4 -0
  112. package/.output/server/node_modules/jiti/lib/jiti-static.mjs +23 -0
  113. package/.output/server/node_modules/jiti/lib/jiti.cjs +30 -0
  114. package/.output/server/node_modules/jiti/lib/jiti.d.cts +8 -0
  115. package/.output/server/node_modules/jiti/lib/jiti.d.mts +8 -0
  116. package/.output/server/node_modules/jiti/lib/jiti.mjs +29 -0
  117. package/.output/server/node_modules/jiti/lib/types.d.ts +420 -0
  118. package/.output/server/node_modules/jiti/package.json +146 -0
  119. package/.output/server/node_modules/remeda/dist/hasProp.js +2 -0
  120. package/.output/server/node_modules/remeda/dist/index.js +1 -1
  121. package/.output/server/node_modules/remeda/package.json +12 -12
  122. package/.output/server/node_modules/ws/lib/receiver.js +54 -0
  123. package/.output/server/node_modules/ws/lib/sender.js +6 -1
  124. package/.output/server/node_modules/ws/lib/websocket-server.js +8 -0
  125. package/.output/server/node_modules/ws/lib/websocket.js +14 -0
  126. package/.output/server/node_modules/ws/package.json +1 -1
  127. package/.output/server/package.json +5 -8
  128. package/README.md +62 -27
  129. package/package.json +15 -14
  130. package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/package.json +0 -40
  131. package/.output/server/node_modules/@rolldown/binding-linux-x64-gnu/rolldown-binding.linux-x64-gnu.node +0 -0
  132. package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js +0 -256
  133. package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.js +0 -75
  134. package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/index.js +0 -3
  135. package/.output/server/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.js +0 -70
  136. package/.output/server/node_modules/@rolldown/pluginutils/dist/index.js +0 -1
  137. package/.output/server/node_modules/@rolldown/pluginutils/dist/utils.js +0 -17
  138. package/.output/server/node_modules/@rolldown/pluginutils/package.json +0 -37
  139. package/.output/server/node_modules/rolldown/dist/index.mjs +0 -50
  140. package/.output/server/node_modules/rolldown/dist/parse-ast-index.mjs +0 -60
  141. package/.output/server/node_modules/rolldown/dist/shared/binding-BeU_1iEk.mjs +0 -582
  142. package/.output/server/node_modules/rolldown/dist/shared/bindingify-input-options-DbbBhzky.mjs +0 -2211
  143. package/.output/server/node_modules/rolldown/dist/shared/define-config-DJOr6Iwt.mjs +0 -6
  144. package/.output/server/node_modules/rolldown/dist/shared/error-DL-e8-oE.mjs +0 -85
  145. package/.output/server/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs +0 -180
  146. package/.output/server/node_modules/rolldown/dist/shared/misc-DJYbNKZX.mjs +0 -21
  147. package/.output/server/node_modules/rolldown/dist/shared/normalize-string-or-regex-CbQQ69gT.mjs +0 -66
  148. package/.output/server/node_modules/rolldown/dist/shared/parse-B_ZnWxLZ.mjs +0 -74
  149. package/.output/server/node_modules/rolldown/dist/shared/prompt-U5ajztzG.mjs +0 -847
  150. package/.output/server/node_modules/rolldown/dist/shared/rolldown-D3JZ9rMt.mjs +0 -40
  151. package/.output/server/node_modules/rolldown/dist/shared/rolldown-build-DSxL8qiP.mjs +0 -3325
  152. package/.output/server/node_modules/rolldown/dist/shared/watch-Bd8v9ewv.mjs +0 -374
  153. package/.output/server/node_modules/rolldown/package.json +0 -153
  154. package/.output/server/node_modules/unrun/dist/index.mjs +0 -2
  155. package/.output/server/node_modules/unrun/dist/src-GU5PtktT.mjs +0 -887
  156. package/.output/server/node_modules/unrun/package.json +0 -125
@@ -40,6 +40,10 @@ class Receiver extends Writable {
40
40
  * extensions
41
41
  * @param {Boolean} [options.isServer=false] Specifies whether to operate in
42
42
  * client or server mode
43
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
44
+ * buffered data chunks
45
+ * @param {Number} [options.maxFragments=0] The maximum number of message
46
+ * fragments
43
47
  * @param {Number} [options.maxPayload=0] The maximum allowed message length
44
48
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
45
49
  * not to skip UTF-8 validation for text and close messages
@@ -54,6 +58,8 @@ class Receiver extends Writable {
54
58
  this._binaryType = options.binaryType || BINARY_TYPES[0];
55
59
  this._extensions = options.extensions || {};
56
60
  this._isServer = !!options.isServer;
61
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
62
+ this._maxFragments = options.maxFragments | 0;
57
63
  this._maxPayload = options.maxPayload | 0;
58
64
  this._skipUTF8Validation = !!options.skipUTF8Validation;
59
65
  this[kWebSocket] = undefined;
@@ -89,6 +95,22 @@ class Receiver extends Writable {
89
95
  _write(chunk, encoding, cb) {
90
96
  if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
91
97
 
98
+ if (
99
+ this._maxBufferedChunks > 0 &&
100
+ this._buffers.length >= this._maxBufferedChunks
101
+ ) {
102
+ cb(
103
+ this.createError(
104
+ RangeError,
105
+ 'Too many buffered chunks',
106
+ false,
107
+ 1008,
108
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
109
+ )
110
+ );
111
+ return;
112
+ }
113
+
92
114
  this._bufferedBytes += chunk.length;
93
115
  this._buffers.push(chunk);
94
116
  this.startLoop(cb);
@@ -485,6 +507,22 @@ class Receiver extends Writable {
485
507
  }
486
508
 
487
509
  if (data.length) {
510
+ if (
511
+ this._maxFragments > 0 &&
512
+ this._fragments.length >= this._maxFragments
513
+ ) {
514
+ const error = this.createError(
515
+ RangeError,
516
+ 'Too many message fragments',
517
+ false,
518
+ 1008,
519
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
520
+ );
521
+
522
+ cb(error);
523
+ return;
524
+ }
525
+
488
526
  //
489
527
  // This message is not compressed so its length is the sum of the payload
490
528
  // length of all fragments.
@@ -524,6 +562,22 @@ class Receiver extends Writable {
524
562
  return;
525
563
  }
526
564
 
565
+ if (
566
+ this._maxFragments > 0 &&
567
+ this._fragments.length >= this._maxFragments
568
+ ) {
569
+ const error = this.createError(
570
+ RangeError,
571
+ 'Too many message fragments',
572
+ false,
573
+ 1008,
574
+ 'WS_ERR_TOO_MANY_BUFFERED_PARTS'
575
+ );
576
+
577
+ cb(error);
578
+ return;
579
+ }
580
+
527
581
  this._fragments.push(buf);
528
582
  }
529
583
 
@@ -4,6 +4,9 @@
4
4
 
5
5
  const { Duplex } = require('stream');
6
6
  const { randomFillSync } = require('crypto');
7
+ const {
8
+ types: { isUint8Array }
9
+ } = require('util');
7
10
 
8
11
  const PerMessageDeflate = require('./permessage-deflate');
9
12
  const { EMPTY_BUFFER, kWebSocket, NOOP } = require('./constants');
@@ -200,8 +203,10 @@ class Sender {
200
203
 
201
204
  if (typeof data === 'string') {
202
205
  buf.write(data, 2);
203
- } else {
206
+ } else if (isUint8Array(data)) {
204
207
  buf.set(data, 2);
208
+ } else {
209
+ throw new TypeError('Second argument must be a string or a Uint8Array');
205
210
  }
206
211
  }
207
212
 
@@ -43,6 +43,10 @@ class WebSocketServer extends EventEmitter {
43
43
  * called
44
44
  * @param {Function} [options.handleProtocols] A hook to handle protocols
45
45
  * @param {String} [options.host] The hostname where to bind the server
46
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
47
+ * buffered data chunks
48
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
49
+ * fragments
46
50
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
47
51
  * size
48
52
  * @param {Boolean} [options.noServer=false] Enable no server mode
@@ -65,6 +69,8 @@ class WebSocketServer extends EventEmitter {
65
69
  options = {
66
70
  allowSynchronousEvents: true,
67
71
  autoPong: true,
72
+ maxBufferedChunks: 1024 * 1024,
73
+ maxFragments: 128 * 1024,
68
74
  maxPayload: 100 * 1024 * 1024,
69
75
  skipUTF8Validation: false,
70
76
  perMessageDeflate: false,
@@ -424,6 +430,8 @@ class WebSocketServer extends EventEmitter {
424
430
 
425
431
  ws.setSocket(socket, head, {
426
432
  allowSynchronousEvents: this.options.allowSynchronousEvents,
433
+ maxBufferedChunks: this.options.maxBufferedChunks,
434
+ maxFragments: this.options.maxFragments,
427
435
  maxPayload: this.options.maxPayload,
428
436
  skipUTF8Validation: this.options.skipUTF8Validation
429
437
  });
@@ -201,6 +201,10 @@ class WebSocket extends EventEmitter {
201
201
  * multiple times in the same tick
202
202
  * @param {Function} [options.generateMask] The function used to generate the
203
203
  * masking key
204
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
205
+ * buffered data chunks
206
+ * @param {Number} [options.maxFragments=0] The maximum number of message
207
+ * fragments
204
208
  * @param {Number} [options.maxPayload=0] The maximum allowed message size
205
209
  * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
206
210
  * not to skip UTF-8 validation for text and close messages
@@ -212,6 +216,8 @@ class WebSocket extends EventEmitter {
212
216
  binaryType: this.binaryType,
213
217
  extensions: this._extensions,
214
218
  isServer: this._isServer,
219
+ maxBufferedChunks: options.maxBufferedChunks,
220
+ maxFragments: options.maxFragments,
215
221
  maxPayload: options.maxPayload,
216
222
  skipUTF8Validation: options.skipUTF8Validation
217
223
  });
@@ -640,6 +646,10 @@ module.exports = WebSocket;
640
646
  * masking key
641
647
  * @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
642
648
  * handshake request
649
+ * @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
650
+ * buffered data chunks
651
+ * @param {Number} [options.maxFragments=131072] The maximum number of message
652
+ * fragments
643
653
  * @param {Number} [options.maxPayload=104857600] The maximum allowed message
644
654
  * size
645
655
  * @param {Number} [options.maxRedirects=10] The maximum number of redirects
@@ -660,6 +670,8 @@ function initAsClient(websocket, address, protocols, options) {
660
670
  autoPong: true,
661
671
  closeTimeout: CLOSE_TIMEOUT,
662
672
  protocolVersion: protocolVersions[1],
673
+ maxBufferedChunks: 1024 * 1024,
674
+ maxFragments: 128 * 1024,
663
675
  maxPayload: 100 * 1024 * 1024,
664
676
  skipUTF8Validation: false,
665
677
  perMessageDeflate: true,
@@ -1017,6 +1029,8 @@ function initAsClient(websocket, address, protocols, options) {
1017
1029
  websocket.setSocket(socket, head, {
1018
1030
  allowSynchronousEvents: opts.allowSynchronousEvents,
1019
1031
  generateMask: opts.generateMask,
1032
+ maxBufferedChunks: opts.maxBufferedChunks,
1033
+ maxFragments: opts.maxFragments,
1020
1034
  maxPayload: opts.maxPayload,
1021
1035
  skipUTF8Validation: opts.skipUTF8Validation
1022
1036
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ws",
3
- "version": "8.20.0",
3
+ "version": "8.21.0",
4
4
  "description": "Simple to use, blazing fast and thoroughly tested websocket client and server for Node.js",
5
5
  "keywords": [
6
6
  "HyBi",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/agent-prod",
3
- "version": "5.0.0-beta.3",
3
+ "version": "5.0.0-beta.31",
4
4
  "type": "module",
5
5
  "private": true,
6
6
  "dependencies": {
@@ -9,21 +9,18 @@
9
9
  "@logtail/tools": "0.5.8",
10
10
  "@logtail/types": "0.5.8",
11
11
  "@msgpack/msgpack": "2.8.0",
12
- "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.17",
13
- "@rolldown/pluginutils": "1.0.0-rc.17",
14
12
  "anymatch": "3.1.3",
15
13
  "chokidar": "5.0.0",
16
14
  "consola": "3.4.2",
17
- "fflate": "0.8.2",
15
+ "fflate": "0.8.3",
16
+ "jiti": "2.7.0",
18
17
  "normalize-path": "3.0.0",
19
18
  "picomatch": "2.3.2",
20
19
  "readdirp": "5.0.0",
21
- "remeda": "2.34.0",
22
- "rolldown": "1.0.0-rc.17",
20
+ "remeda": "2.34.1",
23
21
  "serialize-error": "8.1.0",
24
22
  "stack-trace": "0.0.10",
25
23
  "tinyexec": "1.1.2",
26
- "unrun": "0.2.37",
27
- "ws": "8.20.0"
24
+ "ws": "8.21.0"
28
25
  }
29
26
  }
package/README.md CHANGED
@@ -1,33 +1,41 @@
1
- <p align="center">
2
- <img src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo" width="200" />
3
- </p>
4
-
5
- # @kubb/agent
6
-
7
- Kubb Agent Server — HTTP server for code generation powered by [Nitro](https://nitro.build) with WebSocket integration for real-time Studio communication.
8
-
9
- ## Features
10
-
11
- - 🚀 Fast HTTP server built with [Nitro](https://nitro.build)
12
- - 📡 RESTful API endpoints for code generation
13
- - 🔧 Easy integration with Kubb configuration
14
- - 📊 Health and info endpoints
15
- - 🔗 Bidirectional WebSocket with Kubb Studio
16
- - 🖥️ Machine binding — token locked to the registered machine via stable `machineToken`
17
- - 💾 Automatic session caching for faster reconnects
18
- - Production-ready
1
+ <div align="center">
2
+ <h1>@kubb/agent</h1>
3
+ <a href="https://kubb.dev" target="_blank" rel="noopener noreferrer">
4
+ <img width="180" src="https://raw.githubusercontent.com/kubb-labs/kubb/main/assets/logo.png" alt="Kubb logo">
5
+ </a>
6
+
7
+ [![npm version][npm-version-src]][npm-version-href]
8
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
9
+ [![Coverage][coverage-src]][coverage-href]
10
+ [![License][license-src]][license-href]
11
+ [![Sponsors][sponsors-src]][sponsors-href]
12
+
13
+ <h4>
14
+ <a href="https://kubb.dev/" target="_blank">Documentation</a>
15
+ <span> · </span>
16
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Report Bug</a>
17
+ <span> · </span>
18
+ <a href="https://github.com/kubb-labs/kubb/issues/" target="_blank">Request Feature</a>
19
+ </h4>
20
+ </div>
21
+
22
+ HTTP agent server for Kubb, built on [Nitro](https://nitro.build). It exposes REST endpoints for triggering code generation, a health check, and a bidirectional WebSocket connection to Kubb Studio. Machine tokens are derived from the machine's network identity so they survive restarts. Sessions are cached locally to speed up reconnects.
19
23
 
20
24
  ## Installation
21
25
 
22
26
  The agent server is installed as part of `@kubb/cli`:
23
27
 
24
28
  ```bash
29
+ bun add -D @kubb/cli
30
+ # or
25
31
  pnpm add -D @kubb/cli
32
+ # or
33
+ npm install -D @kubb/cli
26
34
  ```
27
35
 
28
36
  ## Usage
29
37
 
30
- ### Via CLI (Recommended)
38
+ ### Via CLI
31
39
 
32
40
  Start the agent server using the Kubb CLI:
33
41
 
@@ -112,7 +120,7 @@ The `agent_kv` named volume persists the KV store (session cache, machine token)
112
120
  | `KUBB_AGENT_ROOT` | `/kubb/agent` (Docker) / `cwd` | Root directory for resolving relative paths. |
113
121
  | `PORT` | `3000` | Server port. |
114
122
  | `HOST` | `0.0.0.0` | Server host. |
115
- | `KUBB_STUDIO_URL` | `https://studio.kubb.dev` | Kubb Studio WebSocket URL. |
123
+ | `KUBB_STUDIO_URL` | `https://kubb.studio` | Kubb Studio WebSocket URL. |
116
124
  | `KUBB_AGENT_TOKEN` | _(empty)_ | Authentication token for Studio. Required to connect. |
117
125
  | `KUBB_AGENT_ALLOW_WRITE` | `false` | Set to `true` to allow writing generated files to disk. |
118
126
  | `KUBB_AGENT_ALLOW_ALL` | `false` | Set to `true` to grant all permissions (implies `KUBB_AGENT_ALLOW_WRITE=true`). |
@@ -132,7 +140,7 @@ PORT=3000
132
140
  KUBB_AGENT_ROOT=/path/to/your/project
133
141
  KUBB_AGENT_CONFIG=/path/to/your/project/kubb.config.ts
134
142
  KUBB_AGENT_TOKEN=your-token-here
135
- KUBB_STUDIO_URL=https://studio.kubb.dev
143
+ KUBB_STUDIO_URL=https://kubb.studio
136
144
  ```
137
145
 
138
146
  2. **Run the agent:**
@@ -159,13 +167,15 @@ On startup the agent performs these steps before opening a WebSocket:
159
167
  2. **Create session** — calls `POST /api/agent/session/create` (includes `machineToken` for verification) and receives a WebSocket URL.
160
168
  3. **Connect** — opens a WebSocket to the returned URL using the `Authorization` header for authentication.
161
169
 
162
- ### Connection Features
170
+ ### Connection features
163
171
 
164
- - **Automatic reconnection**: Caches session tokens to speed up reconnects
165
- - **Real-time events**: Streams generation progress and events
166
- - **Command handling**: Receives `generate` and `connect` commands from Studio
167
- - **Graceful shutdown**: Notifies Studio when disconnecting
168
- - **Session management**: 24-hour session expiration with auto-refresh; Studio re-validates session validity on every incoming agent message and disconnects immediately if revoked or expired
172
+ | Feature | Description |
173
+ | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
174
+ | Automatic reconnection | Caches session tokens to speed up reconnects |
175
+ | Real-time events | Streams generation progress and events |
176
+ | Command handling | Receives `generate` and `connect` commands from Studio |
177
+ | Graceful shutdown | Notifies Studio when disconnecting |
178
+ | Session management | 24-hour session expiration with auto-refresh; Studio re-validates every incoming message and disconnects if the session is revoked or expired |
169
179
 
170
180
  ### Session Caching
171
181
 
@@ -324,3 +334,28 @@ npx kubb agent start
324
334
  ```
325
335
 
326
336
  You'll receive a stream of events as the code generation progresses.
337
+
338
+ ## Supporting Kubb
339
+
340
+ Kubb is an open source project with its ongoing development made possible entirely by the support of Sponsors. If you would like to become a sponsor, please consider:
341
+
342
+ - [Become a Sponsor on GitHub](https://github.com/sponsors/stijnvanhulle)
343
+
344
+ <p align="center">
345
+ <a href="https://github.com/sponsors/stijnvanhulle">
346
+ <img src="https://raw.githubusercontent.com/stijnvanhulle/sponsors/main/sponsors.svg" alt="My sponsors" />
347
+ </a>
348
+ </p>
349
+
350
+ <!-- Badges -->
351
+
352
+ [npm-version-src]: https://img.shields.io/npm/v/@kubb/agent?flat&colorA=18181B&colorB=f58517
353
+ [npm-version-href]: https://npmjs.com/package/@kubb/agent
354
+ [npm-downloads-src]: https://img.shields.io/npm/dm/@kubb/agent?flat&colorA=18181B&colorB=f58517
355
+ [npm-downloads-href]: https://npmjs.com/package/@kubb/agent
356
+ [license-src]: https://img.shields.io/github/license/kubb-labs/kubb.svg?flat&colorA=18181B&colorB=f58517
357
+ [license-href]: https://github.com/kubb-labs/kubb/blob/main/LICENSE
358
+ [coverage-src]: https://img.shields.io/codecov/c/github/kubb-labs/kubb?style=flat&colorA=18181B&colorB=f58517
359
+ [coverage-href]: https://www.npmjs.com/package/@kubb/agent
360
+ [sponsors-src]: https://img.shields.io/github/sponsors/stijnvanhulle?style=flat&colorA=18181B&colorB=f58517
361
+ [sponsors-href]: https://github.com/sponsors/stijnvanhulle/
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@kubb/agent",
3
- "version": "5.0.0-beta.3",
4
- "description": "Agent server for Kubb, enabling HTTP-based access to code generation capabilities.",
3
+ "version": "5.0.0-beta.31",
4
+ "description": "HTTP agent server for Kubb. Exposes code generation via REST API and WebSocket with real-time Kubb Studio integration, machine binding, and Docker support.",
5
5
  "keywords": [
6
6
  "agent",
7
- "code-generation",
8
7
  "codegen",
8
+ "docker",
9
9
  "http",
10
10
  "kubb",
11
11
  "openapi",
12
12
  "server",
13
- "swagger",
14
- "typescript"
13
+ "typescript",
14
+ "websocket"
15
15
  ],
16
16
  "license": "AGPL-3.0-or-later",
17
17
  "author": "stijnvanhulle",
@@ -38,22 +38,23 @@
38
38
  "dependencies": {
39
39
  "@logtail/node": "^0.5.8",
40
40
  "consola": "^3.4.2",
41
- "remeda": "^2.34.0",
41
+ "jiti": "^2.7.0",
42
+ "remeda": "^2.34.1",
42
43
  "tinyexec": "^1.1.2",
43
- "unrun": "^0.2.37",
44
44
  "unstorage": "^1.17.5",
45
- "ws": "^8.20.0",
46
- "@kubb/ast": "5.0.0-beta.3",
47
- "@kubb/core": "5.0.0-beta.3"
45
+ "ws": "^8.21.0",
46
+ "@kubb/ast": "5.0.0-beta.31",
47
+ "@kubb/core": "5.0.0-beta.31"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/ws": "^8.18.1",
51
- "msw": "^2.14.2",
51
+ "msw": "^2.14.6",
52
52
  "nitropack": "^2.13.4",
53
- "vite": "^8.0.10",
53
+ "vite": "^8.0.14",
54
54
  "@internals/utils": "0.0.0",
55
- "@kubb/adapter-oas": "5.0.0-beta.3",
56
- "@kubb/parser-ts": "5.0.0-beta.3"
55
+ "@kubb/adapter-oas": "5.0.0-beta.31",
56
+ "@kubb/parser-ts": "5.0.0-beta.31",
57
+ "@kubb/renderer-jsx": "5.0.0-beta.31"
57
58
  },
58
59
  "engines": {
59
60
  "node": ">=22"
@@ -1,40 +0,0 @@
1
- {
2
- "name": "@rolldown/binding-linux-x64-gnu",
3
- "version": "1.0.0-rc.17",
4
- "cpu": [
5
- "x64"
6
- ],
7
- "main": "rolldown-binding.linux-x64-gnu.node",
8
- "files": [
9
- "rolldown-binding.linux-x64-gnu.node"
10
- ],
11
- "description": "Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.",
12
- "keywords": [
13
- "bundler",
14
- "esbuild",
15
- "parcel",
16
- "rolldown",
17
- "rollup",
18
- "webpack"
19
- ],
20
- "homepage": "https://rolldown.rs/",
21
- "license": "MIT",
22
- "engines": {
23
- "node": "^20.19.0 || >=22.12.0"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "git+https://github.com/rolldown/rolldown.git",
28
- "directory": "packages/rolldown"
29
- },
30
- "publishConfig": {
31
- "registry": "https://registry.npmjs.org/",
32
- "access": "public"
33
- },
34
- "os": [
35
- "linux"
36
- ],
37
- "libc": [
38
- "glibc"
39
- ]
40
- }