rivetkit 0.0.0-skip-ready-wait-flatten-client-options.1cae221 → 0.0.0-sqlite-uds.ea644f1
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 +561 -89
- package/dist/browser/client.js +1063 -430
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +22 -2
- package/dist/browser/inspector/client.js +1036 -232
- 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 -74
- package/dist/tsup/actor/errors.d.ts +1 -74
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +2232 -2082
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +556 -85
- package/dist/tsup/agent-os/index.d.ts +556 -85
- package/dist/tsup/agent-os/index.js +2234 -2084
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-3GLNEWGY.js} +78 -6
- package/dist/tsup/chunk-3GLNEWGY.js.map +1 -0
- package/dist/tsup/{chunk-V3QNBJ7N.cjs → chunk-4FC7TVS6.cjs} +35 -10
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-XNZR7UD2.cjs → chunk-7DDQA6KN.cjs} +90 -65
- package/dist/tsup/chunk-7DDQA6KN.cjs.map +1 -0
- package/dist/tsup/{chunk-NFC5VU36.cjs → chunk-AESHILFV.cjs} +18 -10
- package/dist/tsup/chunk-AESHILFV.cjs.map +1 -0
- package/dist/tsup/{chunk-D4TSTM6C.js → chunk-EFQCNJ23.js} +83 -58
- package/dist/tsup/chunk-EFQCNJ23.js.map +1 -0
- package/dist/tsup/{chunk-OIKOPSXQ.js → chunk-FUS4OFX5.js} +12 -4
- package/dist/tsup/chunk-FUS4OFX5.js.map +1 -0
- package/dist/tsup/{chunk-IOYKCB6Y.cjs → chunk-GUCITCR3.cjs} +44 -9
- package/dist/tsup/chunk-GUCITCR3.cjs.map +1 -0
- package/dist/tsup/{chunk-3BFYSYRU.js → chunk-HXUEHHJF.js} +3 -2
- package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
- package/dist/tsup/{chunk-KSG2COSQ.js → chunk-KYBAXJRA.js} +6 -6
- package/dist/tsup/chunk-KYBAXJRA.js.map +1 -0
- package/dist/tsup/{chunk-LNMB25HW.js → chunk-LMUEIJUM.js} +780 -183
- package/dist/tsup/chunk-LMUEIJUM.js.map +1 -0
- package/dist/tsup/{chunk-RZEJJJKU.js → chunk-LTMSYD2A.js} +42 -7
- package/dist/tsup/chunk-LTMSYD2A.js.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-OAPVVVTX.cjs} +79 -7
- package/dist/tsup/chunk-OAPVVVTX.cjs.map +1 -0
- package/dist/tsup/{chunk-D2TLG75Y.cjs → chunk-TIUL6FNF.cjs} +10 -10
- package/dist/tsup/chunk-TIUL6FNF.cjs.map +1 -0
- package/dist/tsup/{chunk-POTPHU3P.cjs → chunk-UYT2CIWO.cjs} +3 -3
- package/dist/tsup/{chunk-POTPHU3P.cjs.map → chunk-UYT2CIWO.cjs.map} +1 -1
- package/dist/tsup/{chunk-TPBHXFB2.cjs → chunk-VDTC257X.cjs} +138 -24
- package/dist/tsup/chunk-VDTC257X.cjs.map +1 -0
- package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-VE2X4KMG.cjs} +3 -2
- package/dist/tsup/chunk-VE2X4KMG.cjs.map +1 -0
- package/dist/tsup/{chunk-22XU3BVY.cjs → chunk-VWOA7DRK.cjs} +925 -328
- package/dist/tsup/chunk-VWOA7DRK.cjs.map +1 -0
- package/dist/tsup/{chunk-4ZIWB4CQ.js → chunk-VYQASICJ.js} +2 -2
- package/dist/tsup/{chunk-W54QCENI.js → chunk-X4BXYDTG.js} +134 -20
- package/dist/tsup/chunk-X4BXYDTG.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
- package/dist/tsup/{chunk-K34B3OVG.js → chunk-ZZ3WBRPD.js} +34 -9
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +8 -9
- package/dist/tsup/client/mod.d.ts +8 -9
- package/dist/tsup/client/mod.js +8 -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.js +3 -3
- package/dist/tsup/{config-CRdGwwbr.d.cts → config-CxG53eQo.d.cts} +577 -36
- package/dist/tsup/{config-kxXbtrJU.d.ts → config-DLOxy81E.d.cts} +5 -5
- package/dist/tsup/{config-kxXbtrJU.d.cts → config-DLOxy81E.d.ts} +5 -5
- package/dist/tsup/{config-DIpBWm5C.d.ts → config-Ds6DCRhV.d.ts} +577 -36
- package/dist/tsup/context-8KlcOYIs.d.cts +129 -0
- package/dist/tsup/context-Cfbm4QLr.d.ts +129 -0
- package/dist/tsup/db/drizzle.cjs +164 -78
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +4 -2
- package/dist/tsup/db/drizzle.d.ts +4 -2
- package/dist/tsup/db/drizzle.js +164 -78
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +93 -24
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +92 -23
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +37 -0
- package/dist/tsup/dynamic/mod.d.ts +37 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +37 -15
- package/dist/tsup/inspector/mod.d.ts +37 -15
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +240 -0
- package/dist/tsup/inspector-tab/mod.d.ts +240 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +1078 -479
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -6
- package/dist/tsup/mod.d.ts +5 -6
- package/dist/tsup/mod.js +996 -397
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +21 -18
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -5
- package/dist/tsup/test/mod.d.ts +4 -5
- package/dist/tsup/test/mod.js +18 -15
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils-CqDnC_PS.d.cts +104 -0
- package/dist/tsup/utils-CqDnC_PS.d.ts +104 -0
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +386 -322
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -9
- package/dist/tsup/workflow/mod.d.ts +8 -9
- package/dist/tsup/workflow/mod.js +363 -299
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +35 -14
- package/src/actor/config.ts +188 -59
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +17 -19
- package/src/actor/driver.ts +3 -3
- package/src/actor/errors.ts +70 -7
- package/src/actor/instance/mod.ts +39 -56
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +22 -20
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/index.ts +38 -18
- package/src/agent-os/actor/preview.ts +1 -2
- package/src/agent-os/actor/session.ts +2 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/client/actor-common.ts +88 -62
- package/src/client/actor-conn.ts +58 -63
- package/src/client/actor-handle.ts +125 -71
- package/src/client/actor-query.ts +5 -5
- package/src/client/config.ts +3 -3
- package/src/client/errors.ts +2 -1
- package/src/client/lifecycle-errors.ts +2 -4
- package/src/client/query.ts +1 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +10 -10
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +34 -10
- package/src/common/actor-router-consts.ts +7 -4
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/actor-uds-protocol/v1.ts +802 -0
- package/src/common/bare/generated/client-protocol/v4.ts +599 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +176 -67
- package/src/common/client-protocol-zod.ts +7 -0
- package/src/common/client-protocol.ts +1 -1
- package/src/common/database/config.ts +16 -5
- package/src/common/database/mod.test.ts +137 -16
- package/src/common/database/mod.ts +100 -30
- package/src/common/database/native-database.test.ts +35 -22
- package/src/common/database/native-database.ts +26 -10
- package/src/common/database/shared.ts +1 -0
- package/src/common/encoding.ts +250 -16
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/log.ts +15 -8
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +10 -202
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.ts +194 -95
- package/src/db/mod.ts +1 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/drivers/engine/actor-driver.ts +76 -73
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +66 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +6 -9
- package/src/engine-client/actor-websocket-client.ts +14 -13
- package/src/engine-client/api-endpoints.ts +51 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +3 -4
- package/src/engine-client/mod.ts +17 -10
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +66 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector-tab/mod.ts +300 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +46 -20
- package/src/registry/index.ts +364 -87
- package/src/registry/napi-runtime.ts +97 -8
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +592 -343
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/runtime.ts +85 -6
- package/src/registry/wasm-runtime.ts +72 -3
- package/src/registry/write-through-proxy.ts +40 -0
- package/src/serde.ts +2 -2
- package/src/serverless/configure.ts +19 -8
- package/src/test/mod.ts +11 -8
- package/src/utils/crypto.ts +14 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +37 -0
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +1 -2
- package/src/workflow/context.ts +703 -240
- package/src/workflow/driver.ts +23 -12
- package/src/workflow/inspector.ts +12 -3
- package/src/workflow/mod.ts +37 -23
- package/dist/tsup/chunk-22XU3BVY.cjs.map +0 -1
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
- package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
- package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
- package/dist/tsup/chunk-D2TLG75Y.cjs.map +0 -1
- package/dist/tsup/chunk-D4TSTM6C.js.map +0 -1
- package/dist/tsup/chunk-IOYKCB6Y.cjs.map +0 -1
- package/dist/tsup/chunk-K34B3OVG.js.map +0 -1
- package/dist/tsup/chunk-KSG2COSQ.js.map +0 -1
- package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
- package/dist/tsup/chunk-LNMB25HW.js.map +0 -1
- package/dist/tsup/chunk-NFC5VU36.cjs.map +0 -1
- package/dist/tsup/chunk-OIKOPSXQ.js.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-RZEJJJKU.js.map +0 -1
- package/dist/tsup/chunk-TPBHXFB2.cjs.map +0 -1
- package/dist/tsup/chunk-V3QNBJ7N.cjs.map +0 -1
- package/dist/tsup/chunk-W54QCENI.js.map +0 -1
- package/dist/tsup/chunk-XNZR7UD2.cjs.map +0 -1
- package/dist/tsup/context-B7G6sk7x.d.ts +0 -92
- package/dist/tsup/context-DzMRHkjC.d.cts +0 -92
- package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
- package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-4ZIWB4CQ.js.map → chunk-VYQASICJ.js.map} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
-
import {
|
|
3
|
-
import { A as AnyDatabaseProvider, I as InferDatabaseClient } from './config-kxXbtrJU.js';
|
|
2
|
+
import { A as AnyDatabaseProvider, d as SqliteNativeMetrics, I as InferDatabaseClient } from './config-DLOxy81E.js';
|
|
4
3
|
import * as _rivetkit_rivetkit_wasm from '@rivetkit/rivetkit-wasm';
|
|
5
4
|
import { z as z$1 } from 'zod';
|
|
6
5
|
import { Logger } from 'pino';
|
|
6
|
+
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
7
7
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
8
8
|
import { Context, Hono } from 'hono';
|
|
9
9
|
import { GetUpgradeWebSocket } from './utils.js';
|
|
10
|
-
import {
|
|
10
|
+
import { R as RivetError } from './utils-CqDnC_PS.js';
|
|
11
11
|
|
|
12
12
|
declare const ActorKeySchema: z.ZodArray<z.ZodString>;
|
|
13
13
|
type ActorKey = z.infer<typeof ActorKeySchema>;
|
|
@@ -70,7 +70,7 @@ declare const EncodingSchema: z.ZodEnum<{
|
|
|
70
70
|
*/
|
|
71
71
|
type Encoding = z.infer<typeof EncodingSchema>;
|
|
72
72
|
|
|
73
|
-
declare const ActorsSchema: z$1.ZodRecord<z$1.ZodString, z$1.ZodCustom<
|
|
73
|
+
declare const ActorsSchema: z$1.ZodRecord<z$1.ZodString, z$1.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
|
|
74
74
|
type RegistryActors = z$1.infer<typeof ActorsSchema>;
|
|
75
75
|
declare const RuntimeKindSchema: z$1.ZodEnum<{
|
|
76
76
|
auto: "auto";
|
|
@@ -123,6 +123,7 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
123
123
|
}, z$1.core.$strip>>>;
|
|
124
124
|
maxIncomingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
|
|
125
125
|
maxOutgoingMessageSize: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
|
|
126
|
+
experimentalActorUds: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
126
127
|
runtime: z$1.ZodPipe<z$1.ZodOptional<z$1.ZodEnum<{
|
|
127
128
|
auto: "auto";
|
|
128
129
|
native: "native";
|
|
@@ -167,6 +168,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
167
168
|
httpPort: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
|
|
168
169
|
httpHost: z$1.ZodOptional<z$1.ZodString>;
|
|
169
170
|
startEngine: z$1.ZodDefault<z$1.ZodBoolean>;
|
|
171
|
+
engineHost: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
172
|
+
enginePort: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodNumber>>;
|
|
170
173
|
engineVersion: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodString>>;
|
|
171
174
|
configurePool: z$1.ZodOptional<z$1.ZodOptional<z$1.ZodObject<{
|
|
172
175
|
name: z$1.ZodOptional<z$1.ZodString>;
|
|
@@ -191,7 +194,7 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
191
194
|
envoyKey: z$1.ZodOptional<z$1.ZodString>;
|
|
192
195
|
}, z$1.core.$strip>>>;
|
|
193
196
|
shutdown: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodObject<{
|
|
194
|
-
gracePeriodMs: z$1.
|
|
197
|
+
gracePeriodMs: z$1.ZodOptional<z$1.ZodNumber>;
|
|
195
198
|
disableSignalHandlers: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
|
|
196
199
|
}, z$1.core.$strip>>>;
|
|
197
200
|
}, z$1.core.$strip>, z$1.ZodTransform<{
|
|
@@ -218,6 +221,7 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
218
221
|
};
|
|
219
222
|
maxIncomingMessageSize: number;
|
|
220
223
|
maxOutgoingMessageSize: number;
|
|
224
|
+
experimentalActorUds: boolean;
|
|
221
225
|
runtime: "auto" | "native" | "wasm";
|
|
222
226
|
wasm: {
|
|
223
227
|
bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
|
|
@@ -232,6 +236,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
232
236
|
httpBasePath: string;
|
|
233
237
|
httpPort: number;
|
|
234
238
|
startEngine: boolean;
|
|
239
|
+
engineHost: string;
|
|
240
|
+
enginePort: number;
|
|
235
241
|
engineVersion: string;
|
|
236
242
|
envoy: {
|
|
237
243
|
poolName: string;
|
|
@@ -240,8 +246,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
240
246
|
envoyKey?: string | undefined;
|
|
241
247
|
};
|
|
242
248
|
shutdown: {
|
|
243
|
-
gracePeriodMs: number;
|
|
244
249
|
disableSignalHandlers: boolean;
|
|
250
|
+
gracePeriodMs?: number | undefined;
|
|
245
251
|
};
|
|
246
252
|
staticDir?: string | undefined;
|
|
247
253
|
httpHost?: string | undefined;
|
|
@@ -263,6 +269,7 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
263
269
|
};
|
|
264
270
|
maxIncomingMessageSize: number;
|
|
265
271
|
maxOutgoingMessageSize: number;
|
|
272
|
+
experimentalActorUds: boolean;
|
|
266
273
|
runtime: "auto" | "native" | "wasm";
|
|
267
274
|
wasm: {
|
|
268
275
|
bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
|
|
@@ -283,6 +290,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
283
290
|
httpBasePath: string;
|
|
284
291
|
httpPort: number;
|
|
285
292
|
startEngine: boolean;
|
|
293
|
+
engineHost: string;
|
|
294
|
+
enginePort: number;
|
|
286
295
|
engineVersion: string;
|
|
287
296
|
serverless: {
|
|
288
297
|
basePath: string;
|
|
@@ -297,8 +306,8 @@ declare const RegistryConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
|
|
|
297
306
|
envoyKey?: string | undefined;
|
|
298
307
|
};
|
|
299
308
|
shutdown: {
|
|
300
|
-
gracePeriodMs: number;
|
|
301
309
|
disableSignalHandlers: boolean;
|
|
310
|
+
gracePeriodMs?: number | undefined;
|
|
302
311
|
};
|
|
303
312
|
staticDir?: string | undefined;
|
|
304
313
|
httpHost?: string | undefined;
|
|
@@ -444,7 +453,7 @@ interface QueueSchemaDefinition<TContext = any> {
|
|
|
444
453
|
type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
|
|
445
454
|
type QueueSchema = PrimitiveSchema | QueueSchemaDefinition<any> | QueueTypeToken<unknown, unknown, any>;
|
|
446
455
|
type EventSchemaConfig<TContext = any> = Record<string, EventSchema<TContext>>;
|
|
447
|
-
type QueueSchemaConfig<
|
|
456
|
+
type QueueSchemaConfig<_TContext = any> = Record<string, QueueSchema>;
|
|
448
457
|
type InferSchema<T> = T extends QueueSchemaDefinition<any> ? InferSchema<T["message"]> : T extends QueueTypeToken<infer M, unknown, any> ? M : T extends EventSchemaDefinition<any> ? InferSchema<T["schema"]> : T extends StandardSchemaV1<any, infer O> ? O : T extends EventTypeToken<infer R, any> ? R : never;
|
|
449
458
|
type InferSchemaMap<T extends Record<string, unknown>> = {
|
|
450
459
|
[K in keyof T]: InferSchema<T[K]>;
|
|
@@ -455,15 +464,17 @@ type InferQueueCompleteMap<T extends QueueSchemaConfig> = {
|
|
|
455
464
|
};
|
|
456
465
|
type InferEventArgs<T> = T extends readonly unknown[] ? number extends T["length"] ? [T] : T : [T];
|
|
457
466
|
|
|
458
|
-
interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>,
|
|
459
|
-
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
467
|
+
interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, _R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> {
|
|
468
|
+
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q, _R>;
|
|
469
|
+
}
|
|
470
|
+
interface AnyActorDefinition {
|
|
471
|
+
readonly config: any;
|
|
460
472
|
}
|
|
461
|
-
type AnyActorDefinition = BaseActorDefinition<any, any, any, any, any, any, any, any, any>;
|
|
462
473
|
type AnyStaticActorDefinition = ActorDefinition<any, any, any, any, any, any, any, any, any>;
|
|
463
474
|
declare class ActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>, R extends Actions<S, CP, CS, V, I, DB, E, Q> = Actions<S, CP, CS, V, I, DB, E, Q>> implements BaseActorDefinition<S, CP, CS, V, I, DB, E, Q, R> {
|
|
464
475
|
#private;
|
|
465
|
-
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>);
|
|
466
|
-
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
476
|
+
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>);
|
|
477
|
+
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q, R>;
|
|
467
478
|
}
|
|
468
479
|
interface BaseActorInstance<S = any, CP = any, CS = any, V = any, I = any, DB extends AnyDatabaseProvider = AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>> {
|
|
469
480
|
id: string;
|
|
@@ -482,7 +493,6 @@ type GatewayTarget = {
|
|
|
482
493
|
directId: string;
|
|
483
494
|
} | ActorQuery;
|
|
484
495
|
interface GatewayRequestOptions {
|
|
485
|
-
bypassConnectable?: boolean;
|
|
486
496
|
skipReadyWait?: boolean;
|
|
487
497
|
}
|
|
488
498
|
interface EngineControlClient {
|
|
@@ -558,19 +568,375 @@ interface ActorOutput {
|
|
|
558
568
|
error?: unknown;
|
|
559
569
|
}
|
|
560
570
|
|
|
571
|
+
declare const handleBrand: unique symbol;
|
|
572
|
+
type OpaqueHandle<Name extends string> = {
|
|
573
|
+
readonly [handleBrand]: Name;
|
|
574
|
+
};
|
|
575
|
+
type RegistryHandle = OpaqueHandle<"registry">;
|
|
576
|
+
type ActorFactoryHandle = OpaqueHandle<"actorFactory">;
|
|
577
|
+
type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
578
|
+
type ConnHandle = OpaqueHandle<"conn">;
|
|
579
|
+
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
580
|
+
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
581
|
+
type RuntimeBytes = Uint8Array;
|
|
582
|
+
interface RuntimeActorKeySegment {
|
|
583
|
+
kind: string;
|
|
584
|
+
stringValue?: string;
|
|
585
|
+
numberValue?: number;
|
|
586
|
+
}
|
|
587
|
+
interface RuntimeHttpRequest {
|
|
588
|
+
method: string;
|
|
589
|
+
uri: string;
|
|
590
|
+
headers?: Record<string, string>;
|
|
591
|
+
body?: RuntimeBytes;
|
|
592
|
+
}
|
|
593
|
+
interface RuntimeStateDeltaPayload {
|
|
594
|
+
state?: RuntimeBytes;
|
|
595
|
+
connHibernation: Array<{
|
|
596
|
+
connId: string;
|
|
597
|
+
bytes: RuntimeBytes;
|
|
598
|
+
}>;
|
|
599
|
+
connHibernationRemoved: string[];
|
|
600
|
+
}
|
|
601
|
+
interface RuntimeRequestSaveOpts {
|
|
602
|
+
immediate?: boolean;
|
|
603
|
+
maxWaitMs?: number;
|
|
604
|
+
}
|
|
605
|
+
interface RuntimeInspectorSnapshot {
|
|
606
|
+
stateRevision: number;
|
|
607
|
+
connectionsRevision: number;
|
|
608
|
+
queueRevision: number;
|
|
609
|
+
activeConnections: number;
|
|
610
|
+
queueSize: number;
|
|
611
|
+
connectedClients: number;
|
|
612
|
+
}
|
|
613
|
+
interface RuntimeQueueMessage {
|
|
614
|
+
id(): bigint;
|
|
615
|
+
name(): string;
|
|
616
|
+
body(): RuntimeBytes;
|
|
617
|
+
createdAt(): number;
|
|
618
|
+
isCompletable(): boolean;
|
|
619
|
+
complete(response?: RuntimeBytes | undefined | null): Promise<void>;
|
|
620
|
+
}
|
|
621
|
+
interface RuntimeQueueInspectMessage {
|
|
622
|
+
id: number;
|
|
623
|
+
name: string;
|
|
624
|
+
createdAtMs: number;
|
|
625
|
+
}
|
|
626
|
+
interface RuntimeQueueNextBatchOptions {
|
|
627
|
+
names?: string[];
|
|
628
|
+
count?: number;
|
|
629
|
+
timeoutMs?: number;
|
|
630
|
+
completable?: boolean;
|
|
631
|
+
}
|
|
632
|
+
interface RuntimeQueueWaitOptions {
|
|
633
|
+
timeoutMs?: number;
|
|
634
|
+
completable?: boolean;
|
|
635
|
+
}
|
|
636
|
+
interface RuntimeQueueEnqueueAndWaitOptions {
|
|
637
|
+
timeoutMs?: number;
|
|
638
|
+
}
|
|
639
|
+
interface RuntimeQueueTryNextBatchOptions {
|
|
640
|
+
names?: string[];
|
|
641
|
+
count?: number;
|
|
642
|
+
completable?: boolean;
|
|
643
|
+
}
|
|
644
|
+
interface RuntimeKvListOptions {
|
|
645
|
+
reverse?: boolean;
|
|
646
|
+
limit?: number;
|
|
647
|
+
}
|
|
648
|
+
interface RuntimeKvEntry {
|
|
649
|
+
key: RuntimeBytes;
|
|
650
|
+
value: RuntimeBytes;
|
|
651
|
+
}
|
|
652
|
+
type RuntimeSqlBindNoValues = {
|
|
653
|
+
intValue?: never;
|
|
654
|
+
floatValue?: never;
|
|
655
|
+
textValue?: never;
|
|
656
|
+
blobValue?: never;
|
|
657
|
+
};
|
|
658
|
+
type RuntimeSqlBindParam = ({
|
|
659
|
+
kind: "null";
|
|
660
|
+
} & RuntimeSqlBindNoValues) | {
|
|
661
|
+
kind: "int";
|
|
662
|
+
intValue: number;
|
|
663
|
+
floatValue?: never;
|
|
664
|
+
textValue?: never;
|
|
665
|
+
blobValue?: never;
|
|
666
|
+
} | {
|
|
667
|
+
kind: "float";
|
|
668
|
+
intValue?: never;
|
|
669
|
+
floatValue: number;
|
|
670
|
+
textValue?: never;
|
|
671
|
+
blobValue?: never;
|
|
672
|
+
} | {
|
|
673
|
+
kind: "text";
|
|
674
|
+
intValue?: never;
|
|
675
|
+
floatValue?: never;
|
|
676
|
+
textValue: string;
|
|
677
|
+
blobValue?: never;
|
|
678
|
+
} | {
|
|
679
|
+
kind: "blob";
|
|
680
|
+
intValue?: never;
|
|
681
|
+
floatValue?: never;
|
|
682
|
+
textValue?: never;
|
|
683
|
+
blobValue: RuntimeBytes;
|
|
684
|
+
};
|
|
685
|
+
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
686
|
+
interface RuntimeSqlLeaseOptions {
|
|
687
|
+
key: string;
|
|
688
|
+
timeoutMs?: number;
|
|
689
|
+
}
|
|
690
|
+
interface RuntimeActorUdsEndpointInfo {
|
|
691
|
+
path: string;
|
|
692
|
+
token: string;
|
|
693
|
+
}
|
|
694
|
+
interface RuntimeSqlQueryResult {
|
|
695
|
+
columns: string[];
|
|
696
|
+
rows: unknown[][];
|
|
697
|
+
}
|
|
698
|
+
type RuntimeSqlExecResult = RuntimeSqlQueryResult;
|
|
699
|
+
interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
700
|
+
changes: number;
|
|
701
|
+
lastInsertRowId?: number | null;
|
|
702
|
+
}
|
|
703
|
+
interface RuntimeSqlRunResult {
|
|
704
|
+
changes: number;
|
|
705
|
+
}
|
|
706
|
+
interface RuntimeActorConfig {
|
|
707
|
+
name?: string;
|
|
708
|
+
icon?: string;
|
|
709
|
+
hasDatabase?: boolean;
|
|
710
|
+
remoteSqlite?: boolean;
|
|
711
|
+
experimentalActorUds?: boolean;
|
|
712
|
+
hasState?: boolean;
|
|
713
|
+
canHibernateWebsocket?: boolean;
|
|
714
|
+
stateSaveIntervalMs?: number;
|
|
715
|
+
createStateTimeoutMs?: number;
|
|
716
|
+
onCreateTimeoutMs?: number;
|
|
717
|
+
createVarsTimeoutMs?: number;
|
|
718
|
+
createConnStateTimeoutMs?: number;
|
|
719
|
+
onBeforeConnectTimeoutMs?: number;
|
|
720
|
+
onConnectTimeoutMs?: number;
|
|
721
|
+
onMigrateTimeoutMs?: number;
|
|
722
|
+
onWakeTimeoutMs?: number;
|
|
723
|
+
onBeforeActorStartTimeoutMs?: number;
|
|
724
|
+
actionTimeoutMs?: number;
|
|
725
|
+
onRequestTimeoutMs?: number;
|
|
726
|
+
sleepTimeoutMs?: number;
|
|
727
|
+
noSleep?: boolean;
|
|
728
|
+
sleepGracePeriodMs?: number;
|
|
729
|
+
connectionLivenessTimeoutMs?: number;
|
|
730
|
+
connectionLivenessIntervalMs?: number;
|
|
731
|
+
maxQueueSize?: number;
|
|
732
|
+
maxQueueMessageSize?: number;
|
|
733
|
+
maxIncomingMessageSize?: number;
|
|
734
|
+
maxOutgoingMessageSize?: number;
|
|
735
|
+
preloadMaxWorkflowBytes?: number;
|
|
736
|
+
preloadMaxConnectionsBytes?: number;
|
|
737
|
+
actions?: Array<{
|
|
738
|
+
name: string;
|
|
739
|
+
}>;
|
|
740
|
+
inspectorTabs?: Array<RuntimeInspectorTabEntry>;
|
|
741
|
+
}
|
|
742
|
+
interface RuntimeInspectorTabEntry {
|
|
743
|
+
id: string;
|
|
744
|
+
/** Required for custom entries; omitted for built-in hides. */
|
|
745
|
+
label?: string;
|
|
746
|
+
/**
|
|
747
|
+
* Required for custom entries — absolute path to the source directory.
|
|
748
|
+
* Resolved on the TS side before being handed to the runtime.
|
|
749
|
+
*/
|
|
750
|
+
source?: string;
|
|
751
|
+
/** Optional icon id for custom entries. */
|
|
752
|
+
icon?: string;
|
|
753
|
+
/** Set to true for built-in hide entries. */
|
|
754
|
+
hidden?: boolean;
|
|
755
|
+
}
|
|
756
|
+
interface RuntimeServeConfig {
|
|
757
|
+
version: number;
|
|
758
|
+
endpoint: string;
|
|
759
|
+
token?: string;
|
|
760
|
+
namespace: string;
|
|
761
|
+
poolName: string;
|
|
762
|
+
engineBinaryPath?: string;
|
|
763
|
+
engineHost?: string;
|
|
764
|
+
enginePort?: number;
|
|
765
|
+
handleInspectorHttpInRuntime?: boolean;
|
|
766
|
+
inspectorTestToken?: string;
|
|
767
|
+
serverlessBasePath?: string;
|
|
768
|
+
serverlessPackageVersion: string;
|
|
769
|
+
serverlessClientEndpoint?: string;
|
|
770
|
+
serverlessClientNamespace?: string;
|
|
771
|
+
serverlessClientToken?: string;
|
|
772
|
+
serverlessValidateEndpoint: boolean;
|
|
773
|
+
serverlessMaxStartPayloadBytes: number;
|
|
774
|
+
}
|
|
775
|
+
interface RuntimeListenerConfig {
|
|
776
|
+
port: number;
|
|
777
|
+
host?: string;
|
|
778
|
+
publicDir?: string;
|
|
779
|
+
}
|
|
780
|
+
interface RuntimeServerlessRequest {
|
|
781
|
+
method: string;
|
|
782
|
+
url: string;
|
|
783
|
+
headers: Record<string, string>;
|
|
784
|
+
body: RuntimeBytes;
|
|
785
|
+
}
|
|
786
|
+
interface RuntimeServerlessResponseHead {
|
|
787
|
+
status: number;
|
|
788
|
+
headers: Record<string, string>;
|
|
789
|
+
}
|
|
790
|
+
interface RuntimeRegistryRouteResponse {
|
|
791
|
+
status: number;
|
|
792
|
+
headers: Record<string, string>;
|
|
793
|
+
body: RuntimeBytes;
|
|
794
|
+
}
|
|
795
|
+
type RuntimeServerlessStreamEvent = {
|
|
796
|
+
kind: "chunk";
|
|
797
|
+
chunk?: RuntimeBytes;
|
|
798
|
+
} | {
|
|
799
|
+
kind: "end";
|
|
800
|
+
error?: {
|
|
801
|
+
group: string;
|
|
802
|
+
code: string;
|
|
803
|
+
message: string;
|
|
804
|
+
};
|
|
805
|
+
};
|
|
806
|
+
type RuntimeServerlessStreamCallback = (error: unknown, event?: RuntimeServerlessStreamEvent) => unknown;
|
|
807
|
+
type RuntimeWebSocketEvent = {
|
|
808
|
+
kind: "message";
|
|
809
|
+
data: string | RuntimeBytes;
|
|
810
|
+
binary: boolean;
|
|
811
|
+
messageIndex?: number;
|
|
812
|
+
} | {
|
|
813
|
+
kind: "close";
|
|
814
|
+
code: number;
|
|
815
|
+
reason: string;
|
|
816
|
+
wasClean: boolean;
|
|
817
|
+
};
|
|
818
|
+
interface CoreRuntime {
|
|
819
|
+
readonly kind: "napi" | "wasm";
|
|
820
|
+
createRegistry(): RegistryHandle;
|
|
821
|
+
registerActor(registry: RegistryHandle, name: string, factory: ActorFactoryHandle): void;
|
|
822
|
+
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
823
|
+
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
824
|
+
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
825
|
+
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
826
|
+
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
827
|
+
registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
828
|
+
registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
829
|
+
registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
830
|
+
createActorFactory(callbacks: object, config?: RuntimeActorConfig | undefined | null): ActorFactoryHandle;
|
|
831
|
+
createCancellationToken(): CancellationTokenHandle;
|
|
832
|
+
cancellationTokenAborted(token: CancellationTokenHandle): boolean;
|
|
833
|
+
cancelCancellationToken(token: CancellationTokenHandle): void;
|
|
834
|
+
onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): void;
|
|
835
|
+
actorState(ctx: ActorContextHandle): RuntimeBytes;
|
|
836
|
+
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
837
|
+
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
838
|
+
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
839
|
+
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
840
|
+
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
841
|
+
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
842
|
+
actorDecodeInspectorRequest(ctx: ActorContextHandle, bytes: RuntimeBytes, advertisedVersion: number): RuntimeBytes;
|
|
843
|
+
actorEncodeInspectorResponse(ctx: ActorContextHandle, bytes: RuntimeBytes, targetVersion: number): RuntimeBytes;
|
|
844
|
+
actorVerifyInspectorAuth(ctx: ActorContextHandle, bearerToken?: string | undefined | null): Promise<void>;
|
|
845
|
+
actorQueueHibernationRemoval(ctx: ActorContextHandle, connId: string): void;
|
|
846
|
+
actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
|
|
847
|
+
actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
|
|
848
|
+
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
849
|
+
actorId(ctx: ActorContextHandle): string;
|
|
850
|
+
actorName(ctx: ActorContextHandle): string;
|
|
851
|
+
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
852
|
+
actorRegion(ctx: ActorContextHandle): string;
|
|
853
|
+
actorSleep(ctx: ActorContextHandle): void;
|
|
854
|
+
actorDestroy(ctx: ActorContextHandle): void;
|
|
855
|
+
actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
|
|
856
|
+
actorConns(ctx: ActorContextHandle): ConnHandle[];
|
|
857
|
+
actorConnectConn(ctx: ActorContextHandle, params: RuntimeBytes, request?: RuntimeHttpRequest | undefined | null): Promise<ConnHandle>;
|
|
858
|
+
actorBroadcast(ctx: ActorContextHandle, name: string, args: RuntimeBytes): void;
|
|
859
|
+
actorWaitUntil(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
860
|
+
actorWaitForTrackedShutdownWork(ctx: ActorContextHandle): Promise<boolean>;
|
|
861
|
+
actorWaitForTrackedShutdownWorkUnbounded(ctx: ActorContextHandle): Promise<void>;
|
|
862
|
+
actorKeepAwake(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
863
|
+
actorBeginKeepAwake(ctx: ActorContextHandle): number;
|
|
864
|
+
actorEndKeepAwake(ctx: ActorContextHandle, regionId: number): void;
|
|
865
|
+
actorRegisterTask(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
866
|
+
actorRuntimeState(ctx: ActorContextHandle): object;
|
|
867
|
+
actorClearRuntimeState(ctx: ActorContextHandle): void;
|
|
868
|
+
actorRestartRunHandler(ctx: ActorContextHandle): void;
|
|
869
|
+
actorBeginWebsocketCallback(ctx: ActorContextHandle): number;
|
|
870
|
+
actorEndWebsocketCallback(ctx: ActorContextHandle, regionId: number): void;
|
|
871
|
+
actorKvGet(ctx: ActorContextHandle, key: RuntimeBytes): Promise<RuntimeBytes | null>;
|
|
872
|
+
actorKvPut(ctx: ActorContextHandle, key: RuntimeBytes, value: RuntimeBytes): Promise<void>;
|
|
873
|
+
actorKvDelete(ctx: ActorContextHandle, key: RuntimeBytes): Promise<void>;
|
|
874
|
+
actorKvDeleteRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes): Promise<void>;
|
|
875
|
+
actorKvListPrefix(ctx: ActorContextHandle, prefix: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
876
|
+
actorKvListRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
877
|
+
actorKvBatchGet(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<Array<RuntimeBytes | undefined | null>>;
|
|
878
|
+
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
879
|
+
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
880
|
+
actorSqlExec(ctx: ActorContextHandle, sql: string, lease?: RuntimeSqlLeaseOptions): Promise<RuntimeSqlExecResult>;
|
|
881
|
+
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams, lease?: RuntimeSqlLeaseOptions): Promise<RuntimeSqlExecuteResult>;
|
|
882
|
+
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
883
|
+
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
884
|
+
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
885
|
+
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
886
|
+
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
887
|
+
actorUdsProvision(ctx: ActorContextHandle): Promise<RuntimeActorUdsEndpointInfo>;
|
|
888
|
+
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
889
|
+
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
890
|
+
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
891
|
+
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
892
|
+
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
893
|
+
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
894
|
+
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
895
|
+
actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
|
|
896
|
+
actorQueueReset(ctx: ActorContextHandle): Promise<void>;
|
|
897
|
+
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): void;
|
|
898
|
+
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): void;
|
|
899
|
+
connId(conn: ConnHandle): string;
|
|
900
|
+
connParams(conn: ConnHandle): RuntimeBytes;
|
|
901
|
+
connState(conn: ConnHandle): RuntimeBytes;
|
|
902
|
+
connSetState(conn: ConnHandle, state: RuntimeBytes): void;
|
|
903
|
+
connIsHibernatable(conn: ConnHandle): boolean;
|
|
904
|
+
connSend(conn: ConnHandle, name: string, args: RuntimeBytes): void;
|
|
905
|
+
connDisconnect(conn: ConnHandle, reason?: string | undefined | null): Promise<void>;
|
|
906
|
+
webSocketSend(ws: WebSocketHandle, data: RuntimeBytes, binary: boolean): void;
|
|
907
|
+
webSocketClose(ws: WebSocketHandle, code?: number | undefined | null, reason?: string | undefined | null): Promise<void>;
|
|
908
|
+
webSocketSetEventCallback(ws: WebSocketHandle, callback: (event: RuntimeWebSocketEvent) => void): void;
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
declare function buildConfiguredRegistry(config: RegistryConfig): Promise<{
|
|
912
|
+
runtime: CoreRuntime;
|
|
913
|
+
registry: RegistryHandle;
|
|
914
|
+
serveConfig: RuntimeServeConfig;
|
|
915
|
+
}>;
|
|
916
|
+
|
|
561
917
|
type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
|
|
562
918
|
interface ServerlessHandler {
|
|
563
919
|
fetch: FetchHandler;
|
|
564
920
|
}
|
|
565
|
-
interface
|
|
566
|
-
|
|
567
|
-
|
|
921
|
+
interface RegistryRoutes {
|
|
922
|
+
health(): Promise<Response>;
|
|
923
|
+
metadata(): Promise<Response>;
|
|
924
|
+
prometheusMetrics(request?: Request): Promise<Response>;
|
|
925
|
+
}
|
|
926
|
+
/**
|
|
927
|
+
* Injectable dependencies for {@link Registry}. Production code uses the
|
|
928
|
+
* defaults. Tests override `buildConfiguredRegistry` to drive lifecycle
|
|
929
|
+
* orchestration against a fake `CoreRuntime` without an engine.
|
|
930
|
+
*/
|
|
931
|
+
interface RegistryDeps {
|
|
932
|
+
buildConfiguredRegistry: typeof buildConfiguredRegistry;
|
|
568
933
|
}
|
|
569
934
|
declare class Registry<A extends RegistryActors> {
|
|
570
935
|
#private;
|
|
936
|
+
readonly routes: RegistryRoutes;
|
|
571
937
|
get config(): RegistryConfigInput<A>;
|
|
572
938
|
parseConfig(): RegistryConfig;
|
|
573
|
-
constructor(config: RegistryConfigInput<A>);
|
|
939
|
+
constructor(config: RegistryConfigInput<A>, deps?: Partial<RegistryDeps>);
|
|
574
940
|
/**
|
|
575
941
|
* Handle an incoming HTTP request for serverless deployments.
|
|
576
942
|
*
|
|
@@ -591,11 +957,57 @@ declare class Registry<A extends RegistryActors> {
|
|
|
591
957
|
* ```
|
|
592
958
|
*/
|
|
593
959
|
serve(): ServerlessHandler;
|
|
594
|
-
|
|
960
|
+
/**
|
|
961
|
+
* Bind an HTTP listener provided by the native (Rust) runtime and serve
|
|
962
|
+
* the registry's serverless endpoints over it. Resolves only after the
|
|
963
|
+
* registry is shut down (SIGINT/SIGTERM or `nativeRegistry.shutdown()`).
|
|
964
|
+
*
|
|
965
|
+
* @param opts.port Port to listen on. Defaults to `process.env.RIVET_PORT`
|
|
966
|
+
* if set, otherwise 3000.
|
|
967
|
+
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
968
|
+
* @param opts.publicDir If set, serves static files from this directory
|
|
969
|
+
* as a fallback below the framework routes.
|
|
970
|
+
*
|
|
971
|
+
* @example
|
|
972
|
+
* ```ts
|
|
973
|
+
* await registry.listen();
|
|
974
|
+
* await registry.listen({ port: 8080, publicDir: "./public" });
|
|
975
|
+
* ```
|
|
976
|
+
*/
|
|
977
|
+
listen(opts?: {
|
|
978
|
+
port?: number;
|
|
979
|
+
host?: string;
|
|
980
|
+
publicDir?: string;
|
|
981
|
+
}): Promise<void>;
|
|
982
|
+
/**
|
|
983
|
+
* Gracefully drains all live registries.
|
|
984
|
+
*
|
|
985
|
+
* Programmatic counterpart to the SIGINT/SIGTERM handlers: tears down
|
|
986
|
+
* every live `CoreRegistry` (both `start()` and `handler()` modes) and
|
|
987
|
+
* waits for the serve promise to resolve, all bounded by the shutdown
|
|
988
|
+
* grace period. Unlike a signal-driven shutdown, this does not re-raise a
|
|
989
|
+
* signal or exit the process. The caller owns process lifetime.
|
|
990
|
+
*
|
|
991
|
+
* Idempotent: concurrent or repeated calls share a single drain. Safe to
|
|
992
|
+
* call even if nothing has been started.
|
|
993
|
+
*
|
|
994
|
+
* @example
|
|
995
|
+
* ```ts
|
|
996
|
+
* const registry = setup({ use: { counter } });
|
|
997
|
+
* registry.start();
|
|
998
|
+
* // ...later, on your own shutdown trigger:
|
|
999
|
+
* await registry.shutdown();
|
|
1000
|
+
* ```
|
|
1001
|
+
*/
|
|
1002
|
+
shutdown(): Promise<void>;
|
|
595
1003
|
startEnvoy(): void;
|
|
596
1004
|
/**
|
|
597
1005
|
* Starts the actor envoy for standalone server deployments.
|
|
598
1006
|
*
|
|
1007
|
+
* Set `RIVETKIT_RUNTIME_MODE=serverless` to instead bind an HTTP listener
|
|
1008
|
+
* via `listen()` (Mode B). Mode A (envoy) and Mode B (listener) are
|
|
1009
|
+
* mutually exclusive per registry instance.
|
|
1010
|
+
*
|
|
599
1011
|
* @example
|
|
600
1012
|
* ```ts
|
|
601
1013
|
* const registry = setup({ use: { counter } });
|
|
@@ -631,8 +1043,13 @@ interface QueueSendResult<TResponse = unknown> {
|
|
|
631
1043
|
* @returns {Promise<Response>}
|
|
632
1044
|
*/
|
|
633
1045
|
type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unknown> = (...args: Args extends [unknown, ...infer Rest] ? Rest : Args) => Promise<Response>;
|
|
1046
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
1047
|
+
type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => void) => () => void;
|
|
1048
|
+
type ActorActionMap<R> = {
|
|
1049
|
+
[K in keyof NonNullable<R>]: NonNullable<R>[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Awaited<Return>> : never;
|
|
1050
|
+
};
|
|
1051
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? R : never;
|
|
634
1052
|
interface ActorGatewayOptions {
|
|
635
|
-
bypassConnectable?: boolean;
|
|
636
1053
|
skipReadyWait?: boolean;
|
|
637
1054
|
}
|
|
638
1055
|
interface ActorActionOptions extends ActorGatewayOptions {
|
|
@@ -644,9 +1061,7 @@ type ActorWebSocketOptions = ActorGatewayOptions;
|
|
|
644
1061
|
/**
|
|
645
1062
|
* Maps action methods from actor definition to typed function signatures.
|
|
646
1063
|
*/
|
|
647
|
-
type ActorDefinitionActions<AD extends AnyActorDefinition> = AD extends
|
|
648
|
-
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
649
|
-
} : never;
|
|
1064
|
+
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
|
|
650
1065
|
type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
|
|
651
1066
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
|
|
652
1067
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
|
|
@@ -657,13 +1072,31 @@ type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
|
|
|
657
1072
|
<K extends keyof TEvents & string>(eventName: K, callback: (...args: InferEventArgs<InferSchemaMap<TEvents>[K]>) => void): () => void;
|
|
658
1073
|
(eventName: keyof TEvents extends never ? string : never, callback: (...args: any[]) => void): () => void;
|
|
659
1074
|
};
|
|
660
|
-
type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = AD
|
|
1075
|
+
type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
|
|
1076
|
+
send: ActorQueueSend<Record<string, any>>;
|
|
1077
|
+
} : AD extends {
|
|
1078
|
+
config: {
|
|
1079
|
+
queues?: infer Q;
|
|
1080
|
+
};
|
|
1081
|
+
} ? Q extends QueueSchemaConfig ? {
|
|
661
1082
|
send: ActorQueueSend<Q>;
|
|
662
|
-
} :
|
|
663
|
-
|
|
1083
|
+
} : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, any, infer Q, any> ? Q extends QueueSchemaConfig ? {
|
|
1084
|
+
send: ActorQueueSend<Q>;
|
|
1085
|
+
} : {} : {};
|
|
1086
|
+
type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
|
|
1087
|
+
on: LooseEventSubscribe;
|
|
1088
|
+
once: LooseEventSubscribe;
|
|
1089
|
+
} : AD extends {
|
|
1090
|
+
config: {
|
|
1091
|
+
events?: infer E;
|
|
1092
|
+
};
|
|
1093
|
+
} ? E extends EventSchemaConfig ? {
|
|
1094
|
+
on: ActorEventSubscribe<E>;
|
|
1095
|
+
once: ActorEventSubscribe<E>;
|
|
1096
|
+
} : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, infer E, any, any> ? E extends EventSchemaConfig ? {
|
|
664
1097
|
on: ActorEventSubscribe<E>;
|
|
665
1098
|
once: ActorEventSubscribe<E>;
|
|
666
|
-
} :
|
|
1099
|
+
} : {} : {};
|
|
667
1100
|
|
|
668
1101
|
type ActorResolutionState = ActorQuery;
|
|
669
1102
|
|
|
@@ -1121,6 +1554,7 @@ declare function createClientWithDriver<A extends Registry<any>>(driver: EngineC
|
|
|
1121
1554
|
|
|
1122
1555
|
declare const DEFAULT_SLEEP_GRACE_PERIOD = 15000;
|
|
1123
1556
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
1557
|
+
declare const RAW_STATE_SYMBOL: unique symbol;
|
|
1124
1558
|
declare const CONN_DRIVER_SYMBOL: unique symbol;
|
|
1125
1559
|
declare const CONN_STATE_MANAGER_SYMBOL: unique symbol;
|
|
1126
1560
|
interface ActorLogger {
|
|
@@ -1155,6 +1589,10 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
1155
1589
|
limit?: number;
|
|
1156
1590
|
};
|
|
1157
1591
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
1592
|
+
/**
|
|
1593
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db` / `c.sql`)
|
|
1594
|
+
* or actor state instead.
|
|
1595
|
+
*/
|
|
1158
1596
|
interface ActorKv {
|
|
1159
1597
|
get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
|
|
1160
1598
|
put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
|
|
@@ -1237,7 +1675,7 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
1237
1675
|
iter<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueIterOptions<TName, TCompletable>): AsyncIterable<any>;
|
|
1238
1676
|
[key: string]: any;
|
|
1239
1677
|
}
|
|
1240
|
-
interface Conn<
|
|
1678
|
+
interface Conn<_TState = unknown, TConnParams = unknown, TConnState = unknown, _TVars = unknown, _TInput = unknown, _TDatabase extends AnyDatabaseProvider = AnyDatabaseProvider, _TEvents extends EventSchemaConfig = Record<never, never>, _TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
1241
1679
|
id: string;
|
|
1242
1680
|
params: TConnParams;
|
|
1243
1681
|
state: TConnState;
|
|
@@ -1249,8 +1687,14 @@ interface Conn<TState = unknown, TConnParams = unknown, TConnState = unknown, TV
|
|
|
1249
1687
|
type AnyConn = Conn<any, any, any, any, any, any, any, any>;
|
|
1250
1688
|
interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
1251
1689
|
[ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
|
|
1690
|
+
/** Returns the raw unwrapped state without the write-through proxy. */
|
|
1691
|
+
[RAW_STATE_SYMBOL](): TState;
|
|
1252
1692
|
state: TState;
|
|
1253
1693
|
vars: TVars;
|
|
1694
|
+
/**
|
|
1695
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db` / `sql`)
|
|
1696
|
+
* or actor state instead.
|
|
1697
|
+
*/
|
|
1254
1698
|
readonly kv: ActorKv;
|
|
1255
1699
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1256
1700
|
readonly schedule: ActorSchedule;
|
|
@@ -1259,6 +1703,11 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1259
1703
|
readonly name: string;
|
|
1260
1704
|
readonly key: string[];
|
|
1261
1705
|
readonly region: string;
|
|
1706
|
+
/** Provisions credentials for the experimental local actor Unix socket API. */
|
|
1707
|
+
actorUds(): Promise<{
|
|
1708
|
+
path: string;
|
|
1709
|
+
token: string;
|
|
1710
|
+
}>;
|
|
1262
1711
|
readonly conns: Map<string, Conn<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>>;
|
|
1263
1712
|
readonly log: ActorLogger;
|
|
1264
1713
|
readonly abortSignal: AbortSignal;
|
|
@@ -1316,6 +1765,75 @@ interface WorkflowInspectorConfig<THistory = unknown> {
|
|
|
1316
1765
|
interface RunInspectorConfig<THistory = unknown> {
|
|
1317
1766
|
workflow?: WorkflowInspectorConfig<THistory>;
|
|
1318
1767
|
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Built-in inspector tabs the dashboard ships. Used to validate
|
|
1770
|
+
* `hidden: true` entries and reject custom-tab ids that collide with
|
|
1771
|
+
* a built-in.
|
|
1772
|
+
*/
|
|
1773
|
+
declare const BUILTIN_INSPECTOR_TAB_IDS: readonly ["workflow", "database", "state", "queue", "connections", "console"];
|
|
1774
|
+
declare const BuiltinInspectorTabIdSchema: z.ZodEnum<{
|
|
1775
|
+
workflow: "workflow";
|
|
1776
|
+
state: "state";
|
|
1777
|
+
database: "database";
|
|
1778
|
+
queue: "queue";
|
|
1779
|
+
connections: "connections";
|
|
1780
|
+
console: "console";
|
|
1781
|
+
}>;
|
|
1782
|
+
declare const CustomInspectorTabEntrySchema: z.ZodObject<{
|
|
1783
|
+
id: z.ZodString;
|
|
1784
|
+
label: z.ZodString;
|
|
1785
|
+
source: z.ZodString;
|
|
1786
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1787
|
+
hidden: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1788
|
+
}, z.core.$strict>;
|
|
1789
|
+
declare const HideInspectorTabEntrySchema: z.ZodObject<{
|
|
1790
|
+
id: z.ZodEnum<{
|
|
1791
|
+
workflow: "workflow";
|
|
1792
|
+
state: "state";
|
|
1793
|
+
database: "database";
|
|
1794
|
+
queue: "queue";
|
|
1795
|
+
connections: "connections";
|
|
1796
|
+
console: "console";
|
|
1797
|
+
}>;
|
|
1798
|
+
hidden: z.ZodLiteral<true>;
|
|
1799
|
+
}, z.core.$strict>;
|
|
1800
|
+
declare const InspectorTabEntrySchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
1801
|
+
id: z.ZodString;
|
|
1802
|
+
label: z.ZodString;
|
|
1803
|
+
source: z.ZodString;
|
|
1804
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1805
|
+
hidden: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1806
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1807
|
+
id: z.ZodEnum<{
|
|
1808
|
+
workflow: "workflow";
|
|
1809
|
+
state: "state";
|
|
1810
|
+
database: "database";
|
|
1811
|
+
queue: "queue";
|
|
1812
|
+
connections: "connections";
|
|
1813
|
+
console: "console";
|
|
1814
|
+
}>;
|
|
1815
|
+
hidden: z.ZodLiteral<true>;
|
|
1816
|
+
}, z.core.$strict>]>;
|
|
1817
|
+
declare const ActorInspectorConfigSchema: z.ZodObject<{
|
|
1818
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1819
|
+
id: z.ZodString;
|
|
1820
|
+
label: z.ZodString;
|
|
1821
|
+
source: z.ZodString;
|
|
1822
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1823
|
+
hidden: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1824
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1825
|
+
id: z.ZodEnum<{
|
|
1826
|
+
workflow: "workflow";
|
|
1827
|
+
state: "state";
|
|
1828
|
+
database: "database";
|
|
1829
|
+
queue: "queue";
|
|
1830
|
+
connections: "connections";
|
|
1831
|
+
console: "console";
|
|
1832
|
+
}>;
|
|
1833
|
+
hidden: z.ZodLiteral<true>;
|
|
1834
|
+
}, z.core.$strict>]>>>;
|
|
1835
|
+
}, z.core.$strict>;
|
|
1836
|
+
type ActorInspectorConfig = z.input<typeof ActorInspectorConfigSchema>;
|
|
1319
1837
|
declare const RunConfigSchema: z.ZodObject<{
|
|
1320
1838
|
name: z.ZodOptional<z.ZodString>;
|
|
1321
1839
|
icon: z.ZodOptional<z.ZodString>;
|
|
@@ -1343,6 +1861,8 @@ declare function getRunMetadata(run: ((...args: any[]) => any) | AnyRunConfig |
|
|
|
1343
1861
|
};
|
|
1344
1862
|
/** Extract run inspector configuration if provided. */
|
|
1345
1863
|
declare function getRunInspectorConfig(run: ((...args: any[]) => any) | AnyRunConfig | undefined, actor?: unknown): RunInspectorConfig | undefined;
|
|
1864
|
+
/** Release per-actor inspector state for a destroyed actor, if the run handler registered a disposer. */
|
|
1865
|
+
declare function disposeRunInspector(run: ((...args: any[]) => any) | AnyRunConfig | undefined, actorId: string): void;
|
|
1346
1866
|
declare const GlobalActorOptionsSchema: z.ZodPrefault<z.ZodObject<{
|
|
1347
1867
|
name: z.ZodOptional<z.ZodString>;
|
|
1348
1868
|
icon: z.ZodOptional<z.ZodString>;
|
|
@@ -1457,8 +1977,27 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
1457
1977
|
preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
|
|
1458
1978
|
preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
|
|
1459
1979
|
}, z.core.$strict>>;
|
|
1980
|
+
inspector: z.ZodOptional<z.ZodObject<{
|
|
1981
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1982
|
+
id: z.ZodString;
|
|
1983
|
+
label: z.ZodString;
|
|
1984
|
+
source: z.ZodString;
|
|
1985
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1986
|
+
hidden: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1987
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1988
|
+
id: z.ZodEnum<{
|
|
1989
|
+
workflow: "workflow";
|
|
1990
|
+
state: "state";
|
|
1991
|
+
database: "database";
|
|
1992
|
+
queue: "queue";
|
|
1993
|
+
connections: "connections";
|
|
1994
|
+
console: "console";
|
|
1995
|
+
}>;
|
|
1996
|
+
hidden: z.ZodLiteral<true>;
|
|
1997
|
+
}, z.core.$strict>]>>>;
|
|
1998
|
+
}, z.core.$strict>>;
|
|
1460
1999
|
}, z.core.$strict>;
|
|
1461
|
-
type CreateState<TState,
|
|
2000
|
+
type CreateState<TState, _TConnParams, _TConnState, _TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
1462
2001
|
state: TState;
|
|
1463
2002
|
} | {
|
|
1464
2003
|
createState: (c: CreateContext<TState, TInput, TDatabase, TEvents, TQueues>, input: TInput) => TState | Promise<TState>;
|
|
@@ -1471,7 +2010,7 @@ type CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase e
|
|
|
1471
2010
|
/**
|
|
1472
2011
|
* @experimental
|
|
1473
2012
|
*/
|
|
1474
|
-
type CreateVars<TState,
|
|
2013
|
+
type CreateVars<TState, _TConnParams, _TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
1475
2014
|
/**
|
|
1476
2015
|
* @experimental
|
|
1477
2016
|
*/
|
|
@@ -1543,7 +2082,7 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
1543
2082
|
* shutdown window (`sleepGracePeriod`) cover deferred work.
|
|
1544
2083
|
*
|
|
1545
2084
|
* The handler receives an abort signal via `c.abortSignal` and a
|
|
1546
|
-
* `c.aborted` alias
|
|
2085
|
+
* `c.aborted` alias. Use these to gracefully exit when shutdown starts.
|
|
1547
2086
|
*
|
|
1548
2087
|
* If this handler exits, the actor will follow the normal idle sleep timeout
|
|
1549
2088
|
* once it becomes idle.
|
|
@@ -1572,10 +2111,11 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
1572
2111
|
* Called before a client connects to the actor.
|
|
1573
2112
|
*
|
|
1574
2113
|
* Use this hook to determine if a connection should be accepted
|
|
1575
|
-
* and to
|
|
2114
|
+
* and to validate client-provided parameters. The pending connection
|
|
2115
|
+
* is not visible in `c.conns` while this hook runs.
|
|
1576
2116
|
*
|
|
1577
2117
|
* @param opts Connection parameters including client-provided data
|
|
1578
|
-
* @returns
|
|
2118
|
+
* @returns Void or a Promise.
|
|
1579
2119
|
* @throws Throw an error to reject the connection
|
|
1580
2120
|
*/
|
|
1581
2121
|
onBeforeConnect?: (c: BeforeConnectContext<TState, TVars, TInput, TDatabase, TEvents, TQueues>, params: TConnParams) => void | Promise<void>;
|
|
@@ -1583,7 +2123,8 @@ interface BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatab
|
|
|
1583
2123
|
* Called when a client successfully connects to the actor.
|
|
1584
2124
|
*
|
|
1585
2125
|
* Use this hook to perform actions when a connection is established,
|
|
1586
|
-
* such as sending initial data or updating the actor's state.
|
|
2126
|
+
* such as sending initial data or updating the actor's state. The
|
|
2127
|
+
* connection is visible in `c.conns` before this hook runs.
|
|
1587
2128
|
*
|
|
1588
2129
|
* @param conn The connection object
|
|
1589
2130
|
* @returns Void or a Promise that resolves when connection handling is complete
|
|
@@ -1659,7 +2200,7 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
|
|
|
1659
2200
|
*/
|
|
1660
2201
|
db: TDatabase;
|
|
1661
2202
|
} | Record<never, never>;
|
|
1662
|
-
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = Omit<z.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues,
|
|
2203
|
+
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues>> = Omit<z.infer<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
|
|
1663
2204
|
type ActorConfigInput<TState = undefined, TConnParams = undefined, TConnState = undefined, TVars = undefined, TInput = undefined, TDatabase extends AnyDatabaseProvider = undefined, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>, TActions extends Actions<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> = Record<never, never>> = {
|
|
1664
2205
|
types?: ActorTypes<TState, TConnParams, TConnState, TVars, TInput, TDatabase>;
|
|
1665
2206
|
} & Omit<z.input<typeof ActorConfigSchema>, "actions" | "events" | "queues" | "onCreate" | "onDestroy" | "onMigrate" | "onWake" | "onSleep" | "run" | "onStateChange" | "onBeforeConnect" | "onConnect" | "onDisconnect" | "onBeforeActionResponse" | "onRequest" | "onWebSocket" | "state" | "createState" | "connState" | "createConnState" | "vars" | "createVars" | "db"> & BaseActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues, TActions> & CreateState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & CreateVars<TState, TConnParams, TConnState, TVars, TInput, TDatabase, TEvents, TQueues> & ActorDatabaseConfig<TDatabase>;
|
|
@@ -1738,4 +2279,4 @@ declare const DocActorConfigSchema: z.ZodObject<{
|
|
|
1738
2279
|
}, z.core.$strip>>;
|
|
1739
2280
|
}, z.core.$strip>;
|
|
1740
2281
|
|
|
1741
|
-
export {
|
|
2282
|
+
export { type Conn as $, type AnyActorDefinition as A, type BaseActorDefinition as B, type ConnectContext as C, type DestroyContext as D, type EventSchemaConfig as E, type ActorQuery as F, type ActorQueue as G, type ActorSchedule as H, type ActorTypes as I, ActorsSchema as J, type AnyActorInstance as K, type AnyClient as L, type MigrateContext as M, type AnyConn as N, type AnyStaticActorDefinition as O, type AnyStaticActorInstance as P, type QueueSchemaConfig as Q, type RequestContext as R, type SleepContext as S, type AuthIntent as T, BUILTIN_INSPECTOR_TAB_IDS as U, type BaseActorInstance as V, type WakeContext as W, BuiltinInspectorTabIdSchema as X, CONN_DRIVER_SYMBOL as Y, CONN_STATE_MANAGER_SYMBOL as Z, type Client as _, type ActionContext as a, getRunFunction as a$, CustomInspectorTabEntrySchema as a0, DEFAULT_SLEEP_GRACE_PERIOD as a1, DocActorConfigSchema as a2, DocActorOptionsSchema as a3, DocConfigurePoolSchema as a4, DocEnvoyConfigSchema as a5, DocRegistryConfigSchema as a6, DocServerlessConfigSchema as a7, DocSqliteConfigSchema as a8, type Encoding as a9, type RegistryConfigInput as aA, RegistryConfigSchema as aB, type RegistryDeps as aC, type RegistryRoutes as aD, type RunConfig as aE, RunConfigSchema as aF, type RunInspectorConfig as aG, type RuntimeKind as aH, RuntimeKindSchema as aI, type ServerlessHandler as aJ, type SqliteBackend as aK, SqliteBackendSchema as aL, type SqliteConfig as aM, SqliteConfigSchema as aN, type TestConfig as aO, TestConfigSchema as aP, type Type as aQ, type WasmRuntimeBindings as aR, type WasmRuntimeConfig as aS, WasmRuntimeConfigSchema as aT, type WasmRuntimeInitInput as aU, type WorkflowInspectorConfig as aV, actor as aW, buildActorNames as aX, createClientWithDriver as aY, disposeRunInspector as aZ, event as a_, type FetchHandler as aa, type GlobalActorOptions as ab, type GlobalActorOptionsInput as ac, GlobalActorOptionsSchema as ad, HideInspectorTabEntrySchema as ae, InspectorTabEntrySchema as af, type InspectorUnsubscribe as ag, type InstanceActorOptions as ah, type InstanceActorOptionsInput as ai, InstanceActorOptionsSchema as aj, type QueueEnqueueAndWaitOptions as ak, type QueueFilterName as al, type QueueIterOptions as am, type QueueMessageOf as an, type QueueName as ao, type QueueNextBatchOptions as ap, type QueueNextOptions as aq, type QueueResultMessageForName as ar, type QueueTryNextBatchOptions as as, type QueueTryNextOptions as at, type QueueWaitOptions as au, RAW_STATE_SYMBOL as av, RUN_FUNCTION_CONFIG_SYMBOL as aw, Registry as ax, type RegistryActors as ay, type RegistryConfig as az, type BeforeActionResponseContext as b, getRunInspectorConfig as b0, getRunMetadata as b1, isStaticActorDefinition as b2, isStaticActorInstance as b3, lookupInRegistry as b4, queue as b5, setup as b6, test as b7, type ActorAccessor as b8, type ActorActionFunction as b9, type ActorActionOptions as ba, type ActorConn as bb, ActorConnRaw as bc, type ActorConnStatus as bd, type ActorConnectOptions as be, type ActorGatewayOptions as bf, type ActorHandle as bg, ActorHandleRaw as bh, ClientRaw as bi, type ConnectionStateCallback as bj, type CreateOptions as bk, type CreateRequest as bl, type EventUnsubscribe as bm, type ExtractActorsFromRegistry as bn, type ExtractRegistryFromClient as bo, type GetOptions as bp, type GetWithIdOptions as bq, type QueryOptions as br, type Region as bs, type StatusChangeCallback as bt, type InferEventArgs as bu, type InferSchemaMap as bv, 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 Actions as l, type ActorConfig as m, type ActorConfigInput as n, ActorConfigSchema as o, type ActorContext as p, type ActorContextOf as q, ActorDefinition as r, type ActorInspectorConfig as s, ActorInspectorConfigSchema as t, type ActorKey as u, type ActorKv as v, type ActorLogger as w, type ActorOptions as x, type ActorOptionsInput as y, ActorOptionsSchema as z };
|