rivetkit 2.3.22 → 2.3.24-rc.1

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 (109) hide show
  1. package/dist/browser/client.d.ts +2 -0
  2. package/dist/browser/client.js +1 -1
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +1 -1
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/agent-os/index.cjs +1 -1
  7. package/dist/tsup/agent-os/index.cjs.map +1 -1
  8. package/dist/tsup/agent-os/index.d.cts +2 -0
  9. package/dist/tsup/agent-os/index.d.ts +2 -0
  10. package/dist/tsup/agent-os/index.js +1 -1
  11. package/dist/tsup/agent-os/index.js.map +1 -1
  12. package/dist/tsup/{chunk-4DTWJFIZ.js → chunk-64CRWLOX.js} +3 -3
  13. package/dist/tsup/{chunk-GINS4O73.js → chunk-6HW3TU7Q.js} +2 -2
  14. package/dist/tsup/{chunk-VD47X7KQ.js → chunk-B6WTPGOR.js} +3 -3
  15. package/dist/tsup/{chunk-LUMROGNM.cjs → chunk-CE6NBGOL.cjs} +3 -3
  16. package/dist/tsup/{chunk-LUMROGNM.cjs.map → chunk-CE6NBGOL.cjs.map} +1 -1
  17. package/dist/tsup/{chunk-QOQA4JPN.cjs → chunk-DAC73W53.cjs} +7 -7
  18. package/dist/tsup/{chunk-QOQA4JPN.cjs.map → chunk-DAC73W53.cjs.map} +1 -1
  19. package/dist/tsup/{chunk-WLRGUAMW.cjs → chunk-ERBNWARB.cjs} +4 -4
  20. package/dist/tsup/{chunk-WLRGUAMW.cjs.map → chunk-ERBNWARB.cjs.map} +1 -1
  21. package/dist/tsup/{chunk-DE2IFYJK.js → chunk-JJCUSUWO.js} +2 -2
  22. package/dist/tsup/chunk-JJCUSUWO.js.map +1 -0
  23. package/dist/tsup/{chunk-QXBNHJH5.js → chunk-JKDAOE4T.js} +4 -4
  24. package/dist/tsup/{chunk-GZZNJGXY.cjs → chunk-JMO6AVUC.cjs} +3 -3
  25. package/dist/tsup/{chunk-GZZNJGXY.cjs.map → chunk-JMO6AVUC.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-CSOHAAZK.js → chunk-LTGBHN5Z.js} +1 -1
  27. package/dist/tsup/chunk-LTGBHN5Z.js.map +1 -0
  28. package/dist/tsup/{chunk-XZBDVEQN.js → chunk-M5J3PXNU.js} +2 -2
  29. package/dist/tsup/{chunk-NWCAIWHL.cjs → chunk-NGJWQMUU.cjs} +1 -1
  30. package/dist/tsup/chunk-NGJWQMUU.cjs.map +1 -0
  31. package/dist/tsup/{chunk-47FSGXYN.js → chunk-OB5JLDBM.js} +2 -2
  32. package/dist/tsup/{chunk-KEAUN5F5.cjs → chunk-PFHGTLF2.cjs} +10 -10
  33. package/dist/tsup/{chunk-KEAUN5F5.cjs.map → chunk-PFHGTLF2.cjs.map} +1 -1
  34. package/dist/tsup/{chunk-RIPVNPR6.js → chunk-QQ454DVR.js} +2 -2
  35. package/dist/tsup/{chunk-HEY27WZX.cjs → chunk-R3UI7MO3.cjs} +140 -140
  36. package/dist/tsup/{chunk-HEY27WZX.cjs.map → chunk-R3UI7MO3.cjs.map} +1 -1
  37. package/dist/tsup/{chunk-WMNXGH25.cjs → chunk-SWQCSORE.cjs} +3 -3
  38. package/dist/tsup/{chunk-WMNXGH25.cjs.map → chunk-SWQCSORE.cjs.map} +1 -1
  39. package/dist/tsup/{chunk-BDKVTNJF.cjs → chunk-YVVFOKEP.cjs} +2 -2
  40. package/dist/tsup/chunk-YVVFOKEP.cjs.map +1 -0
  41. package/dist/tsup/client/mod.cjs +5 -5
  42. package/dist/tsup/client/mod.d.cts +2 -2
  43. package/dist/tsup/client/mod.d.ts +2 -2
  44. package/dist/tsup/client/mod.js +4 -4
  45. package/dist/tsup/common/log.cjs +2 -2
  46. package/dist/tsup/common/log.js +1 -1
  47. package/dist/tsup/common/websocket.cjs +3 -3
  48. package/dist/tsup/common/websocket.js +2 -2
  49. package/dist/tsup/{config-osdJqQwX.d.cts → config-CuKzfH58.d.cts} +4 -0
  50. package/dist/tsup/{config-Cv6pjCt-.d.ts → config-RV6gIa2L.d.ts} +4 -0
  51. package/dist/tsup/{context-DpjrM7n7.d.cts → context-DPCxyjax.d.cts} +1 -1
  52. package/dist/tsup/{context-CoVbKBuk.d.ts → context-DoMKZBQA.d.ts} +1 -1
  53. package/dist/tsup/db/drizzle.cjs +2 -2
  54. package/dist/tsup/db/drizzle.js +1 -1
  55. package/dist/tsup/db/mod.cjs +3 -3
  56. package/dist/tsup/db/mod.js +2 -2
  57. package/dist/tsup/dynamic/mod.cjs +2 -2
  58. package/dist/tsup/dynamic/mod.d.cts +1 -1
  59. package/dist/tsup/dynamic/mod.d.ts +1 -1
  60. package/dist/tsup/dynamic/mod.js +1 -1
  61. package/dist/tsup/inspector/mod.cjs +5 -5
  62. package/dist/tsup/inspector/mod.js +4 -4
  63. package/dist/tsup/inspector/workflow.cjs +4 -4
  64. package/dist/tsup/inspector/workflow.js +3 -3
  65. package/dist/tsup/inspector-tab/mod.cjs +2 -2
  66. package/dist/tsup/inspector-tab/mod.d.cts +2 -2
  67. package/dist/tsup/inspector-tab/mod.d.ts +2 -2
  68. package/dist/tsup/inspector-tab/mod.js +1 -1
  69. package/dist/tsup/mod.cjs +416 -188
  70. package/dist/tsup/mod.cjs.map +1 -1
  71. package/dist/tsup/mod.d.cts +3 -3
  72. package/dist/tsup/mod.d.ts +3 -3
  73. package/dist/tsup/mod.js +318 -90
  74. package/dist/tsup/mod.js.map +1 -1
  75. package/dist/tsup/test/mod.cjs +6 -6
  76. package/dist/tsup/test/mod.d.cts +1 -1
  77. package/dist/tsup/test/mod.d.ts +1 -1
  78. package/dist/tsup/test/mod.js +4 -4
  79. package/dist/tsup/utils.cjs +2 -2
  80. package/dist/tsup/utils.js +1 -1
  81. package/dist/tsup/workflow/mod.cjs +69 -21
  82. package/dist/tsup/workflow/mod.cjs.map +1 -1
  83. package/dist/tsup/workflow/mod.d.cts +3 -3
  84. package/dist/tsup/workflow/mod.d.ts +3 -3
  85. package/dist/tsup/workflow/mod.js +64 -16
  86. package/dist/tsup/workflow/mod.js.map +1 -1
  87. package/package.json +9 -9
  88. package/src/actor/config.ts +2 -0
  89. package/src/registry/lost-callbacks.test.ts +64 -0
  90. package/src/registry/napi-runtime.ts +8 -0
  91. package/src/registry/native.ts +332 -65
  92. package/src/registry/run-handler-coordinator.test.ts +102 -0
  93. package/src/registry/run-handler-coordinator.ts +84 -17
  94. package/src/registry/runtime.ts +2 -0
  95. package/src/registry/wasm-runtime.ts +8 -0
  96. package/src/workflow/context.ts +20 -0
  97. package/src/workflow/driver.ts +25 -1
  98. package/src/workflow/mod.ts +46 -12
  99. package/dist/tsup/chunk-BDKVTNJF.cjs.map +0 -1
  100. package/dist/tsup/chunk-CSOHAAZK.js.map +0 -1
  101. package/dist/tsup/chunk-DE2IFYJK.js.map +0 -1
  102. package/dist/tsup/chunk-NWCAIWHL.cjs.map +0 -1
  103. /package/dist/tsup/{chunk-4DTWJFIZ.js.map → chunk-64CRWLOX.js.map} +0 -0
  104. /package/dist/tsup/{chunk-GINS4O73.js.map → chunk-6HW3TU7Q.js.map} +0 -0
  105. /package/dist/tsup/{chunk-VD47X7KQ.js.map → chunk-B6WTPGOR.js.map} +0 -0
  106. /package/dist/tsup/{chunk-QXBNHJH5.js.map → chunk-JKDAOE4T.js.map} +0 -0
  107. /package/dist/tsup/{chunk-XZBDVEQN.js.map → chunk-M5J3PXNU.js.map} +0 -0
  108. /package/dist/tsup/{chunk-47FSGXYN.js.map → chunk-OB5JLDBM.js.map} +0 -0
  109. /package/dist/tsup/{chunk-RIPVNPR6.js.map → chunk-QQ454DVR.js.map} +0 -0
package/dist/tsup/mod.cjs CHANGED
@@ -1,6 +1,6 @@
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');
3
+ var _chunkERBNWARBcjs = require('./chunk-ERBNWARB.cjs');
4
4
 
5
5
 
6
6
 
@@ -17,7 +17,7 @@ var _chunkWLRGUAMWcjs = require('./chunk-WLRGUAMW.cjs');
17
17
 
18
18
 
19
19
 
20
- var _chunkNWCAIWHLcjs = require('./chunk-NWCAIWHL.cjs');
20
+ var _chunkNGJWQMUUcjs = require('./chunk-NGJWQMUU.cjs');
21
21
 
22
22
 
23
23
 
@@ -35,7 +35,7 @@ var _chunkNWCAIWHLcjs = require('./chunk-NWCAIWHL.cjs');
35
35
 
36
36
 
37
37
 
38
- var _chunkHEY27WZXcjs = require('./chunk-HEY27WZX.cjs');
38
+ var _chunkR3UI7MO3cjs = require('./chunk-R3UI7MO3.cjs');
39
39
 
40
40
 
41
41
 
@@ -44,9 +44,9 @@ var _chunkMYWZCDMLcjs = require('./chunk-MYWZCDML.cjs');
44
44
 
45
45
 
46
46
 
47
- var _chunkLUMROGNMcjs = require('./chunk-LUMROGNM.cjs');
47
+ var _chunkCE6NBGOLcjs = require('./chunk-CE6NBGOL.cjs');
48
48
  require('./chunk-KVFIONKQ.cjs');
49
- require('./chunk-GZZNJGXY.cjs');
49
+ require('./chunk-JMO6AVUC.cjs');
50
50
 
51
51
 
52
52
 
@@ -80,7 +80,7 @@ require('./chunk-GZZNJGXY.cjs');
80
80
 
81
81
 
82
82
 
83
- var _chunkBDKVTNJFcjs = require('./chunk-BDKVTNJF.cjs');
83
+ var _chunkYVVFOKEPcjs = require('./chunk-YVVFOKEP.cjs');
84
84
 
85
85
 
86
86
 
@@ -97,7 +97,7 @@ var _chunkMGI2VVF6cjs = require('./chunk-MGI2VVF6.cjs');
97
97
 
98
98
  // src/actor/log.ts
99
99
  function loggerWithoutContext() {
100
- return _chunkBDKVTNJFcjs.getLogger.call(void 0, "actor-runtime");
100
+ return _chunkYVVFOKEPcjs.getLogger.call(void 0, "actor-runtime");
101
101
  }
102
102
 
103
103
  // src/actor/definition.ts
@@ -137,10 +137,10 @@ function actor(input) {
137
137
  warnDeprecatedOptionKeys(
138
138
  input == null ? void 0 : input.options
139
139
  );
140
- const config = _chunkNWCAIWHLcjs.ActorConfigSchema.parse(input);
141
- _chunkNWCAIWHLcjs.flattenActionHandlers.call(void 0, config.actions);
142
- _chunkNWCAIWHLcjs.flattenActionInputSchemas.call(void 0, config.actions, config.actionInputSchemas);
143
- _chunkNWCAIWHLcjs.flattenActionTraceSamplers.call(void 0, config.actions, (_a = config.tracing) == null ? void 0 : _a.actions);
140
+ const config = _chunkNGJWQMUUcjs.ActorConfigSchema.parse(input);
141
+ _chunkNGJWQMUUcjs.flattenActionHandlers.call(void 0, config.actions);
142
+ _chunkNGJWQMUUcjs.flattenActionInputSchemas.call(void 0, config.actions, config.actionInputSchemas);
143
+ _chunkNGJWQMUUcjs.flattenActionTraceSamplers.call(void 0, config.actions, (_a = config.tracing) == null ? void 0 : _a.actions);
144
144
  return new ActorDefinition(config);
145
145
  }
146
146
  function isStaticActorDefinition(definition) {
@@ -239,7 +239,7 @@ function validateSchemaSync(schemas, key, data) {
239
239
  var _virtualwebsocket = require('@rivetkit/virtual-websocket');
240
240
  var _ws = require('hono/ws');
241
241
  function logger() {
242
- return _chunkBDKVTNJFcjs.getLogger.call(void 0, "inline-websocket-adapter");
242
+ return _chunkYVVFOKEPcjs.getLogger.call(void 0, "inline-websocket-adapter");
243
243
  }
244
244
  var InlineWebSocketAdapter = class {
245
245
  #handler;
@@ -391,7 +391,7 @@ var InlineWebSocketAdapter = class {
391
391
 
392
392
  // src/registry/log.ts
393
393
  function logger2() {
394
- return _chunkBDKVTNJFcjs.getLogger.call(void 0, "registry");
394
+ return _chunkYVVFOKEPcjs.getLogger.call(void 0, "registry");
395
395
  }
396
396
 
397
397
  // src/serverless/configure.ts
@@ -437,8 +437,8 @@ async function configureServerlessPool(config) {
437
437
  );
438
438
  }
439
439
  const customConfig = config.configurePool;
440
- const clientConfig = _chunkHEY27WZXcjs.convertRegistryConfigToClientConfig.call(void 0, config);
441
- const dcsRes = await _chunkHEY27WZXcjs.getDatacenters.call(void 0, clientConfig);
440
+ const clientConfig = _chunkR3UI7MO3cjs.convertRegistryConfigToClientConfig.call(void 0, config);
441
+ const dcsRes = await _chunkR3UI7MO3cjs.getDatacenters.call(void 0, clientConfig);
442
442
  const poolName = _nullishCoalesce(customConfig.name, () => ( "default"));
443
443
  const serverlessToken = _nullishCoalesce(config.token, () => ( config.publicToken));
444
444
  const headers = {
@@ -460,7 +460,7 @@ async function configureServerlessPool(config) {
460
460
  metadata: _nullishCoalesce(customConfig.metadata, () => ( {})),
461
461
  drain_on_version_upgrade: _nullishCoalesce(customConfig.drainOnVersionUpgrade, () => ( true))
462
462
  };
463
- await _chunkHEY27WZXcjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
463
+ await _chunkR3UI7MO3cjs.updateRunnerConfig.call(void 0, clientConfig, poolName, {
464
464
  datacenters: Object.fromEntries(
465
465
  dcsRes.datacenters.map((dc) => [dc.name, serverlessConfig])
466
466
  )
@@ -477,7 +477,7 @@ async function configureServerlessPool(config) {
477
477
  logger2().warn({
478
478
  msg: "serverless pool configuration attempt failed",
479
479
  attempts,
480
- error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
480
+ error: _chunkYVVFOKEPcjs.stringifyError.call(void 0, error)
481
481
  });
482
482
  await sleep(CONFIGURE_RETRY_DELAY_MS);
483
483
  }
@@ -485,7 +485,7 @@ async function configureServerlessPool(config) {
485
485
  logger2().error({
486
486
  msg: "failed to configure serverless pool, validate endpoint is configured correctly then restart this process",
487
487
  attempts,
488
- error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, lastError)
488
+ error: _chunkYVVFOKEPcjs.stringifyError.call(void 0, lastError)
489
489
  });
490
490
  throw lastError;
491
491
  }
@@ -496,10 +496,10 @@ var _zod = require('zod');
496
496
  // src/registry/config/envoy.ts
497
497
  var _v4 = require('zod/v4');
498
498
  var EnvoyConfigSchema = _v4.z.object({
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))),
499
+ poolName: _v4.z.string().default(() => _nullishCoalesce(_chunkYVVFOKEPcjs.getRivetPool.call(void 0, ), () => ( "default"))),
500
+ version: _v4.z.number().default(() => _nullishCoalesce(_chunkYVVFOKEPcjs.getRivetEnvoyVersion.call(void 0, ), () => ( 1))),
501
501
  // Deprecated.
502
- totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
502
+ totalSlots: _v4.z.number().default(() => _nullishCoalesce(_chunkYVVFOKEPcjs.getRivetTotalSlots.call(void 0, ), () => ( 1e5))),
503
503
  envoyKey: _v4.z.string().optional()
504
504
  });
505
505
 
@@ -537,7 +537,7 @@ var ServerlessConfigSchema = _v4.z.object({
537
537
  *
538
538
  * Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
539
539
  */
540
- publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetPublicEndpoint.call(void 0, )))),
540
+ publicEndpoint: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkYVVFOKEPcjs.getRivetPublicEndpoint.call(void 0, )))),
541
541
  /**
542
542
  * Token that clients should use when connecting via the public endpoint.
543
543
  *
@@ -545,7 +545,7 @@ var ServerlessConfigSchema = _v4.z.object({
545
545
  *
546
546
  * Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
547
547
  */
548
- publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetPublicToken.call(void 0, ))))
548
+ publicToken: _v4.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkYVVFOKEPcjs.getRivetPublicToken.call(void 0, ))))
549
549
  // There is no publicNamespace config option because the frontend and backend
550
550
  // cannot use different namespaces. The namespace is extracted from the
551
551
  // publicEndpoint URL auth syntax if provided.
@@ -599,7 +599,7 @@ var RegistryConfigSchema = _zod.z.object({
599
599
  * Runtime binding to use for RivetKit core.
600
600
  * */
601
601
  runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
602
- const rawRuntime = _nullishCoalesce(val, () => ( _chunkBDKVTNJFcjs.getRivetkitRuntime.call(void 0, )));
602
+ const rawRuntime = _nullishCoalesce(val, () => ( _chunkYVVFOKEPcjs.getRivetkitRuntime.call(void 0, )));
603
603
  if (rawRuntime === void 0) {
604
604
  return "auto";
605
605
  }
@@ -636,7 +636,7 @@ var RegistryConfigSchema = _zod.z.object({
636
636
  * */
637
637
  logging: _zod.z.object({
638
638
  baseLogger: _zod.z.custom().optional(),
639
- level: _chunkBDKVTNJFcjs.LogLevelSchema.optional()
639
+ level: _chunkYVVFOKEPcjs.LogLevelSchema.optional()
640
640
  }).optional().default(() => ({})),
641
641
  // MARK: Routing
642
642
  // // This is a function to allow for lazy configuration of upgradeWebSocket on the
@@ -654,9 +654,9 @@ var RegistryConfigSchema = _zod.z.object({
654
654
  *
655
655
  * Can also be set via RIVET_ENDPOINT environment variables.
656
656
  */
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, )))),
657
+ endpoint: _zod.z.string().optional().transform((val) => _nullishCoalesce(_nullishCoalesce(val, () => ( _chunkYVVFOKEPcjs.getRivetEngine.call(void 0, ))), () => ( _chunkYVVFOKEPcjs.getRivetEndpoint.call(void 0, )))),
658
+ token: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkYVVFOKEPcjs.getRivetToken.call(void 0, )))),
659
+ namespace: _zod.z.string().optional().transform((val) => _nullishCoalesce(val, () => ( _chunkYVVFOKEPcjs.getRivetNamespace.call(void 0, )))),
660
660
  headers: _zod.z.record(_zod.z.string(), _zod.z.string()).optional().default({}),
661
661
  // MARK: Client
662
662
  // TODO:
@@ -696,21 +696,21 @@ var RegistryConfigSchema = _zod.z.object({
696
696
  *
697
697
  * Starts the full Rust engine process locally.
698
698
  */
699
- startEngine: _zod.z.boolean().default(() => _chunkBDKVTNJFcjs.getRivetRunEngine.call(void 0, )),
699
+ startEngine: _zod.z.boolean().default(() => _chunkYVVFOKEPcjs.getRivetRunEngine.call(void 0, )),
700
700
  /**
701
701
  * @experimental
702
702
  *
703
703
  * Host to bind the spawned local engine process to.
704
704
  */
705
- engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkHEY27WZXcjs.ENGINE_HOST))),
705
+ engineHost: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkYVVFOKEPcjs.getRivetRunEngineHost.call(void 0, ), () => ( _chunkR3UI7MO3cjs.ENGINE_HOST))),
706
706
  /**
707
707
  * @experimental
708
708
  *
709
709
  * Port to bind the spawned local engine process to.
710
710
  */
711
- enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkHEY27WZXcjs.ENGINE_PORT))),
711
+ enginePort: _zod.z.number().int().min(1).max(65535).optional().default(() => _nullishCoalesce(_chunkYVVFOKEPcjs.getRivetRunEnginePort.call(void 0, ), () => ( _chunkR3UI7MO3cjs.ENGINE_PORT))),
712
712
  /** @experimental */
713
- engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkBDKVTNJFcjs.VERSION))),
713
+ engineVersion: _zod.z.string().optional().default(() => _nullishCoalesce(_chunkYVVFOKEPcjs.getRivetRunEngineVersion.call(void 0, ), () => ( _chunkYVVFOKEPcjs.VERSION))),
714
714
  /**
715
715
  * Starts the first-party Services actor host when RivetKit manages
716
716
  * a local engine. Defaults to the local-engine decision. Set
@@ -764,7 +764,7 @@ var RegistryConfigSchema = _zod.z.object({
764
764
  }))
765
765
  }).transform((config, ctx) => {
766
766
  var _a, _b, _c;
767
- const isDevEnv = _chunkBDKVTNJFcjs.isDev.call(void 0, );
767
+ const isDevEnv = _chunkYVVFOKEPcjs.isDev.call(void 0, );
768
768
  const sqliteBackend = _nullishCoalesce(((_a = config.sqlite) == null ? void 0 : _a.backend), () => ( ((_b = config.test) == null ? void 0 : _b.sqliteBackend)));
769
769
  if (config.runtime === "wasm" && sqliteBackend === "local") {
770
770
  ctx.addIssue({
@@ -774,7 +774,7 @@ var RegistryConfigSchema = _zod.z.object({
774
774
  });
775
775
  }
776
776
  const sqlite = config.runtime === "wasm" && config.sqlite === void 0 ? { backend: "remote" } : config.sqlite;
777
- const parsedEndpoint = config.endpoint ? _chunkHEY27WZXcjs.tryParseEndpoint.call(void 0, ctx, {
777
+ const parsedEndpoint = config.endpoint ? _chunkR3UI7MO3cjs.tryParseEndpoint.call(void 0, ctx, {
778
778
  endpoint: config.endpoint,
779
779
  path: ["endpoint"],
780
780
  namespace: config.namespace,
@@ -792,18 +792,18 @@ var RegistryConfigSchema = _zod.z.object({
792
792
  message: "configurePool requires either endpoint or startEngine"
793
793
  });
794
794
  }
795
- const localEngineEndpoint = _chunkHEY27WZXcjs.buildEngineEndpoint.call(void 0,
795
+ const localEngineEndpoint = _chunkR3UI7MO3cjs.buildEngineEndpoint.call(void 0,
796
796
  config.engineHost,
797
797
  config.enginePort
798
798
  );
799
799
  const endpoint = config.startEngine ? localEngineEndpoint : _nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint), () => ( (isDevEnv ? localEngineEndpoint : void 0)));
800
- const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunkBDKVTNJFcjs.getRivetRunServices.call(void 0, ))), () => ( Boolean(endpoint && _chunkHEY27WZXcjs.isLocalEngineEndpoint.call(void 0, endpoint))));
800
+ const startServices = _nullishCoalesce(_nullishCoalesce(config.startServices, () => ( _chunkYVVFOKEPcjs.getRivetRunServices.call(void 0, ))), () => ( Boolean(endpoint && _chunkR3UI7MO3cjs.isLocalEngineEndpoint.call(void 0, endpoint))));
801
801
  const validateServerlessEndpoint = Boolean(
802
802
  config.startEngine || parsedEndpoint
803
803
  );
804
804
  const namespace = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.namespace), () => ( config.namespace)), () => ( "default"));
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, {
805
+ const token = _nullishCoalesce(_nullishCoalesce((parsedEndpoint == null ? void 0 : parsedEndpoint.token), () => ( config.token)), () => ( (endpoint && _chunkR3UI7MO3cjs.isLocalEngineEndpoint.call(void 0, endpoint) ? "default" : void 0)));
806
+ const parsedPublicEndpoint = config.serverless.publicEndpoint ? _chunkR3UI7MO3cjs.tryParseEndpoint.call(void 0, ctx, {
807
807
  endpoint: config.serverless.publicEndpoint,
808
808
  path: ["serverless", "publicEndpoint"]
809
809
  }) : void 0;
@@ -839,7 +839,7 @@ function buildActorNames(config) {
839
839
  Object.keys(config.use).map((actorName) => {
840
840
  const definition = config.use[actorName];
841
841
  const options = _nullishCoalesce(definition.config.options, () => ( {}));
842
- const runMeta = _chunkNWCAIWHLcjs.getRunMetadata.call(void 0, definition.config.run);
842
+ const runMeta = _chunkNGJWQMUUcjs.getRunMetadata.call(void 0, definition.config.run);
843
843
  const metadata = {};
844
844
  metadata.icon = _nullishCoalesce(options.icon, () => ( runMeta.icon));
845
845
  metadata.name = _nullishCoalesce(options.name, () => ( runMeta.name));
@@ -907,7 +907,7 @@ var DocRegistryConfigSchema = _zod.z.object({
907
907
  noWelcome: _zod.z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
908
908
  sqlite: DocSqliteConfigSchema,
909
909
  logging: _zod.z.object({
910
- level: _chunkBDKVTNJFcjs.LogLevelSchema.optional().describe(
910
+ level: _chunkYVVFOKEPcjs.LogLevelSchema.optional().describe(
911
911
  "Log level for RivetKit. Default: 'warn'"
912
912
  )
913
913
  }).optional().describe("Logging configuration."),
@@ -1537,7 +1537,7 @@ var NapiCoreRuntime = (_class = class {
1537
1537
  if (!(active == null ? void 0 : active.sameActorInstance(ownerCtx))) {
1538
1538
  return ownerCtx;
1539
1539
  }
1540
- const applicationSpan = _chunkHEY27WZXcjs.readActiveTraceHeaders.call(void 0, );
1540
+ const applicationSpan = _chunkR3UI7MO3cjs.readActiveTraceHeaders.call(void 0, );
1541
1541
  if (!applicationSpan) {
1542
1542
  return active;
1543
1543
  }
@@ -1732,6 +1732,12 @@ var NapiCoreRuntime = (_class = class {
1732
1732
  actorId(ctx) {
1733
1733
  return asNativeActorContext(ctx).actorId();
1734
1734
  }
1735
+ actorGeneration(ctx) {
1736
+ return _nullishCoalesce(asNativeActorContext(ctx).generation(), () => ( void 0));
1737
+ }
1738
+ actorIsLost(ctx) {
1739
+ return asNativeActorContext(ctx).isLost();
1740
+ }
1735
1741
  runWithActorInvocationContext(ctx, run) {
1736
1742
  return this.#runAs(asNativeActorContext(ctx), run);
1737
1743
  }
@@ -1740,7 +1746,7 @@ var NapiCoreRuntime = (_class = class {
1740
1746
  const span = (_a = nativeCtx.invocationTraceContext()) == null ? void 0 : _a.span;
1741
1747
  return this.#invocationContext.run(
1742
1748
  nativeCtx,
1743
- () => _chunkHEY27WZXcjs.runWithActorInvocationSpan.call(void 0, span, run)
1749
+ () => _chunkR3UI7MO3cjs.runWithActorInvocationSpan.call(void 0, span, run)
1744
1750
  );
1745
1751
  }
1746
1752
  actorInvocationTraceContext(ctx) {
@@ -2115,8 +2121,8 @@ function runtimeBytesToArrayBuffer(value) {
2115
2121
  function buildNativeHttpRequest(init) {
2116
2122
  var _a;
2117
2123
  const headers = new Headers(init.headers);
2118
- const originalUrl = headers.get(_chunkHEY27WZXcjs.HEADER_ORIGINAL_REQUEST_URL);
2119
- headers.delete(_chunkHEY27WZXcjs.HEADER_ORIGINAL_REQUEST_URL);
2124
+ const originalUrl = headers.get(_chunkR3UI7MO3cjs.HEADER_ORIGINAL_REQUEST_URL);
2125
+ headers.delete(_chunkR3UI7MO3cjs.HEADER_ORIGINAL_REQUEST_URL);
2120
2126
  const url = _nullishCoalesce(originalUrl, () => ( (init.uri.startsWith("http") ? init.uri : new URL(init.uri, "http://127.0.0.1").toString())));
2121
2127
  const method2 = init.method.toUpperCase();
2122
2128
  const bodyForbidden = method2 === "GET" || method2 === "HEAD";
@@ -2195,7 +2201,7 @@ async function pumpResponseBody(reader, stream) {
2195
2201
  }
2196
2202
  } catch (error) {
2197
2203
  try {
2198
- await stream.error(_chunkBDKVTNJFcjs.stringifyError.call(void 0, error));
2204
+ await stream.error(_chunkYVVFOKEPcjs.stringifyError.call(void 0, error));
2199
2205
  } catch (streamError) {
2200
2206
  logger2().debug({
2201
2207
  msg: "failed to report native http response stream error",
@@ -2351,6 +2357,27 @@ function notifyStateChanged(state) {
2351
2357
  waiter();
2352
2358
  }
2353
2359
  }
2360
+ function createRunState(actorGeneration) {
2361
+ return {
2362
+ actorGeneration,
2363
+ active: false,
2364
+ closed: false,
2365
+ exclusive: false,
2366
+ exclusiveGeneration: 0,
2367
+ inspectorInitialized: false,
2368
+ queued: 0,
2369
+ waiters: /* @__PURE__ */ new Set()
2370
+ };
2371
+ }
2372
+ function closeRunState(state, disposeInspector = true) {
2373
+ var _a, _b;
2374
+ state.closed = true;
2375
+ if (disposeInspector) {
2376
+ (_b = (_a = state.inspector) == null ? void 0 : _a.dispose) == null ? void 0 : _b.call(_a);
2377
+ }
2378
+ state.inspector = void 0;
2379
+ notifyStateChanged(state);
2380
+ }
2354
2381
  function waitForStateChange(state) {
2355
2382
  return new Promise((resolve) => {
2356
2383
  state.waiters.add(resolve);
@@ -2363,10 +2390,13 @@ var RunHandlerCoordinator = class {
2363
2390
  this.#run = run;
2364
2391
  }
2365
2392
  get inspectorKind() {
2366
- return _chunkNWCAIWHLcjs.getRunInspectorKind.call(void 0, this.#run);
2393
+ return _chunkNGJWQMUUcjs.getRunInspectorKind.call(void 0, this.#run);
2367
2394
  }
2368
- async run(actorId, restart, callback) {
2369
- const state = this.#getOrCreate(actorId);
2395
+ async run(actorId, restart, callback, actorGeneration) {
2396
+ const state = this.#getOrCreate(actorId, actorGeneration);
2397
+ if (state.closed) {
2398
+ return "closed";
2399
+ }
2370
2400
  state.restart = restart;
2371
2401
  this.#initializeInspector(actorId, state);
2372
2402
  state.queued += 1;
@@ -2393,21 +2423,27 @@ var RunHandlerCoordinator = class {
2393
2423
  notifyStateChanged(state);
2394
2424
  }
2395
2425
  }
2396
- getInspector(actorId, restart) {
2426
+ getInspector(actorId, restart, actorGeneration) {
2397
2427
  var _a;
2398
- const state = this.#getOrCreate(actorId);
2428
+ const state = this.#getOrCreate(actorId, actorGeneration);
2429
+ if (state.closed) {
2430
+ return void 0;
2431
+ }
2399
2432
  state.restart = restart;
2400
2433
  this.#initializeInspector(actorId, state);
2401
2434
  return (_a = state.inspector) == null ? void 0 : _a.inspector;
2402
2435
  }
2403
- destroy(actorId) {
2404
- var _a, _b;
2436
+ /**
2437
+ * Closes the run state for `actorId`. With `actorGeneration`, only state owned by that
2438
+ * generation is closed, so an older generation's late cleanup cannot close a newer one.
2439
+ */
2440
+ destroy(actorId, actorGeneration, options = {}) {
2405
2441
  const state = this.#states.get(actorId);
2406
2442
  if (!state) return;
2407
- state.closed = true;
2408
- (_b = (_a = state.inspector) == null ? void 0 : _a.dispose) == null ? void 0 : _b.call(_a);
2409
- state.inspector = void 0;
2410
- notifyStateChanged(state);
2443
+ if (actorGeneration !== void 0 && state.actorGeneration !== void 0 && state.actorGeneration !== actorGeneration) {
2444
+ return;
2445
+ }
2446
+ closeRunState(state, _nullishCoalesce(options.disposeInspector, () => ( true)));
2411
2447
  this.#states.delete(actorId);
2412
2448
  }
2413
2449
  #control(actorId, state) {
@@ -2453,26 +2489,29 @@ var RunHandlerCoordinator = class {
2453
2489
  }
2454
2490
  };
2455
2491
  }
2456
- #getOrCreate(actorId) {
2492
+ #getOrCreate(actorId, actorGeneration) {
2457
2493
  let state = this.#states.get(actorId);
2494
+ if (state && actorGeneration !== void 0 && state.actorGeneration !== void 0 && state.actorGeneration !== actorGeneration) {
2495
+ if (actorGeneration < state.actorGeneration) {
2496
+ const detached = createRunState(actorGeneration);
2497
+ detached.closed = true;
2498
+ return detached;
2499
+ }
2500
+ closeRunState(state, false);
2501
+ this.#states.delete(actorId);
2502
+ state = void 0;
2503
+ }
2458
2504
  if (!state) {
2459
- state = {
2460
- active: false,
2461
- closed: false,
2462
- exclusive: false,
2463
- exclusiveGeneration: 0,
2464
- inspectorInitialized: false,
2465
- queued: 0,
2466
- waiters: /* @__PURE__ */ new Set()
2467
- };
2505
+ state = createRunState(actorGeneration);
2468
2506
  this.#states.set(actorId, state);
2469
2507
  }
2470
2508
  return state;
2471
2509
  }
2472
2510
  #initializeInspector(actorId, state) {
2473
2511
  if (state.inspectorInitialized) return;
2474
- const inspector = _chunkNWCAIWHLcjs.createRunInspector.call(void 0, this.#run, {
2512
+ const inspector = _chunkNGJWQMUUcjs.createRunInspector.call(void 0, this.#run, {
2475
2513
  actorId,
2514
+ actorGeneration: state.actorGeneration,
2476
2515
  control: this.#control(actorId, state)
2477
2516
  });
2478
2517
  if (this.inspectorKind === "workflow") {
@@ -2800,6 +2839,12 @@ var WasmCoreRuntime = (_class2 = class {
2800
2839
  actorId(ctx) {
2801
2840
  return callHandle(asWasmActorContext(ctx), "actorId");
2802
2841
  }
2842
+ actorGeneration(ctx) {
2843
+ return _nullishCoalesce(callHandle(asWasmActorContext(ctx), "generation"), () => ( void 0));
2844
+ }
2845
+ actorIsLost(ctx) {
2846
+ return callHandle(asWasmActorContext(ctx), "isLost");
2847
+ }
2803
2848
  runWithActorInvocationContext(_ctx, run) {
2804
2849
  return run();
2805
2850
  }
@@ -3433,7 +3478,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
3433
3478
  nativeError = error;
3434
3479
  logger2().warn({
3435
3480
  msg: "native runtime failed to load; falling back to wasm",
3436
- error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
3481
+ error: _chunkYVVFOKEPcjs.stringifyError.call(void 0, error)
3437
3482
  });
3438
3483
  }
3439
3484
  try {
@@ -3442,7 +3487,7 @@ async function loadAutoRuntime(config, loaders = defaultRuntimeLoaders) {
3442
3487
  throw new (0, _chunkMGI2VVF6cjs.RivetError)(
3443
3488
  "config",
3444
3489
  "runtime_unavailable",
3445
- `RivetKit could not load a core runtime. Native runtime: ${_chunkBDKVTNJFcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkBDKVTNJFcjs.stringifyError.call(void 0, wasmError)}`,
3490
+ `RivetKit could not load a core runtime. Native runtime: ${_chunkYVVFOKEPcjs.stringifyError.call(void 0, nativeError)} Wasm runtime: ${_chunkYVVFOKEPcjs.stringifyError.call(void 0, wasmError)}`,
3446
3491
  {
3447
3492
  public: true,
3448
3493
  statusCode: 500
@@ -3631,20 +3676,37 @@ async function cleanupNativeSleepRuntimeState(runtime, ctx, afterTrackedWorkDrai
3631
3676
  await closeNativeDatabaseClient(runtime, ctx);
3632
3677
  await closeNativeSqlDatabase(runtime, ctx);
3633
3678
  void runtime.actorWaitForTrackedShutdownWorkUnbounded(ctx).then(async () => {
3634
- await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
3635
- clearNativeRuntimeState(runtime, ctx);
3679
+ try {
3680
+ await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
3681
+ } finally {
3682
+ clearNativeRuntimeState(runtime, ctx);
3683
+ }
3636
3684
  }).catch((error) => {
3637
3685
  logger2().warn({
3638
3686
  msg: "deferred native sleep cleanup failed",
3639
- error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
3687
+ error: _chunkYVVFOKEPcjs.stringifyError.call(void 0, error)
3640
3688
  });
3641
3689
  });
3642
3690
  return;
3643
3691
  }
3644
- await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
3692
+ try {
3693
+ await (afterTrackedWorkDrained == null ? void 0 : afterTrackedWorkDrained());
3694
+ } finally {
3695
+ try {
3696
+ await closeNativeDatabaseClient(runtime, ctx);
3697
+ await closeNativeSqlDatabase(runtime, ctx);
3698
+ } finally {
3699
+ clearNativeRuntimeState(runtime, ctx);
3700
+ }
3701
+ }
3702
+ }
3703
+ async function cleanupNativeLostRuntimeState(runtime, ctx) {
3645
3704
  await closeNativeDatabaseClient(runtime, ctx);
3646
- await closeNativeSqlDatabase(runtime, ctx);
3647
- clearNativeRuntimeState(runtime, ctx);
3705
+ try {
3706
+ await closeNativeSqlDatabase(runtime, ctx);
3707
+ } finally {
3708
+ clearNativeRuntimeState(runtime, ctx);
3709
+ }
3648
3710
  }
3649
3711
  function closeNativeSqlDatabase(runtime, ctx) {
3650
3712
  const runtimeState = getNativeRuntimeState(runtime, ctx);
@@ -3662,6 +3724,9 @@ async function closeNativeDatabaseClient(runtime, ctx) {
3662
3724
  return;
3663
3725
  }
3664
3726
  runtimeState.databaseClient = void 0;
3727
+ if (callNativeSync(() => runtime.actorIsLost(ctx))) {
3728
+ return;
3729
+ }
3665
3730
  if (entry.client && typeof entry.client === "object" && "close" in entry.client && typeof entry.client.close === "function") {
3666
3731
  await entry.client.close();
3667
3732
  }
@@ -3799,10 +3864,10 @@ function decodeValue(value) {
3799
3864
  if (!value || value.length === 0) {
3800
3865
  return void 0;
3801
3866
  }
3802
- return _chunkBDKVTNJFcjs.decodeCborCompat.call(void 0, value);
3867
+ return _chunkYVVFOKEPcjs.decodeCborCompat.call(void 0, value);
3803
3868
  }
3804
3869
  function encodeValue(value) {
3805
- return _chunkBDKVTNJFcjs.encodeCborCompat.call(void 0, value);
3870
+ return _chunkYVVFOKEPcjs.encodeCborCompat.call(void 0, value);
3806
3871
  }
3807
3872
  function normalizeArgs(value) {
3808
3873
  return Array.isArray(value) ? value : value === void 0 || value === null ? [] : [value];
@@ -3838,7 +3903,7 @@ function isStructuredBridgeError(error) {
3838
3903
  return _chunkMGI2VVF6cjs.isRivetErrorLike.call(void 0, error) && "__type" in error && (error.__type === "RivetError" || error.__type === "ActorError");
3839
3904
  }
3840
3905
  function encodeNativeCallbackError(error) {
3841
- const structuredError = isStructuredBridgeError(error) ? error : _chunkBDKVTNJFcjs.deconstructError.call(void 0, error, true);
3906
+ const structuredError = isStructuredBridgeError(error) ? error : _chunkYVVFOKEPcjs.deconstructError.call(void 0, error, true);
3842
3907
  const { encoded, droppedMetadataCause } = _chunkMGI2VVF6cjs.encodeBridgeRivetError.call(void 0, structuredError);
3843
3908
  if (droppedMetadataCause !== void 0) {
3844
3909
  logger2().warn(
@@ -3900,7 +3965,7 @@ function decodeWorkflowCbor(data) {
3900
3965
  return null;
3901
3966
  }
3902
3967
  try {
3903
- return _chunkBDKVTNJFcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
3968
+ return _chunkYVVFOKEPcjs.decodeCborCompat.call(void 0, new Uint8Array(data));
3904
3969
  } catch (e3) {
3905
3970
  return null;
3906
3971
  }
@@ -4013,7 +4078,7 @@ function serializeWorkflowHistoryForJson(data) {
4013
4078
  if (data === null) {
4014
4079
  return null;
4015
4080
  }
4016
- const history = _chunkWLRGUAMWcjs.decodeWorkflowHistoryTransport.call(void 0, data);
4081
+ const history = _chunkERBNWARBcjs.decodeWorkflowHistoryTransport.call(void 0, data);
4017
4082
  return jsonSafe({
4018
4083
  nameRegistry: [...history.nameRegistry],
4019
4084
  entries: history.entries.map((entry) => ({
@@ -4087,6 +4152,49 @@ function wrapNativeCallback(callback) {
4087
4152
  }
4088
4153
  };
4089
4154
  }
4155
+ var LOST_GENERATION_CLEANUP_CALLBACKS = /* @__PURE__ */ new Set(["onSleep", "onDestroy"]);
4156
+ function throwIfActorLost(runtime, ctx) {
4157
+ if (callNativeSync(() => runtime.actorIsLost(ctx))) {
4158
+ throw actorGenerationLostError();
4159
+ }
4160
+ }
4161
+ function actorGenerationLostError() {
4162
+ return new (0, _chunkMGI2VVF6cjs.RivetError)(
4163
+ "actor",
4164
+ "stopping",
4165
+ "Actor generation was declared lost; it starts no new user callbacks."
4166
+ );
4167
+ }
4168
+ function refuseCallbacksAfterLost(runtime, callbacks) {
4169
+ const guard = (callback) => {
4170
+ return async (...args) => {
4171
+ var _a;
4172
+ const ctx = (_a = args[1]) == null ? void 0 : _a.ctx;
4173
+ if (ctx !== void 0 && callNativeSync(() => runtime.actorIsLost(ctx))) {
4174
+ throw encodeNativeCallbackError(actorGenerationLostError());
4175
+ }
4176
+ return await callback(...args);
4177
+ };
4178
+ };
4179
+ const guarded = {};
4180
+ for (const [name, value] of Object.entries(callbacks)) {
4181
+ if (LOST_GENERATION_CLEANUP_CALLBACKS.has(name)) {
4182
+ guarded[name] = value;
4183
+ } else if (typeof value === "function") {
4184
+ guarded[name] = guard(value);
4185
+ } else if (name === "actions" && value !== null && typeof value === "object") {
4186
+ guarded[name] = Object.fromEntries(
4187
+ Object.entries(value).map(([actionName, handler]) => [
4188
+ actionName,
4189
+ guard(handler)
4190
+ ])
4191
+ );
4192
+ } else {
4193
+ guarded[name] = value;
4194
+ }
4195
+ }
4196
+ return guarded;
4197
+ }
4090
4198
  function decodeArgs(value) {
4091
4199
  const decoded = decodeValue(value);
4092
4200
  return normalizeArgs(decoded);
@@ -4112,7 +4220,7 @@ var NativeConnAdapter = class {
4112
4220
  this.#ctx = ctx;
4113
4221
  this.#queueHibernationRemoval = queueHibernationRemoval;
4114
4222
  this.#assertCanMutateState = assertCanMutateState;
4115
- this[_chunkNWCAIWHLcjs.CONN_STATE_MANAGER_SYMBOL] = {
4223
+ this[_chunkNGJWQMUUcjs.CONN_STATE_MANAGER_SYMBOL] = {
4116
4224
  stateEnabled: true,
4117
4225
  get state() {
4118
4226
  return thisConn.state;
@@ -4129,7 +4237,7 @@ var NativeConnAdapter = class {
4129
4237
  decodeValue(this.#runtime.connParams(this.#conn))
4130
4238
  );
4131
4239
  }
4132
- [_chunkNWCAIWHLcjs.RAW_STATE_SYMBOL]() {
4240
+ [_chunkNGJWQMUUcjs.RAW_STATE_SYMBOL]() {
4133
4241
  return this.#readState();
4134
4242
  }
4135
4243
  get state() {
@@ -4159,7 +4267,7 @@ var NativeConnAdapter = class {
4159
4267
  },
4160
4268
  (newValue) => {
4161
4269
  assertCurrentState();
4162
- _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, newValue);
4270
+ _chunkYVVFOKEPcjs.assertJsonCompatValue.call(void 0, newValue);
4163
4271
  }
4164
4272
  );
4165
4273
  }
@@ -4167,7 +4275,7 @@ var NativeConnAdapter = class {
4167
4275
  var _a;
4168
4276
  (_a = this.#assertCanMutateState) == null ? void 0 : _a.call(this);
4169
4277
  const nextValue = unwrapWriteThroughProxy(value);
4170
- _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, nextValue);
4278
+ _chunkYVVFOKEPcjs.assertJsonCompatValue.call(void 0, nextValue);
4171
4279
  this.#writeState(nextValue, { writeNative: true });
4172
4280
  }
4173
4281
  initializeState(value) {
@@ -4524,17 +4632,30 @@ var NativeQueueAdapter = class {
4524
4632
  this.#ctx = ctx;
4525
4633
  this.#schemas = schemas;
4526
4634
  }
4635
+ // Queue results arrive after awaits, and their schema validation is user code, so each
4636
+ // validation checks that the generation was not lost first.
4637
+ #validateBody(name, body) {
4638
+ throwIfActorLost(this.#runtime, this.#ctx);
4639
+ return validateQueueBody(this.#schemas, name, body);
4640
+ }
4641
+ #validateComplete(name, response) {
4642
+ throwIfActorLost(this.#runtime, this.#ctx);
4643
+ return validateQueueComplete(this.#schemas, name, response);
4644
+ }
4645
+ #wrap(message) {
4646
+ throwIfActorLost(this.#runtime, this.#ctx);
4647
+ return wrapQueueMessage(message, this.#schemas);
4648
+ }
4527
4649
  async send(name, body) {
4528
- const validatedBody = validateQueueBody(this.#schemas, name, body);
4529
- return wrapQueueMessage(
4650
+ const validatedBody = this.#validateBody(name, body);
4651
+ return this.#wrap(
4530
4652
  await callNative(
4531
4653
  () => this.#runtime.actorQueueSend(
4532
4654
  this.#ctx,
4533
4655
  name,
4534
4656
  encodeValue(validatedBody)
4535
4657
  )
4536
- ),
4537
- this.#schemas
4658
+ )
4538
4659
  );
4539
4660
  }
4540
4661
  async next(options) {
@@ -4577,9 +4698,7 @@ var NativeQueueAdapter = class {
4577
4698
  token
4578
4699
  )
4579
4700
  );
4580
- const wrapped = messages.map(
4581
- (message) => wrapQueueMessage(message, this.#schemas)
4582
- );
4701
+ const wrapped = messages.map((message) => this.#wrap(message));
4583
4702
  return completable ? wrapped.map(
4584
4703
  (message) => this.#makeCompletableMessage(message)
4585
4704
  ) : wrapped;
@@ -4593,7 +4712,7 @@ var NativeQueueAdapter = class {
4593
4712
  options == null ? void 0 : options.signal
4594
4713
  );
4595
4714
  try {
4596
- return wrapQueueMessage(
4715
+ return this.#wrap(
4597
4716
  await callNative(
4598
4717
  () => this.#runtime.actorQueueWaitForNames(
4599
4718
  this.#ctx,
@@ -4604,8 +4723,7 @@ var NativeQueueAdapter = class {
4604
4723
  },
4605
4724
  token
4606
4725
  )
4607
- ),
4608
- this.#schemas
4726
+ )
4609
4727
  );
4610
4728
  } finally {
4611
4729
  cleanup == null ? void 0 : cleanup();
@@ -4635,8 +4753,7 @@ var NativeQueueAdapter = class {
4635
4753
  await this.waitForNamesAvailable(_nullishCoalesce(names, () => ( [])), options);
4636
4754
  }
4637
4755
  async complete(message, response) {
4638
- const validatedResponse = validateQueueComplete(
4639
- this.#schemas,
4756
+ const validatedResponse = this.#validateComplete(
4640
4757
  message.name,
4641
4758
  response
4642
4759
  );
@@ -4651,7 +4768,7 @@ var NativeQueueAdapter = class {
4651
4768
  this.#pendingCompletableMessageIds.delete(message.id.toString());
4652
4769
  }
4653
4770
  async enqueueAndWait(name, body, options) {
4654
- const validatedBody = validateQueueBody(this.#schemas, name, body);
4771
+ const validatedBody = this.#validateBody(name, body);
4655
4772
  const { token, cleanup } = await createCancellationTokenHandle(
4656
4773
  this.#runtime,
4657
4774
  options == null ? void 0 : options.signal
@@ -4668,11 +4785,7 @@ var NativeQueueAdapter = class {
4668
4785
  token
4669
4786
  )
4670
4787
  );
4671
- return response === void 0 || response === null ? void 0 : validateQueueComplete(
4672
- this.#schemas,
4673
- name,
4674
- decodeValue(response)
4675
- );
4788
+ return response === void 0 || response === null ? void 0 : this.#validateComplete(name, decodeValue(response));
4676
4789
  } finally {
4677
4790
  cleanup == null ? void 0 : cleanup();
4678
4791
  }
@@ -5053,6 +5166,9 @@ var TrackedWebSocketHandleAdapter = class {
5053
5166
  }
5054
5167
  }
5055
5168
  #callHandler(type, handler, event2) {
5169
+ if ((type === "message" || type === "open") && this.#ctx.isLost) {
5170
+ return;
5171
+ }
5056
5172
  try {
5057
5173
  const result = handler(event2);
5058
5174
  if (!this.#isPromiseLike(result)) {
@@ -5186,7 +5302,7 @@ var ActorContextHandleAdapter = class {
5186
5302
  this.#databaseProvider = databaseProvider;
5187
5303
  }
5188
5304
  this.#request = request;
5189
- this[_chunkNWCAIWHLcjs.ACTOR_CONTEXT_INTERNAL_SYMBOL] = new NativeWorkflowRuntimeAdapter(
5305
+ this[_chunkNGJWQMUUcjs.ACTOR_CONTEXT_INTERNAL_SYMBOL] = new NativeWorkflowRuntimeAdapter(
5190
5306
  this,
5191
5307
  () => this.#logByInvocationScope.delete(
5192
5308
  _nullishCoalesce(this.#runtime.currentInvocationScope(), () => ( NO_INVOCATION_SCOPE))
@@ -5219,7 +5335,7 @@ var ActorContextHandleAdapter = class {
5219
5335
  }
5220
5336
  throw databaseClientNotReadyError();
5221
5337
  }
5222
- [_chunkNWCAIWHLcjs.RAW_STATE_SYMBOL]() {
5338
+ [_chunkNGJWQMUUcjs.RAW_STATE_SYMBOL]() {
5223
5339
  if (!this.#stateEnabled) {
5224
5340
  throw stateNotEnabledError();
5225
5341
  }
@@ -5246,7 +5362,7 @@ var ActorContextHandleAdapter = class {
5246
5362
  },
5247
5363
  (newValue) => {
5248
5364
  assertCurrentState();
5249
- _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, newValue);
5365
+ _chunkYVVFOKEPcjs.assertJsonCompatValue.call(void 0, newValue);
5250
5366
  }
5251
5367
  );
5252
5368
  }
@@ -5258,7 +5374,7 @@ var ActorContextHandleAdapter = class {
5258
5374
  }
5259
5375
  this.#assertCanMutateState();
5260
5376
  const nextValue = unwrapWriteThroughProxy(value);
5261
- _chunkBDKVTNJFcjs.assertJsonCompatValue.call(void 0, nextValue);
5377
+ _chunkYVVFOKEPcjs.assertJsonCompatValue.call(void 0, nextValue);
5262
5378
  this.#writeState(nextValue, { scheduleSave: true });
5263
5379
  }
5264
5380
  initializeState(value) {
@@ -5335,6 +5451,13 @@ var ActorContextHandleAdapter = class {
5335
5451
  get actorId() {
5336
5452
  return callNativeSync(() => this.#runtime.actorId(this.#ctx));
5337
5453
  }
5454
+ get actorGeneration() {
5455
+ return callNativeSync(() => this.#runtime.actorGeneration(this.#ctx));
5456
+ }
5457
+ /** Whether this generation was declared lost. A lost generation starts no new user code. */
5458
+ get isLost() {
5459
+ return callNativeSync(() => this.#runtime.actorIsLost(this.#ctx));
5460
+ }
5338
5461
  get name() {
5339
5462
  return callNativeSync(() => this.#runtime.actorName(this.#ctx));
5340
5463
  }
@@ -5449,6 +5572,9 @@ var ActorContextHandleAdapter = class {
5449
5572
  return this.#db;
5450
5573
  }
5451
5574
  const actorId = this.actorId;
5575
+ if (this.isLost) {
5576
+ throw actorGenerationLostError();
5577
+ }
5452
5578
  const createdClient = await this.#databaseProvider.createClient({
5453
5579
  actorId,
5454
5580
  kv: {
@@ -5470,7 +5596,7 @@ var ActorContextHandleAdapter = class {
5470
5596
  log: {
5471
5597
  debug: (obj) => logger2().debug(obj)
5472
5598
  },
5473
- nativeDatabaseProvider: _chunkLUMROGNMcjs.registerNativeStateTransactionOpener.call(void 0,
5599
+ nativeDatabaseProvider: _chunkCE6NBGOLcjs.registerNativeStateTransactionOpener.call(void 0,
5474
5600
  {
5475
5601
  open: async (requestedActorId) => {
5476
5602
  void requestedActorId;
@@ -5493,7 +5619,7 @@ var ActorContextHandleAdapter = class {
5493
5619
  return this.#db;
5494
5620
  }
5495
5621
  #bindDatabaseClient(client) {
5496
- return _chunkLUMROGNMcjs.bindNativeStateTransactionContext.call(void 0, client, {
5622
+ return _chunkCE6NBGOLcjs.bindNativeStateTransactionContext.call(void 0, client, {
5497
5623
  enter: async () => await this.#enterStateTransaction(),
5498
5624
  exit: (scope) => this.#exitStateTransaction(
5499
5625
  scope
@@ -5601,9 +5727,11 @@ var ActorContextHandleAdapter = class {
5601
5727
  if (!this.#databaseProvider) {
5602
5728
  return;
5603
5729
  }
5604
- await this.#databaseProvider.onMigrate(
5605
- await this.ensureDatabaseClient()
5606
- );
5730
+ const client = await this.ensureDatabaseClient();
5731
+ if (this.isLost) {
5732
+ throw actorGenerationLostError();
5733
+ }
5734
+ await this.#databaseProvider.onMigrate(client);
5607
5735
  }
5608
5736
  async closeDatabase() {
5609
5737
  this.#db = void 0;
@@ -5697,7 +5825,7 @@ var ActorContextHandleAdapter = class {
5697
5825
  const trackedPromise = Promise.resolve(promise).catch((error) => {
5698
5826
  logger2().warn({
5699
5827
  msg: "keepAwake promise rejected",
5700
- error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
5828
+ error: _chunkYVVFOKEPcjs.stringifyError.call(void 0, error)
5701
5829
  });
5702
5830
  }).then(() => null);
5703
5831
  try {
@@ -5875,7 +6003,7 @@ var ActorContextHandleAdapter = class {
5875
6003
  callNativeSync(
5876
6004
  () => this.#runtime.actorRequestSave(this.#ctx, { immediate: false })
5877
6005
  );
5878
- if (!this.#onStateChange) {
6006
+ if (!this.#onStateChange || this.isLost) {
5879
6007
  return;
5880
6008
  }
5881
6009
  actorState.isInOnStateChange = true;
@@ -5915,6 +6043,12 @@ var NativeWorkflowRuntimeAdapter = class {
5915
6043
  #onMessagesReceived;
5916
6044
  #completions = /* @__PURE__ */ new Map();
5917
6045
 
6046
+ /** Actor generation, used to keep workflow registrations of different generations apart. */
6047
+
6048
+ /** Whether this generation was declared lost. Workflow code checks it before each user callback. */
6049
+ get isLost() {
6050
+ return this.#ctx.isLost;
6051
+ }
5918
6052
 
5919
6053
 
5920
6054
 
@@ -5922,6 +6056,7 @@ var NativeWorkflowRuntimeAdapter = class {
5922
6056
  this.#ctx = ctx;
5923
6057
  this.#onMessagesReceived = onMessagesReceived;
5924
6058
  this.id = ctx.actorId;
6059
+ this.generation = ctx.actorGeneration;
5925
6060
  this.driver = {
5926
6061
  kvBatchGet: async (actorId, keys) => {
5927
6062
  this.#assertActorId(actorId);
@@ -6057,7 +6192,7 @@ function buildActorTracingConfig(actions, tracing) {
6057
6192
  if (tracing === void 0) return void 0;
6058
6193
  return {
6059
6194
  sampler: tracing.sampler,
6060
- actions: _chunkNWCAIWHLcjs.flattenActionTraceSamplers.call(void 0, actions, tracing.actions)
6195
+ actions: _chunkNGJWQMUUcjs.flattenActionTraceSamplers.call(void 0, actions, tracing.actions)
6061
6196
  };
6062
6197
  }
6063
6198
  function buildActorConfig(definition, registryConfig, runtimeKind) {
@@ -6099,7 +6234,7 @@ function buildActorConfig(definition, registryConfig, runtimeKind) {
6099
6234
  maxOutgoingMessageSize: registryConfig.maxOutgoingMessageSize,
6100
6235
  preloadMaxWorkflowBytes: options.preloadMaxWorkflowBytes,
6101
6236
  preloadMaxConnectionsBytes: options.preloadMaxConnectionsBytes,
6102
- actions: Object.keys(_chunkNWCAIWHLcjs.flattenActionHandlers.call(void 0, config.actions)).sort().map((name) => ({ name })),
6237
+ actions: Object.keys(_chunkNGJWQMUUcjs.flattenActionHandlers.call(void 0, config.actions)).sort().map((name) => ({ name })),
6103
6238
  inspectorTabs: buildInspectorTabs(config.inspector, runtimeKind)
6104
6239
  };
6105
6240
  }
@@ -6175,10 +6310,10 @@ function validateInspectorTabSource(tabId, resolved) {
6175
6310
  function buildNativeFactory(runtime, registryConfig, definition) {
6176
6311
  var _a;
6177
6312
  const config = definition.config;
6178
- const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkLUMROGNMcjs.db.call(void 0, )));
6179
- const actionHandlers = _chunkNWCAIWHLcjs.flattenActionHandlers.call(void 0, config.actions);
6313
+ const databaseProvider = _nullishCoalesce(config.db, () => ( _chunkCE6NBGOLcjs.db.call(void 0, )));
6314
+ const actionHandlers = _chunkNGJWQMUUcjs.flattenActionHandlers.call(void 0, config.actions);
6180
6315
  const schemaConfig = {
6181
- actionInputSchemas: _chunkNWCAIWHLcjs.flattenActionInputSchemas.call(void 0,
6316
+ actionInputSchemas: _chunkNGJWQMUUcjs.flattenActionInputSchemas.call(void 0,
6182
6317
  config.actions,
6183
6318
  config.actionInputSchemas
6184
6319
  ),
@@ -6186,9 +6321,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6186
6321
  events: config.events,
6187
6322
  queues: config.queues
6188
6323
  };
6189
- const createClient = (ctx) => _chunkHEY27WZXcjs.createClientWithDriver.call(void 0,
6190
- new (0, _chunkHEY27WZXcjs.RemoteEngineControlClient)(
6191
- _chunkHEY27WZXcjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
6324
+ const createClient = (ctx) => _chunkR3UI7MO3cjs.createClientWithDriver.call(void 0,
6325
+ new (0, _chunkR3UI7MO3cjs.RemoteEngineControlClient)(
6326
+ _chunkR3UI7MO3cjs.convertRegistryConfigToClientConfig.call(void 0, registryConfig)
6192
6327
  ),
6193
6328
  {
6194
6329
  encoding: "bare",
@@ -6200,13 +6335,27 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6200
6335
  )
6201
6336
  }
6202
6337
  );
6203
- const run = _chunkNWCAIWHLcjs.getRunFunction.call(void 0, config.run);
6204
- const runHandlerCoordinator = _chunkNWCAIWHLcjs.getRunInspectorKind.call(void 0, config.run) === "workflow" ? new RunHandlerCoordinator(config.run) : void 0;
6338
+ const run = _chunkNGJWQMUUcjs.getRunFunction.call(void 0, config.run);
6339
+ const runHandlerCoordinator = _chunkNGJWQMUUcjs.getRunInspectorKind.call(void 0, config.run) === "workflow" ? new RunHandlerCoordinator(config.run) : void 0;
6205
6340
  const getNativeWorkflowInspector = (ctx) => {
6206
6341
  var _a2, _b;
6342
+ if (callNativeSync(() => runtime.actorIsLost(ctx))) {
6343
+ return void 0;
6344
+ }
6207
6345
  const actorId = callNativeSync(() => runtime.actorId(ctx));
6208
6346
  const restart = () => callNativeSync(() => runtime.actorRestartRunHandler(ctx));
6209
- return _nullishCoalesce(((_a2 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(actorId, restart)) == null ? void 0 : _a2.workflow), () => ( ((_b = _chunkNWCAIWHLcjs.getRunInspectorConfig.call(void 0, config.run, actorId)) == null ? void 0 : _b.workflow)));
6347
+ const actorGeneration = callNativeSync(
6348
+ () => runtime.actorGeneration(ctx)
6349
+ );
6350
+ const inspector = _nullishCoalesce(((_a2 = runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.getInspector(
6351
+ actorId,
6352
+ restart,
6353
+ actorGeneration
6354
+ )) == null ? void 0 : _a2.workflow), () => ( ((_b = _chunkNGJWQMUUcjs.getRunInspectorConfig.call(void 0, config.run, actorId)) == null ? void 0 : _b.workflow)));
6355
+ if (callNativeSync(() => runtime.actorIsLost(ctx))) {
6356
+ return void 0;
6357
+ }
6358
+ return inspector;
6210
6359
  };
6211
6360
  const onStateChange = typeof config.onStateChange === "function" ? (actorCtx, nextState) => {
6212
6361
  config.onStateChange(actorCtx, nextState);
@@ -6283,6 +6432,10 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6283
6432
  return errorResponse(error, 401);
6284
6433
  }
6285
6434
  }
6435
+ const inspectorConnParams = (conn) => {
6436
+ throwIfActorLost(runtime, ctx);
6437
+ return conn.params;
6438
+ };
6286
6439
  const workflowHistory = () => {
6287
6440
  var _a3;
6288
6441
  return serializeWorkflowHistoryForJson(
@@ -6316,7 +6469,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6316
6469
  id: conn.id,
6317
6470
  details: {
6318
6471
  type: null,
6319
- params: conn.params,
6472
+ params: inspectorConnParams(conn),
6320
6473
  stateEnabled: true,
6321
6474
  state: conn.state,
6322
6475
  subscriptions: 0,
@@ -6380,7 +6533,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6380
6533
  400
6381
6534
  );
6382
6535
  }
6383
- const cbor = _chunkBDKVTNJFcjs.encodeCborCompat.call(void 0,
6536
+ const cbor = _chunkYVVFOKEPcjs.encodeCborCompat.call(void 0,
6384
6537
  _nullishCoalesce(body.body, () => ( null))
6385
6538
  );
6386
6539
  const message = await runtime.actorQueueSend(ctx, name, cbor);
@@ -6520,7 +6673,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6520
6673
  id: conn.id,
6521
6674
  details: {
6522
6675
  type: null,
6523
- params: conn.params,
6676
+ params: inspectorConnParams(conn),
6524
6677
  stateEnabled: true,
6525
6678
  state: conn.state,
6526
6679
  subscriptions: 0,
@@ -6567,15 +6720,20 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6567
6720
  );
6568
6721
  }
6569
6722
  const args = body.properties !== void 0 ? [body.properties] : normalizeArgs(body.args);
6723
+ if (callNativeSync(() => runtime.actorIsLost(ctx))) {
6724
+ return jsonResponse(
6725
+ { error: "actor generation was declared lost" },
6726
+ { status: 503 }
6727
+ );
6728
+ }
6570
6729
  try {
6571
- const output = await action(
6572
- actorCtx,
6573
- ...validateActionArgs(
6574
- schemaConfig.actionInputSchemas,
6575
- actionName,
6576
- args
6577
- )
6730
+ const validatedArgs = validateActionArgs(
6731
+ schemaConfig.actionInputSchemas,
6732
+ actionName,
6733
+ args
6578
6734
  );
6735
+ throwIfActorLost(runtime, ctx);
6736
+ const output = await action(actorCtx, ...validatedArgs);
6579
6737
  return jsonResponse({ output });
6580
6738
  } catch (error) {
6581
6739
  logger2().error({
@@ -6679,7 +6837,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6679
6837
  await actorCtx.closeDatabase();
6680
6838
  }
6681
6839
  await actorCtx.runDatabaseMigrations();
6682
- if (typeof config.onMigrate === "function") {
6840
+ if (typeof config.onMigrate === "function" && !callNativeSync(
6841
+ () => runtime.actorIsLost(ctx)
6842
+ )) {
6683
6843
  await config.onMigrate(actorCtx, isNew);
6684
6844
  }
6685
6845
  } catch (error2) {
@@ -6722,7 +6882,29 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6722
6882
  const { ctx } = unwrapTsfnPayload(error, payload);
6723
6883
  const actorCtx = makeActorCtx(ctx);
6724
6884
  const actorId = callNativeSync(() => runtime.actorId(ctx));
6885
+ const actorGeneration = callNativeSync(
6886
+ () => runtime.actorGeneration(ctx)
6887
+ );
6888
+ const isLost = () => callNativeSync(() => runtime.actorIsLost(ctx));
6889
+ if (isLost()) {
6890
+ try {
6891
+ await cleanupNativeLostRuntimeState(runtime, ctx);
6892
+ } finally {
6893
+ runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(
6894
+ actorId,
6895
+ actorGeneration,
6896
+ {
6897
+ disposeInspector: false
6898
+ }
6899
+ );
6900
+ await actorCtx.dispose();
6901
+ }
6902
+ return;
6903
+ }
6725
6904
  const saveActorState = async () => {
6905
+ if (isLost()) {
6906
+ return;
6907
+ }
6726
6908
  if (runtime.kind === "wasm") {
6727
6909
  await runtime.actorSaveState(
6728
6910
  ctx,
@@ -6741,14 +6923,26 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6741
6923
  await saveActorState();
6742
6924
  } finally {
6743
6925
  try {
6744
- await cleanupNativeSleepRuntimeState(
6745
- runtime,
6746
- ctx,
6747
- saveActorState
6748
- );
6926
+ if (isLost()) {
6927
+ await cleanupNativeLostRuntimeState(runtime, ctx);
6928
+ } else {
6929
+ await cleanupNativeSleepRuntimeState(
6930
+ runtime,
6931
+ ctx,
6932
+ saveActorState
6933
+ );
6934
+ }
6749
6935
  } finally {
6750
- runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
6751
- _chunkNWCAIWHLcjs.disposeRunInspector.call(void 0, config.run, actorId);
6936
+ runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(
6937
+ actorId,
6938
+ actorGeneration,
6939
+ {
6940
+ disposeInspector: !isLost()
6941
+ }
6942
+ );
6943
+ if (!isLost()) {
6944
+ _chunkNGJWQMUUcjs.disposeRunInspector.call(void 0, config.run, actorId);
6945
+ }
6752
6946
  await actorCtx.dispose();
6753
6947
  }
6754
6948
  }
@@ -6759,10 +6953,17 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6759
6953
  const { ctx } = unwrapTsfnPayload(error, payload);
6760
6954
  const actorCtx = makeActorCtx(ctx);
6761
6955
  const actorId = callNativeSync(() => runtime.actorId(ctx));
6762
- runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(actorId);
6763
- _chunkNWCAIWHLcjs.disposeRunInspector.call(void 0, config.run, actorId);
6956
+ const isLost = () => callNativeSync(() => runtime.actorIsLost(ctx));
6957
+ runHandlerCoordinator == null ? void 0 : runHandlerCoordinator.destroy(
6958
+ actorId,
6959
+ callNativeSync(() => runtime.actorGeneration(ctx)),
6960
+ { disposeInspector: !isLost() }
6961
+ );
6962
+ if (!isLost()) {
6963
+ _chunkNGJWQMUUcjs.disposeRunInspector.call(void 0, config.run, actorId);
6964
+ }
6764
6965
  try {
6765
- if (typeof config.onDestroy === "function") {
6966
+ if (typeof config.onDestroy === "function" && !isLost()) {
6766
6967
  await config.onDestroy(actorCtx);
6767
6968
  }
6768
6969
  } finally {
@@ -6784,12 +6985,14 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6784
6985
  request ? buildNativeHttpRequest(request) : void 0
6785
6986
  );
6786
6987
  try {
6988
+ const validatedParams = validateConnParams(
6989
+ schemaConfig.connParamsSchema,
6990
+ decodeValue(params)
6991
+ );
6992
+ throwIfActorLost(runtime, ctx);
6787
6993
  await config.onBeforeConnect(
6788
6994
  actorCtx,
6789
- validateConnParams(
6790
- schemaConfig.connParamsSchema,
6791
- decodeValue(params)
6792
- )
6995
+ validatedParams
6793
6996
  );
6794
6997
  } finally {
6795
6998
  await actorCtx.dispose();
@@ -6817,13 +7020,22 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6817
7020
  () => actorCtx.assertCanMutateState()
6818
7021
  );
6819
7022
  try {
6820
- const nextConnState = hasStaticConnState ? structuredClone(config.connState) : await config.createConnState(
6821
- actorCtx,
6822
- validateConnParams(
7023
+ let nextConnState;
7024
+ if (hasStaticConnState) {
7025
+ nextConnState = structuredClone(
7026
+ config.connState
7027
+ );
7028
+ } else {
7029
+ const validatedParams = validateConnParams(
6823
7030
  schemaConfig.connParamsSchema,
6824
7031
  decodeValue(params)
6825
- )
6826
- );
7032
+ );
7033
+ throwIfActorLost(runtime, ctx);
7034
+ nextConnState = await config.createConnState(
7035
+ actorCtx,
7036
+ validatedParams
7037
+ );
7038
+ }
6827
7039
  connAdapter.initializeState(nextConnState);
6828
7040
  return encodeValue(nextConnState);
6829
7041
  } finally {
@@ -6928,6 +7140,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6928
7140
  onBeforeActionResponse: typeof config.onBeforeActionResponse === "function" ? wrapNativeCallback(
6929
7141
  async (error, payload) => {
6930
7142
  const { ctx, name, args, output } = unwrapTsfnPayload(error, payload);
7143
+ if (callNativeSync(() => runtime.actorIsLost(ctx))) {
7144
+ return output;
7145
+ }
6931
7146
  const actorCtx = makeActorCtx(ctx);
6932
7147
  try {
6933
7148
  return encodeValue(
@@ -6977,7 +7192,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6977
7192
  ...request,
6978
7193
  abortController: requestAbortController
6979
7194
  });
6980
- const rawConnParams = handlerRequest.headers.get(_chunkHEY27WZXcjs.HEADER_CONN_PARAMS);
7195
+ const rawConnParams = handlerRequest.headers.get(_chunkR3UI7MO3cjs.HEADER_CONN_PARAMS);
6981
7196
  let requestCtx;
6982
7197
  let conn;
6983
7198
  let removeRequestAbortListener;
@@ -6996,6 +7211,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
6996
7211
  }
6997
7212
  };
6998
7213
  try {
7214
+ throwIfActorLost(runtime, ctx);
6999
7215
  const connParams = validateConnParams(
7000
7216
  schemaConfig.connParamsSchema,
7001
7217
  rawConnParams ? JSON.parse(rawConnParams) : void 0
@@ -7030,11 +7246,16 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7030
7246
  abortRequest
7031
7247
  );
7032
7248
  }
7249
+ if (callNativeSync(
7250
+ () => runtime.actorIsLost(ctx)
7251
+ )) {
7252
+ throw actorGenerationLostError();
7253
+ }
7033
7254
  const response = await config.onRequest(
7034
7255
  requestCtx,
7035
7256
  handlerRequest
7036
7257
  );
7037
- if (!_chunkHEY27WZXcjs.isResponseLike.call(void 0, response)) {
7258
+ if (!_chunkR3UI7MO3cjs.isResponseLike.call(void 0, response)) {
7038
7259
  throw new Error(
7039
7260
  "onRequest handler must return a Response"
7040
7261
  );
@@ -7102,6 +7323,9 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7102
7323
  const { ctx } = unwrapTsfnPayload(error, payload);
7103
7324
  const actorId = callNativeSync(() => runtime.actorId(ctx));
7104
7325
  const executeRun = async () => {
7326
+ if (callNativeSync(() => runtime.actorIsLost(ctx))) {
7327
+ return;
7328
+ }
7105
7329
  const actorCtx = makeActorCtx(ctx);
7106
7330
  try {
7107
7331
  await run(actorCtx);
@@ -7115,7 +7339,8 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7115
7339
  () => callNativeSync(
7116
7340
  () => runtime.actorRestartRunHandler(ctx)
7117
7341
  ),
7118
- executeRun
7342
+ executeRun,
7343
+ callNativeSync(() => runtime.actorGeneration(ctx))
7119
7344
  );
7120
7345
  return outcome !== "suppressed";
7121
7346
  }
@@ -7124,15 +7349,15 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7124
7349
  }
7125
7350
  );
7126
7351
  })(),
7127
- getWorkflowHistory: _chunkNWCAIWHLcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
7352
+ getWorkflowHistory: _chunkNGJWQMUUcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
7128
7353
  async (error, payload) => {
7129
7354
  var _a2;
7130
7355
  const { ctx } = unwrapTsfnPayload(error, payload);
7131
7356
  const history = (_a2 = getNativeWorkflowInspector(ctx)) == null ? void 0 : _a2.getHistory();
7132
- return history == null ? void 0 : _chunkBDKVTNJFcjs.toUint8Array.call(void 0, history);
7357
+ return history == null ? void 0 : _chunkYVVFOKEPcjs.toUint8Array.call(void 0, history);
7133
7358
  }
7134
7359
  ) : void 0,
7135
- replayWorkflow: _chunkNWCAIWHLcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
7360
+ replayWorkflow: _chunkNGJWQMUUcjs.hasRunInspectorConfig.call(void 0, config.run) ? wrapNativeCallback(
7136
7361
  async (error, payload) => {
7137
7362
  const { ctx, entryId } = unwrapTsfnPayload(
7138
7363
  error,
@@ -7143,7 +7368,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7143
7368
  return void 0;
7144
7369
  }
7145
7370
  const history = await _asyncNullishCoalesce(await workflowInspector.replayFromStep(entryId), async () => ( null));
7146
- return history == null ? void 0 : _chunkBDKVTNJFcjs.toUint8Array.call(void 0, history);
7371
+ return history == null ? void 0 : _chunkYVVFOKEPcjs.toUint8Array.call(void 0, history);
7147
7372
  }
7148
7373
  ) : void 0,
7149
7374
  actions: Object.fromEntries(
@@ -7155,14 +7380,16 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7155
7380
  const actorCtx = conn != null ? makeConnCtx(ctx, conn, void 0, cancelToken) : makeActorCtx(ctx, void 0, cancelToken);
7156
7381
  const runAction = async () => {
7157
7382
  try {
7383
+ const validatedArgs = validateActionArgs(
7384
+ schemaConfig.actionInputSchemas,
7385
+ name,
7386
+ decodeArgs(args)
7387
+ );
7388
+ throwIfActorLost(runtime, ctx);
7158
7389
  return encodeValue(
7159
7390
  await handler(
7160
7391
  actorCtx,
7161
- ...validateActionArgs(
7162
- schemaConfig.actionInputSchemas,
7163
- name,
7164
- decodeArgs(args)
7165
- ),
7392
+ ...validatedArgs,
7166
7393
  ...scheduledFire ? [scheduledFire] : []
7167
7394
  )
7168
7395
  );
@@ -7218,6 +7445,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7218
7445
  if (canPublish && !await canPublish(actorCtx)) {
7219
7446
  throw _chunkMGI2VVF6cjs.forbiddenError.call(void 0, );
7220
7447
  }
7448
+ throwIfActorLost(runtime, ctx);
7221
7449
  const decodedBody = decodeValue(body);
7222
7450
  if (wait) {
7223
7451
  try {
@@ -7261,7 +7489,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
7261
7489
  )
7262
7490
  };
7263
7491
  return runtime.createActorFactory(
7264
- callbacks,
7492
+ refuseCallbacksAfterLost(runtime, callbacks),
7265
7493
  buildActorConfig(definition, registryConfig, runtime.kind)
7266
7494
  );
7267
7495
  }
@@ -7279,7 +7507,7 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
7279
7507
  startServices: resolveServicesBinary && config.startServices,
7280
7508
  handleInspectorHttpInRuntime: true,
7281
7509
  serverlessBasePath: config.serverless.basePath,
7282
- serverlessPackageVersion: _chunkBDKVTNJFcjs.VERSION,
7510
+ serverlessPackageVersion: _chunkYVVFOKEPcjs.VERSION,
7283
7511
  serverlessClientEndpoint: config.publicEndpoint,
7284
7512
  serverlessClientNamespace: config.publicNamespace,
7285
7513
  serverlessClientToken: config.publicToken,
@@ -7292,7 +7520,7 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
7292
7520
  } catch (error) {
7293
7521
  logger2().warn({
7294
7522
  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",
7295
- error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
7523
+ error: _chunkYVVFOKEPcjs.stringifyError.call(void 0, error)
7296
7524
  });
7297
7525
  }
7298
7526
  if (resolveServicesBinary && config.startServices) {
@@ -7302,20 +7530,20 @@ async function buildServeConfig(config, resolveServicesBinary = true) {
7302
7530
  } catch (error) {
7303
7531
  logger2().warn({
7304
7532
  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",
7305
- error: _chunkBDKVTNJFcjs.stringifyError.call(void 0, error)
7533
+ error: _chunkYVVFOKEPcjs.stringifyError.call(void 0, error)
7306
7534
  });
7307
7535
  }
7308
7536
  }
7309
7537
  serveConfig.engineHost = config.engineHost;
7310
7538
  serveConfig.enginePort = config.enginePort;
7311
7539
  if ((_a = config.test) == null ? void 0 : _a.enabled) {
7312
- serveConfig.inspectorTestToken = _nullishCoalesce(_chunkBDKVTNJFcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
7540
+ serveConfig.inspectorTestToken = _nullishCoalesce(_chunkYVVFOKEPcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN"), () => ( "token"));
7313
7541
  }
7314
7542
  return serveConfig;
7315
7543
  }
7316
7544
  async function buildRegistryWithRuntime(config, runtime) {
7317
7545
  var _a;
7318
- if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkBDKVTNJFcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
7546
+ if (((_a = config.test) == null ? void 0 : _a.enabled) && _chunkYVVFOKEPcjs.getEnvUniversal.call(void 0, "_RIVET_TEST_INSPECTOR_TOKEN") === void 0) {
7319
7547
  trySetProcessEnv("_RIVET_TEST_INSPECTOR_TOKEN", "token");
7320
7548
  }
7321
7549
  if (runtime.kind === "napi") {
@@ -7382,7 +7610,7 @@ function createApplicationFetch(application, runtime) {
7382
7610
  signal: abortController.signal
7383
7611
  })
7384
7612
  );
7385
- if (!_chunkHEY27WZXcjs.isResponseLike.call(void 0, response)) {
7613
+ if (!_chunkR3UI7MO3cjs.isResponseLike.call(void 0, response)) {
7386
7614
  throw new TypeError(
7387
7615
  "registry.listen() application fetch must return a Response"
7388
7616
  );
@@ -7432,7 +7660,7 @@ var Registry = class {
7432
7660
  var _a;
7433
7661
  this.#config = config;
7434
7662
  if ((_a = config.logging) == null ? void 0 : _a.baseLogger) {
7435
- _chunkBDKVTNJFcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
7663
+ _chunkYVVFOKEPcjs.configureBaseLogger.call(void 0, config.logging.baseLogger);
7436
7664
  }
7437
7665
  this.#buildConfiguredRegistry = _nullishCoalesce((deps == null ? void 0 : deps.buildConfiguredRegistry), () => ( buildConfiguredRegistry));
7438
7666
  this.routes = {
@@ -7658,10 +7886,10 @@ var Registry = class {
7658
7886
  * ```
7659
7887
  */
7660
7888
  async listen(opts = {}) {
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, )));
7889
+ const port = _nullishCoalesce(_nullishCoalesce(opts.port, () => ( _chunkYVVFOKEPcjs.parsePortEnv.call(void 0, process.env.RIVET_PORT))), () => ( 3e3));
7890
+ const publicDir = _nullishCoalesce(opts.publicDir, () => ( _chunkYVVFOKEPcjs.getRivetkitPublicDir.call(void 0, )));
7663
7891
  const config = this.parseConfig();
7664
- if (opts.application && _chunkBDKVTNJFcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
7892
+ if (opts.application && _chunkYVVFOKEPcjs.getRivetkitRuntimeMode.call(void 0, ) !== "serverless") {
7665
7893
  if (config.runtime === "wasm") {
7666
7894
  throw new Error(
7667
7895
  "registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly"
@@ -7737,7 +7965,7 @@ var Registry = class {
7737
7965
  return jsonRouteResponse(503, {
7738
7966
  status: "not_started",
7739
7967
  runtime: "rivetkit",
7740
- version: _chunkBDKVTNJFcjs.VERSION
7968
+ version: _chunkYVVFOKEPcjs.VERSION
7741
7969
  });
7742
7970
  }
7743
7971
  const { runtime, registry } = configured;
@@ -7745,7 +7973,7 @@ var Registry = class {
7745
7973
  return jsonRouteResponse(501, {
7746
7974
  status: "unsupported",
7747
7975
  runtime: "rivetkit",
7748
- version: _chunkBDKVTNJFcjs.VERSION
7976
+ version: _chunkYVVFOKEPcjs.VERSION
7749
7977
  });
7750
7978
  }
7751
7979
  const response = await runtime.registryHealth(registry);
@@ -7819,14 +8047,14 @@ var Registry = class {
7819
8047
  var _a;
7820
8048
  if (!this.#runtimeServePromise) {
7821
8049
  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";
8050
+ const envoyVersionSource = configuredEnvoyVersion !== void 0 ? "config" : _chunkYVVFOKEPcjs.getRivetEnvoyVersion.call(void 0, ) !== void 0 ? "environment" : "default";
7823
8051
  logger2().info({
7824
8052
  msg: "starting rivetkit envoy",
7825
- rivetkitVersion: _chunkBDKVTNJFcjs.VERSION,
8053
+ rivetkitVersion: _chunkYVVFOKEPcjs.VERSION,
7826
8054
  envoyVersion: config.envoy.version,
7827
8055
  envoyVersionSource
7828
8056
  });
7829
- if (envoyVersionSource === "default" && _chunkBDKVTNJFcjs.getNodeEnv.call(void 0, ) === "production") {
8057
+ if (envoyVersionSource === "default" && _chunkYVVFOKEPcjs.getNodeEnv.call(void 0, ) === "production") {
7830
8058
  logger2().error({
7831
8059
  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
8060
  envoyVersion: config.envoy.version,
@@ -8017,7 +8245,7 @@ var Registry = class {
8017
8245
  );
8018
8246
  }
8019
8247
  if (this.#runtimeReadyPromise) return this.#runtimeReadyPromise;
8020
- if (_chunkBDKVTNJFcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8248
+ if (_chunkYVVFOKEPcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8021
8249
  return Promise.reject(
8022
8250
  new Error(
8023
8251
  "registry.startAndWait() requires envoy runtime mode; serverless registries become ready per request"
@@ -8087,8 +8315,8 @@ var Registry = class {
8087
8315
  * ```
8088
8316
  */
8089
8317
  start() {
8090
- if (_chunkBDKVTNJFcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8091
- const publicDir = _nullishCoalesce(_chunkBDKVTNJFcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
8318
+ if (_chunkYVVFOKEPcjs.getRivetkitRuntimeMode.call(void 0, ) === "serverless") {
8319
+ const publicDir = _nullishCoalesce(_chunkYVVFOKEPcjs.getRivetkitPublicDir.call(void 0, ), () => ( "/public"));
8092
8320
  this.listen({ publicDir }).catch((error) => {
8093
8321
  logger2().error({ error }, "auto-listen failed; exiting");
8094
8322
  if (typeof process !== "undefined" && typeof process.exit === "function") {
@@ -8109,13 +8337,13 @@ var Registry = class {
8109
8337
  };
8110
8338
  console.log();
8111
8339
  console.log(
8112
- ` RivetKit ${_chunkBDKVTNJFcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
8340
+ ` RivetKit ${_chunkYVVFOKEPcjs.VERSION} (Engine - ${kind === "serverless" ? "Serverless" : "Serverful"})`
8113
8341
  );
8114
8342
  if (config.namespace !== "default") {
8115
8343
  logLine("Namespace", config.namespace);
8116
8344
  }
8117
8345
  if (config.endpoint) {
8118
- const endpointType = config.startEngine || _chunkHEY27WZXcjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
8346
+ const endpointType = config.startEngine || _chunkR3UI7MO3cjs.isLocalEngineEndpoint.call(void 0, config.endpoint) ? "local native" : "remote";
8119
8347
  logLine("Endpoint", `${config.endpoint} (${endpointType})`);
8120
8348
  }
8121
8349
  if (kind === "serverless" && config.publicEndpoint) {
@@ -8185,5 +8413,5 @@ function setup(input) {
8185
8413
 
8186
8414
 
8187
8415
 
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;
8416
+ exports.ALLOWED_PUBLIC_HEADERS = _chunkR3UI7MO3cjs.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 = _chunkR3UI7MO3cjs.createClientWithDriver; exports.defineRunHandler = _chunkNGJWQMUUcjs.defineRunHandler; exports.event = event; exports.isStaticActorDefinition = isStaticActorDefinition; exports.isStaticActorInstance = isStaticActorInstance; exports.lookupInRegistry = lookupInRegistry; exports.noopNext = _chunkYVVFOKEPcjs.noopNext; exports.queue = queue; exports.setup = setup; exports.toUint8Array = _chunkYVVFOKEPcjs.toUint8Array;
8189
8417
  //# sourceMappingURL=mod.cjs.map