rivetkit 2.3.20 → 2.3.22

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 (148) hide show
  1. package/dist/browser/client.d.ts +43 -5
  2. package/dist/browser/client.js +315 -63
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +2 -1
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/actor/errors.cjs +2 -2
  7. package/dist/tsup/actor/errors.cjs.map +1 -1
  8. package/dist/tsup/actor/errors.d.cts +1 -1
  9. package/dist/tsup/actor/errors.d.ts +1 -1
  10. package/dist/tsup/actor/errors.js +1 -1
  11. package/dist/tsup/agent-os/index.cjs +2 -1
  12. package/dist/tsup/agent-os/index.cjs.map +1 -1
  13. package/dist/tsup/agent-os/index.d.cts +32 -4
  14. package/dist/tsup/agent-os/index.d.ts +32 -4
  15. package/dist/tsup/agent-os/index.js +2 -1
  16. package/dist/tsup/agent-os/index.js.map +1 -1
  17. package/dist/tsup/{chunk-553CIQJY.js → chunk-47FSGXYN.js} +2 -2
  18. package/dist/tsup/{chunk-2NXLTFWI.js → chunk-4DTWJFIZ.js} +3 -3
  19. package/dist/tsup/chunk-4DTWJFIZ.js.map +1 -0
  20. package/dist/tsup/{chunk-2CE5UNWK.cjs → chunk-BDKVTNJF.cjs} +11 -10
  21. package/dist/tsup/chunk-BDKVTNJF.cjs.map +1 -0
  22. package/dist/tsup/{chunk-DHWZTUKA.js → chunk-DE2IFYJK.js} +4 -3
  23. package/dist/tsup/chunk-DE2IFYJK.js.map +1 -0
  24. package/dist/tsup/{chunk-DMQUERRN.js → chunk-GINS4O73.js} +2 -2
  25. package/dist/tsup/{chunk-3WS7Z64U.cjs → chunk-GZZNJGXY.cjs} +3 -3
  26. package/dist/tsup/chunk-GZZNJGXY.cjs.map +1 -0
  27. package/dist/tsup/{chunk-A36FMKOV.cjs → chunk-HEY27WZX.cjs} +479 -230
  28. package/dist/tsup/chunk-HEY27WZX.cjs.map +1 -0
  29. package/dist/tsup/{chunk-WAISW7KR.cjs → chunk-KEAUN5F5.cjs} +10 -10
  30. package/dist/tsup/chunk-KEAUN5F5.cjs.map +1 -0
  31. package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -1
  32. package/dist/tsup/{chunk-CVLNRT7O.cjs → chunk-LUMROGNM.cjs} +3 -3
  33. package/dist/tsup/chunk-LUMROGNM.cjs.map +1 -0
  34. package/dist/tsup/{chunk-JX2ITWAV.cjs → chunk-MGI2VVF6.cjs} +14 -4
  35. package/dist/tsup/chunk-MGI2VVF6.cjs.map +1 -0
  36. package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -1
  37. package/dist/tsup/chunk-NWCAIWHL.cjs.map +1 -1
  38. package/dist/tsup/{chunk-RSIOGT2U.cjs → chunk-QOQA4JPN.cjs} +7 -7
  39. package/dist/tsup/chunk-QOQA4JPN.cjs.map +1 -0
  40. package/dist/tsup/{chunk-TZVAVPGJ.js → chunk-QXBNHJH5.js} +4 -4
  41. package/dist/tsup/{chunk-W2PXGWMR.js → chunk-RIPVNPR6.js} +2 -2
  42. package/dist/tsup/{chunk-5G2J26VM.js → chunk-VD47X7KQ.js} +318 -69
  43. package/dist/tsup/chunk-VD47X7KQ.js.map +1 -0
  44. package/dist/tsup/{chunk-76YTS32R.cjs → chunk-WLRGUAMW.cjs} +4 -4
  45. package/dist/tsup/chunk-WLRGUAMW.cjs.map +1 -0
  46. package/dist/tsup/{chunk-IHKDFKM4.cjs → chunk-WMNXGH25.cjs} +3 -3
  47. package/dist/tsup/chunk-WMNXGH25.cjs.map +1 -0
  48. package/dist/tsup/{chunk-SNNVRHLX.js → chunk-XZBDVEQN.js} +2 -2
  49. package/dist/tsup/{chunk-P2OFXH4G.js → chunk-ZOVJDAOW.js} +14 -4
  50. package/dist/tsup/chunk-ZOVJDAOW.js.map +1 -0
  51. package/dist/tsup/client/mod.cjs +6 -6
  52. package/dist/tsup/client/mod.cjs.map +1 -1
  53. package/dist/tsup/client/mod.d.cts +15 -6
  54. package/dist/tsup/client/mod.d.ts +15 -6
  55. package/dist/tsup/client/mod.js +5 -5
  56. package/dist/tsup/common/log.cjs +3 -3
  57. package/dist/tsup/common/log.cjs.map +1 -1
  58. package/dist/tsup/common/log.js +2 -2
  59. package/dist/tsup/common/websocket.cjs +4 -4
  60. package/dist/tsup/common/websocket.cjs.map +1 -1
  61. package/dist/tsup/common/websocket.js +3 -3
  62. package/dist/tsup/{config-Be-VOHaX.d.ts → config-Cv6pjCt-.d.ts} +37 -7
  63. package/dist/tsup/{config-Ct5uXxXk.d.cts → config-osdJqQwX.d.cts} +37 -7
  64. package/dist/tsup/{context-CXLa0BIM.d.ts → context-CoVbKBuk.d.ts} +1 -1
  65. package/dist/tsup/{context-Cw-11Q-B.d.cts → context-DpjrM7n7.d.cts} +1 -1
  66. package/dist/tsup/db/drizzle.cjs +3 -3
  67. package/dist/tsup/db/drizzle.cjs.map +1 -1
  68. package/dist/tsup/db/drizzle.js +2 -2
  69. package/dist/tsup/db/mod.cjs +4 -4
  70. package/dist/tsup/db/mod.cjs.map +1 -1
  71. package/dist/tsup/db/mod.js +3 -3
  72. package/dist/tsup/dynamic/mod.cjs.map +1 -1
  73. package/dist/tsup/dynamic/mod.d.cts +4 -3
  74. package/dist/tsup/dynamic/mod.d.ts +4 -3
  75. package/dist/tsup/inspector/mod.cjs +6 -6
  76. package/dist/tsup/inspector/mod.cjs.map +1 -1
  77. package/dist/tsup/inspector/mod.js +5 -5
  78. package/dist/tsup/inspector/workflow.cjs +5 -5
  79. package/dist/tsup/inspector/workflow.cjs.map +1 -1
  80. package/dist/tsup/inspector/workflow.js +4 -4
  81. package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
  82. package/dist/tsup/inspector-tab/mod.d.cts +5 -4
  83. package/dist/tsup/inspector-tab/mod.d.ts +5 -4
  84. package/dist/tsup/mod.cjs +170 -158
  85. package/dist/tsup/mod.cjs.map +1 -1
  86. package/dist/tsup/mod.d.cts +6 -5
  87. package/dist/tsup/mod.d.ts +6 -5
  88. package/dist/tsup/mod.js +56 -44
  89. package/dist/tsup/mod.js.map +1 -1
  90. package/dist/tsup/test/mod.cjs +7 -7
  91. package/dist/tsup/test/mod.cjs.map +1 -1
  92. package/dist/tsup/test/mod.d.cts +4 -3
  93. package/dist/tsup/test/mod.d.ts +4 -3
  94. package/dist/tsup/test/mod.js +5 -5
  95. package/dist/tsup/unstable/migrations.cjs.map +1 -1
  96. package/dist/tsup/{utils-DsoDinPz.d.ts → utils-3rsE0JvI.d.cts} +12 -2
  97. package/dist/tsup/{utils-DsoDinPz.d.cts → utils-3rsE0JvI.d.ts} +12 -2
  98. package/dist/tsup/{utils-OQHBjfcM.d.ts → utils-C1O-SklO.d.ts} +1 -1
  99. package/dist/tsup/{utils-CNFeS-Dk.d.cts → utils-C6b0aYUM.d.cts} +1 -1
  100. package/dist/tsup/utils.cjs +3 -3
  101. package/dist/tsup/utils.cjs.map +1 -1
  102. package/dist/tsup/utils.d.cts +2 -2
  103. package/dist/tsup/utils.d.ts +2 -2
  104. package/dist/tsup/utils.js +2 -2
  105. package/dist/tsup/workflow/mod.cjs +11 -11
  106. package/dist/tsup/workflow/mod.cjs.map +1 -1
  107. package/dist/tsup/workflow/mod.d.cts +6 -5
  108. package/dist/tsup/workflow/mod.d.ts +6 -5
  109. package/dist/tsup/workflow/mod.js +5 -5
  110. package/package.json +10 -9
  111. package/src/actor/errors.ts +27 -4
  112. package/src/client/actor-conn.ts +34 -1
  113. package/src/client/actor-handle.ts +29 -1
  114. package/src/client/auth.ts +37 -0
  115. package/src/client/client.ts +10 -2
  116. package/src/client/config.ts +12 -1
  117. package/src/client/mod.ts +9 -0
  118. package/src/client/token-provider.test.ts +86 -0
  119. package/src/client/token-provider.ts +93 -0
  120. package/src/client/utils.ts +1 -0
  121. package/src/engine-client/actor-websocket-client.ts +2 -1
  122. package/src/engine-client/api-endpoints.ts +28 -0
  123. package/src/engine-client/driver.ts +4 -0
  124. package/src/engine-client/mod.ts +201 -64
  125. package/src/registry/config/envoy.ts +1 -17
  126. package/src/registry/config/index.test.ts +2 -2
  127. package/src/registry/config/index.ts +7 -2
  128. package/src/registry/index.ts +28 -0
  129. package/src/registry/native.ts +31 -3
  130. package/dist/tsup/chunk-2CE5UNWK.cjs.map +0 -1
  131. package/dist/tsup/chunk-2NXLTFWI.js.map +0 -1
  132. package/dist/tsup/chunk-3WS7Z64U.cjs.map +0 -1
  133. package/dist/tsup/chunk-5G2J26VM.js.map +0 -1
  134. package/dist/tsup/chunk-76YTS32R.cjs.map +0 -1
  135. package/dist/tsup/chunk-A36FMKOV.cjs.map +0 -1
  136. package/dist/tsup/chunk-CVLNRT7O.cjs.map +0 -1
  137. package/dist/tsup/chunk-DHWZTUKA.js.map +0 -1
  138. package/dist/tsup/chunk-IHKDFKM4.cjs.map +0 -1
  139. package/dist/tsup/chunk-JX2ITWAV.cjs.map +0 -1
  140. package/dist/tsup/chunk-P2OFXH4G.js.map +0 -1
  141. package/dist/tsup/chunk-RSIOGT2U.cjs.map +0 -1
  142. package/dist/tsup/chunk-WAISW7KR.cjs.map +0 -1
  143. package/src/registry/process-metrics.ts +0 -250
  144. /package/dist/tsup/{chunk-553CIQJY.js.map → chunk-47FSGXYN.js.map} +0 -0
  145. /package/dist/tsup/{chunk-DMQUERRN.js.map → chunk-GINS4O73.js.map} +0 -0
  146. /package/dist/tsup/{chunk-TZVAVPGJ.js.map → chunk-QXBNHJH5.js.map} +0 -0
  147. /package/dist/tsup/{chunk-W2PXGWMR.js.map → chunk-RIPVNPR6.js.map} +0 -0
  148. /package/dist/tsup/{chunk-SNNVRHLX.js.map → chunk-XZBDVEQN.js.map} +0 -0
package/dist/tsup/mod.cjs CHANGED
@@ -1,5 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } var _class; var _class2; var _class3;
2
2
 
3
+ var _chunkWLRGUAMWcjs = require('./chunk-WLRGUAMW.cjs');
4
+
5
+
3
6
 
4
7
 
5
8
 
@@ -17,7 +20,6 @@
17
20
  var _chunkNWCAIWHLcjs = require('./chunk-NWCAIWHL.cjs');
18
21
 
19
22
 
20
- var _chunk76YTS32Rcjs = require('./chunk-76YTS32R.cjs');
21
23
 
22
24
 
23
25
 
@@ -31,18 +33,20 @@ var _chunk76YTS32Rcjs = require('./chunk-76YTS32R.cjs');
31
33
 
32
34
 
33
35
 
34
- var _chunkA36FMKOVcjs = require('./chunk-A36FMKOV.cjs');
36
+
37
+
38
+ var _chunkHEY27WZXcjs = require('./chunk-HEY27WZX.cjs');
35
39
 
36
40
 
37
41
 
38
42
  var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
39
- require('./chunk-3WS7Z64U.cjs');
40
43
 
41
44
 
42
45
 
43
46
 
44
- var _chunkCVLNRT7Ocjs = require('./chunk-CVLNRT7O.cjs');
47
+ var _chunkLUMROGNMcjs = require('./chunk-LUMROGNM.cjs');
45
48
  require('./chunk-KVFIONKQ.cjs');
49
+ require('./chunk-GZZNJGXY.cjs');
46
50
 
47
51
 
48
52
 
@@ -76,7 +80,7 @@ require('./chunk-KVFIONKQ.cjs');
76
80
 
77
81
 
78
82
 
79
- var _chunk2CE5UNWKcjs = require('./chunk-2CE5UNWK.cjs');
83
+ var _chunkBDKVTNJFcjs = require('./chunk-BDKVTNJF.cjs');
80
84
 
81
85
 
82
86
 
@@ -89,11 +93,11 @@ var _chunk2CE5UNWKcjs = require('./chunk-2CE5UNWK.cjs');
89
93
 
90
94
 
91
95
 
92
- var _chunkJX2ITWAVcjs = require('./chunk-JX2ITWAV.cjs');
96
+ var _chunkMGI2VVF6cjs = require('./chunk-MGI2VVF6.cjs');
93
97
 
94
98
  // src/actor/log.ts
95
99
  function loggerWithoutContext() {
96
- return _chunk2CE5UNWKcjs.getLogger.call(void 0, "actor-runtime");
100
+ return _chunkBDKVTNJFcjs.getLogger.call(void 0, "actor-runtime");
97
101
  }
98
102
 
99
103
  // src/actor/definition.ts
@@ -218,7 +222,7 @@ function validateSchemaSync(schemas, key, data) {
218
222
  if (isStandardSchema(schema)) {
219
223
  const result = schema["~standard"].validate(data);
220
224
  if (isPromiseLike(result)) {
221
- throw _chunkJX2ITWAVcjs.unsupportedFeature.call(void 0, "async schema validation");
225
+ throw _chunkMGI2VVF6cjs.unsupportedFeature.call(void 0, "async schema validation");
222
226
  }
223
227
  if (result.issues) {
224
228
  return { success: false, issues: [...result.issues] };
@@ -235,7 +239,7 @@ function validateSchemaSync(schemas, key, data) {
235
239
  var _virtualwebsocket = require('@rivetkit/virtual-websocket');
236
240
  var _ws = require('hono/ws');
237
241
  function logger() {
238
- return _chunk2CE5UNWKcjs.getLogger.call(void 0, "inline-websocket-adapter");
242
+ return _chunkBDKVTNJFcjs.getLogger.call(void 0, "inline-websocket-adapter");
239
243
  }
240
244
  var InlineWebSocketAdapter = class {
241
245
  #handler;
@@ -385,28 +389,9 @@ var InlineWebSocketAdapter = class {
385
389
  }
386
390
  };
387
391
 
388
- // src/common/engine.ts
389
- var ENGINE_HOST = "127.0.0.1";
390
- var ENGINE_PORT = 6420;
391
- var ENGINE_ENDPOINT = buildEngineEndpoint(ENGINE_HOST, ENGINE_PORT);
392
- function buildEngineEndpoint(host, port) {
393
- const urlHost = host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
394
- return `http://${urlHost}:${port}`;
395
- }
396
- function isLocalEngineEndpoint(endpoint) {
397
- let url;
398
- try {
399
- url = new URL(endpoint);
400
- } catch (e) {
401
- return false;
402
- }
403
- const hostname = url.hostname.toLowerCase();
404
- return hostname === "localhost" || hostname === "0.0.0.0" || hostname === "::" || hostname === "[::]" || hostname === "::1" || hostname === "[::1]" || /^127(?:\.\d{1,3}){0,3}$/.test(hostname);
405
- }
406
-
407
392
  // src/registry/log.ts
408
393
  function logger2() {
409
- return _chunk2CE5UNWKcjs.getLogger.call(void 0, "registry");
394
+ return _chunkBDKVTNJFcjs.getLogger.call(void 0, "registry");
410
395
  }
411
396
 
412
397
  // src/serverless/configure.ts
@@ -452,8 +437,8 @@ async function configureServerlessPool(config) {
452
437
  );
453
438
  }
454
439
  const customConfig = config.configurePool;
455
- const clientConfig = _chunkA36FMKOVcjs.convertRegistryConfigToClientConfig.call(void 0, config);
456
- const dcsRes = await _chunkA36FMKOVcjs.getDatacenters.call(void 0, clientConfig);
440
+ const clientConfig = _chunkHEY27WZXcjs.convertRegistryConfigToClientConfig.call(void 0, config);
441
+ const dcsRes = await _chunkHEY27WZXcjs.getDatacenters.call(void 0, clientConfig);
457
442
  const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
458
443
  const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
459
444
  const headers = {
@@ -475,7 +460,7 @@ async function configureServerlessPool(config) {
475
460
  metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
476
461
  drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
477
462
  };
478
- await _chunkA36FMKOVcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
463
+ await _chunkHEY27WZXcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
479
464
  datacenters: Object.fromEntries(
480
465
  dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
481
466
  )
@@ -492,7 +477,7 @@ async function configureServerlessPool(config) {
492
477
  logger2().warn({
493
478
  msg: "serverless pool configuration attempt failed",
494
479
  attempts,
495
- error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
480
+ error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
496
481
  });
497
482
  await sleep(CONFIGURE_RETRY_DELAY_MS);
498
483
  }
@@ -500,7 +485,7 @@ async function configureServerlessPool(config) {
500
485
  logger2().error({
501
486
  msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
502
487
  attempts,
503
- error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, lastError)
488
+ error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, lastError)
504
489
  });
505
490
  throw lastError;
506
491
  }
@@ -510,22 +495,11 @@ var _zod = require('zod');
510
495
 
511
496
  // src/registry/config/envoy.ts
512
497
  var _v4 = require('zod/v4');
513
- var warnedMissingVersion = false;
514
498
  var EnvoyConfigSchema = _v4.z.object({
515
- poolName: _v4.z.string().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetPool.call(void 0, ), () => ( "default"))),
516
- version: _v4.z.number().default(() => {
517
- const version = _chunk2CE5UNWKcjs.getRivetEnvoyVersion.call(void 0, );
518
- if (version !== void 0) return version;
519
- if (_chunk2CE5UNWKcjs.getNodeEnv.call(void 0, ) === "production" && !warnedMissingVersion) {
520
- warnedMissingVersion = true;
521
- _chunk2CE5UNWKcjs.getLogger.call(void 0, "rivetkit").error(
522
- "RIVET_ENVOY_VERSION is not set. Actors will not be versioned, which means they won't be drained on deploy. This is only needed when self-hosting or using a custom envoy (not needed for Rivet Compute). Set this as a build arg in your Dockerfile. See https://rivet.dev/docs/actors/versions"
523
- );
524
- }
525
- return 1;
526
- }),
499
+ poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetPool.call(void 0, ), () => ( "default"))),
500
+ version: _v4.z.number().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
527
501
  // Deprecated.
528
- totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
502
+ totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
529
503
  envoyKey: _v4.z.string().optional()
530
504
  });
531
505
 
@@ -563,7 +537,7 @@ var ServerlessConfigSchema = _v4.z.object({
563
537
  *
564
538
  * Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
565
539
  */
566
- publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetPublicEndpoint.call(void 0, )))),
540
+ publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetPublicEndpoint.call(void 0, )))),
567
541
  /**
568
542
  * Token that clients should use when connecting via the public endpoint.
569
543
  *
@@ -571,7 +545,7 @@ var ServerlessConfigSchema = _v4.z.object({
571
545
  *
572
546
  * Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
573
547
  */
574
- publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetPublicToken.call(void 0, ))))
548
+ publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetPublicToken.call(void 0, ))))
575
549
  // There is no publicNamespace config option because the frontend and backend
576
550
  // cannot use different namespaces. The namespace is extracted from the
577
551
  // publicEndpoint URL auth syntax if provided.
@@ -625,7 +599,7 @@ var RegistryConfigSchema = _zod.z.object({
625
599
  * Runtime binding to use for RivetKit core.
626
600
  * */
627
601
  runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
628
- const rawRuntime = _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetkitRuntime.call(void 0, )));
602
+ const rawRuntime = _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetkitRuntime.call(void 0, )));
629
603
  if (rawRuntime === void 0) {
630
604
  return "auto";
631
605
  }
@@ -662,7 +636,7 @@ var RegistryConfigSchema = _zod.z.object({
662
636
  * */
663
637
  logging: _zod.z.object({
664
638
  baseLogger: _zod.z.custom().optional(),
665
- level: _chunk2CE5UNWKcjs.LogLevelSchema.optional()
639
+ level: _chunkBDKVTNJFcjs.LogLevelSchema.optional()
666
640
  }).optional().default(() => ({})),
667
641
  // MARK: Routing
668
642
  // // This is a function to allow for lazy configuration of upgradeWebSocket on the
@@ -680,9 +654,9 @@ var RegistryConfigSchema = _zod.z.object({
680
654
  *
681
655
  * Can also be set via RIVET_ENDPOINT environment variables.
682
656
  */
683
- endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetEngine.call(void 0, ))), () => ( _chunk2CE5UNWKcjs.getRivetEndpoint.call(void 0, )))),
684
- token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetToken.call(void 0, )))),
685
- namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunk2CE5UNWKcjs.getRivetNamespace.call(void 0, )))),
657
+ endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetEngine.call(void 0, ))), () => ( _chunkBDKVTNJFcjs.getRivetEndpoint.call(void 0, )))),
658
+ token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetToken.call(void 0, )))),
659
+ namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetNamespace.call(void 0, )))),
686
660
  headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
687
661
  // MARK: Client
688
662
  // TODO:
@@ -722,21 +696,21 @@ var RegistryConfigSchema = _zod.z.object({
722
696
  *
723
697
  * Starts the full Rust engine process locally.
724
698
  */
725
- startEngine: _zod.z.boolean().default(() => _chunk2CE5UNWKcjs.getRivetRunEngine.call(void 0, )),
699
+ startEngine: _zod.z.boolean().default(() => _chunkBDKVTNJFcjs.getRivetRunEngine.call(void 0, )),
726
700
  /**
727
701
  * @experimental
728
702
  *
729
703
  * Host to bind the spawned local engine process to.
730
704
  */
731
- engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetRunEngineHost.call(void 0, ), () => ( ENGINE_HOST))),
705
+ engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkHEY27WZXcjs.ENGINE_HOST))),
732
706
  /**
733
707
  * @experimental
734
708
  *
735
709
  * Port to bind the spawned local engine process to.
736
710
  */
737
- enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetRunEnginePort.call(void 0, ), () => ( ENGINE_PORT))),
711
+ enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkHEY27WZXcjs.ENGINE_PORT))),
738
712
  /** @experimental */
739
- engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunk2CE5UNWKcjs.VERSION))),
713
+ engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkBDKVTNJFcjs.VERSION))),
740
714
  /**
741
715
  * Starts the first-party Services actor host when RivetKit manages
742
716
  * a local engine. Defaults to the local-engine decision. Set
@@ -790,7 +764,7 @@ var RegistryConfigSchema = _zod.z.object({
790
764
  }))
791
765
  }).transform((config, ctx) => {
792
766
  var _a, _b, _c;
793
- const isDevEnv = _chunk2CE5UNWKcjs.isDev.call(void 0, );
767
+ const isDevEnv = _chunkBDKVTNJFcjs.isDev.call(void 0, );
794
768
  const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
795
769
  if (config.runtime === "wasm" && sqliteBackend === "local") {
796
770
  ctx.addIssue({
@@ -800,7 +774,7 @@ var RegistryConfigSchema = _zod.z.object({
800
774
  });
801
775
  }
802
776
  const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
803
- const parsedEndpoint = config.endpoint ? _chunkA36FMKOVcjs.tryParseEndpoint.call(void 0, ctx, {
777
+ const parsedEndpoint = config.endpoint ? _chunkHEY27WZXcjs.tryParseEndpoint.call(void 0, ctx, {
804
778
  endpoint: config.endpoint,
805
779
  path: ["endpoint"],
806
780
  namespace: config.namespace,
@@ -818,18 +792,18 @@ var RegistryConfigSchema = _zod.z.object({
818
792
  message: "configurePool requires either endpoint or startEngine"
819
793
  });
820
794
  }
821
- const localEngineEndpoint = buildEngineEndpoint(
795
+ const localEngineEndpoint = _chunkHEY27WZXcjs.buildEngineEndpoint.call(void 0,
822
796
  config.engineHost,
823
797
  config.enginePort
824
798
  );
825
799
  const endpoint = config.startEngine ? localEngineEndpoint : _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint), () => ( (isDevEnv ? localEngineEndpoint : void 0)));
826
- const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunk2CE5UNWKcjs.getRivetRunServices.call(void 0, ))), () => ( Boolean(endpoint && isLocalEngineEndpoint(endpoint))));
800
+ const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunkBDKVTNJFcjs.getRivetRunServices.call(void 0, ))), () => ( Boolean(endpoint && _chunkHEY27WZXcjs.isLocalEngineEndpoint.call(void 0, endpoint))));
827
801
  const validateServerlessEndpoint = Boolean(
828
802
  config.startEngine || parsedEndpoint
829
803
  );
830
804
  const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
831
- const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( "dev"));
832
- const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkA36FMKOVcjs.tryParseEndpoint.call(void 0, ctx, {
805
+ const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint && _chunkHEY27WZXcjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
806
+ const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkHEY27WZXcjs.tryParseEndpoint.call(void 0, ctx, {
833
807
  endpoint: config.serverless.publicEndpoint,
834
808
  path: ["serverless", "publicEndpoint"]
835
809
  }) : void 0;
@@ -933,7 +907,7 @@ var DocRegistryConfigSchema = _zod.z.object({
933
907
  noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
934
908
  sqlite: DocSqliteConfigSchema,
935
909
  logging: _zod.z.object({
936
- level: _chunk2CE5UNWKcjs.LogLevelSchema.optional().describe(
910
+ level: _chunkBDKVTNJFcjs.LogLevelSchema.optional().describe(
937
911
  "Log level for RivetKit. Default: 'warn'"
938
912
  )
939
913
  }).optional().describe("Logging configuration."),
@@ -981,7 +955,7 @@ function shouldAttachNativeKvError(message) {
981
955
  function enrichNativeDatabaseError(database, error) {
982
956
  var _a;
983
957
  const bridgeReason = typeof error === "string" ? error : error instanceof Error ? error.message : void 0;
984
- const bridged = bridgeReason === void 0 ? void 0 : _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, bridgeReason);
958
+ const bridged = bridgeReason === void 0 ? void 0 : _chunkMGI2VVF6cjs.decodeBridgeRivetError.call(void 0, bridgeReason);
985
959
  if (bridged) {
986
960
  throw bridged;
987
961
  }
@@ -1213,7 +1187,7 @@ function wrapJsNativeDatabase(database) {
1213
1187
  if (transaction) {
1214
1188
  try {
1215
1189
  await transaction.rollback();
1216
- } catch (e2) {
1190
+ } catch (e) {
1217
1191
  }
1218
1192
  }
1219
1193
  enrichNativeDatabaseError(database, error);
@@ -1563,7 +1537,7 @@ var NapiCoreRuntime = (_class = class {
1563
1537
  if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
1564
1538
  return ownerCtx;
1565
1539
  }
1566
- const applicationSpan = _chunkA36FMKOVcjs.readActiveTraceHeaders.call(void 0, );
1540
+ const applicationSpan = _chunkHEY27WZXcjs.readActiveTraceHeaders.call(void 0, );
1567
1541
  if (!applicationSpan) {
1568
1542
  return active;
1569
1543
  }
@@ -1766,7 +1740,7 @@ var NapiCoreRuntime = (_class = class {
1766
1740
  const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
1767
1741
  return this.#invocationContext.run(
1768
1742
  nativeCtx,
1769
- () => _chunkA36FMKOVcjs.runWithActorInvocationSpan.call(void 0, span, run)
1743
+ () => _chunkHEY27WZXcjs.runWithActorInvocationSpan.call(void 0, span, run)
1770
1744
  );
1771
1745
  }
1772
1746
  actorInvocationTraceContext(ctx) {
@@ -1796,7 +1770,7 @@ var NapiCoreRuntime = (_class = class {
1796
1770
  run: (body) => this.#runAs(stepCtx, body),
1797
1771
  finish: (outcome, error) => step.finish(
1798
1772
  outcome,
1799
- error === void 0 ? void 0 : _chunkJX2ITWAVcjs.encodeErrorForBridge.call(void 0, error)
1773
+ error === void 0 ? void 0 : _chunkMGI2VVF6cjs.encodeErrorForBridge.call(void 0, error)
1800
1774
  )
1801
1775
  };
1802
1776
  },
@@ -2141,8 +2115,8 @@ function runtimeBytesToArrayBuffer(value) {
2141
2115
  function buildNativeHttpRequest(init) {
2142
2116
  var _a;
2143
2117
  const headers = new Headers(init.headers);
2144
- const originalUrl = headers.get(_chunkA36FMKOVcjs.HEADER_ORIGINAL_REQUEST_URL);
2145
- headers.delete(_chunkA36FMKOVcjs.HEADER_ORIGINAL_REQUEST_URL);
2118
+ const originalUrl = headers.get(_chunkHEY27WZXcjs.HEADER_ORIGINAL_REQUEST_URL);
2119
+ headers.delete(_chunkHEY27WZXcjs.HEADER_ORIGINAL_REQUEST_URL);
2146
2120
  const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
2147
2121
  const method2 = init.method.toUpperCase();
2148
2122
  const bodyForbidden = method2 === "GET" || method2 === "HEAD";
@@ -2221,7 +2195,7 @@ async function pumpResponseBody(reader, stream) {
2221
2195
  }
2222
2196
  } catch (error) {
2223
2197
  try {
2224
- await stream.error(_chunk2CE5UNWKcjs.stringifyError.call(void 0, error));
2198
+ await stream.error(_chunkBDKVTNJFcjs.stringifyError.call(void 0, error));
2225
2199
  } catch (streamError) {
2226
2200
  logger2().debug({
2227
2201
  msg: "failed to report native http response stream error",
@@ -2351,7 +2325,7 @@ function validateQueueComplete(schemas, name, response) {
2351
2325
  return result.data;
2352
2326
  }
2353
2327
  function validationError(target, issues) {
2354
- return new (0, _chunkJX2ITWAVcjs.RivetError)("actor", "validation_error", `Invalid ${target}`, {
2328
+ return new (0, _chunkMGI2VVF6cjs.RivetError)("actor", "validation_error", `Invalid ${target}`, {
2355
2329
  public: true,
2356
2330
  metadata: { issues }
2357
2331
  });
@@ -2359,7 +2333,7 @@ function validationError(target, issues) {
2359
2333
 
2360
2334
  // src/registry/run-handler-coordinator.ts
2361
2335
  function runUnavailable(actorId, reason) {
2362
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
2336
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
2363
2337
  "actor",
2364
2338
  "run_handler_unavailable",
2365
2339
  `Run handler control is unavailable for actor ${actorId}: ${reason}.`,
@@ -2580,16 +2554,16 @@ function normalizeQueueMessage(message) {
2580
2554
  }
2581
2555
  function normalizeWasmBridgeError(error) {
2582
2556
  if (typeof error === "string") {
2583
- return _nullishCoalesce(_chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
2557
+ return _nullishCoalesce(_chunkMGI2VVF6cjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
2584
2558
  }
2585
2559
  if (error instanceof Error) {
2586
- const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.message);
2560
+ const bridged = _chunkMGI2VVF6cjs.decodeBridgeRivetError.call(void 0, error.message);
2587
2561
  if (bridged) {
2588
2562
  return bridged;
2589
2563
  }
2590
2564
  }
2591
2565
  if (typeof error === "object" && error !== null && "reason" in error && typeof error.reason === "string") {
2592
- const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.reason);
2566
+ const bridged = _chunkMGI2VVF6cjs.decodeBridgeRivetError.call(void 0, error.reason);
2593
2567
  if (bridged) {
2594
2568
  return bridged;
2595
2569
  }
@@ -2611,7 +2585,7 @@ function callWasmSync(invoke) {
2611
2585
  }
2612
2586
  }
2613
2587
  function unsupportedWasmMethod(method2) {
2614
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
2588
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
2615
2589
  "runtime",
2616
2590
  "unsupported",
2617
2591
  `Unsupported wasm runtime method: ${method2}`,
@@ -3069,7 +3043,7 @@ var WasmCoreRuntime = (_class2 = class {
3069
3043
  await callWasm(() => database.close());
3070
3044
  }
3071
3045
  async actorRuntimeSocketProvision(_ctx) {
3072
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
3046
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
3073
3047
  "actor_runtime_socket",
3074
3048
  "unsupported",
3075
3049
  "Actor Runtime Socket is only available on Unix native runtimes.",
@@ -3417,7 +3391,7 @@ function trySetProcessEnv(key, value) {
3417
3391
  if (typeof process === "undefined") return;
3418
3392
  try {
3419
3393
  process.env[key] = value;
3420
- } catch (e3) {
3394
+ } catch (e2) {
3421
3395
  }
3422
3396
  }
3423
3397
  function detectRuntimeHost() {
@@ -3438,7 +3412,7 @@ function loadedRuntimeKind(runtime) {
3438
3412
  case "wasm":
3439
3413
  return "wasm";
3440
3414
  }
3441
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
3415
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
3442
3416
  "config",
3443
3417
  "unknown_runtime",
3444
3418
  "RivetKit runtime must be NAPI or wasm.",
@@ -3459,16 +3433,16 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
3459
3433
  nativeError = error;
3460
3434
  logger2().warn({
3461
3435
  msg: "native runtime failed to load; falling back to wasm",
3462
- error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
3436
+ error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
3463
3437
  });
3464
3438
  }
3465
3439
  try {
3466
3440
  return (await loaders.loadWasm(config.wasm)).runtime;
3467
3441
  } catch (wasmError) {
3468
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
3442
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
3469
3443
  "config",
3470
3444
  "runtime_unavailable",
3471
- `RivetKit could not load a core runtime. Native runtime: ${_chunk2CE5UNWKcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunk2CE5UNWKcjs.stringifyError.call(void 0, wasmError)}`,
3445
+ `RivetKit could not load a core runtime. Native runtime: ${_chunkBDKVTNJFcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkBDKVTNJFcjs.stringifyError.call(void 0, wasmError)}`,
3472
3446
  {
3473
3447
  public: true,
3474
3448
  statusCode: 500
@@ -3496,7 +3470,7 @@ function normalizeRuntimeConfigForKind(config, runtimeKind) {
3496
3470
  return config;
3497
3471
  }
3498
3472
  if (sqliteBackendForConfig(config) === "local") {
3499
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
3473
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
3500
3474
  "config",
3501
3475
  "wasm_local_sqlite",
3502
3476
  "WebAssembly runtime cannot use local SQLite. Use remote SQLite instead.",
@@ -3562,14 +3536,14 @@ function getNativeConnPersistState(runtime, ctx, conn) {
3562
3536
  return connState;
3563
3537
  }
3564
3538
  function stateMutationReentrantError() {
3565
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3539
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3566
3540
  "actor",
3567
3541
  "state_mutation_reentrant",
3568
3542
  "State mutations are not allowed inside onStateChange."
3569
3543
  );
3570
3544
  }
3571
3545
  function stateTransactionConflictError() {
3572
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3546
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3573
3547
  "actor",
3574
3548
  "state_transaction_conflict",
3575
3549
  "State cannot be mutated by another action while an experimental state-aware database transaction is active.",
@@ -3577,7 +3551,7 @@ function stateTransactionConflictError() {
3577
3551
  );
3578
3552
  }
3579
3553
  function databaseNotConfiguredError() {
3580
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3554
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3581
3555
  "actor",
3582
3556
  "database_not_configured",
3583
3557
  "database is not configured for this actor",
@@ -3585,7 +3559,7 @@ function databaseNotConfiguredError() {
3585
3559
  );
3586
3560
  }
3587
3561
  function databaseClientNotReadyError() {
3588
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3562
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3589
3563
  "actor",
3590
3564
  "database_client_not_ready",
3591
3565
  "actor database client was not initialized before user code ran. this is an internal lifecycle error; the migration callback should have pre-warmed the client. file an issue if you can reproduce.",
@@ -3593,7 +3567,7 @@ function databaseClientNotReadyError() {
3593
3567
  );
3594
3568
  }
3595
3569
  function runHandlerNotConfiguredError() {
3596
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3570
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3597
3571
  "actor",
3598
3572
  "run_handler_unavailable",
3599
3573
  "Cannot schedule a run wake because this actor does not define a run handler.",
@@ -3601,7 +3575,7 @@ function runHandlerNotConfiguredError() {
3601
3575
  );
3602
3576
  }
3603
3577
  function stateNotEnabledError() {
3604
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3578
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3605
3579
  "actor",
3606
3580
  "state_not_enabled",
3607
3581
  "State not enabled. Must implement `createState` or `state` to use state. (https://www.rivet.dev/docs/actors/state/#initializing-state)",
@@ -3609,7 +3583,7 @@ function stateNotEnabledError() {
3609
3583
  );
3610
3584
  }
3611
3585
  function nativeClientNotConfiguredError() {
3612
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3586
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3613
3587
  "native",
3614
3588
  "client_not_configured",
3615
3589
  "native actor client is not configured",
@@ -3617,7 +3591,7 @@ function nativeClientNotConfiguredError() {
3617
3591
  );
3618
3592
  }
3619
3593
  function nativeEndpointNotConfiguredError() {
3620
- return new (0, _chunkJX2ITWAVcjs.RivetError)(
3594
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
3621
3595
  "native",
3622
3596
  "endpoint_not_configured",
3623
3597
  "registry endpoint is required for native envoy startup",
@@ -3662,7 +3636,7 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
3662
3636
  }).catch((error) => {
3663
3637
  logger2().warn({
3664
3638
  msg: "deferred native sleep cleanup failed",
3665
- error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
3639
+ error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
3666
3640
  });
3667
3641
  });
3668
3642
  return;
@@ -3825,10 +3799,10 @@ function decodeValue(value) {
3825
3799
  if (!value || value.length === 0) {
3826
3800
  return void 0;
3827
3801
  }
3828
- return _chunk2CE5UNWKcjs.decodeCborCompat.call(void 0, value);
3802
+ return _chunkBDKVTNJFcjs.decodeCborCompat.call(void 0, value);
3829
3803
  }
3830
3804
  function encodeValue(value) {
3831
- return _chunk2CE5UNWKcjs.encodeCborCompat.call(void 0, value);
3805
+ return _chunkBDKVTNJFcjs.encodeCborCompat.call(void 0, value);
3832
3806
  }
3833
3807
  function normalizeArgs(value) {
3834
3808
  return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
@@ -3841,16 +3815,16 @@ function unwrapTsfnPayload(error, payload) {
3841
3815
  }
3842
3816
  function normalizeNativeBridgeError(error) {
3843
3817
  if (typeof error === "string") {
3844
- return _nullishCoalesce(_chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
3818
+ return _nullishCoalesce(_chunkMGI2VVF6cjs.decodeBridgeRivetError.call(void 0, error), () => ( error));
3845
3819
  }
3846
3820
  if (error instanceof Error) {
3847
- const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.message);
3821
+ const bridged = _chunkMGI2VVF6cjs.decodeBridgeRivetError.call(void 0, error.message);
3848
3822
  if (bridged) {
3849
3823
  return bridged;
3850
3824
  }
3851
3825
  }
3852
3826
  if (typeof error === "object" && error !== null && "reason" in error && typeof error.reason === "string") {
3853
- const bridged = _chunkJX2ITWAVcjs.decodeBridgeRivetError.call(void 0, error.reason);
3827
+ const bridged = _chunkMGI2VVF6cjs.decodeBridgeRivetError.call(void 0, error.reason);
3854
3828
  if (bridged) {
3855
3829
  return bridged;
3856
3830
  }
@@ -3858,14 +3832,25 @@ function normalizeNativeBridgeError(error) {
3858
3832
  return error;
3859
3833
  }
3860
3834
  function isStructuredBridgeError(error) {
3861
- if (error instanceof _chunkJX2ITWAVcjs.RivetError) {
3835
+ if (error instanceof _chunkMGI2VVF6cjs.RivetError) {
3862
3836
  return true;
3863
3837
  }
3864
- return _chunkJX2ITWAVcjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
3838
+ return _chunkMGI2VVF6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
3865
3839
  }
3866
3840
  function encodeNativeCallbackError(error) {
3867
- const structuredError = isStructuredBridgeError(error) ? error : _chunk2CE5UNWKcjs.deconstructError.call(void 0, error, true);
3868
- const bridgeError = new Error(_chunkJX2ITWAVcjs.encodeBridgeRivetError.call(void 0, structuredError), {
3841
+ const structuredError = isStructuredBridgeError(error) ? error : _chunkBDKVTNJFcjs.deconstructError.call(void 0, error, true);
3842
+ const { encoded, droppedMetadataCause } = _chunkMGI2VVF6cjs.encodeBridgeRivetError.call(void 0, structuredError);
3843
+ if (droppedMetadataCause !== void 0) {
3844
+ logger2().warn(
3845
+ {
3846
+ group: structuredError.group,
3847
+ code: structuredError.code,
3848
+ error: String(droppedMetadataCause)
3849
+ },
3850
+ "dropped error metadata that JSON cannot encode"
3851
+ );
3852
+ }
3853
+ const bridgeError = new Error(encoded, {
3869
3854
  cause: error instanceof Error ? error : void 0
3870
3855
  });
3871
3856
  return Object.assign(bridgeError, {
@@ -3890,9 +3875,9 @@ function callNativeSync(invoke) {
3890
3875
  }
3891
3876
  }
3892
3877
  function isClosedTaskRegistrationError(error) {
3893
- const metadata = error instanceof _chunkJX2ITWAVcjs.RivetError ? error.metadata : void 0;
3878
+ const metadata = error instanceof _chunkMGI2VVF6cjs.RivetError ? error.metadata : void 0;
3894
3879
  const metadataError = metadata && typeof metadata === "object" && "error" in metadata ? metadata.error : void 0;
3895
- return error instanceof _chunkJX2ITWAVcjs.RivetError && error.group === "core" && error.code === _chunkJX2ITWAVcjs.INTERNAL_ERROR_CODE && typeof metadataError === "string" && /actor task registration is (closed|not configured)/.test(metadataError);
3880
+ return error instanceof _chunkMGI2VVF6cjs.RivetError && error.group === "core" && error.code === _chunkMGI2VVF6cjs.INTERNAL_ERROR_CODE && typeof metadataError === "string" && /actor task registration is (closed|not configured)/.test(metadataError);
3896
3881
  }
3897
3882
  async function createCancellationTokenHandle(runtime, signal) {
3898
3883
  if (!signal) {
@@ -3915,8 +3900,8 @@ function decodeWorkflowCbor(data) {
3915
3900
  return null;
3916
3901
  }
3917
3902
  try {
3918
- return _chunk2CE5UNWKcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
3919
- } catch (e4) {
3903
+ return _chunkBDKVTNJFcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
3904
+ } catch (e3) {
3920
3905
  return null;
3921
3906
  }
3922
3907
  }
@@ -4028,7 +4013,7 @@ function serializeWorkflowHistoryForJson(data) {
4028
4013
  if (data === null) {
4029
4014
  return null;
4030
4015
  }
4031
- const history = _chunk76YTS32Rcjs.decodeWorkflowHistoryTransport.call(void 0, data);
4016
+ const history = _chunkWLRGUAMWcjs.decodeWorkflowHistoryTransport.call(void 0, data);
4032
4017
  return jsonSafe({
4033
4018
  nameRegistry: [...history.nameRegistry],
4034
4019
  entries: history.entries.map((entry) => ({
@@ -4174,7 +4159,7 @@ var NativeConnAdapter = class {
4174
4159
  },
4175
4160
  (newValue) => {
4176
4161
  assertCurrentState();
4177
- _chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, newValue);
4162
+ _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, newValue);
4178
4163
  }
4179
4164
  );
4180
4165
  }
@@ -4182,7 +4167,7 @@ var NativeConnAdapter = class {
4182
4167
  var _a;
4183
4168
  (_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
4184
4169
  const nextValue = unwrapWriteThroughProxy(value);
4185
- _chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, nextValue);
4170
+ _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, nextValue);
4186
4171
  this.#writeState(nextValue, { writeNative: true });
4187
4172
  }
4188
4173
  initializeState(value) {
@@ -4565,7 +4550,7 @@ var NativeQueueAdapter = class {
4565
4550
  async nextBatch(options) {
4566
4551
  const completable = (options == null ? void 0 : options.completable) === true;
4567
4552
  if (this.#pendingCompletableMessageIds.size > 0) {
4568
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
4553
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
4569
4554
  "queue",
4570
4555
  "previous_message_not_completed",
4571
4556
  "Previous completable queue message is not completed. Call `message.complete(...)` before receiving the next message.",
@@ -4732,7 +4717,7 @@ var NativeQueueAdapter = class {
4732
4717
  }
4733
4718
  yield message;
4734
4719
  } catch (error) {
4735
- if (_chunkJX2ITWAVcjs.isActorAbortedError.call(void 0, error)) {
4720
+ if (_chunkMGI2VVF6cjs.isActorAbortedError.call(void 0, error)) {
4736
4721
  return;
4737
4722
  }
4738
4723
  throw error;
@@ -4753,7 +4738,7 @@ var NativeQueueAdapter = class {
4753
4738
  ...message,
4754
4739
  complete: async (response) => {
4755
4740
  if (typeof message.complete !== "function") {
4756
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
4741
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
4757
4742
  "queue",
4758
4743
  "complete_not_configured",
4759
4744
  `Queue '${message.name}' does not support completion responses.`,
@@ -4765,7 +4750,7 @@ var NativeQueueAdapter = class {
4765
4750
  );
4766
4751
  }
4767
4752
  if (completed) {
4768
- throw new (0, _chunkJX2ITWAVcjs.RivetError)(
4753
+ throw new (0, _chunkMGI2VVF6cjs.RivetError)(
4769
4754
  "queue",
4770
4755
  "already_completed",
4771
4756
  "Queue message was already completed.",
@@ -5202,7 +5187,10 @@ var ActorContextHandleAdapter = class {
5202
5187
  }
5203
5188
  this.#request = request;
5204
5189
  this[_chunkNWCAIWHLcjs.ACTOR_CONTEXT_INTERNAL_SYMBOL] = new NativeWorkflowRuntimeAdapter(
5205
- this
5190
+ this,
5191
+ () => this.#logByInvocationScope.delete(
5192
+ _nullishCoalesce(this.#runtime.currentInvocationScope(), () => ( NO_INVOCATION_SCOPE))
5193
+ )
5206
5194
  );
5207
5195
  }
5208
5196
  get kv() {
@@ -5258,7 +5246,7 @@ var ActorContextHandleAdapter = class {
5258
5246
  },
5259
5247
  (newValue) => {
5260
5248
  assertCurrentState();
5261
- _chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, newValue);
5249
+ _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, newValue);
5262
5250
  }
5263
5251
  );
5264
5252
  }
@@ -5270,7 +5258,7 @@ var ActorContextHandleAdapter = class {
5270
5258
  }
5271
5259
  this.#assertCanMutateState();
5272
5260
  const nextValue = unwrapWriteThroughProxy(value);
5273
- _chunk2CE5UNWKcjs.assertJsonCompatValue.call(void 0, nextValue);
5261
+ _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, nextValue);
5274
5262
  this.#writeState(nextValue, { scheduleSave: true });
5275
5263
  }
5276
5264
  initializeState(value) {
@@ -5374,7 +5362,10 @@ var ActorContextHandleAdapter = class {
5374
5362
  () => this.#runtime.actorInvocationTraceContext(this.#ctx)
5375
5363
  );
5376
5364
  }
5377
- /** Cached per invocation, because the `run` context outlives workflow runs and steps. */
5365
+ /**
5366
+ * Cached per invocation, because the `run` context outlives workflow runs and steps.
5367
+ * A workflow queue receive clears the entry, because the run's ray becomes the message's ray.
5368
+ */
5378
5369
  get log() {
5379
5370
  const scope = _nullishCoalesce(this.#runtime.currentInvocationScope(), () => ( NO_INVOCATION_SCOPE));
5380
5371
  const cached = this.#logByInvocationScope.get(scope);
@@ -5479,7 +5470,7 @@ var ActorContextHandleAdapter = class {
5479
5470
  log: {
5480
5471
  debug: (obj) => logger2().debug(obj)
5481
5472
  },
5482
- nativeDatabaseProvider: _chunkCVLNRT7Ocjs.registerNativeStateTransactionOpener.call(void 0,
5473
+ nativeDatabaseProvider: _chunkLUMROGNMcjs.registerNativeStateTransactionOpener.call(void 0,
5483
5474
  {
5484
5475
  open: async (requestedActorId) => {
5485
5476
  void requestedActorId;
@@ -5502,7 +5493,7 @@ var ActorContextHandleAdapter = class {
5502
5493
  return this.#db;
5503
5494
  }
5504
5495
  #bindDatabaseClient(client) {
5505
- return _chunkCVLNRT7Ocjs.bindNativeStateTransactionContext.call(void 0, client, {
5496
+ return _chunkLUMROGNMcjs.bindNativeStateTransactionContext.call(void 0, client, {
5506
5497
  enter: async () => await this.#enterStateTransaction(),
5507
5498
  exit: (scope) => this.#exitStateTransaction(
5508
5499
  scope
@@ -5706,7 +5697,7 @@ var ActorContextHandleAdapter = class {
5706
5697
  const trackedPromise = Promise.resolve(promise).catch((error) => {
5707
5698
  logger2().warn({
5708
5699
  msg: "keepAwake promise rejected",
5709
- error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
5700
+ error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
5710
5701
  });
5711
5702
  }).then(() => null);
5712
5703
  try {
@@ -5921,13 +5912,15 @@ var ActorContextHandleAdapter = class {
5921
5912
  };
5922
5913
  var NativeWorkflowRuntimeAdapter = class {
5923
5914
  #ctx;
5915
+ #onMessagesReceived;
5924
5916
  #completions = /* @__PURE__ */ new Map();
5925
5917
 
5926
5918
 
5927
5919
 
5928
5920
 
5929
- constructor(ctx) {
5921
+ constructor(ctx, onMessagesReceived) {
5930
5922
  this.#ctx = ctx;
5923
+ this.#onMessagesReceived = onMessagesReceived;
5931
5924
  this.id = ctx.actorId;
5932
5925
  this.driver = {
5933
5926
  kvBatchGet: async (actorId, keys) => {
@@ -5967,6 +5960,9 @@ var NativeWorkflowRuntimeAdapter = class {
5967
5960
  timeout: _nullishCoalesce(timeout, () => ( 0)),
5968
5961
  completable
5969
5962
  });
5963
+ if (messages.length > 0) {
5964
+ this.#onMessagesReceived();
5965
+ }
5970
5966
  return messages.map(
5971
5967
  (message) => this.#wrapQueueMessage(message)
5972
5968
  );
@@ -6179,7 +6175,7 @@ function validateInspectorTabSource(tabId, resolved) {
6179
6175
  function buildNativeFactory(runtime, registryConfig, definition) {
6180
6176
  var _a;
6181
6177
  const config = definition.config;
6182
- const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkCVLNRT7Ocjs.db.call(void 0, )));
6178
+ const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkLUMROGNMcjs.db.call(void 0, )));
6183
6179
  const actionHandlers = _chunkNWCAIWHLcjs.flattenActionHandlers.call(void 0, config.actions);
6184
6180
  const schemaConfig = {
6185
6181
  actionInputSchemas: _chunkNWCAIWHLcjs.flattenActionInputSchemas.call(void 0,
@@ -6190,9 +6186,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6190
6186
  events: config.events,
6191
6187
  queues: config.queues
6192
6188
  };
6193
- const createClient = (ctx) => _chunkA36FMKOVcjs.createClientWithDriver.call(void 0,
6194
- new (0, _chunkA36FMKOVcjs.RemoteEngineControlClient)(
6195
- _chunkA36FMKOVcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
6189
+ const createClient = (ctx) => _chunkHEY27WZXcjs.createClientWithDriver.call(void 0,
6190
+ new (0, _chunkHEY27WZXcjs.RemoteEngineControlClient)(
6191
+ _chunkHEY27WZXcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
6196
6192
  ),
6197
6193
  {
6198
6194
  encoding: "bare",
@@ -6263,7 +6259,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6263
6259
  }
6264
6260
  });
6265
6261
  const errorResponse = (error, status) => {
6266
- const rivetError = _chunkJX2ITWAVcjs.toRivetError.call(void 0, error);
6262
+ const rivetError = _chunkMGI2VVF6cjs.toRivetError.call(void 0, error);
6267
6263
  return jsonResponse(
6268
6264
  {
6269
6265
  group: rivetError.group,
@@ -6361,9 +6357,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6361
6357
  let body;
6362
6358
  try {
6363
6359
  body = await jsRequest.json();
6364
- } catch (e5) {
6360
+ } catch (e4) {
6365
6361
  return errorResponse(
6366
- new (0, _chunkJX2ITWAVcjs.RivetError)(
6362
+ new (0, _chunkMGI2VVF6cjs.RivetError)(
6367
6363
  "actor",
6368
6364
  "invalid_request",
6369
6365
  "Invalid inspector JSON body",
@@ -6375,7 +6371,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6375
6371
  const name = _nullishCoalesce(body.name, () => ( ""));
6376
6372
  if (name === "") {
6377
6373
  return errorResponse(
6378
- new (0, _chunkJX2ITWAVcjs.RivetError)(
6374
+ new (0, _chunkMGI2VVF6cjs.RivetError)(
6379
6375
  "actor",
6380
6376
  "invalid_request",
6381
6377
  "Queue message name must not be empty",
@@ -6384,7 +6380,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6384
6380
  400
6385
6381
  );
6386
6382
  }
6387
- const cbor = _chunk2CE5UNWKcjs.encodeCborCompat.call(void 0,
6383
+ const cbor = _chunkBDKVTNJFcjs.encodeCborCompat.call(void 0,
6388
6384
  _nullishCoalesce(body.body, () => ( null))
6389
6385
  );
6390
6386
  const message = await runtime.actorQueueSend(ctx, name, cbor);
@@ -6549,7 +6545,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6549
6545
  const action = actionHandlers[actionName];
6550
6546
  if (!action) {
6551
6547
  return errorResponse(
6552
- new (0, _chunkJX2ITWAVcjs.RivetError)(
6548
+ new (0, _chunkMGI2VVF6cjs.RivetError)(
6553
6549
  "action",
6554
6550
  "action_not_found",
6555
6551
  `Action ${actionName} not found`
@@ -6922,7 +6918,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6922
6918
  );
6923
6919
  }
6924
6920
  if (!result) {
6925
- throw _chunkJX2ITWAVcjs.forbiddenError.call(void 0, );
6921
+ throw _chunkMGI2VVF6cjs.forbiddenError.call(void 0, );
6926
6922
  }
6927
6923
  } finally {
6928
6924
  await actorCtx.dispose();
@@ -6981,7 +6977,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6981
6977
  ...request,
6982
6978
  abortController: requestAbortController
6983
6979
  });
6984
- const rawConnParams = handlerRequest.headers.get(_chunkA36FMKOVcjs.HEADER_CONN_PARAMS);
6980
+ const rawConnParams = handlerRequest.headers.get(_chunkHEY27WZXcjs.HEADER_CONN_PARAMS);
6985
6981
  let requestCtx;
6986
6982
  let conn;
6987
6983
  let removeRequestAbortListener;
@@ -7038,7 +7034,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7038
7034
  requestCtx,
7039
7035
  handlerRequest
7040
7036
  );
7041
- if (!_chunkA36FMKOVcjs.isResponseLike.call(void 0, response)) {
7037
+ if (!_chunkHEY27WZXcjs.isResponseLike.call(void 0, response)) {
7042
7038
  throw new Error(
7043
7039
  "onRequest handler must return a Response"
7044
7040
  );
@@ -7133,7 +7129,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7133
7129
  var _a2;
7134
7130
  const { ctx } = unwrapTsfnPayload(error, payload);
7135
7131
  const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
7136
- return history == null ? void 0 : _chunk2CE5UNWKcjs.toUint8Array.call(void 0, history);
7132
+ return history == null ? void 0 : _chunkBDKVTNJFcjs.toUint8Array.call(void 0, history);
7137
7133
  }
7138
7134
  ) : void 0,
7139
7135
  replayWorkflow: _chunkNWCAIWHLcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
@@ -7147,7 +7143,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7147
7143
  return void 0;
7148
7144
  }
7149
7145
  const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
7150
- return history == null ? void 0 : _chunk2CE5UNWKcjs.toUint8Array.call(void 0, history);
7146
+ return history == null ? void 0 : _chunkBDKVTNJFcjs.toUint8Array.call(void 0, history);
7151
7147
  }
7152
7148
  ) : void 0,
7153
7149
  actions: Object.fromEntries(
@@ -7220,7 +7216,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7220
7216
  name
7221
7217
  );
7222
7218
  if (canPublish && !await canPublish(actorCtx)) {
7223
- throw _chunkJX2ITWAVcjs.forbiddenError.call(void 0, );
7219
+ throw _chunkMGI2VVF6cjs.forbiddenError.call(void 0, );
7224
7220
  }
7225
7221
  const decodedBody = decodeValue(body);
7226
7222
  if (wait) {
@@ -7283,7 +7279,7 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
7283
7279
  startServices: resolveServicesBinary && config.startServices,
7284
7280
  handleInspectorHttpInRuntime: true,
7285
7281
  serverlessBasePath: config.serverless.basePath,
7286
- serverlessPackageVersion: _chunk2CE5UNWKcjs.VERSION,
7282
+ serverlessPackageVersion: _chunkBDKVTNJFcjs.VERSION,
7287
7283
  serverlessClientEndpoint: config.publicEndpoint,
7288
7284
  serverlessClientNamespace: config.publicNamespace,
7289
7285
  serverlessClientToken: config.publicToken,
@@ -7296,7 +7292,7 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
7296
7292
  } catch (error) {
7297
7293
  logger2().warn({
7298
7294
  msg: "could not resolve a local engine binary; if a local engine must be spawned it will fail with engine.binary_unavailable \u2014 set RIVET_ENGINE_BINARY_PATH or install the @rivetkit/engine-cli platform package",
7299
- error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
7295
+ error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
7300
7296
  });
7301
7297
  }
7302
7298
  if (resolveServicesBinary && config.startServices) {
@@ -7306,20 +7302,20 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
7306
7302
  } catch (error) {
7307
7303
  logger2().warn({
7308
7304
  msg: "could not resolve the Services binary; a local engine will fail with services.binary_unavailable \u2014 set RIVET_RUN_SERVICES=0 to disable Services or RIVET_SERVICES_BINARY to a local rivet-services binary",
7309
- error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
7305
+ error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
7310
7306
  });
7311
7307
  }
7312
7308
  }
7313
7309
  serveConfig.engineHost = config.engineHost;
7314
7310
  serveConfig.enginePort = config.enginePort;
7315
7311
  if ((_a = config.test) == null ? void 0 : _a.enabled) {
7316
- serveConfig.inspectorTestToken = _nullishCoalesce(_chunk2CE5UNWKcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
7312
+ serveConfig.inspectorTestToken = _nullishCoalesce(_chunkBDKVTNJFcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
7317
7313
  }
7318
7314
  return serveConfig;
7319
7315
  }
7320
7316
  async function buildRegistryWithRuntime(config, runtime) {
7321
7317
  var _a;
7322
- if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunk2CE5UNWKcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
7318
+ if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkBDKVTNJFcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
7323
7319
  trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
7324
7320
  }
7325
7321
  if (runtime.kind === "napi") {
@@ -7386,7 +7382,7 @@ function createApplicationFetch(application, runtime) {
7386
7382
  signal: abortController.signal
7387
7383
  })
7388
7384
  );
7389
- if (!_chunkA36FMKOVcjs.isResponseLike.call(void 0, response)) {
7385
+ if (!_chunkHEY27WZXcjs.isResponseLike.call(void 0, response)) {
7390
7386
  throw new TypeError(
7391
7387
  "registry.listen() application fetch must return a Response"
7392
7388
  );
@@ -7436,7 +7432,7 @@ var Registry = class {
7436
7432
  var _a;
7437
7433
  this.#config = config;
7438
7434
  if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
7439
- _chunk2CE5UNWKcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
7435
+ _chunkBDKVTNJFcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
7440
7436
  }
7441
7437
  this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
7442
7438
  this.routes = {
@@ -7662,10 +7658,10 @@ var Registry = class {
7662
7658
  * ```
7663
7659
  */
7664
7660
  async listen(opts = {}) {
7665
- const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunk2CE5UNWKcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
7666
- const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunk2CE5UNWKcjs.getRivetkitPublicDir.call(void 0, )));
7661
+ const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkBDKVTNJFcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
7662
+ const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkBDKVTNJFcjs.getRivetkitPublicDir.call(void 0, )));
7667
7663
  const config = this.parseConfig();
7668
- if (opts.application && _chunk2CE5UNWKcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
7664
+ if (opts.application && _chunkBDKVTNJFcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
7669
7665
  if (config.runtime === "wasm") {
7670
7666
  throw new Error(
7671
7667
  "registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
@@ -7741,7 +7737,7 @@ var Registry = class {
7741
7737
  return jsonRouteResponse(503, {
7742
7738
  status: "not_started",
7743
7739
  runtime: "rivetkit",
7744
- version: _chunk2CE5UNWKcjs.VERSION
7740
+ version: _chunkBDKVTNJFcjs.VERSION
7745
7741
  });
7746
7742
  }
7747
7743
  const { runtime, registry } = configured;
@@ -7749,7 +7745,7 @@ var Registry = class {
7749
7745
  return jsonRouteResponse(501, {
7750
7746
  status: "unsupported",
7751
7747
  runtime: "rivetkit",
7752
- version: _chunk2CE5UNWKcjs.VERSION
7748
+ version: _chunkBDKVTNJFcjs.VERSION
7753
7749
  });
7754
7750
  }
7755
7751
  const response = await runtime.registryHealth(registry);
@@ -7820,7 +7816,23 @@ var Registry = class {
7820
7816
  * Starts an actor envoy for standalone server deployments.
7821
7817
  */
7822
7818
  #startEnvoy(config, printWelcome) {
7819
+ var _a;
7823
7820
  if (!this.#runtimeServePromise) {
7821
+ const configuredEnvoyVersion = (_a = this.#config.envoy) == null ? void 0 : _a.version;
7822
+ const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunkBDKVTNJFcjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
7823
+ logger2().info({
7824
+ msg: "starting rivetkit envoy",
7825
+ rivetkitVersion: _chunkBDKVTNJFcjs.VERSION,
7826
+ envoyVersion: config.envoy.version,
7827
+ envoyVersionSource
7828
+ });
7829
+ if (envoyVersionSource === "default" && _chunkBDKVTNJFcjs.getNodeEnv.call(void 0, ) === "production") {
7830
+ logger2().error({
7831
+ msg: "envoy version defaulted because neither config.envoy.version nor RIVET_ENVOY_VERSION is set; actors will not drain automatically across deploys. See https://rivet.dev/docs/actors/versions",
7832
+ envoyVersion: config.envoy.version,
7833
+ envoyVersionSource
7834
+ });
7835
+ }
7824
7836
  const configuredRegistryPromise = this.#buildConfiguredRegistry(config);
7825
7837
  this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
7826
7838
  this.#runtimeServeLifecyclePromise = configuredRegistryPromise.then(
@@ -8005,7 +8017,7 @@ var Registry = class {
8005
8017
  );
8006
8018
  }
8007
8019
  if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
8008
- if (_chunk2CE5UNWKcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8020
+ if (_chunkBDKVTNJFcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8009
8021
  return Promise.reject(
8010
8022
  new Error(
8011
8023
  "registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
@@ -8075,8 +8087,8 @@ var Registry = class {
8075
8087
  * ```
8076
8088
  */
8077
8089
  start() {
8078
- if (_chunk2CE5UNWKcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8079
- const publicDir = _nullishCoalesce(_chunk2CE5UNWKcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
8090
+ if (_chunkBDKVTNJFcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8091
+ const publicDir = _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
8080
8092
  this.listen({ publicDir }).catch((error) => {
8081
8093
  logger2().error({ error }, "auto-listen failed; exiting");
8082
8094
  if (typeof process !== "undefined" && typeof process.exit === "function") {
@@ -8097,13 +8109,13 @@ var Registry = class {
8097
8109
  };
8098
8110
  console.log();
8099
8111
  console.log(
8100
- ` RivetKit ${_chunk2CE5UNWKcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
8112
+ ` RivetKit ${_chunkBDKVTNJFcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
8101
8113
  );
8102
8114
  if (config.namespace !== "default") {
8103
8115
  logLine("Namespace", config.namespace);
8104
8116
  }
8105
8117
  if (config.endpoint) {
8106
- const endpointType = config.startEngine || isLocalEngineEndpoint(config.endpoint) ? "local native" : "remote";
8118
+ const endpointType = config.startEngine || _chunkHEY27WZXcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
8107
8119
  logLine("Endpoint", `${config.endpoint} (${endpointType})`);
8108
8120
  }
8109
8121
  if (kind === "serverless" && config.publicEndpoint) {
@@ -8173,5 +8185,5 @@ function setup(input) {
8173
8185
 
8174
8186
 
8175
8187
 
8176
- exports.ALLOWED_PUBLIC_HEADERS = _chunkA36FMKOVcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorDefinition = ActorDefinition; exports.ActorError = _chunkJX2ITWAVcjs.RivetError; exports.ActorsSchema = ActorsSchema; exports.DocConfigurePoolSchema = DocConfigurePoolSchema; exports.DocEnvoyConfigSchema = DocEnvoyConfigSchema; exports.DocRegistryConfigSchema = DocRegistryConfigSchema; exports.DocServerlessConfigSchema = DocServerlessConfigSchema; exports.DocSqliteConfigSchema = DocSqliteConfigSchema; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.Registry = Registry; exports.RegistryConfigSchema = RegistryConfigSchema; exports.RivetError = _chunkJX2ITWAVcjs.RivetError; exports.RuntimeKindSchema = RuntimeKindSchema; exports.SqliteBackendSchema = SqliteBackendSchema; exports.SqliteConfigSchema = SqliteConfigSchema; exports.TestConfigSchema = TestConfigSchema; exports.UserError = _chunkJX2ITWAVcjs.UserError; exports.WasmRuntimeConfigSchema = WasmRuntimeConfigSchema; exports.actor = actor; exports.buildActorNames = buildActorNames; exports.createClientWithDriver = _chunkA36FMKOVcjs.createClientWithDriver; exports.defineRunHandler = _chunkNWCAIWHLcjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunk2CE5UNWKcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunk2CE5UNWKcjs.toUint8Array;
8188
+ exports.ALLOWED_PUBLIC_HEADERS = _chunkHEY27WZXcjs.ALLOWED_PUBLIC_HEADERS; exports.ActorDefinition = ActorDefinition; exports.ActorError = _chunkMGI2VVF6cjs.RivetError; exports.ActorsSchema = ActorsSchema; exports.DocConfigurePoolSchema = DocConfigurePoolSchema; exports.DocEnvoyConfigSchema = DocEnvoyConfigSchema; exports.DocRegistryConfigSchema = DocRegistryConfigSchema; exports.DocServerlessConfigSchema = DocServerlessConfigSchema; exports.DocSqliteConfigSchema = DocSqliteConfigSchema; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.Registry = Registry; exports.RegistryConfigSchema = RegistryConfigSchema; exports.RivetError = _chunkMGI2VVF6cjs.RivetError; exports.RuntimeKindSchema = RuntimeKindSchema; exports.SqliteBackendSchema = SqliteBackendSchema; exports.SqliteConfigSchema = SqliteConfigSchema; exports.TestConfigSchema = TestConfigSchema; exports.UserError = _chunkMGI2VVF6cjs.UserError; exports.WasmRuntimeConfigSchema = WasmRuntimeConfigSchema; exports.actor = actor; exports.buildActorNames = buildActorNames; exports.createClientWithDriver = _chunkHEY27WZXcjs.createClientWithDriver; exports.defineRunHandler = _chunkNWCAIWHLcjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkBDKVTNJFcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkBDKVTNJFcjs.toUint8Array;
8177
8189
  //# sourceMappingURL=mod.cjs.map