rivetkit 0.0.0-sqlite-profiling-compat.4a9a623 → 0.0.0-sqlite-sync-3x-release.a00b07f
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 +1317 -765
- package/dist/browser/client.js +1457 -737
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +252 -129
- package/dist/browser/inspector/client.js +2042 -228
- 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 -2367
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +1 -2277
- package/dist/tsup/agent-os/index.d.ts +1 -2277
- package/dist/tsup/agent-os/index.js +3 -2367
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-7QKCGUTJ.cjs → chunk-2MOLY6AM.cjs} +444 -29
- package/dist/tsup/chunk-2MOLY6AM.cjs.map +1 -0
- package/dist/tsup/{chunk-IICIOTML.js → chunk-3DONDAMG.js} +2 -2
- package/dist/tsup/{chunk-XIX5DOZN.js → chunk-6FEYCVZC.js} +196 -20
- package/dist/tsup/chunk-6FEYCVZC.js.map +1 -0
- package/dist/tsup/chunk-6KXVLIXL.cjs +14 -0
- package/dist/tsup/chunk-6KXVLIXL.cjs.map +1 -0
- package/dist/tsup/chunk-73RNTXHB.cjs +243 -0
- package/dist/tsup/chunk-73RNTXHB.cjs.map +1 -0
- package/dist/tsup/{chunk-HXUEHHJF.js → chunk-A2CF6PFH.js} +19 -11
- package/dist/tsup/chunk-A2CF6PFH.js.map +1 -0
- package/dist/tsup/{chunk-75UE45DE.js → chunk-BRH4PQS5.js} +436 -21
- package/dist/tsup/chunk-BRH4PQS5.js.map +1 -0
- package/dist/tsup/{chunk-2WMYYG4R.cjs → chunk-BTSDFFDC.cjs} +18 -11
- package/dist/tsup/chunk-BTSDFFDC.cjs.map +1 -0
- package/dist/tsup/{chunk-RIT7N3TX.js → chunk-D5WUPE47.js} +50 -3
- package/dist/tsup/chunk-D5WUPE47.js.map +1 -0
- package/dist/tsup/{chunk-4PX3ZKJR.js → chunk-DJUBJQEQ.js} +3 -3
- package/dist/tsup/chunk-DJUBJQEQ.js.map +1 -0
- package/dist/tsup/{chunk-3MHDOUD7.cjs → chunk-HDVZ6YZG.cjs} +197 -21
- package/dist/tsup/chunk-HDVZ6YZG.cjs.map +1 -0
- package/dist/tsup/{chunk-JZ7TWV65.js → chunk-JTHHCZCZ.js} +24 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-ND567FR5.cjs → chunk-JUHXV3HF.cjs} +3 -3
- package/dist/tsup/chunk-JUHXV3HF.cjs.map +1 -0
- package/dist/tsup/chunk-JUWMP5O3.js +14 -0
- package/dist/tsup/chunk-JUWMP5O3.js.map +1 -0
- package/dist/tsup/{chunk-ZA7FLHKH.cjs → chunk-KVFIONKQ.cjs} +25 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-4FC7TVS6.cjs → chunk-MGI2VVF6.cjs} +39 -7
- package/dist/tsup/chunk-MGI2VVF6.cjs.map +1 -0
- package/dist/tsup/{chunk-NHUTYWKU.cjs → chunk-OTVJYZ2L.cjs} +1139 -470
- package/dist/tsup/chunk-OTVJYZ2L.cjs.map +1 -0
- package/dist/tsup/{chunk-VE2X4KMG.cjs → chunk-RTWH3AX3.cjs} +18 -10
- package/dist/tsup/chunk-RTWH3AX3.cjs.map +1 -0
- package/dist/tsup/{chunk-QAVN4QNO.cjs → chunk-TM76Z7XT.cjs} +7 -7
- package/dist/tsup/chunk-TM76Z7XT.cjs.map +1 -0
- package/dist/tsup/{chunk-AGDY6TKH.js → chunk-TRUHDXOU.js} +1023 -354
- package/dist/tsup/chunk-TRUHDXOU.js.map +1 -0
- package/dist/tsup/{chunk-XFYEVYHG.js → chunk-TSQTI6H6.js} +16 -9
- package/dist/tsup/chunk-TSQTI6H6.js.map +1 -0
- package/dist/tsup/{chunk-2CICCOBL.cjs → chunk-Z7E2G3JZ.cjs} +52 -5
- package/dist/tsup/chunk-Z7E2G3JZ.cjs.map +1 -0
- package/dist/tsup/{chunk-ZZ3WBRPD.js → chunk-ZOVJDAOW.js} +38 -6
- package/dist/tsup/chunk-ZOVJDAOW.js.map +1 -0
- package/dist/tsup/chunk-ZYK4B5WV.js +243 -0
- package/dist/tsup/chunk-ZYK4B5WV.js.map +1 -0
- package/dist/tsup/client/mod.cjs +8 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +32 -6
- package/dist/tsup/client/mod.d.ts +32 -6
- package/dist/tsup/client/mod.js +7 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.cjs.map +1 -1
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-BR1Nn0QQ.d.ts → config-B4erdavw.d.ts} +571 -65
- package/dist/tsup/{config-B0LNDrLY.d.ts → config-BfG1qpYz.d.cts} +80 -14
- package/dist/tsup/{config-B0LNDrLY.d.cts → config-BfG1qpYz.d.ts} +80 -14
- package/dist/tsup/{config-tCvkwzyN.d.cts → config-DK144OAw.d.cts} +571 -65
- package/dist/tsup/{context-oc9zhA3x.d.ts → context-Cvnf3BRe.d.cts} +3 -2
- package/dist/tsup/{context-D4WDwf9m.d.cts → context-Oxi6YWcG.d.ts} +3 -2
- package/dist/tsup/db/drizzle.cjs +127 -67
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +8 -4
- package/dist/tsup/db/drizzle.d.ts +8 -4
- package/dist/tsup/db/drizzle.js +127 -67
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +6 -126
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +8 -4
- package/dist/tsup/db/mod.d.ts +8 -4
- package/dist/tsup/db/mod.js +5 -125
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.cjs.map +1 -1
- package/dist/tsup/dynamic/mod.d.cts +6 -4
- package/dist/tsup/dynamic/mod.d.ts +6 -4
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +26 -136
- package/dist/tsup/inspector/mod.d.ts +26 -136
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector/workflow.cjs +21 -0
- package/dist/tsup/inspector/workflow.cjs.map +1 -0
- package/dist/tsup/inspector/workflow.d.cts +144 -0
- package/dist/tsup/inspector/workflow.d.ts +144 -0
- package/dist/tsup/inspector/workflow.js +21 -0
- package/dist/tsup/inspector/workflow.js.map +1 -0
- package/dist/tsup/inspector-tab/mod.cjs +2 -13
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -1
- package/dist/tsup/inspector-tab/mod.d.cts +9 -17
- package/dist/tsup/inspector-tab/mod.d.ts +9 -17
- package/dist/tsup/inspector-tab/mod.js +1 -12
- package/dist/tsup/inspector-tab/mod.js.map +1 -1
- package/dist/tsup/mod.cjs +2724 -611
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +9 -7
- package/dist/tsup/mod.d.ts +9 -7
- package/dist/tsup/mod.js +2641 -528
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +19 -17
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +6 -4
- package/dist/tsup/test/mod.d.ts +6 -4
- package/dist/tsup/test/mod.js +18 -16
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/unstable/migrations.cjs +101 -0
- package/dist/tsup/unstable/migrations.cjs.map +1 -0
- package/dist/tsup/unstable/migrations.d.cts +29 -0
- package/dist/tsup/unstable/migrations.d.ts +29 -0
- package/dist/tsup/unstable/migrations.js +101 -0
- package/dist/tsup/unstable/migrations.js.map +1 -0
- package/dist/tsup/{utils-CqDnC_PS.d.cts → utils-3rsE0JvI.d.cts} +25 -2
- package/dist/tsup/{utils-CqDnC_PS.d.ts → utils-3rsE0JvI.d.ts} +25 -2
- package/dist/tsup/utils-C1O-SklO.d.ts +162 -0
- package/dist/tsup/utils-C6b0aYUM.d.cts +162 -0
- package/dist/tsup/utils.cjs +7 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +4 -147
- package/dist/tsup/utils.d.ts +4 -147
- package/dist/tsup/utils.js +6 -2
- package/dist/tsup/workflow/mod.cjs +260 -200
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -6
- package/dist/tsup/workflow/mod.d.ts +8 -6
- package/dist/tsup/workflow/mod.js +249 -189
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +34 -14
- package/src/actor/actions.ts +155 -0
- package/src/actor/config.ts +403 -43
- package/src/actor/definition.ts +26 -7
- package/src/actor/errors.ts +87 -5
- package/src/actor/keys.ts +86 -0
- package/src/actor/mod.ts +15 -1
- package/src/actor/tracing.ts +28 -0
- package/src/agent-os/index.ts +5 -65
- package/src/client/actor-common.ts +8 -15
- package/src/client/actor-conn.ts +135 -8
- package/src/client/actor-handle.ts +180 -42
- package/src/client/actor-query.ts +8 -1
- package/src/client/auth.ts +37 -0
- package/src/client/client.ts +89 -21
- package/src/client/config.ts +27 -2
- package/src/client/errors.ts +2 -1
- package/src/client/lifecycle-errors.ts +16 -1
- package/src/client/mod.ts +9 -0
- package/src/client/outbound-telemetry.ts +66 -0
- package/src/client/query.ts +2 -0
- package/src/client/queue.ts +3 -0
- package/src/client/raw-utils.ts +37 -8
- package/src/client/resolve-gateway-target.ts +2 -0
- package/src/client/retry-budget.ts +78 -0
- package/src/client/token-provider.ts +93 -0
- package/src/client/utils.ts +16 -2
- package/src/common/actor-router-consts.ts +5 -0
- package/src/common/actor-telemetry-context.ts +19 -0
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/generated/inspector/v6.ts +1367 -0
- package/src/common/bare/transport/v1.ts +36 -0
- package/src/common/database/config.ts +108 -15
- package/src/common/database/mod.ts +247 -76
- package/src/common/database/native-database.ts +433 -23
- package/src/common/database/shared.ts +24 -0
- package/src/common/encoding.ts +31 -21
- package/src/common/fetch-like.ts +63 -0
- package/src/common/inspector-transport.ts +12 -2
- package/src/common/log.ts +14 -8
- package/src/common/otel-context.ts +99 -0
- package/src/common/router.ts +1 -1
- package/src/common/utils.ts +7 -19
- package/src/db/drizzle.ts +182 -80
- package/src/db/mod.ts +2 -0
- package/src/dynamic/isolate-runtime.ts +0 -2
- package/src/engine-api/actors.ts +3 -3
- package/src/engine-client/actor-http-client.ts +29 -20
- package/src/engine-client/actor-websocket-client.ts +6 -3
- package/src/engine-client/api-endpoints.ts +72 -14
- package/src/engine-client/driver.ts +8 -15
- package/src/engine-client/mod.ts +248 -112
- package/src/inspector/client.browser.ts +134 -16
- package/src/inspector/mod.ts +1 -1
- package/src/inspector/workflow.ts +61 -0
- package/src/inspector-tab/mod.ts +1 -15
- package/src/registry/config/envoy.ts +2 -18
- package/src/registry/config/index.ts +53 -61
- package/src/registry/index.ts +311 -21
- package/src/registry/napi-runtime.ts +583 -39
- package/src/registry/native-http.ts +225 -0
- package/src/registry/native.ts +1365 -414
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.ts +372 -7
- package/src/registry/wasm-runtime.ts +490 -21
- package/src/registry/write-through-proxy.ts +101 -0
- package/src/test/mod.ts +1 -19
- package/src/test/ready.ts +22 -0
- package/src/unstable/migrations.ts +141 -0
- package/src/utils/env-vars.ts +15 -6
- package/src/utils/node.ts +44 -28
- package/src/utils.ts +3 -0
- package/src/workflow/context.ts +9 -27
- package/src/workflow/driver.ts +253 -116
- package/src/workflow/inspector.ts +23 -24
- package/src/workflow/mod.ts +50 -72
- package/dist/tsup/chunk-2CICCOBL.cjs.map +0 -1
- package/dist/tsup/chunk-2WMYYG4R.cjs.map +0 -1
- package/dist/tsup/chunk-3MHDOUD7.cjs.map +0 -1
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +0 -1
- package/dist/tsup/chunk-4PX3ZKJR.js.map +0 -1
- package/dist/tsup/chunk-75UE45DE.js.map +0 -1
- package/dist/tsup/chunk-7QKCGUTJ.cjs.map +0 -1
- package/dist/tsup/chunk-AGDY6TKH.js.map +0 -1
- package/dist/tsup/chunk-HXUEHHJF.js.map +0 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +0 -1
- package/dist/tsup/chunk-ND567FR5.cjs.map +0 -1
- package/dist/tsup/chunk-NHUTYWKU.cjs.map +0 -1
- package/dist/tsup/chunk-QAVN4QNO.cjs.map +0 -1
- package/dist/tsup/chunk-RIT7N3TX.js.map +0 -1
- package/dist/tsup/chunk-RV5MAFDT.cjs +0 -382
- package/dist/tsup/chunk-RV5MAFDT.cjs.map +0 -1
- package/dist/tsup/chunk-VE2X4KMG.cjs.map +0 -1
- package/dist/tsup/chunk-XFYEVYHG.js.map +0 -1
- package/dist/tsup/chunk-XHGDS3DZ.js +0 -382
- package/dist/tsup/chunk-XHGDS3DZ.js.map +0 -1
- package/dist/tsup/chunk-XIX5DOZN.js.map +0 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +0 -1
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +0 -1
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2484
- package/src/actor/keys.test.ts +0 -275
- package/src/actor/utils.test.ts +0 -48
- package/src/agent-os/actor/cron.ts +0 -84
- package/src/agent-os/actor/db.ts +0 -54
- package/src/agent-os/actor/filesystem.ts +0 -131
- package/src/agent-os/actor/index.ts +0 -285
- package/src/agent-os/actor/network.ts +0 -58
- package/src/agent-os/actor/preview.ts +0 -190
- package/src/agent-os/actor/process.ts +0 -177
- package/src/agent-os/actor/session.ts +0 -518
- package/src/agent-os/actor/shell.ts +0 -60
- package/src/agent-os/config.ts +0 -79
- package/src/agent-os/fs/database-vfs.ts +0 -624
- package/src/agent-os/types.ts +0 -148
- package/src/client/test.ts +0 -44
- package/src/common/database/mod.test.ts +0 -137
- package/src/common/database/native-database.test.ts +0 -211
- package/src/common/inline-websocket-adapter.test.ts +0 -51
- package/src/drivers/engine/actor-driver.ts +0 -2473
- package/src/registry/process-metrics.ts +0 -250
- package/src/registry/runtime.test.ts +0 -50
- package/src/utils/endpoint-parser.test.ts +0 -206
- package/src/utils.test.ts +0 -34
- /package/dist/tsup/{chunk-IICIOTML.js.map → chunk-3DONDAMG.js.map} +0 -0
package/src/actor/config.ts
CHANGED
|
@@ -5,7 +5,9 @@ import type {
|
|
|
5
5
|
InferDatabaseClient,
|
|
6
6
|
} from "@/common/database/config";
|
|
7
7
|
import type { UniversalWebSocket } from "@/common/websocket-interface";
|
|
8
|
+
import type { WorkflowState } from "@/inspector/workflow";
|
|
8
9
|
import type { Registry } from "@/registry";
|
|
10
|
+
import { flattenActionHandlers } from "./actions";
|
|
9
11
|
import type { BaseActorDefinition } from "./definition";
|
|
10
12
|
import type {
|
|
11
13
|
EventSchemaConfig,
|
|
@@ -14,6 +16,7 @@ import type {
|
|
|
14
16
|
PrimitiveSchema,
|
|
15
17
|
QueueSchemaConfig,
|
|
16
18
|
} from "./schema";
|
|
19
|
+
import type { ActionSampleRates, ActorTracingOptions } from "./tracing";
|
|
17
20
|
|
|
18
21
|
export const DEFAULT_SLEEP_GRACE_PERIOD = 15_000;
|
|
19
22
|
|
|
@@ -63,7 +66,7 @@ type ActorKvListOptions<
|
|
|
63
66
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
64
67
|
|
|
65
68
|
/**
|
|
66
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`
|
|
69
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
67
70
|
* or actor state instead.
|
|
68
71
|
*/
|
|
69
72
|
export interface ActorKv {
|
|
@@ -107,11 +110,89 @@ export interface ActorKv {
|
|
|
107
110
|
}
|
|
108
111
|
|
|
109
112
|
export interface ActorSchedule {
|
|
110
|
-
after(
|
|
111
|
-
|
|
113
|
+
after(
|
|
114
|
+
duration: number,
|
|
115
|
+
action: string,
|
|
116
|
+
...args: unknown[]
|
|
117
|
+
): Promise<string>;
|
|
118
|
+
at(timestamp: number, action: string, ...args: unknown[]): Promise<string>;
|
|
119
|
+
cancel(id: string): Promise<boolean>;
|
|
120
|
+
get(id: string): Promise<ScheduledEventInfo | undefined>;
|
|
121
|
+
list(): Promise<ScheduledEventInfo[]>;
|
|
112
122
|
[key: string]: any;
|
|
113
123
|
}
|
|
114
124
|
|
|
125
|
+
export interface ActorCronSetOptions {
|
|
126
|
+
name: string;
|
|
127
|
+
expression: string;
|
|
128
|
+
action: string;
|
|
129
|
+
args?: unknown[];
|
|
130
|
+
timezone?: string;
|
|
131
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
132
|
+
maxHistory?: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ActorCronEveryOptions {
|
|
136
|
+
name: string;
|
|
137
|
+
/** Fixed interval in milliseconds. Minimum 5,000. */
|
|
138
|
+
interval: number;
|
|
139
|
+
action: string;
|
|
140
|
+
args?: unknown[];
|
|
141
|
+
/** Defaults to 100. Set to 0 to disable and clear history. Maximum 1,000. */
|
|
142
|
+
maxHistory?: number;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface ActorCron {
|
|
146
|
+
set(options: ActorCronSetOptions): Promise<void>;
|
|
147
|
+
every(options: ActorCronEveryOptions): Promise<void>;
|
|
148
|
+
get(name: string): Promise<CronJobInfo | undefined>;
|
|
149
|
+
list(): Promise<CronJobInfo[]>;
|
|
150
|
+
delete(name: string): Promise<boolean>;
|
|
151
|
+
history(name: string, options?: { limit?: number }): Promise<CronFire[]>;
|
|
152
|
+
[key: string]: any;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ScheduledEventInfo {
|
|
156
|
+
id: string;
|
|
157
|
+
action: string;
|
|
158
|
+
args: unknown[];
|
|
159
|
+
runAt: number;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export type CronJobInfo = {
|
|
163
|
+
name: string;
|
|
164
|
+
action: string;
|
|
165
|
+
args: unknown[];
|
|
166
|
+
nextRunAt: number;
|
|
167
|
+
lastRunAt?: number;
|
|
168
|
+
maxHistory: number;
|
|
169
|
+
} & (
|
|
170
|
+
| { kind: "cron"; expression: string; timezone: string }
|
|
171
|
+
| { kind: "every"; interval: number }
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
export interface ScheduledFireInfo {
|
|
175
|
+
kind: "at" | "cron" | "every";
|
|
176
|
+
id: string;
|
|
177
|
+
name?: string;
|
|
178
|
+
scheduledAt: number;
|
|
179
|
+
firedAt: number;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface CronFire {
|
|
183
|
+
action: string;
|
|
184
|
+
scheduledAt: number;
|
|
185
|
+
firedAt: number;
|
|
186
|
+
finishedAt?: number;
|
|
187
|
+
result: "running" | "ok" | "error" | "skipped";
|
|
188
|
+
error?: {
|
|
189
|
+
group: string;
|
|
190
|
+
code: string;
|
|
191
|
+
message: string;
|
|
192
|
+
metadata?: unknown;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
115
196
|
export type QueueMessageOf<Name extends string, Body> = {
|
|
116
197
|
id: number | bigint;
|
|
117
198
|
name: Name;
|
|
@@ -253,6 +334,16 @@ export interface ActorQueue<
|
|
|
253
334
|
names: readonly TName[],
|
|
254
335
|
opts?: QueueWaitOptions<TCompletable>,
|
|
255
336
|
): Promise<any>;
|
|
337
|
+
/** @experimental */
|
|
338
|
+
waitForAvailable<const TName extends QueueFilterName<TQueues>>(
|
|
339
|
+
names?: readonly TName[],
|
|
340
|
+
opts?: Omit<QueueWaitOptions<false>, "completable">,
|
|
341
|
+
): Promise<void>;
|
|
342
|
+
/** @experimental */
|
|
343
|
+
complete<const TName extends QueueFilterName<TQueues>>(
|
|
344
|
+
message: { id: number | bigint; name: TName },
|
|
345
|
+
...args: QueueCompleteArgsForName<TQueues, TName>
|
|
346
|
+
): Promise<void>;
|
|
256
347
|
enqueueAndWait<const TName extends QueueFilterName<TQueues>>(
|
|
257
348
|
name: TName,
|
|
258
349
|
body: QueueMessageForName<TQueues, TName>["body"],
|
|
@@ -310,17 +401,22 @@ export interface ActorContext<
|
|
|
310
401
|
state: TState;
|
|
311
402
|
vars: TVars;
|
|
312
403
|
/**
|
|
313
|
-
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db`
|
|
404
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db`)
|
|
314
405
|
* or actor state instead.
|
|
315
406
|
*/
|
|
316
407
|
readonly kv: ActorKv;
|
|
317
408
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
318
409
|
readonly schedule: ActorSchedule;
|
|
410
|
+
readonly cron: ActorCron;
|
|
319
411
|
readonly queue: ActorQueue<TQueues>;
|
|
412
|
+
/** @experimental */
|
|
413
|
+
readonly run: ActorRun;
|
|
320
414
|
readonly actorId: string;
|
|
321
415
|
readonly name: string;
|
|
322
416
|
readonly key: string[];
|
|
323
417
|
readonly region: string;
|
|
418
|
+
/** Provisions the experimental Actor Runtime Socket for this actor generation. */
|
|
419
|
+
actorRuntimeSocket(): Promise<{ path: string }>;
|
|
324
420
|
readonly conns: Map<
|
|
325
421
|
string,
|
|
326
422
|
Conn<
|
|
@@ -352,6 +448,53 @@ export interface ActorContext<
|
|
|
352
448
|
[key: string]: any;
|
|
353
449
|
}
|
|
354
450
|
|
|
451
|
+
/** @experimental How one run of a workflow function ended. */
|
|
452
|
+
export type WorkflowOutcome =
|
|
453
|
+
| "completed"
|
|
454
|
+
| "sleeping"
|
|
455
|
+
| "evicted"
|
|
456
|
+
| "failed"
|
|
457
|
+
| "cancelled";
|
|
458
|
+
|
|
459
|
+
/** @experimental How one workflow step attempt ended. `retry` will be tried again, `failed` will not. */
|
|
460
|
+
export type WorkflowStepOutcome = "ok" | "retry" | "failed";
|
|
461
|
+
|
|
462
|
+
/** @experimental One open run of a workflow function, traced as its own invocation. */
|
|
463
|
+
export interface WorkflowSpan {
|
|
464
|
+
/** Runs `body` attributed to this run. */
|
|
465
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
466
|
+
/**
|
|
467
|
+
* Called by a workflow engine before each attempt at a step. Returns
|
|
468
|
+
* nothing when tracing is off.
|
|
469
|
+
*/
|
|
470
|
+
startStep(name: string, attempt: number): WorkflowStepSpan | undefined;
|
|
471
|
+
finish(outcome: WorkflowOutcome): Promise<void>;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/** @experimental One open attempt at one workflow step. */
|
|
475
|
+
export interface WorkflowStepSpan {
|
|
476
|
+
/** Runs `body` attributed to this attempt. */
|
|
477
|
+
run<T>(body: () => Promise<T>): Promise<T>;
|
|
478
|
+
/** `error` is what the step callback threw. */
|
|
479
|
+
finish(outcome: WorkflowStepOutcome, error?: unknown): void;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/** @experimental */
|
|
483
|
+
export interface ActorRun {
|
|
484
|
+
/**
|
|
485
|
+
* @experimental Sets or clears the durable Unix-millisecond deadline that
|
|
486
|
+
* ensures this actor's run handler is active, starting it if inactive.
|
|
487
|
+
*/
|
|
488
|
+
setWakeAt(timestamp: number | null): Promise<void>;
|
|
489
|
+
/** @experimental Called by a workflow engine each time it runs the workflow function. */
|
|
490
|
+
startWorkflowSpan(): Promise<WorkflowSpan>;
|
|
491
|
+
/**
|
|
492
|
+
* @experimental Runs `body` outside the current workflow run, so a workflow
|
|
493
|
+
* engine's own history storage stays out of the trace.
|
|
494
|
+
*/
|
|
495
|
+
runOutsideWorkflowSpan<T>(body: () => T): T;
|
|
496
|
+
}
|
|
497
|
+
|
|
355
498
|
export type ActionContext<
|
|
356
499
|
TState,
|
|
357
500
|
TConnParams,
|
|
@@ -711,22 +854,55 @@ const zFunction = <
|
|
|
711
854
|
T extends (...args: any[]) => any = (...args: unknown[]) => unknown,
|
|
712
855
|
>() => z.custom<T>((val) => typeof val === "function");
|
|
713
856
|
|
|
857
|
+
const zActionTree = z
|
|
858
|
+
.custom<Record<string, unknown>>((value) => {
|
|
859
|
+
if (
|
|
860
|
+
typeof value !== "object" ||
|
|
861
|
+
value === null ||
|
|
862
|
+
Array.isArray(value)
|
|
863
|
+
) {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
const prototype = Object.getPrototypeOf(value);
|
|
867
|
+
return prototype === Object.prototype || prototype === null;
|
|
868
|
+
})
|
|
869
|
+
.superRefine((actions, ctx) => {
|
|
870
|
+
try {
|
|
871
|
+
flattenActionHandlers(actions);
|
|
872
|
+
} catch (error) {
|
|
873
|
+
ctx.addIssue({
|
|
874
|
+
code: "custom",
|
|
875
|
+
message:
|
|
876
|
+
error instanceof Error
|
|
877
|
+
? error.message
|
|
878
|
+
: "Invalid action definition",
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
});
|
|
882
|
+
|
|
714
883
|
export type InspectorUnsubscribe = () => void;
|
|
715
884
|
|
|
885
|
+
/** @experimental */
|
|
716
886
|
export interface WorkflowInspectorConfig<THistory = unknown> {
|
|
717
887
|
getHistory: () => THistory | null;
|
|
888
|
+
getState?: () => Promise<WorkflowState | null>;
|
|
718
889
|
onHistoryUpdated?: (
|
|
719
890
|
listener: (history: THistory) => void,
|
|
720
891
|
) => InspectorUnsubscribe;
|
|
721
892
|
replayFromStep?: (entryId?: string) => Promise<THistory | null>;
|
|
722
893
|
}
|
|
723
894
|
|
|
895
|
+
/** @experimental */
|
|
724
896
|
export interface RunInspectorConfig<THistory = unknown> {
|
|
725
897
|
workflow?: WorkflowInspectorConfig<THistory>;
|
|
726
898
|
}
|
|
727
899
|
|
|
728
900
|
const WorkflowInspectorConfigSchema = z.object({
|
|
729
901
|
getHistory: zFunction<WorkflowInspectorConfig<unknown>["getHistory"]>(),
|
|
902
|
+
getState:
|
|
903
|
+
zFunction<
|
|
904
|
+
NonNullable<WorkflowInspectorConfig<unknown>["getState"]>
|
|
905
|
+
>().optional(),
|
|
730
906
|
onHistoryUpdated:
|
|
731
907
|
zFunction<
|
|
732
908
|
NonNullable<WorkflowInspectorConfig<unknown>["onHistoryUpdated"]>
|
|
@@ -753,6 +929,7 @@ export const BUILTIN_INSPECTOR_TAB_IDS = [
|
|
|
753
929
|
"database",
|
|
754
930
|
"state",
|
|
755
931
|
"queue",
|
|
932
|
+
"schedules",
|
|
756
933
|
"connections",
|
|
757
934
|
"console",
|
|
758
935
|
] as const;
|
|
@@ -872,9 +1049,72 @@ type AnyRunConfig = RunConfig<
|
|
|
872
1049
|
any
|
|
873
1050
|
>;
|
|
874
1051
|
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
1052
|
+
const RUN_FUNCTION_CONFIG_SYMBOL = Symbol.for("rivetkit.run_function_config");
|
|
1053
|
+
|
|
1054
|
+
/** @experimental */
|
|
1055
|
+
export type RunInspectorKind = "workflow";
|
|
1056
|
+
|
|
1057
|
+
/** @experimental */
|
|
1058
|
+
export interface RunWithInactiveOptions {
|
|
1059
|
+
/** Restart the run handler before releasing the exclusive gate on success. */
|
|
1060
|
+
restartOnSuccess?: boolean;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
/** @experimental */
|
|
1064
|
+
export interface RunControl {
|
|
1065
|
+
run: {
|
|
1066
|
+
/**
|
|
1067
|
+
* Executes only while no run handler is active or waiting to start.
|
|
1068
|
+
*
|
|
1069
|
+
* This is a non-blocking acquisition: concurrent replay/control requests
|
|
1070
|
+
* fail instead of waiting behind an active run.
|
|
1071
|
+
*/
|
|
1072
|
+
withInactive<T>(
|
|
1073
|
+
options: RunWithInactiveOptions,
|
|
1074
|
+
callback: () => T | Promise<T>,
|
|
1075
|
+
): Promise<T>;
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/** @experimental */
|
|
1080
|
+
export interface RunInspectorFactoryContext {
|
|
1081
|
+
actorId: string;
|
|
1082
|
+
control: RunControl;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/** @experimental */
|
|
1086
|
+
export interface RunInspectorFactoryResult<THistory = unknown> {
|
|
1087
|
+
inspector: {
|
|
1088
|
+
workflow: Required<WorkflowInspectorConfig<THistory>> & {
|
|
1089
|
+
getState: () => Promise<WorkflowState | null>;
|
|
1090
|
+
};
|
|
1091
|
+
};
|
|
1092
|
+
/** Releases actor-specific listeners and encoded history. */
|
|
1093
|
+
dispose?: () => void;
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
interface RunHandlerDisplayOptions {
|
|
1097
|
+
name?: string;
|
|
1098
|
+
icon?: string;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/** @experimental */
|
|
1102
|
+
export type DefineRunHandlerOptions<THistory = unknown> =
|
|
1103
|
+
RunHandlerDisplayOptions &
|
|
1104
|
+
(
|
|
1105
|
+
| {
|
|
1106
|
+
inspectorKind?: never;
|
|
1107
|
+
createInspector?: never;
|
|
1108
|
+
}
|
|
1109
|
+
| {
|
|
1110
|
+
/** Static metadata used to install Inspector callbacks at registry build time. */
|
|
1111
|
+
inspectorKind: RunInspectorKind;
|
|
1112
|
+
/** Creates one Inspector adapter for each live actor. */
|
|
1113
|
+
createInspector: (
|
|
1114
|
+
context: RunInspectorFactoryContext,
|
|
1115
|
+
) => RunInspectorFactoryResult<THistory>;
|
|
1116
|
+
}
|
|
1117
|
+
);
|
|
878
1118
|
|
|
879
1119
|
interface RunFunctionConfig {
|
|
880
1120
|
name?: string;
|
|
@@ -883,12 +1123,69 @@ interface RunFunctionConfig {
|
|
|
883
1123
|
inspectorFactory?: (actor: unknown) => RunInspectorConfig | undefined;
|
|
884
1124
|
/** Release any per-actor inspector state held for this actor id. */
|
|
885
1125
|
disposeInspector?: (actorId: string) => void;
|
|
1126
|
+
inspectorKind?: RunInspectorKind;
|
|
1127
|
+
createInspector?: (
|
|
1128
|
+
context: RunInspectorFactoryContext,
|
|
1129
|
+
) => RunInspectorFactoryResult;
|
|
886
1130
|
}
|
|
887
1131
|
|
|
888
1132
|
type RunFunctionWithConfig = ((...args: any[]) => any) & {
|
|
889
1133
|
[RUN_FUNCTION_CONFIG_SYMBOL]?: RunFunctionConfig;
|
|
890
1134
|
};
|
|
891
1135
|
|
|
1136
|
+
/**
|
|
1137
|
+
* @experimental Adds supported RivetKit run metadata while preserving the function's exact
|
|
1138
|
+
* callable type.
|
|
1139
|
+
*/
|
|
1140
|
+
export function defineRunHandler<
|
|
1141
|
+
TRun extends (...args: any[]) => any,
|
|
1142
|
+
THistory = unknown,
|
|
1143
|
+
>(run: TRun, options: DefineRunHandlerOptions<THistory>): TRun {
|
|
1144
|
+
if (
|
|
1145
|
+
(options.inspectorKind === undefined) !==
|
|
1146
|
+
(options.createInspector === undefined)
|
|
1147
|
+
) {
|
|
1148
|
+
throw new TypeError(
|
|
1149
|
+
"defineRunHandler requires inspectorKind and createInspector together",
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
Object.defineProperty(run, RUN_FUNCTION_CONFIG_SYMBOL, {
|
|
1154
|
+
configurable: false,
|
|
1155
|
+
enumerable: false,
|
|
1156
|
+
writable: false,
|
|
1157
|
+
value: {
|
|
1158
|
+
name: options.name,
|
|
1159
|
+
icon: options.icon,
|
|
1160
|
+
inspectorKind: options.inspectorKind,
|
|
1161
|
+
createInspector:
|
|
1162
|
+
options.createInspector as RunFunctionConfig["createInspector"],
|
|
1163
|
+
} satisfies RunFunctionConfig,
|
|
1164
|
+
});
|
|
1165
|
+
|
|
1166
|
+
return run;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/** @internal */
|
|
1170
|
+
export function getRunInspectorKind(
|
|
1171
|
+
run: ((...args: any[]) => any) | AnyRunConfig | undefined,
|
|
1172
|
+
): RunInspectorKind | undefined {
|
|
1173
|
+
if (!run || typeof run !== "function") return undefined;
|
|
1174
|
+
return (run as RunFunctionWithConfig)[RUN_FUNCTION_CONFIG_SYMBOL]
|
|
1175
|
+
?.inspectorKind;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
/** @internal */
|
|
1179
|
+
export function createRunInspector(
|
|
1180
|
+
run: ((...args: any[]) => any) | AnyRunConfig | undefined,
|
|
1181
|
+
context: RunInspectorFactoryContext,
|
|
1182
|
+
): RunInspectorFactoryResult | undefined {
|
|
1183
|
+
if (!run || typeof run !== "function") return undefined;
|
|
1184
|
+
return (run as RunFunctionWithConfig)[
|
|
1185
|
+
RUN_FUNCTION_CONFIG_SYMBOL
|
|
1186
|
+
]?.createInspector?.(context);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
892
1189
|
// Run can be either a function or an object with name/icon/run
|
|
893
1190
|
const zRunHandler = z.union([zFunction(), RunConfigSchema]).optional();
|
|
894
1191
|
|
|
@@ -933,6 +1230,21 @@ export function getRunInspectorConfig(
|
|
|
933
1230
|
return run.inspector;
|
|
934
1231
|
}
|
|
935
1232
|
|
|
1233
|
+
/** @internal */
|
|
1234
|
+
export function hasRunInspectorConfig(
|
|
1235
|
+
run: ((...args: any[]) => any) | AnyRunConfig | undefined,
|
|
1236
|
+
): boolean {
|
|
1237
|
+
if (!run) return false;
|
|
1238
|
+
if (typeof run !== "function") return run.inspector !== undefined;
|
|
1239
|
+
const config = (run as RunFunctionWithConfig)[RUN_FUNCTION_CONFIG_SYMBOL];
|
|
1240
|
+
return (
|
|
1241
|
+
config?.inspectorKind !== undefined ||
|
|
1242
|
+
config?.createInspector !== undefined ||
|
|
1243
|
+
config?.inspector !== undefined ||
|
|
1244
|
+
config?.inspectorFactory !== undefined
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
936
1248
|
/** Release per-actor inspector state for a destroyed actor, if the run handler registered a disposer. */
|
|
937
1249
|
export function disposeRunInspector(
|
|
938
1250
|
run: ((...args: any[]) => any) | AnyRunConfig | undefined,
|
|
@@ -956,10 +1268,12 @@ const GlobalActorOptionsBaseSchema = z
|
|
|
956
1268
|
name: z.string().optional(),
|
|
957
1269
|
/** Icon for the actor in the Inspector UI. Can be an emoji or FontAwesome icon name. */
|
|
958
1270
|
icon: z.string().optional(),
|
|
1271
|
+
/** Enables the experimental Actor Runtime Socket for this actor. */
|
|
1272
|
+
enableActorRuntimeSocket: z.boolean().default(false),
|
|
959
1273
|
/**
|
|
960
|
-
* Can hibernate WebSockets for
|
|
961
|
-
*
|
|
962
|
-
*
|
|
1274
|
+
* Can hibernate WebSockets, both client connections for actions and
|
|
1275
|
+
* events and WebSockets for onWebSocket. A WebSocket that does not
|
|
1276
|
+
* hibernate closes when the actor sleeps, and the client reconnects.
|
|
963
1277
|
*
|
|
964
1278
|
* @experimental
|
|
965
1279
|
**/
|
|
@@ -999,13 +1313,15 @@ const InstanceActorOptionsBaseSchema = z
|
|
|
999
1313
|
noSleep: z.boolean().default(false),
|
|
1000
1314
|
sleepTimeout: z.number().positive().default(30_000),
|
|
1001
1315
|
maxQueueSize: z.number().positive().default(1000),
|
|
1316
|
+
/** Maximum pending one-shot and recurring schedules. */
|
|
1317
|
+
maxSchedules: z.number().int().nonnegative().default(1000),
|
|
1002
1318
|
maxQueueMessageSize: z
|
|
1003
1319
|
.number()
|
|
1004
1320
|
.positive()
|
|
1005
1321
|
.default(64 * 1024),
|
|
1006
|
-
/**
|
|
1322
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
1007
1323
|
preloadMaxWorkflowBytes: z.number().nonnegative().optional(),
|
|
1008
|
-
/**
|
|
1324
|
+
/** @deprecated Internal storage moved to SQLite and no longer uses KV preloading, so this option is ignored. Will be removed in 2.2.0. */
|
|
1009
1325
|
preloadMaxConnectionsBytes: z.number().nonnegative().optional(),
|
|
1010
1326
|
})
|
|
1011
1327
|
.strict();
|
|
@@ -1027,6 +1343,12 @@ export const ActorOptionsSchema = GlobalActorOptionsBaseSchema.extend(
|
|
|
1027
1343
|
export type ActorOptions = z.infer<typeof ActorOptionsSchema>;
|
|
1028
1344
|
export type ActorOptionsInput = z.input<typeof ActorOptionsSchema>;
|
|
1029
1345
|
|
|
1346
|
+
const zSampleRate = z.number().min(0).max(1);
|
|
1347
|
+
|
|
1348
|
+
const zActionSampleRates: z.ZodType<ActionSampleRates> = z.lazy(() =>
|
|
1349
|
+
z.record(z.string(), z.union([zSampleRate, zActionSampleRates])),
|
|
1350
|
+
);
|
|
1351
|
+
|
|
1030
1352
|
export const ActorConfigSchema = z
|
|
1031
1353
|
.object({
|
|
1032
1354
|
onCreate: zFunction().optional(),
|
|
@@ -1042,8 +1364,15 @@ export const ActorConfigSchema = z
|
|
|
1042
1364
|
onBeforeActionResponse: zFunction().optional(),
|
|
1043
1365
|
onRequest: zFunction().optional(),
|
|
1044
1366
|
onWebSocket: zFunction().optional(),
|
|
1045
|
-
actions:
|
|
1367
|
+
actions: zActionTree.default(() => ({})),
|
|
1046
1368
|
actionInputSchemas: z.record(z.string(), z.any()).optional(),
|
|
1369
|
+
tracing: z
|
|
1370
|
+
.object({
|
|
1371
|
+
sampler: zSampleRate.optional(),
|
|
1372
|
+
actions: zActionSampleRates.optional(),
|
|
1373
|
+
})
|
|
1374
|
+
.strict()
|
|
1375
|
+
.optional(),
|
|
1047
1376
|
connParamsSchema: z.any().optional(),
|
|
1048
1377
|
events: z.record(z.string(), z.any()).optional(),
|
|
1049
1378
|
queues: z.record(z.string(), z.any()).optional(),
|
|
@@ -1189,19 +1518,34 @@ export interface Actions<
|
|
|
1189
1518
|
TEvents extends EventSchemaConfig = Record<never, never>,
|
|
1190
1519
|
TQueues extends QueueSchemaConfig = Record<never, never>,
|
|
1191
1520
|
> {
|
|
1192
|
-
[Action: string]:
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1521
|
+
[Action: string]:
|
|
1522
|
+
| ((
|
|
1523
|
+
c: ActionContext<
|
|
1524
|
+
TState,
|
|
1525
|
+
TConnParams,
|
|
1526
|
+
TConnState,
|
|
1527
|
+
TVars,
|
|
1528
|
+
TInput,
|
|
1529
|
+
TDatabase,
|
|
1530
|
+
TEvents,
|
|
1531
|
+
TQueues
|
|
1532
|
+
>,
|
|
1533
|
+
...args: any[]
|
|
1534
|
+
) => any)
|
|
1535
|
+
| Actions<
|
|
1536
|
+
TState,
|
|
1537
|
+
TConnParams,
|
|
1538
|
+
TConnState,
|
|
1539
|
+
TVars,
|
|
1540
|
+
TInput,
|
|
1541
|
+
TDatabase,
|
|
1542
|
+
TEvents,
|
|
1543
|
+
TQueues
|
|
1544
|
+
>;
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
export interface ActionInputSchemas {
|
|
1548
|
+
[Action: string]: PrimitiveSchema | ActionInputSchemas;
|
|
1205
1549
|
}
|
|
1206
1550
|
|
|
1207
1551
|
//export type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TAuthData> = BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TAuthData> &
|
|
@@ -1569,9 +1913,16 @@ interface BaseActorConfig<
|
|
|
1569
1913
|
actions?: TActions;
|
|
1570
1914
|
|
|
1571
1915
|
/**
|
|
1572
|
-
* Optional
|
|
1916
|
+
* Optional schemas for validating action argument tuples in native runtimes.
|
|
1917
|
+
* May mirror nested action groups or use dot-separated low-level action names.
|
|
1918
|
+
*/
|
|
1919
|
+
actionInputSchemas?: ActionInputSchemas;
|
|
1920
|
+
|
|
1921
|
+
/**
|
|
1922
|
+
* How much of this actor's work is recorded in traces. Defaults to the
|
|
1923
|
+
* process sampler from `OTEL_TRACES_SAMPLER`.
|
|
1573
1924
|
*/
|
|
1574
|
-
|
|
1925
|
+
tracing?: ActorTracingOptions<TActions>;
|
|
1575
1926
|
|
|
1576
1927
|
/**
|
|
1577
1928
|
* Optional schema for validating connection params in native runtimes.
|
|
@@ -1730,6 +2081,7 @@ export type ActorConfigInput<
|
|
|
1730
2081
|
} & Omit<
|
|
1731
2082
|
z.input<typeof ActorConfigSchema>,
|
|
1732
2083
|
| "actions"
|
|
2084
|
+
| "tracing"
|
|
1733
2085
|
| "events"
|
|
1734
2086
|
| "queues"
|
|
1735
2087
|
| "onCreate"
|
|
@@ -1867,6 +2219,12 @@ export const DocActorOptionsSchema = z
|
|
|
1867
2219
|
.describe(
|
|
1868
2220
|
"Icon for the actor in the Inspector UI. Can be an emoji (e.g., '🚀') or FontAwesome icon name (e.g., 'rocket').",
|
|
1869
2221
|
),
|
|
2222
|
+
enableActorRuntimeSocket: z
|
|
2223
|
+
.boolean()
|
|
2224
|
+
.optional()
|
|
2225
|
+
.describe(
|
|
2226
|
+
"Enables the experimental Actor Runtime Socket for this actor. Default: false",
|
|
2227
|
+
),
|
|
1870
2228
|
createVarsTimeout: z
|
|
1871
2229
|
.number()
|
|
1872
2230
|
.optional()
|
|
@@ -1949,29 +2307,25 @@ export const DocActorOptionsSchema = z
|
|
|
1949
2307
|
.describe(
|
|
1950
2308
|
"Maximum number of queue messages before rejecting new messages. Default: 1000",
|
|
1951
2309
|
),
|
|
1952
|
-
|
|
2310
|
+
maxSchedules: z
|
|
1953
2311
|
.number()
|
|
2312
|
+
.int()
|
|
2313
|
+
.nonnegative()
|
|
1954
2314
|
.optional()
|
|
1955
2315
|
.describe(
|
|
1956
|
-
"Maximum
|
|
1957
|
-
),
|
|
1958
|
-
canHibernateWebSocket: z
|
|
1959
|
-
.boolean()
|
|
1960
|
-
.optional()
|
|
1961
|
-
.describe(
|
|
1962
|
-
"Whether WebSockets using onWebSocket can be hibernated. WebSockets using actions/events are hibernatable by default. Default: false",
|
|
2316
|
+
"Maximum pending one-shot and recurring schedules before rejecting new schedules. Default: 1000",
|
|
1963
2317
|
),
|
|
1964
|
-
|
|
2318
|
+
maxQueueMessageSize: z
|
|
1965
2319
|
.number()
|
|
1966
2320
|
.optional()
|
|
1967
2321
|
.describe(
|
|
1968
|
-
"
|
|
2322
|
+
"Maximum size of each queue message in bytes. Default: 65536",
|
|
1969
2323
|
),
|
|
1970
|
-
|
|
1971
|
-
.
|
|
2324
|
+
canHibernateWebSocket: z
|
|
2325
|
+
.boolean()
|
|
1972
2326
|
.optional()
|
|
1973
2327
|
.describe(
|
|
1974
|
-
"
|
|
2328
|
+
"Whether WebSockets can be hibernated, both client connections for actions and events and WebSockets using onWebSocket. A WebSocket that does not hibernate closes when the actor sleeps. Default: false",
|
|
1975
2329
|
),
|
|
1976
2330
|
})
|
|
1977
2331
|
.describe("Actor options for timeouts and behavior configuration.");
|
|
@@ -2096,13 +2450,19 @@ export const DocActorConfigSchema = z
|
|
|
2096
2450
|
.record(z.string(), z.unknown())
|
|
2097
2451
|
.optional()
|
|
2098
2452
|
.describe(
|
|
2099
|
-
"
|
|
2453
|
+
"Tree of action names or nested groups to handler functions. Nested paths use dot-separated low-level action names. Defaults to an empty object.",
|
|
2100
2454
|
),
|
|
2101
2455
|
actionInputSchemas: z
|
|
2102
2456
|
.record(z.string(), z.unknown())
|
|
2103
2457
|
.optional()
|
|
2104
2458
|
.describe(
|
|
2105
|
-
"Optional
|
|
2459
|
+
"Optional schemas for validating action argument tuples in native runtimes. May mirror nested action groups or use dot-separated low-level action names.",
|
|
2460
|
+
),
|
|
2461
|
+
tracing: z
|
|
2462
|
+
.unknown()
|
|
2463
|
+
.optional()
|
|
2464
|
+
.describe(
|
|
2465
|
+
"Trace sampling for this actor: `sampler` is the share of its invocations that are recorded, from 0 to 1, with optional per-action rates under `actions`. A rate lowers what is recorded and never raises it. Defaults to the process sampler from OTEL_TRACES_SAMPLER.",
|
|
2106
2466
|
),
|
|
2107
2467
|
connParamsSchema: z
|
|
2108
2468
|
.unknown()
|