rivetkit 2.3.18-rc.4 → 2.3.19
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 +723 -616
- 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 +3 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +110 -3
- package/dist/tsup/agent-os/index.d.ts +110 -3
- package/dist/tsup/agent-os/index.js +3 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-ENDOWQTM.js → chunk-464WE4RF.js} +2 -2
- package/dist/tsup/{chunk-KKG2CTSI.js → chunk-4SC2NSAV.js} +2 -2
- package/dist/tsup/{chunk-R2WRP6VV.cjs → chunk-7A5EIXJJ.cjs} +7 -7
- package/dist/tsup/{chunk-R2WRP6VV.cjs.map → chunk-7A5EIXJJ.cjs.map} +1 -1
- package/dist/tsup/{chunk-GUVDWB2O.cjs → chunk-7BRRGBRY.cjs} +10 -10
- package/dist/tsup/{chunk-GUVDWB2O.cjs.map → chunk-7BRRGBRY.cjs.map} +1 -1
- package/dist/tsup/{chunk-KVPU65TI.js → chunk-7HTST3NX.js} +3 -3
- package/dist/tsup/{chunk-MS6C3B2I.js → chunk-BKX7UDTA.js} +185 -28
- package/dist/tsup/chunk-BKX7UDTA.js.map +1 -0
- package/dist/tsup/{chunk-FL2FDUSZ.js → chunk-DK3L22R6.js} +4 -4
- package/dist/tsup/{chunk-CAL23WOC.js → chunk-DN6MD3KK.js} +7 -7
- package/dist/tsup/chunk-DN6MD3KK.js.map +1 -0
- package/dist/tsup/{chunk-6W5VGLFT.js → chunk-EB77NZL4.js} +1 -1
- package/dist/tsup/chunk-EB77NZL4.js.map +1 -0
- package/dist/tsup/{chunk-4KGXFC6M.cjs → chunk-EO5UOXXY.cjs} +1 -1
- package/dist/tsup/chunk-EO5UOXXY.cjs.map +1 -0
- package/dist/tsup/{chunk-QFLG6UB4.cjs → chunk-G4U5L6AX.cjs} +3 -3
- package/dist/tsup/{chunk-QFLG6UB4.cjs.map → chunk-G4U5L6AX.cjs.map} +1 -1
- package/dist/tsup/{chunk-TGGF6SZN.cjs → chunk-IJUXBWH4.cjs} +351 -194
- package/dist/tsup/chunk-IJUXBWH4.cjs.map +1 -0
- package/dist/tsup/{chunk-2JSYYH6P.cjs → chunk-JX2ITWAV.cjs} +13 -2
- package/dist/tsup/chunk-JX2ITWAV.cjs.map +1 -0
- package/dist/tsup/{chunk-N3DJTMSZ.cjs → chunk-OGPFN6BT.cjs} +3 -3
- package/dist/tsup/{chunk-N3DJTMSZ.cjs.map → chunk-OGPFN6BT.cjs.map} +1 -1
- package/dist/tsup/{chunk-OUQUIBVW.js → chunk-P2OFXH4G.js} +12 -1
- package/dist/tsup/chunk-P2OFXH4G.js.map +1 -0
- package/dist/tsup/{chunk-F3IP3SGO.cjs → chunk-PPEIPCW4.cjs} +4 -4
- package/dist/tsup/{chunk-F3IP3SGO.cjs.map → chunk-PPEIPCW4.cjs.map} +1 -1
- package/dist/tsup/{chunk-7E2W2YSM.cjs → chunk-RJC5O2SD.cjs} +13 -13
- package/dist/tsup/chunk-RJC5O2SD.cjs.map +1 -0
- package/dist/tsup/{chunk-YQD6RRVP.js → chunk-WME6KOXW.js} +2 -2
- package/dist/tsup/{chunk-PLAJJOTE.js → chunk-X7RMJQGY.js} +2 -2
- package/dist/tsup/{chunk-4OMHYVOQ.cjs → chunk-Z4RAXFSD.cjs} +3 -3
- package/dist/tsup/{chunk-4OMHYVOQ.cjs.map → chunk-Z4RAXFSD.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-gvHwMas-.d.cts → config-8n2AOhXK.d.cts} +114 -10
- package/dist/tsup/{config-Ug5M2MOr.d.ts → config-DEm0yIVV.d.ts} +114 -10
- package/dist/tsup/{context-DererUCI.d.ts → context-DGg2-IOm.d.ts} +1 -1
- package/dist/tsup/{context-BSCBvbfM.d.cts → context-DwjOVvlE.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 +492 -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 +367 -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/config.ts +38 -0
- package/src/actor/errors.ts +31 -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 +277 -191
- package/src/registry/runtime.ts +66 -0
- package/src/registry/wasm-runtime.ts +40 -0
- package/src/workflow/driver.ts +20 -12
- 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-7E2W2YSM.cjs.map +0 -1
- package/dist/tsup/chunk-CAL23WOC.js.map +0 -1
- package/dist/tsup/chunk-MS6C3B2I.js.map +0 -1
- package/dist/tsup/chunk-OUQUIBVW.js.map +0 -1
- package/dist/tsup/chunk-TGGF6SZN.cjs.map +0 -1
- /package/dist/tsup/{chunk-ENDOWQTM.js.map → chunk-464WE4RF.js.map} +0 -0
- /package/dist/tsup/{chunk-KKG2CTSI.js.map → chunk-4SC2NSAV.js.map} +0 -0
- /package/dist/tsup/{chunk-KVPU65TI.js.map → chunk-7HTST3NX.js.map} +0 -0
- /package/dist/tsup/{chunk-FL2FDUSZ.js.map → chunk-DK3L22R6.js.map} +0 -0
- /package/dist/tsup/{chunk-YQD6RRVP.js.map → chunk-WME6KOXW.js.map} +0 -0
- /package/dist/tsup/{chunk-PLAJJOTE.js.map → chunk-X7RMJQGY.js.map} +0 -0
|
@@ -6,9 +6,9 @@ import { Logger } from 'pino';
|
|
|
6
6
|
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
7
7
|
import { WorkflowState } from './inspector/workflow.cjs';
|
|
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-CNFeS-Dk.cjs';
|
|
10
10
|
import { Context, Hono } from 'hono';
|
|
11
|
-
import { R as RivetError } from './utils-
|
|
11
|
+
import { R as RivetError } from './utils-DsoDinPz.cjs';
|
|
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;
|
|
@@ -877,6 +917,7 @@ interface CoreRuntime {
|
|
|
877
917
|
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
878
918
|
waitRegistryReady(registry: RegistryHandle): Promise<void>;
|
|
879
919
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
920
|
+
shutdownTelemetry?(): Promise<void>;
|
|
880
921
|
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
881
922
|
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
882
923
|
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
@@ -906,6 +947,31 @@ interface CoreRuntime {
|
|
|
906
947
|
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
907
948
|
actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
|
|
908
949
|
actorId(ctx: ActorContextHandle): string;
|
|
950
|
+
/**
|
|
951
|
+
* Runs one actor callback with `ctx` as the current invocation: operations
|
|
952
|
+
* on retained handles for the same actor resolve to it, and its Core span
|
|
953
|
+
* is the active OpenTelemetry span for the duration of `run`. Only actions,
|
|
954
|
+
* raw requests, and queue dispatch run this way; other callbacks have no
|
|
955
|
+
* invocation span.
|
|
956
|
+
*/
|
|
957
|
+
runWithActorInvocationContext<T>(ctx: ActorContextHandle, run: () => T): T;
|
|
958
|
+
/**
|
|
959
|
+
* Correlation of the invocation currently executing for this actor, or
|
|
960
|
+
* `undefined` outside an invocation or after it finished. A sampled-out
|
|
961
|
+
* invocation can still expose valid span context for propagation.
|
|
962
|
+
*/
|
|
963
|
+
actorInvocationTraceContext(ctx: ActorContextHandle): ActorInvocationTraceContext | undefined;
|
|
964
|
+
/**
|
|
965
|
+
* Opens the span covering one call this actor makes to another actor. See
|
|
966
|
+
* `StartCallSpan` for when this returns nothing.
|
|
967
|
+
*/
|
|
968
|
+
startCallSpan(ctx: ActorContextHandle, actorName: string, actionName: string): RuntimeOutboundCall | undefined;
|
|
969
|
+
/** Backs `ActorRun.startWorkflowSpan`. */
|
|
970
|
+
startWorkflowSpan(ctx: ActorContextHandle): Promise<WorkflowSpan>;
|
|
971
|
+
/** Backs `ActorRun.runOutsideWorkflowSpan`. */
|
|
972
|
+
runOutsideActorInvocationContext<T>(run: () => T): T;
|
|
973
|
+
/** Identity of the invocation the caller runs in, usable as a cache key. */
|
|
974
|
+
currentInvocationScope(): object | undefined;
|
|
909
975
|
actorName(ctx: ActorContextHandle): string;
|
|
910
976
|
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
911
977
|
actorRegion(ctx: ActorContextHandle): string;
|
|
@@ -1245,7 +1311,7 @@ declare class ActorConnRaw {
|
|
|
1245
1311
|
*
|
|
1246
1312
|
* @protected
|
|
1247
1313
|
*/
|
|
1248
|
-
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions);
|
|
1314
|
+
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, currentActorInvocation?: CurrentActorInvocation);
|
|
1249
1315
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1250
1316
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1251
1317
|
/**
|
|
@@ -1381,7 +1447,7 @@ declare class ActorHandleRaw {
|
|
|
1381
1447
|
*
|
|
1382
1448
|
* @protected
|
|
1383
1449
|
*/
|
|
1384
|
-
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal);
|
|
1450
|
+
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal, currentActorInvocation?: CurrentActorInvocation, startCallSpan?: StartCallSpan);
|
|
1385
1451
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1386
1452
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1387
1453
|
/**
|
|
@@ -1582,6 +1648,18 @@ interface Region {
|
|
|
1582
1648
|
}
|
|
1583
1649
|
declare const ACTOR_CONNS_SYMBOL: unique symbol;
|
|
1584
1650
|
declare const CREATE_ACTOR_CONN_PROXY: unique symbol;
|
|
1651
|
+
/** Options for constructing a raw actor client. */
|
|
1652
|
+
interface ClientRawOptions {
|
|
1653
|
+
encoding?: Encoding;
|
|
1654
|
+
gateway?: ActorGatewayOptions;
|
|
1655
|
+
}
|
|
1656
|
+
/** Runtime-supplied wiring for clients created inside an actor. Set only by the native runtime. */
|
|
1657
|
+
interface ActorClientRuntimeOptions {
|
|
1658
|
+
/** Supplies the calling actor's invocation so actor-to-actor clients propagate its trace and ray ID. */
|
|
1659
|
+
currentActorInvocation?: CurrentActorInvocation;
|
|
1660
|
+
/** Opens and finishes the Core span covering an actor-to-actor call. */
|
|
1661
|
+
startCallSpan?: StartCallSpan;
|
|
1662
|
+
}
|
|
1585
1663
|
/**
|
|
1586
1664
|
* Client for managing & connecting to actors.
|
|
1587
1665
|
*
|
|
@@ -1594,7 +1672,7 @@ declare class ClientRaw {
|
|
|
1594
1672
|
/**
|
|
1595
1673
|
* Creates an instance of Client.
|
|
1596
1674
|
*/
|
|
1597
|
-
constructor(driver: EngineControlClient,
|
|
1675
|
+
constructor(driver: EngineControlClient, options?: ClientRawOptions & ActorClientRuntimeOptions);
|
|
1598
1676
|
/**
|
|
1599
1677
|
* Gets a stateless handle to a actor by its ID.
|
|
1600
1678
|
*
|
|
@@ -1654,10 +1732,7 @@ type Client<A extends Registry<any>> = ClientRaw & {
|
|
|
1654
1732
|
[K in keyof ExtractActorsFromRegistry<A>]: ActorAccessor<ExtractActorsFromRegistry<A>[K]>;
|
|
1655
1733
|
};
|
|
1656
1734
|
type AnyClient = Client<Registry<any>>;
|
|
1657
|
-
declare function createClientWithDriver<A extends Registry<any>>(driver: EngineControlClient,
|
|
1658
|
-
encoding?: Encoding;
|
|
1659
|
-
gateway?: ActorGatewayOptions;
|
|
1660
|
-
}): Client<A>;
|
|
1735
|
+
declare function createClientWithDriver<A extends Registry<any>>(driver: EngineControlClient, options?: ClientRawOptions & ActorClientRuntimeOptions): Client<A>;
|
|
1661
1736
|
|
|
1662
1737
|
declare const DEFAULT_SLEEP_GRACE_PERIOD = 15000;
|
|
1663
1738
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
@@ -1918,6 +1993,28 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1918
1993
|
client<T = any>(): ActorClientFor<T>;
|
|
1919
1994
|
[key: string]: any;
|
|
1920
1995
|
}
|
|
1996
|
+
/** @experimental How one run of a workflow function ended. */
|
|
1997
|
+
type WorkflowOutcome = "completed" | "sleeping" | "evicted" | "failed" | "cancelled";
|
|
1998
|
+
/** @experimental How one workflow step attempt ended. `retry` will be tried again, `failed` will not. */
|
|
1999
|
+
type WorkflowStepOutcome = "ok" | "retry" | "failed";
|
|
2000
|
+
/** @experimental One open run of a workflow function, traced as its own invocation. */
|
|
2001
|
+
interface WorkflowSpan {
|
|
2002
|
+
/** Runs `body` attributed to this run. */
|
|
2003
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
2004
|
+
/**
|
|
2005
|
+
* Called by a workflow engine before each attempt at a step. Returns
|
|
2006
|
+
* nothing when tracing is off.
|
|
2007
|
+
*/
|
|
2008
|
+
startStep(name: string, attempt: number): WorkflowStepSpan | undefined;
|
|
2009
|
+
finish(outcome: WorkflowOutcome): Promise<void>;
|
|
2010
|
+
}
|
|
2011
|
+
/** @experimental One open attempt at one workflow step. */
|
|
2012
|
+
interface WorkflowStepSpan {
|
|
2013
|
+
/** Runs `body` attributed to this attempt. */
|
|
2014
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
2015
|
+
/** `error` is what the step callback threw. */
|
|
2016
|
+
finish(outcome: WorkflowStepOutcome, error?: unknown): void;
|
|
2017
|
+
}
|
|
1921
2018
|
/** @experimental */
|
|
1922
2019
|
interface ActorRun {
|
|
1923
2020
|
/**
|
|
@@ -1925,6 +2022,13 @@ interface ActorRun {
|
|
|
1925
2022
|
* ensures this actor's run handler is active, starting it if inactive.
|
|
1926
2023
|
*/
|
|
1927
2024
|
setWakeAt(timestamp: number | null): Promise<void>;
|
|
2025
|
+
/** @experimental Called by a workflow engine each time it runs the workflow function. */
|
|
2026
|
+
startWorkflowSpan(): Promise<WorkflowSpan>;
|
|
2027
|
+
/**
|
|
2028
|
+
* @experimental Runs `body` outside the current workflow run, so a workflow
|
|
2029
|
+
* engine's own history storage stays out of the trace.
|
|
2030
|
+
*/
|
|
2031
|
+
runOutsideWorkflowSpan<T>(body: () => T): T;
|
|
1928
2032
|
}
|
|
1929
2033
|
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
2034
|
conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
@@ -2548,4 +2652,4 @@ declare const DocActorConfigSchema: z.ZodObject<{
|
|
|
2548
2652
|
}, z.core.$strip>>;
|
|
2549
2653
|
}, z.core.$strip>;
|
|
2550
2654
|
|
|
2551
|
-
export { type BaseActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorLogger as F, type ActorOptions as G, type ActorOptionsInput as H, ActorOptionsSchema as I, type ActorQuery as J, type ActorQueue as K, type ActorRun as L, type MigrateContext as M, type ActorSchedule as N, type ActorTypes as O, ActorsSchema as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type AnyActorInstance as T, type AnyClient as U, type AnyConn as V, type WakeContext as W, type AnyStaticActorDefinition as X, type AnyStaticActorInstance as Y, type AuthIntent as Z, BUILTIN_INSPECTOR_TAB_IDS as _, type ActionContext as a, type SqliteBackend as a$, BuiltinInspectorTabIdSchema as a0, CONN_DRIVER_SYMBOL as a1, CONN_STATE_MANAGER_SYMBOL as a2, type Client as a3, type Conn as a4, type CronFire as a5, type CronJobInfo as a6, CustomInspectorTabEntrySchema as a7, DEFAULT_SLEEP_GRACE_PERIOD as a8, type DefineRunHandlerOptions as a9, type QueueResultMessageForName as aA, type QueueTryNextBatchOptions as aB, type QueueTryNextOptions as aC, type QueueWaitOptions as aD, RAW_STATE_SYMBOL as aE, Registry as aF, type RegistryActors as aG, type RegistryApplication as aH, type RegistryConfig as aI, type RegistryConfigInput as aJ, RegistryConfigSchema as aK, type RegistryDeps as aL, type RegistryListenOptions as aM, type RegistryRoutes as aN, type RunConfig as aO, RunConfigSchema as aP, type RunControl as aQ, type RunInspectorConfig as aR, type RunInspectorFactoryContext as aS, type RunInspectorFactoryResult as aT, type RunInspectorKind as aU, type RunWithInactiveOptions as aV, type RuntimeKind as aW, RuntimeKindSchema as aX, type ScheduledEventInfo as aY, type ScheduledFireInfo as aZ, type ServerlessHandler as a_, DocActorConfigSchema as aa, DocActorOptionsSchema as ab, DocConfigurePoolSchema as ac, DocEnvoyConfigSchema as ad, DocRegistryConfigSchema as ae, DocServerlessConfigSchema as af, DocSqliteConfigSchema as ag, type FetchHandler as ah, type GlobalActorOptions as ai, type GlobalActorOptionsInput as aj, GlobalActorOptionsSchema as ak, HideInspectorTabEntrySchema as al, type InferEventArgs as am, type InferSchemaMap as an, InspectorTabEntrySchema as ao, type InspectorUnsubscribe as ap, type InstanceActorOptions as aq, type InstanceActorOptionsInput as ar, InstanceActorOptionsSchema as as, type QueueEnqueueAndWaitOptions as at, type QueueFilterName as au, type QueueIterOptions as av, type QueueMessageOf as aw, type QueueName as ax, type QueueNextBatchOptions as ay, type QueueNextOptions as az, type BeforeActionResponseContext as b, SqliteBackendSchema as b0, type SqliteConfig as b1, SqliteConfigSchema as b2, type TestConfig as b3, TestConfigSchema as b4, type Type as b5, type WasmRuntimeBindings as b6, type WasmRuntimeConfig as b7, WasmRuntimeConfigSchema as b8, type WasmRuntimeInitInput as b9,
|
|
2655
|
+
export { type BaseActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorLogger as F, type ActorOptions as G, type ActorOptionsInput as H, ActorOptionsSchema as I, type ActorQuery as J, type ActorQueue as K, type ActorRun as L, type MigrateContext as M, type ActorSchedule as N, type ActorTypes as O, ActorsSchema as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type AnyActorInstance as T, type AnyClient as U, type AnyConn as V, type WakeContext as W, type AnyStaticActorDefinition as X, type AnyStaticActorInstance as Y, type AuthIntent as Z, BUILTIN_INSPECTOR_TAB_IDS as _, type ActionContext as a, type SqliteBackend as a$, BuiltinInspectorTabIdSchema as a0, CONN_DRIVER_SYMBOL as a1, CONN_STATE_MANAGER_SYMBOL as a2, type Client as a3, type Conn as a4, type CronFire as a5, type CronJobInfo as a6, CustomInspectorTabEntrySchema as a7, DEFAULT_SLEEP_GRACE_PERIOD as a8, type DefineRunHandlerOptions as a9, type QueueResultMessageForName as aA, type QueueTryNextBatchOptions as aB, type QueueTryNextOptions as aC, type QueueWaitOptions as aD, RAW_STATE_SYMBOL as aE, Registry as aF, type RegistryActors as aG, type RegistryApplication as aH, type RegistryConfig as aI, type RegistryConfigInput as aJ, RegistryConfigSchema as aK, type RegistryDeps as aL, type RegistryListenOptions as aM, type RegistryRoutes as aN, type RunConfig as aO, RunConfigSchema as aP, type RunControl as aQ, type RunInspectorConfig as aR, type RunInspectorFactoryContext as aS, type RunInspectorFactoryResult as aT, type RunInspectorKind as aU, type RunWithInactiveOptions as aV, type RuntimeKind as aW, RuntimeKindSchema as aX, type ScheduledEventInfo as aY, type ScheduledFireInfo as aZ, type ServerlessHandler as a_, DocActorConfigSchema as aa, DocActorOptionsSchema as ab, DocConfigurePoolSchema as ac, DocEnvoyConfigSchema as ad, DocRegistryConfigSchema as ae, DocServerlessConfigSchema as af, DocSqliteConfigSchema as ag, type FetchHandler as ah, type GlobalActorOptions as ai, type GlobalActorOptionsInput as aj, GlobalActorOptionsSchema as ak, HideInspectorTabEntrySchema as al, type InferEventArgs as am, type InferSchemaMap as an, InspectorTabEntrySchema as ao, type InspectorUnsubscribe as ap, type InstanceActorOptions as aq, type InstanceActorOptionsInput as ar, InstanceActorOptionsSchema as as, type QueueEnqueueAndWaitOptions as at, type QueueFilterName as au, type QueueIterOptions as av, type QueueMessageOf as aw, type QueueName as ax, type QueueNextBatchOptions as ay, type QueueNextOptions as az, type BeforeActionResponseContext as b, SqliteBackendSchema as b0, type SqliteConfig as b1, SqliteConfigSchema as b2, type TestConfig as b3, TestConfigSchema as b4, type Type as b5, type WasmRuntimeBindings as b6, type WasmRuntimeConfig as b7, WasmRuntimeConfigSchema as b8, type WasmRuntimeInitInput as b9, type ActorConnectOptions as bA, type ActorGatewayOptions as bB, type ActorHandle as bC, ActorHandleRaw as bD, ClientRaw as bE, type ConnectionStateCallback as bF, type CreateOptions as bG, type CreateRequest as bH, type EventUnsubscribe as bI, type ExtractActorsFromRegistry as bJ, type ExtractRegistryFromClient as bK, type GetOptions as bL, type GetWithIdOptions as bM, type QueryOptions as bN, type Region as bO, type StatusChangeCallback as bP, type WorkflowInspectorConfig as ba, type WorkflowOutcome as bb, type WorkflowSpan as bc, type WorkflowStepOutcome as bd, type WorkflowStepSpan as be, actor as bf, buildActorNames as bg, createClientWithDriver as bh, defineRunHandler as bi, disposeRunInspector as bj, event as bk, getRunFunction as bl, getRunInspectorConfig as bm, getRunMetadata as bn, isStaticActorDefinition as bo, isStaticActorInstance as bp, lookupInRegistry as bq, queue as br, setup as bs, test as bt, type ActorAccessor as bu, type ActorActionFunction as bv, type ActorActionOptions as bw, type ActorConn as bx, ActorConnRaw as by, type ActorConnStatus 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 Actions as m, type ActorConfig as n, type ActorConfigInput as o, ActorConfigSchema as p, type ActorContext as q, type ActorContextOf as r, type ActorCron as s, type ActorCronEveryOptions as t, type ActorCronSetOptions as u, ActorDefinition as v, type ActorInspectorConfig as w, ActorInspectorConfigSchema as x, type ActorKey as y, type ActorKv as z };
|
|
@@ -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;
|
|
@@ -877,6 +917,7 @@ interface CoreRuntime {
|
|
|
877
917
|
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
878
918
|
waitRegistryReady(registry: RegistryHandle): Promise<void>;
|
|
879
919
|
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
920
|
+
shutdownTelemetry?(): Promise<void>;
|
|
880
921
|
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
881
922
|
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
882
923
|
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
@@ -906,6 +947,31 @@ interface CoreRuntime {
|
|
|
906
947
|
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
907
948
|
actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
|
|
908
949
|
actorId(ctx: ActorContextHandle): string;
|
|
950
|
+
/**
|
|
951
|
+
* Runs one actor callback with `ctx` as the current invocation: operations
|
|
952
|
+
* on retained handles for the same actor resolve to it, and its Core span
|
|
953
|
+
* is the active OpenTelemetry span for the duration of `run`. Only actions,
|
|
954
|
+
* raw requests, and queue dispatch run this way; other callbacks have no
|
|
955
|
+
* invocation span.
|
|
956
|
+
*/
|
|
957
|
+
runWithActorInvocationContext<T>(ctx: ActorContextHandle, run: () => T): T;
|
|
958
|
+
/**
|
|
959
|
+
* Correlation of the invocation currently executing for this actor, or
|
|
960
|
+
* `undefined` outside an invocation or after it finished. A sampled-out
|
|
961
|
+
* invocation can still expose valid span context for propagation.
|
|
962
|
+
*/
|
|
963
|
+
actorInvocationTraceContext(ctx: ActorContextHandle): ActorInvocationTraceContext | undefined;
|
|
964
|
+
/**
|
|
965
|
+
* Opens the span covering one call this actor makes to another actor. See
|
|
966
|
+
* `StartCallSpan` for when this returns nothing.
|
|
967
|
+
*/
|
|
968
|
+
startCallSpan(ctx: ActorContextHandle, actorName: string, actionName: string): RuntimeOutboundCall | undefined;
|
|
969
|
+
/** Backs `ActorRun.startWorkflowSpan`. */
|
|
970
|
+
startWorkflowSpan(ctx: ActorContextHandle): Promise<WorkflowSpan>;
|
|
971
|
+
/** Backs `ActorRun.runOutsideWorkflowSpan`. */
|
|
972
|
+
runOutsideActorInvocationContext<T>(run: () => T): T;
|
|
973
|
+
/** Identity of the invocation the caller runs in, usable as a cache key. */
|
|
974
|
+
currentInvocationScope(): object | undefined;
|
|
909
975
|
actorName(ctx: ActorContextHandle): string;
|
|
910
976
|
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
911
977
|
actorRegion(ctx: ActorContextHandle): string;
|
|
@@ -1245,7 +1311,7 @@ declare class ActorConnRaw {
|
|
|
1245
1311
|
*
|
|
1246
1312
|
* @protected
|
|
1247
1313
|
*/
|
|
1248
|
-
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions);
|
|
1314
|
+
constructor(client: ClientRaw, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, currentActorInvocation?: CurrentActorInvocation);
|
|
1249
1315
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1250
1316
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1251
1317
|
/**
|
|
@@ -1381,7 +1447,7 @@ declare class ActorHandleRaw {
|
|
|
1381
1447
|
*
|
|
1382
1448
|
* @protected
|
|
1383
1449
|
*/
|
|
1384
|
-
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal);
|
|
1450
|
+
constructor(client: any, driver: EngineControlClient, params: unknown, getParams: (() => Promise<unknown>) | undefined, encoding: Encoding, actorResolutionState: ActorResolutionState, gatewayOptions?: ActorGatewayOptions, signal?: AbortSignal, currentActorInvocation?: CurrentActorInvocation, startCallSpan?: StartCallSpan);
|
|
1385
1451
|
send(name: string, body: unknown, options: QueueSendWaitOptions): Promise<QueueSendResult>;
|
|
1386
1452
|
send(name: string, body: unknown, options?: QueueSendNoWaitOptions): Promise<void>;
|
|
1387
1453
|
/**
|
|
@@ -1582,6 +1648,18 @@ interface Region {
|
|
|
1582
1648
|
}
|
|
1583
1649
|
declare const ACTOR_CONNS_SYMBOL: unique symbol;
|
|
1584
1650
|
declare const CREATE_ACTOR_CONN_PROXY: unique symbol;
|
|
1651
|
+
/** Options for constructing a raw actor client. */
|
|
1652
|
+
interface ClientRawOptions {
|
|
1653
|
+
encoding?: Encoding;
|
|
1654
|
+
gateway?: ActorGatewayOptions;
|
|
1655
|
+
}
|
|
1656
|
+
/** Runtime-supplied wiring for clients created inside an actor. Set only by the native runtime. */
|
|
1657
|
+
interface ActorClientRuntimeOptions {
|
|
1658
|
+
/** Supplies the calling actor's invocation so actor-to-actor clients propagate its trace and ray ID. */
|
|
1659
|
+
currentActorInvocation?: CurrentActorInvocation;
|
|
1660
|
+
/** Opens and finishes the Core span covering an actor-to-actor call. */
|
|
1661
|
+
startCallSpan?: StartCallSpan;
|
|
1662
|
+
}
|
|
1585
1663
|
/**
|
|
1586
1664
|
* Client for managing & connecting to actors.
|
|
1587
1665
|
*
|
|
@@ -1594,7 +1672,7 @@ declare class ClientRaw {
|
|
|
1594
1672
|
/**
|
|
1595
1673
|
* Creates an instance of Client.
|
|
1596
1674
|
*/
|
|
1597
|
-
constructor(driver: EngineControlClient,
|
|
1675
|
+
constructor(driver: EngineControlClient, options?: ClientRawOptions & ActorClientRuntimeOptions);
|
|
1598
1676
|
/**
|
|
1599
1677
|
* Gets a stateless handle to a actor by its ID.
|
|
1600
1678
|
*
|
|
@@ -1654,10 +1732,7 @@ type Client<A extends Registry<any>> = ClientRaw & {
|
|
|
1654
1732
|
[K in keyof ExtractActorsFromRegistry<A>]: ActorAccessor<ExtractActorsFromRegistry<A>[K]>;
|
|
1655
1733
|
};
|
|
1656
1734
|
type AnyClient = Client<Registry<any>>;
|
|
1657
|
-
declare function createClientWithDriver<A extends Registry<any>>(driver: EngineControlClient,
|
|
1658
|
-
encoding?: Encoding;
|
|
1659
|
-
gateway?: ActorGatewayOptions;
|
|
1660
|
-
}): Client<A>;
|
|
1735
|
+
declare function createClientWithDriver<A extends Registry<any>>(driver: EngineControlClient, options?: ClientRawOptions & ActorClientRuntimeOptions): Client<A>;
|
|
1661
1736
|
|
|
1662
1737
|
declare const DEFAULT_SLEEP_GRACE_PERIOD = 15000;
|
|
1663
1738
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
@@ -1918,6 +1993,28 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1918
1993
|
client<T = any>(): ActorClientFor<T>;
|
|
1919
1994
|
[key: string]: any;
|
|
1920
1995
|
}
|
|
1996
|
+
/** @experimental How one run of a workflow function ended. */
|
|
1997
|
+
type WorkflowOutcome = "completed" | "sleeping" | "evicted" | "failed" | "cancelled";
|
|
1998
|
+
/** @experimental How one workflow step attempt ended. `retry` will be tried again, `failed` will not. */
|
|
1999
|
+
type WorkflowStepOutcome = "ok" | "retry" | "failed";
|
|
2000
|
+
/** @experimental One open run of a workflow function, traced as its own invocation. */
|
|
2001
|
+
interface WorkflowSpan {
|
|
2002
|
+
/** Runs `body` attributed to this run. */
|
|
2003
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
2004
|
+
/**
|
|
2005
|
+
* Called by a workflow engine before each attempt at a step. Returns
|
|
2006
|
+
* nothing when tracing is off.
|
|
2007
|
+
*/
|
|
2008
|
+
startStep(name: string, attempt: number): WorkflowStepSpan | undefined;
|
|
2009
|
+
finish(outcome: WorkflowOutcome): Promise<void>;
|
|
2010
|
+
}
|
|
2011
|
+
/** @experimental One open attempt at one workflow step. */
|
|
2012
|
+
interface WorkflowStepSpan {
|
|
2013
|
+
/** Runs `body` attributed to this attempt. */
|
|
2014
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
2015
|
+
/** `error` is what the step callback threw. */
|
|
2016
|
+
finish(outcome: WorkflowStepOutcome, error?: unknown): void;
|
|
2017
|
+
}
|
|
1921
2018
|
/** @experimental */
|
|
1922
2019
|
interface ActorRun {
|
|
1923
2020
|
/**
|
|
@@ -1925,6 +2022,13 @@ interface ActorRun {
|
|
|
1925
2022
|
* ensures this actor's run handler is active, starting it if inactive.
|
|
1926
2023
|
*/
|
|
1927
2024
|
setWakeAt(timestamp: number | null): Promise<void>;
|
|
2025
|
+
/** @experimental Called by a workflow engine each time it runs the workflow function. */
|
|
2026
|
+
startWorkflowSpan(): Promise<WorkflowSpan>;
|
|
2027
|
+
/**
|
|
2028
|
+
* @experimental Runs `body` outside the current workflow run, so a workflow
|
|
2029
|
+
* engine's own history storage stays out of the trace.
|
|
2030
|
+
*/
|
|
2031
|
+
runOutsideWorkflowSpan<T>(body: () => T): T;
|
|
1928
2032
|
}
|
|
1929
2033
|
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
2034
|
conn: Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>;
|
|
@@ -2548,4 +2652,4 @@ declare const DocActorConfigSchema: z.ZodObject<{
|
|
|
2548
2652
|
}, z.core.$strip>>;
|
|
2549
2653
|
}, z.core.$strip>;
|
|
2550
2654
|
|
|
2551
|
-
export { type BaseActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorLogger as F, type ActorOptions as G, type ActorOptionsInput as H, ActorOptionsSchema as I, type ActorQuery as J, type ActorQueue as K, type ActorRun as L, type MigrateContext as M, type ActorSchedule as N, type ActorTypes as O, ActorsSchema as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type AnyActorInstance as T, type AnyClient as U, type AnyConn as V, type WakeContext as W, type AnyStaticActorDefinition as X, type AnyStaticActorInstance as Y, type AuthIntent as Z, BUILTIN_INSPECTOR_TAB_IDS as _, type ActionContext as a, type SqliteBackend as a$, BuiltinInspectorTabIdSchema as a0, CONN_DRIVER_SYMBOL as a1, CONN_STATE_MANAGER_SYMBOL as a2, type Client as a3, type Conn as a4, type CronFire as a5, type CronJobInfo as a6, CustomInspectorTabEntrySchema as a7, DEFAULT_SLEEP_GRACE_PERIOD as a8, type DefineRunHandlerOptions as a9, type QueueResultMessageForName as aA, type QueueTryNextBatchOptions as aB, type QueueTryNextOptions as aC, type QueueWaitOptions as aD, RAW_STATE_SYMBOL as aE, Registry as aF, type RegistryActors as aG, type RegistryApplication as aH, type RegistryConfig as aI, type RegistryConfigInput as aJ, RegistryConfigSchema as aK, type RegistryDeps as aL, type RegistryListenOptions as aM, type RegistryRoutes as aN, type RunConfig as aO, RunConfigSchema as aP, type RunControl as aQ, type RunInspectorConfig as aR, type RunInspectorFactoryContext as aS, type RunInspectorFactoryResult as aT, type RunInspectorKind as aU, type RunWithInactiveOptions as aV, type RuntimeKind as aW, RuntimeKindSchema as aX, type ScheduledEventInfo as aY, type ScheduledFireInfo as aZ, type ServerlessHandler as a_, DocActorConfigSchema as aa, DocActorOptionsSchema as ab, DocConfigurePoolSchema as ac, DocEnvoyConfigSchema as ad, DocRegistryConfigSchema as ae, DocServerlessConfigSchema as af, DocSqliteConfigSchema as ag, type FetchHandler as ah, type GlobalActorOptions as ai, type GlobalActorOptionsInput as aj, GlobalActorOptionsSchema as ak, HideInspectorTabEntrySchema as al, type InferEventArgs as am, type InferSchemaMap as an, InspectorTabEntrySchema as ao, type InspectorUnsubscribe as ap, type InstanceActorOptions as aq, type InstanceActorOptionsInput as ar, InstanceActorOptionsSchema as as, type QueueEnqueueAndWaitOptions as at, type QueueFilterName as au, type QueueIterOptions as av, type QueueMessageOf as aw, type QueueName as ax, type QueueNextBatchOptions as ay, type QueueNextOptions as az, type BeforeActionResponseContext as b, SqliteBackendSchema as b0, type SqliteConfig as b1, SqliteConfigSchema as b2, type TestConfig as b3, TestConfigSchema as b4, type Type as b5, type WasmRuntimeBindings as b6, type WasmRuntimeConfig as b7, WasmRuntimeConfigSchema as b8, type WasmRuntimeInitInput as b9,
|
|
2655
|
+
export { type BaseActorInstance as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorLogger as F, type ActorOptions as G, type ActorOptionsInput as H, ActorOptionsSchema as I, type ActorQuery as J, type ActorQueue as K, type ActorRun as L, type MigrateContext as M, type ActorSchedule as N, type ActorTypes as O, ActorsSchema as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type AnyActorInstance as T, type AnyClient as U, type AnyConn as V, type WakeContext as W, type AnyStaticActorDefinition as X, type AnyStaticActorInstance as Y, type AuthIntent as Z, BUILTIN_INSPECTOR_TAB_IDS as _, type ActionContext as a, type SqliteBackend as a$, BuiltinInspectorTabIdSchema as a0, CONN_DRIVER_SYMBOL as a1, CONN_STATE_MANAGER_SYMBOL as a2, type Client as a3, type Conn as a4, type CronFire as a5, type CronJobInfo as a6, CustomInspectorTabEntrySchema as a7, DEFAULT_SLEEP_GRACE_PERIOD as a8, type DefineRunHandlerOptions as a9, type QueueResultMessageForName as aA, type QueueTryNextBatchOptions as aB, type QueueTryNextOptions as aC, type QueueWaitOptions as aD, RAW_STATE_SYMBOL as aE, Registry as aF, type RegistryActors as aG, type RegistryApplication as aH, type RegistryConfig as aI, type RegistryConfigInput as aJ, RegistryConfigSchema as aK, type RegistryDeps as aL, type RegistryListenOptions as aM, type RegistryRoutes as aN, type RunConfig as aO, RunConfigSchema as aP, type RunControl as aQ, type RunInspectorConfig as aR, type RunInspectorFactoryContext as aS, type RunInspectorFactoryResult as aT, type RunInspectorKind as aU, type RunWithInactiveOptions as aV, type RuntimeKind as aW, RuntimeKindSchema as aX, type ScheduledEventInfo as aY, type ScheduledFireInfo as aZ, type ServerlessHandler as a_, DocActorConfigSchema as aa, DocActorOptionsSchema as ab, DocConfigurePoolSchema as ac, DocEnvoyConfigSchema as ad, DocRegistryConfigSchema as ae, DocServerlessConfigSchema as af, DocSqliteConfigSchema as ag, type FetchHandler as ah, type GlobalActorOptions as ai, type GlobalActorOptionsInput as aj, GlobalActorOptionsSchema as ak, HideInspectorTabEntrySchema as al, type InferEventArgs as am, type InferSchemaMap as an, InspectorTabEntrySchema as ao, type InspectorUnsubscribe as ap, type InstanceActorOptions as aq, type InstanceActorOptionsInput as ar, InstanceActorOptionsSchema as as, type QueueEnqueueAndWaitOptions as at, type QueueFilterName as au, type QueueIterOptions as av, type QueueMessageOf as aw, type QueueName as ax, type QueueNextBatchOptions as ay, type QueueNextOptions as az, type BeforeActionResponseContext as b, SqliteBackendSchema as b0, type SqliteConfig as b1, SqliteConfigSchema as b2, type TestConfig as b3, TestConfigSchema as b4, type Type as b5, type WasmRuntimeBindings as b6, type WasmRuntimeConfig as b7, WasmRuntimeConfigSchema as b8, type WasmRuntimeInitInput as b9, type ActorConnectOptions as bA, type ActorGatewayOptions as bB, type ActorHandle as bC, ActorHandleRaw as bD, ClientRaw as bE, type ConnectionStateCallback as bF, type CreateOptions as bG, type CreateRequest as bH, type EventUnsubscribe as bI, type ExtractActorsFromRegistry as bJ, type ExtractRegistryFromClient as bK, type GetOptions as bL, type GetWithIdOptions as bM, type QueryOptions as bN, type Region as bO, type StatusChangeCallback as bP, type WorkflowInspectorConfig as ba, type WorkflowOutcome as bb, type WorkflowSpan as bc, type WorkflowStepOutcome as bd, type WorkflowStepSpan as be, actor as bf, buildActorNames as bg, createClientWithDriver as bh, defineRunHandler as bi, disposeRunInspector as bj, event as bk, getRunFunction as bl, getRunInspectorConfig as bm, getRunMetadata as bn, isStaticActorDefinition as bo, isStaticActorInstance as bp, lookupInRegistry as bq, queue as br, setup as bs, test as bt, type ActorAccessor as bu, type ActorActionFunction as bv, type ActorActionOptions as bw, type ActorConn as bx, ActorConnRaw as by, type ActorConnStatus 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 Actions as m, type ActorConfig as n, type ActorConfigInput as o, ActorConfigSchema as p, type ActorContext as q, type ActorContextOf as r, type ActorCron as s, type ActorCronEveryOptions as t, type ActorCronSetOptions as u, ActorDefinition as v, type ActorInspectorConfig as w, ActorInspectorConfigSchema as x, type ActorKey as y, type ActorKv as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger, au as QueueFilterName, az as QueueNextOptions, aA as QueueResultMessageForName, ay as QueueNextBatchOptions, aF as Registry, a3 as Client, am as InferEventArgs, an as InferSchemaMap } from './config-
|
|
1
|
+
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger, au as QueueFilterName, az as QueueNextOptions, aA as QueueResultMessageForName, ay as QueueNextBatchOptions, aF as Registry, a3 as Client, am as InferEventArgs, an as InferSchemaMap } from './config-DEm0yIVV.js';
|
|
2
2
|
import { WorkflowContextInterface, StepConfig, TryStepResult, TryStepConfig, TryBlockResult, TryBlockConfig, LoopResult, LoopConfig, BranchConfig, BranchOutput, EntryKindType } from '@rivetkit/workflow-engine';
|
|
3
3
|
import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-ey2I2zz5.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger, au as QueueFilterName, az as QueueNextOptions, aA as QueueResultMessageForName, ay as QueueNextBatchOptions, aF as Registry, a3 as Client, am as InferEventArgs, an as InferSchemaMap } from './config-
|
|
1
|
+
import { A as AnyActorDefinition, B as BaseActorDefinition, E as EventSchemaConfig, Q as QueueSchemaConfig, h as RunContext, F as ActorLogger, au as QueueFilterName, az as QueueNextOptions, aA as QueueResultMessageForName, ay as QueueNextBatchOptions, aF as Registry, a3 as Client, am as InferEventArgs, an as InferSchemaMap } from './config-8n2AOhXK.cjs';
|
|
2
2
|
import { WorkflowContextInterface, StepConfig, TryStepResult, TryStepConfig, TryBlockResult, TryBlockConfig, LoopResult, LoopConfig, BranchConfig, BranchOutput, EntryKindType } from '@rivetkit/workflow-engine';
|
|
3
3
|
import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-ey2I2zz5.cjs';
|
|
4
4
|
|
package/dist/tsup/db/drizzle.cjs
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
var _chunkKVFIONKQcjs = require('../chunk-KVFIONKQ.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
11
|
-
require('../chunk-
|
|
10
|
+
var _chunkRJC5O2SDcjs = require('../chunk-RJC5O2SD.cjs');
|
|
11
|
+
require('../chunk-JX2ITWAV.cjs');
|
|
12
12
|
|
|
13
13
|
// src/db/drizzle.ts
|
|
14
14
|
|
|
@@ -164,7 +164,7 @@ function db({
|
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
166
|
manualTransactionWarned = true;
|
|
167
|
-
|
|
167
|
+
_chunkRJC5O2SDcjs.getLogger.call(void 0, "database").warn(
|
|
168
168
|
{ actorId: ctx.actorId },
|
|
169
169
|
"Manual cross-call SQLite transactions can interleave with other actor work. Use db.transaction() for coordinated transactions. Set warnOnManualTransactions: false in your db(...) configuration to disable this warning."
|
|
170
170
|
);
|
package/dist/tsup/db/drizzle.js
CHANGED
package/dist/tsup/db/mod.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZ4RAXFSDcjs = require('../chunk-Z4RAXFSD.cjs');
|
|
4
4
|
require('../chunk-KVFIONKQ.cjs');
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-RJC5O2SD.cjs');
|
|
6
|
+
require('../chunk-JX2ITWAV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.db =
|
|
9
|
+
exports.db = _chunkZ4RAXFSDcjs.db;
|
|
10
10
|
//# sourceMappingURL=mod.cjs.map
|
package/dist/tsup/db/mod.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
db
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WME6KOXW.js";
|
|
4
4
|
import "../chunk-JTHHCZCZ.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-DN6MD3KK.js";
|
|
6
|
+
import "../chunk-P2OFXH4G.js";
|
|
7
7
|
export {
|
|
8
8
|
db
|
|
9
9
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkEO5UOXXYcjs = require('../chunk-EO5UOXXY.cjs');
|
|
4
4
|
|
|
5
5
|
// src/dynamic/internal.ts
|
|
6
6
|
var DYNAMIC_ACTOR_DEFINITION_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
@@ -9,7 +9,7 @@ var DYNAMIC_ACTOR_DEFINITION_SYMBOL = /* @__PURE__ */ Symbol.for(
|
|
|
9
9
|
|
|
10
10
|
// src/dynamic/mod.ts
|
|
11
11
|
function dynamicActor(input) {
|
|
12
|
-
const config =
|
|
12
|
+
const config = _chunkEO5UOXXYcjs.ActorConfigSchema.parse({
|
|
13
13
|
actions: {}
|
|
14
14
|
});
|
|
15
15
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AnyActorDefinition } from '../config-
|
|
1
|
+
import { A as AnyActorDefinition } from '../config-8n2AOhXK.cjs';
|
|
2
2
|
import 'zod/v4';
|
|
3
3
|
import '../config-ey2I2zz5.cjs';
|
|
4
4
|
import '@rivetkit/rivetkit-wasm';
|
|
@@ -7,9 +7,9 @@ import 'pino';
|
|
|
7
7
|
import '@rivetkit/virtual-websocket';
|
|
8
8
|
import '../inspector/workflow.cjs';
|
|
9
9
|
import '@standard-schema/spec';
|
|
10
|
-
import '../utils-
|
|
10
|
+
import '../utils-CNFeS-Dk.cjs';
|
|
11
11
|
import 'hono';
|
|
12
|
-
import '../utils-
|
|
12
|
+
import '../utils-DsoDinPz.cjs';
|
|
13
13
|
import 'hono/utils/http-status';
|
|
14
14
|
|
|
15
15
|
declare const DYNAMIC_ACTOR_DEFINITION_SYMBOL: unique symbol;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as AnyActorDefinition } from '../config-
|
|
1
|
+
import { A as AnyActorDefinition } from '../config-DEm0yIVV.js';
|
|
2
2
|
import 'zod/v4';
|
|
3
3
|
import '../config-ey2I2zz5.js';
|
|
4
4
|
import '@rivetkit/rivetkit-wasm';
|
|
@@ -7,9 +7,9 @@ import 'pino';
|
|
|
7
7
|
import '@rivetkit/virtual-websocket';
|
|
8
8
|
import '../inspector/workflow.js';
|
|
9
9
|
import '@standard-schema/spec';
|
|
10
|
-
import '../utils-
|
|
10
|
+
import '../utils-OQHBjfcM.js';
|
|
11
11
|
import 'hono';
|
|
12
|
-
import '../utils-
|
|
12
|
+
import '../utils-DsoDinPz.js';
|
|
13
13
|
import 'hono/utils/http-status';
|
|
14
14
|
|
|
15
15
|
declare const DYNAMIC_ACTOR_DEFINITION_SYMBOL: unique symbol;
|