rivetkit 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.d.ts +11 -0
- package/dist/browser/client.js +1 -1
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/inspector.tar.gz +0 -0
- package/dist/tsup/{chunk-MNS5LY6M.cjs → chunk-3B6PCYJB.cjs} +280 -115
- package/dist/tsup/chunk-3B6PCYJB.cjs.map +1 -0
- package/dist/tsup/{chunk-YQ5P6KMN.js → chunk-3GTO6H3E.js} +12 -5
- package/dist/tsup/chunk-3GTO6H3E.js.map +1 -0
- package/dist/tsup/{chunk-RMJJE43B.cjs → chunk-4KSHPFXF.cjs} +2 -2
- package/dist/tsup/{chunk-RMJJE43B.cjs.map → chunk-4KSHPFXF.cjs.map} +1 -1
- package/dist/tsup/{chunk-PW3YONDJ.js → chunk-5UEFNG7P.js} +2 -2
- package/dist/tsup/{chunk-PSUVV4HM.js → chunk-ANKZ2FS6.js} +2 -4
- package/dist/tsup/chunk-ANKZ2FS6.js.map +1 -0
- package/dist/tsup/{chunk-GVQAVU7R.cjs → chunk-AQD4CBZ2.cjs} +4 -4
- package/dist/tsup/{chunk-GVQAVU7R.cjs.map → chunk-AQD4CBZ2.cjs.map} +1 -1
- package/dist/tsup/{chunk-WUXR722E.js → chunk-DZXDUGLL.js} +2 -2
- package/dist/tsup/{chunk-WUXR722E.js.map → chunk-DZXDUGLL.js.map} +1 -1
- package/dist/tsup/{chunk-NXEHFUDB.cjs → chunk-GXRVSSVD.cjs} +28 -21
- package/dist/tsup/chunk-GXRVSSVD.cjs.map +1 -0
- package/dist/tsup/{chunk-UZV7NXC6.cjs → chunk-H5TSEPN4.cjs} +30 -30
- package/dist/tsup/{chunk-UZV7NXC6.cjs.map → chunk-H5TSEPN4.cjs.map} +1 -1
- package/dist/tsup/{chunk-TDFDR7AO.js → chunk-HBYEYBIC.js} +2 -2
- package/dist/tsup/{chunk-772NPMTY.cjs → chunk-HKOSZKKZ.cjs} +263 -299
- package/dist/tsup/chunk-HKOSZKKZ.cjs.map +1 -0
- package/dist/tsup/{chunk-HB4RGGMC.js → chunk-I6PL6QIY.js} +5 -5
- package/dist/tsup/{chunk-RHUII57M.js → chunk-KTWY3K6Z.js} +23 -12
- package/dist/tsup/chunk-KTWY3K6Z.js.map +1 -0
- package/dist/tsup/{chunk-HFWRHT5T.cjs → chunk-LK36OGGO.cjs} +3 -5
- package/dist/tsup/chunk-LK36OGGO.cjs.map +1 -0
- package/dist/tsup/{chunk-BSIJG3LG.js → chunk-M6H4XIF4.js} +179 -215
- package/dist/tsup/chunk-M6H4XIF4.js.map +1 -0
- package/dist/tsup/{chunk-ZHQDRRMY.cjs → chunk-QPADHLDU.cjs} +3 -3
- package/dist/tsup/{chunk-ZHQDRRMY.cjs.map → chunk-QPADHLDU.cjs.map} +1 -1
- package/dist/tsup/{chunk-BFI4LYS2.js → chunk-TEFYRRAK.js} +4 -4
- package/dist/tsup/{chunk-PZAV6PP2.cjs → chunk-TEUL4UYN.cjs} +152 -152
- package/dist/tsup/{chunk-PZAV6PP2.cjs.map → chunk-TEUL4UYN.cjs.map} +1 -1
- package/dist/tsup/{chunk-VMX4I4MP.js → chunk-UDMRZR6A.js} +212 -47
- package/dist/tsup/chunk-UDMRZR6A.js.map +1 -0
- package/dist/tsup/{chunk-QABDKI3W.cjs → chunk-UWAGLDT6.cjs} +263 -252
- package/dist/tsup/chunk-UWAGLDT6.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-P3XujgRr.d.ts → config-Qj-zLJPc.d.ts} +11 -0
- package/dist/tsup/{config-_gfywqqI.d.cts → config-iPj5l1bL.d.cts} +11 -0
- package/dist/tsup/{context-uNA4TRn3.d.ts → context-CQCMuHND.d.ts} +1 -1
- package/dist/tsup/{context-Bxd8Cx4H.d.cts → context-DzvH1PBK.d.cts} +1 -1
- package/dist/tsup/{driver-CPGHKXyh.d.ts → driver-Jo8v-kbU.d.ts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +4 -4
- package/dist/tsup/driver-helpers/mod.d.cts +4 -4
- package/dist/tsup/driver-helpers/mod.d.ts +4 -4
- package/dist/tsup/driver-helpers/mod.js +3 -3
- package/dist/tsup/{driver-BcLvZcKl.d.cts → driver-iV8J-WMv.d.cts} +1 -1
- package/dist/tsup/driver-test-suite/mod.cjs +556 -333
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
- package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
- package/dist/tsup/driver-test-suite/mod.js +1332 -1109
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +3 -3
- package/dist/tsup/inspector/mod.js +2 -2
- package/dist/tsup/mod.cjs +8 -8
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +7 -7
- package/dist/tsup/serve-test-suite/mod.cjs +194 -100
- package/dist/tsup/serve-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/serve-test-suite/mod.js +105 -11
- package/dist/tsup/serve-test-suite/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +10 -10
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +5 -5
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +4 -4
- package/package.json +5 -5
- package/src/actor/config.ts +0 -2
- package/src/actor/instance/mod.ts +30 -6
- package/src/actor/router.ts +9 -6
- package/src/driver-test-suite/mod.ts +3 -0
- package/src/driver-test-suite/tests/actor-db.ts +299 -216
- package/src/driver-test-suite/tests/actor-driver.ts +4 -0
- package/src/driver-test-suite/tests/actor-lifecycle.ts +157 -0
- package/src/driver-test-suite/tests/actor-queue.ts +10 -9
- package/src/driver-test-suite/tests/actor-workflow.ts +12 -2
- package/src/driver-test-suite/tests/conn-error-serialization.ts +64 -0
- package/src/driver-test-suite/utils.ts +8 -8
- package/src/drivers/engine/actor-driver.ts +113 -11
- package/src/manager/router.ts +20 -6
- package/src/{registry → utils}/serve.ts +38 -4
- package/src/workflow/context.ts +4 -0
- package/src/workflow/driver.ts +4 -1
- package/dist/tsup/chunk-772NPMTY.cjs.map +0 -1
- package/dist/tsup/chunk-BSIJG3LG.js.map +0 -1
- package/dist/tsup/chunk-HFWRHT5T.cjs.map +0 -1
- package/dist/tsup/chunk-MNS5LY6M.cjs.map +0 -1
- package/dist/tsup/chunk-NXEHFUDB.cjs.map +0 -1
- package/dist/tsup/chunk-PSUVV4HM.js.map +0 -1
- package/dist/tsup/chunk-QABDKI3W.cjs.map +0 -1
- package/dist/tsup/chunk-RHUII57M.js.map +0 -1
- package/dist/tsup/chunk-VMX4I4MP.js.map +0 -1
- package/dist/tsup/chunk-YQ5P6KMN.js.map +0 -1
- /package/dist/tsup/{chunk-PW3YONDJ.js.map → chunk-5UEFNG7P.js.map} +0 -0
- /package/dist/tsup/{chunk-TDFDR7AO.js.map → chunk-HBYEYBIC.js.map} +0 -0
- /package/dist/tsup/{chunk-HB4RGGMC.js.map → chunk-I6PL6QIY.js.map} +0 -0
- /package/dist/tsup/{chunk-BFI4LYS2.js.map → chunk-TEFYRRAK.js.map} +0 -0
package/dist/tsup/test/mod.cjs
CHANGED
|
@@ -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
|
|
3
|
+
var _chunkUWAGLDT6cjs = require('../chunk-UWAGLDT6.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('../chunk-
|
|
6
|
+
var _chunkTEUL4UYNcjs = require('../chunk-TEUL4UYN.cjs');
|
|
7
|
+
require('../chunk-QPADHLDU.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk3B6PCYJBcjs = require('../chunk-3B6PCYJB.cjs');
|
|
11
11
|
require('../chunk-NIYZDWMW.cjs');
|
|
12
|
-
require('../chunk-
|
|
12
|
+
require('../chunk-LK36OGGO.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunk4KSHPFXFcjs = require('../chunk-4KSHPFXF.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
|
|
26
|
+
return _chunk4KSHPFXFcjs.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 =
|
|
33
|
+
const driver = _chunkUWAGLDT6cjs.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 } =
|
|
48
|
+
const { router } = _chunk3B6PCYJBcjs.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 =
|
|
78
|
+
const client = _chunkTEUL4UYNcjs.createClient.call(void 0, {
|
|
79
79
|
endpoint,
|
|
80
80
|
namespace: "default",
|
|
81
81
|
runnerName: "default",
|
package/dist/tsup/test/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestContext } from 'vitest';
|
|
2
|
-
import { a5 as Registry, C as Client } from '../config-
|
|
2
|
+
import { a5 as Registry, C as Client } from '../config-iPj5l1bL.cjs';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '@rivetkit/virtual-websocket';
|
|
5
5
|
import '../config-BiNoIHRs.cjs';
|
package/dist/tsup/test/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestContext } from 'vitest';
|
|
2
|
-
import { a5 as Registry, C as Client } from '../config-
|
|
2
|
+
import { a5 as Registry, C as Client } from '../config-Qj-zLJPc.js';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '@rivetkit/virtual-websocket';
|
|
5
5
|
import '../config-BiNoIHRs.js';
|
package/dist/tsup/test/mod.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createFileSystemOrMemoryDriver
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-KTWY3K6Z.js";
|
|
4
4
|
import {
|
|
5
5
|
createClient
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-I6PL6QIY.js";
|
|
7
|
+
import "../chunk-5UEFNG7P.js";
|
|
8
8
|
import {
|
|
9
9
|
buildManagerRouter
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-UDMRZR6A.js";
|
|
11
11
|
import "../chunk-LXUQ667X.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-ANKZ2FS6.js";
|
|
13
13
|
import {
|
|
14
14
|
getLogger
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-DZXDUGLL.js";
|
|
16
16
|
import "../chunk-7HTNH26M.js";
|
|
17
17
|
import "../chunk-424PT5DM.js";
|
|
18
18
|
|
package/dist/tsup/utils.cjs
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunk4KSHPFXFcjs = require('./chunk-4KSHPFXF.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 =
|
|
42
|
+
exports.EXTRA_ERROR_LOG = _chunk4KSHPFXFcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunk4KSHPFXFcjs.SinglePromiseQueue; exports.VERSION = _chunk4KSHPFXFcjs.VERSION; exports.arrayBuffersEqual = _chunk4KSHPFXFcjs.arrayBuffersEqual; exports.assertUnreachable = _chunk4KSHPFXFcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunk4KSHPFXFcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunk4KSHPFXFcjs.combineUrlPath; exports.dbg = _chunk4KSHPFXFcjs.dbg; exports.detectRuntime = _chunk4KSHPFXFcjs.detectRuntime; exports.getEnvUniversal = _chunk4KSHPFXFcjs.getEnvUniversal; exports.httpUserAgent = _chunk4KSHPFXFcjs.httpUserAgent; exports.interval = _chunk4KSHPFXFcjs.interval; exports.joinSignals = _chunk4KSHPFXFcjs.joinSignals; exports.promiseWithResolvers = _chunk4KSHPFXFcjs.promiseWithResolvers; exports.setLongTimeout = _chunk4KSHPFXFcjs.setLongTimeout; exports.sleep = _chunk4KSHPFXFcjs.sleep; exports.stringifyError = _chunk4KSHPFXFcjs.stringifyError; exports.toUint8Array = _chunk4KSHPFXFcjs.toUint8Array;
|
|
43
43
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/tsup/utils.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('../chunk-
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
5
|
+
var _chunkGXRVSSVDcjs = require('../chunk-GXRVSSVD.cjs');
|
|
6
|
+
require('../chunk-AQD4CBZ2.cjs');
|
|
7
|
+
require('../chunk-LK36OGGO.cjs');
|
|
8
|
+
require('../chunk-4KSHPFXF.cjs');
|
|
9
9
|
require('../chunk-L47L3ZWJ.cjs');
|
|
10
10
|
require('../chunk-HDQ2JUQT.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
exports.ActorWorkflowContext =
|
|
15
|
+
exports.ActorWorkflowContext = _chunkGXRVSSVDcjs.ActorWorkflowContext; exports.Loop = _chunkGXRVSSVDcjs.Loop; exports.workflow = _chunkGXRVSSVDcjs.workflow;
|
|
16
16
|
//# sourceMappingURL=mod.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as EventSchemaConfig, Q as QueueSchemaConfig, ad as RunContext } from '../config-
|
|
1
|
+
import { c as EventSchemaConfig, Q as QueueSchemaConfig, ad as RunContext } from '../config-iPj5l1bL.cjs';
|
|
2
2
|
import { A as AnyDatabaseProvider } from '../config-BiNoIHRs.cjs';
|
|
3
|
-
import { A as ActorWorkflowContext } from '../context-
|
|
4
|
-
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-
|
|
3
|
+
import { A as ActorWorkflowContext } from '../context-DzvH1PBK.cjs';
|
|
4
|
+
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-DzvH1PBK.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-
|
|
1
|
+
import { c as EventSchemaConfig, Q as QueueSchemaConfig, ad as RunContext } from '../config-Qj-zLJPc.js';
|
|
2
2
|
import { A as AnyDatabaseProvider } from '../config-BiNoIHRs.js';
|
|
3
|
-
import { A as ActorWorkflowContext } from '../context-
|
|
4
|
-
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-
|
|
3
|
+
import { A as ActorWorkflowContext } from '../context-CQCMuHND.js';
|
|
4
|
+
export { W as WorkflowBranchContextOf, a as WorkflowContextOf, b as WorkflowLoopContextOf, c as WorkflowStepContextOf } from '../context-CQCMuHND.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-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-3GTO6H3E.js";
|
|
6
|
+
import "../chunk-HBYEYBIC.js";
|
|
7
|
+
import "../chunk-ANKZ2FS6.js";
|
|
8
|
+
import "../chunk-DZXDUGLL.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.
|
|
3
|
+
"version": "2.1.4",
|
|
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/
|
|
223
|
-
"@rivetkit/
|
|
222
|
+
"@rivetkit/sqlite-vfs": "2.1.4",
|
|
223
|
+
"@rivetkit/engine-runner": "2.1.4",
|
|
224
|
+
"@rivetkit/traces": "2.1.4",
|
|
224
225
|
"@rivetkit/virtual-websocket": "2.0.33",
|
|
225
|
-
"@rivetkit/
|
|
226
|
-
"@rivetkit/workflow-engine": "2.1.2"
|
|
226
|
+
"@rivetkit/workflow-engine": "2.1.4"
|
|
227
227
|
},
|
|
228
228
|
"devDependencies": {
|
|
229
229
|
"@bare-ts/tools": "^0.13.0",
|
package/src/actor/config.ts
CHANGED
|
@@ -208,9 +208,7 @@ export const ActorConfigSchema = z
|
|
|
208
208
|
createVarsTimeout: z.number().positive().default(5000),
|
|
209
209
|
createConnStateTimeout: z.number().positive().default(5000),
|
|
210
210
|
onConnectTimeout: z.number().positive().default(5000),
|
|
211
|
-
// This must be less than engine config > pegboard.actor_stop_threshold
|
|
212
211
|
onSleepTimeout: z.number().positive().default(5000),
|
|
213
|
-
// This must be less than engine config > pegboard.actor_stop_threshold
|
|
214
212
|
onDestroyTimeout: z.number().positive().default(5000),
|
|
215
213
|
stateSaveInterval: z.number().positive().default(10_000),
|
|
216
214
|
actionTimeout: z.number().positive().default(60_000),
|
|
@@ -195,6 +195,19 @@ export class ActorInstance<
|
|
|
195
195
|
// MARK: - Tracing
|
|
196
196
|
#traces!: Traces<OtlpExportTraceServiceRequestJson>;
|
|
197
197
|
|
|
198
|
+
// MARK: - Driver Overrides
|
|
199
|
+
/**
|
|
200
|
+
* Per-instance config option overrides applied by the driver after creation.
|
|
201
|
+
* When set, the effective option value is the minimum of the base config
|
|
202
|
+
* value and the override value.
|
|
203
|
+
*/
|
|
204
|
+
overrides: {
|
|
205
|
+
onSleepTimeout?: number;
|
|
206
|
+
onDestroyTimeout?: number;
|
|
207
|
+
runStopTimeout?: number;
|
|
208
|
+
waitUntilTimeout?: number;
|
|
209
|
+
} = {};
|
|
210
|
+
|
|
198
211
|
// MARK: - Constructor
|
|
199
212
|
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>) {
|
|
200
213
|
this.#config = config;
|
|
@@ -486,13 +499,16 @@ export class ActorInstance<
|
|
|
486
499
|
this.#sleepTimeout = undefined;
|
|
487
500
|
}
|
|
488
501
|
|
|
489
|
-
// Abort listeners
|
|
502
|
+
// Abort listeners in the canonical stop path.
|
|
503
|
+
// This must run for all stop modes, including sleep and remote stop.
|
|
504
|
+
// Destroy may have already triggered an early abort, but repeating abort
|
|
505
|
+
// is intentional and safe.
|
|
490
506
|
try {
|
|
491
507
|
this.#abortController.abort();
|
|
492
508
|
} catch { }
|
|
493
509
|
|
|
494
510
|
// Wait for run handler to complete
|
|
495
|
-
await this.#waitForRunHandler(this.#config.options.runStopTimeout);
|
|
511
|
+
await this.#waitForRunHandler(this.overrides.runStopTimeout !== undefined ? Math.min(this.#config.options.runStopTimeout, this.overrides.runStopTimeout) : this.#config.options.runStopTimeout);
|
|
496
512
|
|
|
497
513
|
// Call onStop lifecycle
|
|
498
514
|
if (mode === "sleep") {
|
|
@@ -508,7 +524,7 @@ export class ActorInstance<
|
|
|
508
524
|
|
|
509
525
|
// Wait for background tasks
|
|
510
526
|
await this.#waitBackgroundPromises(
|
|
511
|
-
this.#config.options.waitUntilTimeout,
|
|
527
|
+
this.overrides.waitUntilTimeout !== undefined ? Math.min(this.#config.options.waitUntilTimeout, this.overrides.waitUntilTimeout) : this.#config.options.waitUntilTimeout,
|
|
512
528
|
);
|
|
513
529
|
|
|
514
530
|
// Clear timeouts and save state
|
|
@@ -574,6 +590,14 @@ export class ActorInstance<
|
|
|
574
590
|
}
|
|
575
591
|
this.#destroyCalled = true;
|
|
576
592
|
|
|
593
|
+
// Abort immediately so in flight waits can exit before the driver stop
|
|
594
|
+
// handshake completes.
|
|
595
|
+
// The onStop path will call abort again as a safety net for all stop
|
|
596
|
+
// modes.
|
|
597
|
+
try {
|
|
598
|
+
this.#abortController.abort();
|
|
599
|
+
} catch {}
|
|
600
|
+
|
|
577
601
|
const destroy = this.driver.startDestroy.bind(
|
|
578
602
|
this.driver,
|
|
579
603
|
this.#actorId,
|
|
@@ -958,7 +982,7 @@ export class ActorInstance<
|
|
|
958
982
|
* Errors are propagated to the caller.
|
|
959
983
|
*/
|
|
960
984
|
async keepAwake<T>(promise: Promise<T>): Promise<T> {
|
|
961
|
-
this.assertReady();
|
|
985
|
+
this.assertReady(true);
|
|
962
986
|
|
|
963
987
|
this.#activeKeepAwakeCount++;
|
|
964
988
|
this.resetSleepTimer();
|
|
@@ -1254,7 +1278,7 @@ export class ActorInstance<
|
|
|
1254
1278
|
if (result instanceof Promise) {
|
|
1255
1279
|
await deadline(
|
|
1256
1280
|
result,
|
|
1257
|
-
this.#config.options.onSleepTimeout,
|
|
1281
|
+
this.overrides.onSleepTimeout !== undefined ? Math.min(this.#config.options.onSleepTimeout, this.overrides.onSleepTimeout) : this.#config.options.onSleepTimeout,
|
|
1258
1282
|
);
|
|
1259
1283
|
}
|
|
1260
1284
|
},
|
|
@@ -1286,7 +1310,7 @@ export class ActorInstance<
|
|
|
1286
1310
|
if (result instanceof Promise) {
|
|
1287
1311
|
await deadline(
|
|
1288
1312
|
result,
|
|
1289
|
-
this.#config.options.onDestroyTimeout,
|
|
1313
|
+
this.overrides.onDestroyTimeout !== undefined ? Math.min(this.#config.options.onDestroyTimeout, this.overrides.onDestroyTimeout) : this.#config.options.onDestroyTimeout,
|
|
1290
1314
|
);
|
|
1291
1315
|
}
|
|
1292
1316
|
},
|
package/src/actor/router.ts
CHANGED
|
@@ -20,11 +20,10 @@ import {
|
|
|
20
20
|
} from "@/common/router";
|
|
21
21
|
import { noopNext } from "@/common/utils";
|
|
22
22
|
import { inspectorLogger } from "@/inspector/log";
|
|
23
|
-
import { timingSafeEqual } from "@/utils/crypto";
|
|
24
|
-
import { getNodeEnv } from "@/utils/env-vars";
|
|
25
|
-
|
|
26
23
|
import type { RegistryConfig } from "@/registry/config";
|
|
27
24
|
import { type GetUpgradeWebSocket, VERSION } from "@/utils";
|
|
25
|
+
import { timingSafeEqual } from "@/utils/crypto";
|
|
26
|
+
import { isDev } from "@/utils/env-vars";
|
|
28
27
|
import { CONN_DRIVER_SYMBOL } from "./conn/mod";
|
|
29
28
|
import type { ActorDriver } from "./driver";
|
|
30
29
|
import { loggerWithoutContext } from "./log";
|
|
@@ -167,14 +166,16 @@ export function createActorRouter(
|
|
|
167
166
|
if (config.inspector.enabled) {
|
|
168
167
|
// Auth middleware for inspector routes
|
|
169
168
|
const inspectorAuth = async (c: any): Promise<Response | undefined> => {
|
|
170
|
-
if (
|
|
169
|
+
if (isDev() && !config.inspector.token()) {
|
|
171
170
|
inspectorLogger().warn({
|
|
172
171
|
msg: "RIVET_INSPECTOR_TOKEN is not set, skipping inspector auth in development mode",
|
|
173
172
|
});
|
|
174
173
|
return undefined;
|
|
175
174
|
}
|
|
176
175
|
|
|
177
|
-
const userToken = c.req
|
|
176
|
+
const userToken = c.req
|
|
177
|
+
.header("Authorization")
|
|
178
|
+
?.replace("Bearer ", "");
|
|
178
179
|
if (!userToken) {
|
|
179
180
|
return c.text("Unauthorized", 401);
|
|
180
181
|
}
|
|
@@ -197,7 +198,9 @@ export function createActorRouter(
|
|
|
197
198
|
|
|
198
199
|
const actor = await actorDriver.loadActor(c.env.actorId);
|
|
199
200
|
const isStateEnabled = actor.inspector.isStateEnabled();
|
|
200
|
-
const state = isStateEnabled
|
|
201
|
+
const state = isStateEnabled
|
|
202
|
+
? actor.inspector.getStateJson()
|
|
203
|
+
: undefined;
|
|
201
204
|
return c.json({ state, isStateEnabled });
|
|
202
205
|
});
|
|
203
206
|
|
|
@@ -17,6 +17,7 @@ import { runActorConnTests } from "./tests/actor-conn";
|
|
|
17
17
|
import { runActorConnHibernationTests } from "./tests/actor-conn-hibernation";
|
|
18
18
|
import { runActorConnStateTests } from "./tests/actor-conn-state";
|
|
19
19
|
import { runActorDbTests } from "./tests/actor-db";
|
|
20
|
+
import { runConnErrorSerializationTests } from "./tests/conn-error-serialization";
|
|
20
21
|
import { runActorDestroyTests } from "./tests/actor-destroy";
|
|
21
22
|
import { runActorDriverTests } from "./tests/actor-driver";
|
|
22
23
|
import { runActorErrorHandlingTests } from "./tests/actor-error-handling";
|
|
@@ -111,6 +112,8 @@ export function runDriverTests(
|
|
|
111
112
|
|
|
112
113
|
runActorConnHibernationTests(driverTestConfig);
|
|
113
114
|
|
|
115
|
+
runConnErrorSerializationTests(driverTestConfig);
|
|
116
|
+
|
|
114
117
|
runActorDbTests(driverTestConfig);
|
|
115
118
|
|
|
116
119
|
runActorDestroyTests(driverTestConfig);
|