rivetkit 2.3.18 → 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 +754 -608
- package/dist/browser/client.js +184 -28
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +3 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +36 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +149 -3
- package/dist/tsup/agent-os/index.d.ts +149 -3
- package/dist/tsup/agent-os/index.js +36 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-2IDK6NX3.cjs → chunk-2CE5UNWK.cjs} +13 -13
- package/dist/tsup/chunk-2CE5UNWK.cjs.map +1 -0
- package/dist/tsup/{chunk-IPXIZSE7.js → chunk-2NXLTFWI.js} +3 -3
- package/dist/tsup/{chunk-OKVVWOC3.cjs → chunk-3WS7Z64U.cjs} +3 -3
- package/dist/tsup/{chunk-OKVVWOC3.cjs.map → chunk-3WS7Z64U.cjs.map} +1 -1
- package/dist/tsup/{chunk-LAITPJRA.js → chunk-553CIQJY.js} +2 -2
- package/dist/tsup/{chunk-PXKNBNVU.js → chunk-5G2J26VM.js} +188 -31
- package/dist/tsup/chunk-5G2J26VM.js.map +1 -0
- package/dist/tsup/{chunk-IKZ6DJMP.cjs → chunk-76YTS32R.cjs} +4 -4
- package/dist/tsup/{chunk-IKZ6DJMP.cjs.map → chunk-76YTS32R.cjs.map} +1 -1
- package/dist/tsup/{chunk-NRIRV3Z2.cjs → chunk-A36FMKOV.cjs} +352 -195
- package/dist/tsup/chunk-A36FMKOV.cjs.map +1 -0
- package/dist/tsup/{chunk-6W5VGLFT.js → chunk-CSOHAAZK.js} +33 -1
- package/dist/tsup/chunk-CSOHAAZK.js.map +1 -0
- package/dist/tsup/{chunk-T6JUXRNI.cjs → chunk-CVLNRT7O.cjs} +3 -3
- package/dist/tsup/{chunk-T6JUXRNI.cjs.map → chunk-CVLNRT7O.cjs.map} +1 -1
- package/dist/tsup/{chunk-7EPLADKM.js → chunk-DHWZTUKA.js} +7 -7
- package/dist/tsup/chunk-DHWZTUKA.js.map +1 -0
- package/dist/tsup/{chunk-4XECVATQ.js → chunk-DMQUERRN.js} +2 -2
- package/dist/tsup/{chunk-25Z2RK7C.cjs → chunk-IHKDFKM4.cjs} +3 -3
- package/dist/tsup/{chunk-25Z2RK7C.cjs.map → chunk-IHKDFKM4.cjs.map} +1 -1
- package/dist/tsup/{chunk-2JSYYH6P.cjs → chunk-JX2ITWAV.cjs} +13 -2
- package/dist/tsup/chunk-JX2ITWAV.cjs.map +1 -0
- package/dist/tsup/{chunk-4KGXFC6M.cjs → chunk-NWCAIWHL.cjs} +34 -2
- package/dist/tsup/chunk-NWCAIWHL.cjs.map +1 -0
- package/dist/tsup/{chunk-OUQUIBVW.js → chunk-P2OFXH4G.js} +12 -1
- package/dist/tsup/chunk-P2OFXH4G.js.map +1 -0
- package/dist/tsup/{chunk-ZRTESY7V.cjs → chunk-RSIOGT2U.cjs} +7 -7
- package/dist/tsup/{chunk-ZRTESY7V.cjs.map → chunk-RSIOGT2U.cjs.map} +1 -1
- package/dist/tsup/{chunk-QIFZELUQ.js → chunk-SNNVRHLX.js} +2 -2
- package/dist/tsup/{chunk-2MK75JFR.js → chunk-TZVAVPGJ.js} +4 -4
- package/dist/tsup/{chunk-TNSLNSQH.js → chunk-W2PXGWMR.js} +2 -2
- package/dist/tsup/{chunk-O7RSU3UC.cjs → chunk-WAISW7KR.cjs} +10 -10
- package/dist/tsup/{chunk-O7RSU3UC.cjs.map → chunk-WAISW7KR.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +5 -5
- package/dist/tsup/client/mod.d.ts +5 -5
- 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-Ug5M2MOr.d.ts → config-Be-VOHaX.d.ts} +155 -11
- package/dist/tsup/{config-gvHwMas-.d.cts → config-Ct5uXxXk.d.cts} +155 -11
- package/dist/tsup/{context-DererUCI.d.ts → context-CXLa0BIM.d.ts} +1 -1
- package/dist/tsup/{context-BSCBvbfM.d.cts → context-Cw-11Q-B.d.cts} +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.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +3 -3
- package/dist/tsup/dynamic/mod.d.ts +3 -3
- package/dist/tsup/dynamic/mod.js +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.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +4 -4
- package/dist/tsup/inspector-tab/mod.d.ts +4 -4
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +506 -319
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +381 -194
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +3 -3
- package/dist/tsup/test/mod.d.ts +3 -3
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/{utils-Bbz-3411.d.cts → utils-CNFeS-Dk.d.cts} +1 -1
- package/dist/tsup/{utils-vvJQyygr.d.ts → utils-DsoDinPz.d.cts} +9 -1
- package/dist/tsup/{utils-vvJQyygr.d.cts → utils-DsoDinPz.d.ts} +9 -1
- package/dist/tsup/{utils-BqdWVlzm.d.ts → utils-OQHBjfcM.d.ts} +1 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +2 -2
- package/dist/tsup/utils.d.ts +2 -2
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +33 -27
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +5 -5
- package/dist/tsup/workflow/mod.d.ts +5 -5
- package/dist/tsup/workflow/mod.js +25 -19
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +10 -8
- package/src/actor/actions.ts +36 -0
- package/src/actor/config.ts +65 -0
- package/src/actor/definition.ts +6 -1
- package/src/actor/errors.ts +31 -0
- package/src/actor/mod.ts +5 -0
- package/src/actor/tracing.ts +28 -0
- package/src/client/actor-conn.ts +7 -0
- package/src/client/actor-handle.ts +57 -17
- package/src/client/client.ts +26 -6
- package/src/client/outbound-telemetry.ts +66 -0
- package/src/client/queue.ts +3 -0
- package/src/client/raw-utils.ts +3 -0
- package/src/common/actor-router-consts.ts +3 -0
- package/src/common/actor-telemetry-context.ts +19 -0
- package/src/common/otel-context.ts +99 -0
- package/src/common/utils.ts +1 -19
- package/src/engine-client/actor-http-client.ts +15 -0
- package/src/registry/index.ts +6 -0
- package/src/registry/napi-runtime.ts +155 -35
- package/src/registry/native.ts +295 -191
- package/src/registry/runtime.ts +74 -0
- package/src/registry/wasm-runtime.ts +40 -0
- package/src/workflow/driver.ts +20 -12
- package/dist/tsup/chunk-2IDK6NX3.cjs.map +0 -1
- package/dist/tsup/chunk-2JSYYH6P.cjs.map +0 -1
- package/dist/tsup/chunk-4KGXFC6M.cjs.map +0 -1
- package/dist/tsup/chunk-6W5VGLFT.js.map +0 -1
- package/dist/tsup/chunk-7EPLADKM.js.map +0 -1
- package/dist/tsup/chunk-NRIRV3Z2.cjs.map +0 -1
- package/dist/tsup/chunk-OUQUIBVW.js.map +0 -1
- package/dist/tsup/chunk-PXKNBNVU.js.map +0 -1
- /package/dist/tsup/{chunk-IPXIZSE7.js.map → chunk-2NXLTFWI.js.map} +0 -0
- /package/dist/tsup/{chunk-LAITPJRA.js.map → chunk-553CIQJY.js.map} +0 -0
- /package/dist/tsup/{chunk-4XECVATQ.js.map → chunk-DMQUERRN.js.map} +0 -0
- /package/dist/tsup/{chunk-QIFZELUQ.js.map → chunk-SNNVRHLX.js.map} +0 -0
- /package/dist/tsup/{chunk-2MK75JFR.js.map → chunk-TZVAVPGJ.js.map} +0 -0
- /package/dist/tsup/{chunk-TNSLNSQH.js.map → chunk-W2PXGWMR.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import { G as GetUpgradeWebSocket } from '../utils-
|
|
4
|
-
export { E as Encoding } from '../utils-
|
|
1
|
+
import { aI as Registry, a6 as Client } from '../config-Be-VOHaX.js';
|
|
2
|
+
export { bx as ActorAccessor, by as ActorActionFunction, bz as ActorActionOptions, bA as ActorConn, bB as ActorConnRaw, bC as ActorConnStatus, bD as ActorConnectOptions, x as ActorDefinition, bE as ActorGatewayOptions, bF as ActorHandle, bG as ActorHandleRaw, A as AnyActorDefinition, bH as ClientRaw, bI as ConnectionStateCallback, bJ as CreateOptions, bK as CreateRequest, bL as EventUnsubscribe, bM as ExtractActorsFromRegistry, bN as ExtractRegistryFromClient, bO as GetOptions, bP as GetWithIdOptions, bQ as QueryOptions, bR as Region, bS as StatusChangeCallback } from '../config-Be-VOHaX.js';
|
|
3
|
+
import { G as GetUpgradeWebSocket } from '../utils-OQHBjfcM.js';
|
|
4
|
+
export { E as Encoding } from '../utils-OQHBjfcM.js';
|
|
5
5
|
import z from 'zod/v4';
|
|
6
|
-
export { R as ActorError, R as RivetError, U as UserError } from '../utils-
|
|
6
|
+
export { R as ActorError, R as RivetError, U as UserError } from '../utils-DsoDinPz.js';
|
|
7
7
|
import '../config-ey2I2zz5.js';
|
|
8
8
|
import '@rivetkit/rivetkit-wasm';
|
|
9
9
|
import 'zod';
|
package/dist/tsup/client/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-2NXLTFWI.js";
|
|
4
4
|
import {
|
|
5
5
|
ActorClientError,
|
|
6
6
|
ActorConnDisposed,
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
ActorHandleRaw,
|
|
9
9
|
MalformedResponseMessage,
|
|
10
10
|
ManagerError
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-5G2J26VM.js";
|
|
12
12
|
import "../chunk-JI6GZ2C2.js";
|
|
13
|
+
import "../chunk-553CIQJY.js";
|
|
13
14
|
import "../chunk-JTHHCZCZ.js";
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-7EPLADKM.js";
|
|
15
|
+
import "../chunk-DHWZTUKA.js";
|
|
16
16
|
import {
|
|
17
17
|
RivetError,
|
|
18
18
|
UserError
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-P2OFXH4G.js";
|
|
20
20
|
export {
|
|
21
21
|
ActorClientError,
|
|
22
22
|
ActorConnDisposed,
|
package/dist/tsup/common/log.cjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('../chunk-
|
|
10
|
+
var _chunk2CE5UNWKcjs = require('../chunk-2CE5UNWK.cjs');
|
|
11
|
+
require('../chunk-JX2ITWAV.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
@@ -18,5 +18,5 @@ require('../chunk-2JSYYH6P.cjs');
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
exports.LogLevelSchema =
|
|
21
|
+
exports.LogLevelSchema = _chunk2CE5UNWKcjs.LogLevelSchema; exports.configureBaseLogger = _chunk2CE5UNWKcjs.configureBaseLogger; exports.configureDefaultLogger = _chunk2CE5UNWKcjs.configureDefaultLogger; exports.getBaseLogger = _chunk2CE5UNWKcjs.getBaseLogger; exports.getIncludeTarget = _chunk2CE5UNWKcjs.getIncludeTarget; exports.getLogger = _chunk2CE5UNWKcjs.getLogger; exports.getPinoLevel = _chunk2CE5UNWKcjs.getPinoLevel; exports.makeDefaultLogger = _chunk2CE5UNWKcjs.makeDefaultLogger;
|
|
22
22
|
//# sourceMappingURL=log.cjs.map
|
package/dist/tsup/common/log.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var _chunk3WS7Z64Ucjs = require('../chunk-3WS7Z64U.cjs');
|
|
4
|
+
require('../chunk-2CE5UNWK.cjs');
|
|
5
|
+
require('../chunk-JX2ITWAV.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.importWebSocket =
|
|
8
|
+
exports.importWebSocket = _chunk3WS7Z64Ucjs.importWebSocket;
|
|
9
9
|
//# sourceMappingURL=websocket.cjs.map
|
|
@@ -6,9 +6,9 @@ import { Logger } from 'pino';
|
|
|
6
6
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
7
7
|
import { WorkflowState } from './inspector/workflow.js';
|
|
8
8
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
9
|
-
import { E as Encoding, G as GetUpgradeWebSocket } from './utils-
|
|
9
|
+
import { E as Encoding, G as GetUpgradeWebSocket } from './utils-OQHBjfcM.js';
|
|
10
10
|
import { Context, Hono } from 'hono';
|
|
11
|
-
import { R as RivetError } from './utils-
|
|
11
|
+
import { R as RivetError } from './utils-DsoDinPz.js';
|
|
12
12
|
|
|
13
13
|
declare const ActorKeySchema: z.ZodArray<z.ZodString>;
|
|
14
14
|
type ActorKey = z.infer<typeof ActorKeySchema>;
|
|
@@ -562,6 +562,25 @@ interface ActorOutput {
|
|
|
562
562
|
error?: unknown;
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
+
/** Correlation owned by the currently executing Core actor invocation. */
|
|
566
|
+
interface ActorInvocationTraceContext {
|
|
567
|
+
/** Ray ID the invocation received, absent when nothing upstream supplied one. */
|
|
568
|
+
readonly rayId?: string;
|
|
569
|
+
/** Core-owned invocation span context, absent when tracing is disabled. */
|
|
570
|
+
readonly span?: ActorInvocationSpanContext;
|
|
571
|
+
}
|
|
572
|
+
/** W3C span context of the Core invocation span. */
|
|
573
|
+
interface ActorInvocationSpanContext {
|
|
574
|
+
/** W3C trace identifier. */
|
|
575
|
+
readonly traceId: string;
|
|
576
|
+
/** W3C span identifier for the Core invocation. */
|
|
577
|
+
readonly spanId: string;
|
|
578
|
+
/** OpenTelemetry trace flags encoded as an integer. */
|
|
579
|
+
readonly traceFlags: number;
|
|
580
|
+
/** Optional vendor trace state inherited by the Core invocation. */
|
|
581
|
+
readonly tracestate?: string;
|
|
582
|
+
}
|
|
583
|
+
|
|
565
584
|
declare const handleBrand: unique symbol;
|
|
566
585
|
type OpaqueHandle<Name extends string> = {
|
|
567
586
|
readonly [handleBrand]: Name;
|
|
@@ -580,6 +599,27 @@ interface RuntimeActorKeySegment {
|
|
|
580
599
|
stringValue?: string;
|
|
581
600
|
numberValue?: number;
|
|
582
601
|
}
|
|
602
|
+
/** Resolves correlation at operation time so retained clients cannot freeze stale context. */
|
|
603
|
+
type CurrentActorInvocation = () => ActorInvocationTraceContext | undefined;
|
|
604
|
+
/** One open call from an actor out to another actor. */
|
|
605
|
+
interface RuntimeOutboundCall {
|
|
606
|
+
/**
|
|
607
|
+
* W3C context of the call's own span, to send to the callee so it parents to
|
|
608
|
+
* the call. Absent when tracing is disabled.
|
|
609
|
+
*/
|
|
610
|
+
readonly span?: ActorInvocationSpanContext;
|
|
611
|
+
/**
|
|
612
|
+
* Records the call's outcome. `error` is the failure encoded the way the
|
|
613
|
+
* bridge encodes errors, so a structured error keeps its group and code.
|
|
614
|
+
*/
|
|
615
|
+
finish(error?: string): void;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* Opens the span covering one call out to another actor, or returns `undefined`
|
|
619
|
+
* outside an invocation or on a runtime without invocation telemetry. Callers
|
|
620
|
+
* send their own context when it returns nothing.
|
|
621
|
+
*/
|
|
622
|
+
type StartCallSpan = (actorName: string, actionName: string) => RuntimeOutboundCall | undefined;
|
|
583
623
|
interface RuntimeHttpRequest {
|
|
584
624
|
method: string;
|
|
585
625
|
uri: string;
|
|
@@ -740,12 +780,19 @@ interface RuntimeSqlBatchStatement {
|
|
|
740
780
|
interface RuntimeSqlRunResult {
|
|
741
781
|
changes: number;
|
|
742
782
|
}
|
|
783
|
+
/** Sample rates for the traces an actor starts, in the shape core takes. */
|
|
784
|
+
interface RuntimeActorTracingConfig {
|
|
785
|
+
sampler?: number;
|
|
786
|
+
/** Keyed by flattened, dot-separated action name. */
|
|
787
|
+
actions?: Record<string, number>;
|
|
788
|
+
}
|
|
743
789
|
interface RuntimeActorConfig {
|
|
744
790
|
name?: string;
|
|
745
791
|
icon?: string;
|
|
746
792
|
hasDatabase?: boolean;
|
|
747
793
|
remoteSqlite?: boolean;
|
|
748
794
|
sqliteProfiling?: SqliteProfilingOptions;
|
|
795
|
+
tracing?: RuntimeActorTracingConfig;
|
|
749
796
|
enableActorRuntimeSocket?: boolean;
|
|
750
797
|
hasState?: boolean;
|
|
751
798
|
canHibernateWebsocket?: boolean;
|
|
@@ -877,6 +924,7 @@ interface CoreRuntime {
|
|
|
877
924
|
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
878
925
|
waitRegistryReady(registry: RegistryHandle): Promise<void>;
|
|
879
926
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
927
|
+
shutdownTelemetry?(): Promise<void>;
|
|
880
928
|
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
881
929
|
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
882
930
|
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
@@ -906,6 +954,31 @@ interface CoreRuntime {
|
|
|
906
954
|
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
907
955
|
actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
|
|
908
956
|
actorId(ctx: ActorContextHandle): string;
|
|
957
|
+
/**
|
|
958
|
+
* Runs one actor callback with `ctx` as the current invocation: operations
|
|
959
|
+
* on retained handles for the same actor resolve to it, and its Core span
|
|
960
|
+
* is the active OpenTelemetry span for the duration of `run`. Only actions,
|
|
961
|
+
* raw requests, and queue dispatch run this way; other callbacks have no
|
|
962
|
+
* invocation span.
|
|
963
|
+
*/
|
|
964
|
+
runWithActorInvocationContext<T>(ctx: ActorContextHandle, run: () => T): T;
|
|
965
|
+
/**
|
|
966
|
+
* Correlation of the invocation currently executing for this actor, or
|
|
967
|
+
* `undefined` outside an invocation or after it finished. A sampled-out
|
|
968
|
+
* invocation can still expose valid span context for propagation.
|
|
969
|
+
*/
|
|
970
|
+
actorInvocationTraceContext(ctx: ActorContextHandle): ActorInvocationTraceContext | undefined;
|
|
971
|
+
/**
|
|
972
|
+
* Opens the span covering one call this actor makes to another actor. See
|
|
973
|
+
* `StartCallSpan` for when this returns nothing.
|
|
974
|
+
*/
|
|
975
|
+
startCallSpan(ctx: ActorContextHandle, actorName: string, actionName: string): RuntimeOutboundCall | undefined;
|
|
976
|
+
/** Backs `ActorRun.startWorkflowSpan`. */
|
|
977
|
+
startWorkflowSpan(ctx: ActorContextHandle): Promise<WorkflowSpan>;
|
|
978
|
+
/** Backs `ActorRun.runOutsideWorkflowSpan`. */
|
|
979
|
+
runOutsideActorInvocationContext<T>(run: () => T): T;
|
|
980
|
+
/** Identity of the invocation the caller runs in, usable as a cache key. */
|
|
981
|
+
currentInvocationScope(): object | undefined;
|
|
909
982
|
actorName(ctx: ActorContextHandle): string;
|
|
910
983
|
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
911
984
|
actorRegion(ctx: ActorContextHandle): string;
|
|
@@ -1245,7 +1318,7 @@ declare class ActorConnRaw {
|
|
|
1245
1318
|
*
|
|
1246
1319
|
* @protected
|
|
1247
1320
|
*/
|
|
1248
|
-
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions);
|
|
1321
|
+
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, currentActorInvocation?: CurrentActorInvocation);
|
|
1249
1322
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1250
1323
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1251
1324
|
/**
|
|
@@ -1381,7 +1454,7 @@ declare class ActorHandleRaw {
|
|
|
1381
1454
|
*
|
|
1382
1455
|
* @protected
|
|
1383
1456
|
*/
|
|
1384
|
-
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal);
|
|
1457
|
+
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal, currentActorInvocation?: CurrentActorInvocation, startCallSpan?: StartCallSpan);
|
|
1385
1458
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1386
1459
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1387
1460
|
/**
|
|
@@ -1582,6 +1655,18 @@ interface Region {
|
|
|
1582
1655
|
}
|
|
1583
1656
|
declare const ACTOR_CONNS_SYMBOL: unique symbol;
|
|
1584
1657
|
declare const CREATE_ACTOR_CONN_PROXY: unique symbol;
|
|
1658
|
+
/** Options for constructing a raw actor client. */
|
|
1659
|
+
interface ClientRawOptions {
|
|
1660
|
+
encoding?: Encoding;
|
|
1661
|
+
gateway?: ActorGatewayOptions;
|
|
1662
|
+
}
|
|
1663
|
+
/** Runtime-supplied wiring for clients created inside an actor. Set only by the native runtime. */
|
|
1664
|
+
interface ActorClientRuntimeOptions {
|
|
1665
|
+
/** Supplies the calling actor's invocation so actor-to-actor clients propagate its trace and ray ID. */
|
|
1666
|
+
currentActorInvocation?: CurrentActorInvocation;
|
|
1667
|
+
/** Opens and finishes the Core span covering an actor-to-actor call. */
|
|
1668
|
+
startCallSpan?: StartCallSpan;
|
|
1669
|
+
}
|
|
1585
1670
|
/**
|
|
1586
1671
|
* Client for managing & connecting to actors.
|
|
1587
1672
|
*
|
|
@@ -1594,7 +1679,7 @@ declare class ClientRaw {
|
|
|
1594
1679
|
/**
|
|
1595
1680
|
* Creates an instance of Client.
|
|
1596
1681
|
*/
|
|
1597
|
-
constructor(driver: EngineControlClient,
|
|
1682
|
+
constructor(driver: EngineControlClient, options?: ClientRawOptions & ActorClientRuntimeOptions);
|
|
1598
1683
|
/**
|
|
1599
1684
|
* Gets a stateless handle to a actor by its ID.
|
|
1600
1685
|
*
|
|
@@ -1654,10 +1739,30 @@ type Client<A extends Registry<any>> = ClientRaw & {
|
|
|
1654
1739
|
[K in keyof ExtractActorsFromRegistry<A>]: ActorAccessor<ExtractActorsFromRegistry<A>[K]>;
|
|
1655
1740
|
};
|
|
1656
1741
|
type AnyClient = Client<Registry<any>>;
|
|
1657
|
-
declare function createClientWithDriver<A extends Registry<any>>(driver: EngineControlClient,
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1742
|
+
declare function createClientWithDriver<A extends Registry<any>>(driver: EngineControlClient, options?: ClientRawOptions & ActorClientRuntimeOptions): Client<A>;
|
|
1743
|
+
|
|
1744
|
+
/** Sample rates keyed by action name, nested like the actor's action groups. */
|
|
1745
|
+
interface ActionSampleRates {
|
|
1746
|
+
readonly [name: string]: number | ActionSampleRates;
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* {@link ActionSampleRates} limited to the actions of one actor, so a rate for
|
|
1750
|
+
* an action that does not exist is a compile error.
|
|
1751
|
+
*/
|
|
1752
|
+
type ActionTraceSamplers<TActions> = {
|
|
1753
|
+
readonly [K in keyof TActions]?: TActions[K] extends (...args: never[]) => unknown ? number : ActionTraceSamplers<TActions[K]>;
|
|
1754
|
+
};
|
|
1755
|
+
/** Trace sampling for one actor definition. */
|
|
1756
|
+
interface ActorTracingOptions<TActions> {
|
|
1757
|
+
/**
|
|
1758
|
+
* Share of this actor's invocations that are recorded, from 0 to 1. A rate
|
|
1759
|
+
* lowers what is recorded and never raises it, so an invocation inside a
|
|
1760
|
+
* trace the caller did not record is not recorded at any rate.
|
|
1761
|
+
*/
|
|
1762
|
+
readonly sampler?: number;
|
|
1763
|
+
/** Rates that replace `sampler` for single actions. */
|
|
1764
|
+
readonly actions?: ActionTraceSamplers<TActions>;
|
|
1765
|
+
}
|
|
1661
1766
|
|
|
1662
1767
|
declare const DEFAULT_SLEEP_GRACE_PERIOD = 15000;
|
|
1663
1768
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
@@ -1918,6 +2023,28 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1918
2023
|
client<T = any>(): ActorClientFor<T>;
|
|
1919
2024
|
[key: string]: any;
|
|
1920
2025
|
}
|
|
2026
|
+
/** @experimental How one run of a workflow function ended. */
|
|
2027
|
+
type WorkflowOutcome = "completed" | "sleeping" | "evicted" | "failed" | "cancelled";
|
|
2028
|
+
/** @experimental How one workflow step attempt ended. `retry` will be tried again, `failed` will not. */
|
|
2029
|
+
type WorkflowStepOutcome = "ok" | "retry" | "failed";
|
|
2030
|
+
/** @experimental One open run of a workflow function, traced as its own invocation. */
|
|
2031
|
+
interface WorkflowSpan {
|
|
2032
|
+
/** Runs `body` attributed to this run. */
|
|
2033
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
2034
|
+
/**
|
|
2035
|
+
* Called by a workflow engine before each attempt at a step. Returns
|
|
2036
|
+
* nothing when tracing is off.
|
|
2037
|
+
*/
|
|
2038
|
+
startStep(name: string, attempt: number): WorkflowStepSpan | undefined;
|
|
2039
|
+
finish(outcome: WorkflowOutcome): Promise<void>;
|
|
2040
|
+
}
|
|
2041
|
+
/** @experimental One open attempt at one workflow step. */
|
|
2042
|
+
interface WorkflowStepSpan {
|
|
2043
|
+
/** Runs `body` attributed to this attempt. */
|
|
2044
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
2045
|
+
/** `error` is what the step callback threw. */
|
|
2046
|
+
finish(outcome: WorkflowStepOutcome, error?: unknown): void;
|
|
2047
|
+
}
|
|
1921
2048
|
/** @experimental */
|
|
1922
2049
|
interface ActorRun {
|
|
1923
2050
|
/**
|
|
@@ -1925,6 +2052,13 @@ interface ActorRun {
|
|
|
1925
2052
|
* ensures this actor's run handler is active, starting it if inactive.
|
|
1926
2053
|
*/
|
|
1927
2054
|
setWakeAt(timestamp: number | null): Promise<void>;
|
|
2055
|
+
/** @experimental Called by a workflow engine each time it runs the workflow function. */
|
|
2056
|
+
startWorkflowSpan(): Promise<WorkflowSpan>;
|
|
2057
|
+
/**
|
|
2058
|
+
* @experimental Runs `body` outside the current workflow run, so a workflow
|
|
2059
|
+
* engine's own history storage stays out of the trace.
|
|
2060
|
+
*/
|
|
2061
|
+
runOutsideWorkflowSpan<T>(body: () => T): T;
|
|
1928
2062
|
}
|
|
1929
2063
|
type ActionContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & {
|
|
1930
2064
|
conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
@@ -2206,6 +2340,10 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
2206
2340
|
onWebSocket: z.ZodOptional<z.ZodCustom<(...args: unknown[]) => unknown, (...args: unknown[]) => unknown>>;
|
|
2207
2341
|
actions: z.ZodDefault<z.ZodCustom<Record<string, unknown>, Record<string, unknown>>>;
|
|
2208
2342
|
actionInputSchemas: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2343
|
+
tracing: z.ZodOptional<z.ZodObject<{
|
|
2344
|
+
sampler: z.ZodOptional<z.ZodNumber>;
|
|
2345
|
+
actions: z.ZodOptional<z.ZodType<ActionSampleRates, unknown, z.core.$ZodTypeInternals<ActionSampleRates, unknown>>>;
|
|
2346
|
+
}, z.core.$strict>>;
|
|
2209
2347
|
connParamsSchema: z.ZodOptional<z.ZodAny>;
|
|
2210
2348
|
events: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
2211
2349
|
queues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
@@ -2450,6 +2588,11 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
2450
2588
|
* May mirror nested action groups or use dot-separated low-level action names.
|
|
2451
2589
|
*/
|
|
2452
2590
|
actionInputSchemas?: ActionInputSchemas;
|
|
2591
|
+
/**
|
|
2592
|
+
* How much of this actor's work is recorded in traces. Defaults to the
|
|
2593
|
+
* process sampler from `OTEL_TRACES_SAMPLER`.
|
|
2594
|
+
*/
|
|
2595
|
+
tracing?: ActorTracingOptions<TActions>;
|
|
2453
2596
|
/**
|
|
2454
2597
|
* Optional schema for validating connection params in native runtimes.
|
|
2455
2598
|
*/
|
|
@@ -2472,7 +2615,7 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
|
|
|
2472
2615
|
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>> = Omit<z.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
|
|
2473
2616
|
type ActorConfigInput<TState = undefined, TConnParams = undefined, TConnState = undefined, TVars = undefined, TInput = undefined, TDatabase extends AnyDatabaseProvider = undefined, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Record<never, never>> = {
|
|
2474
2617
|
types?: ActorTypes<TState, TConnParams, TConnState, TVars, TInput, TDatabase>;
|
|
2475
|
-
} & Omit<z.input<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
|
|
2618
|
+
} & Omit<z.input<typeof ActorConfigSchema>, "actions" | "tracing" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
|
|
2476
2619
|
declare function test<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>(input: ActorConfigInput<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions>): ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
2477
2620
|
declare const DocActorOptionsSchema: z.ZodObject<{
|
|
2478
2621
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -2520,6 +2663,7 @@ declare const DocActorConfigSchema: z.ZodObject<{
|
|
|
2520
2663
|
onWebSocket: z.ZodOptional<z.ZodUnknown>;
|
|
2521
2664
|
actions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2522
2665
|
actionInputSchemas: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2666
|
+
tracing: z.ZodOptional<z.ZodUnknown>;
|
|
2523
2667
|
connParamsSchema: z.ZodOptional<z.ZodUnknown>;
|
|
2524
2668
|
events: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2525
2669
|
queues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -2548,4 +2692,4 @@ declare const DocActorConfigSchema: z.ZodObject<{
|
|
|
2548
2692
|
}, z.core.$strip>>;
|
|
2549
2693
|
}, z.core.$strip>;
|
|
2550
2694
|
|
|
2551
|
-
export { type
|
|
2695
|
+
export { type AnyStaticActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorKey as F, type ActorKv as G, type ActorLogger as H, type ActorOptions as I, type ActorOptionsInput as J, ActorOptionsSchema as K, type ActorQuery as L, type MigrateContext as M, type ActorQueue as N, type ActorRun as O, type ActorSchedule as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type ActorTracingOptions as T, type ActorTypes as U, ActorsSchema as V, type WakeContext as W, type AnyActorInstance as X, type AnyClient as Y, type AnyConn as Z, type AnyStaticActorDefinition as _, type ActionContext as a, type ScheduledEventInfo as a$, type AuthIntent as a0, BUILTIN_INSPECTOR_TAB_IDS as a1, type BaseActorInstance as a2, BuiltinInspectorTabIdSchema as a3, CONN_DRIVER_SYMBOL as a4, CONN_STATE_MANAGER_SYMBOL as a5, type Client as a6, type Conn as a7, type CronFire as a8, type CronJobInfo as a9, type QueueName as aA, type QueueNextBatchOptions as aB, type QueueNextOptions as aC, type QueueResultMessageForName as aD, type QueueTryNextBatchOptions as aE, type QueueTryNextOptions as aF, type QueueWaitOptions as aG, RAW_STATE_SYMBOL as aH, Registry as aI, type RegistryActors as aJ, type RegistryApplication as aK, type RegistryConfig as aL, type RegistryConfigInput as aM, RegistryConfigSchema as aN, type RegistryDeps as aO, type RegistryListenOptions as aP, type RegistryRoutes as aQ, type RunConfig as aR, RunConfigSchema as aS, type RunControl as aT, type RunInspectorConfig as aU, type RunInspectorFactoryContext as aV, type RunInspectorFactoryResult as aW, type RunInspectorKind as aX, type RunWithInactiveOptions as aY, type RuntimeKind as aZ, RuntimeKindSchema as a_, CustomInspectorTabEntrySchema as aa, DEFAULT_SLEEP_GRACE_PERIOD as ab, type DefineRunHandlerOptions as ac, DocActorConfigSchema as ad, DocActorOptionsSchema as ae, DocConfigurePoolSchema as af, DocEnvoyConfigSchema as ag, DocRegistryConfigSchema as ah, DocServerlessConfigSchema as ai, DocSqliteConfigSchema as aj, type FetchHandler as ak, type GlobalActorOptions as al, type GlobalActorOptionsInput as am, GlobalActorOptionsSchema as an, HideInspectorTabEntrySchema as ao, type InferEventArgs as ap, type InferSchemaMap as aq, InspectorTabEntrySchema as ar, type InspectorUnsubscribe as as, type InstanceActorOptions as at, type InstanceActorOptionsInput as au, InstanceActorOptionsSchema as av, type QueueEnqueueAndWaitOptions as aw, type QueueFilterName as ax, type QueueIterOptions as ay, type QueueMessageOf as az, type BeforeActionResponseContext as b, type ScheduledFireInfo as b0, type ServerlessHandler as b1, type SqliteBackend as b2, SqliteBackendSchema as b3, type SqliteConfig as b4, SqliteConfigSchema as b5, type TestConfig as b6, TestConfigSchema as b7, type Type as b8, type WasmRuntimeBindings as b9, type ActorConn as bA, ActorConnRaw as bB, type ActorConnStatus as bC, type ActorConnectOptions as bD, type ActorGatewayOptions as bE, type ActorHandle as bF, ActorHandleRaw as bG, ClientRaw as bH, type ConnectionStateCallback as bI, type CreateOptions as bJ, type CreateRequest as bK, type EventUnsubscribe as bL, type ExtractActorsFromRegistry as bM, type ExtractRegistryFromClient as bN, type GetOptions as bO, type GetWithIdOptions as bP, type QueryOptions as bQ, type Region as bR, type StatusChangeCallback as bS, type WasmRuntimeConfig as ba, WasmRuntimeConfigSchema as bb, type WasmRuntimeInitInput as bc, type WorkflowInspectorConfig as bd, type WorkflowOutcome as be, type WorkflowSpan as bf, type WorkflowStepOutcome as bg, type WorkflowStepSpan as bh, actor as bi, buildActorNames as bj, createClientWithDriver as bk, defineRunHandler as bl, disposeRunInspector as bm, event as bn, getRunFunction as bo, getRunInspectorConfig as bp, getRunMetadata as bq, isStaticActorDefinition as br, isStaticActorInstance as bs, lookupInRegistry as bt, queue as bu, setup as bv, test as bw, type ActorAccessor as bx, type ActorActionFunction as by, type ActorActionOptions as bz, type BeforeConnectContext as c, type CreateConnStateContext as d, type CreateContext as e, type CreateVarsContext as f, type DisconnectContext as g, type RunContext as h, type StateChangeContext as i, type WebSocketContext as j, ACTOR_CONTEXT_INTERNAL_SYMBOL as k, type ActionInputSchemas as l, type ActionSampleRates as m, type ActionTraceSamplers as n, type Actions as o, type ActorConfig as p, type ActorConfigInput as q, ActorConfigSchema as r, type ActorContext as s, type ActorContextOf as t, type ActorCron as u, type ActorCronEveryOptions as v, type ActorCronSetOptions as w, ActorDefinition as x, type ActorInspectorConfig as y, ActorInspectorConfigSchema as z };
|