rivetkit 2.1.2 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/dist/browser/client.d.ts +11 -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/inspector.tar.gz +0 -0
  7. package/dist/tsup/{chunk-MNS5LY6M.cjs → chunk-3B6PCYJB.cjs} +280 -115
  8. package/dist/tsup/chunk-3B6PCYJB.cjs.map +1 -0
  9. package/dist/tsup/{chunk-YQ5P6KMN.js → chunk-3GTO6H3E.js} +12 -5
  10. package/dist/tsup/chunk-3GTO6H3E.js.map +1 -0
  11. package/dist/tsup/{chunk-RMJJE43B.cjs → chunk-4KSHPFXF.cjs} +2 -2
  12. package/dist/tsup/{chunk-RMJJE43B.cjs.map → chunk-4KSHPFXF.cjs.map} +1 -1
  13. package/dist/tsup/{chunk-PW3YONDJ.js → chunk-5UEFNG7P.js} +2 -2
  14. package/dist/tsup/{chunk-PSUVV4HM.js → chunk-ANKZ2FS6.js} +2 -4
  15. package/dist/tsup/chunk-ANKZ2FS6.js.map +1 -0
  16. package/dist/tsup/{chunk-GVQAVU7R.cjs → chunk-AQD4CBZ2.cjs} +4 -4
  17. package/dist/tsup/{chunk-GVQAVU7R.cjs.map → chunk-AQD4CBZ2.cjs.map} +1 -1
  18. package/dist/tsup/{chunk-WUXR722E.js → chunk-DZXDUGLL.js} +2 -2
  19. package/dist/tsup/{chunk-WUXR722E.js.map → chunk-DZXDUGLL.js.map} +1 -1
  20. package/dist/tsup/{chunk-NXEHFUDB.cjs → chunk-GXRVSSVD.cjs} +28 -21
  21. package/dist/tsup/chunk-GXRVSSVD.cjs.map +1 -0
  22. package/dist/tsup/{chunk-UZV7NXC6.cjs → chunk-H5TSEPN4.cjs} +30 -30
  23. package/dist/tsup/{chunk-UZV7NXC6.cjs.map → chunk-H5TSEPN4.cjs.map} +1 -1
  24. package/dist/tsup/{chunk-TDFDR7AO.js → chunk-HBYEYBIC.js} +2 -2
  25. package/dist/tsup/{chunk-772NPMTY.cjs → chunk-HKOSZKKZ.cjs} +263 -299
  26. package/dist/tsup/chunk-HKOSZKKZ.cjs.map +1 -0
  27. package/dist/tsup/{chunk-HB4RGGMC.js → chunk-I6PL6QIY.js} +5 -5
  28. package/dist/tsup/{chunk-RHUII57M.js → chunk-KTWY3K6Z.js} +23 -12
  29. package/dist/tsup/chunk-KTWY3K6Z.js.map +1 -0
  30. package/dist/tsup/{chunk-HFWRHT5T.cjs → chunk-LK36OGGO.cjs} +3 -5
  31. package/dist/tsup/chunk-LK36OGGO.cjs.map +1 -0
  32. package/dist/tsup/{chunk-BSIJG3LG.js → chunk-M6H4XIF4.js} +179 -215
  33. package/dist/tsup/chunk-M6H4XIF4.js.map +1 -0
  34. package/dist/tsup/{chunk-ZHQDRRMY.cjs → chunk-QPADHLDU.cjs} +3 -3
  35. package/dist/tsup/{chunk-ZHQDRRMY.cjs.map → chunk-QPADHLDU.cjs.map} +1 -1
  36. package/dist/tsup/{chunk-BFI4LYS2.js → chunk-TEFYRRAK.js} +4 -4
  37. package/dist/tsup/{chunk-PZAV6PP2.cjs → chunk-TEUL4UYN.cjs} +152 -152
  38. package/dist/tsup/{chunk-PZAV6PP2.cjs.map → chunk-TEUL4UYN.cjs.map} +1 -1
  39. package/dist/tsup/{chunk-VMX4I4MP.js → chunk-UDMRZR6A.js} +212 -47
  40. package/dist/tsup/chunk-UDMRZR6A.js.map +1 -0
  41. package/dist/tsup/{chunk-QABDKI3W.cjs → chunk-UWAGLDT6.cjs} +263 -252
  42. package/dist/tsup/chunk-UWAGLDT6.cjs.map +1 -0
  43. package/dist/tsup/client/mod.cjs +6 -6
  44. package/dist/tsup/client/mod.d.cts +2 -2
  45. package/dist/tsup/client/mod.d.ts +2 -2
  46. package/dist/tsup/client/mod.js +5 -5
  47. package/dist/tsup/common/log.cjs +2 -2
  48. package/dist/tsup/common/log.js +1 -1
  49. package/dist/tsup/common/websocket.cjs +3 -3
  50. package/dist/tsup/common/websocket.js +2 -2
  51. package/dist/tsup/{config-P3XujgRr.d.ts → config-Qj-zLJPc.d.ts} +11 -0
  52. package/dist/tsup/{config-_gfywqqI.d.cts → config-iPj5l1bL.d.cts} +11 -0
  53. package/dist/tsup/{context-uNA4TRn3.d.ts → context-CQCMuHND.d.ts} +1 -1
  54. package/dist/tsup/{context-Bxd8Cx4H.d.cts → context-DzvH1PBK.d.cts} +1 -1
  55. package/dist/tsup/{driver-CPGHKXyh.d.ts → driver-Jo8v-kbU.d.ts} +1 -1
  56. package/dist/tsup/driver-helpers/mod.cjs +4 -4
  57. package/dist/tsup/driver-helpers/mod.d.cts +4 -4
  58. package/dist/tsup/driver-helpers/mod.d.ts +4 -4
  59. package/dist/tsup/driver-helpers/mod.js +3 -3
  60. package/dist/tsup/{driver-BcLvZcKl.d.cts → driver-iV8J-WMv.d.cts} +1 -1
  61. package/dist/tsup/driver-test-suite/mod.cjs +556 -333
  62. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  63. package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
  64. package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
  65. package/dist/tsup/driver-test-suite/mod.js +1332 -1109
  66. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  67. package/dist/tsup/inspector/mod.cjs +3 -3
  68. package/dist/tsup/inspector/mod.js +2 -2
  69. package/dist/tsup/mod.cjs +8 -8
  70. package/dist/tsup/mod.d.cts +5 -5
  71. package/dist/tsup/mod.d.ts +5 -5
  72. package/dist/tsup/mod.js +7 -7
  73. package/dist/tsup/serve-test-suite/mod.cjs +194 -100
  74. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
  75. package/dist/tsup/serve-test-suite/mod.js +105 -11
  76. package/dist/tsup/serve-test-suite/mod.js.map +1 -1
  77. package/dist/tsup/test/mod.cjs +10 -10
  78. package/dist/tsup/test/mod.d.cts +1 -1
  79. package/dist/tsup/test/mod.d.ts +1 -1
  80. package/dist/tsup/test/mod.js +6 -6
  81. package/dist/tsup/utils.cjs +2 -2
  82. package/dist/tsup/utils.js +1 -1
  83. package/dist/tsup/workflow/mod.cjs +5 -5
  84. package/dist/tsup/workflow/mod.d.cts +3 -3
  85. package/dist/tsup/workflow/mod.d.ts +3 -3
  86. package/dist/tsup/workflow/mod.js +4 -4
  87. package/package.json +5 -5
  88. package/src/actor/config.ts +0 -2
  89. package/src/actor/instance/mod.ts +30 -6
  90. package/src/actor/router.ts +9 -6
  91. package/src/driver-test-suite/mod.ts +3 -0
  92. package/src/driver-test-suite/tests/actor-db.ts +299 -216
  93. package/src/driver-test-suite/tests/actor-driver.ts +4 -0
  94. package/src/driver-test-suite/tests/actor-lifecycle.ts +157 -0
  95. package/src/driver-test-suite/tests/actor-queue.ts +10 -9
  96. package/src/driver-test-suite/tests/actor-workflow.ts +12 -2
  97. package/src/driver-test-suite/tests/conn-error-serialization.ts +64 -0
  98. package/src/driver-test-suite/utils.ts +8 -8
  99. package/src/drivers/engine/actor-driver.ts +113 -11
  100. package/src/manager/router.ts +20 -6
  101. package/src/{registry → utils}/serve.ts +38 -4
  102. package/src/workflow/context.ts +4 -0
  103. package/src/workflow/driver.ts +4 -1
  104. package/dist/tsup/chunk-772NPMTY.cjs.map +0 -1
  105. package/dist/tsup/chunk-BSIJG3LG.js.map +0 -1
  106. package/dist/tsup/chunk-HFWRHT5T.cjs.map +0 -1
  107. package/dist/tsup/chunk-MNS5LY6M.cjs.map +0 -1
  108. package/dist/tsup/chunk-NXEHFUDB.cjs.map +0 -1
  109. package/dist/tsup/chunk-PSUVV4HM.js.map +0 -1
  110. package/dist/tsup/chunk-QABDKI3W.cjs.map +0 -1
  111. package/dist/tsup/chunk-RHUII57M.js.map +0 -1
  112. package/dist/tsup/chunk-VMX4I4MP.js.map +0 -1
  113. package/dist/tsup/chunk-YQ5P6KMN.js.map +0 -1
  114. /package/dist/tsup/{chunk-PW3YONDJ.js.map → chunk-5UEFNG7P.js.map} +0 -0
  115. /package/dist/tsup/{chunk-TDFDR7AO.js.map → chunk-HBYEYBIC.js.map} +0 -0
  116. /package/dist/tsup/{chunk-HB4RGGMC.js.map → chunk-I6PL6QIY.js.map} +0 -0
  117. /package/dist/tsup/{chunk-BFI4LYS2.js.map → chunk-TEFYRRAK.js.map} +0 -0
@@ -1,6 +1,6 @@
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(); } } var _class;
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(); } } var _class; var _class2;
2
2
 
3
- var _chunkPZAV6PP2cjs = require('./chunk-PZAV6PP2.cjs');
3
+ var _chunkTEUL4UYNcjs = require('./chunk-TEUL4UYN.cjs');
4
4
 
5
5
 
6
6
 
@@ -48,7 +48,7 @@ var _chunkPZAV6PP2cjs = require('./chunk-PZAV6PP2.cjs');
48
48
 
49
49
 
50
50
 
51
- var _chunkMNS5LY6Mcjs = require('./chunk-MNS5LY6M.cjs');
51
+ var _chunk3B6PCYJBcjs = require('./chunk-3B6PCYJB.cjs');
52
52
 
53
53
 
54
54
 
@@ -69,7 +69,7 @@ var _chunkMNS5LY6Mcjs = require('./chunk-MNS5LY6M.cjs');
69
69
 
70
70
 
71
71
 
72
- var _chunkHFWRHT5Tcjs = require('./chunk-HFWRHT5T.cjs');
72
+ var _chunkLK36OGGOcjs = require('./chunk-LK36OGGO.cjs');
73
73
 
74
74
 
75
75
 
@@ -86,7 +86,7 @@ var _chunkHFWRHT5Tcjs = require('./chunk-HFWRHT5T.cjs');
86
86
 
87
87
 
88
88
 
89
- var _chunkRMJJE43Bcjs = require('./chunk-RMJJE43B.cjs');
89
+ var _chunk4KSHPFXFcjs = require('./chunk-4KSHPFXF.cjs');
90
90
 
91
91
 
92
92
 
@@ -124,7 +124,7 @@ var ActorInspector = (_class = class {
124
124
  this.actor = actor;
125
125
  var _a, _b;
126
126
  this.#lastQueueSize = _nullishCoalesce(((_a = actor.queueManager) == null ? void 0 : _a.size), () => ( 0));
127
- const runInspector = _chunkHFWRHT5Tcjs.getRunInspectorConfig.call(void 0, actor.config.run);
127
+ const runInspector = _chunkLK36OGGOcjs.getRunInspectorConfig.call(void 0, actor.config.run);
128
128
  this.#workflowInspector = runInspector == null ? void 0 : runInspector.workflow;
129
129
  if ((_b = this.#workflowInspector) == null ? void 0 : _b.onHistoryUpdated) {
130
130
  this.#workflowInspector.onHistoryUpdated((history) => {
@@ -218,7 +218,7 @@ var ActorInspector = (_class = class {
218
218
  records: _nullishCoalesce(((_a = countResult == null ? void 0 : countResult[0]) == null ? void 0 : _a.count), () => ( 0))
219
219
  });
220
220
  }
221
- return _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor.encode({ tables: tableInfos }));
221
+ return _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor.encode({ tables: tableInfos }));
222
222
  }
223
223
  async getDatabaseTableRows(table, limit, offset) {
224
224
  if (!this.isDatabaseEnabled()) {
@@ -233,7 +233,7 @@ var ActorInspector = (_class = class {
233
233
  safeLimit,
234
234
  safeOffset
235
235
  );
236
- return _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor.encode(result));
236
+ return _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor.encode(result));
237
237
  }
238
238
  isStateEnabled() {
239
239
  return this.actor.stateEnabled;
@@ -242,7 +242,7 @@ var ActorInspector = (_class = class {
242
242
  if (!this.actor.stateEnabled) {
243
243
  throw new (0, _chunkL47L3ZWJcjs.StateNotEnabled)();
244
244
  }
245
- return _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0,
245
+ return _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0,
246
246
  cbor.encode(this.actor.stateManager.persistRaw.state)
247
247
  );
248
248
  }
@@ -254,13 +254,13 @@ var ActorInspector = (_class = class {
254
254
  this.actor.connectionManager.connections.entries()
255
255
  ).map(([id, conn]) => {
256
256
  var _a, _b;
257
- const connStateManager = conn[_chunkMNS5LY6Mcjs.CONN_STATE_MANAGER_SYMBOL];
257
+ const connStateManager = conn[_chunk3B6PCYJBcjs.CONN_STATE_MANAGER_SYMBOL];
258
258
  return {
259
- type: (_a = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
259
+ type: (_a = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
260
260
  id,
261
- details: _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0,
261
+ details: _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0,
262
262
  cbor.encode({
263
- type: (_b = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _b.type,
263
+ type: (_b = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _b.type,
264
264
  params: conn.params,
265
265
  stateEnabled: connStateManager.stateEnabled,
266
266
  state: connStateManager.stateEnabled ? connStateManager.state : void 0,
@@ -282,7 +282,7 @@ var ActorInspector = (_class = class {
282
282
  }
283
283
  async executeAction(name, params) {
284
284
  const conn = await this.actor.connectionManager.prepareAndConnectConn(
285
- _chunkMNS5LY6Mcjs.createHttpDriver.call(void 0, ),
285
+ _chunk3B6PCYJBcjs.createHttpDriver.call(void 0, ),
286
286
  // TODO: This may cause issues
287
287
  void 0,
288
288
  void 0,
@@ -290,10 +290,10 @@ var ActorInspector = (_class = class {
290
290
  void 0
291
291
  );
292
292
  try {
293
- return _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0,
293
+ return _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0,
294
294
  cbor.encode(
295
295
  await this.actor.executeAction(
296
- new (0, _chunkMNS5LY6Mcjs.ActionContext)(this.actor, conn),
296
+ new (0, _chunk3B6PCYJBcjs.ActionContext)(this.actor, conn),
297
297
  name,
298
298
  cbor.decode(Buffer.from(params))
299
299
  )
@@ -323,12 +323,12 @@ var ActorInspector = (_class = class {
323
323
  this.actor.connectionManager.connections.entries()
324
324
  ).map(([id, conn]) => {
325
325
  var _a, _b;
326
- const connStateManager = conn[_chunkMNS5LY6Mcjs.CONN_STATE_MANAGER_SYMBOL];
326
+ const connStateManager = conn[_chunk3B6PCYJBcjs.CONN_STATE_MANAGER_SYMBOL];
327
327
  return {
328
- type: (_a = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
328
+ type: (_a = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
329
329
  id,
330
330
  details: {
331
- type: (_b = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _b.type,
331
+ type: (_b = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _b.type,
332
332
  params: conn.params,
333
333
  stateEnabled: connStateManager.stateEnabled,
334
334
  state: connStateManager.stateEnabled ? connStateManager.state : void 0,
@@ -340,7 +340,7 @@ var ActorInspector = (_class = class {
340
340
  }
341
341
  async executeActionJson(name, args) {
342
342
  const conn = await this.actor.connectionManager.prepareAndConnectConn(
343
- _chunkMNS5LY6Mcjs.createHttpDriver.call(void 0, ),
343
+ _chunk3B6PCYJBcjs.createHttpDriver.call(void 0, ),
344
344
  void 0,
345
345
  void 0,
346
346
  void 0,
@@ -348,7 +348,7 @@ var ActorInspector = (_class = class {
348
348
  );
349
349
  try {
350
350
  return await this.actor.executeAction(
351
- new (0, _chunkMNS5LY6Mcjs.ActionContext)(this.actor, conn),
351
+ new (0, _chunk3B6PCYJBcjs.ActionContext)(this.actor, conn),
352
352
  name,
353
353
  args
354
354
  );
@@ -391,8 +391,8 @@ function escapeDoubleQuotes(value) {
391
391
  function convertConnToBarePersistedConn(persist) {
392
392
  return {
393
393
  id: persist.id,
394
- parameters: _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(persist.parameters)),
395
- state: _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(persist.state)),
394
+ parameters: _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(persist.parameters)),
395
+ state: _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor2.encode(persist.state)),
396
396
  subscriptions: persist.subscriptions.map((sub) => ({
397
397
  eventName: sub.eventName
398
398
  })),
@@ -484,7 +484,7 @@ var ConnectionManager = class {
484
484
  return this.#reconnectHibernatableConn(driver);
485
485
  }
486
486
  if (this.#actor.config.onBeforeConnect) {
487
- const ctx = new (0, _chunkMNS5LY6Mcjs.BeforeConnectContext)(this.#actor, request);
487
+ const ctx = new (0, _chunk3B6PCYJBcjs.BeforeConnectContext)(this.#actor, request);
488
488
  await this.#actor.runInTraceSpan(
489
489
  "actor.onBeforeConnect",
490
490
  {
@@ -530,8 +530,8 @@ var ConnectionManager = class {
530
530
  }
531
531
  };
532
532
  }
533
- const conn = new (0, _chunkMNS5LY6Mcjs.Conn)(this.#actor, connData);
534
- conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL] = driver;
533
+ const conn = new (0, _chunk3B6PCYJBcjs.Conn)(this.#actor, connData);
534
+ conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL] = driver;
535
535
  return conn;
536
536
  }
537
537
  /**
@@ -554,15 +554,15 @@ var ConnectionManager = class {
554
554
  this.#callOnConnect(conn);
555
555
  this.#actor.inspector.emitter.emit("connectionsUpdated");
556
556
  this.#actor.resetSleepTimer();
557
- conn[_chunkMNS5LY6Mcjs.CONN_CONNECTED_SYMBOL] = true;
558
- if (conn[_chunkMNS5LY6Mcjs.CONN_SPEAKS_RIVETKIT_SYMBOL]) {
557
+ conn[_chunk3B6PCYJBcjs.CONN_CONNECTED_SYMBOL] = true;
558
+ if (conn[_chunk3B6PCYJBcjs.CONN_SPEAKS_RIVETKIT_SYMBOL]) {
559
559
  const initData = { actorId: this.#actor.id, connectionId: conn.id };
560
- conn[_chunkMNS5LY6Mcjs.CONN_SEND_MESSAGE_SYMBOL](
561
- new (0, _chunkMNS5LY6Mcjs.CachedSerializer)(
560
+ conn[_chunk3B6PCYJBcjs.CONN_SEND_MESSAGE_SYMBOL](
561
+ new (0, _chunk3B6PCYJBcjs.CachedSerializer)(
562
562
  initData,
563
- _chunkMNS5LY6Mcjs.TO_CLIENT_VERSIONED,
564
- _chunkMNS5LY6Mcjs.CURRENT_VERSION,
565
- _chunkMNS5LY6Mcjs.ToClientSchema,
563
+ _chunk3B6PCYJBcjs.TO_CLIENT_VERSIONED,
564
+ _chunk3B6PCYJBcjs.CURRENT_VERSION,
565
+ _chunk3B6PCYJBcjs.ToClientSchema,
566
566
  // JSON: identity conversion (no nested data to encode)
567
567
  (value) => ({
568
568
  body: {
@@ -595,17 +595,17 @@ var ConnectionManager = class {
595
595
  msg: "reconnecting hibernatable websocket connection",
596
596
  connectionId: existingConn.id
597
597
  });
598
- if (existingConn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) {
598
+ if (existingConn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) {
599
599
  this.#disconnectExistingDriver(existingConn);
600
600
  }
601
- existingConn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL] = driver;
601
+ existingConn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL] = driver;
602
602
  this.#actor.resetSleepTimer();
603
- existingConn[_chunkMNS5LY6Mcjs.CONN_CONNECTED_SYMBOL] = true;
603
+ existingConn[_chunk3B6PCYJBcjs.CONN_CONNECTED_SYMBOL] = true;
604
604
  this.#actor.inspector.emitter.emit("connectionsUpdated");
605
605
  return existingConn;
606
606
  }
607
607
  #disconnectExistingDriver(conn) {
608
- const driver = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL];
608
+ const driver = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL];
609
609
  if (driver == null ? void 0 : driver.disconnect) {
610
610
  driver.disconnect(
611
611
  this.#actor,
@@ -633,7 +633,7 @@ var ConnectionManager = class {
633
633
  this.#pendingDisconnectCount += 1;
634
634
  const attributes = {
635
635
  "rivet.conn.id": conn.id,
636
- "rivet.conn.type": (_a = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
636
+ "rivet.conn.type": (_a = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
637
637
  "rivet.conn.hibernatable": conn.isHibernatable
638
638
  };
639
639
  const span = this.#actor.startTraceSpan(
@@ -669,16 +669,16 @@ var ConnectionManager = class {
669
669
  } catch (error) {
670
670
  this.#actor.endTraceSpan(span, {
671
671
  code: "ERROR",
672
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
672
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
673
673
  });
674
674
  this.#actor.rLog.error({
675
675
  msg: "error in `onDisconnect`",
676
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
676
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
677
677
  });
678
678
  } finally {
679
679
  this.#connsWithPersistChanged.delete(conn.id);
680
680
  if (conn.isHibernatable) {
681
- const key = _chunkHFWRHT5Tcjs.makeConnKey.call(void 0, conn.id);
681
+ const key = _chunkLK36OGGOcjs.makeConnKey.call(void 0, conn.id);
682
682
  try {
683
683
  await this.#actor.driver.kvBatchDelete(this.#actor.id, [key]);
684
684
  this.#actor.rLog.debug({
@@ -688,7 +688,7 @@ var ConnectionManager = class {
688
688
  } catch (err) {
689
689
  this.#actor.rLog.error({
690
690
  msg: "kvBatchDelete failed for conn",
691
- err: _chunkRMJJE43Bcjs.stringifyError.call(void 0, err)
691
+ err: _chunk4KSHPFXFcjs.stringifyError.call(void 0, err)
692
692
  });
693
693
  }
694
694
  }
@@ -701,7 +701,7 @@ var ConnectionManager = class {
701
701
  }
702
702
  async cleanupPersistedHibernatableConnections(reason) {
703
703
  const staleConnections = Array.from(this.#connections.values()).filter(
704
- (conn) => conn.isHibernatable && conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL] === void 0
704
+ (conn) => conn.isHibernatable && conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL] === void 0
705
705
  );
706
706
  if (staleConnections.length === 0) {
707
707
  return 0;
@@ -738,7 +738,7 @@ var ConnectionManager = class {
738
738
  */
739
739
  restoreConnections(connections) {
740
740
  for (const connPersist of connections) {
741
- const conn = new (0, _chunkMNS5LY6Mcjs.Conn)(this.#actor, {
741
+ const conn = new (0, _chunk3B6PCYJBcjs.Conn)(this.#actor, {
742
742
  hibernatable: connPersist
743
743
  });
744
744
  this.#connections.set(conn.id, conn);
@@ -757,22 +757,22 @@ var ConnectionManager = class {
757
757
  // MARK: - Private Helpers
758
758
  findHibernatableConn(gatewayIdBuf, requestIdBuf) {
759
759
  return Array.from(this.#connections.values()).find((conn) => {
760
- const connStateManager = conn[_chunkMNS5LY6Mcjs.CONN_STATE_MANAGER_SYMBOL];
760
+ const connStateManager = conn[_chunk3B6PCYJBcjs.CONN_STATE_MANAGER_SYMBOL];
761
761
  const h = connStateManager.hibernatableDataRaw;
762
- return h && _chunkRMJJE43Bcjs.arrayBuffersEqual.call(void 0, h.gatewayId, gatewayIdBuf) && _chunkRMJJE43Bcjs.arrayBuffersEqual.call(void 0, h.requestId, requestIdBuf);
762
+ return h && _chunk4KSHPFXFcjs.arrayBuffersEqual.call(void 0, h.gatewayId, gatewayIdBuf) && _chunk4KSHPFXFcjs.arrayBuffersEqual.call(void 0, h.requestId, requestIdBuf);
763
763
  });
764
764
  }
765
765
  async #createConnState(params, request) {
766
766
  if ("createConnState" in this.#actor.config) {
767
767
  const createConnState = this.#actor.config.createConnState;
768
- const ctx = new (0, _chunkMNS5LY6Mcjs.CreateConnStateContext)(this.#actor, request);
768
+ const ctx = new (0, _chunk3B6PCYJBcjs.CreateConnStateContext)(this.#actor, request);
769
769
  return await this.#actor.runInTraceSpan(
770
770
  "actor.createConnState",
771
771
  void 0,
772
772
  () => {
773
773
  const dataOrPromise = createConnState(ctx, params);
774
774
  if (dataOrPromise instanceof Promise) {
775
- return _chunkHFWRHT5Tcjs.deadline.call(void 0,
775
+ return _chunkLK36OGGOcjs.deadline.call(void 0,
776
776
  dataOrPromise,
777
777
  this.#actor.config.options.createConnStateTimeout
778
778
  );
@@ -791,13 +791,13 @@ var ConnectionManager = class {
791
791
  var _a;
792
792
  const attributes = {
793
793
  "rivet.conn.id": conn.id,
794
- "rivet.conn.type": (_a = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
794
+ "rivet.conn.type": (_a = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.type,
795
795
  "rivet.conn.hibernatable": conn.isHibernatable
796
796
  };
797
797
  const span = this.#actor.startTraceSpan("actor.onConnect", attributes);
798
798
  try {
799
799
  if (this.#actor.config.onConnect) {
800
- const ctx = new (0, _chunkMNS5LY6Mcjs.ConnectContext)(this.#actor, conn);
800
+ const ctx = new (0, _chunk3B6PCYJBcjs.ConnectContext)(this.#actor, conn);
801
801
  const result = this.#actor.traces.withSpan(
802
802
  span,
803
803
  () => this.#actor.config.onConnect(ctx, conn)
@@ -808,7 +808,7 @@ var ConnectionManager = class {
808
808
  span
809
809
  );
810
810
  if (result instanceof Promise) {
811
- _chunkHFWRHT5Tcjs.deadline.call(void 0,
811
+ _chunkLK36OGGOcjs.deadline.call(void 0,
812
812
  result,
813
813
  this.#actor.config.options.onConnectTimeout
814
814
  ).then(() => {
@@ -816,7 +816,7 @@ var ConnectionManager = class {
816
816
  }).catch((error) => {
817
817
  this.#actor.endTraceSpan(span, {
818
818
  code: "ERROR",
819
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
819
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
820
820
  });
821
821
  this.#actor.rLog.error({
822
822
  msg: "error in `onConnect`, closing socket",
@@ -832,11 +832,11 @@ var ConnectionManager = class {
832
832
  } catch (error) {
833
833
  this.#actor.endTraceSpan(span, {
834
834
  code: "ERROR",
835
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
835
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
836
836
  });
837
837
  this.#actor.rLog.error({
838
838
  msg: "error in `onConnect`",
839
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
839
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
840
840
  });
841
841
  conn == null ? void 0 : conn.disconnect("`onConnect` failed");
842
842
  }
@@ -876,7 +876,7 @@ var EventManager = class {
876
876
  }
877
877
  subscribers.add(connection);
878
878
  if (!fromPersist) {
879
- connection[_chunkMNS5LY6Mcjs.CONN_STATE_MANAGER_SYMBOL].addSubscription({
879
+ connection[_chunk3B6PCYJBcjs.CONN_STATE_MANAGER_SYMBOL].addSubscription({
880
880
  eventName
881
881
  });
882
882
  this.#actor.stateManager.saveState({ immediate: true });
@@ -913,7 +913,7 @@ var EventManager = class {
913
913
  }
914
914
  }
915
915
  if (!fromRemoveConn) {
916
- const removed = connection[_chunkMNS5LY6Mcjs.CONN_STATE_MANAGER_SYMBOL].removeSubscription({ eventName });
916
+ const removed = connection[_chunk3B6PCYJBcjs.CONN_STATE_MANAGER_SYMBOL].removeSubscription({ eventName });
917
917
  if (!removed) {
918
918
  this.#actor.rLog.warn({
919
919
  msg: "subscription does not exist in persist",
@@ -951,11 +951,11 @@ var EventManager = class {
951
951
  "rivet.broadcast.subscribers": subscribers.size
952
952
  });
953
953
  const eventData = { name, args };
954
- const toClientSerializer = new (0, _chunkMNS5LY6Mcjs.CachedSerializer)(
954
+ const toClientSerializer = new (0, _chunk3B6PCYJBcjs.CachedSerializer)(
955
955
  eventData,
956
- _chunkMNS5LY6Mcjs.TO_CLIENT_VERSIONED,
957
- _chunkMNS5LY6Mcjs.CURRENT_VERSION,
958
- _chunkMNS5LY6Mcjs.ToClientSchema,
956
+ _chunk3B6PCYJBcjs.TO_CLIENT_VERSIONED,
957
+ _chunk3B6PCYJBcjs.CURRENT_VERSION,
958
+ _chunk3B6PCYJBcjs.ToClientSchema,
959
959
  // JSON: args is the raw value (array of arguments)
960
960
  (value) => ({
961
961
  body: {
@@ -972,16 +972,16 @@ var EventManager = class {
972
972
  tag: "Event",
973
973
  val: {
974
974
  name: value.name,
975
- args: _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor3.encode(value.args))
975
+ args: _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor3.encode(value.args))
976
976
  }
977
977
  }
978
978
  })
979
979
  );
980
980
  let sentCount = 0;
981
981
  for (const connection of subscribers) {
982
- if (connection[_chunkMNS5LY6Mcjs.CONN_SPEAKS_RIVETKIT_SYMBOL]) {
982
+ if (connection[_chunk3B6PCYJBcjs.CONN_SPEAKS_RIVETKIT_SYMBOL]) {
983
983
  try {
984
- connection[_chunkMNS5LY6Mcjs.CONN_SEND_MESSAGE_SYMBOL](toClientSerializer);
984
+ connection[_chunk3B6PCYJBcjs.CONN_SEND_MESSAGE_SYMBOL](toClientSerializer);
985
985
  sentCount++;
986
986
  } catch (error) {
987
987
  if (error instanceof _chunkL47L3ZWJcjs.OutgoingMessageTooLong) {
@@ -1067,9 +1067,9 @@ var EventManager = class {
1067
1067
 
1068
1068
  function convertActorToBarePersisted(persist) {
1069
1069
  return {
1070
- input: persist.input !== void 0 ? _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor4.encode(persist.input)) : null,
1070
+ input: persist.input !== void 0 ? _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor4.encode(persist.input)) : null,
1071
1071
  hasInitialized: persist.hasInitialized,
1072
- state: _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor4.encode(persist.state)),
1072
+ state: _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor4.encode(persist.state)),
1073
1073
  scheduledEvents: persist.scheduledEvents.map((event) => ({
1074
1074
  eventId: event.eventId,
1075
1075
  timestamp: BigInt(event.timestamp),
@@ -1098,8 +1098,8 @@ var DEFAULT_METADATA = {
1098
1098
  nextId: 1n,
1099
1099
  size: 0
1100
1100
  };
1101
- var QUEUE_METADATA_KEY = _chunkHFWRHT5Tcjs.queueMetadataKey.call(void 0, );
1102
- var QUEUE_MESSAGES_PREFIX = _chunkHFWRHT5Tcjs.queueMessagesPrefix.call(void 0, );
1101
+ var QUEUE_METADATA_KEY = _chunkLK36OGGOcjs.queueMetadataKey.call(void 0, );
1102
+ var QUEUE_MESSAGES_PREFIX = _chunkLK36OGGOcjs.queueMessagesPrefix.call(void 0, );
1103
1103
  var QueueManager = class {
1104
1104
  #actor;
1105
1105
  #driver;
@@ -1128,7 +1128,7 @@ var QueueManager = class {
1128
1128
  return;
1129
1129
  }
1130
1130
  try {
1131
- const decoded = _chunkMNS5LY6Mcjs.QUEUE_METADATA_VERSIONED.deserializeWithEmbeddedVersion(
1131
+ const decoded = _chunk3B6PCYJBcjs.QUEUE_METADATA_VERSIONED.deserializeWithEmbeddedVersion(
1132
1132
  metadataBuffer
1133
1133
  );
1134
1134
  this.#metadata.nextId = decoded.nextId;
@@ -1150,14 +1150,14 @@ var QueueManager = class {
1150
1150
  throw new (0, _chunkL47L3ZWJcjs.QueueFull)(sizeLimit);
1151
1151
  }
1152
1152
  let invalidPath = "";
1153
- if (!_chunkRMJJE43Bcjs.isCborSerializable.call(void 0, body, (path) => {
1153
+ if (!_chunk4KSHPFXFcjs.isCborSerializable.call(void 0, body, (path) => {
1154
1154
  invalidPath = path;
1155
1155
  })) {
1156
1156
  throw new (0, _chunkL47L3ZWJcjs.QueueMessageInvalid)(invalidPath);
1157
1157
  }
1158
1158
  const createdAt = Date.now();
1159
1159
  const bodyCborBuffer = cbor5.encode(body);
1160
- const encodedMessage = _chunkMNS5LY6Mcjs.QUEUE_MESSAGE_VERSIONED.serializeWithEmbeddedVersion(
1160
+ const encodedMessage = _chunk3B6PCYJBcjs.QUEUE_MESSAGE_VERSIONED.serializeWithEmbeddedVersion(
1161
1161
  {
1162
1162
  name,
1163
1163
  body: new Uint8Array(bodyCborBuffer).buffer,
@@ -1167,7 +1167,7 @@ var QueueManager = class {
1167
1167
  inFlight: null,
1168
1168
  inFlightAt: null
1169
1169
  },
1170
- _chunkMNS5LY6Mcjs.CURRENT_VERSION2
1170
+ _chunk3B6PCYJBcjs.CURRENT_VERSION2
1171
1171
  );
1172
1172
  const encodedSize = encodedMessage.byteLength;
1173
1173
  if (encodedSize > this.#actor.config.options.maxQueueMessageSize) {
@@ -1177,7 +1177,7 @@ var QueueManager = class {
1177
1177
  );
1178
1178
  }
1179
1179
  const id = this.#metadata.nextId;
1180
- const messageKey = _chunkHFWRHT5Tcjs.makeQueueMessageKey.call(void 0, id);
1180
+ const messageKey = _chunkLK36OGGOcjs.makeQueueMessageKey.call(void 0, id);
1181
1181
  this.#metadata.nextId = id + 1n;
1182
1182
  this.#metadata.size += 1;
1183
1183
  const encodedMetadata = this.#serializeMetadata();
@@ -1206,7 +1206,7 @@ var QueueManager = class {
1206
1206
  }
1207
1207
  const message = await this.enqueue(name, body);
1208
1208
  const messageId = message.id.toString();
1209
- const { promise, resolve } = _chunkRMJJE43Bcjs.promiseWithResolvers.call(void 0, () => {
1209
+ const { promise, resolve } = _chunk4KSHPFXFcjs.promiseWithResolvers.call(void 0, () => {
1210
1210
  });
1211
1211
  const pending = { resolve };
1212
1212
  if (timeout !== void 0) {
@@ -1249,7 +1249,7 @@ var QueueManager = class {
1249
1249
  if (timeout === 0) {
1250
1250
  return [];
1251
1251
  }
1252
- const { promise, resolve, reject } = _chunkRMJJE43Bcjs.promiseWithResolvers.call(void 0, () => {
1252
+ const { promise, resolve, reject } = _chunk4KSHPFXFcjs.promiseWithResolvers.call(void 0, () => {
1253
1253
  });
1254
1254
  const waiterId = crypto.randomUUID();
1255
1255
  let timeoutHandle;
@@ -1415,8 +1415,8 @@ var QueueManager = class {
1415
1415
  const decoded = [];
1416
1416
  for (const [key, value] of entries) {
1417
1417
  try {
1418
- const messageId = _chunkHFWRHT5Tcjs.decodeQueueMessageKey.call(void 0, key);
1419
- const decodedPayload = _chunkMNS5LY6Mcjs.QUEUE_MESSAGE_VERSIONED.deserializeWithEmbeddedVersion(
1418
+ const messageId = _chunkLK36OGGOcjs.decodeQueueMessageKey.call(void 0, key);
1419
+ const decodedPayload = _chunk3B6PCYJBcjs.QUEUE_MESSAGE_VERSIONED.deserializeWithEmbeddedVersion(
1420
1420
  value
1421
1421
  );
1422
1422
  const body = cbor5.decode(new Uint8Array(decodedPayload.body));
@@ -1463,7 +1463,7 @@ var QueueManager = class {
1463
1463
  if (messages.length === 0) {
1464
1464
  return;
1465
1465
  }
1466
- const keys = messages.map((message) => _chunkHFWRHT5Tcjs.makeQueueMessageKey.call(void 0, message.id));
1466
+ const keys = messages.map((message) => _chunkLK36OGGOcjs.makeQueueMessageKey.call(void 0, message.id));
1467
1467
  this.#metadata.size = Math.max(
1468
1468
  0,
1469
1469
  this.#metadata.size - messages.length
@@ -1501,7 +1501,7 @@ var QueueManager = class {
1501
1501
  let maxId = 0n;
1502
1502
  for (const [key] of entries) {
1503
1503
  try {
1504
- const messageId = _chunkHFWRHT5Tcjs.decodeQueueMessageKey.call(void 0, key);
1504
+ const messageId = _chunkLK36OGGOcjs.decodeQueueMessageKey.call(void 0, key);
1505
1505
  if (messageId > maxId) {
1506
1506
  maxId = messageId;
1507
1507
  }
@@ -1516,12 +1516,12 @@ var QueueManager = class {
1516
1516
  this.#actor.inspector.updateQueueSize(this.#metadata.size);
1517
1517
  }
1518
1518
  #serializeMetadata() {
1519
- return _chunkMNS5LY6Mcjs.QUEUE_METADATA_VERSIONED.serializeWithEmbeddedVersion(
1519
+ return _chunk3B6PCYJBcjs.QUEUE_METADATA_VERSIONED.serializeWithEmbeddedVersion(
1520
1520
  {
1521
1521
  nextId: this.#metadata.nextId,
1522
1522
  size: this.#metadata.size
1523
1523
  },
1524
- _chunkMNS5LY6Mcjs.CURRENT_VERSION2
1524
+ _chunk3B6PCYJBcjs.CURRENT_VERSION2
1525
1525
  );
1526
1526
  }
1527
1527
  };
@@ -1531,7 +1531,7 @@ var QueueManager = class {
1531
1531
  var ScheduleManager = class {
1532
1532
  #actor;
1533
1533
  #actorDriver;
1534
- #alarmWriteQueue = new (0, _chunkRMJJE43Bcjs.SinglePromiseQueue)();
1534
+ #alarmWriteQueue = new (0, _chunk4KSHPFXFcjs.SinglePromiseQueue)();
1535
1535
  #config;
1536
1536
  // ActorConfig type
1537
1537
  #persist;
@@ -1561,7 +1561,7 @@ var ScheduleManager = class {
1561
1561
  eventId: crypto.randomUUID(),
1562
1562
  timestamp,
1563
1563
  action,
1564
- args: _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, cbor6.encode(args))
1564
+ args: _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, cbor6.encode(args))
1565
1565
  };
1566
1566
  this.#actor.emitTraceEvent("schedule.created", {
1567
1567
  "rivet.schedule.event_id": newEvent.eventId,
@@ -1776,16 +1776,16 @@ var ScheduleManager = class {
1776
1776
  });
1777
1777
  } catch (error) {
1778
1778
  this.#actor.traces.setAttributes(span, {
1779
- "error.message": _chunkRMJJE43Bcjs.stringifyError.call(void 0, error),
1779
+ "error.message": _chunk4KSHPFXFcjs.stringifyError.call(void 0, error),
1780
1780
  "error.type": error instanceof Error ? error.name : typeof error
1781
1781
  });
1782
1782
  this.#actor.endTraceSpan(span, {
1783
1783
  code: "ERROR",
1784
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
1784
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
1785
1785
  });
1786
1786
  this.#actor.log.error({
1787
1787
  msg: "error executing scheduled event",
1788
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error),
1788
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error),
1789
1789
  eventId: event.eventId,
1790
1790
  timestamp: event.timestamp,
1791
1791
  action: event.action
@@ -1840,7 +1840,7 @@ var StateManager = class {
1840
1840
  #persistChanged = false;
1841
1841
  #isInOnStateChange = false;
1842
1842
  // Save management
1843
- #persistWriteQueue = new (0, _chunkRMJJE43Bcjs.SinglePromiseQueue)();
1843
+ #persistWriteQueue = new (0, _chunk4KSHPFXFcjs.SinglePromiseQueue)();
1844
1844
  #lastSaveTime = 0;
1845
1845
  #pendingSaveTimeout;
1846
1846
  #pendingSaveScheduledTimestamp;
@@ -1909,10 +1909,10 @@ var StateManager = class {
1909
1909
  const bareData = convertActorToBarePersisted(persistData);
1910
1910
  await this.#actorDriver.kvBatchPut(this.#actor.id, [
1911
1911
  [
1912
- _chunkHFWRHT5Tcjs.KEYS.PERSIST_DATA,
1913
- _chunkMNS5LY6Mcjs.ACTOR_VERSIONED.serializeWithEmbeddedVersion(
1912
+ _chunkLK36OGGOcjs.KEYS.PERSIST_DATA,
1913
+ _chunk3B6PCYJBcjs.ACTOR_VERSIONED.serializeWithEmbeddedVersion(
1914
1914
  bareData,
1915
- _chunkMNS5LY6Mcjs.CURRENT_VERSION2
1915
+ _chunk3B6PCYJBcjs.CURRENT_VERSION2
1916
1916
  )
1917
1917
  ]
1918
1918
  ]);
@@ -1926,7 +1926,7 @@ var StateManager = class {
1926
1926
  this.#persistRaw = target;
1927
1927
  if (target === null || typeof target !== "object") {
1928
1928
  let invalidPath = "";
1929
- if (!_chunkRMJJE43Bcjs.isCborSerializable.call(void 0,
1929
+ if (!_chunk4KSHPFXFcjs.isCborSerializable.call(void 0,
1930
1930
  target,
1931
1931
  (path) => {
1932
1932
  invalidPath = path;
@@ -1960,7 +1960,7 @@ var StateManager = class {
1960
1960
  await this.#savePersistInner();
1961
1961
  } else {
1962
1962
  if (!this.#onPersistSavedPromise) {
1963
- this.#onPersistSavedPromise = _chunkRMJJE43Bcjs.promiseWithResolvers.call(void 0, (reason) => _chunkHFWRHT5Tcjs.loggerWithoutContext.call(void 0, ).warn({ msg: "unhandled persist saved promise rejection", reason }));
1963
+ this.#onPersistSavedPromise = _chunk4KSHPFXFcjs.promiseWithResolvers.call(void 0, (reason) => _chunkLK36OGGOcjs.loggerWithoutContext.call(void 0, ).warn({ msg: "unhandled persist saved promise rejection", reason }));
1964
1964
  }
1965
1965
  this.savePersistThrottled(opts.maxWait);
1966
1966
  await ((_a = this.#onPersistSavedPromise) == null ? void 0 : _a.promise);
@@ -2001,7 +2001,7 @@ var StateManager = class {
2001
2001
  this.#savePersistInner().catch((error) => {
2002
2002
  this.#actor.rLog.error({
2003
2003
  msg: "error saving persist data in scheduled save",
2004
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2004
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2005
2005
  });
2006
2006
  });
2007
2007
  }, saveDelay);
@@ -2009,7 +2009,7 @@ var StateManager = class {
2009
2009
  this.#savePersistInner().catch((error) => {
2010
2010
  this.#actor.rLog.error({
2011
2011
  msg: "error saving persist data immediately",
2012
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2012
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2013
2013
  });
2014
2014
  });
2015
2015
  }
@@ -2039,11 +2039,11 @@ var StateManager = class {
2039
2039
  }
2040
2040
  }
2041
2041
  #handleStateChange(path, value) {
2042
- const actorStatePath = _chunkHFWRHT5Tcjs.isStatePath.call(void 0, path);
2043
- const connStatePath = _chunkHFWRHT5Tcjs.isConnStatePath.call(void 0, path);
2042
+ const actorStatePath = _chunkLK36OGGOcjs.isStatePath.call(void 0, path);
2043
+ const connStatePath = _chunkLK36OGGOcjs.isConnStatePath.call(void 0, path);
2044
2044
  if (actorStatePath || connStatePath) {
2045
2045
  let invalidPath = "";
2046
- if (!_chunkRMJJE43Bcjs.isCborSerializable.call(void 0,
2046
+ if (!_chunk4KSHPFXFcjs.isCborSerializable.call(void 0,
2047
2047
  value,
2048
2048
  (invalidPathPart) => {
2049
2049
  invalidPath = invalidPathPart;
@@ -2083,11 +2083,11 @@ var StateManager = class {
2083
2083
  } catch (error) {
2084
2084
  this.#actor.endTraceSpan(span, {
2085
2085
  code: "ERROR",
2086
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2086
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2087
2087
  });
2088
2088
  this.#actor.rLog.error({
2089
2089
  msg: "error in `_onStateChange`",
2090
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2090
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2091
2091
  });
2092
2092
  } finally {
2093
2093
  this.#isInOnStateChange = false;
@@ -2121,10 +2121,10 @@ var StateManager = class {
2121
2121
  this.#persistRaw
2122
2122
  );
2123
2123
  entries.push([
2124
- _chunkHFWRHT5Tcjs.KEYS.PERSIST_DATA,
2125
- _chunkMNS5LY6Mcjs.ACTOR_VERSIONED.serializeWithEmbeddedVersion(
2124
+ _chunkLK36OGGOcjs.KEYS.PERSIST_DATA,
2125
+ _chunk3B6PCYJBcjs.ACTOR_VERSIONED.serializeWithEmbeddedVersion(
2126
2126
  bareData,
2127
- _chunkMNS5LY6Mcjs.CURRENT_VERSION2
2127
+ _chunk3B6PCYJBcjs.CURRENT_VERSION2
2128
2128
  )
2129
2129
  ]);
2130
2130
  }
@@ -2138,7 +2138,7 @@ var StateManager = class {
2138
2138
  });
2139
2139
  continue;
2140
2140
  }
2141
- const connStateManager = conn[_chunkMNS5LY6Mcjs.CONN_STATE_MANAGER_SYMBOL];
2141
+ const connStateManager = conn[_chunk3B6PCYJBcjs.CONN_STATE_MANAGER_SYMBOL];
2142
2142
  const hibernatableDataRaw = connStateManager.hibernatableDataRaw;
2143
2143
  if (!hibernatableDataRaw) {
2144
2144
  this.#actor.log.warn({
@@ -2159,11 +2159,11 @@ var StateManager = class {
2159
2159
  const bareData = convertConnToBarePersistedConn(
2160
2160
  hibernatableDataRaw
2161
2161
  );
2162
- const connData = _chunkMNS5LY6Mcjs.CONN_VERSIONED.serializeWithEmbeddedVersion(
2162
+ const connData = _chunk3B6PCYJBcjs.CONN_VERSIONED.serializeWithEmbeddedVersion(
2163
2163
  bareData,
2164
- _chunkMNS5LY6Mcjs.CURRENT_VERSION2
2164
+ _chunk3B6PCYJBcjs.CURRENT_VERSION2
2165
2165
  );
2166
- entries.push([_chunkHFWRHT5Tcjs.makeConnKey.call(void 0, connId), connData]);
2166
+ entries.push([_chunkLK36OGGOcjs.makeConnKey.call(void 0, connId), connData]);
2167
2167
  connections.push(conn);
2168
2168
  }
2169
2169
  this.#actor.rLog.info({
@@ -2203,7 +2203,7 @@ var StateManager = class {
2203
2203
  } catch (error) {
2204
2204
  this.#actor.rLog.error({
2205
2205
  msg: "error saving persist",
2206
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2206
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2207
2207
  });
2208
2208
  (_b = this.#onPersistSavedPromise) == null ? void 0 : _b.reject(error);
2209
2209
  throw error;
@@ -2237,7 +2237,7 @@ var ActorTracesDriver = class {
2237
2237
  constructor(driver, actorId) {
2238
2238
  this.#driver = driver;
2239
2239
  this.#actorId = actorId;
2240
- this.#prefix = _chunkHFWRHT5Tcjs.tracesStoragePrefix.call(void 0, );
2240
+ this.#prefix = _chunkLK36OGGOcjs.tracesStoragePrefix.call(void 0, );
2241
2241
  }
2242
2242
  async get(key) {
2243
2243
  const [value] = await this.#driver.kvBatchGet(this.#actorId, [
@@ -2325,7 +2325,7 @@ var CanSleep = /* @__PURE__ */ ((CanSleep2) => {
2325
2325
  CanSleep2[CanSleep2["ActiveRun"] = 7] = "ActiveRun";
2326
2326
  return CanSleep2;
2327
2327
  })(CanSleep || {});
2328
- var ActorInstance = class {
2328
+ var ActorInstance = (_class2 = class {
2329
2329
  // MARK: - Core Properties
2330
2330
 
2331
2331
  #config;
@@ -2382,10 +2382,17 @@ var ActorInstance = class {
2382
2382
  #inspector;
2383
2383
  // MARK: - Tracing
2384
2384
  #traces;
2385
+ // MARK: - Driver Overrides
2386
+ /**
2387
+ * Per-instance config option overrides applied by the driver after creation.
2388
+ * When set, the effective option value is the minimum of the base config
2389
+ * value and the override value.
2390
+ */
2391
+ __init2() {this.overrides = {}}
2385
2392
  // MARK: - Constructor
2386
- constructor(config4) {
2393
+ constructor(config4) {;_class2.prototype.__init2.call(this);
2387
2394
  this.#config = config4;
2388
- this.actorContext = new (0, _chunkHFWRHT5Tcjs.ActorContext)(this);
2395
+ this.actorContext = new (0, _chunkLK36OGGOcjs.ActorContext)(this);
2389
2396
  this.#inspector = new ActorInspector(this);
2390
2397
  }
2391
2398
  // MARK: - Public Getters
@@ -2450,7 +2457,7 @@ var ActorInstance = class {
2450
2457
  this.#traces.endSpan(span, {
2451
2458
  status: {
2452
2459
  code: "ERROR",
2453
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2460
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2454
2461
  }
2455
2462
  });
2456
2463
  throw error;
@@ -2517,7 +2524,7 @@ var ActorInstance = class {
2517
2524
  this.#actorId = actorId;
2518
2525
  this.#name = name;
2519
2526
  this.#key = key;
2520
- this.#actorKeyString = _chunkMNS5LY6Mcjs.serializeActorKey.call(void 0, this.#key);
2527
+ this.#actorKeyString = _chunk3B6PCYJBcjs.serializeActorKey.call(void 0, this.#key);
2521
2528
  this.#region = region;
2522
2529
  this.#initializeTraces();
2523
2530
  this.#initializeLogging();
@@ -2583,17 +2590,17 @@ var ActorInstance = class {
2583
2590
  this.#abortController.abort();
2584
2591
  } catch (e4) {
2585
2592
  }
2586
- await this.#waitForRunHandler(this.#config.options.runStopTimeout);
2593
+ await this.#waitForRunHandler(this.overrides.runStopTimeout !== void 0 ? Math.min(this.#config.options.runStopTimeout, this.overrides.runStopTimeout) : this.#config.options.runStopTimeout);
2587
2594
  if (mode === "sleep") {
2588
2595
  await this.#callOnSleep();
2589
2596
  } else if (mode === "destroy") {
2590
2597
  await this.#callOnDestroy();
2591
2598
  } else {
2592
- _chunkHFWRHT5Tcjs.assertUnreachable.call(void 0, mode);
2599
+ _chunkLK36OGGOcjs.assertUnreachable.call(void 0, mode);
2593
2600
  }
2594
2601
  await this.#disconnectConnections();
2595
2602
  await this.#waitBackgroundPromises(
2596
- this.#config.options.waitUntilTimeout
2603
+ this.overrides.waitUntilTimeout !== void 0 ? Math.min(this.#config.options.waitUntilTimeout, this.overrides.waitUntilTimeout) : this.#config.options.waitUntilTimeout
2597
2604
  );
2598
2605
  this.#rLog.info({ msg: "clearing pending save timeouts" });
2599
2606
  this.stateManager.clearPendingSaveTimeout();
@@ -2647,6 +2654,10 @@ var ActorInstance = class {
2647
2654
  return;
2648
2655
  }
2649
2656
  this.#destroyCalled = true;
2657
+ try {
2658
+ this.#abortController.abort();
2659
+ } catch (e5) {
2660
+ }
2650
2661
  const destroy = this.driver.startDestroy.bind(
2651
2662
  this.driver,
2652
2663
  this.#actorId
@@ -2667,14 +2678,14 @@ var ActorInstance = class {
2667
2678
  this.#activeHonoHttpRequests = 0;
2668
2679
  this.#rLog.warn({
2669
2680
  msg: "active hono requests went below 0, this is a RivetKit bug",
2670
- ..._chunkRMJJE43Bcjs.EXTRA_ERROR_LOG
2681
+ ..._chunk4KSHPFXFcjs.EXTRA_ERROR_LOG
2671
2682
  });
2672
2683
  }
2673
2684
  this.resetSleepTimer();
2674
2685
  }
2675
2686
  // MARK: - Message Processing
2676
2687
  async processMessage(message, conn) {
2677
- await _chunkMNS5LY6Mcjs.processMessage.call(void 0, message, this, conn, {
2688
+ await _chunk3B6PCYJBcjs.processMessage.call(void 0, message, this, conn, {
2678
2689
  onExecuteAction: async (ctx, name, args) => {
2679
2690
  return await this.executeAction(ctx, name, args);
2680
2691
  },
@@ -2687,7 +2698,7 @@ var ActorInstance = class {
2687
2698
  });
2688
2699
  }
2689
2700
  async assertCanSubscribe(ctx, eventName) {
2690
- const canSubscribe = _chunkHFWRHT5Tcjs.getEventCanSubscribe.call(void 0, this.#config.events, eventName);
2701
+ const canSubscribe = _chunkLK36OGGOcjs.getEventCanSubscribe.call(void 0, this.#config.events, eventName);
2691
2702
  if (!canSubscribe) {
2692
2703
  return;
2693
2704
  }
@@ -2700,7 +2711,7 @@ var ActorInstance = class {
2700
2711
  }
2701
2712
  }
2702
2713
  async assertCanPublish(ctx, queueName) {
2703
- const canPublish = _chunkHFWRHT5Tcjs.getQueueCanPublish.call(void 0, this.#config.queues, queueName);
2714
+ const canPublish = _chunkLK36OGGOcjs.getQueueCanPublish.call(void 0, this.#config.queues, queueName);
2704
2715
  if (!canPublish) {
2705
2716
  return;
2706
2717
  }
@@ -2750,7 +2761,7 @@ var ActorInstance = class {
2750
2761
  let output;
2751
2762
  const maybeThenable = outputOrPromise;
2752
2763
  if (maybeThenable && typeof maybeThenable.then === "function") {
2753
- output = await _chunkHFWRHT5Tcjs.deadline.call(void 0,
2764
+ output = await _chunkLK36OGGOcjs.deadline.call(void 0,
2754
2765
  Promise.resolve(outputOrPromise),
2755
2766
  this.#config.options.actionTimeout
2756
2767
  );
@@ -2772,15 +2783,15 @@ var ActorInstance = class {
2772
2783
  } catch (error) {
2773
2784
  this.#rLog.error({
2774
2785
  msg: "error in `onBeforeActionResponse`",
2775
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2786
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2776
2787
  });
2777
2788
  }
2778
2789
  }
2779
2790
  return output;
2780
2791
  });
2781
2792
  } catch (error) {
2782
- const isTimeout = error instanceof _chunkHFWRHT5Tcjs.DeadlineError;
2783
- const message = isTimeout ? "ActionTimedOut" : _chunkRMJJE43Bcjs.stringifyError.call(void 0, error);
2793
+ const isTimeout = error instanceof _chunkLK36OGGOcjs.DeadlineError;
2794
+ const message = isTimeout ? "ActionTimedOut" : _chunk4KSHPFXFcjs.stringifyError.call(void 0, error);
2784
2795
  this.#traces.setAttributes(actionSpan, {
2785
2796
  "error.message": message,
2786
2797
  "error.type": error instanceof Error ? error.name : typeof error
@@ -2795,7 +2806,7 @@ var ActorInstance = class {
2795
2806
  this.#rLog.error({
2796
2807
  msg: "action error",
2797
2808
  actionName,
2798
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2809
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2799
2810
  });
2800
2811
  throw error;
2801
2812
  } finally {
@@ -2809,7 +2820,7 @@ var ActorInstance = class {
2809
2820
  this.#activeKeepAwakeCount = 0;
2810
2821
  this.#rLog.warn({
2811
2822
  msg: "active keep awake count went below 0, this is a RivetKit bug",
2812
- ..._chunkRMJJE43Bcjs.EXTRA_ERROR_LOG
2823
+ ..._chunk4KSHPFXFcjs.EXTRA_ERROR_LOG
2813
2824
  });
2814
2825
  }
2815
2826
  this.resetSleepTimer();
@@ -2831,7 +2842,7 @@ var ActorInstance = class {
2831
2842
  "rivet.conn.id": conn.id
2832
2843
  },
2833
2844
  async () => {
2834
- const ctx = new (0, _chunkMNS5LY6Mcjs.RequestContext)(this, conn, request);
2845
+ const ctx = new (0, _chunk3B6PCYJBcjs.RequestContext)(this, conn, request);
2835
2846
  try {
2836
2847
  const response = await onRequest(ctx, request);
2837
2848
  if (!response) {
@@ -2841,7 +2852,7 @@ var ActorInstance = class {
2841
2852
  } catch (error) {
2842
2853
  this.#rLog.error({
2843
2854
  msg: "onRequest error",
2844
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2855
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2845
2856
  });
2846
2857
  throw error;
2847
2858
  } finally {
@@ -2862,7 +2873,7 @@ var ActorInstance = class {
2862
2873
  let spanEnded = false;
2863
2874
  try {
2864
2875
  this.resetSleepTimer();
2865
- const ctx = new (0, _chunkMNS5LY6Mcjs.WebSocketContext)(this, conn, request);
2876
+ const ctx = new (0, _chunk3B6PCYJBcjs.WebSocketContext)(this, conn, request);
2866
2877
  const voidOrPromise = this.#traces.withSpan(
2867
2878
  span,
2868
2879
  () => this.#config.onWebSocket(ctx, websocket)
@@ -2877,13 +2888,13 @@ var ActorInstance = class {
2877
2888
  if (!spanEnded) {
2878
2889
  this.endTraceSpan(span, {
2879
2890
  code: "ERROR",
2880
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2891
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2881
2892
  });
2882
2893
  spanEnded = true;
2883
2894
  }
2884
2895
  this.#rLog.error({
2885
2896
  msg: "onWebSocket error",
2886
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2897
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2887
2898
  });
2888
2899
  }).finally(() => {
2889
2900
  this.stateManager.savePersistThrottled();
@@ -2899,13 +2910,13 @@ var ActorInstance = class {
2899
2910
  if (!spanEnded) {
2900
2911
  this.endTraceSpan(span, {
2901
2912
  code: "ERROR",
2902
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2913
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2903
2914
  });
2904
2915
  spanEnded = true;
2905
2916
  }
2906
2917
  this.#rLog.error({
2907
2918
  msg: "onWebSocket error",
2908
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2919
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2909
2920
  });
2910
2921
  throw error;
2911
2922
  }
@@ -2926,7 +2937,7 @@ var ActorInstance = class {
2926
2937
  }).catch((error) => {
2927
2938
  this.#rLog.error({
2928
2939
  msg: "wait until promise failed",
2929
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
2940
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
2930
2941
  });
2931
2942
  });
2932
2943
  this.#backgroundPromises.push(nonfailablePromise);
@@ -2941,7 +2952,7 @@ var ActorInstance = class {
2941
2952
  * Errors are propagated to the caller.
2942
2953
  */
2943
2954
  async keepAwake(promise) {
2944
- this.assertReady();
2955
+ this.assertReady(true);
2945
2956
  this.#activeKeepAwakeCount++;
2946
2957
  this.resetSleepTimer();
2947
2958
  try {
@@ -2952,7 +2963,7 @@ var ActorInstance = class {
2952
2963
  this.#activeKeepAwakeCount = 0;
2953
2964
  this.#rLog.warn({
2954
2965
  msg: "active keep awake count went below 0, this is a RivetKit bug",
2955
- ..._chunkRMJJE43Bcjs.EXTRA_ERROR_LOG
2966
+ ..._chunk4KSHPFXFcjs.EXTRA_ERROR_LOG
2956
2967
  });
2957
2968
  }
2958
2969
  this.resetSleepTimer();
@@ -2969,14 +2980,14 @@ var ActorInstance = class {
2969
2980
  this.#activeQueueWaitCount = 0;
2970
2981
  this.#rLog.warn({
2971
2982
  msg: "active queue wait count went below 0, this is a RivetKit bug",
2972
- ..._chunkRMJJE43Bcjs.EXTRA_ERROR_LOG
2983
+ ..._chunk4KSHPFXFcjs.EXTRA_ERROR_LOG
2973
2984
  });
2974
2985
  }
2975
2986
  this.resetSleepTimer();
2976
2987
  }
2977
2988
  // MARK: - Private Helper Methods
2978
2989
  #initializeTraces() {
2979
- if (_chunkRMJJE43Bcjs.getRivetExperimentalOtel.call(void 0, )) {
2990
+ if (_chunk4KSHPFXFcjs.getRivetExperimentalOtel.call(void 0, )) {
2980
2991
  this.#traces = _traces.createTraces.call(void 0, {
2981
2992
  driver: new ActorTracesDriver(this.driver, this.#actorId)
2982
2993
  });
@@ -3041,15 +3052,15 @@ var ActorInstance = class {
3041
3052
  };
3042
3053
  const extraLogParams = (_b = (_a = this.driver).getExtraActorLogParams) == null ? void 0 : _b.call(_a);
3043
3054
  if (extraLogParams) Object.assign(logParams, extraLogParams);
3044
- this.#log = _chunkRMJJE43Bcjs.getBaseLogger.call(void 0, ).child(
3055
+ this.#log = _chunk4KSHPFXFcjs.getBaseLogger.call(void 0, ).child(
3045
3056
  Object.assign(
3046
- _chunkRMJJE43Bcjs.getIncludeTarget.call(void 0, ) ? { target: "actor" } : {},
3057
+ _chunk4KSHPFXFcjs.getIncludeTarget.call(void 0, ) ? { target: "actor" } : {},
3047
3058
  logParams
3048
3059
  )
3049
3060
  );
3050
- this.#rLog = _chunkRMJJE43Bcjs.getBaseLogger.call(void 0, ).child(
3061
+ this.#rLog = _chunk4KSHPFXFcjs.getBaseLogger.call(void 0, ).child(
3051
3062
  Object.assign(
3052
- _chunkRMJJE43Bcjs.getIncludeTarget.call(void 0, ) ? { target: "actor-runtime" } : {},
3063
+ _chunk4KSHPFXFcjs.getIncludeTarget.call(void 0, ) ? { target: "actor-runtime" } : {},
3053
3064
  logParams
3054
3065
  )
3055
3066
  );
@@ -3059,13 +3070,13 @@ var ActorInstance = class {
3059
3070
  async #loadState() {
3060
3071
  const [persistDataBuffer] = await this.driver.kvBatchGet(
3061
3072
  this.#actorId,
3062
- [_chunkHFWRHT5Tcjs.KEYS.PERSIST_DATA]
3073
+ [_chunkLK36OGGOcjs.KEYS.PERSIST_DATA]
3063
3074
  );
3064
3075
  _invariant2.default.call(void 0,
3065
3076
  persistDataBuffer !== null,
3066
3077
  "persist data has not been set, it should be set when initialized"
3067
3078
  );
3068
- const bareData = _chunkMNS5LY6Mcjs.ACTOR_VERSIONED.deserializeWithEmbeddedVersion(persistDataBuffer);
3079
+ const bareData = _chunk3B6PCYJBcjs.ACTOR_VERSIONED.deserializeWithEmbeddedVersion(persistDataBuffer);
3069
3080
  const persistData = convertActorFromBarePersisted(bareData);
3070
3081
  if (persistData.hasInitialized) {
3071
3082
  await this.#restoreExistingActor(persistData);
@@ -3089,12 +3100,12 @@ var ActorInstance = class {
3089
3100
  async #restoreExistingActor(persistData) {
3090
3101
  const connEntries = await this.driver.kvListPrefix(
3091
3102
  this.#actorId,
3092
- _chunkHFWRHT5Tcjs.KEYS.CONN_PREFIX
3103
+ _chunkLK36OGGOcjs.KEYS.CONN_PREFIX
3093
3104
  );
3094
3105
  const connections = [];
3095
3106
  for (const [_key, value] of connEntries) {
3096
3107
  try {
3097
- const bareData = _chunkMNS5LY6Mcjs.CONN_VERSIONED.deserializeWithEmbeddedVersion(
3108
+ const bareData = _chunk3B6PCYJBcjs.CONN_VERSIONED.deserializeWithEmbeddedVersion(
3098
3109
  new Uint8Array(value)
3099
3110
  );
3100
3111
  const conn = convertConnFromBarePersistedConn(bareData);
@@ -3102,7 +3113,7 @@ var ActorInstance = class {
3102
3113
  } catch (error) {
3103
3114
  this.#rLog.error({
3104
3115
  msg: "failed to decode connection",
3105
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3116
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3106
3117
  });
3107
3118
  }
3108
3119
  }
@@ -3115,17 +3126,17 @@ var ActorInstance = class {
3115
3126
  }
3116
3127
  async #initializeInspectorToken() {
3117
3128
  const [tokenBuffer] = await this.driver.kvBatchGet(this.#actorId, [
3118
- _chunkHFWRHT5Tcjs.KEYS.INSPECTOR_TOKEN
3129
+ _chunkLK36OGGOcjs.KEYS.INSPECTOR_TOKEN
3119
3130
  ]);
3120
3131
  if (tokenBuffer !== null) {
3121
3132
  const decoder = new TextDecoder();
3122
3133
  this.#inspectorToken = decoder.decode(tokenBuffer);
3123
3134
  this.#rLog.debug({ msg: "loaded existing inspector token" });
3124
3135
  } else {
3125
- this.#inspectorToken = _chunkHFWRHT5Tcjs.generateSecureToken.call(void 0, );
3136
+ this.#inspectorToken = _chunkLK36OGGOcjs.generateSecureToken.call(void 0, );
3126
3137
  const tokenBytes = new TextEncoder().encode(this.#inspectorToken);
3127
3138
  await this.driver.kvBatchPut(this.#actorId, [
3128
- [_chunkHFWRHT5Tcjs.KEYS.INSPECTOR_TOKEN, tokenBytes]
3139
+ [_chunkLK36OGGOcjs.KEYS.INSPECTOR_TOKEN, tokenBytes]
3129
3140
  ]);
3130
3141
  this.#rLog.debug({ msg: "generated new inspector token" });
3131
3142
  }
@@ -3143,7 +3154,7 @@ var ActorInstance = class {
3143
3154
  this.driver.getContext(this.#actorId)
3144
3155
  );
3145
3156
  if (dataOrPromise instanceof Promise) {
3146
- return _chunkHFWRHT5Tcjs.deadline.call(void 0,
3157
+ return _chunkLK36OGGOcjs.deadline.call(void 0,
3147
3158
  dataOrPromise,
3148
3159
  this.#config.options.createVarsTimeout
3149
3160
  );
@@ -3182,21 +3193,21 @@ var ActorInstance = class {
3182
3193
  async () => {
3183
3194
  const result = onSleep(this.actorContext);
3184
3195
  if (result instanceof Promise) {
3185
- await _chunkHFWRHT5Tcjs.deadline.call(void 0,
3196
+ await _chunkLK36OGGOcjs.deadline.call(void 0,
3186
3197
  result,
3187
- this.#config.options.onSleepTimeout
3198
+ this.overrides.onSleepTimeout !== void 0 ? Math.min(this.#config.options.onSleepTimeout, this.overrides.onSleepTimeout) : this.#config.options.onSleepTimeout
3188
3199
  );
3189
3200
  }
3190
3201
  }
3191
3202
  );
3192
3203
  this.#rLog.debug({ msg: "onSleep completed" });
3193
3204
  } catch (error) {
3194
- if (error instanceof _chunkHFWRHT5Tcjs.DeadlineError) {
3205
+ if (error instanceof _chunkLK36OGGOcjs.DeadlineError) {
3195
3206
  this.#rLog.error({ msg: "onSleep timed out" });
3196
3207
  } else {
3197
3208
  this.#rLog.error({
3198
3209
  msg: "error in onSleep",
3199
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3210
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3200
3211
  });
3201
3212
  }
3202
3213
  }
@@ -3213,28 +3224,28 @@ var ActorInstance = class {
3213
3224
  async () => {
3214
3225
  const result = onDestroy(this.actorContext);
3215
3226
  if (result instanceof Promise) {
3216
- await _chunkHFWRHT5Tcjs.deadline.call(void 0,
3227
+ await _chunkLK36OGGOcjs.deadline.call(void 0,
3217
3228
  result,
3218
- this.#config.options.onDestroyTimeout
3229
+ this.overrides.onDestroyTimeout !== void 0 ? Math.min(this.#config.options.onDestroyTimeout, this.overrides.onDestroyTimeout) : this.#config.options.onDestroyTimeout
3219
3230
  );
3220
3231
  }
3221
3232
  }
3222
3233
  );
3223
3234
  this.#rLog.debug({ msg: "onDestroy completed" });
3224
3235
  } catch (error) {
3225
- if (error instanceof _chunkHFWRHT5Tcjs.DeadlineError) {
3236
+ if (error instanceof _chunkLK36OGGOcjs.DeadlineError) {
3226
3237
  this.#rLog.error({ msg: "onDestroy timed out" });
3227
3238
  } else {
3228
3239
  this.#rLog.error({
3229
3240
  msg: "error in onDestroy",
3230
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3241
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3231
3242
  });
3232
3243
  }
3233
3244
  }
3234
3245
  }
3235
3246
  }
3236
3247
  #startRunHandler() {
3237
- const runFn = _chunkHFWRHT5Tcjs.getRunFunction.call(void 0, this.#config.run);
3248
+ const runFn = _chunkLK36OGGOcjs.getRunFunction.call(void 0, this.#config.run);
3238
3249
  if (!runFn) return;
3239
3250
  this.#rLog.debug({ msg: "starting run handler" });
3240
3251
  this.#runHandlerActive = true;
@@ -3275,7 +3286,7 @@ var ActorInstance = class {
3275
3286
  }
3276
3287
  this.#rLog.debug({
3277
3288
  msg: "run handler threw during actor stop",
3278
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3289
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3279
3290
  });
3280
3291
  return;
3281
3292
  }
@@ -3283,17 +3294,17 @@ var ActorInstance = class {
3283
3294
  "actor.crash",
3284
3295
  {
3285
3296
  "rivet.actor.reason": "run_error",
3286
- "error.message": _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3297
+ "error.message": _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3287
3298
  },
3288
3299
  runSpan
3289
3300
  );
3290
3301
  this.endTraceSpan(runSpan, {
3291
3302
  code: "ERROR",
3292
- message: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3303
+ message: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3293
3304
  });
3294
3305
  this.#rLog.error({
3295
3306
  msg: "run handler threw error, crashing actor to reschedule",
3296
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3307
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3297
3308
  });
3298
3309
  this.startDestroy();
3299
3310
  }).finally(() => {
@@ -3358,7 +3369,7 @@ var ActorInstance = class {
3358
3369
  } catch (cleanupError) {
3359
3370
  this.#rLog.error({
3360
3371
  msg: "database setup cleanup failed",
3361
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, cleanupError)
3372
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, cleanupError)
3362
3373
  });
3363
3374
  }
3364
3375
  }
@@ -3368,7 +3379,7 @@ var ActorInstance = class {
3368
3379
  } catch (cleanupError) {
3369
3380
  this.#rLog.error({
3370
3381
  msg: "sqlite vfs teardown after setup failure failed",
3371
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, cleanupError)
3382
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, cleanupError)
3372
3383
  });
3373
3384
  }
3374
3385
  }
@@ -3376,7 +3387,7 @@ var ActorInstance = class {
3376
3387
  if (error instanceof Error) {
3377
3388
  this.#rLog.error({
3378
3389
  msg: "database setup failed",
3379
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3390
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3380
3391
  });
3381
3392
  throw error;
3382
3393
  }
@@ -3402,7 +3413,7 @@ var ActorInstance = class {
3402
3413
  } catch (error) {
3403
3414
  this.#rLog.error({
3404
3415
  msg: "database cleanup failed",
3405
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3416
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3406
3417
  });
3407
3418
  }
3408
3419
  }
@@ -3412,7 +3423,7 @@ var ActorInstance = class {
3412
3423
  } catch (error) {
3413
3424
  this.#rLog.error({
3414
3425
  msg: "sqlite vfs cleanup failed",
3415
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, error)
3426
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, error)
3416
3427
  });
3417
3428
  }
3418
3429
  }
@@ -3525,7 +3536,7 @@ var ActorInstance = class {
3525
3536
  throw new (0, _chunkL47L3ZWJcjs.VarsNotEnabled)();
3526
3537
  }
3527
3538
  }
3528
- };
3539
+ }, _class2);
3529
3540
 
3530
3541
  // src/actor/definition.ts
3531
3542
  var ActorDefinition = class {
@@ -3552,7 +3563,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3552
3563
  const router = new (0, _hono.Hono)({
3553
3564
  strict: false
3554
3565
  });
3555
- router.use("*", _chunkMNS5LY6Mcjs.loggerMiddleware.call(void 0, _chunkHFWRHT5Tcjs.loggerWithoutContext.call(void 0, )));
3566
+ router.use("*", _chunk3B6PCYJBcjs.loggerMiddleware.call(void 0, _chunkLK36OGGOcjs.loggerWithoutContext.call(void 0, )));
3556
3567
  router.use("*", async (c, next) => {
3557
3568
  const actor = await actorDriver.loadActor(c.env.actorId);
3558
3569
  actor.beginHonoHttpRequest();
@@ -3573,7 +3584,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3573
3584
  router.get("/metadata", async (c) => {
3574
3585
  return c.json({
3575
3586
  runtime: "rivetkit",
3576
- version: _chunkRMJJE43Bcjs.VERSION
3587
+ version: _chunk4KSHPFXFcjs.VERSION
3577
3588
  });
3578
3589
  });
3579
3590
  if (isTest) {
@@ -3588,8 +3599,8 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3588
3599
  if (!conn) {
3589
3600
  return c.text(`Connection not found: ${connId}`, 404);
3590
3601
  }
3591
- if ((_a = conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.terminate) {
3592
- conn[_chunkMNS5LY6Mcjs.CONN_DRIVER_SYMBOL].terminate(actor, conn);
3602
+ if ((_a = conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL]) == null ? void 0 : _a.terminate) {
3603
+ conn[_chunk3B6PCYJBcjs.CONN_DRIVER_SYMBOL].terminate(actor, conn);
3593
3604
  }
3594
3605
  return c.json({ success: true });
3595
3606
  });
@@ -3597,7 +3608,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3597
3608
  if (getUpgradeWebSocket) {
3598
3609
  router.on(
3599
3610
  "GET",
3600
- [_chunkMNS5LY6Mcjs.PATH_CONNECT, `${_chunkMNS5LY6Mcjs.PATH_WEBSOCKET_PREFIX}*`, _chunkMNS5LY6Mcjs.PATH_INSPECTOR_CONNECT],
3611
+ [_chunk3B6PCYJBcjs.PATH_CONNECT, `${_chunk3B6PCYJBcjs.PATH_WEBSOCKET_PREFIX}*`, _chunk3B6PCYJBcjs.PATH_INSPECTOR_CONNECT],
3601
3612
  async (c) => {
3602
3613
  const upgradeWebSocket = getUpgradeWebSocket();
3603
3614
  if (upgradeWebSocket) {
@@ -3605,8 +3616,8 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3605
3616
  const protocols = c2.req.header(
3606
3617
  "sec-websocket-protocol"
3607
3618
  );
3608
- const { encoding, connParams } = _chunkMNS5LY6Mcjs.parseWebSocketProtocols.call(void 0, protocols);
3609
- return await _chunkMNS5LY6Mcjs.routeWebSocket.call(void 0,
3619
+ const { encoding, connParams } = _chunk3B6PCYJBcjs.parseWebSocketProtocols.call(void 0, protocols);
3620
+ return await _chunk3B6PCYJBcjs.routeWebSocket.call(void 0,
3610
3621
  c2.req.raw,
3611
3622
  c2.req.path,
3612
3623
  c2.req.header(),
@@ -3620,7 +3631,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3620
3631
  false,
3621
3632
  false
3622
3633
  );
3623
- })(c, _chunkRMJJE43Bcjs.noopNext.call(void 0, ));
3634
+ })(c, _chunk4KSHPFXFcjs.noopNext.call(void 0, ));
3624
3635
  } else {
3625
3636
  return c.text(
3626
3637
  "WebSockets are not enabled for this driver.",
@@ -3633,8 +3644,8 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3633
3644
  if (config4.inspector.enabled) {
3634
3645
  const inspectorAuth = async (c) => {
3635
3646
  var _a;
3636
- if (_chunkRMJJE43Bcjs.getNodeEnv.call(void 0, ) === "development" && !config4.inspector.token()) {
3637
- _chunkMNS5LY6Mcjs.inspectorLogger.call(void 0, ).warn({
3647
+ if (_chunk4KSHPFXFcjs.isDev.call(void 0, ) && !config4.inspector.token()) {
3648
+ _chunk3B6PCYJBcjs.inspectorLogger.call(void 0, ).warn({
3638
3649
  msg: "RIVET_INSPECTOR_TOKEN is not set, skipping inspector auth in development mode"
3639
3650
  });
3640
3651
  return void 0;
@@ -3647,7 +3658,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3647
3658
  if (!inspectorToken) {
3648
3659
  return c.text("Unauthorized", 401);
3649
3660
  }
3650
- if (!_chunkMNS5LY6Mcjs.timingSafeEqual.call(void 0, userToken, inspectorToken)) {
3661
+ if (!_chunk3B6PCYJBcjs.timingSafeEqual.call(void 0, userToken, inspectorToken)) {
3651
3662
  return c.text("Unauthorized", 401);
3652
3663
  }
3653
3664
  return void 0;
@@ -3755,13 +3766,13 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3755
3766
  }
3756
3767
  router.post("/action/:action", async (c) => {
3757
3768
  const actionName = c.req.param("action");
3758
- return _chunkMNS5LY6Mcjs.handleAction.call(void 0, c, config4, actorDriver, actionName, c.env.actorId);
3769
+ return _chunk3B6PCYJBcjs.handleAction.call(void 0, c, config4, actorDriver, actionName, c.env.actorId);
3759
3770
  });
3760
3771
  router.post("/queue", async (c) => {
3761
- return _chunkMNS5LY6Mcjs.handleQueueSend.call(void 0, c, config4, actorDriver, c.env.actorId);
3772
+ return _chunk3B6PCYJBcjs.handleQueueSend.call(void 0, c, config4, actorDriver, c.env.actorId);
3762
3773
  });
3763
3774
  router.post("/queue/:name", async (c) => {
3764
- return _chunkMNS5LY6Mcjs.handleQueueSend.call(void 0,
3775
+ return _chunk3B6PCYJBcjs.handleQueueSend.call(void 0,
3765
3776
  c,
3766
3777
  config4,
3767
3778
  actorDriver,
@@ -3779,20 +3790,20 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3779
3790
  body: c.req.raw.body,
3780
3791
  duplex: "half"
3781
3792
  });
3782
- _chunkHFWRHT5Tcjs.loggerWithoutContext.call(void 0, ).debug({
3793
+ _chunkLK36OGGOcjs.loggerWithoutContext.call(void 0, ).debug({
3783
3794
  msg: "rewriting http url",
3784
3795
  from: c.req.url,
3785
3796
  to: correctedRequest.url
3786
3797
  });
3787
- return await _chunkMNS5LY6Mcjs.handleRawRequest.call(void 0,
3798
+ return await _chunk3B6PCYJBcjs.handleRawRequest.call(void 0,
3788
3799
  c,
3789
3800
  correctedRequest,
3790
3801
  actorDriver,
3791
3802
  c.env.actorId
3792
3803
  );
3793
3804
  });
3794
- router.notFound(_chunkMNS5LY6Mcjs.handleRouteNotFound);
3795
- router.onError(_chunkMNS5LY6Mcjs.handleRouteError);
3805
+ router.notFound(_chunk3B6PCYJBcjs.handleRouteNotFound);
3806
+ router.onError(_chunk3B6PCYJBcjs.handleRouteError);
3796
3807
  return router;
3797
3808
  }
3798
3809
 
@@ -3800,7 +3811,7 @@ function createActorRouter(config4, actorDriver, getUpgradeWebSocket, isTest) {
3800
3811
  var _ws = require('hono/ws');
3801
3812
  var _virtualwebsocket = require('@rivetkit/virtual-websocket');
3802
3813
  function logger() {
3803
- return _chunkRMJJE43Bcjs.getLogger.call(void 0, "inline-websocket-adapter");
3814
+ return _chunk4KSHPFXFcjs.getLogger.call(void 0, "inline-websocket-adapter");
3804
3815
  }
3805
3816
  var InlineWebSocketAdapter = class {
3806
3817
  #handler;
@@ -3951,7 +3962,7 @@ var FileSystemActorDriver = class {
3951
3962
  }
3952
3963
  /** Creates a SQLite VFS instance for creating KV-backed databases */
3953
3964
  async createSqliteVfs() {
3954
- return await _chunkMNS5LY6Mcjs.importSqliteVfs.call(void 0, );
3965
+ return await _chunk3B6PCYJBcjs.importSqliteVfs.call(void 0, );
3955
3966
  }
3956
3967
  startSleep(actorId) {
3957
3968
  this.#state.sleepActor(actorId);
@@ -4285,7 +4296,7 @@ var v1ToV2 = (v1State) => {
4285
4296
  if (v1State.persistedData) {
4286
4297
  const key = new Uint8Array([1]);
4287
4298
  kvStorage.push({
4288
- key: _chunkRMJJE43Bcjs.bufferToArrayBuffer.call(void 0, key),
4299
+ key: _chunk4KSHPFXFcjs.bufferToArrayBuffer.call(void 0, key),
4289
4300
  value: v1State.persistedData
4290
4301
  });
4291
4302
  }
@@ -4391,56 +4402,56 @@ var ACTOR_ALARM_VERSIONED = _vbare.createVersionedDataHandler.call(void 0, {
4391
4402
 
4392
4403
  // src/drivers/file-system/log.ts
4393
4404
  function logger2() {
4394
- return _chunkRMJJE43Bcjs.getLogger.call(void 0, "driver-fs");
4405
+ return _chunk4KSHPFXFcjs.getLogger.call(void 0, "driver-fs");
4395
4406
  }
4396
4407
 
4397
4408
  // src/drivers/file-system/utils.ts
4398
4409
  function generateActorId(name, key) {
4399
4410
  const jsonString = JSON.stringify([name, key]);
4400
- const crypto2 = _chunkMNS5LY6Mcjs.getNodeCrypto.call(void 0, );
4411
+ const crypto2 = _chunk3B6PCYJBcjs.getNodeCrypto.call(void 0, );
4401
4412
  const hash = crypto2.createHash("sha256").update(jsonString).digest("hex").substring(0, 16);
4402
4413
  return hash;
4403
4414
  }
4404
4415
  function createHashForPath(dirPath) {
4405
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
4416
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
4406
4417
  const normalizedPath = path.normalize(dirPath);
4407
4418
  const lastComponent = path.basename(normalizedPath);
4408
- const crypto2 = _chunkMNS5LY6Mcjs.getNodeCrypto.call(void 0, );
4419
+ const crypto2 = _chunk3B6PCYJBcjs.getNodeCrypto.call(void 0, );
4409
4420
  const hash = crypto2.createHash("sha256").update(normalizedPath).digest("hex").substring(0, 8);
4410
4421
  return `${lastComponent}-${hash}`;
4411
4422
  }
4412
4423
  function getStoragePath() {
4413
4424
  const dataPath = getDataPath("rivetkit");
4414
4425
  const dirHash = createHashForPath(process.cwd());
4415
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
4426
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
4416
4427
  return path.join(dataPath, dirHash);
4417
4428
  }
4418
4429
  async function pathExists(path) {
4419
4430
  try {
4420
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
4431
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
4421
4432
  await fs.access(path);
4422
4433
  return true;
4423
- } catch (e5) {
4434
+ } catch (e6) {
4424
4435
  return false;
4425
4436
  }
4426
4437
  }
4427
4438
  async function ensureDirectoryExists(directoryPath) {
4428
4439
  if (!await pathExists(directoryPath)) {
4429
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
4440
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
4430
4441
  await fs.mkdir(directoryPath, { recursive: true });
4431
4442
  }
4432
4443
  }
4433
4444
  function ensureDirectoryExistsSync(directoryPath) {
4434
- const fsSync = _chunkMNS5LY6Mcjs.getNodeFsSync.call(void 0, );
4445
+ const fsSync = _chunk3B6PCYJBcjs.getNodeFsSync.call(void 0, );
4435
4446
  if (!fsSync.existsSync(directoryPath)) {
4436
4447
  fsSync.mkdirSync(directoryPath, { recursive: true });
4437
4448
  }
4438
4449
  }
4439
4450
  function getDataPath(appName) {
4440
4451
  const platform = process.platform;
4441
- const os = _chunkMNS5LY6Mcjs.getNodeOs.call(void 0, );
4452
+ const os = _chunk3B6PCYJBcjs.getNodeOs.call(void 0, );
4442
4453
  const homeDir = os.homedir();
4443
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
4454
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
4444
4455
  switch (platform) {
4445
4456
  case "win32":
4446
4457
  return path.join(
@@ -4503,7 +4514,7 @@ function configureSqliteRuntimeDatabase(rawDb, path) {
4503
4514
  }
4504
4515
  }
4505
4516
  function loadSqliteRuntime() {
4506
- const requireFn = _chunkMNS5LY6Mcjs.getRequireFn.call(void 0, );
4517
+ const requireFn = _chunk3B6PCYJBcjs.getRequireFn.call(void 0, );
4507
4518
  const loadErrors = [];
4508
4519
  try {
4509
4520
  const bunSqlite = requireFn(
@@ -4697,7 +4708,7 @@ var FileSystemGlobalState = class {
4697
4708
  this.#persist = persist;
4698
4709
  this.#sqliteRuntime = loadSqliteRuntime();
4699
4710
  this.#storagePath = persist ? _nullishCoalesce(customPath, () => ( getStoragePath())) : "/tmp";
4700
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
4711
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
4701
4712
  this.#stateDir = path.join(this.#storagePath, "state");
4702
4713
  this.#dbsDir = path.join(this.#storagePath, "databases");
4703
4714
  this.#alarmsDir = path.join(this.#storagePath, "alarms");
@@ -4706,7 +4717,7 @@ var FileSystemGlobalState = class {
4706
4717
  ensureDirectoryExistsSync(this.#dbsDir);
4707
4718
  ensureDirectoryExistsSync(this.#alarmsDir);
4708
4719
  try {
4709
- const fsSync = _chunkMNS5LY6Mcjs.getNodeFsSync.call(void 0, );
4720
+ const fsSync = _chunk3B6PCYJBcjs.getNodeFsSync.call(void 0, );
4710
4721
  const actorIds = fsSync.readdirSync(this.#stateDir);
4711
4722
  this.#actorCountOnStartup = actorIds.length;
4712
4723
  } catch (error) {
@@ -4743,13 +4754,13 @@ var FileSystemGlobalState = class {
4743
4754
  }
4744
4755
  }
4745
4756
  getActorStatePath(actorId) {
4746
- return _chunkMNS5LY6Mcjs.getNodePath.call(void 0, ).join(this.#stateDir, actorId);
4757
+ return _chunk3B6PCYJBcjs.getNodePath.call(void 0, ).join(this.#stateDir, actorId);
4747
4758
  }
4748
4759
  getActorDbPath(actorId) {
4749
- return _chunkMNS5LY6Mcjs.getNodePath.call(void 0, ).join(this.#dbsDir, `${actorId}.db`);
4760
+ return _chunk3B6PCYJBcjs.getNodePath.call(void 0, ).join(this.#dbsDir, `${actorId}.db`);
4750
4761
  }
4751
4762
  getActorAlarmPath(actorId) {
4752
- return _chunkMNS5LY6Mcjs.getNodePath.call(void 0, ).join(this.#alarmsDir, actorId);
4763
+ return _chunk3B6PCYJBcjs.getNodePath.call(void 0, ).join(this.#alarmsDir, actorId);
4753
4764
  }
4754
4765
  #getActorKvDatabasePath(actorId) {
4755
4766
  if (this.#persist) {
@@ -4772,7 +4783,7 @@ var FileSystemGlobalState = class {
4772
4783
  }
4773
4784
  const dbPath = this.#getActorKvDatabasePath(actorId);
4774
4785
  if (this.#persist) {
4775
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
4786
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
4776
4787
  ensureDirectoryExistsSync(path.dirname(dbPath));
4777
4788
  }
4778
4789
  let db;
@@ -4814,7 +4825,7 @@ var FileSystemGlobalState = class {
4814
4825
  } catch (error) {
4815
4826
  try {
4816
4827
  db.exec("ROLLBACK");
4817
- } catch (e6) {
4828
+ } catch (e7) {
4818
4829
  }
4819
4830
  throw error;
4820
4831
  }
@@ -4827,7 +4838,7 @@ var FileSystemGlobalState = class {
4827
4838
  return count > 0;
4828
4839
  }
4829
4840
  #migrateLegacyKvToSqliteOnStartupSync() {
4830
- const fsSync = _chunkMNS5LY6Mcjs.getNodeFsSync.call(void 0, );
4841
+ const fsSync = _chunk3B6PCYJBcjs.getNodeFsSync.call(void 0, );
4831
4842
  if (!fsSync.existsSync(this.#stateDir)) {
4832
4843
  return;
4833
4844
  }
@@ -4852,7 +4863,7 @@ var FileSystemGlobalState = class {
4852
4863
  continue;
4853
4864
  }
4854
4865
  const dbPath = this.getActorDbPath(actorId);
4855
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
4866
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
4856
4867
  ensureDirectoryExistsSync(path.dirname(dbPath));
4857
4868
  const db = this.#sqliteRuntime.open(dbPath);
4858
4869
  try {
@@ -4877,7 +4888,7 @@ var FileSystemGlobalState = class {
4877
4888
  }
4878
4889
  async *getActorsIterator(params) {
4879
4890
  let actorIds = Array.from(this.#actors.keys()).sort();
4880
- const fsSync = _chunkMNS5LY6Mcjs.getNodeFsSync.call(void 0, );
4891
+ const fsSync = _chunk3B6PCYJBcjs.getNodeFsSync.call(void 0, );
4881
4892
  if (fsSync.existsSync(this.#stateDir)) {
4882
4893
  actorIds = fsSync.readdirSync(this.#stateDir).filter((id) => !id.includes(".tmp")).sort();
4883
4894
  }
@@ -4934,7 +4945,7 @@ var FileSystemGlobalState = class {
4934
4945
  entry.lifecycleState = 0 /* NONEXISTENT */;
4935
4946
  entry.generation = crypto.randomUUID();
4936
4947
  }
4937
- const initialKvState = _chunkMNS5LY6Mcjs.getInitialActorKvState.call(void 0, input);
4948
+ const initialKvState = _chunk3B6PCYJBcjs.getInitialActorKvState.call(void 0, input);
4938
4949
  await this.#withActorWrite(actorId, async (lockedEntry) => {
4939
4950
  lockedEntry.state = {
4940
4951
  actorId,
@@ -4986,7 +4997,7 @@ var FileSystemGlobalState = class {
4986
4997
  async loadActorState(entry) {
4987
4998
  const stateFilePath = this.getActorStatePath(entry.id);
4988
4999
  try {
4989
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
5000
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
4990
5001
  const stateData = await fs.readFile(stateFilePath);
4991
5002
  const loadedState = ACTOR_STATE_VERSIONED.deserializeWithEmbeddedVersion(
4992
5003
  new Uint8Array(stateData)
@@ -5019,7 +5030,7 @@ var FileSystemGlobalState = class {
5019
5030
  entry.lifecycleState = 0 /* NONEXISTENT */;
5020
5031
  entry.generation = crypto.randomUUID();
5021
5032
  }
5022
- const initialKvState = _chunkMNS5LY6Mcjs.getInitialActorKvState.call(void 0, input);
5033
+ const initialKvState = _chunk3B6PCYJBcjs.getInitialActorKvState.call(void 0, input);
5023
5034
  await this.#withActorWrite(actorId, async (lockedEntry) => {
5024
5035
  lockedEntry.state = {
5025
5036
  actorId,
@@ -5059,7 +5070,7 @@ var FileSystemGlobalState = class {
5059
5070
  return;
5060
5071
  }
5061
5072
  actor.lifecycleState = 2 /* STARTING_SLEEP */;
5062
- actor.stopPromise = _chunkRMJJE43Bcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor sleep stop promise rejection", reason }));
5073
+ actor.stopPromise = _chunk4KSHPFXFcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor sleep stop promise rejection", reason }));
5063
5074
  if (actor.loadPromise) await actor.loadPromise.catch();
5064
5075
  if ((_a = actor.startPromise) == null ? void 0 : _a.promise)
5065
5076
  await actor.startPromise.promise.catch();
@@ -5100,7 +5111,7 @@ var FileSystemGlobalState = class {
5100
5111
  return;
5101
5112
  }
5102
5113
  actor.lifecycleState = 3 /* STARTING_DESTROY */;
5103
- actor.stopPromise = _chunkRMJJE43Bcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor destroy stop promise rejection", reason }));
5114
+ actor.stopPromise = _chunk4KSHPFXFcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor destroy stop promise rejection", reason }));
5104
5115
  if (actor.loadPromise) await actor.loadPromise.catch();
5105
5116
  if ((_a = actor.startPromise) == null ? void 0 : _a.promise)
5106
5117
  await actor.startPromise.promise.catch();
@@ -5133,7 +5144,7 @@ var FileSystemGlobalState = class {
5133
5144
  actor.alarmTimeout.abort();
5134
5145
  }
5135
5146
  if (this.#persist) {
5136
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
5147
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
5137
5148
  await Promise.all([
5138
5149
  // Delete actor state file
5139
5150
  (async () => {
@@ -5144,7 +5155,7 @@ var FileSystemGlobalState = class {
5144
5155
  logger2().error({
5145
5156
  msg: "failed to delete actor state file",
5146
5157
  actorId,
5147
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, err)
5158
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, err)
5148
5159
  });
5149
5160
  }
5150
5161
  }
@@ -5158,7 +5169,7 @@ var FileSystemGlobalState = class {
5158
5169
  logger2().error({
5159
5170
  msg: "failed to delete actor database file",
5160
5171
  actorId,
5161
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, err)
5172
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, err)
5162
5173
  });
5163
5174
  }
5164
5175
  }
@@ -5172,7 +5183,7 @@ var FileSystemGlobalState = class {
5172
5183
  logger2().error({
5173
5184
  msg: "failed to delete actor alarm file",
5174
5185
  actorId,
5175
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, err)
5186
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, err)
5176
5187
  });
5177
5188
  }
5178
5189
  }
@@ -5223,7 +5234,7 @@ var FileSystemGlobalState = class {
5223
5234
  }
5224
5235
  try {
5225
5236
  await entry.stopPromise.promise;
5226
- } catch (e7) {
5237
+ } catch (e8) {
5227
5238
  return;
5228
5239
  }
5229
5240
  }
@@ -5232,12 +5243,12 @@ var FileSystemGlobalState = class {
5232
5243
  const entry = this.#actors.get(actorId);
5233
5244
  _invariant2.default.call(void 0, entry, "actor entry does not exist");
5234
5245
  const previousWrite = entry.pendingWriteResolver;
5235
- const currentWrite = _chunkRMJJE43Bcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled kv write promise rejection", reason }));
5246
+ const currentWrite = _chunk4KSHPFXFcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled kv write promise rejection", reason }));
5236
5247
  entry.pendingWriteResolver = currentWrite;
5237
5248
  if (previousWrite) {
5238
5249
  try {
5239
5250
  await previousWrite.promise;
5240
- } catch (e8) {
5251
+ } catch (e9) {
5241
5252
  }
5242
5253
  }
5243
5254
  try {
@@ -5258,7 +5269,7 @@ var FileSystemGlobalState = class {
5258
5269
  const pending = entry.pendingWriteResolver;
5259
5270
  try {
5260
5271
  await pending.promise;
5261
- } catch (e9) {
5272
+ } catch (e10) {
5262
5273
  }
5263
5274
  }
5264
5275
  }
@@ -5272,10 +5283,10 @@ var FileSystemGlobalState = class {
5272
5283
  }
5273
5284
  if (this.#persist) {
5274
5285
  const alarmPath = this.getActorAlarmPath(actorId);
5275
- const crypto2 = _chunkMNS5LY6Mcjs.getNodeCrypto.call(void 0, );
5286
+ const crypto2 = _chunk3B6PCYJBcjs.getNodeCrypto.call(void 0, );
5276
5287
  const tempPath = `${alarmPath}.tmp.${crypto2.randomUUID()}`;
5277
5288
  try {
5278
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
5289
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
5279
5290
  await ensureDirectoryExists(path.dirname(alarmPath));
5280
5291
  const alarmData = {
5281
5292
  actorId,
@@ -5285,7 +5296,7 @@ var FileSystemGlobalState = class {
5285
5296
  alarmData,
5286
5297
  CURRENT_VERSION3
5287
5298
  );
5288
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
5299
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
5289
5300
  await fs.writeFile(tempPath, data);
5290
5301
  if (!this.isGenerationCurrentAndNotDestroyed(
5291
5302
  actorId,
@@ -5299,9 +5310,9 @@ var FileSystemGlobalState = class {
5299
5310
  await fs.rename(tempPath, alarmPath);
5300
5311
  } catch (error) {
5301
5312
  try {
5302
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
5313
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
5303
5314
  await fs.unlink(tempPath);
5304
- } catch (e10) {
5315
+ } catch (e11) {
5305
5316
  }
5306
5317
  logger2().error({
5307
5318
  msg: "failed to write alarm",
@@ -5318,10 +5329,10 @@ var FileSystemGlobalState = class {
5318
5329
  */
5319
5330
  async #performWrite(actorId, generation, state) {
5320
5331
  const dataPath = this.getActorStatePath(actorId);
5321
- const crypto2 = _chunkMNS5LY6Mcjs.getNodeCrypto.call(void 0, );
5332
+ const crypto2 = _chunk3B6PCYJBcjs.getNodeCrypto.call(void 0, );
5322
5333
  const tempPath = `${dataPath}.tmp.${crypto2.randomUUID()}`;
5323
5334
  try {
5324
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
5335
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
5325
5336
  await ensureDirectoryExists(path.dirname(dataPath));
5326
5337
  const bareState = {
5327
5338
  actorId: state.actorId,
@@ -5338,7 +5349,7 @@ var FileSystemGlobalState = class {
5338
5349
  bareState,
5339
5350
  CURRENT_VERSION3
5340
5351
  );
5341
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
5352
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
5342
5353
  await fs.writeFile(tempPath, serializedState);
5343
5354
  if (!this.isGenerationCurrentAndNotDestroyed(actorId, generation)) {
5344
5355
  logger2().debug(
@@ -5349,9 +5360,9 @@ var FileSystemGlobalState = class {
5349
5360
  await fs.rename(tempPath, dataPath);
5350
5361
  } catch (error) {
5351
5362
  try {
5352
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
5363
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
5353
5364
  await fs.unlink(tempPath);
5354
- } catch (e11) {
5365
+ } catch (e12) {
5355
5366
  }
5356
5367
  logger2().error({
5357
5368
  msg: "failed to save actor state",
@@ -5413,7 +5424,7 @@ var FileSystemGlobalState = class {
5413
5424
  return entry.actor;
5414
5425
  }
5415
5426
  }
5416
- entry.startPromise = _chunkRMJJE43Bcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor start promise rejection", reason }));
5427
+ entry.startPromise = _chunk4KSHPFXFcjs.promiseWithResolvers.call(void 0, (reason) => logger2().warn({ msg: "unhandled actor start promise rejection", reason }));
5417
5428
  try {
5418
5429
  const definition = lookupInRegistry(config4, entry.state.name);
5419
5430
  entry.actor = await definition.instantiate();
@@ -5479,11 +5490,11 @@ var FileSystemGlobalState = class {
5479
5490
  */
5480
5491
  #loadAlarmsSync() {
5481
5492
  try {
5482
- const fsSync = _chunkMNS5LY6Mcjs.getNodeFsSync.call(void 0, );
5493
+ const fsSync = _chunk3B6PCYJBcjs.getNodeFsSync.call(void 0, );
5483
5494
  const files = fsSync.existsSync(this.#alarmsDir) ? fsSync.readdirSync(this.#alarmsDir) : [];
5484
5495
  for (const file of files) {
5485
5496
  if (file.includes(".tmp.")) continue;
5486
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
5497
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
5487
5498
  const fullPath = path.join(this.#alarmsDir, file);
5488
5499
  try {
5489
5500
  const buf = fsSync.readFileSync(fullPath);
@@ -5506,7 +5517,7 @@ var FileSystemGlobalState = class {
5506
5517
  logger2().error({
5507
5518
  msg: "failed to read alarm file",
5508
5519
  file,
5509
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, err)
5520
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, err)
5510
5521
  });
5511
5522
  }
5512
5523
  }
@@ -5536,18 +5547,18 @@ var FileSystemGlobalState = class {
5536
5547
  (_a = entry.alarmTimeout) == null ? void 0 : _a.abort();
5537
5548
  entry.alarmTimestamp = timestamp;
5538
5549
  const delay = Math.max(0, timestamp - Date.now());
5539
- entry.alarmTimeout = _chunkRMJJE43Bcjs.setLongTimeout.call(void 0, async () => {
5550
+ entry.alarmTimeout = _chunk4KSHPFXFcjs.setLongTimeout.call(void 0, async () => {
5540
5551
  entry.alarmTimestamp = void 0;
5541
5552
  if (this.#persist) {
5542
5553
  try {
5543
- const fs = _chunkMNS5LY6Mcjs.getNodeFs.call(void 0, );
5554
+ const fs = _chunk3B6PCYJBcjs.getNodeFs.call(void 0, );
5544
5555
  await fs.unlink(this.getActorAlarmPath(actorId));
5545
5556
  } catch (err) {
5546
5557
  if ((err == null ? void 0 : err.code) !== "ENOENT") {
5547
5558
  logger2().debug({
5548
5559
  msg: "failed to remove alarm file",
5549
5560
  actorId,
5550
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, err)
5561
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, err)
5551
5562
  });
5552
5563
  }
5553
5564
  }
@@ -5573,7 +5584,7 @@ var FileSystemGlobalState = class {
5573
5584
  logger2().error({
5574
5585
  msg: "failed to handle alarm",
5575
5586
  actorId,
5576
- error: _chunkRMJJE43Bcjs.stringifyError.call(void 0, err)
5587
+ error: _chunk4KSHPFXFcjs.stringifyError.call(void 0, err)
5577
5588
  });
5578
5589
  }
5579
5590
  }, delay);
@@ -5583,13 +5594,13 @@ var FileSystemGlobalState = class {
5583
5594
  */
5584
5595
  #cleanupTempFilesSync() {
5585
5596
  try {
5586
- const fsSync = _chunkMNS5LY6Mcjs.getNodeFsSync.call(void 0, );
5597
+ const fsSync = _chunk3B6PCYJBcjs.getNodeFsSync.call(void 0, );
5587
5598
  const files = fsSync.readdirSync(this.#stateDir);
5588
5599
  const tempFiles = files.filter((f) => f.includes(".tmp."));
5589
5600
  const oneHourAgo = Date.now() - 36e5;
5590
5601
  for (const tempFile of tempFiles) {
5591
5602
  try {
5592
- const path = _chunkMNS5LY6Mcjs.getNodePath.call(void 0, );
5603
+ const path = _chunk3B6PCYJBcjs.getNodePath.call(void 0, );
5593
5604
  const fullPath = path.join(this.#stateDir, tempFile);
5594
5605
  const stat = fsSync.statSync(fullPath);
5595
5606
  if (stat.mtimeMs < oneHourAgo) {
@@ -5687,7 +5698,7 @@ var FileSystemGlobalState = class {
5687
5698
  } catch (error) {
5688
5699
  try {
5689
5700
  db.exec("ROLLBACK");
5690
- } catch (e12) {
5701
+ } catch (e13) {
5691
5702
  }
5692
5703
  throw error;
5693
5704
  }
@@ -5736,7 +5747,7 @@ var FileSystemManagerDriver = class {
5736
5747
  this.#config = config4;
5737
5748
  this.#state = state;
5738
5749
  this.#driverConfig = driverConfig;
5739
- const inlineClient = _chunkPZAV6PP2cjs.createClientWithDriver.call(void 0, this);
5750
+ const inlineClient = _chunkTEUL4UYNcjs.createClientWithDriver.call(void 0, this);
5740
5751
  this.#actorDriver = this.#driverConfig.actor(
5741
5752
  config4,
5742
5753
  this,
@@ -5762,7 +5773,7 @@ var FileSystemManagerDriver = class {
5762
5773
  });
5763
5774
  const pathOnly = normalizedPath.split("?")[0];
5764
5775
  const { gatewayId, requestId } = createHibernatableRequestMetadata();
5765
- const wsHandler = await _chunkMNS5LY6Mcjs.routeWebSocket.call(void 0,
5776
+ const wsHandler = await _chunk3B6PCYJBcjs.routeWebSocket.call(void 0,
5766
5777
  fakeRequest,
5767
5778
  pathOnly,
5768
5779
  {},
@@ -5790,7 +5801,7 @@ var FileSystemManagerDriver = class {
5790
5801
  const pathOnly = path.split("?")[0];
5791
5802
  const normalizedPath = pathOnly.startsWith("/") ? pathOnly : `/${pathOnly}`;
5792
5803
  const { gatewayId, requestId } = createHibernatableRequestMetadata();
5793
- const wsHandler = await _chunkMNS5LY6Mcjs.routeWebSocket.call(void 0,
5804
+ const wsHandler = await _chunk3B6PCYJBcjs.routeWebSocket.call(void 0,
5794
5805
  // TODO: Create new request with new path
5795
5806
  c.req.raw,
5796
5807
  normalizedPath,
@@ -5805,7 +5816,7 @@ var FileSystemManagerDriver = class {
5805
5816
  true,
5806
5817
  false
5807
5818
  );
5808
- return upgradeWebSocket(() => wsHandler)(c, _chunkRMJJE43Bcjs.noopNext.call(void 0, ));
5819
+ return upgradeWebSocket(() => wsHandler)(c, _chunk4KSHPFXFcjs.noopNext.call(void 0, ));
5809
5820
  }
5810
5821
  async buildGatewayUrl(actorId) {
5811
5822
  const port = _nullishCoalesce(this.#config.managerPort, () => ( 6420));
@@ -5921,7 +5932,7 @@ var CreateFileSystemDriverOptionsSchema = _zod.z.object({
5921
5932
  useNativeSqlite: _zod.z.boolean().optional()
5922
5933
  });
5923
5934
  function createFileSystemOrMemoryDriver(persist = true, options) {
5924
- _chunkMNS5LY6Mcjs.importNodeDependencies.call(void 0, );
5935
+ _chunk3B6PCYJBcjs.importNodeDependencies.call(void 0, );
5925
5936
  if ((options == null ? void 0 : options.useNativeSqlite) === false) {
5926
5937
  throw new Error(
5927
5938
  "File-system driver no longer supports non-SQLite KV storage. Remove useNativeSqlite: false."
@@ -5970,4 +5981,4 @@ function createMemoryDriver() {
5970
5981
 
5971
5982
 
5972
5983
  exports.ActorDefinition = ActorDefinition; exports.lookupInRegistry = lookupInRegistry; exports.createActorRouter = createActorRouter; exports.InlineWebSocketAdapter = InlineWebSocketAdapter; exports.getStoragePath = getStoragePath; exports.ensureDirectoryExists = ensureDirectoryExists; exports.createFileSystemOrMemoryDriver = createFileSystemOrMemoryDriver; exports.createFileSystemDriver = createFileSystemDriver; exports.createMemoryDriver = createMemoryDriver;
5973
- //# sourceMappingURL=chunk-QABDKI3W.cjs.map
5984
+ //# sourceMappingURL=chunk-UWAGLDT6.cjs.map