rivetkit 2.3.12-rc.3 → 2.3.12
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 +17 -2
- package/dist/browser/client.js +32 -24
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +2 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/agent-os/index.cjs +2 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +17 -2
- package/dist/tsup/agent-os/index.d.ts +17 -2
- package/dist/tsup/agent-os/index.js +2 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-SPJORZMM.cjs → chunk-2JSYYH6P.cjs} +1 -1
- package/dist/tsup/chunk-2JSYYH6P.cjs.map +1 -0
- package/dist/tsup/{chunk-IJWTHKH6.cjs → chunk-AN7WO7BM.cjs} +3 -3
- package/dist/tsup/{chunk-IJWTHKH6.cjs.map → chunk-AN7WO7BM.cjs.map} +1 -1
- package/dist/tsup/{chunk-PSXMESQJ.js → chunk-EBXARMGI.js} +2 -2
- package/dist/tsup/{chunk-O6H3BUN4.cjs → chunk-FGQABMXZ.cjs} +3 -3
- package/dist/tsup/{chunk-O6H3BUN4.cjs.map → chunk-FGQABMXZ.cjs.map} +1 -1
- package/dist/tsup/{chunk-WVFTFWJL.js → chunk-GEN4NHXM.js} +2 -2
- package/dist/tsup/{chunk-XI4MEUUI.js → chunk-JYTXOMM7.js} +2 -2
- package/dist/tsup/{chunk-OX6WVQE6.cjs → chunk-MEF7RVQ7.cjs} +10 -10
- package/dist/tsup/{chunk-OX6WVQE6.cjs.map → chunk-MEF7RVQ7.cjs.map} +1 -1
- package/dist/tsup/{chunk-OLGQYFUW.js → chunk-MF42PRF2.js} +9 -3
- package/dist/tsup/chunk-MF42PRF2.js.map +1 -0
- package/dist/tsup/{chunk-IXBD7BXC.js → chunk-OUQUIBVW.js} +1 -1
- package/dist/tsup/chunk-OUQUIBVW.js.map +1 -0
- package/dist/tsup/{chunk-QLOBB27M.cjs → chunk-PW2VSGUR.cjs} +4 -4
- package/dist/tsup/{chunk-QLOBB27M.cjs.map → chunk-PW2VSGUR.cjs.map} +1 -1
- package/dist/tsup/{chunk-NHI5L7C7.js → chunk-RBXJWAJB.js} +3 -3
- package/dist/tsup/{chunk-UBB32UOG.cjs → chunk-SSPTEGTX.cjs} +7 -7
- package/dist/tsup/{chunk-UBB32UOG.cjs.map → chunk-SSPTEGTX.cjs.map} +1 -1
- package/dist/tsup/{chunk-4ESGNS3Z.cjs → chunk-TAG6UEL5.cjs} +17 -11
- package/dist/tsup/chunk-TAG6UEL5.cjs.map +1 -0
- package/dist/tsup/{chunk-EQKSWDIH.cjs → chunk-TXUHVBKH.cjs} +3 -3
- package/dist/tsup/{chunk-EQKSWDIH.cjs.map → chunk-TXUHVBKH.cjs.map} +1 -1
- package/dist/tsup/{chunk-PZBWSCQR.cjs → chunk-TZPNSOG2.cjs} +203 -195
- package/dist/tsup/chunk-TZPNSOG2.cjs.map +1 -0
- package/dist/tsup/{chunk-YYIDQBBM.js → chunk-VOYNLY57.js} +41 -33
- package/dist/tsup/chunk-VOYNLY57.js.map +1 -0
- package/dist/tsup/{chunk-UN5JNDBT.js → chunk-XUODFCRJ.js} +4 -4
- package/dist/tsup/{chunk-34Q4YVCX.js → chunk-ZIPXAVKR.js} +2 -2
- 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 +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Bi1r6gI7.d.ts → config-BGTanB_3.d.ts} +18 -2
- package/dist/tsup/{config-BXSV17G7.d.cts → config-NHz6oMb9.d.cts} +18 -2
- package/dist/tsup/{context-4fJemY0D.d.cts → context-DB8zG_Ib.d.cts} +1 -1
- package/dist/tsup/{context-D4sNYboo.d.ts → context-SHomdVV8.d.ts} +1 -1
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.js +2 -2
- package/dist/tsup/db/mod.cjs +4 -4
- package/dist/tsup/db/mod.js +3 -3
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/inspector/workflow.cjs +5 -5
- package/dist/tsup/inspector/workflow.js +4 -4
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/mod.cjs +423 -177
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +322 -76
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +11 -11
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +9 -8
- package/src/actor/errors.ts +2 -1
- package/src/client/actor-handle.ts +10 -3
- package/src/client/raw-utils.ts +8 -0
- package/src/common/actor-router-consts.ts +2 -0
- package/src/engine-client/actor-http-client.ts +6 -22
- package/src/engine-client/mod.ts +1 -1
- package/src/registry/config/index.ts +27 -1
- package/src/registry/index.ts +48 -14
- package/src/registry/napi-runtime.ts +32 -5
- package/src/registry/native-http.ts +225 -0
- package/src/registry/native.ts +130 -64
- package/src/registry/runtime.ts +30 -2
- package/src/utils/env-vars.ts +4 -0
- package/dist/tsup/chunk-4ESGNS3Z.cjs.map +0 -1
- package/dist/tsup/chunk-IXBD7BXC.js.map +0 -1
- package/dist/tsup/chunk-OLGQYFUW.js.map +0 -1
- package/dist/tsup/chunk-PZBWSCQR.cjs.map +0 -1
- package/dist/tsup/chunk-SPJORZMM.cjs.map +0 -1
- package/dist/tsup/chunk-YYIDQBBM.js.map +0 -1
- /package/dist/tsup/{chunk-PSXMESQJ.js.map → chunk-EBXARMGI.js.map} +0 -0
- /package/dist/tsup/{chunk-WVFTFWJL.js.map → chunk-GEN4NHXM.js.map} +0 -0
- /package/dist/tsup/{chunk-XI4MEUUI.js.map → chunk-JYTXOMM7.js.map} +0 -0
- /package/dist/tsup/{chunk-NHI5L7C7.js.map → chunk-RBXJWAJB.js.map} +0 -0
- /package/dist/tsup/{chunk-UN5JNDBT.js.map → chunk-XUODFCRJ.js.map} +0 -0
- /package/dist/tsup/{chunk-34Q4YVCX.js.map → chunk-ZIPXAVKR.js.map} +0 -0
package/dist/tsup/test/mod.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 _chunkSSPTEGTXcjs = require('../chunk-SSPTEGTX.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkTZPNSOG2cjs = require('../chunk-TZPNSOG2.cjs');
|
|
7
7
|
require('../chunk-MYWZCDML.cjs');
|
|
8
|
+
require('../chunk-TXUHVBKH.cjs');
|
|
8
9
|
require('../chunk-KVFIONKQ.cjs');
|
|
9
|
-
require('../chunk-
|
|
10
|
-
require('../chunk-
|
|
11
|
-
require('../chunk-SPJORZMM.cjs');
|
|
10
|
+
require('../chunk-TAG6UEL5.cjs');
|
|
11
|
+
require('../chunk-2JSYYH6P.cjs');
|
|
12
12
|
|
|
13
13
|
// src/test/ready.ts
|
|
14
14
|
var _pretry = require('p-retry'); var _pretry2 = _interopRequireDefault(_pretry);
|
|
@@ -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 =
|
|
40
|
-
...
|
|
39
|
+
const client = _chunkSSPTEGTXcjs.createClient.call(void 0, {
|
|
40
|
+
..._chunkTZPNSOG2cjs.convertRegistryConfigToClientConfig.call(void 0, registry.parseConfig()),
|
|
41
41
|
disableMetadataLookup: false
|
|
42
42
|
});
|
|
43
43
|
c.onTestFinished(async () => {
|
package/dist/tsup/test/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestContext } from 'vitest';
|
|
2
|
-
import { aF as Registry, a3 as Client } from '../config-
|
|
2
|
+
import { aF as Registry, a3 as Client } from '../config-NHz6oMb9.cjs';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '../config-ey2I2zz5.cjs';
|
|
5
5
|
import '@rivetkit/rivetkit-wasm';
|
package/dist/tsup/test/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TestContext } from 'vitest';
|
|
2
|
-
import { aF as Registry, a3 as Client } from '../config-
|
|
2
|
+
import { aF as Registry, a3 as Client } from '../config-BGTanB_3.js';
|
|
3
3
|
import 'zod/v4';
|
|
4
4
|
import '../config-ey2I2zz5.js';
|
|
5
5
|
import '@rivetkit/rivetkit-wasm';
|
package/dist/tsup/test/mod.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-RBXJWAJB.js";
|
|
4
4
|
import {
|
|
5
5
|
convertRegistryConfigToClientConfig
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-VOYNLY57.js";
|
|
7
7
|
import "../chunk-JI6GZ2C2.js";
|
|
8
|
+
import "../chunk-JYTXOMM7.js";
|
|
8
9
|
import "../chunk-JTHHCZCZ.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-IXBD7BXC.js";
|
|
10
|
+
import "../chunk-MF42PRF2.js";
|
|
11
|
+
import "../chunk-OUQUIBVW.js";
|
|
12
12
|
|
|
13
13
|
// src/test/ready.ts
|
|
14
14
|
import pRetry from "p-retry";
|
package/dist/tsup/utils.cjs
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
23
|
-
require('./chunk-
|
|
22
|
+
var _chunkTAG6UEL5cjs = require('./chunk-TAG6UEL5.cjs');
|
|
23
|
+
require('./chunk-2JSYYH6P.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
@@ -42,5 +42,5 @@ require('./chunk-SPJORZMM.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
exports.EXTRA_ERROR_LOG =
|
|
45
|
+
exports.EXTRA_ERROR_LOG = _chunkTAG6UEL5cjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunkTAG6UEL5cjs.SinglePromiseQueue; exports.VERSION = _chunkTAG6UEL5cjs.VERSION; exports.arrayBuffersEqual = _chunkTAG6UEL5cjs.arrayBuffersEqual; exports.assertUnreachable = _chunkTAG6UEL5cjs.assertUnreachable; exports.bufferToArrayBuffer = _chunkTAG6UEL5cjs.bufferToArrayBuffer; exports.combineUrlPath = _chunkTAG6UEL5cjs.combineUrlPath; exports.dbg = _chunkTAG6UEL5cjs.dbg; exports.detectRuntime = _chunkTAG6UEL5cjs.detectRuntime; exports.getEnvUniversal = _chunkTAG6UEL5cjs.getEnvUniversal; exports.httpUserAgent = _chunkTAG6UEL5cjs.httpUserAgent; exports.interval = _chunkTAG6UEL5cjs.interval; exports.joinSignals = _chunkTAG6UEL5cjs.joinSignals; exports.jsonParseCompat = _chunkTAG6UEL5cjs.jsonParseCompat; exports.jsonStringifyCompat = _chunkTAG6UEL5cjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunkTAG6UEL5cjs.promiseWithResolvers; exports.setLongTimeout = _chunkTAG6UEL5cjs.setLongTimeout; exports.sleep = _chunkTAG6UEL5cjs.sleep; exports.stringifyError = _chunkTAG6UEL5cjs.stringifyError; exports.toUint8Array = _chunkTAG6UEL5cjs.toUint8Array;
|
|
46
46
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/tsup/utils.js
CHANGED
|
@@ -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
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var _chunkMEF7RVQ7cjs = require('../chunk-MEF7RVQ7.cjs');
|
|
4
|
+
require('../chunk-AN7WO7BM.cjs');
|
|
5
|
+
require('../chunk-PW2VSGUR.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -13,11 +13,11 @@ var _chunk4KGXFC6Mcjs = require('../chunk-4KGXFC6M.cjs');
|
|
|
13
13
|
var _chunkMYWZCDMLcjs = require('../chunk-MYWZCDML.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkTAG6UEL5cjs = require('../chunk-TAG6UEL5.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunk2JSYYH6Pcjs = require('../chunk-2JSYYH6P.cjs');
|
|
21
21
|
|
|
22
22
|
// src/workflow/mod.ts
|
|
23
23
|
|
|
@@ -705,7 +705,7 @@ function shouldRethrowWorkflowError(error) {
|
|
|
705
705
|
return true;
|
|
706
706
|
}
|
|
707
707
|
function workflowReplayInFlightError() {
|
|
708
|
-
return new (0,
|
|
708
|
+
return new (0, _chunk2JSYYH6Pcjs.RivetError)(
|
|
709
709
|
"actor",
|
|
710
710
|
"workflow_in_flight",
|
|
711
711
|
"Workflow replay is unavailable while the workflow is currently in flight.",
|
|
@@ -719,7 +719,7 @@ function isWorkflowReplayBlockedByRunningEntry(error) {
|
|
|
719
719
|
return error instanceof Error && error.message === "Cannot replay a workflow while a step is currently running";
|
|
720
720
|
}
|
|
721
721
|
function isRunHandlerUnavailable(error) {
|
|
722
|
-
return error instanceof
|
|
722
|
+
return error instanceof _chunk2JSYYH6Pcjs.RivetError && error.group === "actor" && error.code === "run_handler_unavailable";
|
|
723
723
|
}
|
|
724
724
|
function workflow(fn, options = {}) {
|
|
725
725
|
const onError = options.onError;
|
|
@@ -727,7 +727,7 @@ function workflow(fn, options = {}) {
|
|
|
727
727
|
function getWorkflowInspector(actorId) {
|
|
728
728
|
let workflowInspector = workflowInspectors.get(actorId);
|
|
729
729
|
if (!workflowInspector) {
|
|
730
|
-
workflowInspector =
|
|
730
|
+
workflowInspector = _chunkMEF7RVQ7cjs.createWorkflowInspectorAdapter.call(void 0, );
|
|
731
731
|
workflowInspectors.set(actorId, workflowInspector);
|
|
732
732
|
}
|
|
733
733
|
return workflowInspector;
|
|
@@ -794,19 +794,19 @@ function workflow(fn, options = {}) {
|
|
|
794
794
|
try {
|
|
795
795
|
await handle.result;
|
|
796
796
|
} catch (error) {
|
|
797
|
-
if (runCtx.abortSignal.aborted ||
|
|
797
|
+
if (runCtx.abortSignal.aborted || _chunk2JSYYH6Pcjs.isActorAbortedError.call(void 0, error)) {
|
|
798
798
|
return;
|
|
799
799
|
}
|
|
800
800
|
if (shouldRethrowWorkflowError(error)) {
|
|
801
801
|
runCtx.log.error({
|
|
802
802
|
msg: "workflow run failed",
|
|
803
|
-
error:
|
|
803
|
+
error: _chunkTAG6UEL5cjs.stringifyError.call(void 0, error)
|
|
804
804
|
});
|
|
805
805
|
throw error;
|
|
806
806
|
}
|
|
807
807
|
runCtx.log.warn({
|
|
808
808
|
msg: "workflow failed and will sleep until woken",
|
|
809
|
-
error:
|
|
809
|
+
error: _chunkTAG6UEL5cjs.stringifyError.call(void 0, error)
|
|
810
810
|
});
|
|
811
811
|
} finally {
|
|
812
812
|
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-
|
|
3
|
+
import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-NHz6oMb9.cjs';
|
|
4
4
|
import { A as AnyDatabaseProvider } from '../config-ey2I2zz5.cjs';
|
|
5
|
-
import { d as WorkflowContext } from '../context-
|
|
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-
|
|
5
|
+
import { d as WorkflowContext } from '../context-DB8zG_Ib.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-DB8zG_Ib.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-
|
|
3
|
+
import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-BGTanB_3.js';
|
|
4
4
|
import { A as AnyDatabaseProvider } from '../config-ey2I2zz5.js';
|
|
5
|
-
import { d as WorkflowContext } from '../context-
|
|
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-
|
|
5
|
+
import { d as WorkflowContext } from '../context-SHomdVV8.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-SHomdVV8.js';
|
|
7
7
|
import 'zod/v4';
|
|
8
8
|
import '@rivetkit/rivetkit-wasm';
|
|
9
9
|
import 'zod';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createWorkflowInspectorAdapter
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-XUODFCRJ.js";
|
|
4
|
+
import "../chunk-ZIPXAVKR.js";
|
|
5
|
+
import "../chunk-GEN4NHXM.js";
|
|
6
6
|
import {
|
|
7
7
|
ACTOR_CONTEXT_INTERNAL_SYMBOL,
|
|
8
8
|
defineRunHandler
|
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
} from "../chunk-JI6GZ2C2.js";
|
|
14
14
|
import {
|
|
15
15
|
stringifyError
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-MF42PRF2.js";
|
|
17
17
|
import {
|
|
18
18
|
RivetError,
|
|
19
19
|
isActorAbortedError
|
|
20
|
-
} from "../chunk-
|
|
20
|
+
} from "../chunk-OUQUIBVW.js";
|
|
21
21
|
|
|
22
22
|
// src/workflow/mod.ts
|
|
23
23
|
import {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rivetkit",
|
|
3
|
-
"version": "2.3.12
|
|
3
|
+
"version": "2.3.12",
|
|
4
4
|
"description": "Lightweight libraries for building stateful actors on edge platforms",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -210,15 +210,16 @@
|
|
|
210
210
|
"dependencies": {
|
|
211
211
|
"@hono/zod-openapi": "^1.1.5",
|
|
212
212
|
"@rivet-dev/agent-os-core": "^0.1.1",
|
|
213
|
+
"@rivet-dev/services": "^0.1.3",
|
|
213
214
|
"@rivetkit/bare-ts": "^0.6.2",
|
|
214
|
-
"@rivetkit/engine-cli": "2.3.12
|
|
215
|
-
"@rivetkit/engine-envoy-protocol": "2.3.12
|
|
215
|
+
"@rivetkit/engine-cli": "2.3.12",
|
|
216
|
+
"@rivetkit/engine-envoy-protocol": "2.3.12",
|
|
216
217
|
"@rivetkit/on-change": "6.0.1",
|
|
217
|
-
"@rivetkit/rivetkit-napi": "2.3.12
|
|
218
|
-
"@rivetkit/rivetkit-wasm": "2.3.12
|
|
219
|
-
"@rivetkit/traces": "2.3.12
|
|
220
|
-
"@rivetkit/virtual-websocket": "2.3.12
|
|
221
|
-
"@rivetkit/workflow-engine": "2.3.12
|
|
218
|
+
"@rivetkit/rivetkit-napi": "2.3.12",
|
|
219
|
+
"@rivetkit/rivetkit-wasm": "2.3.12",
|
|
220
|
+
"@rivetkit/traces": "2.3.12",
|
|
221
|
+
"@rivetkit/virtual-websocket": "2.3.12",
|
|
222
|
+
"@rivetkit/workflow-engine": "2.3.12",
|
|
222
223
|
"cbor-x": "^1.6.0",
|
|
223
224
|
"drizzle-orm": "^0.44.2",
|
|
224
225
|
"hono": "^4.7.0",
|
package/src/actor/errors.ts
CHANGED
|
@@ -45,7 +45,8 @@ export interface BridgeRivetErrorPayload extends RivetErrorLike {}
|
|
|
45
45
|
* Shape as it arrives from the native bridge, where an absent ray ID serializes
|
|
46
46
|
* to null. Normalized to a BridgeRivetErrorPayload before validation.
|
|
47
47
|
*/
|
|
48
|
-
interface NativeBridgeErrorPayload
|
|
48
|
+
interface NativeBridgeErrorPayload
|
|
49
|
+
extends Omit<BridgeRivetErrorPayload, "rayId"> {
|
|
49
50
|
rayId?: string | null;
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
HEADER_CONN_PARAMS,
|
|
5
5
|
HEADER_ENCODING,
|
|
6
6
|
} from "@/common/actor-router-consts";
|
|
7
|
+
import { isRequestLike } from "@/common/fetch-like";
|
|
7
8
|
import type * as protocol from "@/common/client-protocol";
|
|
8
9
|
import {
|
|
9
10
|
CURRENT_VERSION as CLIENT_PROTOCOL_CURRENT_VERSION,
|
|
@@ -142,7 +143,9 @@ export class ActorHandleRaw {
|
|
|
142
143
|
// Dynamic (get/getOrCreate) handles resolve at the gateway per
|
|
143
144
|
// request so cross-datacenter queries forward to the reserved dc,
|
|
144
145
|
// rather than pre-resolving via the non-forwarding PUT /actors path.
|
|
145
|
-
let useQueryTarget = isDynamicActorQuery(
|
|
146
|
+
let useQueryTarget = isDynamicActorQuery(
|
|
147
|
+
this.#actorResolutionState,
|
|
148
|
+
);
|
|
146
149
|
|
|
147
150
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
148
151
|
let actorId: string | undefined;
|
|
@@ -651,9 +654,13 @@ export class ActorHandleRaw {
|
|
|
651
654
|
input: string | URL | Request,
|
|
652
655
|
init?: ActorFetchInit,
|
|
653
656
|
) {
|
|
654
|
-
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
655
|
-
let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
656
657
|
const { skipReadyWait, ...requestInit } = init ?? {};
|
|
658
|
+
const hasBody =
|
|
659
|
+
requestInit.body !== undefined
|
|
660
|
+
? requestInit.body !== null
|
|
661
|
+
: isRequestLike(input) && input.body !== null;
|
|
662
|
+
const maxAttempts = hasBody ? 1 : this.#getDynamicQueryMaxAttempts();
|
|
663
|
+
let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
657
664
|
const gatewayOptions = resolveActorGatewayOptions(
|
|
658
665
|
this.#gatewayOptions,
|
|
659
666
|
{
|
package/src/client/raw-utils.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HEADER_CONN_PARAMS,
|
|
3
|
+
HEADER_ORIGINAL_REQUEST_URL,
|
|
3
4
|
PATH_WEBSOCKET_PREFIX,
|
|
4
5
|
} from "@/common/actor-router-consts";
|
|
5
6
|
import { deconstructError } from "@/common/utils";
|
|
@@ -25,16 +26,19 @@ export async function rawHttpFetch(
|
|
|
25
26
|
): Promise<Response> {
|
|
26
27
|
// Extract path and merge init options
|
|
27
28
|
let path: string;
|
|
29
|
+
let originalUrl: string | undefined;
|
|
28
30
|
let mergedInit: RequestInit = init || {};
|
|
29
31
|
|
|
30
32
|
if (typeof input === "string") {
|
|
31
33
|
path = input;
|
|
32
34
|
} else if (isUrlLike(input)) {
|
|
33
35
|
path = input.pathname + input.search;
|
|
36
|
+
originalUrl = input.toString();
|
|
34
37
|
} else if (isRequestLike(input)) {
|
|
35
38
|
// Extract path from Request URL
|
|
36
39
|
const url = new URL(input.url);
|
|
37
40
|
path = url.pathname + url.search;
|
|
41
|
+
originalUrl = url.toString();
|
|
38
42
|
// Merge Request properties with init
|
|
39
43
|
const requestHeaders = new Headers(input.headers);
|
|
40
44
|
const initHeaders = new Headers(init?.headers || {});
|
|
@@ -86,6 +90,10 @@ export async function rawHttpFetch(
|
|
|
86
90
|
|
|
87
91
|
// Forward conn params if provided
|
|
88
92
|
const proxyRequestHeaders = new Headers(mergedInit.headers);
|
|
93
|
+
proxyRequestHeaders.delete(HEADER_ORIGINAL_REQUEST_URL);
|
|
94
|
+
if (originalUrl) {
|
|
95
|
+
proxyRequestHeaders.set(HEADER_ORIGINAL_REQUEST_URL, originalUrl);
|
|
96
|
+
}
|
|
89
97
|
if (params) {
|
|
90
98
|
proxyRequestHeaders.set(HEADER_CONN_PARAMS, JSON.stringify(params));
|
|
91
99
|
}
|
|
@@ -12,6 +12,8 @@ export const HEADER_ENCODING = "x-rivet-encoding";
|
|
|
12
12
|
|
|
13
13
|
// IMPORTANT: Params must be in headers or in an E2EE part of the request (i.e. NOT the URL or query string) in order to ensure that tokens can be securely passed in params.
|
|
14
14
|
export const HEADER_CONN_PARAMS = "x-rivet-conn-params";
|
|
15
|
+
export const HEADER_ORIGINAL_REQUEST_URL =
|
|
16
|
+
"x-rivet-internal-original-request-url";
|
|
15
17
|
|
|
16
18
|
export const HEADER_ACTOR_ID = "x-rivet-actor";
|
|
17
19
|
export const HEADER_ACTOR_GENERATION = "x-rivet-actor-generation";
|
|
@@ -17,8 +17,7 @@ export async function sendHttpRequestToGateway(
|
|
|
17
17
|
actorRequest: Request,
|
|
18
18
|
options: HttpGatewayRequestOptions = {},
|
|
19
19
|
): Promise<Response> {
|
|
20
|
-
|
|
21
|
-
let bodyToSend: ArrayBuffer | null = null;
|
|
20
|
+
let bodyToSend: ReadableStream<Uint8Array> | null = null;
|
|
22
21
|
const guardHeaders = buildGuardHeaders(runConfig, actorRequest, options);
|
|
23
22
|
|
|
24
23
|
if (actorRequest.method !== "GET" && actorRequest.method !== "HEAD") {
|
|
@@ -26,35 +25,20 @@ export async function sendHttpRequestToGateway(
|
|
|
26
25
|
throw new Error("Request body has already been consumed");
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const reqBody = await actorRequest.arrayBuffer();
|
|
32
|
-
|
|
33
|
-
if (reqBody.byteLength !== 0) {
|
|
34
|
-
bodyToSend = reqBody;
|
|
35
|
-
|
|
36
|
-
// If this is a streaming request, we need to convert the headers
|
|
37
|
-
// for the basic array buffer.
|
|
28
|
+
if (actorRequest.body) {
|
|
29
|
+
bodyToSend = actorRequest.body;
|
|
38
30
|
guardHeaders.delete("transfer-encoding");
|
|
39
31
|
guardHeaders.delete("content-length");
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
return fetch(gatewayUrl, {
|
|
44
36
|
method: actorRequest.method,
|
|
45
37
|
headers: guardHeaders,
|
|
46
38
|
body: bodyToSend,
|
|
47
39
|
signal: actorRequest.signal,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return mutableResponse(await fetch(guardRequest));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function mutableResponse(fetchRes: Response): Response {
|
|
54
|
-
// We cannot return the raw response from `fetch` since the response type is not mutable.
|
|
55
|
-
//
|
|
56
|
-
// In order for middleware to be able to mutate the response, we need to build a new Response object that is mutable.
|
|
57
|
-
return new Response(fetchRes.body, fetchRes);
|
|
40
|
+
...(bodyToSend ? { duplex: "half" } : {}),
|
|
41
|
+
} as RequestInit);
|
|
58
42
|
}
|
|
59
43
|
|
|
60
44
|
function buildGuardHeaders(
|
package/src/engine-client/mod.ts
CHANGED
|
@@ -462,7 +462,7 @@ export class RemoteEngineControlClient implements EngineControlClient {
|
|
|
462
462
|
undefined,
|
|
463
463
|
"getOrCreateForKey" in target
|
|
464
464
|
? (target.getOrCreateForKey.poolName ??
|
|
465
|
-
|
|
465
|
+
this.#config.poolName)
|
|
466
466
|
: undefined,
|
|
467
467
|
options,
|
|
468
468
|
);
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getRunMetadata } from "@/actor/config";
|
|
3
3
|
import type { AnyActorDefinition } from "@/actor/definition";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
buildEngineEndpoint,
|
|
6
|
+
ENGINE_HOST,
|
|
7
|
+
ENGINE_PORT,
|
|
8
|
+
isLocalEngineEndpoint,
|
|
9
|
+
} from "@/common/engine";
|
|
5
10
|
import { type Logger, LogLevelSchema } from "@/common/log";
|
|
6
11
|
import { VERSION } from "@/utils";
|
|
7
12
|
import { tryParseEndpoint } from "@/utils/endpoint-parser";
|
|
@@ -14,6 +19,7 @@ import {
|
|
|
14
19
|
getRivetRunEngineHost,
|
|
15
20
|
getRivetRunEnginePort,
|
|
16
21
|
getRivetRunEngineVersion,
|
|
22
|
+
getRivetRunServices,
|
|
17
23
|
getRivetToken,
|
|
18
24
|
isDev,
|
|
19
25
|
} from "@/utils/env-vars";
|
|
@@ -243,6 +249,12 @@ export const RegistryConfigSchema = z
|
|
|
243
249
|
.string()
|
|
244
250
|
.optional()
|
|
245
251
|
.default(() => getRivetRunEngineVersion() ?? VERSION),
|
|
252
|
+
/**
|
|
253
|
+
* Starts the first-party Services actor host when RivetKit manages
|
|
254
|
+
* a local engine. Defaults to the local-engine decision. Set
|
|
255
|
+
* RIVET_RUN_SERVICES=0 or 1 to override it.
|
|
256
|
+
*/
|
|
257
|
+
startServices: z.boolean().optional(),
|
|
246
258
|
/**
|
|
247
259
|
* @experimental
|
|
248
260
|
*
|
|
@@ -354,6 +366,13 @@ export const RegistryConfigSchema = z
|
|
|
354
366
|
? localEngineEndpoint
|
|
355
367
|
: (parsedEndpoint?.endpoint ??
|
|
356
368
|
(isDevEnv ? localEngineEndpoint : undefined));
|
|
369
|
+
// Services is another local development actor host. Its default
|
|
370
|
+
// follows the same local-endpoint decision that causes core to manage the
|
|
371
|
+
// Engine, while explicit config and RIVET_RUN_SERVICES take precedence.
|
|
372
|
+
const startServices =
|
|
373
|
+
config.startServices ??
|
|
374
|
+
getRivetRunServices() ??
|
|
375
|
+
Boolean(endpoint && isLocalEngineEndpoint(endpoint));
|
|
357
376
|
const validateServerlessEndpoint = Boolean(
|
|
358
377
|
config.startEngine || parsedEndpoint,
|
|
359
378
|
);
|
|
@@ -398,6 +417,7 @@ export const RegistryConfigSchema = z
|
|
|
398
417
|
...config,
|
|
399
418
|
sqlite,
|
|
400
419
|
endpoint,
|
|
420
|
+
startServices,
|
|
401
421
|
namespace,
|
|
402
422
|
token,
|
|
403
423
|
publicEndpoint,
|
|
@@ -629,6 +649,12 @@ export const DocRegistryConfigSchema = z
|
|
|
629
649
|
.describe(
|
|
630
650
|
"Version of the local engine package to use. Defaults to the current RivetKit version.",
|
|
631
651
|
),
|
|
652
|
+
startServices: z
|
|
653
|
+
.boolean()
|
|
654
|
+
.optional()
|
|
655
|
+
.describe(
|
|
656
|
+
"Starts Services when RivetKit manages a local Engine. Defaults to the local-Engine decision. Set RIVET_RUN_SERVICES=0 or 1 to override.",
|
|
657
|
+
),
|
|
632
658
|
configurePool: DocConfigurePoolSchema.describe(
|
|
633
659
|
"Automatically configure serverless runners in the engine.",
|
|
634
660
|
),
|
package/src/registry/index.ts
CHANGED
|
@@ -16,8 +16,11 @@ import {
|
|
|
16
16
|
} from "./config";
|
|
17
17
|
import { logger } from "./log";
|
|
18
18
|
import { buildConfiguredRegistry } from "./native";
|
|
19
|
+
import { convertNativeHttpResponse } from "./native-http";
|
|
19
20
|
import type {
|
|
21
|
+
CoreRuntime,
|
|
20
22
|
RuntimeApplicationFetch,
|
|
23
|
+
RuntimeHttpResponseBodyStream,
|
|
21
24
|
RuntimeServerlessResponseHead,
|
|
22
25
|
} from "./runtime";
|
|
23
26
|
|
|
@@ -43,18 +46,33 @@ function finishShutdownSignal(signal: ShutdownSignal): void {
|
|
|
43
46
|
|
|
44
47
|
function createApplicationFetch(
|
|
45
48
|
application: RegistryApplication,
|
|
49
|
+
runtime: CoreRuntime,
|
|
46
50
|
): RuntimeApplicationFetch {
|
|
47
|
-
return async (
|
|
51
|
+
return async (
|
|
52
|
+
request,
|
|
53
|
+
responseBodyStream?: RuntimeHttpResponseBodyStream,
|
|
54
|
+
) => {
|
|
48
55
|
const method = request.method.toUpperCase();
|
|
49
56
|
const body =
|
|
50
57
|
method === "GET" || method === "HEAD" || request.body.length === 0
|
|
51
58
|
? undefined
|
|
52
59
|
: Uint8Array.from(request.body).buffer;
|
|
60
|
+
const abortController = new AbortController();
|
|
61
|
+
if (request.cancelToken) {
|
|
62
|
+
if (runtime.cancellationTokenAborted(request.cancelToken)) {
|
|
63
|
+
abortController.abort();
|
|
64
|
+
} else {
|
|
65
|
+
runtime.onCancellationTokenCancelled(request.cancelToken, () =>
|
|
66
|
+
abortController.abort(),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
53
70
|
const response = await application.fetch(
|
|
54
71
|
new Request(request.url, {
|
|
55
72
|
method,
|
|
56
73
|
headers: request.headers,
|
|
57
74
|
body,
|
|
75
|
+
signal: abortController.signal,
|
|
58
76
|
}),
|
|
59
77
|
);
|
|
60
78
|
if (!isResponseLike(response)) {
|
|
@@ -62,10 +80,25 @@ function createApplicationFetch(
|
|
|
62
80
|
"registry.listen() application fetch must return a Response",
|
|
63
81
|
);
|
|
64
82
|
}
|
|
83
|
+
const conversion = await convertNativeHttpResponse(
|
|
84
|
+
response,
|
|
85
|
+
responseBodyStream,
|
|
86
|
+
);
|
|
87
|
+
if (conversion.bodyCompletion) {
|
|
88
|
+
void conversion.bodyCompletion.catch((error) => {
|
|
89
|
+
logger().error({
|
|
90
|
+
msg: "application response stream failed",
|
|
91
|
+
error,
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
65
95
|
return {
|
|
66
|
-
status: response.status,
|
|
67
|
-
headers:
|
|
68
|
-
|
|
96
|
+
status: conversion.response.status ?? response.status,
|
|
97
|
+
headers:
|
|
98
|
+
conversion.response.headers ??
|
|
99
|
+
Object.fromEntries(response.headers.entries()),
|
|
100
|
+
body: conversion.response.body,
|
|
101
|
+
stream: conversion.response.stream,
|
|
69
102
|
};
|
|
70
103
|
};
|
|
71
104
|
}
|
|
@@ -406,11 +439,8 @@ export class Registry<A extends RegistryActors> {
|
|
|
406
439
|
const port = opts.port ?? parsePortEnv(process.env.RIVET_PORT) ?? 3000;
|
|
407
440
|
const publicDir = opts.publicDir ?? getRivetkitPublicDir();
|
|
408
441
|
const config = this.parseConfig();
|
|
409
|
-
const application = opts.application
|
|
410
|
-
? createApplicationFetch(opts.application)
|
|
411
|
-
: undefined;
|
|
412
442
|
|
|
413
|
-
if (application && getRivetkitRuntimeMode() !== "serverless") {
|
|
443
|
+
if (opts.application && getRivetkitRuntimeMode() !== "serverless") {
|
|
414
444
|
if (config.runtime === "wasm") {
|
|
415
445
|
throw new Error(
|
|
416
446
|
"registry.listen() requires the native runtime; use an application-owned HTTP server with WebAssembly",
|
|
@@ -431,6 +461,11 @@ export class Registry<A extends RegistryActors> {
|
|
|
431
461
|
}
|
|
432
462
|
const { runtime, registry, serveConfig } =
|
|
433
463
|
await configuredRegistryPromise;
|
|
464
|
+
const application = createApplicationFetch(
|
|
465
|
+
opts.application,
|
|
466
|
+
runtime,
|
|
467
|
+
);
|
|
468
|
+
await readyPromise;
|
|
434
469
|
const listenerPromise = runtime.serveApplicationListener(
|
|
435
470
|
registry,
|
|
436
471
|
{
|
|
@@ -448,16 +483,12 @@ export class Registry<A extends RegistryActors> {
|
|
|
448
483
|
"registry envoy serve lifecycle did not initialize",
|
|
449
484
|
);
|
|
450
485
|
}
|
|
451
|
-
await Promise.all([
|
|
452
|
-
readyPromise,
|
|
453
|
-
listenerPromise,
|
|
454
|
-
serveLifecyclePromise,
|
|
455
|
-
]);
|
|
486
|
+
await Promise.all([listenerPromise, serveLifecyclePromise]);
|
|
456
487
|
return;
|
|
457
488
|
}
|
|
458
489
|
|
|
459
490
|
// Cache on both promise fields so the shutdown drain sees Mode A and B.
|
|
460
|
-
const configuredRegistryPromise = buildConfiguredRegistry(config);
|
|
491
|
+
const configuredRegistryPromise = this.#buildConfiguredRegistry(config);
|
|
461
492
|
this.#runtimeServeConfiguredPromise = configuredRegistryPromise;
|
|
462
493
|
this.#runtimeServerlessPromise = configuredRegistryPromise;
|
|
463
494
|
this.#installSignalHandlers(config);
|
|
@@ -473,6 +504,9 @@ export class Registry<A extends RegistryActors> {
|
|
|
473
504
|
|
|
474
505
|
const { runtime, registry, serveConfig } =
|
|
475
506
|
await configuredRegistryPromise;
|
|
507
|
+
const application = opts.application
|
|
508
|
+
? createApplicationFetch(opts.application, runtime)
|
|
509
|
+
: undefined;
|
|
476
510
|
await runtime.serveListener(
|
|
477
511
|
registry,
|
|
478
512
|
{
|