rivetkit 3.1.2-rc.6 → 3.1.2-rc.7

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 (103) hide show
  1. package/dist/browser/client.d.ts +2 -30
  2. package/dist/browser/client.js +56 -39
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +1 -1
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/{chunk-KCL4AISR.cjs → chunk-4QYXOAW5.cjs} +4 -4
  7. package/dist/tsup/{chunk-KCL4AISR.cjs.map → chunk-4QYXOAW5.cjs.map} +1 -1
  8. package/dist/tsup/{chunk-V32FXQ3Y.cjs → chunk-AH3SB6EE.cjs} +3 -3
  9. package/dist/tsup/{chunk-V32FXQ3Y.cjs.map → chunk-AH3SB6EE.cjs.map} +1 -1
  10. package/dist/tsup/{chunk-X3EPJHTD.cjs → chunk-BEXWAJ6U.cjs} +7 -7
  11. package/dist/tsup/{chunk-X3EPJHTD.cjs.map → chunk-BEXWAJ6U.cjs.map} +1 -1
  12. package/dist/tsup/{chunk-JHBRUK2G.cjs → chunk-DOJBNDVS.cjs} +5 -3
  13. package/dist/tsup/chunk-DOJBNDVS.cjs.map +1 -0
  14. package/dist/tsup/{chunk-NHTD4LYE.cjs → chunk-EBFFGWLN.cjs} +3 -3
  15. package/dist/tsup/{chunk-NHTD4LYE.cjs.map → chunk-EBFFGWLN.cjs.map} +1 -1
  16. package/dist/tsup/{chunk-7EDYE6RS.cjs → chunk-ER6SIYWL.cjs} +196 -181
  17. package/dist/tsup/chunk-ER6SIYWL.cjs.map +1 -0
  18. package/dist/tsup/{chunk-GPNKYTKX.js → chunk-FWPWI7QL.js} +2 -2
  19. package/dist/tsup/{chunk-AKADRXK5.cjs → chunk-GQKAGJK5.cjs} +3 -3
  20. package/dist/tsup/{chunk-AKADRXK5.cjs.map → chunk-GQKAGJK5.cjs.map} +1 -1
  21. package/dist/tsup/{chunk-2OEJM5K3.js → chunk-HRSJKLCU.js} +5 -3
  22. package/dist/tsup/{chunk-2OEJM5K3.js.map → chunk-HRSJKLCU.js.map} +1 -1
  23. package/dist/tsup/{chunk-O6BVKXY4.js → chunk-IOQREPUK.js} +55 -40
  24. package/dist/tsup/chunk-IOQREPUK.js.map +1 -0
  25. package/dist/tsup/{chunk-Y5RH2IT6.js → chunk-L4UTSVE3.js} +3 -3
  26. package/dist/tsup/{chunk-X7HD5E4N.cjs → chunk-LE3YMWAP.cjs} +10 -10
  27. package/dist/tsup/{chunk-X7HD5E4N.cjs.map → chunk-LE3YMWAP.cjs.map} +1 -1
  28. package/dist/tsup/{chunk-4GCDILHQ.js → chunk-LJ6SZFME.js} +2 -2
  29. package/dist/tsup/{chunk-HEWH252Y.js → chunk-N6GT7FYD.js} +2 -2
  30. package/dist/tsup/{chunk-AUC22H3Q.js → chunk-NWQJIAG4.js} +4 -4
  31. package/dist/tsup/{chunk-LFGYDRKK.js → chunk-XGN6KETJ.js} +2 -2
  32. package/dist/tsup/client/mod.cjs +5 -5
  33. package/dist/tsup/client/mod.d.cts +4 -4
  34. package/dist/tsup/client/mod.d.ts +4 -4
  35. package/dist/tsup/client/mod.js +4 -4
  36. package/dist/tsup/common/log.cjs +2 -2
  37. package/dist/tsup/common/log.js +1 -1
  38. package/dist/tsup/common/websocket.cjs +3 -3
  39. package/dist/tsup/common/websocket.js +2 -2
  40. package/dist/tsup/{config-BMGUEKMZ.d.cts → config-CyOAiV6S.d.cts} +3 -31
  41. package/dist/tsup/{config-iBpXyITj.d.ts → config-TS1eu7w9.d.ts} +3 -31
  42. package/dist/tsup/{context-qfvLuF0P.d.cts → context-Cq5UEIVG.d.cts} +1 -1
  43. package/dist/tsup/{context-hyVakgnU.d.ts → context-CxYw0sLz.d.ts} +1 -1
  44. package/dist/tsup/db/drizzle.cjs +2 -2
  45. package/dist/tsup/db/drizzle.js +1 -1
  46. package/dist/tsup/db/mod.cjs +3 -3
  47. package/dist/tsup/db/mod.js +2 -2
  48. package/dist/tsup/dynamic/mod.d.cts +2 -2
  49. package/dist/tsup/dynamic/mod.d.ts +2 -2
  50. package/dist/tsup/inspector/mod.cjs +5 -5
  51. package/dist/tsup/inspector/mod.js +4 -4
  52. package/dist/tsup/inspector/workflow.cjs +4 -4
  53. package/dist/tsup/inspector/workflow.js +3 -3
  54. package/dist/tsup/inspector-tab/mod.d.cts +3 -3
  55. package/dist/tsup/inspector-tab/mod.d.ts +3 -3
  56. package/dist/tsup/mod.cjs +127 -391
  57. package/dist/tsup/mod.cjs.map +1 -1
  58. package/dist/tsup/mod.d.cts +4 -4
  59. package/dist/tsup/mod.d.ts +4 -4
  60. package/dist/tsup/mod.js +46 -310
  61. package/dist/tsup/mod.js.map +1 -1
  62. package/dist/tsup/test/mod.cjs +6 -6
  63. package/dist/tsup/test/mod.d.cts +2 -2
  64. package/dist/tsup/test/mod.d.ts +2 -2
  65. package/dist/tsup/test/mod.js +4 -4
  66. package/dist/tsup/{utils-C6b0aYUM.d.cts → utils-BctYATXG.d.cts} +4 -1
  67. package/dist/tsup/{utils-C1O-SklO.d.ts → utils-CR1Y49t6.d.ts} +4 -1
  68. package/dist/tsup/utils.cjs +2 -2
  69. package/dist/tsup/utils.d.cts +1 -1
  70. package/dist/tsup/utils.d.ts +1 -1
  71. package/dist/tsup/utils.js +1 -1
  72. package/dist/tsup/workflow/mod.cjs +7 -7
  73. package/dist/tsup/workflow/mod.d.cts +4 -4
  74. package/dist/tsup/workflow/mod.d.ts +4 -4
  75. package/dist/tsup/workflow/mod.js +4 -4
  76. package/package.json +9 -9
  77. package/src/client/actor-conn.ts +6 -7
  78. package/src/client/actor-handle.ts +1 -0
  79. package/src/client/client.ts +4 -1
  80. package/src/client/lifecycle-errors.ts +38 -0
  81. package/src/client/query.ts +4 -4
  82. package/src/client/resolve-gateway-target.ts +34 -15
  83. package/src/common/database/config.ts +0 -52
  84. package/src/common/database/native-database.ts +18 -229
  85. package/src/engine-api/actors.ts +0 -2
  86. package/src/engine-client/driver.ts +1 -3
  87. package/src/engine-client/mod.ts +1 -11
  88. package/src/registry/config/index.ts +3 -1
  89. package/src/registry/index.ts +15 -14
  90. package/src/registry/napi-runtime.ts +2 -81
  91. package/src/registry/native.ts +17 -66
  92. package/src/registry/runtime.ts +2 -53
  93. package/src/registry/wasm-runtime.ts +0 -88
  94. package/src/utils.ts +7 -2
  95. package/dist/tsup/chunk-7EDYE6RS.cjs.map +0 -1
  96. package/dist/tsup/chunk-JHBRUK2G.cjs.map +0 -1
  97. package/dist/tsup/chunk-O6BVKXY4.js.map +0 -1
  98. /package/dist/tsup/{chunk-GPNKYTKX.js.map → chunk-FWPWI7QL.js.map} +0 -0
  99. /package/dist/tsup/{chunk-Y5RH2IT6.js.map → chunk-L4UTSVE3.js.map} +0 -0
  100. /package/dist/tsup/{chunk-4GCDILHQ.js.map → chunk-LJ6SZFME.js.map} +0 -0
  101. /package/dist/tsup/{chunk-HEWH252Y.js.map → chunk-N6GT7FYD.js.map} +0 -0
  102. /package/dist/tsup/{chunk-AUC22H3Q.js.map → chunk-NWQJIAG4.js.map} +0 -0
  103. /package/dist/tsup/{chunk-LFGYDRKK.js.map → chunk-XGN6KETJ.js.map} +0 -0
@@ -1,13 +1,13 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkX3EPJHTDcjs = require('../chunk-X3EPJHTD.cjs');
3
+ var _chunkBEXWAJ6Ucjs = require('../chunk-BEXWAJ6U.cjs');
4
4
 
5
5
 
6
- var _chunk7EDYE6RScjs = require('../chunk-7EDYE6RS.cjs');
6
+ var _chunkER6SIYWLcjs = require('../chunk-ER6SIYWL.cjs');
7
7
  require('../chunk-RTWH3AX3.cjs');
8
- require('../chunk-NHTD4LYE.cjs');
8
+ require('../chunk-EBFFGWLN.cjs');
9
9
  require('../chunk-KVFIONKQ.cjs');
10
- require('../chunk-JHBRUK2G.cjs');
10
+ require('../chunk-DOJBNDVS.cjs');
11
11
  require('../chunk-MGI2VVF6.cjs');
12
12
 
13
13
  // src/test/ready.ts
@@ -36,8 +36,8 @@ async function setupTest(c, registry) {
36
36
  registry.config.noWelcome = true;
37
37
  registry.start();
38
38
  await waitForRegistryReady(registry);
39
- const client = _chunkX3EPJHTDcjs.createClient.call(void 0, {
40
- ..._chunk7EDYE6RScjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
39
+ const client = _chunkBEXWAJ6Ucjs.createClient.call(void 0, {
40
+ ..._chunkER6SIYWLcjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
41
41
  disableMetadataLookup: false
42
42
  });
43
43
  c.onTestFinished(async () => {
@@ -1,5 +1,5 @@
1
1
  import { TestContext } from 'vitest';
2
- import { aK as Registry, a8 as Client } from '../config-BMGUEKMZ.cjs';
2
+ import { aK as Registry, a8 as Client } from '../config-CyOAiV6S.cjs';
3
3
  import 'zod/v4';
4
4
  import '../config-CBTr4IhE.cjs';
5
5
  import '@rivetkit/rivetkit-wasm';
@@ -9,7 +9,7 @@ import '@rivetkit/virtual-websocket';
9
9
  import '../inspector/workflow.cjs';
10
10
  import '@standard-schema/spec';
11
11
  import '@rivetkit/engine-api-full';
12
- import '../utils-C6b0aYUM.cjs';
12
+ import '../utils-BctYATXG.cjs';
13
13
  import 'hono';
14
14
  import '../utils-3rsE0JvI.cjs';
15
15
  import 'hono/utils/http-status';
@@ -1,5 +1,5 @@
1
1
  import { TestContext } from 'vitest';
2
- import { aK as Registry, a8 as Client } from '../config-iBpXyITj.js';
2
+ import { aK as Registry, a8 as Client } from '../config-TS1eu7w9.js';
3
3
  import 'zod/v4';
4
4
  import '../config-CBTr4IhE.js';
5
5
  import '@rivetkit/rivetkit-wasm';
@@ -9,7 +9,7 @@ import '@rivetkit/virtual-websocket';
9
9
  import '../inspector/workflow.js';
10
10
  import '@standard-schema/spec';
11
11
  import '@rivetkit/engine-api-full';
12
- import '../utils-C1O-SklO.js';
12
+ import '../utils-CR1Y49t6.js';
13
13
  import 'hono';
14
14
  import '../utils-3rsE0JvI.js';
15
15
  import 'hono/utils/http-status';
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createClient
3
- } from "../chunk-Y5RH2IT6.js";
3
+ } from "../chunk-L4UTSVE3.js";
4
4
  import {
5
5
  convertRegistryConfigToClientConfig
6
- } from "../chunk-O6BVKXY4.js";
6
+ } from "../chunk-IOQREPUK.js";
7
7
  import "../chunk-A2CF6PFH.js";
8
- import "../chunk-GPNKYTKX.js";
8
+ import "../chunk-FWPWI7QL.js";
9
9
  import "../chunk-JTHHCZCZ.js";
10
- import "../chunk-2OEJM5K3.js";
10
+ import "../chunk-HRSJKLCU.js";
11
11
  import "../chunk-ZOVJDAOW.js";
12
12
 
13
13
  // src/test/ready.ts
@@ -84,9 +84,12 @@ type LongTimeoutHandle = {
84
84
  *
85
85
  * This is specifically for Cloudflare Workers. Their implementation of Promise.withResolvers does not work correctly.
86
86
  *
87
+ * `onReject` runs on every rejection, so a promise given one never reports as unhandled. Omit it when the
88
+ * caller awaits the promise and handles its rejection.
89
+ *
87
90
  * @experimental
88
91
  */
89
- declare function promiseWithResolvers<T>(onReject: (reason?: any) => void): {
92
+ declare function promiseWithResolvers<T>(onReject?: (reason?: any) => void): {
90
93
  promise: Promise<T>;
91
94
  resolve: (value: T | PromiseLike<T>) => void;
92
95
  reject: (reason?: any) => void;
@@ -84,9 +84,12 @@ type LongTimeoutHandle = {
84
84
  *
85
85
  * This is specifically for Cloudflare Workers. Their implementation of Promise.withResolvers does not work correctly.
86
86
  *
87
+ * `onReject` runs on every rejection, so a promise given one never reports as unhandled. Omit it when the
88
+ * caller awaits the promise and handles its rejection.
89
+ *
87
90
  * @experimental
88
91
  */
89
- declare function promiseWithResolvers<T>(onReject: (reason?: any) => void): {
92
+ declare function promiseWithResolvers<T>(onReject?: (reason?: any) => void): {
90
93
  promise: Promise<T>;
91
94
  resolve: (value: T | PromiseLike<T>) => void;
92
95
  reject: (reason?: any) => void;
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkJHBRUK2Gcjs = require('./chunk-JHBRUK2G.cjs');
22
+ var _chunkDOJBNDVScjs = require('./chunk-DOJBNDVS.cjs');
23
23
  require('./chunk-MGI2VVF6.cjs');
24
24
 
25
25
 
@@ -42,5 +42,5 @@ require('./chunk-MGI2VVF6.cjs');
42
42
 
43
43
 
44
44
 
45
- exports.EXTRA_ERROR_LOG = _chunkJHBRUK2Gcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkJHBRUK2Gcjs.SinglePromiseQueue; exports.VERSION = _chunkJHBRUK2Gcjs.VERSION; exports.arrayBuffersEqual = _chunkJHBRUK2Gcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkJHBRUK2Gcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkJHBRUK2Gcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkJHBRUK2Gcjs.combineUrlPath; exports.dbg = _chunkJHBRUK2Gcjs.dbg; exports.detectRuntime = _chunkJHBRUK2Gcjs.detectRuntime; exports.getEnvUniversal = _chunkJHBRUK2Gcjs.getEnvUniversal; exports.httpUserAgent = _chunkJHBRUK2Gcjs.httpUserAgent; exports.interval = _chunkJHBRUK2Gcjs.interval; exports.joinSignals = _chunkJHBRUK2Gcjs.joinSignals; exports.jsonParseCompat = _chunkJHBRUK2Gcjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkJHBRUK2Gcjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkJHBRUK2Gcjs.promiseWithResolvers; exports.setLongTimeout = _chunkJHBRUK2Gcjs.setLongTimeout; exports.sleep = _chunkJHBRUK2Gcjs.sleep; exports.stringifyError = _chunkJHBRUK2Gcjs.stringifyError; exports.toUint8Array = _chunkJHBRUK2Gcjs.toUint8Array;
45
+ exports.EXTRA_ERROR_LOG = _chunkDOJBNDVScjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkDOJBNDVScjs.SinglePromiseQueue; exports.VERSION = _chunkDOJBNDVScjs.VERSION; exports.arrayBuffersEqual = _chunkDOJBNDVScjs.arrayBuffersEqual; exports.assertUnreachable = _chunkDOJBNDVScjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkDOJBNDVScjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkDOJBNDVScjs.combineUrlPath; exports.dbg = _chunkDOJBNDVScjs.dbg; exports.detectRuntime = _chunkDOJBNDVScjs.detectRuntime; exports.getEnvUniversal = _chunkDOJBNDVScjs.getEnvUniversal; exports.httpUserAgent = _chunkDOJBNDVScjs.httpUserAgent; exports.interval = _chunkDOJBNDVScjs.interval; exports.joinSignals = _chunkDOJBNDVScjs.joinSignals; exports.jsonParseCompat = _chunkDOJBNDVScjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkDOJBNDVScjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkDOJBNDVScjs.promiseWithResolvers; exports.setLongTimeout = _chunkDOJBNDVScjs.setLongTimeout; exports.sleep = _chunkDOJBNDVScjs.sleep; exports.stringifyError = _chunkDOJBNDVScjs.stringifyError; exports.toUint8Array = _chunkDOJBNDVScjs.toUint8Array;
46
46
  //# sourceMappingURL=utils.cjs.map
@@ -1,5 +1,5 @@
1
1
  import 'hono';
2
2
  export { d as assertUnreachable, s as stringifyError } from './utils-3rsE0JvI.cjs';
3
- export { D as DeepMutable, a as DeepReadonly, b as EXTRA_ERROR_LOG, G as GetUpgradeWebSocket, L as LongTimeoutHandle, R as Runtime, S as SinglePromiseQueue, U as UpgradeWebSocket, V as VERSION, c as arrayBuffersEqual, d as bufferToArrayBuffer, e as combineUrlPath, f as dbg, g as detectRuntime, h as getEnvUniversal, i as httpUserAgent, j as interval, k as joinSignals, l as jsonParseCompat, m as jsonStringifyCompat, p as promiseWithResolvers, s as setLongTimeout, n as sleep, t as toUint8Array } from './utils-C6b0aYUM.cjs';
3
+ export { D as DeepMutable, a as DeepReadonly, b as EXTRA_ERROR_LOG, G as GetUpgradeWebSocket, L as LongTimeoutHandle, R as Runtime, S as SinglePromiseQueue, U as UpgradeWebSocket, V as VERSION, c as arrayBuffersEqual, d as bufferToArrayBuffer, e as combineUrlPath, f as dbg, g as detectRuntime, h as getEnvUniversal, i as httpUserAgent, j as interval, k as joinSignals, l as jsonParseCompat, m as jsonStringifyCompat, p as promiseWithResolvers, s as setLongTimeout, n as sleep, t as toUint8Array } from './utils-BctYATXG.cjs';
4
4
  import 'hono/utils/http-status';
5
5
  import 'zod/v4';
@@ -1,5 +1,5 @@
1
1
  import 'hono';
2
2
  export { d as assertUnreachable, s as stringifyError } from './utils-3rsE0JvI.js';
3
- export { D as DeepMutable, a as DeepReadonly, b as EXTRA_ERROR_LOG, G as GetUpgradeWebSocket, L as LongTimeoutHandle, R as Runtime, S as SinglePromiseQueue, U as UpgradeWebSocket, V as VERSION, c as arrayBuffersEqual, d as bufferToArrayBuffer, e as combineUrlPath, f as dbg, g as detectRuntime, h as getEnvUniversal, i as httpUserAgent, j as interval, k as joinSignals, l as jsonParseCompat, m as jsonStringifyCompat, p as promiseWithResolvers, s as setLongTimeout, n as sleep, t as toUint8Array } from './utils-C1O-SklO.js';
3
+ export { D as DeepMutable, a as DeepReadonly, b as EXTRA_ERROR_LOG, G as GetUpgradeWebSocket, L as LongTimeoutHandle, R as Runtime, S as SinglePromiseQueue, U as UpgradeWebSocket, V as VERSION, c as arrayBuffersEqual, d as bufferToArrayBuffer, e as combineUrlPath, f as dbg, g as detectRuntime, h as getEnvUniversal, i as httpUserAgent, j as interval, k as joinSignals, l as jsonParseCompat, m as jsonStringifyCompat, p as promiseWithResolvers, s as setLongTimeout, n as sleep, t as toUint8Array } from './utils-CR1Y49t6.js';
4
4
  import 'hono/utils/http-status';
5
5
  import 'zod/v4';
@@ -19,7 +19,7 @@ import {
19
19
  sleep,
20
20
  stringifyError,
21
21
  toUint8Array
22
- } from "./chunk-2OEJM5K3.js";
22
+ } from "./chunk-HRSJKLCU.js";
23
23
  import "./chunk-ZOVJDAOW.js";
24
24
  export {
25
25
  EXTRA_ERROR_LOG,
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } var _class; var _class2;
2
2
 
3
- var _chunkX7HD5E4Ncjs = require('../chunk-X7HD5E4N.cjs');
4
- require('../chunk-AKADRXK5.cjs');
5
- require('../chunk-KCL4AISR.cjs');
3
+ var _chunkLE3YMWAPcjs = require('../chunk-LE3YMWAP.cjs');
4
+ require('../chunk-GQKAGJK5.cjs');
5
+ require('../chunk-4QYXOAW5.cjs');
6
6
 
7
7
 
8
8
 
@@ -13,7 +13,7 @@ var _chunkAQJFKHBKcjs = require('../chunk-AQJFKHBK.cjs');
13
13
  var _chunkRTWH3AX3cjs = require('../chunk-RTWH3AX3.cjs');
14
14
 
15
15
 
16
- var _chunkJHBRUK2Gcjs = require('../chunk-JHBRUK2G.cjs');
16
+ var _chunkDOJBNDVScjs = require('../chunk-DOJBNDVS.cjs');
17
17
 
18
18
 
19
19
 
@@ -769,7 +769,7 @@ function workflow(fn, options = {}) {
769
769
  function getWorkflowInspector(actorId) {
770
770
  let workflowInspector = workflowInspectors.get(actorId);
771
771
  if (!workflowInspector) {
772
- workflowInspector = _chunkX7HD5E4Ncjs.createWorkflowInspectorAdapter.call(void 0, );
772
+ workflowInspector = _chunkLE3YMWAPcjs.createWorkflowInspectorAdapter.call(void 0, );
773
773
  workflowInspectors.set(actorId, workflowInspector);
774
774
  }
775
775
  return workflowInspector;
@@ -842,13 +842,13 @@ function workflow(fn, options = {}) {
842
842
  if (shouldRethrowWorkflowError(error)) {
843
843
  runCtx.log.error({
844
844
  msg: "workflow run failed",
845
- error: _chunkJHBRUK2Gcjs.stringifyError.call(void 0, error)
845
+ error: _chunkDOJBNDVScjs.stringifyError.call(void 0, error)
846
846
  });
847
847
  throw error;
848
848
  }
849
849
  runCtx.log.warn({
850
850
  msg: "workflow failed and will sleep until woken",
851
- error: _chunkJHBRUK2Gcjs.stringifyError.call(void 0, error)
851
+ error: _chunkDOJBNDVScjs.stringifyError.call(void 0, error)
852
852
  });
853
853
  } finally {
854
854
  runCtx.abortSignal.removeEventListener("abort", onAbort);
@@ -1,9 +1,9 @@
1
1
  import { WorkflowErrorEvent } from '@rivetkit/workflow-engine';
2
2
  export { Loop, TryBlockCatchKind, TryBlockConfig, TryBlockFailure, TryBlockResult, TryStepCatchKind, TryStepConfig, TryStepFailure, TryStepResult, WorkflowError, WorkflowErrorEvent } from '@rivetkit/workflow-engine';
3
- import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-BMGUEKMZ.cjs';
3
+ import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-CyOAiV6S.cjs';
4
4
  import { A as AnyDatabaseProvider } from '../config-CBTr4IhE.cjs';
5
- import { d as WorkflowContext } from '../context-qfvLuF0P.cjs';
6
- export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-qfvLuF0P.cjs';
5
+ import { d as WorkflowContext } from '../context-Cq5UEIVG.cjs';
6
+ export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-Cq5UEIVG.cjs';
7
7
  import 'zod/v4';
8
8
  import '@rivetkit/rivetkit-wasm';
9
9
  import 'zod';
@@ -12,7 +12,7 @@ import '@rivetkit/virtual-websocket';
12
12
  import '../inspector/workflow.cjs';
13
13
  import '@standard-schema/spec';
14
14
  import '@rivetkit/engine-api-full';
15
- import '../utils-C6b0aYUM.cjs';
15
+ import '../utils-BctYATXG.cjs';
16
16
  import 'hono';
17
17
  import '../utils-3rsE0JvI.cjs';
18
18
  import 'hono/utils/http-status';
@@ -1,9 +1,9 @@
1
1
  import { WorkflowErrorEvent } from '@rivetkit/workflow-engine';
2
2
  export { Loop, TryBlockCatchKind, TryBlockConfig, TryBlockFailure, TryBlockResult, TryStepCatchKind, TryStepConfig, TryStepFailure, TryStepResult, WorkflowError, WorkflowErrorEvent } from '@rivetkit/workflow-engine';
3
- import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-iBpXyITj.js';
3
+ import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-TS1eu7w9.js';
4
4
  import { A as AnyDatabaseProvider } from '../config-CBTr4IhE.js';
5
- import { d as WorkflowContext } from '../context-hyVakgnU.js';
6
- export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-hyVakgnU.js';
5
+ import { d as WorkflowContext } from '../context-CxYw0sLz.js';
6
+ export { e as WorkflowBranchConfig, W as WorkflowBranchContextOf, a as WorkflowContextOf, f as WorkflowLoopConfig, b as WorkflowLoopContextOf, g as WorkflowStepConfig, h as WorkflowStepContext, c as WorkflowStepContextOf, i as WorkflowTryConfig, j as WorkflowTryStepConfig } from '../context-CxYw0sLz.js';
7
7
  import 'zod/v4';
8
8
  import '@rivetkit/rivetkit-wasm';
9
9
  import 'zod';
@@ -12,7 +12,7 @@ import '@rivetkit/virtual-websocket';
12
12
  import '../inspector/workflow.js';
13
13
  import '@standard-schema/spec';
14
14
  import '@rivetkit/engine-api-full';
15
- import '../utils-C1O-SklO.js';
15
+ import '../utils-CR1Y49t6.js';
16
16
  import 'hono';
17
17
  import '../utils-3rsE0JvI.js';
18
18
  import 'hono/utils/http-status';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createWorkflowInspectorAdapter
3
- } from "../chunk-AUC22H3Q.js";
4
- import "../chunk-4GCDILHQ.js";
5
- import "../chunk-LFGYDRKK.js";
3
+ } from "../chunk-NWQJIAG4.js";
4
+ import "../chunk-LJ6SZFME.js";
5
+ import "../chunk-XGN6KETJ.js";
6
6
  import {
7
7
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
8
8
  defineRunHandler
@@ -13,7 +13,7 @@ import {
13
13
  } from "../chunk-A2CF6PFH.js";
14
14
  import {
15
15
  stringifyError
16
- } from "../chunk-2OEJM5K3.js";
16
+ } from "../chunk-HRSJKLCU.js";
17
17
  import {
18
18
  RivetError,
19
19
  isActorAbortedError
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rivetkit",
3
- "version": "3.1.2-rc.6",
3
+ "version": "3.1.2-rc.7",
4
4
  "description": "Lightweight libraries for building stateful actors on edge platforms",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -211,15 +211,15 @@
211
211
  "@hono/zod-openapi": "^1.1.5",
212
212
  "@opentelemetry/api": "^1.1.0",
213
213
  "@rivetkit/bare-ts": "^0.6.2",
214
- "@rivetkit/engine-api-full": "3.1.2-rc.6",
215
- "@rivetkit/engine-cli": "3.1.2-rc.6",
216
- "@rivetkit/engine-envoy-protocol": "3.1.2-rc.6",
214
+ "@rivetkit/engine-api-full": "3.1.2-rc.7",
215
+ "@rivetkit/engine-cli": "3.1.2-rc.7",
216
+ "@rivetkit/engine-envoy-protocol": "3.1.2-rc.7",
217
217
  "@rivetkit/on-change": "6.0.1",
218
- "@rivetkit/rivetkit-napi": "3.1.2-rc.6",
219
- "@rivetkit/rivetkit-wasm": "3.1.2-rc.6",
220
- "@rivetkit/traces": "3.1.2-rc.6",
221
- "@rivetkit/virtual-websocket": "3.1.2-rc.6",
222
- "@rivetkit/workflow-engine": "3.1.2-rc.6",
218
+ "@rivetkit/rivetkit-napi": "3.1.2-rc.7",
219
+ "@rivetkit/rivetkit-wasm": "3.1.2-rc.7",
220
+ "@rivetkit/traces": "3.1.2-rc.7",
221
+ "@rivetkit/virtual-websocket": "3.1.2-rc.7",
222
+ "@rivetkit/workflow-engine": "3.1.2-rc.7",
223
223
  "cbor-x": "^1.6.0",
224
224
  "drizzle-orm": "0.45.2",
225
225
  "hono": "^4.7.0",
@@ -381,12 +381,7 @@ export class ActorConnRaw {
381
381
  const { promise, resolve, reject } = promiseWithResolvers<{
382
382
  id: bigint;
383
383
  output: unknown;
384
- }>((reason) =>
385
- logger().warn({
386
- msg: "unhandled action promise rejection",
387
- reason,
388
- }),
389
- );
384
+ }>();
390
385
  this.#actionsInFlight.set(actionId, {
391
386
  name: opts.name,
392
387
  resolve,
@@ -1069,7 +1064,11 @@ export class ActorConnRaw {
1069
1064
  error = new errors.ActorError(
1070
1065
  group,
1071
1066
  code,
1072
- `Connection closed: ${reason}`,
1067
+ group === "guard" &&
1068
+ code === "service_unavailable" &&
1069
+ retryAfterMs !== undefined
1070
+ ? `The gateway could not open the actor connection. RivetKit will retry automatically after at least ${retryAfterMs} ms. If connection failures increase with load, reduce concurrent connection attempts and ramp up gradually. If they persist at low load, ask your cluster operator to check gateway and storage health.`
1071
+ : `Connection closed: ${reason}`,
1073
1072
  closeOptions,
1074
1073
  );
1075
1074
  }
@@ -681,6 +681,7 @@ export class ActorHandleRaw {
681
681
  this.#resolvingActorId = resolveGatewayTarget(
682
682
  this.#driver,
683
683
  this.#actorResolutionState,
684
+ { budget: this.#retryBudget, signal: this.#signal },
684
685
  ).then((actorId) => {
685
686
  this.#resolvedActorId = actorId;
686
687
  return actorId;
@@ -421,7 +421,10 @@ export class ClientRaw {
421
421
  });
422
422
 
423
423
  // Create the actor
424
- const actorId = await resolveGatewayTarget(this.#driver, createQuery);
424
+ const actorId = await resolveGatewayTarget(this.#driver, createQuery, {
425
+ budget: this.#retryBudget,
426
+ signal: opts?.signal,
427
+ });
425
428
  logger().debug({
426
429
  msg: "created actor with ID",
427
430
  name,
@@ -82,6 +82,21 @@ function classifyActorError(
82
82
  );
83
83
  }
84
84
 
85
+ // Storage refused the actor's write before running it, as when a new actor's startup commit
86
+ // is shed under load. The connection may open again after the hint the close carried, but
87
+ // an action that failed this way already ran its handler, so it is not sent again.
88
+ if (
89
+ (error.group === "sqlite" && error.code === "storage_overloaded") ||
90
+ (error.group === "depot" && error.code === "overloaded")
91
+ ) {
92
+ return buildLifecycleBoundaryInfo(
93
+ "reconnect_only",
94
+ "actor_error",
95
+ error.message,
96
+ { group: error.group, code: error.code },
97
+ );
98
+ }
99
+
85
100
  if (
86
101
  (error.group === "ups" && error.code === "consumer_closed") ||
87
102
  (error.group === "depot" && error.code === "request_deadline_exceeded")
@@ -314,6 +329,29 @@ export function isRetryableForkRefusal(error: unknown): boolean {
314
329
  return false;
315
330
  }
316
331
 
332
+ /**
333
+ * Whether the engine refused an actor create before submitting it, so sending it again cannot
334
+ * make a second actor: a storage, gateway or namespace refusal that carries a `retry_after_ms`
335
+ * hint, which the actor API answers only for a refusal left before the create was sent, or a
336
+ * retryable lifecycle error. A create that may already have been sent answers
337
+ * `actor.create_pending` instead and goes to the caller, as does every other error.
338
+ */
339
+ export function isRetryableCreateRefusal(error: unknown): boolean {
340
+ if (isRetryableLifecycleRequestError(error)) {
341
+ return true;
342
+ }
343
+ if (!(error instanceof ActorError) || retryAfterMs(error) === undefined) {
344
+ return false;
345
+ }
346
+ return (
347
+ (error.group === "depot" &&
348
+ (error.code === "overloaded" ||
349
+ error.code === "read_interrupted")) ||
350
+ (error.group === "guard" && error.code === "service_unavailable") ||
351
+ (error.group === "namespace" && error.code === "creating")
352
+ );
353
+ }
354
+
317
355
  /**
318
356
  * Runs `run`, retrying retryable lifecycle and refusal errors with jittered exponential backoff
319
357
  * that honors the service's `retry_after_ms` hint. With a `budget`, the call credits it once and
@@ -17,12 +17,12 @@ export const ActorKeySchema = z.array(z.string().max(MAX_ACTOR_KEY_SIZE));
17
17
  export type ActorKey = z.infer<typeof ActorKeySchema>;
18
18
 
19
19
  /**
20
- * Crash policy for actor lifecycle management.
20
+ * Crash policy sent as `rvt-crash-policy` when a gateway query creates an actor.
21
21
  *
22
- * This schema is only used by the engine driver for actor creation. The manager
23
- * driver ignores crash policy and passes it through to the engine unchanged.
22
+ * The engine supports only `sleep`: a crashed actor sleeps and wakes on its next
23
+ * request. The gateway rejects any other value.
24
24
  */
25
- export const CrashPolicySchema = z.enum(["restart", "sleep", "destroy"]);
25
+ export const CrashPolicySchema = z.enum(["sleep"]);
26
26
 
27
27
  export type CrashPolicy = z.infer<typeof CrashPolicySchema>;
28
28
 
@@ -3,17 +3,32 @@ import type {
3
3
  EngineControlClient,
4
4
  GatewayTarget,
5
5
  } from "@/engine-client/driver";
6
+ import {
7
+ isRetryableCreateRefusal,
8
+ retryOnLifecycleBoundary,
9
+ } from "./lifecycle-errors";
10
+ import type { RetryBudget } from "./retry-budget";
6
11
 
7
12
  /**
8
13
  * Resolves a GatewayTarget to a concrete actor ID string.
9
14
  *
10
15
  * Shared across all EngineControlClient implementations to avoid duplicating the
11
- * same query-to-actorId dispatch logic.
16
+ * same query-to-actorId dispatch logic. The client is the retry owner of a create: one the
17
+ * engine refused before submitting it is sent again after the service's hint, within
18
+ * `opts.budget`.
12
19
  */
13
20
  export async function resolveGatewayTarget(
14
21
  driver: EngineControlClient,
15
22
  target: GatewayTarget,
23
+ opts?: { budget?: RetryBudget; signal?: AbortSignal },
16
24
  ): Promise<string> {
25
+ const retryCreate = <T>(run: () => Promise<T>) =>
26
+ retryOnLifecycleBoundary(run, {
27
+ signal: opts?.signal,
28
+ budget: opts?.budget,
29
+ isRetryable: isRetryableCreateRefusal,
30
+ });
31
+
17
32
  if ("directId" in target) {
18
33
  return target.directId;
19
34
  }
@@ -36,24 +51,28 @@ export async function resolveGatewayTarget(
36
51
  }
37
52
 
38
53
  if ("getOrCreateForKey" in target) {
39
- const output = await driver.getOrCreateWithKey({
40
- name: target.getOrCreateForKey.name,
41
- key: target.getOrCreateForKey.key,
42
- input: target.getOrCreateForKey.input,
43
- region: target.getOrCreateForKey.region,
44
- poolName: target.getOrCreateForKey.poolName,
45
- });
54
+ const output = await retryCreate(() =>
55
+ driver.getOrCreateWithKey({
56
+ name: target.getOrCreateForKey.name,
57
+ key: target.getOrCreateForKey.key,
58
+ input: target.getOrCreateForKey.input,
59
+ region: target.getOrCreateForKey.region,
60
+ poolName: target.getOrCreateForKey.poolName,
61
+ }),
62
+ );
46
63
  return output.actorId;
47
64
  }
48
65
 
49
66
  if ("create" in target) {
50
- const output = await driver.createActor({
51
- name: target.create.name,
52
- key: target.create.key,
53
- input: target.create.input,
54
- region: target.create.region,
55
- poolName: target.create.poolName,
56
- });
67
+ const output = await retryCreate(() =>
68
+ driver.createActor({
69
+ name: target.create.name,
70
+ key: target.create.key,
71
+ input: target.create.input,
72
+ region: target.create.region,
73
+ poolName: target.create.poolName,
74
+ }),
75
+ );
57
76
  return output.actorId;
58
77
  }
59
78
 
@@ -160,58 +160,6 @@ export interface SqliteTransactionDatabase {
160
160
  rollback(): Promise<void>;
161
161
  }
162
162
 
163
- /**
164
- * A native database as `NativeDatabaseProvider.open` returns it. The synchronous calls and commit
165
- * tickets work only when the database provider opts into deferred commits, which only embedders
166
- * that hold output until writes are durable do. Internal: not exported from `rivetkit/db`.
167
- */
168
- export interface DeferredSqliteDatabase extends SqliteDatabase {
169
- /**
170
- * Never waits behind other work. Fails with `sqlite.sync_unsupported` unless the actor uses
171
- * deferred commits. Fails with the retryable `sqlite.writer_busy` while a transaction is open,
172
- * including a state save, or while another call on this database is running, and with the
173
- * retryable `sqlite.storage_overloaded` while too many earlier writes wait for storage.
174
- */
175
- execSync(
176
- sql: string,
177
- callback?: (row: unknown[], columns: string[]) => void,
178
- ): void;
179
- /** Fails like `execSync`. */
180
- executeSync(sql: string, params?: SqliteBindings): SqliteExecuteResult;
181
- /**
182
- * Fails like `execSync`, also while a transaction is beginning or a manual `BEGIN` is open.
183
- */
184
- beginTransactionSync(
185
- timeoutMs?: number,
186
- name?: string,
187
- ): SynchronousSqliteTransactionDatabase;
188
- /**
189
- * Returns the ticket of the latest local commit. Synchronous writes return before they are
190
- * durable; pass the ticket to `whenDurable` before releasing output that depends on them.
191
- */
192
- commitTicket(): number;
193
- /**
194
- * Resolves once the commit `ticket` names and every earlier commit are durable. Rejects with
195
- * `sqlite.durability_failed` once the database broke and the actor is restarting.
196
- */
197
- whenDurable(ticket: number): Promise<void>;
198
- /**
199
- * Restarts the owning actor from durable state. Every later write fails, including the final
200
- * state save. For native database providers whose in-memory state can no longer be trusted.
201
- */
202
- abortGeneration(reason: string): void;
203
- }
204
-
205
- export type SynchronousSqliteTransactionDatabase = SqliteTransactionDatabase & {
206
- execSync(
207
- sql: string,
208
- callback?: (row: unknown[], columns: string[]) => void,
209
- ): void;
210
- executeSync(sql: string, params?: SqliteBindings): SqliteExecuteResult;
211
- commitSync(): void;
212
- rollbackSync(): void;
213
- };
214
-
215
163
  /**
216
164
  * Provider for opening native databases from the active runtime.
217
165
  */