rivetkit 0.0.0-skip-ready-wait-flatten-client-options.1cae221 → 0.0.0-sqlite-uds.4e59a38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/client.d.ts +561 -89
- package/dist/browser/client.js +1063 -430
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +22 -2
- package/dist/browser/inspector/client.js +1036 -232
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -74
- package/dist/tsup/actor/errors.d.ts +1 -74
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/agent-os/index.cjs +2218 -2082
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +556 -85
- package/dist/tsup/agent-os/index.d.ts +556 -85
- package/dist/tsup/agent-os/index.js +2220 -2084
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-NFC5VU36.cjs → chunk-3GC3EP6D.cjs} +18 -10
- package/dist/tsup/chunk-3GC3EP6D.cjs.map +1 -0
- package/dist/tsup/{chunk-7MRGNVSR.js → chunk-3GLNEWGY.js} +78 -6
- package/dist/tsup/chunk-3GLNEWGY.js.map +1 -0
- package/dist/tsup/{chunk-V3QNBJ7N.cjs → chunk-4FC7TVS6.cjs} +35 -10
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-POTPHU3P.cjs → chunk-62LSMTP2.cjs} +3 -3
- package/dist/tsup/{chunk-POTPHU3P.cjs.map → chunk-62LSMTP2.cjs.map} +1 -1
- package/dist/tsup/{chunk-OIKOPSXQ.js → chunk-7IVUT2JT.js} +12 -4
- package/dist/tsup/chunk-7IVUT2JT.js.map +1 -0
- package/dist/tsup/{chunk-22XU3BVY.cjs → chunk-GEYQLGXC.cjs} +925 -328
- package/dist/tsup/chunk-GEYQLGXC.cjs.map +1 -0
- package/dist/tsup/{chunk-D2TLG75Y.cjs → chunk-GMN45CQ6.cjs} +10 -10
- package/dist/tsup/chunk-GMN45CQ6.cjs.map +1 -0
- package/dist/tsup/{chunk-3BFYSYRU.js → chunk-HXUEHHJF.js} +3 -2
- package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
- package/dist/tsup/{chunk-IOYKCB6Y.cjs → chunk-I336PMWT.cjs} +44 -9
- package/dist/tsup/chunk-I336PMWT.cjs.map +1 -0
- package/dist/tsup/{chunk-RZEJJJKU.js → chunk-IB73AMGJ.js} +42 -7
- package/dist/tsup/chunk-IB73AMGJ.js.map +1 -0
- package/dist/tsup/{chunk-4ZIWB4CQ.js → chunk-ITWJ6Y7G.js} +2 -2
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
- package/dist/tsup/{chunk-W54QCENI.js → chunk-KTNBYGRU.js} +134 -20
- package/dist/tsup/chunk-KTNBYGRU.js.map +1 -0
- package/dist/tsup/{chunk-AK57AL7S.cjs → chunk-OAPVVVTX.cjs} +79 -7
- package/dist/tsup/chunk-OAPVVVTX.cjs.map +1 -0
- package/dist/tsup/{chunk-TPBHXFB2.cjs → chunk-OUDV3ITX.cjs} +138 -24
- package/dist/tsup/chunk-OUDV3ITX.cjs.map +1 -0
- package/dist/tsup/{chunk-XNZR7UD2.cjs → chunk-PRXTIERO.cjs} +90 -65
- package/dist/tsup/chunk-PRXTIERO.cjs.map +1 -0
- package/dist/tsup/{chunk-LLD2D5LO.cjs → chunk-VE2X4KMG.cjs} +3 -2
- package/dist/tsup/chunk-VE2X4KMG.cjs.map +1 -0
- package/dist/tsup/{chunk-KSG2COSQ.js → chunk-WRZEVVLL.js} +6 -6
- package/dist/tsup/chunk-WRZEVVLL.js.map +1 -0
- package/dist/tsup/{chunk-LNMB25HW.js → chunk-XAIMHUPG.js} +780 -183
- package/dist/tsup/chunk-XAIMHUPG.js.map +1 -0
- package/dist/tsup/{chunk-D4TSTM6C.js → chunk-XZ62SWSC.js} +83 -58
- package/dist/tsup/chunk-XZ62SWSC.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
- package/dist/tsup/{chunk-K34B3OVG.js → chunk-ZZ3WBRPD.js} +34 -9
- package/dist/tsup/chunk-ZZ3WBRPD.js.map +1 -0
- package/dist/tsup/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +8 -9
- package/dist/tsup/client/mod.d.ts +8 -9
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-CRdGwwbr.d.cts → config-CxG53eQo.d.cts} +577 -36
- package/dist/tsup/{config-kxXbtrJU.d.ts → config-DLOxy81E.d.cts} +5 -5
- package/dist/tsup/{config-kxXbtrJU.d.cts → config-DLOxy81E.d.ts} +5 -5
- package/dist/tsup/{config-DIpBWm5C.d.ts → config-Ds6DCRhV.d.ts} +577 -36
- package/dist/tsup/context-8KlcOYIs.d.cts +129 -0
- package/dist/tsup/context-Cfbm4QLr.d.ts +129 -0
- package/dist/tsup/db/drizzle.cjs +151 -79
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +2 -2
- package/dist/tsup/db/drizzle.d.ts +2 -2
- package/dist/tsup/db/drizzle.js +151 -79
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +79 -24
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +78 -23
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +37 -0
- package/dist/tsup/dynamic/mod.d.ts +37 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +37 -15
- package/dist/tsup/inspector/mod.d.ts +37 -15
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +240 -0
- package/dist/tsup/inspector-tab/mod.d.ts +240 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +1078 -479
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -6
- package/dist/tsup/mod.d.ts +5 -6
- package/dist/tsup/mod.js +996 -397
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +21 -18
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -5
- package/dist/tsup/test/mod.d.ts +4 -5
- package/dist/tsup/test/mod.js +18 -15
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/utils-CqDnC_PS.d.cts +104 -0
- package/dist/tsup/utils-CqDnC_PS.d.ts +104 -0
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +386 -322
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -9
- package/dist/tsup/workflow/mod.d.ts +8 -9
- package/dist/tsup/workflow/mod.js +363 -299
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +35 -14
- package/src/actor/config.ts +188 -59
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +17 -19
- package/src/actor/driver.ts +3 -3
- package/src/actor/errors.ts +70 -7
- package/src/actor/instance/mod.ts +39 -56
- package/src/actor/keys.ts +2 -1
- package/src/actor/mod.ts +22 -20
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/index.ts +38 -18
- package/src/agent-os/actor/preview.ts +1 -2
- package/src/agent-os/actor/session.ts +2 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/client/actor-common.ts +88 -62
- package/src/client/actor-conn.ts +58 -63
- package/src/client/actor-handle.ts +125 -71
- package/src/client/actor-query.ts +5 -5
- package/src/client/config.ts +3 -3
- package/src/client/errors.ts +2 -1
- package/src/client/lifecycle-errors.ts +2 -4
- package/src/client/query.ts +1 -1
- package/src/client/queue.ts +8 -3
- package/src/client/raw-utils.ts +10 -10
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +34 -10
- package/src/common/actor-router-consts.ts +7 -4
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/client-protocol/v4.ts +599 -0
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +176 -67
- package/src/common/client-protocol-zod.ts +7 -0
- package/src/common/client-protocol.ts +1 -1
- package/src/common/database/config.ts +16 -5
- package/src/common/database/mod.test.ts +83 -16
- package/src/common/database/mod.ts +86 -30
- package/src/common/database/native-database.test.ts +35 -22
- package/src/common/database/native-database.ts +26 -10
- package/src/common/database/shared.ts +1 -0
- package/src/common/encoding.ts +250 -16
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/log.ts +15 -8
- package/src/common/router.ts +49 -23
- package/src/common/utils.ts +10 -202
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.ts +173 -96
- package/src/db/mod.ts +1 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/drivers/engine/actor-driver.ts +76 -73
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +66 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +6 -9
- package/src/engine-client/actor-websocket-client.ts +14 -13
- package/src/engine-client/api-endpoints.ts +51 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +3 -4
- package/src/engine-client/mod.ts +17 -10
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +66 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector-tab/mod.ts +300 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +46 -20
- package/src/registry/index.ts +364 -87
- package/src/registry/napi-runtime.ts +97 -8
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +592 -343
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/runtime.ts +85 -6
- package/src/registry/wasm-runtime.ts +72 -3
- package/src/registry/write-through-proxy.ts +40 -0
- package/src/serde.ts +2 -2
- package/src/serverless/configure.ts +19 -8
- package/src/test/mod.ts +11 -8
- package/src/utils/crypto.ts +14 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +37 -0
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +1 -2
- package/src/workflow/context.ts +703 -240
- package/src/workflow/driver.ts +23 -12
- package/src/workflow/inspector.ts +12 -3
- package/src/workflow/mod.ts +37 -23
- package/dist/tsup/chunk-22XU3BVY.cjs.map +0 -1
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3BFYSYRU.js.map +0 -1
- package/dist/tsup/chunk-7MRGNVSR.js.map +0 -1
- package/dist/tsup/chunk-AK57AL7S.cjs.map +0 -1
- package/dist/tsup/chunk-D2TLG75Y.cjs.map +0 -1
- package/dist/tsup/chunk-D4TSTM6C.js.map +0 -1
- package/dist/tsup/chunk-IOYKCB6Y.cjs.map +0 -1
- package/dist/tsup/chunk-K34B3OVG.js.map +0 -1
- package/dist/tsup/chunk-KSG2COSQ.js.map +0 -1
- package/dist/tsup/chunk-LLD2D5LO.cjs.map +0 -1
- package/dist/tsup/chunk-LNMB25HW.js.map +0 -1
- package/dist/tsup/chunk-NFC5VU36.cjs.map +0 -1
- package/dist/tsup/chunk-OIKOPSXQ.js.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-RZEJJJKU.js.map +0 -1
- package/dist/tsup/chunk-TPBHXFB2.cjs.map +0 -1
- package/dist/tsup/chunk-V3QNBJ7N.cjs.map +0 -1
- package/dist/tsup/chunk-W54QCENI.js.map +0 -1
- package/dist/tsup/chunk-XNZR7UD2.cjs.map +0 -1
- package/dist/tsup/context-B7G6sk7x.d.ts +0 -92
- package/dist/tsup/context-DzMRHkjC.d.cts +0 -92
- package/dist/tsup/utils-fwx3o3K9.d.cts +0 -18
- package/dist/tsup/utils-fwx3o3K9.d.ts +0 -18
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-4ZIWB4CQ.js.map → chunk-ITWJ6Y7G.js.map} +0 -0
|
@@ -0,0 +1,300 @@
|
|
|
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
|
+
| "connections"
|
|
73
|
+
| "console";
|
|
74
|
+
|
|
75
|
+
// ============================================================================
|
|
76
|
+
// Dashboard ↔ tab postMessage envelope (source of truth).
|
|
77
|
+
//
|
|
78
|
+
// These Zod schemas are imported by `frontend/apps/inspector-ui/src/bridge.ts`
|
|
79
|
+
// and used to validate inbound messages at runtime. Changes here flow to
|
|
80
|
+
// both sides in a single commit.
|
|
81
|
+
// ============================================================================
|
|
82
|
+
|
|
83
|
+
/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */
|
|
84
|
+
export const InspectorTabDescriptorSchema = z.object({
|
|
85
|
+
id: z.string(),
|
|
86
|
+
label: z.string(),
|
|
87
|
+
icon: z.string(),
|
|
88
|
+
/**
|
|
89
|
+
* `true` for author-shipped custom tabs; absent or `false` for
|
|
90
|
+
* built-in tabs the SPA renders. Lets the dashboard route the
|
|
91
|
+
* iframe `src` to `/inspector/custom-tabs/<id>/` for custom tabs and
|
|
92
|
+
* `/inspector/ui/` for built-ins without the dashboard needing to
|
|
93
|
+
* know which ids are built-in.
|
|
94
|
+
*/
|
|
95
|
+
isCustom: z.boolean().optional(),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Initial handshake from the dashboard. Sent on first mount and again on
|
|
100
|
+
* every token refresh. Tabs MUST accept late `init` messages and replace
|
|
101
|
+
* the cached token.
|
|
102
|
+
*/
|
|
103
|
+
export const V1InitSchema = z.object({
|
|
104
|
+
type: z.literal("init"),
|
|
105
|
+
v: z.literal(1),
|
|
106
|
+
/** The actor this tab is mounted for. */
|
|
107
|
+
actorId: z.string(),
|
|
108
|
+
/**
|
|
109
|
+
* Per-actor inspector bearer token. Tabs include it as
|
|
110
|
+
* `Authorization: Bearer ${authToken}` on every authenticated fetch.
|
|
111
|
+
*/
|
|
112
|
+
authToken: z.string(),
|
|
113
|
+
/**
|
|
114
|
+
* Outer Rivet API token. Optional; not required for inspector HTTP
|
|
115
|
+
* routes but available to tabs that want to call the engine REST API.
|
|
116
|
+
*/
|
|
117
|
+
rivetToken: z.string().optional(),
|
|
118
|
+
/**
|
|
119
|
+
* The tab id the dashboard wants active at mount time. Multi-view
|
|
120
|
+
* tabs may read this to seed their initial route; most tabs ignore it.
|
|
121
|
+
*/
|
|
122
|
+
activeTab: z.string().optional(),
|
|
123
|
+
/**
|
|
124
|
+
* Dashboard's currently active theme. Tabs that use the shared
|
|
125
|
+
* stylesheet (`/inspector/tab.css`) mirror it by toggling the `dark`
|
|
126
|
+
* class on `<html>`. Optional for backwards compatibility — tabs
|
|
127
|
+
* should default to `"dark"` if absent (the dashboard pinned dark
|
|
128
|
+
* mode before this field was added).
|
|
129
|
+
*/
|
|
130
|
+
theme: z.enum(["light", "dark"]).optional(),
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Dashboard tells the inspector-ui SPA which built-in tab to render. Not
|
|
135
|
+
* sent to custom tabs — when the user activates a custom tab the
|
|
136
|
+
* dashboard navigates the outer iframe to a different `src`.
|
|
137
|
+
*/
|
|
138
|
+
export const V1SetActiveTabSchema = z.object({
|
|
139
|
+
type: z.literal("set-active-tab"),
|
|
140
|
+
v: z.literal(1),
|
|
141
|
+
tab: z.string(),
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Tab → dashboard. Sent once after the message listener is registered.
|
|
146
|
+
* The dashboard hides the "Connecting to inspector…" overlay on receipt;
|
|
147
|
+
* if it never arrives the overlay times out after 8 s.
|
|
148
|
+
*/
|
|
149
|
+
export const V1ReadySchema = z.object({
|
|
150
|
+
type: z.literal("ready"),
|
|
151
|
+
v: z.literal(1),
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Tab → dashboard. Sent when the tab gets a 401 on an inspector data
|
|
156
|
+
* call. The dashboard refreshes the token and re-issues `v1Init`.
|
|
157
|
+
*/
|
|
158
|
+
export const V1TokenRefreshNeededSchema = z.object({
|
|
159
|
+
type: z.literal("token-refresh-needed"),
|
|
160
|
+
v: z.literal(1),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Emitted by the inspector-ui SPA to tell the dashboard which tabs to
|
|
165
|
+
* render in the strip. Custom tab bundles do NOT emit this — only the
|
|
166
|
+
* SPA does.
|
|
167
|
+
*/
|
|
168
|
+
export const V1TabsAvailableSchema = z.object({
|
|
169
|
+
type: z.literal("tabs-available"),
|
|
170
|
+
v: z.literal(1),
|
|
171
|
+
tabs: z.array(InspectorTabDescriptorSchema),
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
/** Discriminated union of messages a tab can RECEIVE from the dashboard. */
|
|
175
|
+
export const ShellToTabMessageSchema = z.discriminatedUnion("type", [
|
|
176
|
+
V1InitSchema,
|
|
177
|
+
V1SetActiveTabSchema,
|
|
178
|
+
]);
|
|
179
|
+
|
|
180
|
+
/** Discriminated union of messages a tab can SEND to the dashboard. */
|
|
181
|
+
export const TabToShellMessageSchema = z.discriminatedUnion("type", [
|
|
182
|
+
V1ReadySchema,
|
|
183
|
+
V1TabsAvailableSchema,
|
|
184
|
+
V1TokenRefreshNeededSchema,
|
|
185
|
+
]);
|
|
186
|
+
|
|
187
|
+
export type InspectorTabDescriptor = z.infer<
|
|
188
|
+
typeof InspectorTabDescriptorSchema
|
|
189
|
+
>;
|
|
190
|
+
export type V1Init = z.infer<typeof V1InitSchema>;
|
|
191
|
+
export type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;
|
|
192
|
+
export type V1Ready = z.infer<typeof V1ReadySchema>;
|
|
193
|
+
export type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;
|
|
194
|
+
export type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;
|
|
195
|
+
export type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;
|
|
196
|
+
export type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;
|
|
197
|
+
|
|
198
|
+
/** Stable envelope protocol version. Bump only when introducing a v2 shape. */
|
|
199
|
+
export const POSTMESSAGE_PROTOCOL_VERSION = 1;
|
|
200
|
+
|
|
201
|
+
/** URL query parameters the dashboard sets on the tab iframe `src`. */
|
|
202
|
+
export const SHELL_ORIGIN_PARAM = "shellOrigin";
|
|
203
|
+
export const ACTOR_ID_PARAM = "actorId";
|
|
204
|
+
|
|
205
|
+
// ============================================================================
|
|
206
|
+
// Inspector HTTP endpoint response schemas (source of truth).
|
|
207
|
+
//
|
|
208
|
+
// The dashboard parses every authenticated inspector response through
|
|
209
|
+
// these schemas (`frontend/src/components/actors/actor-inspector-context.tsx`).
|
|
210
|
+
// If the Rust handler emits a different shape the parse fails and the
|
|
211
|
+
// dashboard surfaces an error — drift is loud.
|
|
212
|
+
// ============================================================================
|
|
213
|
+
|
|
214
|
+
/** `GET /inspector/state` response shape. */
|
|
215
|
+
export const InspectorStateResponseSchema = z.object({
|
|
216
|
+
/** Current actor state (whatever shape the actor declared). */
|
|
217
|
+
state: z.unknown(),
|
|
218
|
+
/**
|
|
219
|
+
* `false` when the actor did not declare any state — `state` is then
|
|
220
|
+
* `null` and `PATCH /inspector/state` returns an error.
|
|
221
|
+
*/
|
|
222
|
+
isStateEnabled: z.boolean(),
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
/** `POST /inspector/action/<name>` request body. */
|
|
226
|
+
export const InspectorActionRequestSchema = z
|
|
227
|
+
.object({
|
|
228
|
+
/** Positional arguments. Mutually exclusive with `properties`. */
|
|
229
|
+
args: z.array(z.unknown()).optional(),
|
|
230
|
+
/** Keyed arguments. Mutually exclusive with `args`. */
|
|
231
|
+
properties: z.record(z.string(), z.unknown()).optional(),
|
|
232
|
+
})
|
|
233
|
+
.refine(
|
|
234
|
+
(body) => !(body.args !== undefined && body.properties !== undefined),
|
|
235
|
+
"Use either `args` or `properties`, not both",
|
|
236
|
+
);
|
|
237
|
+
|
|
238
|
+
/** `POST /inspector/action/<name>` response shape. */
|
|
239
|
+
export const InspectorActionResponseSchema = z.object({
|
|
240
|
+
output: z.unknown(),
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
/** `GET /inspector/rpcs` response shape — the list of action names. */
|
|
244
|
+
export const InspectorRpcsResponseSchema = z.object({
|
|
245
|
+
rpcs: z.array(z.string()),
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
/** One connection record in `GET /inspector/connections`. */
|
|
249
|
+
export const InspectorConnectionSchema = z.object({
|
|
250
|
+
connectionType: z.string().nullable(),
|
|
251
|
+
id: z.string(),
|
|
252
|
+
details: z.object({
|
|
253
|
+
connectionType: z.string().nullable(),
|
|
254
|
+
params: z.unknown(),
|
|
255
|
+
stateEnabled: z.boolean(),
|
|
256
|
+
state: z.unknown(),
|
|
257
|
+
subscriptions: z.number(),
|
|
258
|
+
isHibernatable: z.boolean(),
|
|
259
|
+
}),
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
/** `GET /inspector/connections` response shape. */
|
|
263
|
+
export const InspectorConnectionsResponseSchema = z.object({
|
|
264
|
+
connections: z.array(InspectorConnectionSchema),
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
/** One queued message in `GET /inspector/queue`. */
|
|
268
|
+
export const InspectorQueueMessageSchema = z.object({
|
|
269
|
+
id: z.string(),
|
|
270
|
+
name: z.string(),
|
|
271
|
+
createdAtMs: z.number(),
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
/** `GET /inspector/queue` response shape. */
|
|
275
|
+
export const InspectorQueueResponseSchema = z.object({
|
|
276
|
+
size: z.number(),
|
|
277
|
+
maxSize: z.number(),
|
|
278
|
+
/** `true` if `?limit=N` truncated the message list below `size`. */
|
|
279
|
+
truncated: z.boolean(),
|
|
280
|
+
messages: z.array(InspectorQueueMessageSchema),
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
export type InspectorStateResponse = z.infer<
|
|
284
|
+
typeof InspectorStateResponseSchema
|
|
285
|
+
>;
|
|
286
|
+
export type InspectorActionRequest = z.infer<
|
|
287
|
+
typeof InspectorActionRequestSchema
|
|
288
|
+
>;
|
|
289
|
+
export type InspectorActionResponse = z.infer<
|
|
290
|
+
typeof InspectorActionResponseSchema
|
|
291
|
+
>;
|
|
292
|
+
export type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;
|
|
293
|
+
export type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;
|
|
294
|
+
export type InspectorConnectionsResponse = z.infer<
|
|
295
|
+
typeof InspectorConnectionsResponseSchema
|
|
296
|
+
>;
|
|
297
|
+
export type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;
|
|
298
|
+
export type InspectorQueueResponse = z.infer<
|
|
299
|
+
typeof InspectorQueueResponseSchema
|
|
300
|
+
>;
|
|
@@ -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;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
queueMetadataKey,
|
|
11
11
|
workflowStoragePrefix,
|
|
12
12
|
} from "@/actor/keys";
|
|
13
|
-
import {
|
|
13
|
+
import { buildEngineEndpoint, ENGINE_HOST, ENGINE_PORT } from "@/common/engine";
|
|
14
14
|
import { type Logger, LogLevelSchema } from "@/common/log";
|
|
15
15
|
import { VERSION } from "@/utils";
|
|
16
16
|
import { tryParseEndpoint } from "@/utils/endpoint-parser";
|
|
@@ -20,6 +20,8 @@ import {
|
|
|
20
20
|
getRivetkitRuntime,
|
|
21
21
|
getRivetNamespace,
|
|
22
22
|
getRivetRunEngine,
|
|
23
|
+
getRivetRunEngineHost,
|
|
24
|
+
getRivetRunEnginePort,
|
|
23
25
|
getRivetRunEngineVersion,
|
|
24
26
|
getRivetToken,
|
|
25
27
|
isDev,
|
|
@@ -33,9 +35,7 @@ import {
|
|
|
33
35
|
|
|
34
36
|
export const ActorsSchema = z.record(
|
|
35
37
|
z.string(),
|
|
36
|
-
z.custom<
|
|
37
|
-
BaseActorDefinition<any, any, any, any, any, any, any, any, any>
|
|
38
|
-
>(),
|
|
38
|
+
z.custom<AnyActorDefinition>(),
|
|
39
39
|
);
|
|
40
40
|
export type RegistryActors = z.infer<typeof ActorsSchema>;
|
|
41
41
|
|
|
@@ -97,6 +97,9 @@ export const RegistryConfigSchema = z
|
|
|
97
97
|
/** @experimental */
|
|
98
98
|
maxOutgoingMessageSize: z.number().optional().default(1_048_576),
|
|
99
99
|
|
|
100
|
+
/** Enables the experimental per-actor Unix socket API. */
|
|
101
|
+
experimentalActorUds: z.boolean().optional().default(false),
|
|
102
|
+
|
|
100
103
|
// MARK: Runtime
|
|
101
104
|
/**
|
|
102
105
|
* @experimental
|
|
@@ -226,6 +229,27 @@ export const RegistryConfigSchema = z
|
|
|
226
229
|
* Starts the full Rust engine process locally.
|
|
227
230
|
*/
|
|
228
231
|
startEngine: z.boolean().default(() => getRivetRunEngine()),
|
|
232
|
+
/**
|
|
233
|
+
* @experimental
|
|
234
|
+
*
|
|
235
|
+
* Host to bind the spawned local engine process to.
|
|
236
|
+
*/
|
|
237
|
+
engineHost: z
|
|
238
|
+
.string()
|
|
239
|
+
.optional()
|
|
240
|
+
.default(() => getRivetRunEngineHost() ?? ENGINE_HOST),
|
|
241
|
+
/**
|
|
242
|
+
* @experimental
|
|
243
|
+
*
|
|
244
|
+
* Port to bind the spawned local engine process to.
|
|
245
|
+
*/
|
|
246
|
+
enginePort: z
|
|
247
|
+
.number()
|
|
248
|
+
.int()
|
|
249
|
+
.min(1)
|
|
250
|
+
.max(65_535)
|
|
251
|
+
.optional()
|
|
252
|
+
.default(() => getRivetRunEnginePort() ?? ENGINE_PORT),
|
|
229
253
|
/** @experimental */
|
|
230
254
|
engineVersion: z
|
|
231
255
|
.string()
|
|
@@ -264,17 +288,12 @@ export const RegistryConfigSchema = z
|
|
|
264
288
|
.object({
|
|
265
289
|
/**
|
|
266
290
|
* Wait this many milliseconds for the serve promise to resolve
|
|
267
|
-
* after calling `CoreRegistry::shutdown()`. Defaults to
|
|
268
|
-
*
|
|
291
|
+
* after calling `CoreRegistry::shutdown()`. Defaults to the
|
|
292
|
+
* engine-provided actor stop threshold once the envoy connects.
|
|
269
293
|
*
|
|
270
|
-
* Must be
|
|
294
|
+
* Must be long enough for rivetkit-core to drain the envoy.
|
|
271
295
|
*/
|
|
272
|
-
gracePeriodMs: z
|
|
273
|
-
.number()
|
|
274
|
-
.int()
|
|
275
|
-
.min(1_000)
|
|
276
|
-
.optional()
|
|
277
|
-
.default(30_000),
|
|
296
|
+
gracePeriodMs: z.number().int().min(1_000).optional(),
|
|
278
297
|
/**
|
|
279
298
|
* If true, rivetkit will not install SIGINT/SIGTERM handlers.
|
|
280
299
|
* Use when the host application owns signal policy and will
|
|
@@ -284,7 +303,6 @@ export const RegistryConfigSchema = z
|
|
|
284
303
|
})
|
|
285
304
|
.optional()
|
|
286
305
|
.default(() => ({
|
|
287
|
-
gracePeriodMs: 30_000,
|
|
288
306
|
disableSignalHandlers: false,
|
|
289
307
|
})),
|
|
290
308
|
})
|
|
@@ -320,7 +338,9 @@ export const RegistryConfigSchema = z
|
|
|
320
338
|
})
|
|
321
339
|
: undefined;
|
|
322
340
|
|
|
323
|
-
//
|
|
341
|
+
// RIVET_ENDPOINT configures what RivetKit connects to. Use
|
|
342
|
+
// engineHost/enginePort (or RIVET_RUN_ENGINE_HOST/PORT) to control the
|
|
343
|
+
// spawned local engine bind address.
|
|
324
344
|
if (config.startEngine && parsedEndpoint) {
|
|
325
345
|
ctx.addIssue({
|
|
326
346
|
code: "custom",
|
|
@@ -337,12 +357,17 @@ export const RegistryConfigSchema = z
|
|
|
337
357
|
});
|
|
338
358
|
}
|
|
339
359
|
|
|
340
|
-
// Flatten the endpoint and apply defaults for namespace/token
|
|
341
|
-
|
|
360
|
+
// Flatten the endpoint and apply defaults for namespace/token.
|
|
361
|
+
const localEngineEndpoint = buildEngineEndpoint(
|
|
362
|
+
config.engineHost,
|
|
363
|
+
config.enginePort,
|
|
364
|
+
);
|
|
342
365
|
const endpoint = config.startEngine
|
|
343
|
-
?
|
|
366
|
+
? localEngineEndpoint
|
|
344
367
|
: (parsedEndpoint?.endpoint ??
|
|
345
|
-
(isDevEnv
|
|
368
|
+
(isDevEnv
|
|
369
|
+
? buildEngineEndpoint(ENGINE_HOST, ENGINE_PORT)
|
|
370
|
+
: undefined));
|
|
346
371
|
const validateServerlessEndpoint = Boolean(
|
|
347
372
|
config.startEngine || parsedEndpoint,
|
|
348
373
|
);
|
|
@@ -375,7 +400,7 @@ export const RegistryConfigSchema = z
|
|
|
375
400
|
// In dev mode, clients connect directly to the local Rivet Engine.
|
|
376
401
|
const publicEndpoint =
|
|
377
402
|
parsedPublicEndpoint?.endpoint ??
|
|
378
|
-
(isDevEnv && config.startEngine ?
|
|
403
|
+
(isDevEnv && config.startEngine ? endpoint : undefined);
|
|
379
404
|
// We extract publicNamespace to validate that it matches the backend
|
|
380
405
|
// namespace (see validation above), not for functional use.
|
|
381
406
|
const publicNamespace = parsedPublicEndpoint?.namespace;
|
|
@@ -423,6 +448,7 @@ export function buildActorNames(
|
|
|
423
448
|
Array.from(KEYS.PERSIST_DATA),
|
|
424
449
|
Array.from(KEYS.INSPECTOR_TOKEN),
|
|
425
450
|
Array.from(queueMetadataKey()),
|
|
451
|
+
Array.from(KEYS.LAST_PUSHED_ALARM),
|
|
426
452
|
],
|
|
427
453
|
prefixes: [
|
|
428
454
|
{
|