rivetkit 2.0.8 → 2.0.10
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/tsup/{chunk-2FAWAPRT.js → chunk-346X2XU4.js} +2 -2
- package/dist/tsup/{chunk-SFRRXLRM.js → chunk-7E5K3375.js} +2 -2
- package/dist/tsup/{chunk-3WRAGTDC.cjs → chunk-CA3X5M6H.cjs} +92 -39
- package/dist/tsup/{chunk-PVKV2O2E.js.map → chunk-CA3X5M6H.cjs.map} +1 -1
- package/dist/tsup/{chunk-L5MHM6JJ.cjs → chunk-DVPXSB4B.cjs} +12 -12
- package/dist/tsup/{chunk-L5MHM6JJ.cjs.map → chunk-DVPXSB4B.cjs.map} +1 -1
- package/dist/tsup/{chunk-DQVVH5ZK.cjs → chunk-GIFHYL7A.cjs} +5 -6
- package/dist/tsup/chunk-GIFHYL7A.cjs.map +1 -0
- package/dist/tsup/{chunk-N7OVEOMU.js → chunk-H7E2UU23.js} +38 -15
- package/dist/tsup/chunk-H7E2UU23.js.map +1 -0
- package/dist/tsup/{chunk-A6TV3QU6.js → chunk-HI55LHM3.js} +5 -6
- package/dist/tsup/chunk-HI55LHM3.js.map +1 -0
- package/dist/tsup/{chunk-FGOZELKN.cjs → chunk-I3FB346I.cjs} +112 -58
- package/dist/tsup/chunk-I3FB346I.cjs.map +1 -0
- package/dist/tsup/{chunk-DOZBWJRI.js → chunk-KGDZYQYE.js} +2 -2
- package/dist/tsup/{chunk-KYEEAVJO.cjs → chunk-KH5WFDUK.cjs} +6 -6
- package/dist/tsup/{chunk-KYEEAVJO.cjs.map → chunk-KH5WFDUK.cjs.map} +1 -1
- package/dist/tsup/{chunk-WP7YG7S5.js → chunk-KL4V2ULR.js} +5 -4
- package/dist/tsup/chunk-KL4V2ULR.js.map +1 -0
- package/dist/tsup/{chunk-S6EAEZQA.js → chunk-MLQIYKAZ.js} +106 -52
- package/dist/tsup/chunk-MLQIYKAZ.js.map +1 -0
- package/dist/tsup/{chunk-3ZMJUIL3.js → chunk-N3A5GYJU.js} +3 -3
- package/dist/tsup/{chunk-CKSA7NOS.cjs → chunk-PDFL7FBL.cjs} +717 -380
- package/dist/tsup/chunk-PDFL7FBL.cjs.map +1 -0
- package/dist/tsup/{chunk-ESD2JX3L.cjs → chunk-PPLR53PP.cjs} +3 -3
- package/dist/tsup/{chunk-ESD2JX3L.cjs.map → chunk-PPLR53PP.cjs.map} +1 -1
- package/dist/tsup/{chunk-6INXQCH7.cjs → chunk-PSCDCEXM.cjs} +17 -12
- package/dist/tsup/chunk-PSCDCEXM.cjs.map +1 -0
- package/dist/tsup/{chunk-PVKV2O2E.js → chunk-QRFXXTLG.js} +96 -43
- package/dist/tsup/chunk-QRFXXTLG.js.map +1 -0
- package/dist/tsup/{chunk-RM2V2IRK.js → chunk-R2S45MO6.js} +14 -9
- package/dist/tsup/chunk-R2S45MO6.js.map +1 -0
- package/dist/tsup/{chunk-QGUQB3NC.cjs → chunk-SIWYIRXP.cjs} +7 -6
- package/dist/tsup/chunk-SIWYIRXP.cjs.map +1 -0
- package/dist/tsup/{chunk-E77RVI3P.js → chunk-VJRXZPTT.js} +601 -264
- package/dist/tsup/chunk-VJRXZPTT.js.map +1 -0
- package/dist/tsup/{chunk-KDNB2BQX.cjs → chunk-VZMXAZKC.cjs} +229 -206
- package/dist/tsup/chunk-VZMXAZKC.cjs.map +1 -0
- package/dist/tsup/{chunk-TPJNKVFB.cjs → chunk-YKVTF7MP.cjs} +7 -7
- package/dist/tsup/{chunk-TPJNKVFB.cjs.map → chunk-YKVTF7MP.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- 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/{conn-ChAuuTr0.d.cts → conn-Cc9WHuN4.d.cts} +196 -185
- package/dist/tsup/{conn-CjUkMEcm.d.ts → conn-DfPG71FA.d.ts} +196 -185
- package/dist/tsup/driver-helpers/mod.cjs +7 -5
- package/dist/tsup/driver-helpers/mod.cjs.map +1 -1
- package/dist/tsup/driver-helpers/mod.d.cts +4 -2
- package/dist/tsup/driver-helpers/mod.d.ts +4 -2
- package/dist/tsup/driver-helpers/mod.js +9 -7
- package/dist/tsup/driver-test-suite/mod.cjs +116 -102
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +3 -2
- package/dist/tsup/driver-test-suite/mod.d.ts +3 -2
- package/dist/tsup/driver-test-suite/mod.js +61 -47
- package/dist/tsup/driver-test-suite/mod.js.map +1 -1
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.d.cts +6 -6
- package/dist/tsup/inspector/mod.d.ts +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/mod.cjs +10 -10
- package/dist/tsup/mod.d.cts +8 -39
- package/dist/tsup/mod.d.ts +8 -39
- package/dist/tsup/mod.js +9 -9
- package/dist/tsup/test/mod.cjs +11 -11
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +10 -10
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.d.cts +2 -1
- package/dist/tsup/utils.d.ts +2 -1
- package/dist/tsup/utils.js +1 -1
- package/package.json +4 -5
- package/src/actor/driver.ts +2 -2
- package/src/actor/instance.ts +4 -4
- package/src/actor/protocol/serde.ts +75 -3
- package/src/actor/router-endpoints.ts +6 -6
- package/src/actor/router.ts +2 -2
- package/src/client/actor-conn.ts +24 -3
- package/src/client/config.ts +18 -25
- package/src/driver-helpers/mod.ts +5 -1
- package/src/driver-test-suite/mod.ts +65 -43
- package/src/driver-test-suite/utils.ts +4 -1
- package/src/drivers/default.ts +11 -9
- package/src/drivers/engine/actor-driver.ts +40 -39
- package/src/drivers/engine/config.ts +9 -22
- package/src/drivers/engine/mod.ts +9 -8
- package/src/drivers/file-system/global-state.ts +4 -4
- package/src/engine-process/log.ts +5 -0
- package/src/engine-process/mod.ts +316 -0
- package/src/inspector/utils.ts +6 -4
- package/src/manager/driver.ts +3 -3
- package/src/manager/gateway.ts +29 -11
- package/src/manager/router-schema.ts +20 -0
- package/src/manager/router.ts +139 -58
- package/src/registry/mod.ts +146 -120
- package/src/registry/run-config.ts +116 -47
- package/src/registry/serve.ts +3 -1
- package/src/remote-manager-driver/mod.ts +3 -2
- package/src/serde.ts +18 -3
- package/src/test/config.ts +2 -2
- package/src/test/mod.ts +6 -3
- package/src/utils.ts +2 -0
- package/dist/tsup/chunk-3WRAGTDC.cjs.map +0 -1
- package/dist/tsup/chunk-6INXQCH7.cjs.map +0 -1
- package/dist/tsup/chunk-A6TV3QU6.js.map +0 -1
- package/dist/tsup/chunk-CKSA7NOS.cjs.map +0 -1
- package/dist/tsup/chunk-DQVVH5ZK.cjs.map +0 -1
- package/dist/tsup/chunk-E77RVI3P.js.map +0 -1
- package/dist/tsup/chunk-FGOZELKN.cjs.map +0 -1
- package/dist/tsup/chunk-KDNB2BQX.cjs.map +0 -1
- package/dist/tsup/chunk-N7OVEOMU.js.map +0 -1
- package/dist/tsup/chunk-QGUQB3NC.cjs.map +0 -1
- package/dist/tsup/chunk-RM2V2IRK.js.map +0 -1
- package/dist/tsup/chunk-S6EAEZQA.js.map +0 -1
- package/dist/tsup/chunk-WP7YG7S5.js.map +0 -1
- /package/dist/tsup/{chunk-2FAWAPRT.js.map → chunk-346X2XU4.js.map} +0 -0
- /package/dist/tsup/{chunk-SFRRXLRM.js.map → chunk-7E5K3375.js.map} +0 -0
- /package/dist/tsup/{chunk-DOZBWJRI.js.map → chunk-KGDZYQYE.js.map} +0 -0
- /package/dist/tsup/{chunk-3ZMJUIL3.js.map → chunk-N3A5GYJU.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SSEStreamingApi } from 'hono/streaming';
|
|
2
2
|
import { WSContext } from 'hono/ws';
|
|
3
|
-
import {
|
|
3
|
+
import { GetUpgradeWebSocket, promiseWithResolvers } from './utils.cjs';
|
|
4
4
|
import z$1, { z } from 'zod';
|
|
5
5
|
import { Logger } from 'pino';
|
|
6
6
|
import * as hono from 'hono';
|
|
@@ -138,129 +138,6 @@ type RegistryConfigInput<A extends RegistryActors> = Omit<z.input<typeof Registr
|
|
|
138
138
|
use: A;
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
-
type GetUpgradeWebSocket = () => UpgradeWebSocket;
|
|
142
|
-
declare const ClientConfigSchema: z$1.ZodObject<{
|
|
143
|
-
/** Configure serving the API */
|
|
144
|
-
api: z$1.ZodDefault<z$1.ZodObject<{
|
|
145
|
-
host: z$1.ZodDefault<z$1.ZodString>;
|
|
146
|
-
port: z$1.ZodDefault<z$1.ZodNumber>;
|
|
147
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
148
|
-
host: string;
|
|
149
|
-
port: number;
|
|
150
|
-
}, {
|
|
151
|
-
host?: string | undefined;
|
|
152
|
-
port?: number | undefined;
|
|
153
|
-
}>>;
|
|
154
|
-
token: z$1.ZodEffects<z$1.ZodOptional<z$1.ZodString>, string | undefined, string | undefined>;
|
|
155
|
-
totalSlots: z$1.ZodOptional<z$1.ZodNumber>;
|
|
156
|
-
headers: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>>;
|
|
157
|
-
/** Endpoint to connect to the Rivet engine. Can be configured via RIVET_ENGINE env var. */
|
|
158
|
-
endpoint: z$1.ZodDefault<z$1.ZodNullable<z$1.ZodString>>;
|
|
159
|
-
namespace: z$1.ZodDefault<z$1.ZodString>;
|
|
160
|
-
runnerName: z$1.ZodDefault<z$1.ZodString>;
|
|
161
|
-
encoding: z$1.ZodDefault<z$1.ZodEnum<["json", "cbor", "bare"]>>;
|
|
162
|
-
transport: z$1.ZodDefault<z$1.ZodEnum<["websocket", "sse"]>>;
|
|
163
|
-
getUpgradeWebSocket: z$1.ZodOptional<z$1.ZodType<GetUpgradeWebSocket, z$1.ZodTypeDef, GetUpgradeWebSocket>>;
|
|
164
|
-
}, "strip", z$1.ZodTypeAny, {
|
|
165
|
-
encoding: "json" | "cbor" | "bare";
|
|
166
|
-
api: {
|
|
167
|
-
host: string;
|
|
168
|
-
port: number;
|
|
169
|
-
};
|
|
170
|
-
headers: Record<string, string>;
|
|
171
|
-
endpoint: string | null;
|
|
172
|
-
namespace: string;
|
|
173
|
-
runnerName: string;
|
|
174
|
-
transport: "websocket" | "sse";
|
|
175
|
-
token?: string | undefined;
|
|
176
|
-
totalSlots?: number | undefined;
|
|
177
|
-
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
178
|
-
}, {
|
|
179
|
-
encoding?: "json" | "cbor" | "bare" | undefined;
|
|
180
|
-
api?: {
|
|
181
|
-
host?: string | undefined;
|
|
182
|
-
port?: number | undefined;
|
|
183
|
-
} | undefined;
|
|
184
|
-
token?: string | undefined;
|
|
185
|
-
totalSlots?: number | undefined;
|
|
186
|
-
headers?: Record<string, string> | undefined;
|
|
187
|
-
endpoint?: string | null | undefined;
|
|
188
|
-
namespace?: string | undefined;
|
|
189
|
-
runnerName?: string | undefined;
|
|
190
|
-
transport?: "websocket" | "sse" | undefined;
|
|
191
|
-
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
192
|
-
}>;
|
|
193
|
-
type ClientConfig = z$1.infer<typeof ClientConfigSchema>;
|
|
194
|
-
type ClientConfigInput = z$1.input<typeof ClientConfigSchema>;
|
|
195
|
-
|
|
196
|
-
type ManagerDriverBuilder = (registryConfig: RegistryConfig, runConfig: RunConfig) => ManagerDriver;
|
|
197
|
-
interface ManagerDriver {
|
|
198
|
-
getForId(input: GetForIdInput): Promise<ActorOutput | undefined>;
|
|
199
|
-
getWithKey(input: GetWithKeyInput): Promise<ActorOutput | undefined>;
|
|
200
|
-
getOrCreateWithKey(input: GetOrCreateWithKeyInput): Promise<ActorOutput>;
|
|
201
|
-
createActor(input: CreateInput): Promise<ActorOutput>;
|
|
202
|
-
sendRequest(actorId: string, actorRequest: Request): Promise<Response>;
|
|
203
|
-
openWebSocket(path: string, actorId: string, encoding: Encoding, params: unknown, connId?: string, connToken?: string): Promise<UniversalWebSocket>;
|
|
204
|
-
proxyRequest(c: Context, actorRequest: Request, actorId: string): Promise<Response>;
|
|
205
|
-
proxyWebSocket(c: Context, path: string, actorId: string, encoding: Encoding, params: unknown, connId?: string, connToken?: string): Promise<Response>;
|
|
206
|
-
displayInformation(): ManagerDisplayInformation;
|
|
207
|
-
extraStartupLog?: () => Record<string, unknown>;
|
|
208
|
-
modifyManagerRouter?: (registryConfig: RegistryConfig, router: Hono) => void;
|
|
209
|
-
}
|
|
210
|
-
interface ManagerDisplayInformation {
|
|
211
|
-
name: string;
|
|
212
|
-
properties: Record<string, string>;
|
|
213
|
-
}
|
|
214
|
-
interface GetForIdInput<E extends Env = any> {
|
|
215
|
-
c?: Context | undefined;
|
|
216
|
-
name: string;
|
|
217
|
-
actorId: string;
|
|
218
|
-
}
|
|
219
|
-
interface GetWithKeyInput<E extends Env = any> {
|
|
220
|
-
c?: Context | undefined;
|
|
221
|
-
name: string;
|
|
222
|
-
key: ActorKey;
|
|
223
|
-
}
|
|
224
|
-
interface GetOrCreateWithKeyInput<E extends Env = any> {
|
|
225
|
-
c?: Context | undefined;
|
|
226
|
-
name: string;
|
|
227
|
-
key: ActorKey;
|
|
228
|
-
input?: unknown;
|
|
229
|
-
region?: string;
|
|
230
|
-
}
|
|
231
|
-
interface CreateInput<E extends Env = any> {
|
|
232
|
-
c?: Context | undefined;
|
|
233
|
-
name: string;
|
|
234
|
-
key: ActorKey;
|
|
235
|
-
input?: unknown;
|
|
236
|
-
region?: string;
|
|
237
|
-
}
|
|
238
|
-
interface ActorOutput {
|
|
239
|
-
actorId: string;
|
|
240
|
-
name: string;
|
|
241
|
-
key: ActorKey;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
type ActorDriverBuilder = (registryConfig: RegistryConfig, runConfig: RunConfig, managerDriver: ManagerDriver, inlineClient: AnyClient) => ActorDriver;
|
|
245
|
-
interface ActorDriver {
|
|
246
|
-
loadActor(actorId: string): Promise<AnyActorInstance>;
|
|
247
|
-
getContext(actorId: string): unknown;
|
|
248
|
-
readPersistedData(actorId: string): Promise<Uint8Array | undefined>;
|
|
249
|
-
/** ActorInstance ensure that only one instance of writePersistedData is called in parallel at a time. */
|
|
250
|
-
writePersistedData(actorId: string, data: Uint8Array): Promise<void>;
|
|
251
|
-
/** ActorInstance ensure that only one instance of setAlarm is called in parallel at a time. */
|
|
252
|
-
setAlarm(actor: AnyActorInstance, timestamp: number): Promise<void>;
|
|
253
|
-
/**
|
|
254
|
-
* @experimental
|
|
255
|
-
* This is an experimental API that may change in the future.
|
|
256
|
-
*/
|
|
257
|
-
getDatabase(actorId: string): Promise<unknown | undefined>;
|
|
258
|
-
sleep?(actorId: string): Promise<void>;
|
|
259
|
-
shutdown?(immediate: boolean): Promise<void>;
|
|
260
|
-
/** This handles the serverless start request. This should manage the lifecycle of the runner tied to the request lifecycle. */
|
|
261
|
-
serverlessHandleStart?(c: Context): Promise<Response>;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
141
|
declare const DriverConfigSchema: z.ZodObject<{
|
|
265
142
|
/** Machine-readable name to identify this driver by. */
|
|
266
143
|
name: z.ZodString;
|
|
@@ -277,27 +154,7 @@ declare const DriverConfigSchema: z.ZodObject<{
|
|
|
277
154
|
}>;
|
|
278
155
|
type DriverConfig = z.infer<typeof DriverConfigSchema>;
|
|
279
156
|
/** Base config used for the actor config across all platforms. */
|
|
280
|
-
declare const
|
|
281
|
-
api: z.ZodDefault<z.ZodObject<{
|
|
282
|
-
host: z.ZodDefault<z.ZodString>;
|
|
283
|
-
port: z.ZodDefault<z.ZodNumber>;
|
|
284
|
-
}, "strip", z.ZodTypeAny, {
|
|
285
|
-
host: string;
|
|
286
|
-
port: number;
|
|
287
|
-
}, {
|
|
288
|
-
host?: string | undefined;
|
|
289
|
-
port?: number | undefined;
|
|
290
|
-
}>>;
|
|
291
|
-
token: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
292
|
-
totalSlots: z.ZodOptional<z.ZodNumber>;
|
|
293
|
-
headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
294
|
-
endpoint: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
295
|
-
namespace: z.ZodDefault<z.ZodString>;
|
|
296
|
-
runnerName: z.ZodDefault<z.ZodString>;
|
|
297
|
-
encoding: z.ZodDefault<z.ZodEnum<["json", "cbor", "bare"]>>;
|
|
298
|
-
transport: z.ZodDefault<z.ZodEnum<["websocket", "sse"]>>;
|
|
299
|
-
getUpgradeWebSocket: z.ZodOptional<z.ZodType<GetUpgradeWebSocket, z.ZodTypeDef, GetUpgradeWebSocket>>;
|
|
300
|
-
} & {
|
|
157
|
+
declare const RunnerConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
301
158
|
driver: z.ZodOptional<z.ZodObject<{
|
|
302
159
|
/** Machine-readable name to identify this driver by. */
|
|
303
160
|
name: z.ZodString;
|
|
@@ -312,7 +169,6 @@ declare const RunConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
312
169
|
name: string;
|
|
313
170
|
manager: ManagerDriverBuilder;
|
|
314
171
|
}>>;
|
|
315
|
-
/** CORS configuration for the router. Uses Hono's CORS middleware options. */
|
|
316
172
|
cors: z.ZodOptional<z.ZodType<{
|
|
317
173
|
origin: string | string[] | ((origin: string, c: hono.Context) => Promise<string | undefined | null> | string | undefined | null);
|
|
318
174
|
allowMethods?: string[] | ((origin: string, c: hono.Context) => Promise<string[]> | string[]);
|
|
@@ -388,27 +244,15 @@ declare const RunConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
388
244
|
token?: ((...args: unknown[]) => string) | undefined;
|
|
389
245
|
defaultEndpoint?: string | undefined;
|
|
390
246
|
}>>>;
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
247
|
+
disableDefaultServer: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
248
|
+
defaultServerPort: z.ZodDefault<z.ZodNumber>;
|
|
249
|
+
runEngine: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
250
|
+
runEngineVersion: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
251
|
+
overrideServerAddress: z.ZodOptional<z.ZodString>;
|
|
394
252
|
disableActorDriver: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
395
|
-
|
|
396
|
-
* @experimental
|
|
397
|
-
*
|
|
398
|
-
* Base path for the router. This is used to prefix all routes.
|
|
399
|
-
* For example, if the base path is `/api`, then the route `/actors` will be
|
|
400
|
-
* available at `/api/actors`.
|
|
401
|
-
*/
|
|
253
|
+
runnerKind: z.ZodDefault<z.ZodOptional<z.ZodEnum<["serverless", "normal"]>>>;
|
|
402
254
|
basePath: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
403
|
-
/**
|
|
404
|
-
* @experimental
|
|
405
|
-
*
|
|
406
|
-
* Disable welcome message.
|
|
407
|
-
* */
|
|
408
255
|
noWelcome: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
409
|
-
/**
|
|
410
|
-
* @experimental
|
|
411
|
-
* */
|
|
412
256
|
logging: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
413
257
|
baseLogger: z.ZodOptional<z.ZodType<Logger, z.ZodTypeDef, Logger>>;
|
|
414
258
|
level: z.ZodOptional<z.ZodEnum<["trace", "debug", "info", "warn", "error", "fatal", "silent"]>>;
|
|
@@ -419,6 +263,42 @@ declare const RunConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
419
263
|
level?: "error" | "trace" | "fatal" | "warn" | "info" | "debug" | "silent" | undefined;
|
|
420
264
|
baseLogger?: Logger | undefined;
|
|
421
265
|
}>>>;
|
|
266
|
+
autoConfigureServerless: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
267
|
+
url: z.ZodOptional<z.ZodString>;
|
|
268
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
269
|
+
maxRunners: z.ZodOptional<z.ZodNumber>;
|
|
270
|
+
minRunners: z.ZodOptional<z.ZodNumber>;
|
|
271
|
+
requestLifespan: z.ZodOptional<z.ZodNumber>;
|
|
272
|
+
runnersMargin: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
slotsPerRunner: z.ZodOptional<z.ZodNumber>;
|
|
274
|
+
}, "strip", z.ZodTypeAny, {
|
|
275
|
+
headers?: Record<string, string> | undefined;
|
|
276
|
+
url?: string | undefined;
|
|
277
|
+
maxRunners?: number | undefined;
|
|
278
|
+
minRunners?: number | undefined;
|
|
279
|
+
requestLifespan?: number | undefined;
|
|
280
|
+
runnersMargin?: number | undefined;
|
|
281
|
+
slotsPerRunner?: number | undefined;
|
|
282
|
+
}, {
|
|
283
|
+
headers?: Record<string, string> | undefined;
|
|
284
|
+
url?: string | undefined;
|
|
285
|
+
maxRunners?: number | undefined;
|
|
286
|
+
minRunners?: number | undefined;
|
|
287
|
+
requestLifespan?: number | undefined;
|
|
288
|
+
runnersMargin?: number | undefined;
|
|
289
|
+
slotsPerRunner?: number | undefined;
|
|
290
|
+
}>]>>;
|
|
291
|
+
} & {
|
|
292
|
+
runnerKey: z.ZodDefault<z.ZodString>;
|
|
293
|
+
totalSlots: z.ZodDefault<z.ZodNumber>;
|
|
294
|
+
endpoint: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
295
|
+
token: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
296
|
+
namespace: z.ZodDefault<z.ZodString>;
|
|
297
|
+
runnerName: z.ZodDefault<z.ZodString>;
|
|
298
|
+
encoding: z.ZodDefault<z.ZodEnum<["json", "cbor", "bare"]>>;
|
|
299
|
+
transport: z.ZodDefault<z.ZodEnum<["websocket", "sse"]>>;
|
|
300
|
+
headers: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
301
|
+
getUpgradeWebSocket: z.ZodOptional<z.ZodType<GetUpgradeWebSocket, z.ZodTypeDef, GetUpgradeWebSocket>>;
|
|
422
302
|
}, "strip", z.ZodTypeAny, {
|
|
423
303
|
encoding: "json" | "cbor" | "bare";
|
|
424
304
|
inspector: {
|
|
@@ -437,18 +317,19 @@ declare const RunConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
437
317
|
token: (...args: unknown[]) => string;
|
|
438
318
|
defaultEndpoint?: string | undefined;
|
|
439
319
|
};
|
|
440
|
-
api: {
|
|
441
|
-
host: string;
|
|
442
|
-
port: number;
|
|
443
|
-
};
|
|
444
|
-
headers: Record<string, string>;
|
|
445
|
-
endpoint: string | null;
|
|
446
320
|
namespace: string;
|
|
447
321
|
runnerName: string;
|
|
448
322
|
transport: "websocket" | "sse";
|
|
323
|
+
headers: Record<string, string>;
|
|
324
|
+
runnerKey: string;
|
|
325
|
+
totalSlots: number;
|
|
449
326
|
maxIncomingMessageSize: number;
|
|
450
|
-
|
|
327
|
+
disableDefaultServer: boolean;
|
|
328
|
+
defaultServerPort: number;
|
|
329
|
+
runEngine: boolean;
|
|
330
|
+
runEngineVersion: string;
|
|
451
331
|
disableActorDriver: boolean;
|
|
332
|
+
runnerKind: "serverless" | "normal";
|
|
452
333
|
basePath: string;
|
|
453
334
|
noWelcome: boolean;
|
|
454
335
|
logging: {
|
|
@@ -468,9 +349,19 @@ declare const RunConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
468
349
|
credentials?: boolean;
|
|
469
350
|
exposeHeaders?: string[];
|
|
470
351
|
} | undefined;
|
|
352
|
+
endpoint?: string | undefined;
|
|
471
353
|
token?: string | undefined;
|
|
472
|
-
totalSlots?: number | undefined;
|
|
473
354
|
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
355
|
+
overrideServerAddress?: string | undefined;
|
|
356
|
+
autoConfigureServerless?: boolean | {
|
|
357
|
+
headers?: Record<string, string> | undefined;
|
|
358
|
+
url?: string | undefined;
|
|
359
|
+
maxRunners?: number | undefined;
|
|
360
|
+
minRunners?: number | undefined;
|
|
361
|
+
requestLifespan?: number | undefined;
|
|
362
|
+
runnersMargin?: number | undefined;
|
|
363
|
+
slotsPerRunner?: number | undefined;
|
|
364
|
+
} | undefined;
|
|
474
365
|
}, {
|
|
475
366
|
encoding?: "json" | "cbor" | "bare" | undefined;
|
|
476
367
|
driver?: {
|
|
@@ -502,31 +393,117 @@ declare const RunConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
502
393
|
credentials?: boolean;
|
|
503
394
|
exposeHeaders?: string[];
|
|
504
395
|
} | undefined;
|
|
505
|
-
|
|
506
|
-
host?: string | undefined;
|
|
507
|
-
port?: number | undefined;
|
|
508
|
-
} | undefined;
|
|
396
|
+
endpoint?: string | undefined;
|
|
509
397
|
token?: string | undefined;
|
|
510
|
-
totalSlots?: number | undefined;
|
|
511
|
-
headers?: Record<string, string> | undefined;
|
|
512
|
-
endpoint?: string | null | undefined;
|
|
513
398
|
namespace?: string | undefined;
|
|
514
399
|
runnerName?: string | undefined;
|
|
515
400
|
transport?: "websocket" | "sse" | undefined;
|
|
401
|
+
headers?: Record<string, string> | undefined;
|
|
516
402
|
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
403
|
+
runnerKey?: string | undefined;
|
|
404
|
+
totalSlots?: number | undefined;
|
|
517
405
|
maxIncomingMessageSize?: number | undefined;
|
|
518
|
-
|
|
406
|
+
disableDefaultServer?: boolean | undefined;
|
|
407
|
+
defaultServerPort?: number | undefined;
|
|
408
|
+
runEngine?: boolean | undefined;
|
|
409
|
+
runEngineVersion?: string | undefined;
|
|
410
|
+
overrideServerAddress?: string | undefined;
|
|
519
411
|
disableActorDriver?: boolean | undefined;
|
|
412
|
+
runnerKind?: "serverless" | "normal" | undefined;
|
|
520
413
|
basePath?: string | undefined;
|
|
521
414
|
noWelcome?: boolean | undefined;
|
|
522
415
|
logging?: {
|
|
523
416
|
level?: "error" | "trace" | "fatal" | "warn" | "info" | "debug" | "silent" | undefined;
|
|
524
417
|
baseLogger?: Logger | undefined;
|
|
525
418
|
} | undefined;
|
|
419
|
+
autoConfigureServerless?: boolean | {
|
|
420
|
+
headers?: Record<string, string> | undefined;
|
|
421
|
+
url?: string | undefined;
|
|
422
|
+
maxRunners?: number | undefined;
|
|
423
|
+
minRunners?: number | undefined;
|
|
424
|
+
requestLifespan?: number | undefined;
|
|
425
|
+
runnersMargin?: number | undefined;
|
|
426
|
+
slotsPerRunner?: number | undefined;
|
|
427
|
+
} | undefined;
|
|
526
428
|
}>>;
|
|
527
|
-
type
|
|
528
|
-
type
|
|
429
|
+
type RunnerConfig = z.infer<typeof RunnerConfigSchema>;
|
|
430
|
+
type RunnerConfigInput = z.input<typeof RunnerConfigSchema>;
|
|
529
431
|
|
|
432
|
+
type ManagerDriverBuilder = (registryConfig: RegistryConfig, runConfig: RunnerConfig) => ManagerDriver;
|
|
433
|
+
interface ManagerDriver {
|
|
434
|
+
getForId(input: GetForIdInput): Promise<ActorOutput | undefined>;
|
|
435
|
+
getWithKey(input: GetWithKeyInput): Promise<ActorOutput | undefined>;
|
|
436
|
+
getOrCreateWithKey(input: GetOrCreateWithKeyInput): Promise<ActorOutput>;
|
|
437
|
+
createActor(input: CreateInput): Promise<ActorOutput>;
|
|
438
|
+
sendRequest(actorId: string, actorRequest: Request): Promise<Response>;
|
|
439
|
+
openWebSocket(path: string, actorId: string, encoding: Encoding, params: unknown, connId?: string, connToken?: string): Promise<UniversalWebSocket>;
|
|
440
|
+
proxyRequest(c: Context, actorRequest: Request, actorId: string): Promise<Response>;
|
|
441
|
+
proxyWebSocket(c: Context, path: string, actorId: string, encoding: Encoding, params: unknown, connId?: string, connToken?: string): Promise<Response>;
|
|
442
|
+
displayInformation(): ManagerDisplayInformation;
|
|
443
|
+
extraStartupLog?: () => Record<string, unknown>;
|
|
444
|
+
modifyManagerRouter?: (registryConfig: RegistryConfig, router: Hono) => void;
|
|
445
|
+
/**
|
|
446
|
+
* Get or create the inspector access token.
|
|
447
|
+
* @experimental
|
|
448
|
+
* @returns creates or returns existing inspector access token
|
|
449
|
+
*/
|
|
450
|
+
getOrCreateInspectorAccessToken: () => string;
|
|
451
|
+
}
|
|
452
|
+
interface ManagerDisplayInformation {
|
|
453
|
+
name: string;
|
|
454
|
+
properties: Record<string, string>;
|
|
455
|
+
}
|
|
456
|
+
interface GetForIdInput<E extends Env = any> {
|
|
457
|
+
c?: Context | undefined;
|
|
458
|
+
name: string;
|
|
459
|
+
actorId: string;
|
|
460
|
+
}
|
|
461
|
+
interface GetWithKeyInput<E extends Env = any> {
|
|
462
|
+
c?: Context | undefined;
|
|
463
|
+
name: string;
|
|
464
|
+
key: ActorKey;
|
|
465
|
+
}
|
|
466
|
+
interface GetOrCreateWithKeyInput<E extends Env = any> {
|
|
467
|
+
c?: Context | undefined;
|
|
468
|
+
name: string;
|
|
469
|
+
key: ActorKey;
|
|
470
|
+
input?: unknown;
|
|
471
|
+
region?: string;
|
|
472
|
+
}
|
|
473
|
+
interface CreateInput<E extends Env = any> {
|
|
474
|
+
c?: Context | undefined;
|
|
475
|
+
name: string;
|
|
476
|
+
key: ActorKey;
|
|
477
|
+
input?: unknown;
|
|
478
|
+
region?: string;
|
|
479
|
+
}
|
|
480
|
+
interface ActorOutput {
|
|
481
|
+
actorId: string;
|
|
482
|
+
name: string;
|
|
483
|
+
key: ActorKey;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
type ActorDriverBuilder = (registryConfig: RegistryConfig, runConfig: RunnerConfig, managerDriver: ManagerDriver, inlineClient: AnyClient) => ActorDriver;
|
|
487
|
+
interface ActorDriver {
|
|
488
|
+
loadActor(actorId: string): Promise<AnyActorInstance>;
|
|
489
|
+
getContext(actorId: string): unknown;
|
|
490
|
+
readPersistedData(actorId: string): Promise<Uint8Array | undefined>;
|
|
491
|
+
/** ActorInstance ensure that only one instance of writePersistedData is called in parallel at a time. */
|
|
492
|
+
writePersistedData(actorId: string, data: Uint8Array): Promise<void>;
|
|
493
|
+
/** ActorInstance ensure that only one instance of setAlarm is called in parallel at a time. */
|
|
494
|
+
setAlarm(actor: AnyActorInstance, timestamp: number): Promise<void>;
|
|
495
|
+
/**
|
|
496
|
+
* @experimental
|
|
497
|
+
* This is an experimental API that may change in the future.
|
|
498
|
+
*/
|
|
499
|
+
getDatabase(actorId: string): Promise<unknown | undefined>;
|
|
500
|
+
sleep?(actorId: string): Promise<void>;
|
|
501
|
+
shutdown?(immediate: boolean): Promise<void>;
|
|
502
|
+
/** This handles the serverless start request. This should manage the lifecycle of the runner tied to the request lifecycle. */
|
|
503
|
+
serverlessHandleStart?(c: Context): Promise<Response>;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
type ServerlessActorDriverBuilder = (updateConfig: (config: RunnerConfig) => void) => ActorDriver;
|
|
530
507
|
interface ServerOutput<A extends Registry<any>> {
|
|
531
508
|
/** Client to communicate with the actors. */
|
|
532
509
|
client: Client<A>;
|
|
@@ -540,8 +517,7 @@ declare class Registry<A extends RegistryActors> {
|
|
|
540
517
|
/**
|
|
541
518
|
* Runs the registry for a server.
|
|
542
519
|
*/
|
|
543
|
-
start(inputConfig?:
|
|
544
|
-
startServerless(inputConfig?: RunConfigInput): ServerOutput<this>;
|
|
520
|
+
start(inputConfig?: RunnerConfigInput): ServerOutput<this>;
|
|
545
521
|
}
|
|
546
522
|
declare function setup<A extends RegistryActors>(input: RegistryConfigInput<A>): Registry<A>;
|
|
547
523
|
|
|
@@ -1060,6 +1036,41 @@ type ActorHandle<AD extends AnyActorDefinition> = Omit<ActorHandleRaw, "connect"
|
|
|
1060
1036
|
resolve(): Promise<string>;
|
|
1061
1037
|
} & ActorDefinitionActions<AD>;
|
|
1062
1038
|
|
|
1039
|
+
declare const ClientConfigSchema: z$1.ZodObject<{
|
|
1040
|
+
/** Endpoint to connect to for Rivet Engine or RivetKit manager API. */
|
|
1041
|
+
endpoint: z$1.ZodEffects<z$1.ZodOptional<z$1.ZodString>, string | undefined, string | undefined>;
|
|
1042
|
+
/** Token to use to authenticate with the API. */
|
|
1043
|
+
token: z$1.ZodEffects<z$1.ZodOptional<z$1.ZodString>, string | undefined, string | undefined>;
|
|
1044
|
+
/** Namespace to connect to. */
|
|
1045
|
+
namespace: z$1.ZodDefault<z$1.ZodString>;
|
|
1046
|
+
/** Name of the runner. This is used to group together runners in to different pools. */
|
|
1047
|
+
runnerName: z$1.ZodDefault<z$1.ZodString>;
|
|
1048
|
+
encoding: z$1.ZodDefault<z$1.ZodEnum<["json", "cbor", "bare"]>>;
|
|
1049
|
+
transport: z$1.ZodDefault<z$1.ZodEnum<["websocket", "sse"]>>;
|
|
1050
|
+
headers: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodString>>>;
|
|
1051
|
+
getUpgradeWebSocket: z$1.ZodOptional<z$1.ZodType<GetUpgradeWebSocket, z$1.ZodTypeDef, GetUpgradeWebSocket>>;
|
|
1052
|
+
}, "strip", z$1.ZodTypeAny, {
|
|
1053
|
+
encoding: "json" | "cbor" | "bare";
|
|
1054
|
+
namespace: string;
|
|
1055
|
+
runnerName: string;
|
|
1056
|
+
transport: "websocket" | "sse";
|
|
1057
|
+
headers: Record<string, string>;
|
|
1058
|
+
endpoint?: string | undefined;
|
|
1059
|
+
token?: string | undefined;
|
|
1060
|
+
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
1061
|
+
}, {
|
|
1062
|
+
encoding?: "json" | "cbor" | "bare" | undefined;
|
|
1063
|
+
endpoint?: string | undefined;
|
|
1064
|
+
token?: string | undefined;
|
|
1065
|
+
namespace?: string | undefined;
|
|
1066
|
+
runnerName?: string | undefined;
|
|
1067
|
+
transport?: "websocket" | "sse" | undefined;
|
|
1068
|
+
headers?: Record<string, string> | undefined;
|
|
1069
|
+
getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
|
|
1070
|
+
}>;
|
|
1071
|
+
type ClientConfig = z$1.infer<typeof ClientConfigSchema>;
|
|
1072
|
+
type ClientConfigInput = z$1.input<typeof ClientConfigSchema>;
|
|
1073
|
+
|
|
1063
1074
|
/** Extract the actor registry from the registry definition. */
|
|
1064
1075
|
type ExtractActorsFromRegistry<A extends Registry<any>> = A extends Registry<infer Actors> ? Actors : never;
|
|
1065
1076
|
/** Extract the registry definition from the client. */
|
|
@@ -2359,4 +2370,4 @@ declare class Conn<S, CP, CS, V, I, DB extends AnyDatabaseProvider> {
|
|
|
2359
2370
|
disconnect(reason?: string): Promise<void>;
|
|
2360
2371
|
}
|
|
2361
2372
|
|
|
2362
|
-
export {
|
|
2373
|
+
export { ActorConnRaw as $, type ActorDriver as A, test as B, type Client as C, type DriverConfig as D, type Encoding as E, type RegistryConfig as F, type RegistryActors as G, type RunnerConfigInput as H, type InitContext as I, RegistryConfigSchema as J, Registry as K, setup as L, type ClientConfigInput as M, ActorClientError as N, type OnConnectOptions as O, ActorError as P, InternalError as Q, type RivetEvent as R, type ServerlessActorDriverBuilder as S, type Transport as T, type UniversalWebSocket as U, MalformedResponseMessage as V, ManagerError as W, type CreateRequest as X, type ActorActionFunction as Y, type ActorConn as Z, type EventUnsubscribe as _, type RivetCloseEvent as a, type ActorHandle as a0, ActorHandleRaw as a1, type ActorAccessor as a2, ClientRaw as a3, type CreateOptions as a4, type ExtractActorsFromRegistry as a5, type ExtractRegistryFromClient as a6, type GetOptions as a7, type GetWithIdOptions as a8, type QueryOptions as a9, DatabaseQuerySchema as aA, type DatabaseQuery as aB, TableSchema as aC, type Table as aD, TablesSchema as aE, type Tables as aF, ColumnSchema as aG, type Column as aH, ColumnsSchema as aI, type Columns as aJ, ForeignKeySchema as aK, type ForeignKey as aL, ForeignKeysSchema as aM, type ForeignKeys as aN, BuildSchema as aO, type Build as aP, BuildsSchema as aQ, type Builds as aR, CreateActorSchema as aS, type CreateActor as aT, type Region as aa, ActorInstance as ab, type ActorOutput as ac, type CreateInput as ad, type GetForIdInput as ae, type GetOrCreateWithKeyInput as af, type GetWithKeyInput as ag, type ManagerDisplayInformation as ah, type ManagerDriver as ai, DriverConfigSchema as aj, RunnerConfigSchema as ak, ActorFeature as al, ActorId as am, ActorLogEntry as an, ActorSchema as ao, type Actor as ap, OperationSchema as aq, type Operation as ar, PatchSchema as as, type Patch as at, ConnectionSchema as au, type Connection as av, RealtimeEventSchema as aw, type RealtimeEvent as ax, RecordedRealtimeEventSchema as ay, type RecordedRealtimeEvent as az, type RivetMessageEvent as b, type RunnerConfig as c, type AnyDatabaseProvider as d, type Actions as e, type ActorConfigInput as f, ActorDefinition as g, generateConnId as h, generateConnToken as i, type AnyClient as j, createClientWithDriver as k, type ActorQuery as l, type ActorKey as m, ActionContext as n, Conn as o, type ConnectionStatus as p, ActorContext as q, type ActionContextOf as r, type ActorContextOf as s, type AnyActorDefinition as t, lookupInRegistry as u, type AnyActorInstance as v, type ActorTypes as w, ActorConfigSchema as x, type AuthIntent as y, type ActorConfig as z };
|