rivetkit 2.3.0-rc.9 → 2.3.1
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 +511 -62
- package/dist/browser/client.js +230 -174
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +53 -23
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +4 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +3 -1
- package/dist/tsup/agent-os/index.cjs +2163 -2087
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +509 -69
- package/dist/tsup/agent-os/index.d.ts +509 -69
- package/dist/tsup/agent-os/index.js +2163 -2087
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-WQ4HNA4W.cjs → chunk-3MHDOUD7.cjs} +73 -3
- package/dist/tsup/chunk-3MHDOUD7.cjs.map +1 -0
- package/dist/tsup/{chunk-QAZLM4WT.cjs → chunk-4FC7TVS6.cjs} +8 -4
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-4CGA6QJO.cjs → chunk-4UUEB43Y.cjs} +24 -9
- package/dist/tsup/chunk-4UUEB43Y.cjs.map +1 -0
- package/dist/tsup/{chunk-GVTOE34S.cjs → chunk-5IWLUJ6W.cjs} +222 -235
- package/dist/tsup/chunk-5IWLUJ6W.cjs.map +1 -0
- package/dist/tsup/{chunk-MMMEZM5J.js → chunk-H6VVZMWN.js} +4 -4
- package/dist/tsup/chunk-H6VVZMWN.js.map +1 -0
- package/dist/tsup/{chunk-3YY5S6TV.js → chunk-HXUEHHJF.js} +2 -2
- package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
- package/dist/tsup/{chunk-H7P7WR2Y.js → chunk-I35VSLEM.js} +6 -6
- package/dist/tsup/chunk-I35VSLEM.js.map +1 -0
- package/dist/tsup/{chunk-H37XQU3I.js → chunk-JBUZRPY5.js} +2 -2
- package/dist/tsup/{chunk-CPA4Y3RG.cjs → chunk-JLJJZYCJ.cjs} +10 -10
- package/dist/tsup/chunk-JLJJZYCJ.cjs.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-VRCIXJRN.js → chunk-L2X3YFER.js} +64 -10
- package/dist/tsup/chunk-L2X3YFER.js.map +1 -0
- package/dist/tsup/{chunk-Y5NSCZA2.cjs → chunk-MNHKOS6L.cjs} +72 -18
- package/dist/tsup/chunk-MNHKOS6L.cjs.map +1 -0
- package/dist/tsup/{chunk-KJTA3ATT.js → chunk-NERUIBOT.js} +22 -7
- package/dist/tsup/chunk-NERUIBOT.js.map +1 -0
- package/dist/tsup/{chunk-4WPEZBK4.cjs → chunk-OST76LRW.cjs} +10 -10
- package/dist/tsup/chunk-OST76LRW.cjs.map +1 -0
- package/dist/tsup/{chunk-MALSPBAF.cjs → chunk-OZBCXBVP.cjs} +3 -3
- package/dist/tsup/{chunk-MALSPBAF.cjs.map → chunk-OZBCXBVP.cjs.map} +1 -1
- package/dist/tsup/{chunk-F3Q5BFQ6.js → chunk-PT6OIW5E.js} +66 -79
- package/dist/tsup/chunk-PT6OIW5E.js.map +1 -0
- package/dist/tsup/{chunk-W7EYSYVI.js → chunk-R6KPN5EW.js} +134 -20
- package/dist/tsup/chunk-R6KPN5EW.js.map +1 -0
- package/dist/tsup/{chunk-VJFRBJVQ.cjs → chunk-V5KMAMX3.cjs} +138 -24
- package/dist/tsup/chunk-V5KMAMX3.cjs.map +1 -0
- package/dist/tsup/{chunk-LD5YASJU.cjs → chunk-VE2X4KMG.cjs} +2 -2
- package/dist/tsup/{chunk-LD5YASJU.cjs.map → chunk-VE2X4KMG.cjs.map} +1 -1
- package/dist/tsup/{chunk-T6YVRM4K.js → chunk-XIX5DOZN.js} +72 -2
- package/dist/tsup/chunk-XIX5DOZN.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-KIWH5H3K.js → chunk-ZZ3WBRPD.js} +7 -3
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.d.cts +5 -5
- package/dist/tsup/client/mod.d.ts +5 -5
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Ca8dN4cS.d.cts → config-CzvopP5m.d.cts} +544 -23
- package/dist/tsup/{config-CxjGYf4K.d.cts → config-D49x8NpL.d.cts} +1 -2
- package/dist/tsup/{config-CxjGYf4K.d.ts → config-D49x8NpL.d.ts} +1 -2
- package/dist/tsup/{config-0Ta55UV0.d.ts → config-DZuT7tcp.d.ts} +544 -23
- package/dist/tsup/context-CyAdY-aA.d.ts +128 -0
- package/dist/tsup/context-sNB28g0N.d.cts +128 -0
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.d.cts +1 -1
- package/dist/tsup/db/drizzle.d.ts +1 -1
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +2 -2
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +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 +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- 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 +758 -348
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +662 -252
- 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 -4
- package/dist/tsup/test/mod.d.ts +4 -4
- package/dist/tsup/test/mod.js +18 -15
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/{utils-DVekpm4I.d.cts → utils-CqDnC_PS.d.cts} +2 -1
- package/dist/tsup/{utils-DVekpm4I.d.ts → utils-CqDnC_PS.d.ts} +2 -1
- 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 +383 -322
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -8
- package/dist/tsup/workflow/mod.d.ts +8 -8
- package/dist/tsup/workflow/mod.js +360 -299
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +35 -14
- package/src/actor/config.ts +173 -51
- 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 +20 -3
- package/src/actor/instance/mod.ts +26 -34
- package/src/actor/keys.ts +1 -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 +87 -54
- package/src/client/actor-conn.ts +8 -36
- package/src/client/actor-handle.ts +69 -51
- package/src/client/actor-query.ts +5 -5
- package/src/client/errors.ts +1 -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 +8 -6
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +2 -7
- 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/transport/v1.ts +659 -543
- package/src/common/client-protocol-versioned.ts +66 -64
- package/src/common/database/config.ts +2 -8
- package/src/common/database/native-database.ts +1 -1
- 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 +1 -0
- package/src/common/router.ts +13 -17
- package/src/common/utils.ts +1 -150
- package/src/common/websocket-interface.ts +1 -1
- 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 +58 -56
- 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 +3 -3
- package/src/engine-client/actor-websocket-client.ts +6 -5
- package/src/engine-client/api-endpoints.ts +51 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +1 -1
- package/src/engine-client/mod.ts +6 -3
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +5 -11
- package/src/inspector/mod.ts +1 -3
- package/src/inspector-tab/mod.ts +315 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +40 -16
- package/src/registry/index.ts +209 -73
- package/src/registry/napi-runtime.ts +29 -2
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +433 -198
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/runtime.ts +52 -1
- package/src/registry/wasm-runtime.ts +29 -2
- package/src/registry/write-through-proxy.ts +40 -0
- package/src/serde.ts +2 -2
- package/src/serverless/configure.ts +18 -7
- package/src/test/mod.ts +11 -8
- 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 +699 -240
- package/src/workflow/driver.ts +23 -12
- package/src/workflow/inspector.ts +4 -3
- package/src/workflow/mod.ts +37 -23
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3YY5S6TV.js.map +0 -1
- package/dist/tsup/chunk-4CGA6QJO.cjs.map +0 -1
- package/dist/tsup/chunk-4WPEZBK4.cjs.map +0 -1
- package/dist/tsup/chunk-CPA4Y3RG.cjs.map +0 -1
- package/dist/tsup/chunk-F3Q5BFQ6.js.map +0 -1
- package/dist/tsup/chunk-GVTOE34S.cjs.map +0 -1
- package/dist/tsup/chunk-H7P7WR2Y.js.map +0 -1
- package/dist/tsup/chunk-KIWH5H3K.js.map +0 -1
- package/dist/tsup/chunk-KJTA3ATT.js.map +0 -1
- package/dist/tsup/chunk-MMMEZM5J.js.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-QAZLM4WT.cjs.map +0 -1
- package/dist/tsup/chunk-T6YVRM4K.js.map +0 -1
- package/dist/tsup/chunk-VJFRBJVQ.cjs.map +0 -1
- package/dist/tsup/chunk-VRCIXJRN.js.map +0 -1
- package/dist/tsup/chunk-W7EYSYVI.js.map +0 -1
- package/dist/tsup/chunk-WQ4HNA4W.cjs.map +0 -1
- package/dist/tsup/chunk-Y5NSCZA2.cjs.map +0 -1
- package/dist/tsup/context-B_IWbWne.d.ts +0 -92
- package/dist/tsup/context-CUrQ9MHc.d.cts +0 -92
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-H37XQU3I.js.map → chunk-JBUZRPY5.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as _rivet_dev_agent_os_core from '@rivet-dev/agent-os-core';
|
|
2
2
|
import { AgentOs, JsonRpcNotification, PermissionRequest, CronEvent, AgentCapabilities, AgentInfo, JsonRpcResponse, AgentOsOptions, BatchReadResult, BatchWriteEntry, BatchWriteResult, ReaddirRecursiveOptions, DirEntry, AgentRegistryEntry, SpawnedProcessInfo, ProcessInfo, ProcessTreeNode, SessionModeState, SessionConfigOption, GetEventsOptions, SequencedEvent, PermissionReply, AgentType, CreateSessionOptions, SessionInfo, OpenShellOptions } from '@rivet-dev/agent-os-core';
|
|
3
3
|
import { z as z$1 } from 'zod/v4';
|
|
4
|
-
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
5
4
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
6
5
|
import { Context, Handler, Hono } from 'hono';
|
|
6
|
+
import { UniversalWebSocket } from '@rivetkit/virtual-websocket';
|
|
7
7
|
import * as _rivetkit_rivetkit_wasm from '@rivetkit/rivetkit-wasm';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import { Logger } from 'pino';
|
|
@@ -105,8 +105,7 @@ type DatabaseProvider<DB extends RawAccess> = {
|
|
|
105
105
|
/**
|
|
106
106
|
* Drizzle database client interface (will be extended by drizzle-orm types)
|
|
107
107
|
*/
|
|
108
|
-
|
|
109
|
-
}
|
|
108
|
+
type DrizzleDatabaseClient = {};
|
|
110
109
|
type ExecuteFunction = <TRow extends Record<string, unknown> = Record<string, unknown>>(query: string, ...args: unknown[]) => Promise<TRow[]>;
|
|
111
110
|
type RawAccess = {
|
|
112
111
|
/**
|
|
@@ -123,23 +122,7 @@ type RawAccess = {
|
|
|
123
122
|
close: () => Promise<void>;
|
|
124
123
|
};
|
|
125
124
|
|
|
126
|
-
declare
|
|
127
|
-
|
|
128
|
-
type VirtualFileSystem = _rivet_dev_agent_os_core.PlainMountConfig["driver"];
|
|
129
|
-
interface DatabaseVfsOptions {
|
|
130
|
-
/** The RawAccess database handle from the actor's db provider. */
|
|
131
|
-
db: RawAccess;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Create a VirtualFileSystem backed by SQLite.
|
|
135
|
-
*
|
|
136
|
-
* The returned filesystem stores all content and metadata in the
|
|
137
|
-
* `agent_os_fs_entries` table. The table must be created beforehand
|
|
138
|
-
* via `migrateAgentOsTables()`.
|
|
139
|
-
*/
|
|
140
|
-
declare function createDatabaseVfs(options: DatabaseVfsOptions): VirtualFileSystem;
|
|
141
|
-
|
|
142
|
-
declare const ActorsSchema: z.ZodRecord<z.ZodString, z.ZodCustom<BaseActorDefinition<any, any, any, any, any, any, any, any, any>, BaseActorDefinition<any, any, any, any, any, any, any, any, any>>>;
|
|
125
|
+
declare const ActorsSchema: z.ZodRecord<z.ZodString, z.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
|
|
143
126
|
type RegistryActors = z.infer<typeof ActorsSchema>;
|
|
144
127
|
declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
145
128
|
use: z.ZodRecord<z.ZodString, z.ZodCustom<AnyActorDefinition, AnyActorDefinition>>;
|
|
@@ -196,6 +179,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
196
179
|
httpPort: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
197
180
|
httpHost: z.ZodOptional<z.ZodString>;
|
|
198
181
|
startEngine: z.ZodDefault<z.ZodBoolean>;
|
|
182
|
+
engineHost: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
183
|
+
enginePort: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
199
184
|
engineVersion: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
200
185
|
configurePool: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
201
186
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -261,6 +246,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
261
246
|
httpBasePath: string;
|
|
262
247
|
httpPort: number;
|
|
263
248
|
startEngine: boolean;
|
|
249
|
+
engineHost: string;
|
|
250
|
+
enginePort: number;
|
|
264
251
|
engineVersion: string;
|
|
265
252
|
envoy: {
|
|
266
253
|
poolName: string;
|
|
@@ -312,6 +299,8 @@ declare const RegistryConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
312
299
|
httpBasePath: string;
|
|
313
300
|
httpPort: number;
|
|
314
301
|
startEngine: boolean;
|
|
302
|
+
engineHost: string;
|
|
303
|
+
enginePort: number;
|
|
315
304
|
engineVersion: string;
|
|
316
305
|
serverless: {
|
|
317
306
|
basePath: string;
|
|
@@ -374,7 +363,7 @@ interface QueueSchemaDefinition<TContext = any> {
|
|
|
374
363
|
type EventSchema<TContext = any> = PrimitiveSchema | EventSchemaDefinition<TContext>;
|
|
375
364
|
type QueueSchema = PrimitiveSchema | QueueSchemaDefinition<any> | QueueTypeToken<unknown, unknown, any>;
|
|
376
365
|
type EventSchemaConfig<TContext = any> = Record<string, EventSchema<TContext>>;
|
|
377
|
-
type QueueSchemaConfig<
|
|
366
|
+
type QueueSchemaConfig<_TContext = any> = Record<string, QueueSchema>;
|
|
378
367
|
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;
|
|
379
368
|
type InferSchemaMap<T extends Record<string, unknown>> = {
|
|
380
369
|
[K in keyof T]: InferSchema<T[K]>;
|
|
@@ -385,14 +374,16 @@ type InferQueueCompleteMap<T extends QueueSchemaConfig> = {
|
|
|
385
374
|
};
|
|
386
375
|
type InferEventArgs<T> = T extends readonly unknown[] ? number extends T["length"] ? [T] : T : [T];
|
|
387
376
|
|
|
388
|
-
interface BaseActorDefinition<S, CP, CS, V, I, DB extends AnyDatabaseProvider, E extends EventSchemaConfig = Record<never, never>, Q extends QueueSchemaConfig = Record<never, never>,
|
|
389
|
-
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
377
|
+
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>> {
|
|
378
|
+
readonly config: ActorConfig<S, CP, CS, V, I, DB, E, Q, _R>;
|
|
379
|
+
}
|
|
380
|
+
interface AnyActorDefinition {
|
|
381
|
+
readonly config: any;
|
|
390
382
|
}
|
|
391
|
-
type AnyActorDefinition = BaseActorDefinition<any, any, any, any, any, any, any, any, any>;
|
|
392
383
|
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> {
|
|
393
384
|
#private;
|
|
394
|
-
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q>);
|
|
395
|
-
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q>;
|
|
385
|
+
constructor(config: ActorConfig<S, CP, CS, V, I, DB, E, Q, R>);
|
|
386
|
+
get config(): ActorConfig<S, CP, CS, V, I, DB, E, Q, R>;
|
|
396
387
|
}
|
|
397
388
|
|
|
398
389
|
declare const EncodingSchema: z$1.ZodEnum<{
|
|
@@ -569,6 +560,341 @@ interface ActorOutput {
|
|
|
569
560
|
error?: unknown;
|
|
570
561
|
}
|
|
571
562
|
|
|
563
|
+
declare const handleBrand: unique symbol;
|
|
564
|
+
type OpaqueHandle<Name extends string> = {
|
|
565
|
+
readonly [handleBrand]: Name;
|
|
566
|
+
};
|
|
567
|
+
type RegistryHandle = OpaqueHandle<"registry">;
|
|
568
|
+
type ActorFactoryHandle = OpaqueHandle<"actorFactory">;
|
|
569
|
+
type ActorContextHandle = OpaqueHandle<"actorContext">;
|
|
570
|
+
type ConnHandle = OpaqueHandle<"conn">;
|
|
571
|
+
type WebSocketHandle = OpaqueHandle<"webSocket">;
|
|
572
|
+
type CancellationTokenHandle = OpaqueHandle<"cancellationToken">;
|
|
573
|
+
type RuntimeBytes = Uint8Array;
|
|
574
|
+
interface RuntimeActorKeySegment {
|
|
575
|
+
kind: string;
|
|
576
|
+
stringValue?: string;
|
|
577
|
+
numberValue?: number;
|
|
578
|
+
}
|
|
579
|
+
interface RuntimeHttpRequest {
|
|
580
|
+
method: string;
|
|
581
|
+
uri: string;
|
|
582
|
+
headers?: Record<string, string>;
|
|
583
|
+
body?: RuntimeBytes;
|
|
584
|
+
}
|
|
585
|
+
interface RuntimeStateDeltaPayload {
|
|
586
|
+
state?: RuntimeBytes;
|
|
587
|
+
connHibernation: Array<{
|
|
588
|
+
connId: string;
|
|
589
|
+
bytes: RuntimeBytes;
|
|
590
|
+
}>;
|
|
591
|
+
connHibernationRemoved: string[];
|
|
592
|
+
}
|
|
593
|
+
interface RuntimeRequestSaveOpts {
|
|
594
|
+
immediate?: boolean;
|
|
595
|
+
maxWaitMs?: number;
|
|
596
|
+
}
|
|
597
|
+
interface RuntimeInspectorSnapshot {
|
|
598
|
+
stateRevision: number;
|
|
599
|
+
connectionsRevision: number;
|
|
600
|
+
queueRevision: number;
|
|
601
|
+
activeConnections: number;
|
|
602
|
+
queueSize: number;
|
|
603
|
+
connectedClients: number;
|
|
604
|
+
}
|
|
605
|
+
interface RuntimeQueueMessage {
|
|
606
|
+
id(): bigint;
|
|
607
|
+
name(): string;
|
|
608
|
+
body(): RuntimeBytes;
|
|
609
|
+
createdAt(): number;
|
|
610
|
+
isCompletable(): boolean;
|
|
611
|
+
complete(response?: RuntimeBytes | undefined | null): Promise<void>;
|
|
612
|
+
}
|
|
613
|
+
interface RuntimeQueueInspectMessage {
|
|
614
|
+
id: number;
|
|
615
|
+
name: string;
|
|
616
|
+
createdAtMs: number;
|
|
617
|
+
}
|
|
618
|
+
interface RuntimeQueueNextBatchOptions {
|
|
619
|
+
names?: string[];
|
|
620
|
+
count?: number;
|
|
621
|
+
timeoutMs?: number;
|
|
622
|
+
completable?: boolean;
|
|
623
|
+
}
|
|
624
|
+
interface RuntimeQueueWaitOptions {
|
|
625
|
+
timeoutMs?: number;
|
|
626
|
+
completable?: boolean;
|
|
627
|
+
}
|
|
628
|
+
interface RuntimeQueueEnqueueAndWaitOptions {
|
|
629
|
+
timeoutMs?: number;
|
|
630
|
+
}
|
|
631
|
+
interface RuntimeQueueTryNextBatchOptions {
|
|
632
|
+
names?: string[];
|
|
633
|
+
count?: number;
|
|
634
|
+
completable?: boolean;
|
|
635
|
+
}
|
|
636
|
+
interface RuntimeKvListOptions {
|
|
637
|
+
reverse?: boolean;
|
|
638
|
+
limit?: number;
|
|
639
|
+
}
|
|
640
|
+
interface RuntimeKvEntry {
|
|
641
|
+
key: RuntimeBytes;
|
|
642
|
+
value: RuntimeBytes;
|
|
643
|
+
}
|
|
644
|
+
type RuntimeSqlBindNoValues = {
|
|
645
|
+
intValue?: never;
|
|
646
|
+
floatValue?: never;
|
|
647
|
+
textValue?: never;
|
|
648
|
+
blobValue?: never;
|
|
649
|
+
};
|
|
650
|
+
type RuntimeSqlBindParam = ({
|
|
651
|
+
kind: "null";
|
|
652
|
+
} & RuntimeSqlBindNoValues) | {
|
|
653
|
+
kind: "int";
|
|
654
|
+
intValue: number;
|
|
655
|
+
floatValue?: never;
|
|
656
|
+
textValue?: never;
|
|
657
|
+
blobValue?: never;
|
|
658
|
+
} | {
|
|
659
|
+
kind: "float";
|
|
660
|
+
intValue?: never;
|
|
661
|
+
floatValue: number;
|
|
662
|
+
textValue?: never;
|
|
663
|
+
blobValue?: never;
|
|
664
|
+
} | {
|
|
665
|
+
kind: "text";
|
|
666
|
+
intValue?: never;
|
|
667
|
+
floatValue?: never;
|
|
668
|
+
textValue: string;
|
|
669
|
+
blobValue?: never;
|
|
670
|
+
} | {
|
|
671
|
+
kind: "blob";
|
|
672
|
+
intValue?: never;
|
|
673
|
+
floatValue?: never;
|
|
674
|
+
textValue?: never;
|
|
675
|
+
blobValue: RuntimeBytes;
|
|
676
|
+
};
|
|
677
|
+
type RuntimeSqlBindParams = RuntimeSqlBindParam[] | null;
|
|
678
|
+
interface RuntimeSqlQueryResult {
|
|
679
|
+
columns: string[];
|
|
680
|
+
rows: unknown[][];
|
|
681
|
+
}
|
|
682
|
+
type RuntimeSqlExecResult = RuntimeSqlQueryResult;
|
|
683
|
+
interface RuntimeSqlExecuteResult extends RuntimeSqlQueryResult {
|
|
684
|
+
changes: number;
|
|
685
|
+
lastInsertRowId?: number | null;
|
|
686
|
+
}
|
|
687
|
+
interface RuntimeSqlRunResult {
|
|
688
|
+
changes: number;
|
|
689
|
+
}
|
|
690
|
+
interface RuntimeActorConfig {
|
|
691
|
+
name?: string;
|
|
692
|
+
icon?: string;
|
|
693
|
+
hasDatabase?: boolean;
|
|
694
|
+
remoteSqlite?: boolean;
|
|
695
|
+
hasState?: boolean;
|
|
696
|
+
canHibernateWebsocket?: boolean;
|
|
697
|
+
stateSaveIntervalMs?: number;
|
|
698
|
+
createStateTimeoutMs?: number;
|
|
699
|
+
onCreateTimeoutMs?: number;
|
|
700
|
+
createVarsTimeoutMs?: number;
|
|
701
|
+
createConnStateTimeoutMs?: number;
|
|
702
|
+
onBeforeConnectTimeoutMs?: number;
|
|
703
|
+
onConnectTimeoutMs?: number;
|
|
704
|
+
onMigrateTimeoutMs?: number;
|
|
705
|
+
onWakeTimeoutMs?: number;
|
|
706
|
+
onBeforeActorStartTimeoutMs?: number;
|
|
707
|
+
actionTimeoutMs?: number;
|
|
708
|
+
onRequestTimeoutMs?: number;
|
|
709
|
+
sleepTimeoutMs?: number;
|
|
710
|
+
noSleep?: boolean;
|
|
711
|
+
sleepGracePeriodMs?: number;
|
|
712
|
+
connectionLivenessTimeoutMs?: number;
|
|
713
|
+
connectionLivenessIntervalMs?: number;
|
|
714
|
+
maxQueueSize?: number;
|
|
715
|
+
maxQueueMessageSize?: number;
|
|
716
|
+
maxIncomingMessageSize?: number;
|
|
717
|
+
maxOutgoingMessageSize?: number;
|
|
718
|
+
preloadMaxWorkflowBytes?: number;
|
|
719
|
+
preloadMaxConnectionsBytes?: number;
|
|
720
|
+
actions?: Array<{
|
|
721
|
+
name: string;
|
|
722
|
+
}>;
|
|
723
|
+
inspectorTabs?: Array<RuntimeInspectorTabEntry>;
|
|
724
|
+
}
|
|
725
|
+
interface RuntimeInspectorTabEntry {
|
|
726
|
+
id: string;
|
|
727
|
+
/** Required for custom entries; omitted for built-in hides. */
|
|
728
|
+
label?: string;
|
|
729
|
+
/**
|
|
730
|
+
* Required for custom entries — absolute path to the source directory.
|
|
731
|
+
* Resolved on the TS side before being handed to the runtime.
|
|
732
|
+
*/
|
|
733
|
+
source?: string;
|
|
734
|
+
/** Optional icon id for custom entries. */
|
|
735
|
+
icon?: string;
|
|
736
|
+
/** Set to true for built-in hide entries. */
|
|
737
|
+
hidden?: boolean;
|
|
738
|
+
}
|
|
739
|
+
interface RuntimeServeConfig {
|
|
740
|
+
version: number;
|
|
741
|
+
endpoint: string;
|
|
742
|
+
token?: string;
|
|
743
|
+
namespace: string;
|
|
744
|
+
poolName: string;
|
|
745
|
+
engineBinaryPath?: string;
|
|
746
|
+
engineHost?: string;
|
|
747
|
+
enginePort?: number;
|
|
748
|
+
handleInspectorHttpInRuntime?: boolean;
|
|
749
|
+
inspectorTestToken?: string;
|
|
750
|
+
serverlessBasePath?: string;
|
|
751
|
+
serverlessPackageVersion: string;
|
|
752
|
+
serverlessClientEndpoint?: string;
|
|
753
|
+
serverlessClientNamespace?: string;
|
|
754
|
+
serverlessClientToken?: string;
|
|
755
|
+
serverlessValidateEndpoint: boolean;
|
|
756
|
+
serverlessMaxStartPayloadBytes: number;
|
|
757
|
+
}
|
|
758
|
+
interface RuntimeListenerConfig {
|
|
759
|
+
port: number;
|
|
760
|
+
host?: string;
|
|
761
|
+
publicDir?: string;
|
|
762
|
+
}
|
|
763
|
+
interface RuntimeServerlessRequest {
|
|
764
|
+
method: string;
|
|
765
|
+
url: string;
|
|
766
|
+
headers: Record<string, string>;
|
|
767
|
+
body: RuntimeBytes;
|
|
768
|
+
}
|
|
769
|
+
interface RuntimeServerlessResponseHead {
|
|
770
|
+
status: number;
|
|
771
|
+
headers: Record<string, string>;
|
|
772
|
+
}
|
|
773
|
+
interface RuntimeRegistryRouteResponse {
|
|
774
|
+
status: number;
|
|
775
|
+
headers: Record<string, string>;
|
|
776
|
+
body: RuntimeBytes;
|
|
777
|
+
}
|
|
778
|
+
type RuntimeServerlessStreamEvent = {
|
|
779
|
+
kind: "chunk";
|
|
780
|
+
chunk?: RuntimeBytes;
|
|
781
|
+
} | {
|
|
782
|
+
kind: "end";
|
|
783
|
+
error?: {
|
|
784
|
+
group: string;
|
|
785
|
+
code: string;
|
|
786
|
+
message: string;
|
|
787
|
+
};
|
|
788
|
+
};
|
|
789
|
+
type RuntimeServerlessStreamCallback = (error: unknown, event?: RuntimeServerlessStreamEvent) => unknown;
|
|
790
|
+
type RuntimeWebSocketEvent = {
|
|
791
|
+
kind: "message";
|
|
792
|
+
data: string | RuntimeBytes;
|
|
793
|
+
binary: boolean;
|
|
794
|
+
messageIndex?: number;
|
|
795
|
+
} | {
|
|
796
|
+
kind: "close";
|
|
797
|
+
code: number;
|
|
798
|
+
reason: string;
|
|
799
|
+
wasClean: boolean;
|
|
800
|
+
};
|
|
801
|
+
interface CoreRuntime {
|
|
802
|
+
readonly kind: "napi" | "wasm";
|
|
803
|
+
createRegistry(): RegistryHandle;
|
|
804
|
+
registerActor(registry: RegistryHandle, name: string, factory: ActorFactoryHandle): void;
|
|
805
|
+
serveRegistry(registry: RegistryHandle, config: RuntimeServeConfig): Promise<void>;
|
|
806
|
+
shutdownRegistry(registry: RegistryHandle): Promise<void>;
|
|
807
|
+
registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
|
|
808
|
+
handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
|
|
809
|
+
serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
|
|
810
|
+
registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
811
|
+
registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
812
|
+
registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
|
|
813
|
+
createActorFactory(callbacks: object, config?: RuntimeActorConfig | undefined | null): ActorFactoryHandle;
|
|
814
|
+
createCancellationToken(): CancellationTokenHandle;
|
|
815
|
+
cancellationTokenAborted(token: CancellationTokenHandle): boolean;
|
|
816
|
+
cancelCancellationToken(token: CancellationTokenHandle): void;
|
|
817
|
+
onCancellationTokenCancelled(token: CancellationTokenHandle, callback: (...args: unknown[]) => unknown): void;
|
|
818
|
+
actorState(ctx: ActorContextHandle): RuntimeBytes;
|
|
819
|
+
actorBeginOnStateChange(ctx: ActorContextHandle): void;
|
|
820
|
+
actorEndOnStateChange(ctx: ActorContextHandle): void;
|
|
821
|
+
actorSetAlarm(ctx: ActorContextHandle, timestampMs?: number | undefined | null): void;
|
|
822
|
+
actorRequestSave(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): void;
|
|
823
|
+
actorRequestSaveAndWait(ctx: ActorContextHandle, opts?: RuntimeRequestSaveOpts | undefined | null): Promise<void>;
|
|
824
|
+
actorInspectorSnapshot(ctx: ActorContextHandle): RuntimeInspectorSnapshot;
|
|
825
|
+
actorDecodeInspectorRequest(ctx: ActorContextHandle, bytes: RuntimeBytes, advertisedVersion: number): RuntimeBytes;
|
|
826
|
+
actorEncodeInspectorResponse(ctx: ActorContextHandle, bytes: RuntimeBytes, targetVersion: number): RuntimeBytes;
|
|
827
|
+
actorVerifyInspectorAuth(ctx: ActorContextHandle, bearerToken?: string | undefined | null): Promise<void>;
|
|
828
|
+
actorQueueHibernationRemoval(ctx: ActorContextHandle, connId: string): void;
|
|
829
|
+
actorTakePendingHibernationChanges(ctx: ActorContextHandle): string[];
|
|
830
|
+
actorDirtyHibernatableConns(ctx: ActorContextHandle): ConnHandle[];
|
|
831
|
+
actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
|
|
832
|
+
actorId(ctx: ActorContextHandle): string;
|
|
833
|
+
actorName(ctx: ActorContextHandle): string;
|
|
834
|
+
actorKey(ctx: ActorContextHandle): RuntimeActorKeySegment[];
|
|
835
|
+
actorRegion(ctx: ActorContextHandle): string;
|
|
836
|
+
actorSleep(ctx: ActorContextHandle): void;
|
|
837
|
+
actorDestroy(ctx: ActorContextHandle): void;
|
|
838
|
+
actorAbortSignal(ctx: ActorContextHandle): AbortSignal;
|
|
839
|
+
actorConns(ctx: ActorContextHandle): ConnHandle[];
|
|
840
|
+
actorConnectConn(ctx: ActorContextHandle, params: RuntimeBytes, request?: RuntimeHttpRequest | undefined | null): Promise<ConnHandle>;
|
|
841
|
+
actorBroadcast(ctx: ActorContextHandle, name: string, args: RuntimeBytes): void;
|
|
842
|
+
actorWaitUntil(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
843
|
+
actorWaitForTrackedShutdownWork(ctx: ActorContextHandle): Promise<boolean>;
|
|
844
|
+
actorWaitForTrackedShutdownWorkUnbounded(ctx: ActorContextHandle): Promise<void>;
|
|
845
|
+
actorKeepAwake(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
846
|
+
actorBeginKeepAwake(ctx: ActorContextHandle): number;
|
|
847
|
+
actorEndKeepAwake(ctx: ActorContextHandle, regionId: number): void;
|
|
848
|
+
actorRegisterTask(ctx: ActorContextHandle, promise: Promise<unknown>): void;
|
|
849
|
+
actorRuntimeState(ctx: ActorContextHandle): object;
|
|
850
|
+
actorClearRuntimeState(ctx: ActorContextHandle): void;
|
|
851
|
+
actorRestartRunHandler(ctx: ActorContextHandle): void;
|
|
852
|
+
actorBeginWebsocketCallback(ctx: ActorContextHandle): number;
|
|
853
|
+
actorEndWebsocketCallback(ctx: ActorContextHandle, regionId: number): void;
|
|
854
|
+
actorKvGet(ctx: ActorContextHandle, key: RuntimeBytes): Promise<RuntimeBytes | null>;
|
|
855
|
+
actorKvPut(ctx: ActorContextHandle, key: RuntimeBytes, value: RuntimeBytes): Promise<void>;
|
|
856
|
+
actorKvDelete(ctx: ActorContextHandle, key: RuntimeBytes): Promise<void>;
|
|
857
|
+
actorKvDeleteRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes): Promise<void>;
|
|
858
|
+
actorKvListPrefix(ctx: ActorContextHandle, prefix: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
859
|
+
actorKvListRange(ctx: ActorContextHandle, start: RuntimeBytes, end: RuntimeBytes, options?: RuntimeKvListOptions | undefined | null): Promise<RuntimeKvEntry[]>;
|
|
860
|
+
actorKvBatchGet(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<Array<RuntimeBytes | undefined | null>>;
|
|
861
|
+
actorKvBatchPut(ctx: ActorContextHandle, entries: RuntimeKvEntry[]): Promise<void>;
|
|
862
|
+
actorKvBatchDelete(ctx: ActorContextHandle, keys: RuntimeBytes[]): Promise<void>;
|
|
863
|
+
actorSqlExec(ctx: ActorContextHandle, sql: string): Promise<RuntimeSqlExecResult>;
|
|
864
|
+
actorSqlExecute(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlExecuteResult>;
|
|
865
|
+
actorSqlQuery(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlQueryResult>;
|
|
866
|
+
actorSqlRun(ctx: ActorContextHandle, sql: string, params?: RuntimeSqlBindParams): Promise<RuntimeSqlRunResult>;
|
|
867
|
+
actorSqlMetrics(ctx: ActorContextHandle): SqliteNativeMetrics | null;
|
|
868
|
+
actorSqlTakeLastKvError(ctx: ActorContextHandle): string | null;
|
|
869
|
+
actorSqlClose(ctx: ActorContextHandle): Promise<void>;
|
|
870
|
+
actorQueueSend(ctx: ActorContextHandle, name: string, body: RuntimeBytes): Promise<RuntimeQueueMessage>;
|
|
871
|
+
actorQueueNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueNextBatchOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage[]>;
|
|
872
|
+
actorQueueWaitForNames(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeQueueMessage>;
|
|
873
|
+
actorQueueWaitForNamesAvailable(ctx: ActorContextHandle, names: string[], options?: RuntimeQueueWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<void>;
|
|
874
|
+
actorQueueEnqueueAndWait(ctx: ActorContextHandle, name: string, body: RuntimeBytes, options?: RuntimeQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationTokenHandle | undefined | null): Promise<RuntimeBytes | null>;
|
|
875
|
+
actorQueueTryNextBatch(ctx: ActorContextHandle, options?: RuntimeQueueTryNextBatchOptions | undefined | null): RuntimeQueueMessage[];
|
|
876
|
+
actorQueueMaxSize(ctx: ActorContextHandle): number;
|
|
877
|
+
actorQueueInspectMessages(ctx: ActorContextHandle): Promise<RuntimeQueueInspectMessage[]>;
|
|
878
|
+
actorScheduleAfter(ctx: ActorContextHandle, durationMs: number, actionName: string, args: RuntimeBytes): void;
|
|
879
|
+
actorScheduleAt(ctx: ActorContextHandle, timestampMs: number, actionName: string, args: RuntimeBytes): void;
|
|
880
|
+
connId(conn: ConnHandle): string;
|
|
881
|
+
connParams(conn: ConnHandle): RuntimeBytes;
|
|
882
|
+
connState(conn: ConnHandle): RuntimeBytes;
|
|
883
|
+
connSetState(conn: ConnHandle, state: RuntimeBytes): void;
|
|
884
|
+
connIsHibernatable(conn: ConnHandle): boolean;
|
|
885
|
+
connSend(conn: ConnHandle, name: string, args: RuntimeBytes): void;
|
|
886
|
+
connDisconnect(conn: ConnHandle, reason?: string | undefined | null): Promise<void>;
|
|
887
|
+
webSocketSend(ws: WebSocketHandle, data: RuntimeBytes, binary: boolean): void;
|
|
888
|
+
webSocketClose(ws: WebSocketHandle, code?: number | undefined | null, reason?: string | undefined | null): Promise<void>;
|
|
889
|
+
webSocketSetEventCallback(ws: WebSocketHandle, callback: (event: RuntimeWebSocketEvent) => void): void;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
declare function buildConfiguredRegistry(config: RegistryConfig): Promise<{
|
|
893
|
+
runtime: CoreRuntime;
|
|
894
|
+
registry: RegistryHandle;
|
|
895
|
+
serveConfig: RuntimeServeConfig;
|
|
896
|
+
}>;
|
|
897
|
+
|
|
572
898
|
type FetchHandler = (request: Request, ...args: any) => Response | Promise<Response>;
|
|
573
899
|
interface ServerlessHandler {
|
|
574
900
|
fetch: FetchHandler;
|
|
@@ -578,12 +904,20 @@ interface RegistryRoutes {
|
|
|
578
904
|
metadata(): Promise<Response>;
|
|
579
905
|
prometheusMetrics(request?: Request): Promise<Response>;
|
|
580
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* Injectable dependencies for {@link Registry}. Production code uses the
|
|
909
|
+
* defaults. Tests override `buildConfiguredRegistry` to drive lifecycle
|
|
910
|
+
* orchestration against a fake `CoreRuntime` without an engine.
|
|
911
|
+
*/
|
|
912
|
+
interface RegistryDeps {
|
|
913
|
+
buildConfiguredRegistry: typeof buildConfiguredRegistry;
|
|
914
|
+
}
|
|
581
915
|
declare class Registry<A extends RegistryActors> {
|
|
582
916
|
#private;
|
|
583
917
|
readonly routes: RegistryRoutes;
|
|
584
918
|
get config(): RegistryConfigInput<A>;
|
|
585
919
|
parseConfig(): RegistryConfig;
|
|
586
|
-
constructor(config: RegistryConfigInput<A>);
|
|
920
|
+
constructor(config: RegistryConfigInput<A>, deps?: Partial<RegistryDeps>);
|
|
587
921
|
/**
|
|
588
922
|
* Handle an incoming HTTP request for serverless deployments.
|
|
589
923
|
*
|
|
@@ -604,10 +938,57 @@ declare class Registry<A extends RegistryActors> {
|
|
|
604
938
|
* ```
|
|
605
939
|
*/
|
|
606
940
|
serve(): ServerlessHandler;
|
|
941
|
+
/**
|
|
942
|
+
* Bind an HTTP listener provided by the native (Rust) runtime and serve
|
|
943
|
+
* the registry's serverless endpoints over it. Resolves only after the
|
|
944
|
+
* registry is shut down (SIGINT/SIGTERM or `nativeRegistry.shutdown()`).
|
|
945
|
+
*
|
|
946
|
+
* @param opts.port Port to listen on. Defaults to `process.env.RIVET_PORT`
|
|
947
|
+
* if set, otherwise 3000.
|
|
948
|
+
* @param opts.host Address to bind. Defaults to `0.0.0.0`.
|
|
949
|
+
* @param opts.publicDir If set, serves static files from this directory
|
|
950
|
+
* as a fallback below the framework routes.
|
|
951
|
+
*
|
|
952
|
+
* @example
|
|
953
|
+
* ```ts
|
|
954
|
+
* await registry.listen();
|
|
955
|
+
* await registry.listen({ port: 8080, publicDir: "./public" });
|
|
956
|
+
* ```
|
|
957
|
+
*/
|
|
958
|
+
listen(opts?: {
|
|
959
|
+
port?: number;
|
|
960
|
+
host?: string;
|
|
961
|
+
publicDir?: string;
|
|
962
|
+
}): Promise<void>;
|
|
963
|
+
/**
|
|
964
|
+
* Gracefully drains all live registries.
|
|
965
|
+
*
|
|
966
|
+
* Programmatic counterpart to the SIGINT/SIGTERM handlers: tears down
|
|
967
|
+
* every live `CoreRegistry` (both `start()` and `handler()` modes) and
|
|
968
|
+
* waits for the serve promise to resolve, all bounded by the shutdown
|
|
969
|
+
* grace period. Unlike a signal-driven shutdown, this does not re-raise a
|
|
970
|
+
* signal or exit the process. The caller owns process lifetime.
|
|
971
|
+
*
|
|
972
|
+
* Idempotent: concurrent or repeated calls share a single drain. Safe to
|
|
973
|
+
* call even if nothing has been started.
|
|
974
|
+
*
|
|
975
|
+
* @example
|
|
976
|
+
* ```ts
|
|
977
|
+
* const registry = setup({ use: { counter } });
|
|
978
|
+
* registry.start();
|
|
979
|
+
* // ...later, on your own shutdown trigger:
|
|
980
|
+
* await registry.shutdown();
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
shutdown(): Promise<void>;
|
|
607
984
|
startEnvoy(): void;
|
|
608
985
|
/**
|
|
609
986
|
* Starts the actor envoy for standalone server deployments.
|
|
610
987
|
*
|
|
988
|
+
* Set `RIVETKIT_RUNTIME_MODE=serverless` to instead bind an HTTP listener
|
|
989
|
+
* via `listen()` (Mode B). Mode A (envoy) and Mode B (listener) are
|
|
990
|
+
* mutually exclusive per registry instance.
|
|
991
|
+
*
|
|
611
992
|
* @example
|
|
612
993
|
* ```ts
|
|
613
994
|
* const registry = setup({ use: { counter } });
|
|
@@ -642,6 +1023,12 @@ interface QueueSendResult<TResponse = unknown> {
|
|
|
642
1023
|
* @returns {Promise<Response>}
|
|
643
1024
|
*/
|
|
644
1025
|
type ActorActionFunction<Args extends Array<unknown> = unknown[], Response = unknown> = (...args: Args extends [unknown, ...infer Rest] ? Rest : Args) => Promise<Response>;
|
|
1026
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
1027
|
+
type LooseEventSubscribe = (eventName: string, callback: (...args: any[]) => void) => () => void;
|
|
1028
|
+
type ActorActionMap<R> = {
|
|
1029
|
+
[K in keyof NonNullable<R>]: NonNullable<R>[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Awaited<Return>> : never;
|
|
1030
|
+
};
|
|
1031
|
+
type ActionsOf<AD extends AnyActorDefinition> = AD extends BaseActorDefinition<any, any, any, any, any, any, any, any, infer R> ? R : never;
|
|
645
1032
|
interface ActorGatewayOptions {
|
|
646
1033
|
skipReadyWait?: boolean;
|
|
647
1034
|
}
|
|
@@ -654,9 +1041,7 @@ type ActorWebSocketOptions = ActorGatewayOptions;
|
|
|
654
1041
|
/**
|
|
655
1042
|
* Maps action methods from actor definition to typed function signatures.
|
|
656
1043
|
*/
|
|
657
|
-
type ActorDefinitionActions<AD extends AnyActorDefinition> = AD extends
|
|
658
|
-
[K in keyof R]: R[K] extends (...args: infer Args) => infer Return ? ActorActionFunction<Args, Return> : never;
|
|
659
|
-
} : never;
|
|
1044
|
+
type ActorDefinitionActions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? Record<string, ActorActionFunction<any[], any>> : ActorActionMap<ActionsOf<AD>>;
|
|
660
1045
|
type ActorQueueSend<TQueues extends QueueSchemaConfig> = {
|
|
661
1046
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options: QueueSendWaitOptions): Promise<QueueSendResult<InferQueueCompleteMap<TQueues>[K]>>;
|
|
662
1047
|
<K extends keyof TQueues & string>(name: K, body: InferSchemaMap<TQueues>[K], options?: QueueSendNoWaitOptions): Promise<void>;
|
|
@@ -667,13 +1052,31 @@ type ActorEventSubscribe<TEvents extends EventSchemaConfig> = {
|
|
|
667
1052
|
<K extends keyof TEvents & string>(eventName: K, callback: (...args: InferEventArgs<InferSchemaMap<TEvents>[K]>) => void): () => void;
|
|
668
1053
|
(eventName: keyof TEvents extends never ? string : never, callback: (...args: any[]) => void): () => void;
|
|
669
1054
|
};
|
|
670
|
-
type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = AD
|
|
1055
|
+
type ActorDefinitionQueueSend<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
|
|
1056
|
+
send: ActorQueueSend<Record<string, any>>;
|
|
1057
|
+
} : AD extends {
|
|
1058
|
+
config: {
|
|
1059
|
+
queues?: infer Q;
|
|
1060
|
+
};
|
|
1061
|
+
} ? Q extends QueueSchemaConfig ? {
|
|
1062
|
+
send: ActorQueueSend<Q>;
|
|
1063
|
+
} : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, any, infer Q, any> ? Q extends QueueSchemaConfig ? {
|
|
671
1064
|
send: ActorQueueSend<Q>;
|
|
672
|
-
} :
|
|
673
|
-
type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = AD
|
|
1065
|
+
} : {} : {};
|
|
1066
|
+
type ActorDefinitionEventSubscriptions<AD extends AnyActorDefinition> = IsAny<AD> extends true ? {
|
|
1067
|
+
on: LooseEventSubscribe;
|
|
1068
|
+
once: LooseEventSubscribe;
|
|
1069
|
+
} : AD extends {
|
|
1070
|
+
config: {
|
|
1071
|
+
events?: infer E;
|
|
1072
|
+
};
|
|
1073
|
+
} ? E extends EventSchemaConfig ? {
|
|
1074
|
+
on: ActorEventSubscribe<E>;
|
|
1075
|
+
once: ActorEventSubscribe<E>;
|
|
1076
|
+
} : {} : AD extends BaseActorDefinition<any, any, any, any, any, any, infer E, any, any> ? E extends EventSchemaConfig ? {
|
|
674
1077
|
on: ActorEventSubscribe<E>;
|
|
675
1078
|
once: ActorEventSubscribe<E>;
|
|
676
|
-
} :
|
|
1079
|
+
} : {} : {};
|
|
677
1080
|
|
|
678
1081
|
type ActorResolutionState = ActorQuery;
|
|
679
1082
|
|
|
@@ -1099,6 +1502,7 @@ type Client<A extends Registry<any>> = ClientRaw & {
|
|
|
1099
1502
|
};
|
|
1100
1503
|
|
|
1101
1504
|
declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
|
|
1505
|
+
declare const RAW_STATE_SYMBOL: unique symbol;
|
|
1102
1506
|
interface ActorLogger {
|
|
1103
1507
|
level: any;
|
|
1104
1508
|
fatal: any;
|
|
@@ -1131,6 +1535,10 @@ type ActorKvListOptions<T extends ActorKvValueType = "text", K extends ActorKvKe
|
|
|
1131
1535
|
limit?: number;
|
|
1132
1536
|
};
|
|
1133
1537
|
type ActorClientFor<T> = T extends Registry<any> ? Client<T> : T;
|
|
1538
|
+
/**
|
|
1539
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`c.db` / `c.sql`)
|
|
1540
|
+
* or actor state instead.
|
|
1541
|
+
*/
|
|
1134
1542
|
interface ActorKv {
|
|
1135
1543
|
get<T extends ActorKvValueType = "text">(key: Uint8Array | string, options?: ActorKvValueOptions<T>): Promise<ActorKvValueTypeMap[T] | null>;
|
|
1136
1544
|
put<T extends ActorKvValueType = "text">(key: Uint8Array | string, value: Uint8Array | string | ArrayBuffer, options?: ActorKvValueOptions<T>): Promise<void>;
|
|
@@ -1207,7 +1615,7 @@ interface ActorQueue<TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
|
1207
1615
|
iter<const TName extends QueueFilterName<TQueues>, const TCompletable extends boolean = false>(opts?: QueueIterOptions<TName, TCompletable>): AsyncIterable<any>;
|
|
1208
1616
|
[key: string]: any;
|
|
1209
1617
|
}
|
|
1210
|
-
interface Conn<
|
|
1618
|
+
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>> {
|
|
1211
1619
|
id: string;
|
|
1212
1620
|
params: TConnParams;
|
|
1213
1621
|
state: TConnState;
|
|
@@ -1218,8 +1626,14 @@ interface Conn<TState = unknown, TConnParams = unknown, TConnState = unknown, TV
|
|
|
1218
1626
|
}
|
|
1219
1627
|
interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
|
|
1220
1628
|
[ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
|
|
1629
|
+
/** Returns the raw unwrapped state without the write-through proxy. */
|
|
1630
|
+
[RAW_STATE_SYMBOL](): TState;
|
|
1221
1631
|
state: TState;
|
|
1222
1632
|
vars: TVars;
|
|
1633
|
+
/**
|
|
1634
|
+
* @deprecated Actor KV is deprecated. Use embedded SQLite (`db` / `sql`)
|
|
1635
|
+
* or actor state instead.
|
|
1636
|
+
*/
|
|
1223
1637
|
readonly kv: ActorKv;
|
|
1224
1638
|
readonly db: InferDatabaseClient<TDatabase>;
|
|
1225
1639
|
readonly schedule: ActorSchedule;
|
|
@@ -1344,8 +1758,27 @@ declare const ActorConfigSchema: z$1.ZodObject<{
|
|
|
1344
1758
|
preloadMaxWorkflowBytes: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1345
1759
|
preloadMaxConnectionsBytes: z$1.ZodOptional<z$1.ZodNumber>;
|
|
1346
1760
|
}, z$1.core.$strict>>;
|
|
1761
|
+
inspector: z$1.ZodOptional<z$1.ZodObject<{
|
|
1762
|
+
tabs: z$1.ZodDefault<z$1.ZodArray<z$1.ZodUnion<readonly [z$1.ZodObject<{
|
|
1763
|
+
id: z$1.ZodString;
|
|
1764
|
+
label: z$1.ZodString;
|
|
1765
|
+
source: z$1.ZodString;
|
|
1766
|
+
icon: z$1.ZodOptional<z$1.ZodString>;
|
|
1767
|
+
hidden: z$1.ZodOptional<z$1.ZodLiteral<false>>;
|
|
1768
|
+
}, z$1.core.$strict>, z$1.ZodObject<{
|
|
1769
|
+
id: z$1.ZodEnum<{
|
|
1770
|
+
state: "state";
|
|
1771
|
+
queue: "queue";
|
|
1772
|
+
workflow: "workflow";
|
|
1773
|
+
database: "database";
|
|
1774
|
+
connections: "connections";
|
|
1775
|
+
console: "console";
|
|
1776
|
+
}>;
|
|
1777
|
+
hidden: z$1.ZodLiteral<true>;
|
|
1778
|
+
}, z$1.core.$strict>]>>>;
|
|
1779
|
+
}, z$1.core.$strict>>;
|
|
1347
1780
|
}, z$1.core.$strict>;
|
|
1348
|
-
type CreateState<TState,
|
|
1781
|
+
type CreateState<TState, _TConnParams, _TConnState, _TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
1349
1782
|
state: TState;
|
|
1350
1783
|
} | {
|
|
1351
1784
|
createState: (c: CreateContext<TState, TInput, TDatabase, TEvents, TQueues>, input: TInput) => TState | Promise<TState>;
|
|
@@ -1358,7 +1791,7 @@ type CreateConnState<TState, TConnParams, TConnState, TVars, TInput, TDatabase e
|
|
|
1358
1791
|
/**
|
|
1359
1792
|
* @experimental
|
|
1360
1793
|
*/
|
|
1361
|
-
type CreateVars<TState,
|
|
1794
|
+
type CreateVars<TState, _TConnParams, _TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig, TQueues extends QueueSchemaConfig> = {
|
|
1362
1795
|
/**
|
|
1363
1796
|
* @experimental
|
|
1364
1797
|
*/
|
|
@@ -1544,7 +1977,7 @@ type ActorDatabaseConfig<TDatabase extends AnyDatabaseProvider> = {
|
|
|
1544
1977
|
*/
|
|
1545
1978
|
db: TDatabase;
|
|
1546
1979
|
} | Record<never, never>;
|
|
1547
|
-
type ActorConfig<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> = Omit<z$1.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,
|
|
1980
|
+
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$1.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>;
|
|
1548
1981
|
|
|
1549
1982
|
type AgentOsActorState = {};
|
|
1550
1983
|
interface AgentOsActorVars {
|
|
@@ -1666,6 +2099,16 @@ interface AgentOsActorConfigCallbacks<TConnParams> {
|
|
|
1666
2099
|
type AgentOsActorConfig<TConnParams = undefined> = Omit<z$1.infer<typeof agentOsActorConfigSchema>, "onBeforeConnect" | "onSessionEvent" | "onPermissionRequest"> & AgentOsActorConfigCallbacks<TConnParams>;
|
|
1667
2100
|
type AgentOsActorConfigInput<TConnParams = undefined> = Omit<z$1.input<typeof agentOsActorConfigSchema>, "onBeforeConnect" | "onSessionEvent" | "onPermissionRequest"> & AgentOsActorConfigCallbacks<TConnParams>;
|
|
1668
2101
|
|
|
2102
|
+
declare function buildCronActions<TConnParams>(config: AgentOsActorConfig<TConnParams>): {
|
|
2103
|
+
scheduleCron: (c: AgentOsActionContext<TConnParams>, options: SerializableCronJobOptions) => Promise<{
|
|
2104
|
+
id: string;
|
|
2105
|
+
}>;
|
|
2106
|
+
listCronJobs: (c: AgentOsActionContext<TConnParams>) => Promise<SerializableCronJobInfo[]>;
|
|
2107
|
+
cancelCronJob: (c: AgentOsActionContext<TConnParams>, id: string) => Promise<void>;
|
|
2108
|
+
};
|
|
2109
|
+
|
|
2110
|
+
declare function migrateAgentOsTables(db: RawAccess): Promise<void>;
|
|
2111
|
+
|
|
1669
2112
|
type VirtualStat = Awaited<ReturnType<_rivet_dev_agent_os_core.AgentOs["stat"]>>;
|
|
1670
2113
|
type DeleteOptions = Parameters<_rivet_dev_agent_os_core.AgentOs["delete"]>[1];
|
|
1671
2114
|
declare function buildFilesystemActions<TConnParams>(config: AgentOsActorConfig<TConnParams>): {
|
|
@@ -1697,16 +2140,7 @@ declare function agentOs<TConnParams = undefined>(config: AgentOsActorConfigInpu
|
|
|
1697
2140
|
processExit: typeof processExitToken;
|
|
1698
2141
|
shellData: typeof shellDataToken;
|
|
1699
2142
|
cronEvent: typeof cronEventToken;
|
|
1700
|
-
}, Record<never, never>,
|
|
1701
|
-
sessionEvent: typeof sessionEventToken;
|
|
1702
|
-
permissionRequest: typeof permissionRequestToken;
|
|
1703
|
-
vmBooted: typeof vmBootedToken;
|
|
1704
|
-
vmShutdown: typeof vmShutdownToken;
|
|
1705
|
-
processOutput: typeof processOutputToken;
|
|
1706
|
-
processExit: typeof processExitToken;
|
|
1707
|
-
shellData: typeof shellDataToken;
|
|
1708
|
-
cronEvent: typeof cronEventToken;
|
|
1709
|
-
}, Record<never, never>>>;
|
|
2143
|
+
}, Record<never, never>, any>;
|
|
1710
2144
|
declare const sessionEventToken: EventTypeToken<SessionEventPayload, any>;
|
|
1711
2145
|
declare const permissionRequestToken: EventTypeToken<PermissionRequestPayload, any>;
|
|
1712
2146
|
declare const vmBootedToken: EventTypeToken<VmBootedPayload, any>;
|
|
@@ -1716,6 +2150,21 @@ declare const processExitToken: EventTypeToken<ProcessExitPayload, any>;
|
|
|
1716
2150
|
declare const shellDataToken: EventTypeToken<ShellDataPayload, any>;
|
|
1717
2151
|
declare const cronEventToken: EventTypeToken<CronEventPayload, any>;
|
|
1718
2152
|
|
|
2153
|
+
interface VmFetchOptions {
|
|
2154
|
+
method?: string;
|
|
2155
|
+
headers?: Record<string, string>;
|
|
2156
|
+
body?: string | Uint8Array;
|
|
2157
|
+
}
|
|
2158
|
+
interface VmFetchResult {
|
|
2159
|
+
status: number;
|
|
2160
|
+
statusText: string;
|
|
2161
|
+
headers: Record<string, string>;
|
|
2162
|
+
body: Uint8Array;
|
|
2163
|
+
}
|
|
2164
|
+
declare function buildNetworkActions<TConnParams>(config: AgentOsActorConfig<TConnParams>): {
|
|
2165
|
+
vmFetch: (c: AgentOsActionContext<TConnParams>, port: number, url: string, options?: VmFetchOptions) => Promise<VmFetchResult>;
|
|
2166
|
+
};
|
|
2167
|
+
|
|
1719
2168
|
declare function generateToken(): string;
|
|
1720
2169
|
type AgentOsRequestContext<TConnParams> = RequestContext<AgentOsActorState, TConnParams, undefined, AgentOsActorVars, undefined, DatabaseProvider<RawAccess>>;
|
|
1721
2170
|
declare function buildOnRequestHandler<TConnParams>(config: AgentOsActorConfig<TConnParams>): (c: AgentOsRequestContext<TConnParams>, request: Request) => Promise<Response>;
|
|
@@ -1788,27 +2237,18 @@ declare function buildShellActions<TConnParams>(config: AgentOsActorConfig<TConn
|
|
|
1788
2237
|
closeShell: (c: AgentOsActionContext<TConnParams>, shellId: string) => Promise<void>;
|
|
1789
2238
|
};
|
|
1790
2239
|
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
listCronJobs: (c: AgentOsActionContext<TConnParams>) => Promise<SerializableCronJobInfo[]>;
|
|
1796
|
-
cancelCronJob: (c: AgentOsActionContext<TConnParams>, id: string) => Promise<void>;
|
|
1797
|
-
};
|
|
1798
|
-
|
|
1799
|
-
interface VmFetchOptions {
|
|
1800
|
-
method?: string;
|
|
1801
|
-
headers?: Record<string, string>;
|
|
1802
|
-
body?: string | Uint8Array;
|
|
1803
|
-
}
|
|
1804
|
-
interface VmFetchResult {
|
|
1805
|
-
status: number;
|
|
1806
|
-
statusText: string;
|
|
1807
|
-
headers: Record<string, string>;
|
|
1808
|
-
body: Uint8Array;
|
|
2240
|
+
type VirtualFileSystem = _rivet_dev_agent_os_core.PlainMountConfig["driver"];
|
|
2241
|
+
interface DatabaseVfsOptions {
|
|
2242
|
+
/** The RawAccess database handle from the actor's db provider. */
|
|
2243
|
+
db: RawAccess;
|
|
1809
2244
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
2245
|
+
/**
|
|
2246
|
+
* Create a VirtualFileSystem backed by SQLite.
|
|
2247
|
+
*
|
|
2248
|
+
* The returned filesystem stores all content and metadata in the
|
|
2249
|
+
* `agent_os_fs_entries` table. The table must be created beforehand
|
|
2250
|
+
* via `migrateAgentOsTables()`.
|
|
2251
|
+
*/
|
|
2252
|
+
declare function createDatabaseVfs(options: DatabaseVfsOptions): VirtualFileSystem;
|
|
1813
2253
|
|
|
1814
2254
|
export { type AgentOsActionContext, type AgentOsActorConfig, type AgentOsActorConfigInput, type AgentOsActorState, type AgentOsActorVars, type AgentOsEvents, type CronEventPayload, type DatabaseVfsOptions, type PermissionRequestPayload, type PersistedSessionEvent, type PersistedSessionRecord, type ProcessExitPayload, type ProcessOutputPayload, type PromptResult, type SerializableCronAction, type SerializableCronJobOptions, type SessionEventPayload, type SessionRecord, type ShellDataPayload, type VmBootedPayload, type VmFetchOptions, type VmFetchResult, type VmShutdownPayload, agentOs, agentOsActorConfigSchema, buildConfigActions, buildCronActions, buildFilesystemActions, buildNetworkActions, buildOnRequestHandler, buildPreviewActions, buildProcessActions, buildPromptActions, buildSessionActions, buildSessionPersistenceActions, buildShellActions, createDatabaseVfs, ensureVm, generateToken, migrateAgentOsTables, runHook, subscribeToSession, syncPreventSleep };
|