rivetkit 0.0.0-main.41efcce → 0.0.0-main.49693dc
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 +939 -104
- package/dist/browser/client.js +1867 -900
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +252 -129
- package/dist/browser/inspector/client.js +2079 -233
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -74
- package/dist/tsup/actor/errors.d.ts +1 -74
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +2408 -2029
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +932 -114
- package/dist/tsup/agent-os/index.d.ts +932 -114
- package/dist/tsup/agent-os/index.js +2412 -2033
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-J27CEW6F.js → chunk-2OBVQZX6.js} +6 -6
- package/dist/tsup/chunk-2OBVQZX6.js.map +1 -0
- package/dist/tsup/chunk-3ZWHWMFJ.js +14 -0
- package/dist/tsup/chunk-3ZWHWMFJ.js.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-4KGXFC6M.cjs} +238 -22
- package/dist/tsup/chunk-4KGXFC6M.cjs.map +1 -0
- package/dist/tsup/{chunk-CVHUXINE.js → chunk-5IU3MI7X.js} +594 -72
- package/dist/tsup/chunk-5IU3MI7X.js.map +1 -0
- package/dist/tsup/{chunk-VD7AZIBR.js → chunk-6CXQMHZR.js} +1161 -361
- package/dist/tsup/chunk-6CXQMHZR.js.map +1 -0
- package/dist/tsup/{chunk-SBEFJ4IQ.js → chunk-6W2UIH3X.js} +70 -8
- package/dist/tsup/chunk-6W2UIH3X.js.map +1 -0
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-6W5VGLFT.js} +237 -21
- package/dist/tsup/chunk-6W5VGLFT.js.map +1 -0
- package/dist/tsup/{chunk-RF3MEJV6.cjs → chunk-B73TBMMG.cjs} +18 -11
- package/dist/tsup/chunk-B73TBMMG.cjs.map +1 -0
- package/dist/tsup/chunk-D6TORRA4.js +243 -0
- package/dist/tsup/chunk-D6TORRA4.js.map +1 -0
- package/dist/tsup/{chunk-PXLJOMJD.js → chunk-FXT3HN32.js} +2 -2
- package/dist/tsup/{chunk-ZGWSH7YV.js → chunk-IXBD7BXC.js} +48 -72
- package/dist/tsup/chunk-IXBD7BXC.js.map +1 -0
- package/dist/tsup/{chunk-3BFYSYRU.js → chunk-JI6GZ2C2.js} +4 -12
- package/dist/tsup/chunk-JI6GZ2C2.js.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JTHHCZCZ.js} +24 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-KVFIONKQ.cjs} +25 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-SPMMF6TR.cjs → chunk-LGOWPZJ5.cjs} +3 -3
- package/dist/tsup/chunk-LGOWPZJ5.cjs.map +1 -0
- package/dist/tsup/chunk-LYNWTX6R.cjs +14 -0
- package/dist/tsup/chunk-LYNWTX6R.cjs.map +1 -0
- package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-MYWZCDML.cjs} +4 -12
- package/dist/tsup/chunk-MYWZCDML.cjs.map +1 -0
- package/dist/tsup/{chunk-XSC2WWXD.js → chunk-NYDZLWHZ.js} +16 -9
- package/dist/tsup/chunk-NYDZLWHZ.js.map +1 -0
- package/dist/tsup/{chunk-AV54CVAG.cjs → chunk-RB7WUDX6.cjs} +1290 -490
- package/dist/tsup/chunk-RB7WUDX6.cjs.map +1 -0
- package/dist/tsup/{chunk-JTL6Y2UN.cjs → chunk-SPJORZMM.cjs} +49 -73
- package/dist/tsup/chunk-SPJORZMM.cjs.map +1 -0
- package/dist/tsup/chunk-SSMKIYEX.cjs +243 -0
- package/dist/tsup/chunk-SSMKIYEX.cjs.map +1 -0
- package/dist/tsup/{chunk-TQSL4NJ3.cjs → chunk-TQ4HSX2U.cjs} +72 -10
- package/dist/tsup/chunk-TQ4HSX2U.cjs.map +1 -0
- package/dist/tsup/{chunk-EVADNK6Z.cjs → chunk-U6ZQELGJ.cjs} +10 -10
- package/dist/tsup/chunk-U6ZQELGJ.cjs.map +1 -0
- package/dist/tsup/chunk-XLBMKZD3.cjs +1257 -0
- package/dist/tsup/chunk-XLBMKZD3.cjs.map +1 -0
- package/dist/tsup/client/mod.cjs +8 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +18 -7
- package/dist/tsup/client/mod.d.ts +18 -7
- package/dist/tsup/client/mod.js +7 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.cjs.map +1 -1
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-B3RIidaJ.d.ts → config-BXSV17G7.d.cts} +987 -72
- package/dist/tsup/{config-D6WxBYjV.d.cts → config-Bi1r6gI7.d.ts} +987 -72
- package/dist/tsup/{config-B9qUIHX4.d.ts → config-ey2I2zz5.d.cts} +82 -15
- package/dist/tsup/{config-B9qUIHX4.d.cts → config-ey2I2zz5.d.ts} +82 -15
- package/dist/tsup/context-4fJemY0D.d.cts +129 -0
- package/dist/tsup/context-D4sNYboo.d.ts +129 -0
- package/dist/tsup/db/drizzle.cjs +168 -103
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +8 -4
- package/dist/tsup/db/drizzle.d.ts +8 -4
- package/dist/tsup/db/drizzle.js +170 -105
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +6 -163
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +12 -4
- package/dist/tsup/db/mod.d.ts +12 -4
- package/dist/tsup/db/mod.js +5 -162
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +38 -0
- package/dist/tsup/dynamic/mod.d.ts +38 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +26 -136
- package/dist/tsup/inspector/mod.d.ts +26 -136
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector/workflow.cjs +21 -0
- package/dist/tsup/inspector/workflow.cjs.map +1 -0
- package/dist/tsup/inspector/workflow.d.cts +144 -0
- package/dist/tsup/inspector/workflow.d.ts +144 -0
- package/dist/tsup/inspector/workflow.js +21 -0
- package/dist/tsup/inspector/workflow.js.map +1 -0
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +241 -0
- package/dist/tsup/inspector-tab/mod.d.ts +241 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +4268 -944
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +9 -8
- package/dist/tsup/mod.d.ts +9 -8
- package/dist/tsup/mod.js +4229 -905
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +26 -21
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +7 -6
- package/dist/tsup/test/mod.d.ts +7 -6
- package/dist/tsup/test/mod.js +25 -20
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/unstable/migrations.cjs +101 -0
- package/dist/tsup/unstable/migrations.cjs.map +1 -0
- package/dist/tsup/unstable/migrations.d.cts +29 -0
- package/dist/tsup/unstable/migrations.d.ts +29 -0
- package/dist/tsup/unstable/migrations.js +101 -0
- package/dist/tsup/unstable/migrations.js.map +1 -0
- package/dist/tsup/utils-Bbz-3411.d.cts +162 -0
- package/dist/tsup/utils-BqdWVlzm.d.ts +162 -0
- package/dist/tsup/utils-vvJQyygr.d.cts +109 -0
- package/dist/tsup/utils-vvJQyygr.d.ts +109 -0
- package/dist/tsup/utils.cjs +7 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +4 -147
- package/dist/tsup/utils.d.ts +4 -147
- package/dist/tsup/utils.js +6 -2
- package/dist/tsup/workflow/mod.cjs +517 -412
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +11 -10
- package/dist/tsup/workflow/mod.d.ts +11 -10
- package/dist/tsup/workflow/mod.js +511 -406
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +62 -14
- package/src/actor/actions.ts +119 -0
- package/src/actor/config.test.ts +78 -0
- package/src/actor/config.ts +518 -96
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +38 -26
- package/src/actor/errors.ts +101 -89
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +32 -21
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/cron.ts +37 -2
- package/src/agent-os/actor/index.ts +39 -19
- 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/agent-os/types.ts +11 -0
- package/src/client/actor-common.ts +106 -53
- package/src/client/actor-conn.ts +94 -45
- package/src/client/actor-handle.ts +198 -79
- package/src/client/actor-query.ts +13 -6
- package/src/client/client.ts +43 -15
- package/src/client/config.ts +8 -0
- package/src/client/errors.ts +4 -2
- package/src/client/lifecycle-errors.ts +28 -4
- package/src/client/mod.ts +9 -4
- package/src/client/query.ts +3 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +24 -16
- package/src/client/resolve-gateway-target.ts +3 -1
- package/src/client/utils.ts +36 -10
- package/src/common/actor-router-consts.ts +7 -0
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/actor-runtime-socket-protocol/v1.ts +848 -0
- package/src/common/bare/generated/client-protocol/v4.ts +599 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/generated/inspector/v6.ts +1367 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +176 -67
- package/src/common/client-protocol-zod.ts +7 -0
- package/src/common/client-protocol.ts +1 -1
- package/src/common/database/config.ts +103 -10
- package/src/common/database/mod.test.ts +364 -0
- package/src/common/database/mod.ts +278 -149
- package/src/common/database/native-database.test.ts +220 -0
- package/src/common/database/native-database.ts +394 -58
- package/src/common/database/shared.ts +25 -0
- package/src/common/encoding.ts +302 -38
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/fetch-like.ts +49 -0
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/inspector-transport.ts +12 -2
- package/src/common/log.ts +117 -14
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +23 -203
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.test.ts +164 -0
- package/src/db/drizzle.ts +207 -121
- package/src/db/mod.ts +6 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +64 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +23 -4
- package/src/engine-client/actor-websocket-client.ts +32 -5
- package/src/engine-client/api-endpoints.ts +52 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +21 -17
- package/src/engine-client/mod.ts +116 -64
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/globals.d.ts +4 -0
- package/src/inspector/client.browser.ts +127 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector/workflow.ts +61 -0
- package/src/inspector-tab/mod.ts +301 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +160 -53
- package/src/registry/config/serverless.ts +7 -1
- package/src/registry/index.ts +659 -96
- package/src/registry/napi-runtime.ts +1154 -0
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +2005 -955
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/run-handler-coordinator.test.ts +252 -0
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.test.ts +50 -0
- package/src/registry/runtime.ts +839 -0
- package/src/registry/wasm-runtime.ts +1283 -0
- package/src/registry/write-through-proxy.ts +141 -0
- package/src/serde.ts +8 -2
- package/src/serverless/configure.ts +102 -49
- package/src/test/mod.ts +2 -17
- package/src/test/ready.ts +22 -0
- package/src/unstable/migrations.test.ts +170 -0
- package/src/unstable/migrations.ts +141 -0
- package/src/utils/crypto.ts +14 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +39 -0
- package/src/utils/node.ts +44 -28
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +4 -2
- package/src/workflow/context.ts +683 -242
- package/src/workflow/driver.test.ts +62 -0
- package/src/workflow/driver.ts +246 -119
- package/src/workflow/inspector.ts +24 -24
- package/src/workflow/mod.ts +76 -84
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
- package/dist/tsup/chunk-6AVUJ52Q.cjs +0 -253
- package/dist/tsup/chunk-6AVUJ52Q.cjs.map +0 -1
- package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
- package/dist/tsup/chunk-7X7RVTFF.cjs +0 -735
- package/dist/tsup/chunk-7X7RVTFF.cjs.map +0 -1
- package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
- package/dist/tsup/chunk-AV54CVAG.cjs.map +0 -1
- package/dist/tsup/chunk-CVHUXINE.js.map +0 -1
- package/dist/tsup/chunk-EVADNK6Z.cjs.map +0 -1
- package/dist/tsup/chunk-J27CEW6F.js.map +0 -1
- package/dist/tsup/chunk-JTL6Y2UN.cjs.map +0 -1
- package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-RF3MEJV6.cjs.map +0 -1
- package/dist/tsup/chunk-SB4MXRN2.js +0 -253
- package/dist/tsup/chunk-SB4MXRN2.js.map +0 -1
- package/dist/tsup/chunk-SBEFJ4IQ.js.map +0 -1
- package/dist/tsup/chunk-SPMMF6TR.cjs.map +0 -1
- package/dist/tsup/chunk-TQSL4NJ3.cjs.map +0 -1
- package/dist/tsup/chunk-VD7AZIBR.js.map +0 -1
- package/dist/tsup/chunk-XSC2WWXD.js.map +0 -1
- package/dist/tsup/chunk-ZGWSH7YV.js.map +0 -1
- package/dist/tsup/context-BxvHh9wi.d.cts +0 -92
- package/dist/tsup/context-CNIZBIKl.d.ts +0 -92
- package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
- package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2501
- package/src/drivers/engine/actor-driver.ts +0 -2470
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-PXLJOMJD.js.map → chunk-FXT3HN32.js.map} +0 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type and schema declarations for custom Rivet inspector tabs.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is **derived from runtime Zod schemas** that the
|
|
5
|
+
* dashboard and rivetkit itself use, so the published types cannot
|
|
6
|
+
* drift from the wire format. There are three sources of truth:
|
|
7
|
+
*
|
|
8
|
+
* 1. The `inspector.tabs[]` actor-config Zod schemas in
|
|
9
|
+
* `../actor/config.ts` — re-exported below. These validate the
|
|
10
|
+
* authoring surface (`defineActor({ inspector: { tabs: [...] } })`).
|
|
11
|
+
* 2. The dashboard ↔ tab postMessage envelopes defined in this file.
|
|
12
|
+
* The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`)
|
|
13
|
+
* imports the same schemas to validate messages at runtime, so any
|
|
14
|
+
* change here lands on both ends in lockstep.
|
|
15
|
+
* 3. The inspector HTTP endpoint response schemas defined in this
|
|
16
|
+
* file. The dashboard parses every response through them; if the
|
|
17
|
+
* Rust handler ever emits a different shape, the dashboard fails
|
|
18
|
+
* loudly at the parse step instead of silently casting `unknown`.
|
|
19
|
+
*
|
|
20
|
+
* Tab bundles import these types for autocomplete and compile-time
|
|
21
|
+
* safety:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import type {
|
|
25
|
+
* ShellToTabMessage,
|
|
26
|
+
* TabToShellMessage,
|
|
27
|
+
* V1Init,
|
|
28
|
+
* InspectorStateResponse,
|
|
29
|
+
* } from "rivetkit/inspector-tab";
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { z } from "zod";
|
|
34
|
+
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Re-exported from `../actor/config.ts` — the authoring schema for
|
|
37
|
+
// `defineActor({ inspector: { tabs: [...] } })`.
|
|
38
|
+
// ============================================================================
|
|
39
|
+
|
|
40
|
+
export type { ActorInspectorConfig } from "../actor/config";
|
|
41
|
+
export {
|
|
42
|
+
ActorInspectorConfigSchema,
|
|
43
|
+
BUILTIN_INSPECTOR_TAB_IDS,
|
|
44
|
+
BuiltinInspectorTabIdSchema,
|
|
45
|
+
CustomInspectorTabEntrySchema,
|
|
46
|
+
HideInspectorTabEntrySchema,
|
|
47
|
+
InspectorTabEntrySchema,
|
|
48
|
+
} from "../actor/config";
|
|
49
|
+
|
|
50
|
+
import type {
|
|
51
|
+
CustomInspectorTabEntrySchema,
|
|
52
|
+
HideInspectorTabEntrySchema,
|
|
53
|
+
InspectorTabEntrySchema,
|
|
54
|
+
} from "../actor/config";
|
|
55
|
+
|
|
56
|
+
/** One entry in the actor's `inspector.tabs[]` declaration. */
|
|
57
|
+
export type ActorInspectorTabEntry = z.input<typeof InspectorTabEntrySchema>;
|
|
58
|
+
/** A custom-tab entry — adds a new tab to the dashboard strip. */
|
|
59
|
+
export type ActorCustomInspectorTabEntry = z.input<
|
|
60
|
+
typeof CustomInspectorTabEntrySchema
|
|
61
|
+
>;
|
|
62
|
+
/** A hide modifier — removes a built-in tab from the strip. */
|
|
63
|
+
export type ActorHideInspectorTabEntry = z.input<
|
|
64
|
+
typeof HideInspectorTabEntrySchema
|
|
65
|
+
>;
|
|
66
|
+
/** Union of the six built-in inspector tab ids. */
|
|
67
|
+
export type BuiltinInspectorTabId =
|
|
68
|
+
| "workflow"
|
|
69
|
+
| "database"
|
|
70
|
+
| "state"
|
|
71
|
+
| "queue"
|
|
72
|
+
| "schedules"
|
|
73
|
+
| "connections"
|
|
74
|
+
| "console";
|
|
75
|
+
|
|
76
|
+
// ============================================================================
|
|
77
|
+
// Dashboard ↔ tab postMessage envelope (source of truth).
|
|
78
|
+
//
|
|
79
|
+
// These Zod schemas are imported by `frontend/apps/inspector-ui/src/bridge.ts`
|
|
80
|
+
// and used to validate inbound messages at runtime. Changes here flow to
|
|
81
|
+
// both sides in a single commit.
|
|
82
|
+
// ============================================================================
|
|
83
|
+
|
|
84
|
+
/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */
|
|
85
|
+
export const InspectorTabDescriptorSchema = z.object({
|
|
86
|
+
id: z.string(),
|
|
87
|
+
label: z.string(),
|
|
88
|
+
icon: z.string(),
|
|
89
|
+
/**
|
|
90
|
+
* `true` for author-shipped custom tabs; absent or `false` for
|
|
91
|
+
* built-in tabs the SPA renders. Lets the dashboard route the
|
|
92
|
+
* iframe `src` to `/inspector/custom-tabs/<id>/` for custom tabs and
|
|
93
|
+
* `/inspector/ui/` for built-ins without the dashboard needing to
|
|
94
|
+
* know which ids are built-in.
|
|
95
|
+
*/
|
|
96
|
+
isCustom: z.boolean().optional(),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Initial handshake from the dashboard. Sent on first mount and again on
|
|
101
|
+
* every token refresh. Tabs MUST accept late `init` messages and replace
|
|
102
|
+
* the cached token.
|
|
103
|
+
*/
|
|
104
|
+
export const V1InitSchema = z.object({
|
|
105
|
+
type: z.literal("init"),
|
|
106
|
+
v: z.literal(1),
|
|
107
|
+
/** The actor this tab is mounted for. */
|
|
108
|
+
actorId: z.string(),
|
|
109
|
+
/**
|
|
110
|
+
* Per-actor inspector bearer token. Tabs include it as
|
|
111
|
+
* `Authorization: Bearer ${authToken}` on every authenticated fetch.
|
|
112
|
+
*/
|
|
113
|
+
authToken: z.string(),
|
|
114
|
+
/**
|
|
115
|
+
* Outer Rivet API token. Optional; not required for inspector HTTP
|
|
116
|
+
* routes but available to tabs that want to call the engine REST API.
|
|
117
|
+
*/
|
|
118
|
+
rivetToken: z.string().optional(),
|
|
119
|
+
/**
|
|
120
|
+
* The tab id the dashboard wants active at mount time. Multi-view
|
|
121
|
+
* tabs may read this to seed their initial route; most tabs ignore it.
|
|
122
|
+
*/
|
|
123
|
+
activeTab: z.string().optional(),
|
|
124
|
+
/**
|
|
125
|
+
* Dashboard's currently active theme. Tabs that use the shared
|
|
126
|
+
* stylesheet (`/inspector/tab.css`) mirror it by toggling the `dark`
|
|
127
|
+
* class on `<html>`. Optional for backwards compatibility — tabs
|
|
128
|
+
* should default to `"dark"` if absent (the dashboard pinned dark
|
|
129
|
+
* mode before this field was added).
|
|
130
|
+
*/
|
|
131
|
+
theme: z.enum(["light", "dark"]).optional(),
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Dashboard tells the inspector-ui SPA which built-in tab to render. Not
|
|
136
|
+
* sent to custom tabs — when the user activates a custom tab the
|
|
137
|
+
* dashboard navigates the outer iframe to a different `src`.
|
|
138
|
+
*/
|
|
139
|
+
export const V1SetActiveTabSchema = z.object({
|
|
140
|
+
type: z.literal("set-active-tab"),
|
|
141
|
+
v: z.literal(1),
|
|
142
|
+
tab: z.string(),
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Tab → dashboard. Sent once after the message listener is registered.
|
|
147
|
+
* The dashboard hides the "Connecting to inspector…" overlay on receipt;
|
|
148
|
+
* if it never arrives the overlay times out after 8 s.
|
|
149
|
+
*/
|
|
150
|
+
export const V1ReadySchema = z.object({
|
|
151
|
+
type: z.literal("ready"),
|
|
152
|
+
v: z.literal(1),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Tab → dashboard. Sent when the tab gets a 401 on an inspector data
|
|
157
|
+
* call. The dashboard refreshes the token and re-issues `v1Init`.
|
|
158
|
+
*/
|
|
159
|
+
export const V1TokenRefreshNeededSchema = z.object({
|
|
160
|
+
type: z.literal("token-refresh-needed"),
|
|
161
|
+
v: z.literal(1),
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Emitted by the inspector-ui SPA to tell the dashboard which tabs to
|
|
166
|
+
* render in the strip. Custom tab bundles do NOT emit this — only the
|
|
167
|
+
* SPA does.
|
|
168
|
+
*/
|
|
169
|
+
export const V1TabsAvailableSchema = z.object({
|
|
170
|
+
type: z.literal("tabs-available"),
|
|
171
|
+
v: z.literal(1),
|
|
172
|
+
tabs: z.array(InspectorTabDescriptorSchema),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
/** Discriminated union of messages a tab can RECEIVE from the dashboard. */
|
|
176
|
+
export const ShellToTabMessageSchema = z.discriminatedUnion("type", [
|
|
177
|
+
V1InitSchema,
|
|
178
|
+
V1SetActiveTabSchema,
|
|
179
|
+
]);
|
|
180
|
+
|
|
181
|
+
/** Discriminated union of messages a tab can SEND to the dashboard. */
|
|
182
|
+
export const TabToShellMessageSchema = z.discriminatedUnion("type", [
|
|
183
|
+
V1ReadySchema,
|
|
184
|
+
V1TabsAvailableSchema,
|
|
185
|
+
V1TokenRefreshNeededSchema,
|
|
186
|
+
]);
|
|
187
|
+
|
|
188
|
+
export type InspectorTabDescriptor = z.infer<
|
|
189
|
+
typeof InspectorTabDescriptorSchema
|
|
190
|
+
>;
|
|
191
|
+
export type V1Init = z.infer<typeof V1InitSchema>;
|
|
192
|
+
export type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;
|
|
193
|
+
export type V1Ready = z.infer<typeof V1ReadySchema>;
|
|
194
|
+
export type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;
|
|
195
|
+
export type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;
|
|
196
|
+
export type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;
|
|
197
|
+
export type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;
|
|
198
|
+
|
|
199
|
+
/** Stable envelope protocol version. Bump only when introducing a v2 shape. */
|
|
200
|
+
export const POSTMESSAGE_PROTOCOL_VERSION = 1;
|
|
201
|
+
|
|
202
|
+
/** URL query parameters the dashboard sets on the tab iframe `src`. */
|
|
203
|
+
export const SHELL_ORIGIN_PARAM = "shellOrigin";
|
|
204
|
+
export const ACTOR_ID_PARAM = "actorId";
|
|
205
|
+
|
|
206
|
+
// ============================================================================
|
|
207
|
+
// Inspector HTTP endpoint response schemas (source of truth).
|
|
208
|
+
//
|
|
209
|
+
// The dashboard parses every authenticated inspector response through
|
|
210
|
+
// these schemas (`frontend/src/components/actors/actor-inspector-context.tsx`).
|
|
211
|
+
// If the Rust handler emits a different shape the parse fails and the
|
|
212
|
+
// dashboard surfaces an error — drift is loud.
|
|
213
|
+
// ============================================================================
|
|
214
|
+
|
|
215
|
+
/** `GET /inspector/state` response shape. */
|
|
216
|
+
export const InspectorStateResponseSchema = z.object({
|
|
217
|
+
/** Current actor state (whatever shape the actor declared). */
|
|
218
|
+
state: z.unknown(),
|
|
219
|
+
/**
|
|
220
|
+
* `false` when the actor did not declare any state — `state` is then
|
|
221
|
+
* `null` and `PATCH /inspector/state` returns an error.
|
|
222
|
+
*/
|
|
223
|
+
isStateEnabled: z.boolean(),
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
/** `POST /inspector/action/<name>` request body. */
|
|
227
|
+
export const InspectorActionRequestSchema = z
|
|
228
|
+
.object({
|
|
229
|
+
/** Positional arguments. Mutually exclusive with `properties`. */
|
|
230
|
+
args: z.array(z.unknown()).optional(),
|
|
231
|
+
/** Keyed arguments. Mutually exclusive with `args`. */
|
|
232
|
+
properties: z.record(z.string(), z.unknown()).optional(),
|
|
233
|
+
})
|
|
234
|
+
.refine(
|
|
235
|
+
(body) => !(body.args !== undefined && body.properties !== undefined),
|
|
236
|
+
"Use either `args` or `properties`, not both",
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
/** `POST /inspector/action/<name>` response shape. */
|
|
240
|
+
export const InspectorActionResponseSchema = z.object({
|
|
241
|
+
output: z.unknown(),
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
/** `GET /inspector/rpcs` response shape — the list of action names. */
|
|
245
|
+
export const InspectorRpcsResponseSchema = z.object({
|
|
246
|
+
rpcs: z.array(z.string()),
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
/** One connection record in `GET /inspector/connections`. */
|
|
250
|
+
export const InspectorConnectionSchema = z.object({
|
|
251
|
+
connectionType: z.string().nullable(),
|
|
252
|
+
id: z.string(),
|
|
253
|
+
details: z.object({
|
|
254
|
+
connectionType: z.string().nullable(),
|
|
255
|
+
params: z.unknown(),
|
|
256
|
+
stateEnabled: z.boolean(),
|
|
257
|
+
state: z.unknown(),
|
|
258
|
+
subscriptions: z.number(),
|
|
259
|
+
isHibernatable: z.boolean(),
|
|
260
|
+
}),
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
/** `GET /inspector/connections` response shape. */
|
|
264
|
+
export const InspectorConnectionsResponseSchema = z.object({
|
|
265
|
+
connections: z.array(InspectorConnectionSchema),
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
/** One queued message in `GET /inspector/queue`. */
|
|
269
|
+
export const InspectorQueueMessageSchema = z.object({
|
|
270
|
+
id: z.string(),
|
|
271
|
+
name: z.string(),
|
|
272
|
+
createdAtMs: z.number(),
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
/** `GET /inspector/queue` response shape. */
|
|
276
|
+
export const InspectorQueueResponseSchema = z.object({
|
|
277
|
+
size: z.number(),
|
|
278
|
+
maxSize: z.number(),
|
|
279
|
+
/** `true` if `?limit=N` truncated the message list below `size`. */
|
|
280
|
+
truncated: z.boolean(),
|
|
281
|
+
messages: z.array(InspectorQueueMessageSchema),
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
export type InspectorStateResponse = z.infer<
|
|
285
|
+
typeof InspectorStateResponseSchema
|
|
286
|
+
>;
|
|
287
|
+
export type InspectorActionRequest = z.infer<
|
|
288
|
+
typeof InspectorActionRequestSchema
|
|
289
|
+
>;
|
|
290
|
+
export type InspectorActionResponse = z.infer<
|
|
291
|
+
typeof InspectorActionResponseSchema
|
|
292
|
+
>;
|
|
293
|
+
export type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;
|
|
294
|
+
export type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;
|
|
295
|
+
export type InspectorConnectionsResponse = z.infer<
|
|
296
|
+
typeof InspectorConnectionsResponseSchema
|
|
297
|
+
>;
|
|
298
|
+
export type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;
|
|
299
|
+
export type InspectorQueueResponse = z.infer<
|
|
300
|
+
typeof InspectorQueueResponseSchema
|
|
301
|
+
>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
import { getLogger } from "@/common/log";
|
|
3
3
|
import {
|
|
4
|
-
isDev,
|
|
5
4
|
getNodeEnv,
|
|
5
|
+
getRivetEnvoyVersion,
|
|
6
6
|
getRivetPool,
|
|
7
7
|
getRivetTotalSlots,
|
|
8
|
-
getRivetEnvoyVersion,
|
|
9
8
|
} from "@/utils/env-vars";
|
|
10
9
|
|
|
11
10
|
let warnedMissingVersion = false;
|
|
@@ -1,42 +1,71 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { getRunMetadata } from "@/actor/config";
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
AnyActorDefinition,
|
|
6
|
-
} from "@/actor/definition";
|
|
7
|
-
import {
|
|
8
|
-
KEYS,
|
|
9
|
-
queueMetadataKey,
|
|
10
|
-
queueMessagesPrefix,
|
|
11
|
-
workflowStoragePrefix,
|
|
12
|
-
} from "@/actor/keys";
|
|
13
|
-
import { ENGINE_ENDPOINT } from "@/common/engine";
|
|
3
|
+
import type { AnyActorDefinition } from "@/actor/definition";
|
|
4
|
+
import { buildEngineEndpoint, ENGINE_HOST, ENGINE_PORT } from "@/common/engine";
|
|
14
5
|
import { type Logger, LogLevelSchema } from "@/common/log";
|
|
15
|
-
import {
|
|
6
|
+
import { VERSION } from "@/utils";
|
|
16
7
|
import { tryParseEndpoint } from "@/utils/endpoint-parser";
|
|
17
8
|
import {
|
|
18
9
|
getRivetEndpoint,
|
|
19
10
|
getRivetEngine,
|
|
11
|
+
getRivetkitRuntime,
|
|
20
12
|
getRivetNamespace,
|
|
21
13
|
getRivetRunEngine,
|
|
14
|
+
getRivetRunEngineHost,
|
|
15
|
+
getRivetRunEnginePort,
|
|
22
16
|
getRivetRunEngineVersion,
|
|
23
17
|
getRivetToken,
|
|
24
18
|
isDev,
|
|
25
19
|
} from "@/utils/env-vars";
|
|
26
20
|
import { EnvoyConfigSchema } from "./envoy";
|
|
27
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
ConfigurePoolSchema,
|
|
23
|
+
DEFAULT_SERVERLESS_MAX_START_PAYLOAD_BYTES,
|
|
24
|
+
ServerlessConfigSchema,
|
|
25
|
+
} from "./serverless";
|
|
28
26
|
|
|
29
27
|
export const ActorsSchema = z.record(
|
|
30
28
|
z.string(),
|
|
31
|
-
z.custom<
|
|
32
|
-
BaseActorDefinition<any, any, any, any, any, any, any, any, any>
|
|
33
|
-
>(),
|
|
29
|
+
z.custom<AnyActorDefinition>(),
|
|
34
30
|
);
|
|
35
31
|
export type RegistryActors = z.infer<typeof ActorsSchema>;
|
|
36
32
|
|
|
37
|
-
export const
|
|
33
|
+
export const RuntimeKindSchema = z.enum(["auto", "native", "wasm"]);
|
|
34
|
+
export type RuntimeKind = z.infer<typeof RuntimeKindSchema>;
|
|
35
|
+
export type WasmRuntimeBindings = typeof import("@rivetkit/rivetkit-wasm");
|
|
36
|
+
export type WasmRuntimeInitInput = Parameters<
|
|
37
|
+
WasmRuntimeBindings["default"]
|
|
38
|
+
>[0];
|
|
39
|
+
export const SqliteBackendSchema = z.enum(["local", "remote"]);
|
|
40
|
+
export type SqliteBackend = z.infer<typeof SqliteBackendSchema>;
|
|
41
|
+
|
|
42
|
+
export const TestConfigSchema = z.object({
|
|
43
|
+
enabled: z.boolean().optional().default(false),
|
|
44
|
+
sqliteBackend: SqliteBackendSchema.optional(),
|
|
45
|
+
});
|
|
38
46
|
export type TestConfig = z.infer<typeof TestConfigSchema>;
|
|
39
47
|
|
|
48
|
+
export const WasmRuntimeConfigSchema = z.object({
|
|
49
|
+
bindings: z.custom<WasmRuntimeBindings>().optional(),
|
|
50
|
+
initInput: z.custom<WasmRuntimeInitInput>().optional(),
|
|
51
|
+
});
|
|
52
|
+
export type WasmRuntimeConfig = z.infer<typeof WasmRuntimeConfigSchema>;
|
|
53
|
+
|
|
54
|
+
export const SqliteConfigSchema = z
|
|
55
|
+
.union([
|
|
56
|
+
SqliteBackendSchema,
|
|
57
|
+
z.object({
|
|
58
|
+
backend: SqliteBackendSchema,
|
|
59
|
+
}),
|
|
60
|
+
])
|
|
61
|
+
.optional()
|
|
62
|
+
.transform((config) => {
|
|
63
|
+
if (config === undefined) return undefined;
|
|
64
|
+
if (typeof config === "string") return { backend: config };
|
|
65
|
+
return config;
|
|
66
|
+
});
|
|
67
|
+
export type SqliteConfig = z.infer<typeof SqliteConfigSchema>;
|
|
68
|
+
|
|
40
69
|
// TODO: Add sane defaults for NODE_ENV=development
|
|
41
70
|
export const RegistryConfigSchema = z
|
|
42
71
|
.object({
|
|
@@ -60,6 +89,44 @@ export const RegistryConfigSchema = z
|
|
|
60
89
|
maxOutgoingMessageSize: z.number().optional().default(1_048_576),
|
|
61
90
|
|
|
62
91
|
// MARK: Runtime
|
|
92
|
+
/**
|
|
93
|
+
* @experimental
|
|
94
|
+
*
|
|
95
|
+
* Runtime binding to use for RivetKit core.
|
|
96
|
+
* */
|
|
97
|
+
runtime: RuntimeKindSchema.optional().transform((val, ctx) => {
|
|
98
|
+
const rawRuntime = val ?? getRivetkitRuntime();
|
|
99
|
+
if (rawRuntime === undefined) {
|
|
100
|
+
return "auto";
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const parsed = RuntimeKindSchema.safeParse(rawRuntime);
|
|
104
|
+
if (!parsed.success) {
|
|
105
|
+
ctx.addIssue({
|
|
106
|
+
code: "custom",
|
|
107
|
+
message:
|
|
108
|
+
"RIVETKIT_RUNTIME must be one of auto, native, or wasm",
|
|
109
|
+
});
|
|
110
|
+
return "auto";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return parsed.data;
|
|
114
|
+
}),
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @experimental
|
|
118
|
+
*
|
|
119
|
+
* WebAssembly runtime configuration.
|
|
120
|
+
* */
|
|
121
|
+
wasm: WasmRuntimeConfigSchema.optional().default(() => ({})),
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @experimental
|
|
125
|
+
*
|
|
126
|
+
* SQLite backend selection.
|
|
127
|
+
* */
|
|
128
|
+
sqlite: SqliteConfigSchema,
|
|
129
|
+
|
|
63
130
|
/**
|
|
64
131
|
* @experimental
|
|
65
132
|
*
|
|
@@ -150,6 +217,27 @@ export const RegistryConfigSchema = z
|
|
|
150
217
|
* Starts the full Rust engine process locally.
|
|
151
218
|
*/
|
|
152
219
|
startEngine: z.boolean().default(() => getRivetRunEngine()),
|
|
220
|
+
/**
|
|
221
|
+
* @experimental
|
|
222
|
+
*
|
|
223
|
+
* Host to bind the spawned local engine process to.
|
|
224
|
+
*/
|
|
225
|
+
engineHost: z
|
|
226
|
+
.string()
|
|
227
|
+
.optional()
|
|
228
|
+
.default(() => getRivetRunEngineHost() ?? ENGINE_HOST),
|
|
229
|
+
/**
|
|
230
|
+
* @experimental
|
|
231
|
+
*
|
|
232
|
+
* Port to bind the spawned local engine process to.
|
|
233
|
+
*/
|
|
234
|
+
enginePort: z
|
|
235
|
+
.number()
|
|
236
|
+
.int()
|
|
237
|
+
.min(1)
|
|
238
|
+
.max(65_535)
|
|
239
|
+
.optional()
|
|
240
|
+
.default(() => getRivetRunEnginePort() ?? ENGINE_PORT),
|
|
153
241
|
/** @experimental */
|
|
154
242
|
engineVersion: z
|
|
155
243
|
.string()
|
|
@@ -188,12 +276,12 @@ export const RegistryConfigSchema = z
|
|
|
188
276
|
.object({
|
|
189
277
|
/**
|
|
190
278
|
* Wait this many milliseconds for the serve promise to resolve
|
|
191
|
-
* after calling `CoreRegistry::shutdown()`. Defaults to
|
|
192
|
-
*
|
|
279
|
+
* after calling `CoreRegistry::shutdown()`. Defaults to the
|
|
280
|
+
* engine-provided actor stop threshold once the envoy connects.
|
|
193
281
|
*
|
|
194
|
-
* Must be
|
|
282
|
+
* Must be long enough for rivetkit-core to drain the envoy.
|
|
195
283
|
*/
|
|
196
|
-
gracePeriodMs: z.number().int().min(1_000).optional()
|
|
284
|
+
gracePeriodMs: z.number().int().min(1_000).optional(),
|
|
197
285
|
/**
|
|
198
286
|
* If true, rivetkit will not install SIGINT/SIGTERM handlers.
|
|
199
287
|
* Use when the host application owns signal policy and will
|
|
@@ -202,10 +290,31 @@ export const RegistryConfigSchema = z
|
|
|
202
290
|
disableSignalHandlers: z.boolean().optional().default(false),
|
|
203
291
|
})
|
|
204
292
|
.optional()
|
|
205
|
-
.default(() => ({
|
|
293
|
+
.default(() => ({
|
|
294
|
+
disableSignalHandlers: false,
|
|
295
|
+
})),
|
|
206
296
|
})
|
|
207
297
|
.transform((config, ctx) => {
|
|
208
298
|
const isDevEnv = isDev();
|
|
299
|
+
const sqliteBackend =
|
|
300
|
+
config.sqlite?.backend ?? config.test?.sqliteBackend;
|
|
301
|
+
|
|
302
|
+
if (config.runtime === "wasm" && sqliteBackend === "local") {
|
|
303
|
+
ctx.addIssue({
|
|
304
|
+
code: "custom",
|
|
305
|
+
message:
|
|
306
|
+
"WebAssembly runtime cannot use local SQLite. Use remote SQLite instead.",
|
|
307
|
+
path:
|
|
308
|
+
config.sqlite?.backend === "local"
|
|
309
|
+
? ["sqlite"]
|
|
310
|
+
: ["test", "sqliteBackend"],
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
const sqlite =
|
|
315
|
+
config.runtime === "wasm" && config.sqlite === undefined
|
|
316
|
+
? { backend: "remote" as const }
|
|
317
|
+
: config.sqlite;
|
|
209
318
|
|
|
210
319
|
// Parse endpoint string (env var fallback is applied via transform above)
|
|
211
320
|
const parsedEndpoint = config.endpoint
|
|
@@ -217,7 +326,9 @@ export const RegistryConfigSchema = z
|
|
|
217
326
|
})
|
|
218
327
|
: undefined;
|
|
219
328
|
|
|
220
|
-
//
|
|
329
|
+
// RIVET_ENDPOINT configures what RivetKit connects to. Use
|
|
330
|
+
// engineHost/enginePort (or RIVET_RUN_ENGINE_HOST/PORT) to control the
|
|
331
|
+
// spawned local engine bind address.
|
|
221
332
|
if (config.startEngine && parsedEndpoint) {
|
|
222
333
|
ctx.addIssue({
|
|
223
334
|
code: "custom",
|
|
@@ -234,12 +345,15 @@ export const RegistryConfigSchema = z
|
|
|
234
345
|
});
|
|
235
346
|
}
|
|
236
347
|
|
|
237
|
-
// Flatten the endpoint and apply defaults for namespace/token
|
|
238
|
-
|
|
348
|
+
// Flatten the endpoint and apply defaults for namespace/token.
|
|
349
|
+
const localEngineEndpoint = buildEngineEndpoint(
|
|
350
|
+
config.engineHost,
|
|
351
|
+
config.enginePort,
|
|
352
|
+
);
|
|
239
353
|
const endpoint = config.startEngine
|
|
240
|
-
?
|
|
354
|
+
? localEngineEndpoint
|
|
241
355
|
: (parsedEndpoint?.endpoint ??
|
|
242
|
-
(isDevEnv ?
|
|
356
|
+
(isDevEnv ? localEngineEndpoint : undefined));
|
|
243
357
|
const validateServerlessEndpoint = Boolean(
|
|
244
358
|
config.startEngine || parsedEndpoint,
|
|
245
359
|
);
|
|
@@ -272,7 +386,7 @@ export const RegistryConfigSchema = z
|
|
|
272
386
|
// In dev mode, clients connect directly to the local Rivet Engine.
|
|
273
387
|
const publicEndpoint =
|
|
274
388
|
parsedPublicEndpoint?.endpoint ??
|
|
275
|
-
(isDevEnv &&
|
|
389
|
+
(isDevEnv && !parsedEndpoint ? endpoint : undefined);
|
|
276
390
|
// We extract publicNamespace to validate that it matches the backend
|
|
277
391
|
// namespace (see validation above), not for functional use.
|
|
278
392
|
const publicNamespace = parsedPublicEndpoint?.namespace;
|
|
@@ -282,6 +396,7 @@ export const RegistryConfigSchema = z
|
|
|
282
396
|
// If endpoint is set or starting the engine, we'll use the engine driver.
|
|
283
397
|
return {
|
|
284
398
|
...config,
|
|
399
|
+
sqlite,
|
|
285
400
|
endpoint,
|
|
286
401
|
namespace,
|
|
287
402
|
token,
|
|
@@ -314,30 +429,6 @@ export function buildActorNames(
|
|
|
314
429
|
// Actor options take precedence over run metadata
|
|
315
430
|
metadata.icon = options.icon ?? runMeta.icon;
|
|
316
431
|
metadata.name = options.name ?? runMeta.name;
|
|
317
|
-
metadata.preload = {
|
|
318
|
-
keys: [
|
|
319
|
-
Array.from(KEYS.PERSIST_DATA),
|
|
320
|
-
Array.from(KEYS.INSPECTOR_TOKEN),
|
|
321
|
-
Array.from(queueMetadataKey()),
|
|
322
|
-
],
|
|
323
|
-
prefixes: [
|
|
324
|
-
{
|
|
325
|
-
prefix: Array.from(workflowStoragePrefix()),
|
|
326
|
-
maxBytes: options.preloadMaxWorkflowBytes ?? 131_072,
|
|
327
|
-
partial: false,
|
|
328
|
-
},
|
|
329
|
-
{
|
|
330
|
-
prefix: Array.from(KEYS.CONN_PREFIX),
|
|
331
|
-
maxBytes: options.preloadMaxConnectionsBytes ?? 65_536,
|
|
332
|
-
partial: false,
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
prefix: Array.from(queueMessagesPrefix()),
|
|
336
|
-
maxBytes: 65_536,
|
|
337
|
-
partial: false,
|
|
338
|
-
},
|
|
339
|
-
],
|
|
340
|
-
};
|
|
341
432
|
// Remove undefined values
|
|
342
433
|
if (!metadata.icon) delete metadata.icon;
|
|
343
434
|
if (!metadata.name) delete metadata.name;
|
|
@@ -366,6 +457,12 @@ export const DocConfigurePoolSchema = z
|
|
|
366
457
|
.number()
|
|
367
458
|
.optional()
|
|
368
459
|
.describe("Maximum lifespan of a request in seconds."),
|
|
460
|
+
drainGracePeriod: z
|
|
461
|
+
.number()
|
|
462
|
+
.optional()
|
|
463
|
+
.describe(
|
|
464
|
+
"Grace period before the serverless request is forcibly closed, in seconds.",
|
|
465
|
+
),
|
|
369
466
|
metadata: z
|
|
370
467
|
.record(z.string(), z.unknown())
|
|
371
468
|
.optional()
|
|
@@ -399,7 +496,7 @@ export const DocServerlessConfigSchema = z
|
|
|
399
496
|
.number()
|
|
400
497
|
.optional()
|
|
401
498
|
.describe(
|
|
402
|
-
|
|
499
|
+
`Maximum POST /start body size in bytes. Default: ${DEFAULT_SERVERLESS_MAX_START_PAYLOAD_BYTES}`,
|
|
403
500
|
),
|
|
404
501
|
publicEndpoint: z
|
|
405
502
|
.string()
|
|
@@ -437,6 +534,15 @@ export const DocEnvoyConfigSchema = z
|
|
|
437
534
|
})
|
|
438
535
|
.describe("Configuration for envoy mode.");
|
|
439
536
|
|
|
537
|
+
export const DocSqliteConfigSchema = z
|
|
538
|
+
.object({
|
|
539
|
+
backend: SqliteBackendSchema.optional().describe(
|
|
540
|
+
"SQLite backend to use. Native defaults to local. Wasm defaults to remote and cannot use local.",
|
|
541
|
+
),
|
|
542
|
+
})
|
|
543
|
+
.optional()
|
|
544
|
+
.describe("SQLite runtime configuration.");
|
|
545
|
+
|
|
440
546
|
export const DocRegistryConfigSchema = z
|
|
441
547
|
.object({
|
|
442
548
|
use: z
|
|
@@ -460,6 +566,7 @@ export const DocRegistryConfigSchema = z
|
|
|
460
566
|
.boolean()
|
|
461
567
|
.optional()
|
|
462
568
|
.describe("Disable the welcome message on startup. Default: false"),
|
|
569
|
+
sqlite: DocSqliteConfigSchema,
|
|
463
570
|
logging: z
|
|
464
571
|
.object({
|
|
465
572
|
level: LogLevelSchema.optional().describe(
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
2
|
import { getRivetPublicEndpoint, getRivetPublicToken } from "@/utils/env-vars";
|
|
3
3
|
|
|
4
|
+
export const DEFAULT_SERVERLESS_MAX_START_PAYLOAD_BYTES = 16 * 1024 * 1024;
|
|
5
|
+
|
|
4
6
|
export const ConfigurePoolSchema = z
|
|
5
7
|
.object({
|
|
6
8
|
name: z.string().optional(),
|
|
7
9
|
url: z.string(),
|
|
8
10
|
headers: z.record(z.string(), z.string()).optional(),
|
|
9
11
|
requestLifespan: z.number().optional(),
|
|
12
|
+
drainGracePeriod: z.number().optional(),
|
|
10
13
|
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
11
14
|
metadataPollInterval: z.number().optional(),
|
|
12
15
|
drainOnVersionUpgrade: z.boolean().optional(),
|
|
@@ -16,7 +19,10 @@ export const ConfigurePoolSchema = z
|
|
|
16
19
|
export const ServerlessConfigSchema = z.object({
|
|
17
20
|
// MARK: Routing
|
|
18
21
|
basePath: z.string().optional().default("/api/rivet"),
|
|
19
|
-
maxStartPayloadBytes: z
|
|
22
|
+
maxStartPayloadBytes: z
|
|
23
|
+
.number()
|
|
24
|
+
.optional()
|
|
25
|
+
.default(DEFAULT_SERVERLESS_MAX_START_PAYLOAD_BYTES),
|
|
20
26
|
|
|
21
27
|
// MARK: Public Endpoint Configuration
|
|
22
28
|
/**
|