rivetkit 2.3.19 → 2.3.20
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 +39 -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/tsup/agent-os/index.cjs +34 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +39 -0
- package/dist/tsup/agent-os/index.d.ts +39 -0
- package/dist/tsup/agent-os/index.js +34 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-RJC5O2SD.cjs → chunk-2CE5UNWK.cjs} +2 -2
- package/dist/tsup/{chunk-RJC5O2SD.cjs.map → chunk-2CE5UNWK.cjs.map} +1 -1
- package/dist/tsup/{chunk-7HTST3NX.js → chunk-2NXLTFWI.js} +3 -3
- package/dist/tsup/{chunk-OGPFN6BT.cjs → chunk-3WS7Z64U.cjs} +3 -3
- package/dist/tsup/{chunk-OGPFN6BT.cjs.map → chunk-3WS7Z64U.cjs.map} +1 -1
- package/dist/tsup/{chunk-X7RMJQGY.js → chunk-553CIQJY.js} +2 -2
- package/dist/tsup/{chunk-BKX7UDTA.js → chunk-5G2J26VM.js} +3 -3
- package/dist/tsup/{chunk-PPEIPCW4.cjs → chunk-76YTS32R.cjs} +4 -4
- package/dist/tsup/{chunk-PPEIPCW4.cjs.map → chunk-76YTS32R.cjs.map} +1 -1
- package/dist/tsup/{chunk-IJUXBWH4.cjs → chunk-A36FMKOV.cjs} +138 -138
- package/dist/tsup/{chunk-IJUXBWH4.cjs.map → chunk-A36FMKOV.cjs.map} +1 -1
- package/dist/tsup/{chunk-EB77NZL4.js → chunk-CSOHAAZK.js} +33 -1
- package/dist/tsup/chunk-CSOHAAZK.js.map +1 -0
- package/dist/tsup/{chunk-Z4RAXFSD.cjs → chunk-CVLNRT7O.cjs} +3 -3
- package/dist/tsup/{chunk-Z4RAXFSD.cjs.map → chunk-CVLNRT7O.cjs.map} +1 -1
- package/dist/tsup/{chunk-DN6MD3KK.js → chunk-DHWZTUKA.js} +2 -2
- package/dist/tsup/{chunk-DN6MD3KK.js.map → chunk-DHWZTUKA.js.map} +1 -1
- package/dist/tsup/{chunk-464WE4RF.js → chunk-DMQUERRN.js} +2 -2
- package/dist/tsup/{chunk-G4U5L6AX.cjs → chunk-IHKDFKM4.cjs} +3 -3
- package/dist/tsup/{chunk-G4U5L6AX.cjs.map → chunk-IHKDFKM4.cjs.map} +1 -1
- package/dist/tsup/{chunk-EO5UOXXY.cjs → chunk-NWCAIWHL.cjs} +34 -2
- package/dist/tsup/chunk-NWCAIWHL.cjs.map +1 -0
- package/dist/tsup/{chunk-7A5EIXJJ.cjs → chunk-RSIOGT2U.cjs} +7 -7
- package/dist/tsup/{chunk-7A5EIXJJ.cjs.map → chunk-RSIOGT2U.cjs.map} +1 -1
- package/dist/tsup/{chunk-4SC2NSAV.js → chunk-SNNVRHLX.js} +2 -2
- package/dist/tsup/{chunk-DK3L22R6.js → chunk-TZVAVPGJ.js} +4 -4
- package/dist/tsup/{chunk-WME6KOXW.js → chunk-W2PXGWMR.js} +2 -2
- package/dist/tsup/{chunk-7BRRGBRY.cjs → chunk-WAISW7KR.cjs} +10 -10
- package/dist/tsup/{chunk-7BRRGBRY.cjs.map → chunk-WAISW7KR.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +4 -4
- 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-DEm0yIVV.d.ts → config-Be-VOHaX.d.ts} +42 -2
- package/dist/tsup/{config-8n2AOhXK.d.cts → config-Ct5uXxXk.d.cts} +42 -2
- package/dist/tsup/{context-DGg2-IOm.d.ts → context-CXLa0BIM.d.ts} +1 -1
- package/dist/tsup/{context-DwjOVvlE.d.cts → context-Cw-11Q-B.d.cts} +1 -1
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector/workflow.cjs +4 -4
- package/dist/tsup/inspector/workflow.js +3 -3
- package/dist/tsup/inspector-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +115 -101
- 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 +20 -6
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +10 -10
- 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 +8 -8
- package/src/actor/actions.ts +36 -0
- package/src/actor/config.ts +27 -0
- package/src/actor/definition.ts +6 -1
- package/src/actor/mod.ts +5 -0
- package/src/actor/tracing.ts +28 -0
- package/src/registry/native.ts +18 -0
- package/src/registry/runtime.ts +8 -0
- package/dist/tsup/chunk-EB77NZL4.js.map +0 -1
- package/dist/tsup/chunk-EO5UOXXY.cjs.map +0 -1
- /package/dist/tsup/{chunk-7HTST3NX.js.map → chunk-2NXLTFWI.js.map} +0 -0
- /package/dist/tsup/{chunk-X7RMJQGY.js.map → chunk-553CIQJY.js.map} +0 -0
- /package/dist/tsup/{chunk-BKX7UDTA.js.map → chunk-5G2J26VM.js.map} +0 -0
- /package/dist/tsup/{chunk-464WE4RF.js.map → chunk-DMQUERRN.js.map} +0 -0
- /package/dist/tsup/{chunk-4SC2NSAV.js.map → chunk-SNNVRHLX.js.map} +0 -0
- /package/dist/tsup/{chunk-DK3L22R6.js.map → chunk-TZVAVPGJ.js.map} +0 -0
- /package/dist/tsup/{chunk-WME6KOXW.js.map → chunk-W2PXGWMR.js.map} +0 -0
package/dist/tsup/test/mod.cjs
CHANGED
|
@@ -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
|
|
3
|
+
var _chunkRSIOGT2Ucjs = require('../chunk-RSIOGT2U.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkA36FMKOVcjs = require('../chunk-A36FMKOV.cjs');
|
|
7
7
|
require('../chunk-MYWZCDML.cjs');
|
|
8
|
-
require('../chunk-
|
|
8
|
+
require('../chunk-3WS7Z64U.cjs');
|
|
9
9
|
require('../chunk-KVFIONKQ.cjs');
|
|
10
|
-
require('../chunk-
|
|
10
|
+
require('../chunk-2CE5UNWK.cjs');
|
|
11
11
|
require('../chunk-JX2ITWAV.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 =
|
|
40
|
-
...
|
|
39
|
+
const client = _chunkRSIOGT2Ucjs.createClient.call(void 0, {
|
|
40
|
+
..._chunkA36FMKOVcjs.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 {
|
|
2
|
+
import { aI as Registry, a6 as Client } from '../config-Ct5uXxXk.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 {
|
|
2
|
+
import { aI as Registry, a6 as Client } from '../config-Be-VOHaX.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,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2NXLTFWI.js";
|
|
4
4
|
import {
|
|
5
5
|
convertRegistryConfigToClientConfig
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-5G2J26VM.js";
|
|
7
7
|
import "../chunk-JI6GZ2C2.js";
|
|
8
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-553CIQJY.js";
|
|
9
9
|
import "../chunk-JTHHCZCZ.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-DHWZTUKA.js";
|
|
11
11
|
import "../chunk-P2OFXH4G.js";
|
|
12
12
|
|
|
13
13
|
// src/test/ready.ts
|
package/dist/tsup/utils.cjs
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _chunk2CE5UNWKcjs = require('./chunk-2CE5UNWK.cjs');
|
|
23
23
|
require('./chunk-JX2ITWAV.cjs');
|
|
24
24
|
|
|
25
25
|
|
|
@@ -42,5 +42,5 @@ require('./chunk-JX2ITWAV.cjs');
|
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
|
|
45
|
-
exports.EXTRA_ERROR_LOG =
|
|
45
|
+
exports.EXTRA_ERROR_LOG = _chunk2CE5UNWKcjs.EXTRA_ERROR_LOG; exports.SinglePromiseQueue = _chunk2CE5UNWKcjs.SinglePromiseQueue; exports.VERSION = _chunk2CE5UNWKcjs.VERSION; exports.arrayBuffersEqual = _chunk2CE5UNWKcjs.arrayBuffersEqual; exports.assertUnreachable = _chunk2CE5UNWKcjs.assertUnreachable; exports.bufferToArrayBuffer = _chunk2CE5UNWKcjs.bufferToArrayBuffer; exports.combineUrlPath = _chunk2CE5UNWKcjs.combineUrlPath; exports.dbg = _chunk2CE5UNWKcjs.dbg; exports.detectRuntime = _chunk2CE5UNWKcjs.detectRuntime; exports.getEnvUniversal = _chunk2CE5UNWKcjs.getEnvUniversal; exports.httpUserAgent = _chunk2CE5UNWKcjs.httpUserAgent; exports.interval = _chunk2CE5UNWKcjs.interval; exports.joinSignals = _chunk2CE5UNWKcjs.joinSignals; exports.jsonParseCompat = _chunk2CE5UNWKcjs.jsonParseCompat; exports.jsonStringifyCompat = _chunk2CE5UNWKcjs.jsonStringifyCompat; exports.promiseWithResolvers = _chunk2CE5UNWKcjs.promiseWithResolvers; exports.setLongTimeout = _chunk2CE5UNWKcjs.setLongTimeout; exports.sleep = _chunk2CE5UNWKcjs.sleep; exports.stringifyError = _chunk2CE5UNWKcjs.stringifyError; exports.toUint8Array = _chunk2CE5UNWKcjs.toUint8Array;
|
|
46
46
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/tsup/utils.js
CHANGED
|
@@ -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
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var _chunkWAISW7KRcjs = require('../chunk-WAISW7KR.cjs');
|
|
4
|
+
require('../chunk-IHKDFKM4.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../chunk-
|
|
8
|
+
var _chunkNWCAIWHLcjs = require('../chunk-NWCAIWHL.cjs');
|
|
9
|
+
require('../chunk-76YTS32R.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkMYWZCDMLcjs = require('../chunk-MYWZCDML.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunk2CE5UNWKcjs = require('../chunk-2CE5UNWK.cjs');
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
@@ -743,13 +743,13 @@ function workflow(fn, options = {}) {
|
|
|
743
743
|
function getWorkflowInspector(actorId) {
|
|
744
744
|
let workflowInspector = workflowInspectors.get(actorId);
|
|
745
745
|
if (!workflowInspector) {
|
|
746
|
-
workflowInspector =
|
|
746
|
+
workflowInspector = _chunkWAISW7KRcjs.createWorkflowInspectorAdapter.call(void 0, );
|
|
747
747
|
workflowInspectors.set(actorId, workflowInspector);
|
|
748
748
|
}
|
|
749
749
|
return workflowInspector;
|
|
750
750
|
}
|
|
751
751
|
async function run(runCtx) {
|
|
752
|
-
const actor = runCtx[
|
|
752
|
+
const actor = runCtx[_chunkNWCAIWHLcjs.ACTOR_CONTEXT_INTERNAL_SYMBOL];
|
|
753
753
|
_invariant2.default.call(void 0, actor, "workflow() requires an actor instance");
|
|
754
754
|
const workflowInspector = getWorkflowInspector(actor.id);
|
|
755
755
|
const driver = new ActorWorkflowDriver(actor, runCtx);
|
|
@@ -816,19 +816,19 @@ function workflow(fn, options = {}) {
|
|
|
816
816
|
if (shouldRethrowWorkflowError(error)) {
|
|
817
817
|
runCtx.log.error({
|
|
818
818
|
msg: "workflow run failed",
|
|
819
|
-
error:
|
|
819
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
820
820
|
});
|
|
821
821
|
throw error;
|
|
822
822
|
}
|
|
823
823
|
runCtx.log.warn({
|
|
824
824
|
msg: "workflow failed and will sleep until woken",
|
|
825
|
-
error:
|
|
825
|
+
error: _chunk2CE5UNWKcjs.stringifyError.call(void 0, error)
|
|
826
826
|
});
|
|
827
827
|
} finally {
|
|
828
828
|
runCtx.abortSignal.removeEventListener("abort", onAbort);
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
|
-
return
|
|
831
|
+
return _chunkNWCAIWHLcjs.defineRunHandler.call(void 0, run, {
|
|
832
832
|
icon: "diagram-project",
|
|
833
833
|
inspectorKind: "workflow",
|
|
834
834
|
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-
|
|
3
|
+
import { E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext } from '../config-Ct5uXxXk.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-Cw-11Q-B.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-Cw-11Q-B.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-Be-VOHaX.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-CXLa0BIM.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-CXLa0BIM.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-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-TZVAVPGJ.js";
|
|
4
|
+
import "../chunk-DMQUERRN.js";
|
|
5
5
|
import {
|
|
6
6
|
ACTOR_CONTEXT_INTERNAL_SYMBOL,
|
|
7
7
|
defineRunHandler
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-CSOHAAZK.js";
|
|
9
|
+
import "../chunk-SNNVRHLX.js";
|
|
10
10
|
import {
|
|
11
11
|
makeWorkflowKey,
|
|
12
12
|
workflowStoragePrefix
|
|
13
13
|
} from "../chunk-JI6GZ2C2.js";
|
|
14
14
|
import {
|
|
15
15
|
stringifyError
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-DHWZTUKA.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": "2.3.
|
|
3
|
+
"version": "2.3.20",
|
|
4
4
|
"description": "Lightweight libraries for building stateful actors on edge platforms",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"keywords": [
|
|
@@ -213,14 +213,14 @@
|
|
|
213
213
|
"@rivet-dev/agent-os-core": "^0.1.1",
|
|
214
214
|
"@rivet-dev/services": "^0.1.5",
|
|
215
215
|
"@rivetkit/bare-ts": "^0.6.2",
|
|
216
|
-
"@rivetkit/engine-cli": "2.3.
|
|
217
|
-
"@rivetkit/engine-envoy-protocol": "2.3.
|
|
216
|
+
"@rivetkit/engine-cli": "2.3.20",
|
|
217
|
+
"@rivetkit/engine-envoy-protocol": "2.3.20",
|
|
218
218
|
"@rivetkit/on-change": "6.0.1",
|
|
219
|
-
"@rivetkit/rivetkit-napi": "2.3.
|
|
220
|
-
"@rivetkit/rivetkit-wasm": "2.3.
|
|
221
|
-
"@rivetkit/traces": "2.3.
|
|
222
|
-
"@rivetkit/virtual-websocket": "2.3.
|
|
223
|
-
"@rivetkit/workflow-engine": "2.3.
|
|
219
|
+
"@rivetkit/rivetkit-napi": "2.3.20",
|
|
220
|
+
"@rivetkit/rivetkit-wasm": "2.3.20",
|
|
221
|
+
"@rivetkit/traces": "2.3.20",
|
|
222
|
+
"@rivetkit/virtual-websocket": "2.3.20",
|
|
223
|
+
"@rivetkit/workflow-engine": "2.3.20",
|
|
224
224
|
"cbor-x": "^1.6.0",
|
|
225
225
|
"drizzle-orm": "0.45.2",
|
|
226
226
|
"hono": "^4.7.0",
|
package/src/actor/actions.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PrimitiveSchema } from "./schema";
|
|
2
|
+
import type { ActionSampleRates } from "./tracing";
|
|
2
3
|
|
|
3
4
|
export type RuntimeActionHandler = (...args: any[]) => any;
|
|
4
5
|
|
|
@@ -46,6 +47,41 @@ export function flattenActionInputSchemas(
|
|
|
46
47
|
return flattened;
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Flatten per-action sample rates into dot-separated action names.
|
|
52
|
+
*
|
|
53
|
+
* @throws TypeError when a rate names something that is not an action.
|
|
54
|
+
*/
|
|
55
|
+
export function flattenActionTraceSamplers(
|
|
56
|
+
actions: unknown,
|
|
57
|
+
rates: ActionSampleRates = {},
|
|
58
|
+
): Record<string, number> {
|
|
59
|
+
const handlers = flattenActionHandlers(actions);
|
|
60
|
+
const flattened = Object.fromEntries(flattenSampleRates(rates, []));
|
|
61
|
+
for (const name of Object.keys(flattened)) {
|
|
62
|
+
if (!Object.hasOwn(handlers, name)) {
|
|
63
|
+
throw new TypeError(
|
|
64
|
+
`tracing.actions.${name} does not name an action`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return flattened;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function flattenSampleRates(
|
|
72
|
+
rates: ActionSampleRates,
|
|
73
|
+
path: readonly string[],
|
|
74
|
+
): Array<[name: string, rate: number]> {
|
|
75
|
+
return Object.entries(rates).flatMap(
|
|
76
|
+
([segment, rate]): Array<[name: string, rate: number]> => {
|
|
77
|
+
const childPath = [...path, segment];
|
|
78
|
+
return typeof rate === "number"
|
|
79
|
+
? [[childPath.join("."), rate]]
|
|
80
|
+
: flattenSampleRates(rate, childPath);
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
49
85
|
interface ActionEntry {
|
|
50
86
|
name: string;
|
|
51
87
|
path: string[];
|
package/src/actor/config.ts
CHANGED
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
PrimitiveSchema,
|
|
17
17
|
QueueSchemaConfig,
|
|
18
18
|
} from "./schema";
|
|
19
|
+
import type { ActionSampleRates, ActorTracingOptions } from "./tracing";
|
|
19
20
|
|
|
20
21
|
export const DEFAULT_SLEEP_GRACE_PERIOD = 15_000;
|
|
21
22
|
|
|
@@ -1342,6 +1343,12 @@ export const ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
|
1342
1343
|
export type ActorOptions = z.infer<typeof ActorOptionsSchema>;
|
|
1343
1344
|
export type ActorOptionsInput = z.input<typeof ActorOptionsSchema>;
|
|
1344
1345
|
|
|
1346
|
+
const zSampleRate = z.number().min(0).max(1);
|
|
1347
|
+
|
|
1348
|
+
const zActionSampleRates: z.ZodType<ActionSampleRates> = z.lazy(() =>
|
|
1349
|
+
z.record(z.string(), z.union([zSampleRate, zActionSampleRates])),
|
|
1350
|
+
);
|
|
1351
|
+
|
|
1345
1352
|
export const ActorConfigSchema = z
|
|
1346
1353
|
.object({
|
|
1347
1354
|
onCreate: zFunction().optional(),
|
|
@@ -1359,6 +1366,13 @@ export const ActorConfigSchema = z
|
|
|
1359
1366
|
onWebSocket: zFunction().optional(),
|
|
1360
1367
|
actions: zActionTree.default(() => ({})),
|
|
1361
1368
|
actionInputSchemas: z.record(z.string(), z.any()).optional(),
|
|
1369
|
+
tracing: z
|
|
1370
|
+
.object({
|
|
1371
|
+
sampler: zSampleRate.optional(),
|
|
1372
|
+
actions: zActionSampleRates.optional(),
|
|
1373
|
+
})
|
|
1374
|
+
.strict()
|
|
1375
|
+
.optional(),
|
|
1362
1376
|
connParamsSchema: z.any().optional(),
|
|
1363
1377
|
events: z.record(z.string(), z.any()).optional(),
|
|
1364
1378
|
queues: z.record(z.string(), z.any()).optional(),
|
|
@@ -1904,6 +1918,12 @@ interface BaseActorConfig<
|
|
|
1904
1918
|
*/
|
|
1905
1919
|
actionInputSchemas?: ActionInputSchemas;
|
|
1906
1920
|
|
|
1921
|
+
/**
|
|
1922
|
+
* How much of this actor's work is recorded in traces. Defaults to the
|
|
1923
|
+
* process sampler from `OTEL_TRACES_SAMPLER`.
|
|
1924
|
+
*/
|
|
1925
|
+
tracing?: ActorTracingOptions<TActions>;
|
|
1926
|
+
|
|
1907
1927
|
/**
|
|
1908
1928
|
* Optional schema for validating connection params in native runtimes.
|
|
1909
1929
|
*/
|
|
@@ -2061,6 +2081,7 @@ export type ActorConfigInput<
|
|
|
2061
2081
|
} & Omit<
|
|
2062
2082
|
z.input<typeof ActorConfigSchema>,
|
|
2063
2083
|
| "actions"
|
|
2084
|
+
| "tracing"
|
|
2064
2085
|
| "events"
|
|
2065
2086
|
| "queues"
|
|
2066
2087
|
| "onCreate"
|
|
@@ -2437,6 +2458,12 @@ export const DocActorConfigSchema = z
|
|
|
2437
2458
|
.describe(
|
|
2438
2459
|
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names.",
|
|
2439
2460
|
),
|
|
2461
|
+
tracing: z
|
|
2462
|
+
.unknown()
|
|
2463
|
+
.optional()
|
|
2464
|
+
.describe(
|
|
2465
|
+
"Trace sampling for this actor: `sampler` is the share of its invocations that are recorded, from 0 to 1, with optional per-action rates under `actions`. A rate lowers what is recorded and never raises it. Defaults to the process sampler from OTEL_TRACES_SAMPLER.",
|
|
2466
|
+
),
|
|
2440
2467
|
connParamsSchema: z
|
|
2441
2468
|
.unknown()
|
|
2442
2469
|
.optional()
|
package/src/actor/definition.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { AnyDatabaseProvider } from "@/common/database/config";
|
|
2
2
|
import type { RegistryConfig } from "@/registry/config";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
flattenActionHandlers,
|
|
5
|
+
flattenActionInputSchemas,
|
|
6
|
+
flattenActionTraceSamplers,
|
|
7
|
+
} from "./actions";
|
|
4
8
|
import {
|
|
5
9
|
type Actions,
|
|
6
10
|
type ActorConfig,
|
|
@@ -209,6 +213,7 @@ export function actor<
|
|
|
209
213
|
>;
|
|
210
214
|
flattenActionHandlers(config.actions);
|
|
211
215
|
flattenActionInputSchemas(config.actions, config.actionInputSchemas);
|
|
216
|
+
flattenActionTraceSamplers(config.actions, config.tracing?.actions);
|
|
212
217
|
return new ActorDefinition(config);
|
|
213
218
|
}
|
|
214
219
|
|
package/src/actor/mod.ts
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Sample rates keyed by action name, nested like the actor's action groups. */
|
|
2
|
+
export interface ActionSampleRates {
|
|
3
|
+
readonly [name: string]: number | ActionSampleRates;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* {@link ActionSampleRates} limited to the actions of one actor, so a rate for
|
|
8
|
+
* an action that does not exist is a compile error.
|
|
9
|
+
*/
|
|
10
|
+
export type ActionTraceSamplers<TActions> = {
|
|
11
|
+
readonly [K in keyof TActions]?: TActions[K] extends (
|
|
12
|
+
...args: never[]
|
|
13
|
+
) => unknown
|
|
14
|
+
? number
|
|
15
|
+
: ActionTraceSamplers<TActions[K]>;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** Trace sampling for one actor definition. */
|
|
19
|
+
export interface ActorTracingOptions<TActions> {
|
|
20
|
+
/**
|
|
21
|
+
* Share of this actor's invocations that are recorded, from 0 to 1. A rate
|
|
22
|
+
* lowers what is recorded and never raises it, so an invocation inside a
|
|
23
|
+
* trace the caller did not record is not recorded at any rate.
|
|
24
|
+
*/
|
|
25
|
+
readonly sampler?: number;
|
|
26
|
+
/** Rates that replace `sampler` for single actions. */
|
|
27
|
+
readonly actions?: ActionTraceSamplers<TActions>;
|
|
28
|
+
}
|
package/src/registry/native.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { VirtualWebSocket } from "@rivetkit/virtual-websocket";
|
|
|
2
2
|
import {
|
|
3
3
|
flattenActionHandlers,
|
|
4
4
|
flattenActionInputSchemas,
|
|
5
|
+
flattenActionTraceSamplers,
|
|
5
6
|
} from "@/actor/actions";
|
|
6
7
|
import {
|
|
7
8
|
ACTOR_CONTEXT_INTERNAL_SYMBOL,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
getQueueCanPublish,
|
|
42
43
|
hasSchemaConfigKey,
|
|
43
44
|
} from "@/actor/schema";
|
|
45
|
+
import type { ActionSampleRates } from "@/actor/tracing";
|
|
44
46
|
import {
|
|
45
47
|
type AnyClient,
|
|
46
48
|
type Client,
|
|
@@ -112,6 +114,7 @@ import type {
|
|
|
112
114
|
CoreRuntime,
|
|
113
115
|
RegistryHandle,
|
|
114
116
|
RuntimeActorConfig,
|
|
117
|
+
RuntimeActorTracingConfig,
|
|
115
118
|
RuntimeBytes,
|
|
116
119
|
RuntimeCronFire,
|
|
117
120
|
RuntimeCronJobInfo,
|
|
@@ -3854,6 +3857,17 @@ function withConnContext(
|
|
|
3854
3857
|
});
|
|
3855
3858
|
}
|
|
3856
3859
|
|
|
3860
|
+
function buildActorTracingConfig(
|
|
3861
|
+
actions: unknown,
|
|
3862
|
+
tracing: { sampler?: number; actions?: ActionSampleRates } | undefined,
|
|
3863
|
+
): RuntimeActorTracingConfig | undefined {
|
|
3864
|
+
if (tracing === undefined) return undefined;
|
|
3865
|
+
return {
|
|
3866
|
+
sampler: tracing.sampler,
|
|
3867
|
+
actions: flattenActionTraceSamplers(actions, tracing.actions),
|
|
3868
|
+
};
|
|
3869
|
+
}
|
|
3870
|
+
|
|
3857
3871
|
function buildActorConfig(
|
|
3858
3872
|
definition: AnyActorDefinition,
|
|
3859
3873
|
registryConfig: RegistryConfig,
|
|
@@ -3874,6 +3888,10 @@ function buildActorConfig(
|
|
|
3874
3888
|
hasDatabase: true,
|
|
3875
3889
|
remoteSqlite: usesRemoteSqlite,
|
|
3876
3890
|
sqliteProfiling,
|
|
3891
|
+
tracing: buildActorTracingConfig(
|
|
3892
|
+
definition.config.actions,
|
|
3893
|
+
definition.config.tracing,
|
|
3894
|
+
),
|
|
3877
3895
|
enableActorRuntimeSocket: options.enableActorRuntimeSocket === true,
|
|
3878
3896
|
hasState:
|
|
3879
3897
|
config.state !== undefined ||
|
package/src/registry/runtime.ts
CHANGED
|
@@ -318,12 +318,20 @@ export interface RuntimeSqlTransactionDatabase {
|
|
|
318
318
|
rollback(): Promise<void>;
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
+
/** Sample rates for the traces an actor starts, in the shape core takes. */
|
|
322
|
+
export interface RuntimeActorTracingConfig {
|
|
323
|
+
sampler?: number;
|
|
324
|
+
/** Keyed by flattened, dot-separated action name. */
|
|
325
|
+
actions?: Record<string, number>;
|
|
326
|
+
}
|
|
327
|
+
|
|
321
328
|
export interface RuntimeActorConfig {
|
|
322
329
|
name?: string;
|
|
323
330
|
icon?: string;
|
|
324
331
|
hasDatabase?: boolean;
|
|
325
332
|
remoteSqlite?: boolean;
|
|
326
333
|
sqliteProfiling?: SqliteProfilingOptions;
|
|
334
|
+
tracing?: RuntimeActorTracingConfig;
|
|
327
335
|
enableActorRuntimeSocket?: boolean;
|
|
328
336
|
hasState?: boolean;
|
|
329
337
|
canHibernateWebsocket?: boolean;
|