rivetkit 2.1.2-rc.1 → 2.1.2

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 (108) hide show
  1. package/dist/browser/client.d.ts +22 -2
  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-ORWO4CBW.cjs → chunk-772NPMTY.cjs} +97 -97
  8. package/dist/tsup/{chunk-ORWO4CBW.cjs.map → chunk-772NPMTY.cjs.map} +1 -1
  9. package/dist/tsup/{chunk-UIRNGRHD.js → chunk-BFI4LYS2.js} +5 -6
  10. package/dist/tsup/chunk-BFI4LYS2.js.map +1 -0
  11. package/dist/tsup/{chunk-LBWUMERE.js → chunk-BSIJG3LG.js} +6 -6
  12. package/dist/tsup/{chunk-NSQACCER.cjs → chunk-GVQAVU7R.cjs} +4 -4
  13. package/dist/tsup/{chunk-NSQACCER.cjs.map → chunk-GVQAVU7R.cjs.map} +1 -1
  14. package/dist/tsup/{chunk-JZFXDQ4A.js → chunk-HB4RGGMC.js} +5 -5
  15. package/dist/tsup/{chunk-XEHCOHAO.cjs → chunk-HFWRHT5T.cjs} +24 -10
  16. package/dist/tsup/chunk-HFWRHT5T.cjs.map +1 -0
  17. package/dist/tsup/{chunk-WGMREZC4.cjs → chunk-MNS5LY6M.cjs} +81 -75
  18. package/dist/tsup/chunk-MNS5LY6M.cjs.map +1 -0
  19. package/dist/tsup/{chunk-RQW3ZCXG.cjs → chunk-NXEHFUDB.cjs} +20 -20
  20. package/dist/tsup/chunk-NXEHFUDB.cjs.map +1 -0
  21. package/dist/tsup/{chunk-KBMYS2AH.js → chunk-PSUVV4HM.js} +23 -9
  22. package/dist/tsup/{chunk-KBMYS2AH.js.map → chunk-PSUVV4HM.js.map} +1 -1
  23. package/dist/tsup/{chunk-MA36UPL5.js → chunk-PW3YONDJ.js} +2 -2
  24. package/dist/tsup/{chunk-QQVYIMJK.cjs → chunk-PZAV6PP2.cjs} +152 -152
  25. package/dist/tsup/{chunk-QQVYIMJK.cjs.map → chunk-PZAV6PP2.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-MV5MNNF2.cjs → chunk-QABDKI3W.cjs} +236 -237
  27. package/dist/tsup/chunk-QABDKI3W.cjs.map +1 -0
  28. package/dist/tsup/{chunk-4Q4OQCFP.js → chunk-RHUII57M.js} +7 -8
  29. package/dist/tsup/chunk-RHUII57M.js.map +1 -0
  30. package/dist/tsup/{chunk-VQ3ZBZFF.cjs → chunk-RMJJE43B.cjs} +2 -2
  31. package/dist/tsup/chunk-RMJJE43B.cjs.map +1 -0
  32. package/dist/tsup/{chunk-J5YSDWR3.js → chunk-TDFDR7AO.js} +2 -2
  33. package/dist/tsup/{chunk-VSKXODDS.cjs → chunk-UZV7NXC6.cjs} +31 -32
  34. package/dist/tsup/chunk-UZV7NXC6.cjs.map +1 -0
  35. package/dist/tsup/{chunk-TR6PPOIA.js → chunk-VMX4I4MP.js} +10 -4
  36. package/dist/tsup/{chunk-TR6PPOIA.js.map → chunk-VMX4I4MP.js.map} +1 -1
  37. package/dist/tsup/{chunk-3WTCEG7J.js → chunk-WUXR722E.js} +2 -2
  38. package/dist/tsup/chunk-WUXR722E.js.map +1 -0
  39. package/dist/tsup/{chunk-4HQKSHVJ.js → chunk-YQ5P6KMN.js} +4 -4
  40. package/dist/tsup/chunk-YQ5P6KMN.js.map +1 -0
  41. package/dist/tsup/{chunk-H74QXLH7.cjs → chunk-ZHQDRRMY.cjs} +3 -3
  42. package/dist/tsup/{chunk-H74QXLH7.cjs.map → chunk-ZHQDRRMY.cjs.map} +1 -1
  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-BFqid9Gr.d.ts → config-P3XujgRr.d.ts} +23 -3
  52. package/dist/tsup/{config-CAZphOS1.d.cts → config-_gfywqqI.d.cts} +23 -3
  53. package/dist/tsup/{context-7X-Dm6_f.d.cts → context-Bxd8Cx4H.d.cts} +5 -5
  54. package/dist/tsup/{context-x9zKhx5T.d.ts → context-uNA4TRn3.d.ts} +5 -5
  55. package/dist/tsup/{driver-DYXwJR5D.d.cts → driver-BcLvZcKl.d.cts} +1 -1
  56. package/dist/tsup/{driver-Bxv62E2p.d.ts → driver-CPGHKXyh.d.ts} +1 -1
  57. package/dist/tsup/driver-helpers/mod.cjs +6 -4
  58. package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
  59. package/dist/tsup/driver-helpers/mod.d.cts +16 -4
  60. package/dist/tsup/driver-helpers/mod.d.ts +16 -4
  61. package/dist/tsup/driver-helpers/mod.js +6 -4
  62. package/dist/tsup/driver-test-suite/mod.cjs +64 -64
  63. package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
  64. package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
  65. package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
  66. package/dist/tsup/driver-test-suite/mod.js +14 -14
  67. package/dist/tsup/driver-test-suite/mod.js.map +1 -1
  68. package/dist/tsup/inspector/mod.cjs +3 -3
  69. package/dist/tsup/inspector/mod.js +2 -2
  70. package/dist/tsup/mod.cjs +8 -8
  71. package/dist/tsup/mod.d.cts +5 -5
  72. package/dist/tsup/mod.d.ts +5 -5
  73. package/dist/tsup/mod.js +7 -7
  74. package/dist/tsup/serve-test-suite/mod.cjs +126 -118
  75. package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
  76. package/dist/tsup/serve-test-suite/mod.js +37 -29
  77. package/dist/tsup/serve-test-suite/mod.js.map +1 -1
  78. package/dist/tsup/test/mod.cjs +10 -10
  79. package/dist/tsup/test/mod.d.cts +1 -1
  80. package/dist/tsup/test/mod.d.ts +1 -1
  81. package/dist/tsup/test/mod.js +6 -6
  82. package/dist/tsup/utils.cjs +2 -2
  83. package/dist/tsup/utils.js +1 -1
  84. package/dist/tsup/workflow/mod.cjs +5 -5
  85. package/dist/tsup/workflow/mod.d.cts +3 -3
  86. package/dist/tsup/workflow/mod.d.ts +3 -3
  87. package/dist/tsup/workflow/mod.js +4 -4
  88. package/package.json +5 -5
  89. package/src/actor/instance/queue.ts +67 -9
  90. package/src/driver-helpers/mod.ts +1 -1
  91. package/src/driver-helpers/utils.ts +18 -0
  92. package/src/driver-test-suite/tests/actor-queue.ts +4 -4
  93. package/src/drivers/file-system/actor.ts +6 -16
  94. package/src/workflow/context.ts +5 -4
  95. package/dist/tsup/chunk-3WTCEG7J.js.map +0 -1
  96. package/dist/tsup/chunk-4HQKSHVJ.js.map +0 -1
  97. package/dist/tsup/chunk-4Q4OQCFP.js.map +0 -1
  98. package/dist/tsup/chunk-MV5MNNF2.cjs.map +0 -1
  99. package/dist/tsup/chunk-RQW3ZCXG.cjs.map +0 -1
  100. package/dist/tsup/chunk-UIRNGRHD.js.map +0 -1
  101. package/dist/tsup/chunk-VQ3ZBZFF.cjs.map +0 -1
  102. package/dist/tsup/chunk-VSKXODDS.cjs.map +0 -1
  103. package/dist/tsup/chunk-WGMREZC4.cjs.map +0 -1
  104. package/dist/tsup/chunk-XEHCOHAO.cjs.map +0 -1
  105. /package/dist/tsup/{chunk-LBWUMERE.js.map → chunk-BSIJG3LG.js.map} +0 -0
  106. /package/dist/tsup/{chunk-JZFXDQ4A.js.map → chunk-HB4RGGMC.js.map} +0 -0
  107. /package/dist/tsup/{chunk-MA36UPL5.js.map → chunk-PW3YONDJ.js.map} +0 -0
  108. /package/dist/tsup/{chunk-J5YSDWR3.js.map → chunk-TDFDR7AO.js.map} +0 -0
@@ -1,18 +1,18 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkMV5MNNF2cjs = require('../chunk-MV5MNNF2.cjs');
3
+ var _chunkQABDKI3Wcjs = require('../chunk-QABDKI3W.cjs');
4
4
 
5
5
 
6
- var _chunkQQVYIMJKcjs = require('../chunk-QQVYIMJK.cjs');
7
- require('../chunk-H74QXLH7.cjs');
6
+ var _chunkPZAV6PP2cjs = require('../chunk-PZAV6PP2.cjs');
7
+ require('../chunk-ZHQDRRMY.cjs');
8
8
 
9
9
 
10
- var _chunkWGMREZC4cjs = require('../chunk-WGMREZC4.cjs');
10
+ var _chunkMNS5LY6Mcjs = require('../chunk-MNS5LY6M.cjs');
11
11
  require('../chunk-NIYZDWMW.cjs');
12
- require('../chunk-XEHCOHAO.cjs');
12
+ require('../chunk-HFWRHT5T.cjs');
13
13
 
14
14
 
15
- var _chunkVQ3ZBZFFcjs = require('../chunk-VQ3ZBZFF.cjs');
15
+ var _chunkRMJJE43Bcjs = require('../chunk-RMJJE43B.cjs');
16
16
  require('../chunk-L47L3ZWJ.cjs');
17
17
  require('../chunk-HDQ2JUQT.cjs');
18
18
 
@@ -23,14 +23,14 @@ var _invariant = require('invariant'); var _invariant2 = _interopRequireDefault(
23
23
 
24
24
  // src/test/log.ts
25
25
  function logger() {
26
- return _chunkVQ3ZBZFFcjs.getLogger.call(void 0, "test");
26
+ return _chunkRMJJE43Bcjs.getLogger.call(void 0, "test");
27
27
  }
28
28
 
29
29
  // src/test/mod.ts
30
30
  async function setupTest(c, registry) {
31
31
  var _a;
32
32
  registry.config.test = { ...registry.config.test, enabled: true };
33
- const driver = _chunkMV5MNNF2cjs.createFileSystemOrMemoryDriver.call(void 0,
33
+ const driver = _chunkQABDKI3Wcjs.createFileSystemOrMemoryDriver.call(void 0,
34
34
  true,
35
35
  { path: `/tmp/rivetkit-test-${crypto.randomUUID()}` }
36
36
  );
@@ -45,7 +45,7 @@ async function setupTest(c, registry) {
45
45
  _invariant2.default.call(void 0, managerDriver, "missing manager driver");
46
46
  const getUpgradeWebSocket = () => upgradeWebSocket;
47
47
  managerDriver.setGetUpgradeWebSocket(getUpgradeWebSocket);
48
- const { router } = _chunkWGMREZC4cjs.buildManagerRouter.call(void 0,
48
+ const { router } = _chunkMNS5LY6Mcjs.buildManagerRouter.call(void 0,
49
49
  parsedConfig,
50
50
  managerDriver,
51
51
  getUpgradeWebSocket
@@ -75,7 +75,7 @@ async function setupTest(c, registry) {
75
75
  c.onTestFinished(async () => {
76
76
  await new Promise((resolve) => server.close(() => resolve(void 0)));
77
77
  });
78
- const client = _chunkQQVYIMJKcjs.createClient.call(void 0, {
78
+ const client = _chunkPZAV6PP2cjs.createClient.call(void 0, {
79
79
  endpoint,
80
80
  namespace: "default",
81
81
  runnerName: "default",
@@ -1,5 +1,5 @@
1
1
  import { TestContext } from 'vitest';
2
- import { a5 as Registry, C as Client } from '../config-CAZphOS1.cjs';
2
+ import { a5 as Registry, C as Client } from '../config-_gfywqqI.cjs';
3
3
  import 'zod/v4';
4
4
  import '@rivetkit/virtual-websocket';
5
5
  import '../config-BiNoIHRs.cjs';
@@ -1,5 +1,5 @@
1
1
  import { TestContext } from 'vitest';
2
- import { a5 as Registry, C as Client } from '../config-BFqid9Gr.js';
2
+ import { a5 as Registry, C as Client } from '../config-P3XujgRr.js';
3
3
  import 'zod/v4';
4
4
  import '@rivetkit/virtual-websocket';
5
5
  import '../config-BiNoIHRs.js';
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  createFileSystemOrMemoryDriver
3
- } from "../chunk-4Q4OQCFP.js";
3
+ } from "../chunk-RHUII57M.js";
4
4
  import {
5
5
  createClient
6
- } from "../chunk-JZFXDQ4A.js";
7
- import "../chunk-MA36UPL5.js";
6
+ } from "../chunk-HB4RGGMC.js";
7
+ import "../chunk-PW3YONDJ.js";
8
8
  import {
9
9
  buildManagerRouter
10
- } from "../chunk-TR6PPOIA.js";
10
+ } from "../chunk-VMX4I4MP.js";
11
11
  import "../chunk-LXUQ667X.js";
12
- import "../chunk-KBMYS2AH.js";
12
+ import "../chunk-PSUVV4HM.js";
13
13
  import {
14
14
  getLogger
15
- } from "../chunk-3WTCEG7J.js";
15
+ } from "../chunk-WUXR722E.js";
16
16
  import "../chunk-7HTNH26M.js";
17
17
  import "../chunk-424PT5DM.js";
18
18
 
@@ -17,7 +17,7 @@
17
17
 
18
18
 
19
19
 
20
- var _chunkVQ3ZBZFFcjs = require('./chunk-VQ3ZBZFF.cjs');
20
+ var _chunkRMJJE43Bcjs = require('./chunk-RMJJE43B.cjs');
21
21
  require('./chunk-L47L3ZWJ.cjs');
22
22
  require('./chunk-HDQ2JUQT.cjs');
23
23
 
@@ -39,5 +39,5 @@ require('./chunk-HDQ2JUQT.cjs');
39
39
 
40
40
 
41
41
 
42
- exports.EXTRA_ERROR_LOG = _chunkVQ3ZBZFFcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkVQ3ZBZFFcjs.SinglePromiseQueue; exports.VERSION = _chunkVQ3ZBZFFcjs.VERSION; exports.arrayBuffersEqual = _chunkVQ3ZBZFFcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkVQ3ZBZFFcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkVQ3ZBZFFcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkVQ3ZBZFFcjs.combineUrlPath; exports.dbg = _chunkVQ3ZBZFFcjs.dbg; exports.detectRuntime = _chunkVQ3ZBZFFcjs.detectRuntime; exports.getEnvUniversal = _chunkVQ3ZBZFFcjs.getEnvUniversal; exports.httpUserAgent = _chunkVQ3ZBZFFcjs.httpUserAgent; exports.interval = _chunkVQ3ZBZFFcjs.interval; exports.joinSignals = _chunkVQ3ZBZFFcjs.joinSignals; exports.promiseWithResolvers = _chunkVQ3ZBZFFcjs.promiseWithResolvers; exports.setLongTimeout = _chunkVQ3ZBZFFcjs.setLongTimeout; exports.sleep = _chunkVQ3ZBZFFcjs.sleep; exports.stringifyError = _chunkVQ3ZBZFFcjs.stringifyError; exports.toUint8Array = _chunkVQ3ZBZFFcjs.toUint8Array;
42
+ exports.EXTRA_ERROR_LOG = _chunkRMJJE43Bcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkRMJJE43Bcjs.SinglePromiseQueue; exports.VERSION = _chunkRMJJE43Bcjs.VERSION; exports.arrayBuffersEqual = _chunkRMJJE43Bcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkRMJJE43Bcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkRMJJE43Bcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkRMJJE43Bcjs.combineUrlPath; exports.dbg = _chunkRMJJE43Bcjs.dbg; exports.detectRuntime = _chunkRMJJE43Bcjs.detectRuntime; exports.getEnvUniversal = _chunkRMJJE43Bcjs.getEnvUniversal; exports.httpUserAgent = _chunkRMJJE43Bcjs.httpUserAgent; exports.interval = _chunkRMJJE43Bcjs.interval; exports.joinSignals = _chunkRMJJE43Bcjs.joinSignals; exports.promiseWithResolvers = _chunkRMJJE43Bcjs.promiseWithResolvers; exports.setLongTimeout = _chunkRMJJE43Bcjs.setLongTimeout; exports.sleep = _chunkRMJJE43Bcjs.sleep; exports.stringifyError = _chunkRMJJE43Bcjs.stringifyError; exports.toUint8Array = _chunkRMJJE43Bcjs.toUint8Array;
43
43
  //# sourceMappingURL=utils.cjs.map
@@ -17,7 +17,7 @@ import {
17
17
  sleep,
18
18
  stringifyError,
19
19
  toUint8Array
20
- } from "./chunk-3WTCEG7J.js";
20
+ } from "./chunk-WUXR722E.js";
21
21
  import "./chunk-7HTNH26M.js";
22
22
  import "./chunk-424PT5DM.js";
23
23
  export {
@@ -2,15 +2,15 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkRQW3ZCXGcjs = require('../chunk-RQW3ZCXG.cjs');
6
- require('../chunk-NSQACCER.cjs');
7
- require('../chunk-XEHCOHAO.cjs');
8
- require('../chunk-VQ3ZBZFF.cjs');
5
+ var _chunkNXEHFUDBcjs = require('../chunk-NXEHFUDB.cjs');
6
+ require('../chunk-GVQAVU7R.cjs');
7
+ require('../chunk-HFWRHT5T.cjs');
8
+ require('../chunk-RMJJE43B.cjs');
9
9
  require('../chunk-L47L3ZWJ.cjs');
10
10
  require('../chunk-HDQ2JUQT.cjs');
11
11
 
12
12
 
13
13
 
14
14
 
15
- exports.ActorWorkflowContext = _chunkRQW3ZCXGcjs.ActorWorkflowContext; exports.Loop = _chunkRQW3ZCXGcjs.Loop; exports.workflow = _chunkRQW3ZCXGcjs.workflow;
15
+ exports.ActorWorkflowContext = _chunkNXEHFUDBcjs.ActorWorkflowContext; exports.Loop = _chunkNXEHFUDBcjs.Loop; exports.workflow = _chunkNXEHFUDBcjs.workflow;
16
16
  //# sourceMappingURL=mod.cjs.map
@@ -1,7 +1,7 @@
1
- import { c as EventSchemaConfig, Q as QueueSchemaConfig, ad as RunContext } from '../config-CAZphOS1.cjs';
1
+ import { c as EventSchemaConfig, Q as QueueSchemaConfig, ad as RunContext } from '../config-_gfywqqI.cjs';
2
2
  import { A as AnyDatabaseProvider } from '../config-BiNoIHRs.cjs';
3
- import { A as ActorWorkflowContext } from '../context-7X-Dm6_f.cjs';
4
- export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-7X-Dm6_f.cjs';
3
+ import { A as ActorWorkflowContext } from '../context-Bxd8Cx4H.cjs';
4
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-Bxd8Cx4H.cjs';
5
5
  export { Loop } from '@rivetkit/workflow-engine';
6
6
  import 'zod/v4';
7
7
  import '@rivetkit/virtual-websocket';
@@ -1,7 +1,7 @@
1
- import { c as EventSchemaConfig, Q as QueueSchemaConfig, ad as RunContext } from '../config-BFqid9Gr.js';
1
+ import { c as EventSchemaConfig, Q as QueueSchemaConfig, ad as RunContext } from '../config-P3XujgRr.js';
2
2
  import { A as AnyDatabaseProvider } from '../config-BiNoIHRs.js';
3
- import { A as ActorWorkflowContext } from '../context-x9zKhx5T.js';
4
- export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-x9zKhx5T.js';
3
+ import { A as ActorWorkflowContext } from '../context-uNA4TRn3.js';
4
+ export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-uNA4TRn3.js';
5
5
  export { Loop } from '@rivetkit/workflow-engine';
6
6
  import 'zod/v4';
7
7
  import '@rivetkit/virtual-websocket';
@@ -2,10 +2,10 @@ import {
2
2
  ActorWorkflowContext,
3
3
  Loop,
4
4
  workflow
5
- } from "../chunk-4HQKSHVJ.js";
6
- import "../chunk-J5YSDWR3.js";
7
- import "../chunk-KBMYS2AH.js";
8
- import "../chunk-3WTCEG7J.js";
5
+ } from "../chunk-YQ5P6KMN.js";
6
+ import "../chunk-TDFDR7AO.js";
7
+ import "../chunk-PSUVV4HM.js";
8
+ import "../chunk-WUXR722E.js";
9
9
  import "../chunk-7HTNH26M.js";
10
10
  import "../chunk-424PT5DM.js";
11
11
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivetkit",
3
- "version": "2.1.2-rc.1",
3
+ "version": "2.1.2",
4
4
  "description": "Lightweight libraries for building stateful actors on edge platforms",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -219,11 +219,11 @@
219
219
  "vbare": "^0.0.4",
220
220
  "@rivetkit/sqlite": "^0.1.1",
221
221
  "zod": "^4.1.0",
222
- "@rivetkit/engine-runner": "2.1.2-rc.1",
223
- "@rivetkit/traces": "2.1.2-rc.1",
222
+ "@rivetkit/engine-runner": "2.1.2",
223
+ "@rivetkit/traces": "2.1.2",
224
224
  "@rivetkit/virtual-websocket": "2.0.33",
225
- "@rivetkit/workflow-engine": "2.1.2-rc.1",
226
- "@rivetkit/sqlite-vfs": "2.1.2-rc.1"
225
+ "@rivetkit/sqlite-vfs": "2.1.2",
226
+ "@rivetkit/workflow-engine": "2.1.2"
227
227
  },
228
228
  "devDependencies": {
229
229
  "@bare-ts/tools": "^0.13.0",
@@ -66,6 +66,21 @@ export type QueueResultMessageForName<
66
66
  export interface QueueNextOptions<
67
67
  TName extends string = string,
68
68
  TCompletable extends boolean = boolean,
69
+ > {
70
+ /** Queue names to receive from. If omitted, reads from all queue names. */
71
+ names?: readonly TName[];
72
+ /** Timeout in milliseconds. Omit to wait indefinitely. */
73
+ timeout?: number;
74
+ /** Optional abort signal for this receive call. */
75
+ signal?: AbortSignal;
76
+ /** Whether to return completable messages. */
77
+ completable?: TCompletable;
78
+ }
79
+
80
+ /** Options for receiving queue message batches. */
81
+ export interface QueueNextBatchOptions<
82
+ TName extends string = string,
83
+ TCompletable extends boolean = boolean,
69
84
  > {
70
85
  /** Queue names to receive from. If omitted, reads from all queue names. */
71
86
  names?: readonly TName[];
@@ -83,6 +98,17 @@ export interface QueueNextOptions<
83
98
  export interface QueueTryNextOptions<
84
99
  TName extends string = string,
85
100
  TCompletable extends boolean = boolean,
101
+ > {
102
+ /** Queue names to receive from. If omitted, reads from all queue names. */
103
+ names?: readonly TName[];
104
+ /** Whether to return completable messages. */
105
+ completable?: TCompletable;
106
+ }
107
+
108
+ /** Options for non-blocking queue batch reads. */
109
+ export interface QueueTryNextBatchOptions<
110
+ TName extends string = string,
111
+ TCompletable extends boolean = boolean,
86
112
  > {
87
113
  /** Queue names to receive from. If omitted, reads from all queue names. */
88
114
  names?: readonly TName[];
@@ -133,11 +159,28 @@ export class ActorQueue<
133
159
  const TCompletable extends boolean = false,
134
160
  >(
135
161
  opts?: QueueNextOptions<TName, TCompletable>,
136
- ): Promise<Array<QueueResultMessageForName<TQueues, TName, TCompletable>>> {
162
+ ): Promise<QueueResultMessageForName<TQueues, TName, TCompletable> | undefined> {
137
163
  const resolvedOpts = (opts ?? {}) as QueueNextOptions<
138
164
  TName,
139
165
  TCompletable
140
166
  >;
167
+ const messages = await this.nextBatch<TName, TCompletable>({
168
+ ...(resolvedOpts as QueueNextBatchOptions<TName, TCompletable>),
169
+ count: 1,
170
+ });
171
+ return messages[0];
172
+ }
173
+
174
+ async nextBatch<
175
+ const TName extends QueueFilterName<TQueues>,
176
+ const TCompletable extends boolean = false,
177
+ >(
178
+ opts?: QueueNextBatchOptions<TName, TCompletable>,
179
+ ): Promise<Array<QueueResultMessageForName<TQueues, TName, TCompletable>>> {
180
+ const resolvedOpts = (opts ?? {}) as QueueNextBatchOptions<
181
+ TName,
182
+ TCompletable
183
+ >;
141
184
  const completable = resolvedOpts.completable === true;
142
185
 
143
186
  if (this.#pendingCompletableMessageIds.size > 0) {
@@ -174,20 +217,37 @@ export class ActorQueue<
174
217
  const TCompletable extends boolean = false,
175
218
  >(
176
219
  opts?: QueueTryNextOptions<TName, TCompletable>,
177
- ): Promise<Array<QueueResultMessageForName<TQueues, TName, TCompletable>>> {
220
+ ): Promise<QueueResultMessageForName<TQueues, TName, TCompletable> | undefined> {
178
221
  const resolvedOpts = (opts ?? {}) as QueueTryNextOptions<
179
222
  TName,
180
223
  TCompletable
181
224
  >;
225
+ const messages = await this.tryNextBatch<TName, TCompletable>({
226
+ ...(resolvedOpts as QueueTryNextBatchOptions<TName, TCompletable>),
227
+ count: 1,
228
+ });
229
+ return messages[0];
230
+ }
231
+
232
+ async tryNextBatch<
233
+ const TName extends QueueFilterName<TQueues>,
234
+ const TCompletable extends boolean = false,
235
+ >(
236
+ opts?: QueueTryNextBatchOptions<TName, TCompletable>,
237
+ ): Promise<Array<QueueResultMessageForName<TQueues, TName, TCompletable>>> {
238
+ const resolvedOpts = (opts ?? {}) as QueueTryNextBatchOptions<
239
+ TName,
240
+ TCompletable
241
+ >;
182
242
  if (resolvedOpts.completable === true) {
183
- return (await this.next<TName, true>({
243
+ return (await this.nextBatch<TName, true>({
184
244
  names: resolvedOpts.names,
185
245
  count: resolvedOpts.count,
186
246
  timeout: 0,
187
247
  completable: true,
188
248
  })) as Array<QueueResultMessageForName<TQueues, TName, TCompletable>>;
189
249
  }
190
- return (await this.next<TName, false>({
250
+ return (await this.nextBatch<TName, false>({
191
251
  names: resolvedOpts.names,
192
252
  count: resolvedOpts.count,
193
253
  timeout: 0,
@@ -208,22 +268,20 @@ export class ActorQueue<
208
268
  >;
209
269
  while (!this.#abortSignal.aborted) {
210
270
  try {
211
- const messages = resolvedOpts.completable === true
271
+ const message = resolvedOpts.completable === true
212
272
  ? await this.next<TName, true>({
213
273
  names: resolvedOpts.names,
214
- count: 1,
215
274
  signal: resolvedOpts.signal,
216
275
  completable: true,
217
276
  })
218
277
  : await this.next<TName, false>({
219
278
  names: resolvedOpts.names,
220
- count: 1,
221
279
  signal: resolvedOpts.signal,
222
280
  });
223
- if (messages.length === 0) {
281
+ if (!message) {
224
282
  continue;
225
283
  }
226
- yield messages[0] as QueueResultMessageForName<
284
+ yield message as QueueResultMessageForName<
227
285
  TQueues,
228
286
  TName,
229
287
  TCompletable
@@ -30,4 +30,4 @@ export type {
30
30
  ManagerDriver,
31
31
  } from "@/manager/driver";
32
32
  export { buildManagerRouter } from "@/manager/router";
33
- export { getInitialActorKvState } from "./utils";
33
+ export { getInitialActorKvState, importSqliteVfs } from "./utils";
@@ -7,6 +7,7 @@ import {
7
7
  } from "@/schemas/actor-persist/versioned";
8
8
  import { bufferToArrayBuffer } from "@/utils";
9
9
  import type { ActorDriver } from "./mod";
10
+ import type { SqliteVfs } from "@rivetkit/sqlite-vfs";
10
11
 
11
12
  function serializeEmptyPersistData(input: unknown | undefined): Uint8Array {
12
13
  const persistData: persistSchema.Actor = {
@@ -34,3 +35,20 @@ export function getInitialActorKvState(
34
35
  const persistData = serializeEmptyPersistData(input);
35
36
  return [[KEYS.PERSIST_DATA, persistData]];
36
37
  }
38
+
39
+ /**
40
+ * Dynamically import @rivetkit/sqlite-vfs and return a fresh SqliteVfs instance.
41
+ *
42
+ * The module specifier is built with Array.join() so that bundlers (esbuild, tsup,
43
+ * Turbopack) cannot statically analyze or constant-fold the import path. This
44
+ * prevents them from tracing into the WASM dependency tree, which would cause
45
+ * errors in environments that don't support .wasm imports (e.g. Turbopack).
46
+ *
47
+ * Each call returns a new instance so that actors get independent SQLite modules,
48
+ * avoiding cross-actor re-entry on the non-reentrant async build.
49
+ */
50
+ export async function importSqliteVfs(): Promise<SqliteVfs> {
51
+ const specifier = ["@rivetkit", "sqlite-vfs"].join("/");
52
+ const { SqliteVfs } = await import(specifier);
53
+ return new SqliteVfs();
54
+ }
@@ -28,7 +28,7 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
28
28
  expect(message).toEqual({ name: "self", body: { value: 42 } });
29
29
  });
30
30
 
31
- test("next supports name arrays and counts", async (c) => {
31
+ test("nextBatch supports name arrays and counts", async (c) => {
32
32
  const { client } = await setupDriverTest(c, driverTestConfig);
33
33
  const handle = client.queueActor.getOrCreate(["receive-array"]);
34
34
 
@@ -43,7 +43,7 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
43
43
  ]);
44
44
  });
45
45
 
46
- test("next supports request objects", async (c) => {
46
+ test("nextBatch supports request objects", async (c) => {
47
47
  const { client } = await setupDriverTest(c, driverTestConfig);
48
48
  const handle = client.queueActor.getOrCreate(["receive-request"]);
49
49
 
@@ -60,7 +60,7 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
60
60
  ]);
61
61
  });
62
62
 
63
- test("next defaults to all names when names is omitted", async (c) => {
63
+ test("nextBatch defaults to all names when names is omitted", async (c) => {
64
64
  const { client } = await setupDriverTest(c, driverTestConfig);
65
65
  const handle = client.queueActor.getOrCreate([
66
66
  "receive-request-all",
@@ -86,7 +86,7 @@ export function runActorQueueTests(driverTestConfig: DriverTestConfig) {
86
86
  expect(messages).toEqual([]);
87
87
  });
88
88
 
89
- test("tryNext does not wait and returns empty array", async (c) => {
89
+ test("tryNextBatch does not wait and returns empty array", async (c) => {
90
90
  const { client } = await setupDriverTest(c, driverTestConfig);
91
91
  const handle = client.queueActor.getOrCreate(["try-next-empty"]);
92
92
 
@@ -1,10 +1,11 @@
1
1
  import type { AnyClient } from "@/client/client";
2
2
  import type { RawDatabaseClient } from "@/db/config";
3
3
  import type { SqliteVfs } from "@rivetkit/sqlite-vfs";
4
- import type {
5
- ActorDriver,
6
- AnyActorInstance,
7
- ManagerDriver,
4
+ import {
5
+ importSqliteVfs,
6
+ type ActorDriver,
7
+ type AnyActorInstance,
8
+ type ManagerDriver,
8
9
  } from "@/driver-helpers/mod";
9
10
  import type { FileSystemGlobalState } from "./global-state";
10
11
  import { RegistryConfig } from "@/registry/config";
@@ -83,18 +84,7 @@ export class FileSystemActorDriver implements ActorDriver {
83
84
 
84
85
  /** Creates a SQLite VFS instance for creating KV-backed databases */
85
86
  async createSqliteVfs(): Promise<SqliteVfs> {
86
- // Dynamic import keeps @rivetkit/sqlite out of the main entrypoint bundle,
87
- // preserving tree-shakeability for environments that don't use SQLite.
88
- // The async @rivetkit/sqlite build is not re-entrant per module instance.
89
- // Returning a fresh SqliteVfs here gives each actor its own module,
90
- // allowing actor-level parallelism without cross-actor re-entry.
91
- //
92
- // The specifier is built via concatenation so that bundlers like
93
- // wrangler's esbuild cannot statically analyze and attempt to
94
- // bundle the module (it is never used on Cloudflare Workers).
95
- const specifier = "@rivetkit/" + "sqlite-vfs";
96
- const { SqliteVfs } = await import(specifier);
97
- return new SqliteVfs();
87
+ return await importSqliteVfs();
98
88
  }
99
89
 
100
90
  startSleep(actorId: string): void {
@@ -5,6 +5,7 @@ import type { ActorDefinition, AnyActorDefinition } from "@/actor/definition";
5
5
  import type { AnyDatabaseProvider, InferDatabaseClient } from "@/actor/database";
6
6
  import type {
7
7
  QueueFilterName,
8
+ QueueNextBatchOptions,
8
9
  QueueNextOptions,
9
10
  QueueResultMessageForName,
10
11
  } from "@/actor/instance/queue";
@@ -29,21 +30,21 @@ import { WORKFLOW_GUARD_KV_KEY } from "./constants";
29
30
  type WorkflowActorQueueNextOptions<
30
31
  TName extends string,
31
32
  TCompletable extends boolean,
32
- > = Omit<QueueNextOptions<TName, TCompletable>, "signal" | "count">;
33
+ > = Omit<QueueNextOptions<TName, TCompletable>, "signal">;
33
34
 
34
35
  type WorkflowActorQueueNextOptionsFallback<TCompletable extends boolean> = Omit<
35
36
  QueueNextOptions<string, TCompletable>,
36
- "signal" | "count"
37
+ "signal"
37
38
  >;
38
39
 
39
40
  type WorkflowActorQueueNextBatchOptions<
40
41
  TName extends string,
41
42
  TCompletable extends boolean,
42
- > = Omit<QueueNextOptions<TName, TCompletable>, "signal">;
43
+ > = Omit<QueueNextBatchOptions<TName, TCompletable>, "signal">;
43
44
 
44
45
  type WorkflowActorQueueNextBatchOptionsFallback<
45
46
  TCompletable extends boolean,
46
- > = Omit<QueueNextOptions<string, TCompletable>, "signal">;
47
+ > = Omit<QueueNextBatchOptions<string, TCompletable>, "signal">;
47
48
 
48
49
  type ActorWorkflowLoopConfig<
49
50
  S,