rivetkit 2.3.0-rc.11 → 2.3.0-rc.13
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 +407 -20
- package/dist/browser/client.js +101 -86
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +12 -2
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/agent-os/index.cjs +66 -3
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +404 -17
- package/dist/tsup/agent-os/index.d.ts +404 -17
- package/dist/tsup/agent-os/index.js +66 -3
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-WXYWDLJY.js → chunk-33YE6XCI.js} +4 -4
- package/dist/tsup/{chunk-2NXFKPRB.cjs → chunk-7OR3CHD5.cjs} +10 -10
- package/dist/tsup/{chunk-2NXFKPRB.cjs.map → chunk-7OR3CHD5.cjs.map} +1 -1
- package/dist/tsup/{chunk-LW5HNCWD.cjs → chunk-7XQCARVY.cjs} +3 -3
- package/dist/tsup/{chunk-LW5HNCWD.cjs.map → chunk-7XQCARVY.cjs.map} +1 -1
- package/dist/tsup/{chunk-GX6W4MW3.cjs → chunk-BSPS6NSN.cjs} +5 -5
- package/dist/tsup/{chunk-GX6W4MW3.cjs.map → chunk-BSPS6NSN.cjs.map} +1 -1
- package/dist/tsup/{chunk-T3VCJ4PV.js → chunk-DPIMKYNB.js} +61 -2
- package/dist/tsup/chunk-DPIMKYNB.js.map +1 -0
- package/dist/tsup/{chunk-XG25CGSW.cjs → chunk-E5CLYAUZ.cjs} +146 -143
- package/dist/tsup/chunk-E5CLYAUZ.cjs.map +1 -0
- package/dist/tsup/{chunk-RDBGKI66.cjs → chunk-EBWOJRCC.cjs} +22 -5
- package/dist/tsup/chunk-EBWOJRCC.cjs.map +1 -0
- package/dist/tsup/{chunk-YRQ4F5CD.js → chunk-HHNYEQD3.js} +6 -6
- package/dist/tsup/chunk-HHNYEQD3.js.map +1 -0
- package/dist/tsup/{chunk-4FP4FFB5.js → chunk-IOUSQVXI.js} +21 -4
- package/dist/tsup/chunk-IOUSQVXI.js.map +1 -0
- package/dist/tsup/{chunk-LNP7Q6I6.cjs → chunk-ISDKSSYR.cjs} +4 -4
- package/dist/tsup/{chunk-LNP7Q6I6.cjs.map → chunk-ISDKSSYR.cjs.map} +1 -1
- package/dist/tsup/{chunk-TTLUIDVH.js → chunk-J72WHUBC.js} +12 -9
- package/dist/tsup/chunk-J72WHUBC.js.map +1 -0
- package/dist/tsup/{chunk-Y3JBOFBG.cjs → chunk-KWABEUUA.cjs} +10 -10
- package/dist/tsup/chunk-KWABEUUA.cjs.map +1 -0
- package/dist/tsup/{chunk-XCDCURZ4.cjs → chunk-NIY3RSPX.cjs} +62 -3
- package/dist/tsup/chunk-NIY3RSPX.cjs.map +1 -0
- package/dist/tsup/{chunk-3P2JUHWJ.js → chunk-T44AVAGW.js} +2 -2
- package/dist/tsup/{chunk-GRFBV2U7.js → chunk-TCXEM6PA.js} +2 -2
- package/dist/tsup/{chunk-KRC4L3YB.js → chunk-ZI5CNA2Z.js} +2 -2
- package/dist/tsup/client/mod.cjs +7 -7
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +3 -3
- package/dist/tsup/client/mod.d.ts +3 -3
- package/dist/tsup/client/mod.js +6 -6
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-De5UVu0V.d.ts → config-BxWAw3iH.d.ts} +476 -20
- package/dist/tsup/{config-CTwe3WwC.d.cts → config-CZQQ-mso.d.cts} +476 -20
- package/dist/tsup/{context-Dmj477Uh.d.cts → context-Bw7xq8w3.d.cts} +1 -1
- package/dist/tsup/{context-DPHISlUi.d.ts → context-D8QA76sV.d.ts} +1 -1
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +2 -2
- package/dist/tsup/dynamic/mod.d.ts +2 -2
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector-tab/mod.cjs +173 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +250 -0
- package/dist/tsup/inspector-tab/mod.d.ts +250 -0
- package/dist/tsup/inspector-tab/mod.js +173 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +341 -138
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +4 -4
- package/dist/tsup/mod.d.ts +4 -4
- package/dist/tsup/mod.js +277 -74
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +10 -10
- package/dist/tsup/test/mod.d.cts +2 -2
- package/dist/tsup/test/mod.d.ts +2 -2
- package/dist/tsup/test/mod.js +6 -6
- package/dist/tsup/{utils-DVekpm4I.d.ts → utils-DQosb24I.d.cts} +1 -1
- package/dist/tsup/{utils-DVekpm4I.d.cts → utils-DQosb24I.d.ts} +1 -1
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +11 -11
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +4 -4
- package/dist/tsup/workflow/mod.d.ts +4 -4
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +19 -9
- package/src/actor/config.ts +111 -10
- package/src/actor/definition.ts +6 -5
- package/src/actor/instance/mod.ts +4 -4
- package/src/actor/mod.ts +2 -0
- package/src/client/actor-common.ts +24 -27
- package/src/client/actor-handle.ts +2 -1
- package/src/common/engine.ts +28 -1
- package/src/common/utils.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 +16 -5
- package/src/engine-client/actor-http-client.ts +2 -2
- package/src/engine-client/api-endpoints.ts +5 -1
- package/src/engine-client/ws-proxy.ts +5 -0
- package/src/inspector-tab/mod.ts +315 -0
- package/src/registry/config/index.ts +40 -16
- package/src/registry/index.ts +143 -62
- package/src/registry/napi-runtime.ts +6 -0
- package/src/registry/native.ts +170 -27
- package/src/registry/process-metrics.ts +16 -4
- package/src/registry/runtime.ts +26 -0
- package/src/registry/wasm-runtime.ts +16 -1
- package/src/utils/env-vars.ts +6 -0
- package/dist/tsup/chunk-4FP4FFB5.js.map +0 -1
- package/dist/tsup/chunk-RDBGKI66.cjs.map +0 -1
- package/dist/tsup/chunk-T3VCJ4PV.js.map +0 -1
- package/dist/tsup/chunk-TTLUIDVH.js.map +0 -1
- package/dist/tsup/chunk-XCDCURZ4.cjs.map +0 -1
- package/dist/tsup/chunk-XG25CGSW.cjs.map +0 -1
- package/dist/tsup/chunk-Y3JBOFBG.cjs.map +0 -1
- package/dist/tsup/chunk-YRQ4F5CD.js.map +0 -1
- /package/dist/tsup/{chunk-WXYWDLJY.js.map → chunk-33YE6XCI.js.map} +0 -0
- /package/dist/tsup/{chunk-3P2JUHWJ.js.map → chunk-T44AVAGW.js.map} +0 -0
- /package/dist/tsup/{chunk-GRFBV2U7.js.map → chunk-TCXEM6PA.js.map} +0 -0
- /package/dist/tsup/{chunk-KRC4L3YB.js.map → chunk-ZI5CNA2Z.js.map} +0 -0
package/dist/browser/client.d.ts
CHANGED
|
@@ -385,6 +385,10 @@ interface QueueSendResult<TResponse = unknown> {
|
|
|
385
385
|
type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unknown> = (...args: Args extends [unknown, ...infer Rest] ? Rest : Args) => Promise<Response>;
|
|
386
386
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
387
387
|
type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => void) => () => void;
|
|
388
|
+
type ActorActionMap<R> = {
|
|
389
|
+
[K in keyof NonNullable<R>]: NonNullable<R>[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Awaited<Return>> : never;
|
|
390
|
+
};
|
|
391
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? R : never;
|
|
388
392
|
interface ActorGatewayOptions {
|
|
389
393
|
skipReadyWait?: boolean;
|
|
390
394
|
}
|
|
@@ -397,15 +401,7 @@ type ActorWebSocketOptions = ActorGatewayOptions;
|
|
|
397
401
|
/**
|
|
398
402
|
* Maps action methods from actor definition to typed function signatures.
|
|
399
403
|
*/
|
|
400
|
-
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : AD
|
|
401
|
-
config: {
|
|
402
|
-
actions?: infer R;
|
|
403
|
-
};
|
|
404
|
-
} ? {
|
|
405
|
-
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
406
|
-
} : AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? {
|
|
407
|
-
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
408
|
-
} : {};
|
|
404
|
+
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
|
|
409
405
|
type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
|
|
410
406
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
|
|
411
407
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
|
|
@@ -987,6 +983,10 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
987
983
|
limit?: number;
|
|
988
984
|
};
|
|
989
985
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
986
|
+
/**
|
|
987
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db` / `c.sql`)
|
|
988
|
+
* or actor state instead.
|
|
989
|
+
*/
|
|
990
990
|
interface ActorKv {
|
|
991
991
|
get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
|
|
992
992
|
put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
|
|
@@ -1078,6 +1078,10 @@ interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase
|
|
|
1078
1078
|
[RAW_STATE_SYMBOL](): TState;
|
|
1079
1079
|
state: TState;
|
|
1080
1080
|
vars: TVars;
|
|
1081
|
+
/**
|
|
1082
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db` / `sql`)
|
|
1083
|
+
* or actor state instead.
|
|
1084
|
+
*/
|
|
1081
1085
|
readonly kv: ActorKv;
|
|
1082
1086
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1083
1087
|
readonly schedule: ActorSchedule;
|
|
@@ -1202,6 +1206,25 @@ declare const ActorConfigSchema: z.ZodObject<{
|
|
|
1202
1206
|
preloadMaxWorkflowBytes: z.ZodOptional<z.ZodNumber>;
|
|
1203
1207
|
preloadMaxConnectionsBytes: z.ZodOptional<z.ZodNumber>;
|
|
1204
1208
|
}, z.core.$strict>>;
|
|
1209
|
+
inspector: z.ZodOptional<z.ZodObject<{
|
|
1210
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
1211
|
+
id: z.ZodString;
|
|
1212
|
+
label: z.ZodString;
|
|
1213
|
+
source: z.ZodString;
|
|
1214
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
1215
|
+
hidden: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1216
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1217
|
+
id: z.ZodEnum<{
|
|
1218
|
+
state: "state";
|
|
1219
|
+
queue: "queue";
|
|
1220
|
+
workflow: "workflow";
|
|
1221
|
+
database: "database";
|
|
1222
|
+
connections: "connections";
|
|
1223
|
+
console: "console";
|
|
1224
|
+
}>;
|
|
1225
|
+
hidden: z.ZodLiteral<true>;
|
|
1226
|
+
}, z.core.$strict>]>>>;
|
|
1227
|
+
}, z.core.$strict>>;
|
|
1205
1228
|
}, z.core.$strict>;
|
|
1206
1229
|
type CreateState<TState, _TConnParams, _TConnState, _TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
1207
1230
|
state: TState;
|
|
@@ -1402,18 +1425,18 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
|
|
|
1402
1425
|
*/
|
|
1403
1426
|
db: TDatabase;
|
|
1404
1427
|
} | Record<never, never>;
|
|
1405
|
-
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,
|
|
1428
|
+
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>;
|
|
1406
1429
|
|
|
1407
1430
|
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>> {
|
|
1408
|
-
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
1431
|
+
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q, _R>;
|
|
1409
1432
|
}
|
|
1410
1433
|
interface AnyActorDefinition {
|
|
1411
1434
|
readonly config: any;
|
|
1412
1435
|
}
|
|
1413
1436
|
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> {
|
|
1414
1437
|
#private;
|
|
1415
|
-
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>);
|
|
1416
|
-
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
1438
|
+
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>);
|
|
1439
|
+
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q, R>;
|
|
1417
1440
|
}
|
|
1418
1441
|
|
|
1419
1442
|
declare const ActorsSchema: z$2.ZodRecord<z$2.ZodString, z$2.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
|
|
@@ -1436,7 +1459,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1436
1459
|
}>>, z$2.ZodTransform<"auto" | "native" | "wasm", "auto" | "native" | "wasm" | undefined>>;
|
|
1437
1460
|
wasm: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
1438
1461
|
bindings: z$2.ZodOptional<z$2.ZodCustom<typeof _rivetkit_rivetkit_wasm, typeof _rivetkit_rivetkit_wasm>>;
|
|
1439
|
-
initInput: z$2.ZodOptional<z$2.ZodCustom<
|
|
1462
|
+
initInput: z$2.ZodOptional<z$2.ZodCustom<_rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined, _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined>>;
|
|
1440
1463
|
}, z$2.core.$strip>>>;
|
|
1441
1464
|
sqlite: z$2.ZodPipe<z$2.ZodOptional<z$2.ZodUnion<readonly [z$2.ZodEnum<{
|
|
1442
1465
|
local: "local";
|
|
@@ -1473,6 +1496,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1473
1496
|
httpPort: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodNumber>>;
|
|
1474
1497
|
httpHost: z$2.ZodOptional<z$2.ZodString>;
|
|
1475
1498
|
startEngine: z$2.ZodDefault<z$2.ZodBoolean>;
|
|
1499
|
+
engineHost: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodString>>;
|
|
1500
|
+
enginePort: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodNumber>>;
|
|
1476
1501
|
engineVersion: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodString>>;
|
|
1477
1502
|
configurePool: z$2.ZodOptional<z$2.ZodOptional<z$2.ZodObject<{
|
|
1478
1503
|
name: z$2.ZodOptional<z$2.ZodString>;
|
|
@@ -1497,7 +1522,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1497
1522
|
envoyKey: z$2.ZodOptional<z$2.ZodString>;
|
|
1498
1523
|
}, z$2.core.$strip>>>;
|
|
1499
1524
|
shutdown: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
|
|
1500
|
-
gracePeriodMs: z$2.
|
|
1525
|
+
gracePeriodMs: z$2.ZodOptional<z$2.ZodNumber>;
|
|
1501
1526
|
disableSignalHandlers: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodBoolean>>;
|
|
1502
1527
|
}, z$2.core.$strip>>>;
|
|
1503
1528
|
}, z$2.core.$strip>, z$2.ZodTransform<{
|
|
@@ -1527,7 +1552,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1527
1552
|
runtime: "auto" | "native" | "wasm";
|
|
1528
1553
|
wasm: {
|
|
1529
1554
|
bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
|
|
1530
|
-
initInput?:
|
|
1555
|
+
initInput?: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined;
|
|
1531
1556
|
};
|
|
1532
1557
|
noWelcome: boolean;
|
|
1533
1558
|
logging: {
|
|
@@ -1538,6 +1563,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1538
1563
|
httpBasePath: string;
|
|
1539
1564
|
httpPort: number;
|
|
1540
1565
|
startEngine: boolean;
|
|
1566
|
+
engineHost: string;
|
|
1567
|
+
enginePort: number;
|
|
1541
1568
|
engineVersion: string;
|
|
1542
1569
|
envoy: {
|
|
1543
1570
|
poolName: string;
|
|
@@ -1546,8 +1573,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1546
1573
|
envoyKey?: string | undefined;
|
|
1547
1574
|
};
|
|
1548
1575
|
shutdown: {
|
|
1549
|
-
gracePeriodMs: number;
|
|
1550
1576
|
disableSignalHandlers: boolean;
|
|
1577
|
+
gracePeriodMs?: number | undefined;
|
|
1551
1578
|
};
|
|
1552
1579
|
staticDir?: string | undefined;
|
|
1553
1580
|
httpHost?: string | undefined;
|
|
@@ -1572,7 +1599,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1572
1599
|
runtime: "auto" | "native" | "wasm";
|
|
1573
1600
|
wasm: {
|
|
1574
1601
|
bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
|
|
1575
|
-
initInput?:
|
|
1602
|
+
initInput?: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined;
|
|
1576
1603
|
};
|
|
1577
1604
|
sqlite: {
|
|
1578
1605
|
backend: "local" | "remote";
|
|
@@ -1589,6 +1616,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1589
1616
|
httpBasePath: string;
|
|
1590
1617
|
httpPort: number;
|
|
1591
1618
|
startEngine: boolean;
|
|
1619
|
+
engineHost: string;
|
|
1620
|
+
enginePort: number;
|
|
1592
1621
|
engineVersion: string;
|
|
1593
1622
|
serverless: {
|
|
1594
1623
|
basePath: string;
|
|
@@ -1603,8 +1632,8 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1603
1632
|
envoyKey?: string | undefined;
|
|
1604
1633
|
};
|
|
1605
1634
|
shutdown: {
|
|
1606
|
-
gracePeriodMs: number;
|
|
1607
1635
|
disableSignalHandlers: boolean;
|
|
1636
|
+
gracePeriodMs?: number | undefined;
|
|
1608
1637
|
};
|
|
1609
1638
|
staticDir?: string | undefined;
|
|
1610
1639
|
httpHost?: string | undefined;
|
|
@@ -1624,6 +1653,335 @@ type RegistryConfigInput<A extends RegistryActors> = Omit<z$2.input<typeof Regis
|
|
|
1624
1653
|
use: A;
|
|
1625
1654
|
};
|
|
1626
1655
|
|
|
1656
|
+
declare const handleBrand: unique symbol;
|
|
1657
|
+
type OpaqueHandle<Name extends string> = {
|
|
1658
|
+
readonly [handleBrand]: Name;
|
|
1659
|
+
};
|
|
1660
|
+
type RegistryHandle = OpaqueHandle<"registry">;
|
|
1661
|
+
type ActorFactoryHandle = OpaqueHandle<"actorFactory">;
|
|
1662
|
+
type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
1663
|
+
type ConnHandle = OpaqueHandle<"conn">;
|
|
1664
|
+
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
1665
|
+
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
1666
|
+
type RuntimeBytes = Uint8Array;
|
|
1667
|
+
interface RuntimeActorKeySegment {
|
|
1668
|
+
kind: string;
|
|
1669
|
+
stringValue?: string;
|
|
1670
|
+
numberValue?: number;
|
|
1671
|
+
}
|
|
1672
|
+
interface RuntimeHttpRequest {
|
|
1673
|
+
method: string;
|
|
1674
|
+
uri: string;
|
|
1675
|
+
headers?: Record<string, string>;
|
|
1676
|
+
body?: RuntimeBytes;
|
|
1677
|
+
}
|
|
1678
|
+
interface RuntimeStateDeltaPayload {
|
|
1679
|
+
state?: RuntimeBytes;
|
|
1680
|
+
connHibernation: Array<{
|
|
1681
|
+
connId: string;
|
|
1682
|
+
bytes: RuntimeBytes;
|
|
1683
|
+
}>;
|
|
1684
|
+
connHibernationRemoved: string[];
|
|
1685
|
+
}
|
|
1686
|
+
interface RuntimeRequestSaveOpts {
|
|
1687
|
+
immediate?: boolean;
|
|
1688
|
+
maxWaitMs?: number;
|
|
1689
|
+
}
|
|
1690
|
+
interface RuntimeInspectorSnapshot {
|
|
1691
|
+
stateRevision: number;
|
|
1692
|
+
connectionsRevision: number;
|
|
1693
|
+
queueRevision: number;
|
|
1694
|
+
activeConnections: number;
|
|
1695
|
+
queueSize: number;
|
|
1696
|
+
connectedClients: number;
|
|
1697
|
+
}
|
|
1698
|
+
interface RuntimeQueueMessage {
|
|
1699
|
+
id(): bigint;
|
|
1700
|
+
name(): string;
|
|
1701
|
+
body(): RuntimeBytes;
|
|
1702
|
+
createdAt(): number;
|
|
1703
|
+
isCompletable(): boolean;
|
|
1704
|
+
complete(response?: RuntimeBytes | undefined | null): Promise<void>;
|
|
1705
|
+
}
|
|
1706
|
+
interface RuntimeQueueInspectMessage {
|
|
1707
|
+
id: number;
|
|
1708
|
+
name: string;
|
|
1709
|
+
createdAtMs: number;
|
|
1710
|
+
}
|
|
1711
|
+
interface RuntimeQueueNextBatchOptions {
|
|
1712
|
+
names?: string[];
|
|
1713
|
+
count?: number;
|
|
1714
|
+
timeoutMs?: number;
|
|
1715
|
+
completable?: boolean;
|
|
1716
|
+
}
|
|
1717
|
+
interface RuntimeQueueWaitOptions {
|
|
1718
|
+
timeoutMs?: number;
|
|
1719
|
+
completable?: boolean;
|
|
1720
|
+
}
|
|
1721
|
+
interface RuntimeQueueEnqueueAndWaitOptions {
|
|
1722
|
+
timeoutMs?: number;
|
|
1723
|
+
}
|
|
1724
|
+
interface RuntimeQueueTryNextBatchOptions {
|
|
1725
|
+
names?: string[];
|
|
1726
|
+
count?: number;
|
|
1727
|
+
completable?: boolean;
|
|
1728
|
+
}
|
|
1729
|
+
interface RuntimeKvListOptions {
|
|
1730
|
+
reverse?: boolean;
|
|
1731
|
+
limit?: number;
|
|
1732
|
+
}
|
|
1733
|
+
interface RuntimeKvEntry {
|
|
1734
|
+
key: RuntimeBytes;
|
|
1735
|
+
value: RuntimeBytes;
|
|
1736
|
+
}
|
|
1737
|
+
type RuntimeSqlBindNoValues = {
|
|
1738
|
+
intValue?: never;
|
|
1739
|
+
floatValue?: never;
|
|
1740
|
+
textValue?: never;
|
|
1741
|
+
blobValue?: never;
|
|
1742
|
+
};
|
|
1743
|
+
type RuntimeSqlBindParam = ({
|
|
1744
|
+
kind: "null";
|
|
1745
|
+
} & RuntimeSqlBindNoValues) | {
|
|
1746
|
+
kind: "int";
|
|
1747
|
+
intValue: number;
|
|
1748
|
+
floatValue?: never;
|
|
1749
|
+
textValue?: never;
|
|
1750
|
+
blobValue?: never;
|
|
1751
|
+
} | {
|
|
1752
|
+
kind: "float";
|
|
1753
|
+
intValue?: never;
|
|
1754
|
+
floatValue: number;
|
|
1755
|
+
textValue?: never;
|
|
1756
|
+
blobValue?: never;
|
|
1757
|
+
} | {
|
|
1758
|
+
kind: "text";
|
|
1759
|
+
intValue?: never;
|
|
1760
|
+
floatValue?: never;
|
|
1761
|
+
textValue: string;
|
|
1762
|
+
blobValue?: never;
|
|
1763
|
+
} | {
|
|
1764
|
+
kind: "blob";
|
|
1765
|
+
intValue?: never;
|
|
1766
|
+
floatValue?: never;
|
|
1767
|
+
textValue?: never;
|
|
1768
|
+
blobValue: RuntimeBytes;
|
|
1769
|
+
};
|
|
1770
|
+
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
1771
|
+
interface RuntimeSqlQueryResult {
|
|
1772
|
+
columns: string[];
|
|
1773
|
+
rows: unknown[][];
|
|
1774
|
+
}
|
|
1775
|
+
type RuntimeSqlExecResult = RuntimeSqlQueryResult;
|
|
1776
|
+
interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
1777
|
+
changes: number;
|
|
1778
|
+
lastInsertRowId?: number | null;
|
|
1779
|
+
}
|
|
1780
|
+
interface RuntimeSqlRunResult {
|
|
1781
|
+
changes: number;
|
|
1782
|
+
}
|
|
1783
|
+
interface RuntimeActorConfig {
|
|
1784
|
+
name?: string;
|
|
1785
|
+
icon?: string;
|
|
1786
|
+
hasDatabase?: boolean;
|
|
1787
|
+
remoteSqlite?: boolean;
|
|
1788
|
+
hasState?: boolean;
|
|
1789
|
+
canHibernateWebsocket?: boolean;
|
|
1790
|
+
stateSaveIntervalMs?: number;
|
|
1791
|
+
createStateTimeoutMs?: number;
|
|
1792
|
+
onCreateTimeoutMs?: number;
|
|
1793
|
+
createVarsTimeoutMs?: number;
|
|
1794
|
+
createConnStateTimeoutMs?: number;
|
|
1795
|
+
onBeforeConnectTimeoutMs?: number;
|
|
1796
|
+
onConnectTimeoutMs?: number;
|
|
1797
|
+
onMigrateTimeoutMs?: number;
|
|
1798
|
+
onWakeTimeoutMs?: number;
|
|
1799
|
+
onBeforeActorStartTimeoutMs?: number;
|
|
1800
|
+
actionTimeoutMs?: number;
|
|
1801
|
+
onRequestTimeoutMs?: number;
|
|
1802
|
+
sleepTimeoutMs?: number;
|
|
1803
|
+
noSleep?: boolean;
|
|
1804
|
+
sleepGracePeriodMs?: number;
|
|
1805
|
+
connectionLivenessTimeoutMs?: number;
|
|
1806
|
+
connectionLivenessIntervalMs?: number;
|
|
1807
|
+
maxQueueSize?: number;
|
|
1808
|
+
maxQueueMessageSize?: number;
|
|
1809
|
+
maxIncomingMessageSize?: number;
|
|
1810
|
+
maxOutgoingMessageSize?: number;
|
|
1811
|
+
preloadMaxWorkflowBytes?: number;
|
|
1812
|
+
preloadMaxConnectionsBytes?: number;
|
|
1813
|
+
actions?: Array<{
|
|
1814
|
+
name: string;
|
|
1815
|
+
}>;
|
|
1816
|
+
inspectorTabs?: Array<RuntimeInspectorTabEntry>;
|
|
1817
|
+
}
|
|
1818
|
+
interface RuntimeInspectorTabEntry {
|
|
1819
|
+
id: string;
|
|
1820
|
+
/** Required for custom entries; omitted for built-in hides. */
|
|
1821
|
+
label?: string;
|
|
1822
|
+
/**
|
|
1823
|
+
* Required for custom entries — absolute path to the source directory.
|
|
1824
|
+
* Resolved on the TS side before being handed to the runtime.
|
|
1825
|
+
*/
|
|
1826
|
+
source?: string;
|
|
1827
|
+
/** Optional icon id for custom entries. */
|
|
1828
|
+
icon?: string;
|
|
1829
|
+
/** Set to true for built-in hide entries. */
|
|
1830
|
+
hidden?: boolean;
|
|
1831
|
+
}
|
|
1832
|
+
interface RuntimeServeConfig {
|
|
1833
|
+
version: number;
|
|
1834
|
+
endpoint: string;
|
|
1835
|
+
token?: string;
|
|
1836
|
+
namespace: string;
|
|
1837
|
+
poolName: string;
|
|
1838
|
+
engineBinaryPath?: string;
|
|
1839
|
+
engineHost?: string;
|
|
1840
|
+
enginePort?: number;
|
|
1841
|
+
handleInspectorHttpInRuntime?: boolean;
|
|
1842
|
+
inspectorTestToken?: string;
|
|
1843
|
+
serverlessBasePath?: string;
|
|
1844
|
+
serverlessPackageVersion: string;
|
|
1845
|
+
serverlessClientEndpoint?: string;
|
|
1846
|
+
serverlessClientNamespace?: string;
|
|
1847
|
+
serverlessClientToken?: string;
|
|
1848
|
+
serverlessValidateEndpoint: boolean;
|
|
1849
|
+
serverlessMaxStartPayloadBytes: number;
|
|
1850
|
+
}
|
|
1851
|
+
interface RuntimeServerlessRequest {
|
|
1852
|
+
method: string;
|
|
1853
|
+
url: string;
|
|
1854
|
+
headers: Record<string, string>;
|
|
1855
|
+
body: RuntimeBytes;
|
|
1856
|
+
}
|
|
1857
|
+
interface RuntimeServerlessResponseHead {
|
|
1858
|
+
status: number;
|
|
1859
|
+
headers: Record<string, string>;
|
|
1860
|
+
}
|
|
1861
|
+
interface RuntimeRegistryRouteResponse {
|
|
1862
|
+
status: number;
|
|
1863
|
+
headers: Record<string, string>;
|
|
1864
|
+
body: RuntimeBytes;
|
|
1865
|
+
}
|
|
1866
|
+
type RuntimeServerlessStreamEvent = {
|
|
1867
|
+
kind: "chunk";
|
|
1868
|
+
chunk?: RuntimeBytes;
|
|
1869
|
+
} | {
|
|
1870
|
+
kind: "end";
|
|
1871
|
+
error?: {
|
|
1872
|
+
group: string;
|
|
1873
|
+
code: string;
|
|
1874
|
+
message: string;
|
|
1875
|
+
};
|
|
1876
|
+
};
|
|
1877
|
+
type RuntimeServerlessStreamCallback = (error: unknown, event?: RuntimeServerlessStreamEvent) => unknown;
|
|
1878
|
+
type RuntimeWebSocketEvent = {
|
|
1879
|
+
kind: "message";
|
|
1880
|
+
data: string | RuntimeBytes;
|
|
1881
|
+
binary: boolean;
|
|
1882
|
+
messageIndex?: number;
|
|
1883
|
+
} | {
|
|
1884
|
+
kind: "close";
|
|
1885
|
+
code: number;
|
|
1886
|
+
reason: string;
|
|
1887
|
+
wasClean: boolean;
|
|
1888
|
+
};
|
|
1889
|
+
interface CoreRuntime {
|
|
1890
|
+
readonly kind: "napi" | "wasm";
|
|
1891
|
+
createRegistry(): RegistryHandle;
|
|
1892
|
+
registerActor(registry: RegistryHandle, name: string, factory: ActorFactoryHandle): void;
|
|
1893
|
+
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
1894
|
+
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
1895
|
+
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
1896
|
+
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
1897
|
+
registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
1898
|
+
registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
1899
|
+
registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
1900
|
+
createActorFactory(callbacks: object, config?: RuntimeActorConfig | undefined | null): ActorFactoryHandle;
|
|
1901
|
+
createCancellationToken(): CancellationTokenHandle;
|
|
1902
|
+
cancellationTokenAborted(token: CancellationTokenHandle): boolean;
|
|
1903
|
+
cancelCancellationToken(token: CancellationTokenHandle): void;
|
|
1904
|
+
onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): void;
|
|
1905
|
+
actorState(ctx: ActorContextHandle): RuntimeBytes;
|
|
1906
|
+
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
1907
|
+
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
1908
|
+
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
1909
|
+
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
1910
|
+
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
1911
|
+
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
1912
|
+
actorDecodeInspectorRequest(ctx: ActorContextHandle, bytes: RuntimeBytes, advertisedVersion: number): RuntimeBytes;
|
|
1913
|
+
actorEncodeInspectorResponse(ctx: ActorContextHandle, bytes: RuntimeBytes, targetVersion: number): RuntimeBytes;
|
|
1914
|
+
actorVerifyInspectorAuth(ctx: ActorContextHandle, bearerToken?: string | undefined | null): Promise<void>;
|
|
1915
|
+
actorQueueHibernationRemoval(ctx: ActorContextHandle, connId: string): void;
|
|
1916
|
+
actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
|
|
1917
|
+
actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
|
|
1918
|
+
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
1919
|
+
actorId(ctx: ActorContextHandle): string;
|
|
1920
|
+
actorName(ctx: ActorContextHandle): string;
|
|
1921
|
+
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
1922
|
+
actorRegion(ctx: ActorContextHandle): string;
|
|
1923
|
+
actorSleep(ctx: ActorContextHandle): void;
|
|
1924
|
+
actorDestroy(ctx: ActorContextHandle): void;
|
|
1925
|
+
actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
|
|
1926
|
+
actorConns(ctx: ActorContextHandle): ConnHandle[];
|
|
1927
|
+
actorConnectConn(ctx: ActorContextHandle, params: RuntimeBytes, request?: RuntimeHttpRequest | undefined | null): Promise<ConnHandle>;
|
|
1928
|
+
actorBroadcast(ctx: ActorContextHandle, name: string, args: RuntimeBytes): void;
|
|
1929
|
+
actorWaitUntil(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
1930
|
+
actorWaitForTrackedShutdownWork(ctx: ActorContextHandle): Promise<boolean>;
|
|
1931
|
+
actorWaitForTrackedShutdownWorkUnbounded(ctx: ActorContextHandle): Promise<void>;
|
|
1932
|
+
actorKeepAwake(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
1933
|
+
actorBeginKeepAwake(ctx: ActorContextHandle): number;
|
|
1934
|
+
actorEndKeepAwake(ctx: ActorContextHandle, regionId: number): void;
|
|
1935
|
+
actorRegisterTask(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
1936
|
+
actorRuntimeState(ctx: ActorContextHandle): object;
|
|
1937
|
+
actorClearRuntimeState(ctx: ActorContextHandle): void;
|
|
1938
|
+
actorRestartRunHandler(ctx: ActorContextHandle): void;
|
|
1939
|
+
actorBeginWebsocketCallback(ctx: ActorContextHandle): number;
|
|
1940
|
+
actorEndWebsocketCallback(ctx: ActorContextHandle, regionId: number): void;
|
|
1941
|
+
actorKvGet(ctx: ActorContextHandle, key: RuntimeBytes): Promise<RuntimeBytes | null>;
|
|
1942
|
+
actorKvPut(ctx: ActorContextHandle, key: RuntimeBytes, value: RuntimeBytes): Promise<void>;
|
|
1943
|
+
actorKvDelete(ctx: ActorContextHandle, key: RuntimeBytes): Promise<void>;
|
|
1944
|
+
actorKvDeleteRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes): Promise<void>;
|
|
1945
|
+
actorKvListPrefix(ctx: ActorContextHandle, prefix: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
1946
|
+
actorKvListRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
1947
|
+
actorKvBatchGet(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<Array<RuntimeBytes | undefined | null>>;
|
|
1948
|
+
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
1949
|
+
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
1950
|
+
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
1951
|
+
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
1952
|
+
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
1953
|
+
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
1954
|
+
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
1955
|
+
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
1956
|
+
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
1957
|
+
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
1958
|
+
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
1959
|
+
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
1960
|
+
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
1961
|
+
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
1962
|
+
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
1963
|
+
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
1964
|
+
actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
|
|
1965
|
+
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): void;
|
|
1966
|
+
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): void;
|
|
1967
|
+
connId(conn: ConnHandle): string;
|
|
1968
|
+
connParams(conn: ConnHandle): RuntimeBytes;
|
|
1969
|
+
connState(conn: ConnHandle): RuntimeBytes;
|
|
1970
|
+
connSetState(conn: ConnHandle, state: RuntimeBytes): void;
|
|
1971
|
+
connIsHibernatable(conn: ConnHandle): boolean;
|
|
1972
|
+
connSend(conn: ConnHandle, name: string, args: RuntimeBytes): void;
|
|
1973
|
+
connDisconnect(conn: ConnHandle, reason?: string | undefined | null): Promise<void>;
|
|
1974
|
+
webSocketSend(ws: WebSocketHandle, data: RuntimeBytes, binary: boolean): void;
|
|
1975
|
+
webSocketClose(ws: WebSocketHandle, code?: number | undefined | null, reason?: string | undefined | null): Promise<void>;
|
|
1976
|
+
webSocketSetEventCallback(ws: WebSocketHandle, callback: (event: RuntimeWebSocketEvent) => void): void;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
declare function buildConfiguredRegistry(config: RegistryConfig): Promise<{
|
|
1980
|
+
runtime: CoreRuntime;
|
|
1981
|
+
registry: RegistryHandle;
|
|
1982
|
+
serveConfig: RuntimeServeConfig;
|
|
1983
|
+
}>;
|
|
1984
|
+
|
|
1627
1985
|
type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
|
|
1628
1986
|
interface ServerlessHandler {
|
|
1629
1987
|
fetch: FetchHandler;
|
|
@@ -1633,12 +1991,20 @@ interface RegistryRoutes {
|
|
|
1633
1991
|
metadata(): Promise<Response>;
|
|
1634
1992
|
prometheusMetrics(request?: Request): Promise<Response>;
|
|
1635
1993
|
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Injectable dependencies for {@link Registry}. Production code uses the
|
|
1996
|
+
* defaults. Tests override `buildConfiguredRegistry` to drive lifecycle
|
|
1997
|
+
* orchestration against a fake `CoreRuntime` without an engine.
|
|
1998
|
+
*/
|
|
1999
|
+
interface RegistryDeps {
|
|
2000
|
+
buildConfiguredRegistry: typeof buildConfiguredRegistry;
|
|
2001
|
+
}
|
|
1636
2002
|
declare class Registry<A extends RegistryActors> {
|
|
1637
2003
|
#private;
|
|
1638
2004
|
readonly routes: RegistryRoutes;
|
|
1639
2005
|
get config(): RegistryConfigInput<A>;
|
|
1640
2006
|
parseConfig(): RegistryConfig;
|
|
1641
|
-
constructor(config: RegistryConfigInput<A>);
|
|
2007
|
+
constructor(config: RegistryConfigInput<A>, deps?: Partial<RegistryDeps>);
|
|
1642
2008
|
/**
|
|
1643
2009
|
* Handle an incoming HTTP request for serverless deployments.
|
|
1644
2010
|
*
|
|
@@ -1678,6 +2044,27 @@ declare class Registry<A extends RegistryActors> {
|
|
|
1678
2044
|
port?: number;
|
|
1679
2045
|
publicDir?: string;
|
|
1680
2046
|
}): Promise<void>;
|
|
2047
|
+
/**
|
|
2048
|
+
* Gracefully drains all live registries.
|
|
2049
|
+
*
|
|
2050
|
+
* Programmatic counterpart to the SIGINT/SIGTERM handlers: tears down
|
|
2051
|
+
* every live `CoreRegistry` (both `start()` and `handler()` modes) and
|
|
2052
|
+
* waits for the serve promise to resolve, all bounded by the shutdown
|
|
2053
|
+
* grace period. Unlike a signal-driven shutdown, this does not re-raise a
|
|
2054
|
+
* signal or exit the process. The caller owns process lifetime.
|
|
2055
|
+
*
|
|
2056
|
+
* Idempotent: concurrent or repeated calls share a single drain. Safe to
|
|
2057
|
+
* call even if nothing has been started.
|
|
2058
|
+
*
|
|
2059
|
+
* @example
|
|
2060
|
+
* ```ts
|
|
2061
|
+
* const registry = setup({ use: { counter } });
|
|
2062
|
+
* registry.start();
|
|
2063
|
+
* // ...later, on your own shutdown trigger:
|
|
2064
|
+
* await registry.shutdown();
|
|
2065
|
+
* ```
|
|
2066
|
+
*/
|
|
2067
|
+
shutdown(): Promise<void>;
|
|
1681
2068
|
startEnvoy(): void;
|
|
1682
2069
|
/**
|
|
1683
2070
|
* Starts the actor envoy for standalone server deployments.
|