rivetkit 3.0.1-preview.1 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/browser/client.d.ts +9 -0
  2. package/dist/browser/client.js +68 -8
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +4 -1
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/{chunk-76EPM7XH.js → chunk-2JSFY7XD.js} +2 -2
  7. package/dist/tsup/{chunk-GD6EEIUP.cjs → chunk-3PFAODLE.cjs} +3 -3
  8. package/dist/tsup/{chunk-GD6EEIUP.cjs.map → chunk-3PFAODLE.cjs.map} +1 -1
  9. package/dist/tsup/{chunk-PC27E4VN.cjs → chunk-4VEJIK7O.cjs} +3 -3
  10. package/dist/tsup/{chunk-PC27E4VN.cjs.map → chunk-4VEJIK7O.cjs.map} +1 -1
  11. package/dist/tsup/{chunk-MPBDBG56.js → chunk-57I7SSSV.js} +4 -4
  12. package/dist/tsup/{chunk-UQGGPTAI.js → chunk-7K6MC544.js} +2 -2
  13. package/dist/tsup/{chunk-SRAILZ2U.cjs → chunk-B3MXZSPO.cjs} +204 -147
  14. package/dist/tsup/chunk-B3MXZSPO.cjs.map +1 -0
  15. package/dist/tsup/{chunk-KYSDMIRN.js → chunk-B5WDVY32.js} +9 -3
  16. package/dist/tsup/chunk-B5WDVY32.js.map +1 -0
  17. package/dist/tsup/{chunk-QGK24TS3.js → chunk-BOVQ3JQK.js} +3 -3
  18. package/dist/tsup/{chunk-W6D3WHMT.cjs → chunk-HQ5JCCK6.cjs} +7 -7
  19. package/dist/tsup/{chunk-W6D3WHMT.cjs.map → chunk-HQ5JCCK6.cjs.map} +1 -1
  20. package/dist/tsup/{chunk-33N3SX2W.js → chunk-JOCSSMLU.js} +70 -13
  21. package/dist/tsup/chunk-JOCSSMLU.js.map +1 -0
  22. package/dist/tsup/{chunk-HY2NYO2Q.cjs → chunk-LXSYHJ7E.cjs} +4 -4
  23. package/dist/tsup/{chunk-HY2NYO2Q.cjs.map → chunk-LXSYHJ7E.cjs.map} +1 -1
  24. package/dist/tsup/{chunk-CNCOY7HZ.cjs → chunk-N7V3BQUB.cjs} +10 -10
  25. package/dist/tsup/{chunk-CNCOY7HZ.cjs.map → chunk-N7V3BQUB.cjs.map} +1 -1
  26. package/dist/tsup/{chunk-6M2QCAHK.cjs → chunk-NSQWB4QD.cjs} +3 -3
  27. package/dist/tsup/{chunk-6M2QCAHK.cjs.map → chunk-NSQWB4QD.cjs.map} +1 -1
  28. package/dist/tsup/{chunk-ISCHIEBJ.js → chunk-PLZVADML.js} +2 -2
  29. package/dist/tsup/{chunk-HD2OTPZY.cjs → chunk-QI7E2UH5.cjs} +9 -3
  30. package/dist/tsup/chunk-QI7E2UH5.cjs.map +1 -0
  31. package/dist/tsup/{chunk-IHQRD4KC.js → chunk-QX7DWU46.js} +2 -2
  32. package/dist/tsup/{chunk-HDVZ6YZG.cjs → chunk-SSF2XC33.cjs} +1 -1
  33. package/dist/tsup/chunk-SSF2XC33.cjs.map +1 -0
  34. package/dist/tsup/{chunk-6FEYCVZC.js → chunk-UXDASKP6.js} +1 -1
  35. package/dist/tsup/chunk-UXDASKP6.js.map +1 -0
  36. package/dist/tsup/client/mod.cjs +5 -5
  37. package/dist/tsup/client/mod.d.cts +2 -2
  38. package/dist/tsup/client/mod.d.ts +2 -2
  39. package/dist/tsup/client/mod.js +4 -4
  40. package/dist/tsup/common/log.cjs +2 -2
  41. package/dist/tsup/common/log.js +1 -1
  42. package/dist/tsup/common/websocket.cjs +3 -3
  43. package/dist/tsup/common/websocket.js +2 -2
  44. package/dist/tsup/{config-8NgsxIcT.d.cts → config-K9uOKlok.d.cts} +2 -0
  45. package/dist/tsup/{config-DJ3KW-fe.d.ts → config-XfKwGYxx.d.ts} +2 -0
  46. package/dist/tsup/{context-BL8kUGjq.d.ts → context-Bm7mA4E3.d.ts} +1 -1
  47. package/dist/tsup/{context-_RoE_YHL.d.cts → context-CPCM-xn6.d.cts} +1 -1
  48. package/dist/tsup/db/drizzle.cjs +2 -2
  49. package/dist/tsup/db/drizzle.js +1 -1
  50. package/dist/tsup/db/mod.cjs +3 -3
  51. package/dist/tsup/db/mod.js +2 -2
  52. package/dist/tsup/dynamic/mod.cjs +2 -2
  53. package/dist/tsup/dynamic/mod.d.cts +1 -1
  54. package/dist/tsup/dynamic/mod.d.ts +1 -1
  55. package/dist/tsup/dynamic/mod.js +1 -1
  56. package/dist/tsup/inspector/mod.cjs +5 -5
  57. package/dist/tsup/inspector/mod.js +4 -4
  58. package/dist/tsup/inspector/workflow.cjs +4 -4
  59. package/dist/tsup/inspector/workflow.js +3 -3
  60. package/dist/tsup/inspector-tab/mod.cjs +2 -2
  61. package/dist/tsup/inspector-tab/mod.d.cts +2 -2
  62. package/dist/tsup/inspector-tab/mod.d.ts +2 -2
  63. package/dist/tsup/inspector-tab/mod.js +1 -1
  64. package/dist/tsup/mod.cjs +132 -124
  65. package/dist/tsup/mod.cjs.map +1 -1
  66. package/dist/tsup/mod.d.cts +3 -3
  67. package/dist/tsup/mod.d.ts +3 -3
  68. package/dist/tsup/mod.js +31 -23
  69. package/dist/tsup/mod.js.map +1 -1
  70. package/dist/tsup/test/mod.cjs +6 -6
  71. package/dist/tsup/test/mod.d.cts +1 -1
  72. package/dist/tsup/test/mod.d.ts +1 -1
  73. package/dist/tsup/test/mod.js +4 -4
  74. package/dist/tsup/utils.cjs +2 -2
  75. package/dist/tsup/utils.js +1 -1
  76. package/dist/tsup/workflow/mod.cjs +10 -10
  77. package/dist/tsup/workflow/mod.d.cts +3 -3
  78. package/dist/tsup/workflow/mod.d.ts +3 -3
  79. package/dist/tsup/workflow/mod.js +5 -5
  80. package/package.json +12 -9
  81. package/src/actor/config.ts +2 -0
  82. package/src/client/actor-handle.ts +43 -7
  83. package/src/client/lifecycle-errors.ts +6 -1
  84. package/src/client/raw-utils.ts +17 -3
  85. package/src/client/utils.ts +4 -0
  86. package/src/registry/config/index.ts +7 -5
  87. package/src/registry/native.ts +24 -17
  88. package/src/registry/runtime.ts +1 -1
  89. package/src/utils/env-vars.ts +4 -2
  90. package/dist/tsup/chunk-33N3SX2W.js.map +0 -1
  91. package/dist/tsup/chunk-6FEYCVZC.js.map +0 -1
  92. package/dist/tsup/chunk-HD2OTPZY.cjs.map +0 -1
  93. package/dist/tsup/chunk-HDVZ6YZG.cjs.map +0 -1
  94. package/dist/tsup/chunk-KYSDMIRN.js.map +0 -1
  95. package/dist/tsup/chunk-SRAILZ2U.cjs.map +0 -1
  96. /package/dist/tsup/{chunk-76EPM7XH.js.map → chunk-2JSFY7XD.js.map} +0 -0
  97. /package/dist/tsup/{chunk-MPBDBG56.js.map → chunk-57I7SSSV.js.map} +0 -0
  98. /package/dist/tsup/{chunk-UQGGPTAI.js.map → chunk-7K6MC544.js.map} +0 -0
  99. /package/dist/tsup/{chunk-QGK24TS3.js.map → chunk-BOVQ3JQK.js.map} +0 -0
  100. /package/dist/tsup/{chunk-ISCHIEBJ.js.map → chunk-PLZVADML.js.map} +0 -0
  101. /package/dist/tsup/{chunk-IHQRD4KC.js.map → chunk-QX7DWU46.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 _chunkW6D3WHMTcjs = require('../chunk-W6D3WHMT.cjs');
3
+ var _chunkHQ5JCCK6cjs = require('../chunk-HQ5JCCK6.cjs');
4
4
 
5
5
 
6
- var _chunkSRAILZ2Ucjs = require('../chunk-SRAILZ2U.cjs');
6
+ var _chunkB3MXZSPOcjs = require('../chunk-B3MXZSPO.cjs');
7
7
  require('../chunk-RTWH3AX3.cjs');
8
- require('../chunk-PC27E4VN.cjs');
9
8
  require('../chunk-KVFIONKQ.cjs');
10
- require('../chunk-HD2OTPZY.cjs');
9
+ require('../chunk-4VEJIK7O.cjs');
10
+ require('../chunk-QI7E2UH5.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 = _chunkW6D3WHMTcjs.createClient.call(void 0, {
40
- ..._chunkSRAILZ2Ucjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
39
+ const client = _chunkHQ5JCCK6cjs.createClient.call(void 0, {
40
+ ..._chunkB3MXZSPOcjs.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 { aI as Registry, a6 as Client } from '../config-8NgsxIcT.cjs';
2
+ import { aI as Registry, a6 as Client } from '../config-K9uOKlok.cjs';
3
3
  import 'zod/v4';
4
4
  import '../config-B2wlj9wx.cjs';
5
5
  import '@rivetkit/rivetkit-wasm';
@@ -1,5 +1,5 @@
1
1
  import { TestContext } from 'vitest';
2
- import { aI as Registry, a6 as Client } from '../config-DJ3KW-fe.js';
2
+ import { aI as Registry, a6 as Client } from '../config-XfKwGYxx.js';
3
3
  import 'zod/v4';
4
4
  import '../config-B2wlj9wx.js';
5
5
  import '@rivetkit/rivetkit-wasm';
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createClient
3
- } from "../chunk-QGK24TS3.js";
3
+ } from "../chunk-BOVQ3JQK.js";
4
4
  import {
5
5
  convertRegistryConfigToClientConfig
6
- } from "../chunk-33N3SX2W.js";
6
+ } from "../chunk-JOCSSMLU.js";
7
7
  import "../chunk-A2CF6PFH.js";
8
- import "../chunk-ISCHIEBJ.js";
9
8
  import "../chunk-JTHHCZCZ.js";
10
- import "../chunk-KYSDMIRN.js";
9
+ import "../chunk-PLZVADML.js";
10
+ import "../chunk-B5WDVY32.js";
11
11
  import "../chunk-ZOVJDAOW.js";
12
12
 
13
13
  // src/test/ready.ts
@@ -19,7 +19,7 @@
19
19
 
20
20
 
21
21
 
22
- var _chunkHD2OTPZYcjs = require('./chunk-HD2OTPZY.cjs');
22
+ var _chunkQI7E2UH5cjs = require('./chunk-QI7E2UH5.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 = _chunkHD2OTPZYcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkHD2OTPZYcjs.SinglePromiseQueue; exports.VERSION = _chunkHD2OTPZYcjs.VERSION; exports.arrayBuffersEqual = _chunkHD2OTPZYcjs.arrayBuffersEqual; exports.assertUnreachable = _chunkHD2OTPZYcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkHD2OTPZYcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkHD2OTPZYcjs.combineUrlPath; exports.dbg = _chunkHD2OTPZYcjs.dbg; exports.detectRuntime = _chunkHD2OTPZYcjs.detectRuntime; exports.getEnvUniversal = _chunkHD2OTPZYcjs.getEnvUniversal; exports.httpUserAgent = _chunkHD2OTPZYcjs.httpUserAgent; exports.interval = _chunkHD2OTPZYcjs.interval; exports.joinSignals = _chunkHD2OTPZYcjs.joinSignals; exports.jsonParseCompat = _chunkHD2OTPZYcjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkHD2OTPZYcjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkHD2OTPZYcjs.promiseWithResolvers; exports.setLongTimeout = _chunkHD2OTPZYcjs.setLongTimeout; exports.sleep = _chunkHD2OTPZYcjs.sleep; exports.stringifyError = _chunkHD2OTPZYcjs.stringifyError; exports.toUint8Array = _chunkHD2OTPZYcjs.toUint8Array;
45
+ exports.EXTRA_ERROR_LOG = _chunkQI7E2UH5cjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkQI7E2UH5cjs.SinglePromiseQueue; exports.VERSION = _chunkQI7E2UH5cjs.VERSION; exports.arrayBuffersEqual = _chunkQI7E2UH5cjs.arrayBuffersEqual; exports.assertUnreachable = _chunkQI7E2UH5cjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkQI7E2UH5cjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkQI7E2UH5cjs.combineUrlPath; exports.dbg = _chunkQI7E2UH5cjs.dbg; exports.detectRuntime = _chunkQI7E2UH5cjs.detectRuntime; exports.getEnvUniversal = _chunkQI7E2UH5cjs.getEnvUniversal; exports.httpUserAgent = _chunkQI7E2UH5cjs.httpUserAgent; exports.interval = _chunkQI7E2UH5cjs.interval; exports.joinSignals = _chunkQI7E2UH5cjs.joinSignals; exports.jsonParseCompat = _chunkQI7E2UH5cjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkQI7E2UH5cjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkQI7E2UH5cjs.promiseWithResolvers; exports.setLongTimeout = _chunkQI7E2UH5cjs.setLongTimeout; exports.sleep = _chunkQI7E2UH5cjs.sleep; exports.stringifyError = _chunkQI7E2UH5cjs.stringifyError; exports.toUint8Array = _chunkQI7E2UH5cjs.toUint8Array;
46
46
  //# sourceMappingURL=utils.cjs.map
@@ -19,7 +19,7 @@ import {
19
19
  sleep,
20
20
  stringifyError,
21
21
  toUint8Array
22
- } from "./chunk-KYSDMIRN.js";
22
+ } from "./chunk-B5WDVY32.js";
23
23
  import "./chunk-ZOVJDAOW.js";
24
24
  export {
25
25
  EXTRA_ERROR_LOG,
@@ -1,19 +1,19 @@
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 _chunkCNCOY7HZcjs = require('../chunk-CNCOY7HZ.cjs');
4
- require('../chunk-6M2QCAHK.cjs');
5
- require('../chunk-HY2NYO2Q.cjs');
3
+ var _chunkN7V3BQUBcjs = require('../chunk-N7V3BQUB.cjs');
4
+ require('../chunk-NSQWB4QD.cjs');
5
+ require('../chunk-LXSYHJ7E.cjs');
6
6
 
7
7
 
8
8
 
9
- var _chunkHDVZ6YZGcjs = require('../chunk-HDVZ6YZG.cjs');
9
+ var _chunkSSF2XC33cjs = require('../chunk-SSF2XC33.cjs');
10
10
 
11
11
 
12
12
 
13
13
  var _chunkRTWH3AX3cjs = require('../chunk-RTWH3AX3.cjs');
14
14
 
15
15
 
16
- var _chunkHD2OTPZYcjs = require('../chunk-HD2OTPZY.cjs');
16
+ var _chunkQI7E2UH5cjs = require('../chunk-QI7E2UH5.cjs');
17
17
 
18
18
 
19
19
 
@@ -746,13 +746,13 @@ function workflow(fn, options = {}) {
746
746
  function getWorkflowInspector(actorId) {
747
747
  let workflowInspector = workflowInspectors.get(actorId);
748
748
  if (!workflowInspector) {
749
- workflowInspector = _chunkCNCOY7HZcjs.createWorkflowInspectorAdapter.call(void 0, );
749
+ workflowInspector = _chunkN7V3BQUBcjs.createWorkflowInspectorAdapter.call(void 0, );
750
750
  workflowInspectors.set(actorId, workflowInspector);
751
751
  }
752
752
  return workflowInspector;
753
753
  }
754
754
  async function run(runCtx) {
755
- const actor = runCtx[_chunkHDVZ6YZGcjs.ACTOR_CONTEXT_INTERNAL_SYMBOL];
755
+ const actor = runCtx[_chunkSSF2XC33cjs.ACTOR_CONTEXT_INTERNAL_SYMBOL];
756
756
  _invariant2.default.call(void 0, actor, "workflow() requires an actor instance");
757
757
  const workflowInspector = getWorkflowInspector(actor.id);
758
758
  const driver = new ActorWorkflowDriver(actor, runCtx);
@@ -819,19 +819,19 @@ function workflow(fn, options = {}) {
819
819
  if (shouldRethrowWorkflowError(error)) {
820
820
  runCtx.log.error({
821
821
  msg: "workflow run failed",
822
- error: _chunkHD2OTPZYcjs.stringifyError.call(void 0, error)
822
+ error: _chunkQI7E2UH5cjs.stringifyError.call(void 0, error)
823
823
  });
824
824
  throw error;
825
825
  }
826
826
  runCtx.log.warn({
827
827
  msg: "workflow failed and will sleep until woken",
828
- error: _chunkHD2OTPZYcjs.stringifyError.call(void 0, error)
828
+ error: _chunkQI7E2UH5cjs.stringifyError.call(void 0, error)
829
829
  });
830
830
  } finally {
831
831
  runCtx.abortSignal.removeEventListener("abort", onAbort);
832
832
  }
833
833
  }
834
- return _chunkHDVZ6YZGcjs.defineRunHandler.call(void 0, run, {
834
+ return _chunkSSF2XC33cjs.defineRunHandler.call(void 0, run, {
835
835
  icon: "diagram-project",
836
836
  inspectorKind: "workflow",
837
837
  createInspector: ({ actorId, control }) => {
@@ -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-8NgsxIcT.cjs';
3
+ import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-K9uOKlok.cjs';
4
4
  import { A as AnyDatabaseProvider } from '../config-B2wlj9wx.cjs';
5
- import { d as WorkflowContext } from '../context-_RoE_YHL.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-_RoE_YHL.cjs';
5
+ import { d as WorkflowContext } from '../context-CPCM-xn6.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-CPCM-xn6.cjs';
7
7
  import 'zod/v4';
8
8
  import '@rivetkit/rivetkit-wasm';
9
9
  import 'zod';
@@ -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-DJ3KW-fe.js';
3
+ import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-XfKwGYxx.js';
4
4
  import { A as AnyDatabaseProvider } from '../config-B2wlj9wx.js';
5
- import { d as WorkflowContext } from '../context-BL8kUGjq.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-BL8kUGjq.js';
5
+ import { d as WorkflowContext } from '../context-Bm7mA4E3.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-Bm7mA4E3.js';
7
7
  import 'zod/v4';
8
8
  import '@rivetkit/rivetkit-wasm';
9
9
  import 'zod';
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  createWorkflowInspectorAdapter
3
- } from "../chunk-MPBDBG56.js";
4
- import "../chunk-76EPM7XH.js";
5
- import "../chunk-IHQRD4KC.js";
3
+ } from "../chunk-57I7SSSV.js";
4
+ import "../chunk-2JSFY7XD.js";
5
+ import "../chunk-QX7DWU46.js";
6
6
  import {
7
7
  ACTOR_CONTEXT_INTERNAL_SYMBOL,
8
8
  defineRunHandler
9
- } from "../chunk-6FEYCVZC.js";
9
+ } from "../chunk-UXDASKP6.js";
10
10
  import {
11
11
  makeWorkflowKey,
12
12
  workflowStoragePrefix
13
13
  } from "../chunk-A2CF6PFH.js";
14
14
  import {
15
15
  stringifyError
16
- } from "../chunk-KYSDMIRN.js";
16
+ } from "../chunk-B5WDVY32.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.0.1-preview.1",
3
+ "version": "3.0.1",
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.0.1-preview.1",
215
- "@rivetkit/engine-cli": "3.0.1-preview.1",
216
- "@rivetkit/engine-envoy-protocol": "3.0.1-preview.1",
214
+ "@rivetkit/engine-api-full": "3.0.1",
215
+ "@rivetkit/engine-cli": "3.0.1",
216
+ "@rivetkit/engine-envoy-protocol": "3.0.1",
217
217
  "@rivetkit/on-change": "6.0.1",
218
- "@rivetkit/rivetkit-napi": "3.0.1-preview.1",
219
- "@rivetkit/rivetkit-wasm": "3.0.1-preview.1",
220
- "@rivetkit/traces": "3.0.1-preview.1",
221
- "@rivetkit/virtual-websocket": "3.0.1-preview.1",
222
- "@rivetkit/workflow-engine": "3.0.1-preview.1",
218
+ "@rivetkit/rivetkit-napi": "3.0.1",
219
+ "@rivetkit/rivetkit-wasm": "3.0.1",
220
+ "@rivetkit/traces": "3.0.1",
221
+ "@rivetkit/virtual-websocket": "3.0.1",
222
+ "@rivetkit/workflow-engine": "3.0.1",
223
223
  "cbor-x": "^1.6.0",
224
224
  "drizzle-orm": "0.45.2",
225
225
  "hono": "^4.7.0",
@@ -248,6 +248,9 @@
248
248
  "vitest": "^3.1.1",
249
249
  "ws": "^8.18.1"
250
250
  },
251
+ "optionalDependencies": {
252
+ "@rivet-dev/services": "^0.2.5"
253
+ },
251
254
  "peerDependencies": {
252
255
  "drizzle-kit": "^0.31.2",
253
256
  "eventsource": "^4.0.0",
@@ -514,6 +514,8 @@ export type ActionContext<
514
514
  TEvents,
515
515
  TQueues
516
516
  > & {
517
+ /** Present only when a durable schedule or cron invokes this action. */
518
+ readonly scheduledFire?: ScheduledFireInfo;
517
519
  conn: Conn<
518
520
  TState,
519
521
  TConnParams,
@@ -200,8 +200,16 @@ export class ActorHandleRaw {
200
200
  },
201
201
  }).send(name, body, options as any);
202
202
  } catch (err) {
203
- const { group, code, message, metadata, rayId, actor } =
204
- deconstructError(err, true);
203
+ const {
204
+ group,
205
+ code,
206
+ message,
207
+ metadata,
208
+ rayId,
209
+ actor,
210
+ public: isPublic,
211
+ statusCode,
212
+ } = deconstructError(err, true);
205
213
 
206
214
  if (
207
215
  this.#shouldRetryQueueDispatchOverload(
@@ -272,6 +280,8 @@ export class ActorHandleRaw {
272
280
  }
273
281
 
274
282
  throw new ActorError(group, code, message, {
283
+ public: isPublic,
284
+ statusCode,
275
285
  metadata,
276
286
  rayId,
277
287
  actor,
@@ -434,8 +444,16 @@ export class ActorHandleRaw {
434
444
  }
435
445
  return output;
436
446
  } catch (err) {
437
- const { group, code, message, metadata, rayId, actor } =
438
- deconstructError(err, true);
447
+ const {
448
+ group,
449
+ code,
450
+ message,
451
+ metadata,
452
+ rayId,
453
+ actor,
454
+ public: isPublic,
455
+ statusCode,
456
+ } = deconstructError(err, true);
439
457
 
440
458
  if (
441
459
  await this.#shouldRetrySchedulingError(
@@ -476,7 +494,13 @@ export class ActorHandleRaw {
476
494
  "actor",
477
495
  "not_found",
478
496
  "The actor does not exist or was destroyed.",
479
- { metadata, rayId, actor },
497
+ {
498
+ public: true,
499
+ statusCode: 404,
500
+ metadata,
501
+ rayId,
502
+ actor,
503
+ },
480
504
  );
481
505
  }
482
506
 
@@ -498,6 +522,8 @@ export class ActorHandleRaw {
498
522
  }
499
523
 
500
524
  throw new ActorError(group, code, message, {
525
+ public: isPublic,
526
+ statusCode,
501
527
  metadata,
502
528
  rayId,
503
529
  actor,
@@ -779,8 +805,16 @@ export class ActorHandleRaw {
779
805
  }
780
806
  return response;
781
807
  } catch (err) {
782
- const { group, code, message, metadata, rayId, actor } =
783
- deconstructError(err, true);
808
+ const {
809
+ group,
810
+ code,
811
+ message,
812
+ metadata,
813
+ rayId,
814
+ actor,
815
+ public: isPublic,
816
+ statusCode,
817
+ } = deconstructError(err, true);
784
818
 
785
819
  if (
786
820
  await this.#shouldRetrySchedulingError(
@@ -828,6 +862,8 @@ export class ActorHandleRaw {
828
862
  }
829
863
 
830
864
  throw new ActorError(group, code, message, {
865
+ public: isPublic,
866
+ statusCode,
831
867
  metadata,
832
868
  rayId,
833
869
  actor,
@@ -65,7 +65,12 @@ function classifyActorError(
65
65
  return undefined;
66
66
  }
67
67
 
68
- if (error.group === "actor" && error.code === "restarting") {
68
+ // `actor.migrating_from_v2` is a refusal while the actor moves in from a V2 cluster; it
69
+ // carries a `retry_after_ms` hint.
70
+ if (
71
+ error.group === "actor" &&
72
+ (error.code === "restarting" || error.code === "migrating_from_v2")
73
+ ) {
69
74
  return buildLifecycleBoundaryInfo(
70
75
  "request_retry",
71
76
  "actor_error",
@@ -129,9 +129,23 @@ export async function rawHttpFetch(
129
129
  return driver.sendRequest(target, proxyRequest, options);
130
130
  } catch (err) {
131
131
  // Standardize to ClientActorError instead of the native backend error
132
- const { group, code, message, metadata, rayId, actor } =
133
- deconstructError(err, true);
134
- throw new ActorError(group, code, message, { metadata, rayId, actor });
132
+ const {
133
+ group,
134
+ code,
135
+ message,
136
+ metadata,
137
+ rayId,
138
+ actor,
139
+ public: isPublic,
140
+ statusCode,
141
+ } = deconstructError(err, true);
142
+ throw new ActorError(group, code, message, {
143
+ public: isPublic,
144
+ statusCode,
145
+ metadata,
146
+ rayId,
147
+ actor,
148
+ });
135
149
  }
136
150
  }
137
151
 
@@ -169,6 +169,10 @@ export async function sendHttpRequest<
169
169
  }),
170
170
  );
171
171
  } catch (error) {
172
+ // Credential providers and custom transports can already supply a structured error.
173
+ if (ActorError.isRivetError(error)) {
174
+ throw error;
175
+ }
172
176
  throw new HttpRequestError(`Request failed: ${error}`, {
173
177
  cause: error,
174
178
  });
@@ -251,8 +251,8 @@ export const RegistryConfigSchema = z
251
251
  .default(() => getRivetRunEngineVersion() ?? VERSION),
252
252
  /**
253
253
  * Starts the first-party Services actor host when RivetKit manages
254
- * a local engine. Disabled by default. Set RIVET_RUN_SERVICES=1
255
- * or startServices: true to enable it.
254
+ * a local engine. Enabled by default for a managed local Engine. Set
255
+ * RIVET_RUN_SERVICES=0 or startServices: false to disable it.
256
256
  */
257
257
  startServices: z.boolean().optional(),
258
258
  /**
@@ -369,7 +369,9 @@ export const RegistryConfigSchema = z
369
369
  ? localEngineEndpoint
370
370
  : (parsedEndpoint?.endpoint ??
371
371
  (isDevEnv ? localEngineEndpoint : undefined));
372
- const startServices = config.startServices ?? getRivetRunServices();
372
+ const engineSpawn = !parsedEndpoint && Boolean(endpoint);
373
+ const startServices =
374
+ config.startServices ?? getRivetRunServices() ?? engineSpawn;
373
375
  const validateServerlessEndpoint = Boolean(
374
376
  config.startEngine || parsedEndpoint,
375
377
  );
@@ -419,7 +421,7 @@ export const RegistryConfigSchema = z
419
421
  ...config,
420
422
  sqlite,
421
423
  endpoint,
422
- engineSpawn: !parsedEndpoint && Boolean(endpoint),
424
+ engineSpawn,
423
425
  startServices,
424
426
  namespace,
425
427
  token,
@@ -656,7 +658,7 @@ export const DocRegistryConfigSchema = z
656
658
  .boolean()
657
659
  .optional()
658
660
  .describe(
659
- "Starts Services when RivetKit manages a local Engine. Disabled by default. Set RIVET_RUN_SERVICES=1 or startServices: true to enable.",
661
+ "Starts Services when RivetKit manages a local Engine. Enabled by default for a managed local Engine. Set RIVET_RUN_SERVICES=0 or startServices: false to disable.",
660
662
  ),
661
663
  configurePool: DocConfigurePoolSchema.describe(
662
664
  "Automatically configure serverless nodes in the engine.",
@@ -5512,6 +5512,11 @@ export function buildNativeFactory(
5512
5512
  conn != null
5513
5513
  ? makeConnCtx(ctx, conn, undefined, cancelToken)
5514
5514
  : makeActorCtx(ctx, undefined, cancelToken);
5515
+ if (scheduledFire) {
5516
+ Object.defineProperty(actorCtx, "scheduledFire", {
5517
+ value: scheduledFire,
5518
+ });
5519
+ }
5515
5520
  const runAction = async () => {
5516
5521
  try {
5517
5522
  return encodeValue(
@@ -5680,7 +5685,7 @@ export function buildNativeFactory(
5680
5685
 
5681
5686
  export async function buildServeConfig(
5682
5687
  config: RegistryConfig,
5683
- resolveServicesBinary = true,
5688
+ resolveNativeBinaries = true,
5684
5689
  ): Promise<RuntimeServeConfig> {
5685
5690
  if (!config.endpoint) {
5686
5691
  throw nativeEndpointNotConfiguredError();
@@ -5693,7 +5698,7 @@ export async function buildServeConfig(
5693
5698
  token: config.token,
5694
5699
  namespace: config.namespace,
5695
5700
  poolName: config.node.poolName,
5696
- startServices: resolveServicesBinary && config.startServices,
5701
+ startServices: resolveNativeBinaries && config.startServices,
5697
5702
  handleInspectorHttpInRuntime: true,
5698
5703
  serverlessBasePath: config.serverless.basePath,
5699
5704
  serverlessPackageVersion: VERSION,
@@ -5704,28 +5709,30 @@ export async function buildServeConfig(
5704
5709
  serverlessMaxStartPayloadBytes: config.serverless.maxStartPayloadBytes,
5705
5710
  };
5706
5711
 
5707
- // Always best-effort resolve the npm-installed engine binary and hand its
5708
- // path to the core. The core alone decides whether to actually spawn a local
5712
+ // For native runtimes, best-effort resolve the npm-installed engine binary
5713
+ // and hand its path to the core. The core decides whether to spawn a local
5709
5714
  // engine using the resolved spawn decision, so
5710
5715
  // JS must not duplicate that decision here. Only JS knows the npm
5711
5716
  // `node_modules` layout, so it resolves the path; if no binary is available
5712
5717
  // (remote-only install, unsupported platform, optional deps skipped), leave
5713
5718
  // it unset and let the core report `engine.binary_unavailable` if it actually
5714
5719
  // needs one.
5715
- try {
5716
- const { getEnginePath } = await loadEngineCli();
5717
- serveConfig.engineBinaryPath = getEnginePath();
5718
- } catch (error) {
5719
- // The npm-installed engine binary could not be resolved. The core still
5720
- // decides whether it needs to spawn a local engine; if it does, it will
5721
- // fail with engine.binary_unavailable (auto-download is off in the napi
5722
- // runtime). Warn so the cause is actionable.
5723
- logger().warn({
5724
- msg: "could not resolve a local engine binary; if a local engine must be spawned it will fail with engine.binary_unavailable — set RIVET_ENGINE_BINARY_PATH or install the @rivetkit/engine-cli platform package",
5725
- error: stringifyError(error),
5726
- });
5720
+ if (resolveNativeBinaries) {
5721
+ try {
5722
+ const { getEnginePath } = await loadEngineCli();
5723
+ serveConfig.engineBinaryPath = getEnginePath();
5724
+ } catch (error) {
5725
+ // The npm-installed engine binary could not be resolved. The core still
5726
+ // decides whether it needs to spawn a local engine; if it does, it will
5727
+ // fail with engine.binary_unavailable (auto-download is off in the napi
5728
+ // runtime). Warn so the cause is actionable.
5729
+ logger().warn({
5730
+ msg: "could not resolve a local engine binary; if a local engine must be spawned it will fail with engine.binary_unavailable — set RIVET_ENGINE_BINARY_PATH or install the @rivetkit/engine-cli platform package",
5731
+ error: stringifyError(error),
5732
+ });
5733
+ }
5727
5734
  }
5728
- if (resolveServicesBinary && config.startServices) {
5735
+ if (resolveNativeBinaries && config.startServices) {
5729
5736
  const servicesBinary = getEnvUniversal("RIVET_SERVICES_BINARY");
5730
5737
  if (servicesBinary) {
5731
5738
  serveConfig.servicesBinaryPath = servicesBinary;
@@ -885,7 +885,7 @@ export interface RuntimeBundle {
885
885
 
886
886
  export function servicesBinaryUnavailable(cause: unknown): Error {
887
887
  return new Error(
888
- "services.binary_unavailable: Install @rivet-dev/services yourself to run local Services, or set RIVET_SERVICES_BINARY to its executable path.",
888
+ "services.binary_unavailable: Install @rivet-dev/services to run local Services, set RIVET_SERVICES_BINARY to its executable path, or set RIVET_RUN_SERVICES=0 to disable Services.",
889
889
  { cause },
890
890
  );
891
891
  }
@@ -30,8 +30,10 @@ export const getRivetRunEnginePort = (): number | undefined => {
30
30
  };
31
31
  export const getRivetRunEngineVersion = (): string | undefined =>
32
32
  getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
33
- export const getRivetRunServices = (): boolean =>
34
- getEnvUniversal("RIVET_RUN_SERVICES") === "1";
33
+ export const getRivetRunServices = (): boolean | undefined => {
34
+ const value = getEnvUniversal("RIVET_RUN_SERVICES");
35
+ return value === undefined ? undefined : value === "1";
36
+ };
35
37
  export const getRivetEnvoyKind = (): string | undefined =>
36
38
  getEnvUniversal("RIVET_NODE_KIND") ?? getEnvUniversal("RIVET_ENVOY_KIND");
37
39
  export const getRivetEnvoyVersion = (): number | undefined => {