rivetkit 2.3.0-rc.8 → 2.3.0
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 +481 -74
- package/dist/browser/client.js +174 -148
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +47 -18
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/agent-os/index.cjs +2160 -2086
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +479 -73
- package/dist/tsup/agent-os/index.d.ts +479 -73
- package/dist/tsup/agent-os/index.js +2160 -2086
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-KY3CERZR.js → chunk-2OTRTA3J.js} +7 -21
- package/dist/tsup/chunk-2OTRTA3J.js.map +1 -0
- package/dist/tsup/{chunk-HGW6PBWR.cjs → chunk-3677IIOV.cjs} +11 -25
- package/dist/tsup/chunk-3677IIOV.cjs.map +1 -0
- package/dist/tsup/{chunk-OT7FF6GB.cjs → chunk-47HHIEXH.cjs} +24 -9
- package/dist/tsup/chunk-47HHIEXH.cjs.map +1 -0
- package/dist/tsup/{chunk-EMFKMVJR.js → chunk-4JDSFJS5.js} +69 -58
- package/dist/tsup/chunk-4JDSFJS5.js.map +1 -0
- package/dist/tsup/{chunk-7HLFSAJP.cjs → chunk-7QKCIVAY.cjs} +225 -214
- package/dist/tsup/chunk-7QKCIVAY.cjs.map +1 -0
- package/dist/tsup/{chunk-AWTPTUQ7.cjs → chunk-B6VUNZUD.cjs} +10 -10
- package/dist/tsup/{chunk-AWTPTUQ7.cjs.map → chunk-B6VUNZUD.cjs.map} +1 -1
- package/dist/tsup/{chunk-D3T3ZBSY.js → chunk-BEI24WTI.js} +2 -2
- package/dist/tsup/{chunk-TMLOKTRB.js → chunk-BRP62GZC.js} +1 -1
- package/dist/tsup/chunk-BRP62GZC.js.map +1 -0
- package/dist/tsup/{chunk-D5G75T7J.js → chunk-DPIMKYNB.js} +61 -2
- package/dist/tsup/chunk-DPIMKYNB.js.map +1 -0
- package/dist/tsup/{chunk-BATTOVHF.cjs → chunk-DXXJPH55.cjs} +40 -13
- package/dist/tsup/chunk-DXXJPH55.cjs.map +1 -0
- package/dist/tsup/{chunk-3YY5S6TV.js → chunk-HXUEHHJF.js} +2 -2
- package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
- package/dist/tsup/{chunk-4BPKKZJO.cjs → chunk-I4LN3FNT.cjs} +10 -10
- package/dist/tsup/chunk-I4LN3FNT.cjs.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
- package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
- package/dist/tsup/{chunk-63WNTDRC.cjs → chunk-KORQB2IR.cjs} +1 -1
- package/dist/tsup/{chunk-63WNTDRC.cjs.map → chunk-KORQB2IR.cjs.map} +1 -1
- package/dist/tsup/{chunk-6TQSSJ4F.cjs → chunk-LVTBW2RE.cjs} +3 -3
- package/dist/tsup/{chunk-6TQSSJ4F.cjs.map → chunk-LVTBW2RE.cjs.map} +1 -1
- package/dist/tsup/{chunk-4JU3IPG2.js → chunk-MEHBWPLJ.js} +6 -6
- package/dist/tsup/chunk-MEHBWPLJ.js.map +1 -0
- package/dist/tsup/{chunk-SRNOPUC6.cjs → chunk-NIY3RSPX.cjs} +62 -3
- package/dist/tsup/chunk-NIY3RSPX.cjs.map +1 -0
- package/dist/tsup/{chunk-UZXQEGVJ.js → chunk-P2GNQ4RN.js} +4 -4
- package/dist/tsup/{chunk-UZXQEGVJ.js.map → chunk-P2GNQ4RN.js.map} +1 -1
- package/dist/tsup/{chunk-VUGENVIK.js → chunk-UMZVD6DQ.js} +22 -7
- package/dist/tsup/chunk-UMZVD6DQ.js.map +1 -0
- package/dist/tsup/{chunk-LD5YASJU.cjs → chunk-VE2X4KMG.cjs} +2 -2
- package/dist/tsup/{chunk-LD5YASJU.cjs.map → chunk-VE2X4KMG.cjs.map} +1 -1
- package/dist/tsup/{chunk-GBG63SUG.js → chunk-VTTFNQQI.js} +32 -5
- package/dist/tsup/chunk-VTTFNQQI.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/client/mod.cjs +9 -9
- package/dist/tsup/client/mod.d.cts +5 -5
- package/dist/tsup/client/mod.d.ts +5 -5
- package/dist/tsup/client/mod.js +8 -8
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Ak1lv4gF.d.ts → config-BxWAw3iH.d.ts} +512 -27
- package/dist/tsup/{config-DU_xj4qZ.d.cts → config-CZQQ-mso.d.cts} +512 -27
- package/dist/tsup/{config-CxjGYf4K.d.ts → config-D49x8NpL.d.cts} +1 -2
- package/dist/tsup/{config-CxjGYf4K.d.cts → config-D49x8NpL.d.ts} +1 -2
- package/dist/tsup/{context-DAAp4Lpg.d.ts → context-Bw7xq8w3.d.cts} +8 -8
- package/dist/tsup/{context-Dt_L55q8.d.cts → context-D8QA76sV.d.ts} +8 -8
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.d.cts +1 -1
- package/dist/tsup/db/drizzle.d.ts +1 -1
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +2 -2
- package/dist/tsup/db/mod.d.cts +2 -2
- package/dist/tsup/db/mod.d.ts +2 -2
- package/dist/tsup/db/mod.js +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +37 -0
- package/dist/tsup/dynamic/mod.d.ts +37 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/inspector-tab/mod.cjs +173 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +250 -0
- package/dist/tsup/inspector-tab/mod.d.ts +250 -0
- package/dist/tsup/inspector-tab/mod.js +173 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +615 -348
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +5 -5
- package/dist/tsup/mod.d.ts +5 -5
- package/dist/tsup/mod.js +511 -244
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +21 -18
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +4 -4
- package/dist/tsup/test/mod.d.ts +4 -4
- package/dist/tsup/test/mod.js +18 -15
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/{utils-DVekpm4I.d.cts → utils-DQosb24I.d.cts} +1 -1
- package/dist/tsup/{utils-DVekpm4I.d.ts → utils-DQosb24I.d.ts} +1 -1
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.d.cts +1 -1
- package/dist/tsup/utils.d.ts +1 -1
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +279 -279
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +6 -6
- package/dist/tsup/workflow/mod.d.ts +6 -6
- package/dist/tsup/workflow/mod.js +380 -380
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +29 -9
- package/src/actor/config.ts +156 -51
- package/src/actor/contexts/index.ts +7 -2
- package/src/actor/definition.ts +17 -19
- package/src/actor/driver.ts +3 -3
- package/src/actor/errors.ts +8 -2
- package/src/actor/instance/mod.ts +26 -34
- package/src/actor/keys.ts +1 -1
- package/src/actor/mod.ts +22 -20
- package/src/actor/schema.ts +2 -2
- package/src/agent-os/actor/index.ts +38 -18
- package/src/agent-os/actor/preview.ts +1 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/client/actor-common.ts +87 -54
- package/src/client/actor-conn.ts +11 -11
- package/src/client/actor-handle.ts +69 -52
- package/src/client/actor-query.ts +5 -5
- package/src/client/errors.ts +1 -1
- package/src/client/lifecycle-errors.ts +2 -4
- package/src/client/query.ts +1 -1
- package/src/client/queue.ts +8 -4
- package/src/client/raw-utils.ts +8 -6
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +2 -6
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/transport/v1.ts +659 -543
- package/src/common/client-protocol-versioned.ts +66 -64
- package/src/common/database/config.ts +2 -8
- package/src/common/database/native-database.ts +1 -1
- package/src/common/database/shared.ts +1 -0
- package/src/common/encoding.ts +13 -17
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/inline-websocket-adapter.ts +3 -2
- package/src/common/router.ts +13 -17
- package/src/common/utils.ts +1 -2
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/mod.ts +1 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/drivers/engine/actor-driver.ts +48 -46
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +66 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-client/actor-http-client.ts +3 -3
- package/src/engine-client/actor-websocket-client.ts +5 -5
- package/src/engine-client/api-endpoints.ts +51 -2
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +1 -1
- package/src/engine-client/mod.ts +5 -3
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +5 -11
- package/src/inspector/mod.ts +1 -3
- package/src/inspector-tab/mod.ts +315 -0
- package/src/registry/config/envoy.ts +1 -2
- package/src/registry/config/index.ts +40 -16
- package/src/registry/index.ts +226 -83
- package/src/registry/napi-runtime.ts +46 -12
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +307 -164
- package/src/registry/process-metrics.ts +90 -23
- package/src/registry/runtime.ts +53 -6
- package/src/registry/wasm-runtime.ts +30 -3
- package/src/serde.ts +1 -1
- package/src/serverless/configure.ts +18 -7
- package/src/test/mod.ts +11 -8
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +6 -0
- package/src/utils/router.ts +1 -1
- package/src/utils/serve.ts +4 -5
- package/src/utils.ts +1 -2
- package/src/workflow/context.ts +30 -29
- package/src/workflow/driver.ts +4 -6
- package/src/workflow/inspector.ts +2 -2
- package/src/workflow/mod.ts +15 -17
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3YY5S6TV.js.map +0 -1
- package/dist/tsup/chunk-4BPKKZJO.cjs.map +0 -1
- package/dist/tsup/chunk-4JU3IPG2.js.map +0 -1
- package/dist/tsup/chunk-7HLFSAJP.cjs.map +0 -1
- package/dist/tsup/chunk-BATTOVHF.cjs.map +0 -1
- package/dist/tsup/chunk-D5G75T7J.js.map +0 -1
- package/dist/tsup/chunk-EMFKMVJR.js.map +0 -1
- package/dist/tsup/chunk-GBG63SUG.js.map +0 -1
- package/dist/tsup/chunk-HGW6PBWR.cjs.map +0 -1
- package/dist/tsup/chunk-KY3CERZR.js.map +0 -1
- package/dist/tsup/chunk-OT7FF6GB.cjs.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-SRNOPUC6.cjs.map +0 -1
- package/dist/tsup/chunk-TMLOKTRB.js.map +0 -1
- package/dist/tsup/chunk-VUGENVIK.js.map +0 -1
- package/dist/tsup/process-metrics-NW754INA.js +0 -118
- package/dist/tsup/process-metrics-NW754INA.js.map +0 -1
- package/dist/tsup/process-metrics-TYAGKCEJ.cjs +0 -118
- package/dist/tsup/process-metrics-TYAGKCEJ.cjs.map +0 -1
- /package/dist/tsup/{chunk-D3T3ZBSY.js.map → chunk-BEI24WTI.js.map} +0 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a0 as CustomInspectorTabEntrySchema, ae as HideInspectorTabEntrySchema, af as InspectorTabEntrySchema } from '../config-CZQQ-mso.cjs';
|
|
3
|
+
export { s as ActorInspectorConfig, t as ActorInspectorConfigSchema, U as BUILTIN_INSPECTOR_TAB_IDS, X as BuiltinInspectorTabIdSchema } from '../config-CZQQ-mso.cjs';
|
|
4
|
+
import 'zod/v4';
|
|
5
|
+
import '../config-D49x8NpL.cjs';
|
|
6
|
+
import '@rivetkit/rivetkit-wasm';
|
|
7
|
+
import 'pino';
|
|
8
|
+
import '@rivetkit/virtual-websocket';
|
|
9
|
+
import '@standard-schema/spec';
|
|
10
|
+
import 'hono';
|
|
11
|
+
import '../utils.cjs';
|
|
12
|
+
import '../utils-DQosb24I.cjs';
|
|
13
|
+
import 'hono/utils/http-status';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Type and schema declarations for custom Rivet inspector tabs.
|
|
17
|
+
*
|
|
18
|
+
* Everything here is **derived from runtime Zod schemas** that the
|
|
19
|
+
* dashboard and rivetkit itself use, so the published types cannot
|
|
20
|
+
* drift from the wire format. There are three sources of truth:
|
|
21
|
+
*
|
|
22
|
+
* 1. The `inspector.tabs[]` actor-config Zod schemas in
|
|
23
|
+
* `../actor/config.ts` — re-exported below. These validate the
|
|
24
|
+
* authoring surface (`defineActor({ inspector: { tabs: [...] } })`).
|
|
25
|
+
* 2. The dashboard ↔ tab postMessage envelopes defined in this file.
|
|
26
|
+
* The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`)
|
|
27
|
+
* imports the same schemas to validate messages at runtime, so any
|
|
28
|
+
* change here lands on both ends in lockstep.
|
|
29
|
+
* 3. The inspector HTTP endpoint response schemas defined in this
|
|
30
|
+
* file. The dashboard parses every response through them; if the
|
|
31
|
+
* Rust handler ever emits a different shape, the dashboard fails
|
|
32
|
+
* loudly at the parse step instead of silently casting `unknown`.
|
|
33
|
+
*
|
|
34
|
+
* Tab bundles import these types for autocomplete and compile-time
|
|
35
|
+
* safety:
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* import type {
|
|
39
|
+
* ShellToTabMessage,
|
|
40
|
+
* TabToShellMessage,
|
|
41
|
+
* V1Init,
|
|
42
|
+
* InspectorStateResponse,
|
|
43
|
+
* } from "rivetkit/inspector-tab";
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/** One entry in the actor's `inspector.tabs[]` declaration. */
|
|
48
|
+
type ActorInspectorTabEntry = z.input<typeof InspectorTabEntrySchema>;
|
|
49
|
+
/** A custom-tab entry — adds a new tab to the dashboard strip. */
|
|
50
|
+
type ActorCustomInspectorTabEntry = z.input<typeof CustomInspectorTabEntrySchema>;
|
|
51
|
+
/** A hide modifier — removes a built-in tab from the strip. */
|
|
52
|
+
type ActorHideInspectorTabEntry = z.input<typeof HideInspectorTabEntrySchema>;
|
|
53
|
+
/** Union of the six built-in inspector tab ids. */
|
|
54
|
+
type BuiltinInspectorTabId = "workflow" | "database" | "state" | "queue" | "connections" | "console";
|
|
55
|
+
/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */
|
|
56
|
+
declare const InspectorTabDescriptorSchema: z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
label: z.ZodString;
|
|
59
|
+
icon: z.ZodString;
|
|
60
|
+
isCustom: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
/**
|
|
63
|
+
* Initial handshake from the dashboard. Sent on first mount and again on
|
|
64
|
+
* every token refresh. Tabs MUST accept late `init` messages and replace
|
|
65
|
+
* the cached token.
|
|
66
|
+
*/
|
|
67
|
+
declare const V1InitSchema: z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"init">;
|
|
69
|
+
v: z.ZodLiteral<1>;
|
|
70
|
+
actorId: z.ZodString;
|
|
71
|
+
authToken: z.ZodString;
|
|
72
|
+
rivetToken: z.ZodOptional<z.ZodString>;
|
|
73
|
+
activeTab: z.ZodOptional<z.ZodString>;
|
|
74
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
light: "light";
|
|
76
|
+
dark: "dark";
|
|
77
|
+
}>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
/**
|
|
80
|
+
* Dashboard tells the inspector-ui SPA which built-in tab to render. Not
|
|
81
|
+
* sent to custom tabs — when the user activates a custom tab the
|
|
82
|
+
* dashboard navigates the outer iframe to a different `src`.
|
|
83
|
+
*/
|
|
84
|
+
declare const V1SetActiveTabSchema: z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"set-active-tab">;
|
|
86
|
+
v: z.ZodLiteral<1>;
|
|
87
|
+
tab: z.ZodString;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
/**
|
|
90
|
+
* Tab → dashboard. Sent once after the message listener is registered.
|
|
91
|
+
* The dashboard hides the "Connecting to inspector…" overlay on receipt;
|
|
92
|
+
* if it never arrives the overlay times out after 8 s.
|
|
93
|
+
*/
|
|
94
|
+
declare const V1ReadySchema: z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"ready">;
|
|
96
|
+
v: z.ZodLiteral<1>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
/**
|
|
99
|
+
* Tab → dashboard. Sent when the tab gets a 401 on an inspector data
|
|
100
|
+
* call. The dashboard refreshes the token and re-issues `v1Init`.
|
|
101
|
+
*/
|
|
102
|
+
declare const V1TokenRefreshNeededSchema: z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"token-refresh-needed">;
|
|
104
|
+
v: z.ZodLiteral<1>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
/**
|
|
107
|
+
* Emitted by the inspector-ui SPA to tell the dashboard which tabs to
|
|
108
|
+
* render in the strip. Custom tab bundles do NOT emit this — only the
|
|
109
|
+
* SPA does.
|
|
110
|
+
*/
|
|
111
|
+
declare const V1TabsAvailableSchema: z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"tabs-available">;
|
|
113
|
+
v: z.ZodLiteral<1>;
|
|
114
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
label: z.ZodString;
|
|
117
|
+
icon: z.ZodString;
|
|
118
|
+
isCustom: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
/** Discriminated union of messages a tab can RECEIVE from the dashboard. */
|
|
122
|
+
declare const ShellToTabMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"init">;
|
|
124
|
+
v: z.ZodLiteral<1>;
|
|
125
|
+
actorId: z.ZodString;
|
|
126
|
+
authToken: z.ZodString;
|
|
127
|
+
rivetToken: z.ZodOptional<z.ZodString>;
|
|
128
|
+
activeTab: z.ZodOptional<z.ZodString>;
|
|
129
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
130
|
+
light: "light";
|
|
131
|
+
dark: "dark";
|
|
132
|
+
}>>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
type: z.ZodLiteral<"set-active-tab">;
|
|
135
|
+
v: z.ZodLiteral<1>;
|
|
136
|
+
tab: z.ZodString;
|
|
137
|
+
}, z.core.$strip>], "type">;
|
|
138
|
+
/** Discriminated union of messages a tab can SEND to the dashboard. */
|
|
139
|
+
declare const TabToShellMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"ready">;
|
|
141
|
+
v: z.ZodLiteral<1>;
|
|
142
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
143
|
+
type: z.ZodLiteral<"tabs-available">;
|
|
144
|
+
v: z.ZodLiteral<1>;
|
|
145
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
label: z.ZodString;
|
|
148
|
+
icon: z.ZodString;
|
|
149
|
+
isCustom: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, z.core.$strip>>;
|
|
151
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
152
|
+
type: z.ZodLiteral<"token-refresh-needed">;
|
|
153
|
+
v: z.ZodLiteral<1>;
|
|
154
|
+
}, z.core.$strip>], "type">;
|
|
155
|
+
type InspectorTabDescriptor = z.infer<typeof InspectorTabDescriptorSchema>;
|
|
156
|
+
type V1Init = z.infer<typeof V1InitSchema>;
|
|
157
|
+
type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;
|
|
158
|
+
type V1Ready = z.infer<typeof V1ReadySchema>;
|
|
159
|
+
type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;
|
|
160
|
+
type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;
|
|
161
|
+
type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;
|
|
162
|
+
type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;
|
|
163
|
+
/** Stable envelope protocol version. Bump only when introducing a v2 shape. */
|
|
164
|
+
declare const POSTMESSAGE_PROTOCOL_VERSION = 1;
|
|
165
|
+
/** URL query parameters the dashboard sets on the tab iframe `src`. */
|
|
166
|
+
declare const SHELL_ORIGIN_PARAM = "shellOrigin";
|
|
167
|
+
declare const ACTOR_ID_PARAM = "actorId";
|
|
168
|
+
/** `GET /inspector/state` response shape. */
|
|
169
|
+
declare const InspectorStateResponseSchema: z.ZodObject<{
|
|
170
|
+
state: z.ZodUnknown;
|
|
171
|
+
isStateEnabled: z.ZodBoolean;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
/** `POST /inspector/action/<name>` request body. */
|
|
174
|
+
declare const InspectorActionRequestSchema: z.ZodObject<{
|
|
175
|
+
args: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
176
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
/** `POST /inspector/action/<name>` response shape. */
|
|
179
|
+
declare const InspectorActionResponseSchema: z.ZodObject<{
|
|
180
|
+
output: z.ZodUnknown;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
/** `GET /inspector/rpcs` response shape — the list of action names. */
|
|
183
|
+
declare const InspectorRpcsResponseSchema: z.ZodObject<{
|
|
184
|
+
rpcs: z.ZodArray<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
/** One connection record in `GET /inspector/connections`. */
|
|
187
|
+
declare const InspectorConnectionSchema: z.ZodObject<{
|
|
188
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
189
|
+
id: z.ZodString;
|
|
190
|
+
details: z.ZodObject<{
|
|
191
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
192
|
+
params: z.ZodUnknown;
|
|
193
|
+
stateEnabled: z.ZodBoolean;
|
|
194
|
+
state: z.ZodUnknown;
|
|
195
|
+
subscriptions: z.ZodNumber;
|
|
196
|
+
isHibernatable: z.ZodBoolean;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
/** `GET /inspector/connections` response shape. */
|
|
200
|
+
declare const InspectorConnectionsResponseSchema: z.ZodObject<{
|
|
201
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
202
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
203
|
+
id: z.ZodString;
|
|
204
|
+
details: z.ZodObject<{
|
|
205
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
206
|
+
params: z.ZodUnknown;
|
|
207
|
+
stateEnabled: z.ZodBoolean;
|
|
208
|
+
state: z.ZodUnknown;
|
|
209
|
+
subscriptions: z.ZodNumber;
|
|
210
|
+
isHibernatable: z.ZodBoolean;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
/** One queued message in `GET /inspector/queue`. */
|
|
215
|
+
declare const InspectorQueueMessageSchema: z.ZodObject<{
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
createdAtMs: z.ZodNumber;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
/** `GET /inspector/queue` response shape. */
|
|
221
|
+
declare const InspectorQueueResponseSchema: z.ZodObject<{
|
|
222
|
+
size: z.ZodNumber;
|
|
223
|
+
maxSize: z.ZodNumber;
|
|
224
|
+
truncated: z.ZodBoolean;
|
|
225
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
name: z.ZodString;
|
|
228
|
+
createdAtMs: z.ZodNumber;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
}, z.core.$strip>;
|
|
231
|
+
/** `GET /inspector/tab-config` response shape. */
|
|
232
|
+
declare const InspectorTabConfigResponseSchema: z.ZodObject<{
|
|
233
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
label: z.ZodOptional<z.ZodString>;
|
|
236
|
+
icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
237
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
238
|
+
}, z.core.$strip>>;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
type InspectorStateResponse = z.infer<typeof InspectorStateResponseSchema>;
|
|
241
|
+
type InspectorActionRequest = z.infer<typeof InspectorActionRequestSchema>;
|
|
242
|
+
type InspectorActionResponse = z.infer<typeof InspectorActionResponseSchema>;
|
|
243
|
+
type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;
|
|
244
|
+
type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;
|
|
245
|
+
type InspectorConnectionsResponse = z.infer<typeof InspectorConnectionsResponseSchema>;
|
|
246
|
+
type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;
|
|
247
|
+
type InspectorQueueResponse = z.infer<typeof InspectorQueueResponseSchema>;
|
|
248
|
+
type InspectorTabConfigResponse = z.infer<typeof InspectorTabConfigResponseSchema>;
|
|
249
|
+
|
|
250
|
+
export { ACTOR_ID_PARAM, type ActorCustomInspectorTabEntry, type ActorHideInspectorTabEntry, type ActorInspectorTabEntry, type BuiltinInspectorTabId, CustomInspectorTabEntrySchema, HideInspectorTabEntrySchema, type InspectorActionRequest, InspectorActionRequestSchema, type InspectorActionResponse, InspectorActionResponseSchema, type InspectorConnection, InspectorConnectionSchema, type InspectorConnectionsResponse, InspectorConnectionsResponseSchema, type InspectorQueueMessage, InspectorQueueMessageSchema, type InspectorQueueResponse, InspectorQueueResponseSchema, type InspectorRpcsResponse, InspectorRpcsResponseSchema, type InspectorStateResponse, InspectorStateResponseSchema, type InspectorTabConfigResponse, InspectorTabConfigResponseSchema, type InspectorTabDescriptor, InspectorTabDescriptorSchema, InspectorTabEntrySchema, POSTMESSAGE_PROTOCOL_VERSION, SHELL_ORIGIN_PARAM, type ShellToTabMessage, ShellToTabMessageSchema, type TabToShellMessage, TabToShellMessageSchema, type V1Init, V1InitSchema, type V1Ready, V1ReadySchema, type V1SetActiveTab, V1SetActiveTabSchema, type V1TabsAvailable, V1TabsAvailableSchema, type V1TokenRefreshNeeded, V1TokenRefreshNeededSchema };
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a0 as CustomInspectorTabEntrySchema, ae as HideInspectorTabEntrySchema, af as InspectorTabEntrySchema } from '../config-BxWAw3iH.js';
|
|
3
|
+
export { s as ActorInspectorConfig, t as ActorInspectorConfigSchema, U as BUILTIN_INSPECTOR_TAB_IDS, X as BuiltinInspectorTabIdSchema } from '../config-BxWAw3iH.js';
|
|
4
|
+
import 'zod/v4';
|
|
5
|
+
import '../config-D49x8NpL.js';
|
|
6
|
+
import '@rivetkit/rivetkit-wasm';
|
|
7
|
+
import 'pino';
|
|
8
|
+
import '@rivetkit/virtual-websocket';
|
|
9
|
+
import '@standard-schema/spec';
|
|
10
|
+
import 'hono';
|
|
11
|
+
import '../utils.js';
|
|
12
|
+
import '../utils-DQosb24I.js';
|
|
13
|
+
import 'hono/utils/http-status';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Type and schema declarations for custom Rivet inspector tabs.
|
|
17
|
+
*
|
|
18
|
+
* Everything here is **derived from runtime Zod schemas** that the
|
|
19
|
+
* dashboard and rivetkit itself use, so the published types cannot
|
|
20
|
+
* drift from the wire format. There are three sources of truth:
|
|
21
|
+
*
|
|
22
|
+
* 1. The `inspector.tabs[]` actor-config Zod schemas in
|
|
23
|
+
* `../actor/config.ts` — re-exported below. These validate the
|
|
24
|
+
* authoring surface (`defineActor({ inspector: { tabs: [...] } })`).
|
|
25
|
+
* 2. The dashboard ↔ tab postMessage envelopes defined in this file.
|
|
26
|
+
* The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`)
|
|
27
|
+
* imports the same schemas to validate messages at runtime, so any
|
|
28
|
+
* change here lands on both ends in lockstep.
|
|
29
|
+
* 3. The inspector HTTP endpoint response schemas defined in this
|
|
30
|
+
* file. The dashboard parses every response through them; if the
|
|
31
|
+
* Rust handler ever emits a different shape, the dashboard fails
|
|
32
|
+
* loudly at the parse step instead of silently casting `unknown`.
|
|
33
|
+
*
|
|
34
|
+
* Tab bundles import these types for autocomplete and compile-time
|
|
35
|
+
* safety:
|
|
36
|
+
*
|
|
37
|
+
* ```ts
|
|
38
|
+
* import type {
|
|
39
|
+
* ShellToTabMessage,
|
|
40
|
+
* TabToShellMessage,
|
|
41
|
+
* V1Init,
|
|
42
|
+
* InspectorStateResponse,
|
|
43
|
+
* } from "rivetkit/inspector-tab";
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/** One entry in the actor's `inspector.tabs[]` declaration. */
|
|
48
|
+
type ActorInspectorTabEntry = z.input<typeof InspectorTabEntrySchema>;
|
|
49
|
+
/** A custom-tab entry — adds a new tab to the dashboard strip. */
|
|
50
|
+
type ActorCustomInspectorTabEntry = z.input<typeof CustomInspectorTabEntrySchema>;
|
|
51
|
+
/** A hide modifier — removes a built-in tab from the strip. */
|
|
52
|
+
type ActorHideInspectorTabEntry = z.input<typeof HideInspectorTabEntrySchema>;
|
|
53
|
+
/** Union of the six built-in inspector tab ids. */
|
|
54
|
+
type BuiltinInspectorTabId = "workflow" | "database" | "state" | "queue" | "connections" | "console";
|
|
55
|
+
/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */
|
|
56
|
+
declare const InspectorTabDescriptorSchema: z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
label: z.ZodString;
|
|
59
|
+
icon: z.ZodString;
|
|
60
|
+
isCustom: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
/**
|
|
63
|
+
* Initial handshake from the dashboard. Sent on first mount and again on
|
|
64
|
+
* every token refresh. Tabs MUST accept late `init` messages and replace
|
|
65
|
+
* the cached token.
|
|
66
|
+
*/
|
|
67
|
+
declare const V1InitSchema: z.ZodObject<{
|
|
68
|
+
type: z.ZodLiteral<"init">;
|
|
69
|
+
v: z.ZodLiteral<1>;
|
|
70
|
+
actorId: z.ZodString;
|
|
71
|
+
authToken: z.ZodString;
|
|
72
|
+
rivetToken: z.ZodOptional<z.ZodString>;
|
|
73
|
+
activeTab: z.ZodOptional<z.ZodString>;
|
|
74
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
light: "light";
|
|
76
|
+
dark: "dark";
|
|
77
|
+
}>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
/**
|
|
80
|
+
* Dashboard tells the inspector-ui SPA which built-in tab to render. Not
|
|
81
|
+
* sent to custom tabs — when the user activates a custom tab the
|
|
82
|
+
* dashboard navigates the outer iframe to a different `src`.
|
|
83
|
+
*/
|
|
84
|
+
declare const V1SetActiveTabSchema: z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"set-active-tab">;
|
|
86
|
+
v: z.ZodLiteral<1>;
|
|
87
|
+
tab: z.ZodString;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
/**
|
|
90
|
+
* Tab → dashboard. Sent once after the message listener is registered.
|
|
91
|
+
* The dashboard hides the "Connecting to inspector…" overlay on receipt;
|
|
92
|
+
* if it never arrives the overlay times out after 8 s.
|
|
93
|
+
*/
|
|
94
|
+
declare const V1ReadySchema: z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"ready">;
|
|
96
|
+
v: z.ZodLiteral<1>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
/**
|
|
99
|
+
* Tab → dashboard. Sent when the tab gets a 401 on an inspector data
|
|
100
|
+
* call. The dashboard refreshes the token and re-issues `v1Init`.
|
|
101
|
+
*/
|
|
102
|
+
declare const V1TokenRefreshNeededSchema: z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"token-refresh-needed">;
|
|
104
|
+
v: z.ZodLiteral<1>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
/**
|
|
107
|
+
* Emitted by the inspector-ui SPA to tell the dashboard which tabs to
|
|
108
|
+
* render in the strip. Custom tab bundles do NOT emit this — only the
|
|
109
|
+
* SPA does.
|
|
110
|
+
*/
|
|
111
|
+
declare const V1TabsAvailableSchema: z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"tabs-available">;
|
|
113
|
+
v: z.ZodLiteral<1>;
|
|
114
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
label: z.ZodString;
|
|
117
|
+
icon: z.ZodString;
|
|
118
|
+
isCustom: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
/** Discriminated union of messages a tab can RECEIVE from the dashboard. */
|
|
122
|
+
declare const ShellToTabMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"init">;
|
|
124
|
+
v: z.ZodLiteral<1>;
|
|
125
|
+
actorId: z.ZodString;
|
|
126
|
+
authToken: z.ZodString;
|
|
127
|
+
rivetToken: z.ZodOptional<z.ZodString>;
|
|
128
|
+
activeTab: z.ZodOptional<z.ZodString>;
|
|
129
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
130
|
+
light: "light";
|
|
131
|
+
dark: "dark";
|
|
132
|
+
}>>;
|
|
133
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
134
|
+
type: z.ZodLiteral<"set-active-tab">;
|
|
135
|
+
v: z.ZodLiteral<1>;
|
|
136
|
+
tab: z.ZodString;
|
|
137
|
+
}, z.core.$strip>], "type">;
|
|
138
|
+
/** Discriminated union of messages a tab can SEND to the dashboard. */
|
|
139
|
+
declare const TabToShellMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"ready">;
|
|
141
|
+
v: z.ZodLiteral<1>;
|
|
142
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
143
|
+
type: z.ZodLiteral<"tabs-available">;
|
|
144
|
+
v: z.ZodLiteral<1>;
|
|
145
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
146
|
+
id: z.ZodString;
|
|
147
|
+
label: z.ZodString;
|
|
148
|
+
icon: z.ZodString;
|
|
149
|
+
isCustom: z.ZodOptional<z.ZodBoolean>;
|
|
150
|
+
}, z.core.$strip>>;
|
|
151
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
152
|
+
type: z.ZodLiteral<"token-refresh-needed">;
|
|
153
|
+
v: z.ZodLiteral<1>;
|
|
154
|
+
}, z.core.$strip>], "type">;
|
|
155
|
+
type InspectorTabDescriptor = z.infer<typeof InspectorTabDescriptorSchema>;
|
|
156
|
+
type V1Init = z.infer<typeof V1InitSchema>;
|
|
157
|
+
type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;
|
|
158
|
+
type V1Ready = z.infer<typeof V1ReadySchema>;
|
|
159
|
+
type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;
|
|
160
|
+
type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;
|
|
161
|
+
type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;
|
|
162
|
+
type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;
|
|
163
|
+
/** Stable envelope protocol version. Bump only when introducing a v2 shape. */
|
|
164
|
+
declare const POSTMESSAGE_PROTOCOL_VERSION = 1;
|
|
165
|
+
/** URL query parameters the dashboard sets on the tab iframe `src`. */
|
|
166
|
+
declare const SHELL_ORIGIN_PARAM = "shellOrigin";
|
|
167
|
+
declare const ACTOR_ID_PARAM = "actorId";
|
|
168
|
+
/** `GET /inspector/state` response shape. */
|
|
169
|
+
declare const InspectorStateResponseSchema: z.ZodObject<{
|
|
170
|
+
state: z.ZodUnknown;
|
|
171
|
+
isStateEnabled: z.ZodBoolean;
|
|
172
|
+
}, z.core.$strip>;
|
|
173
|
+
/** `POST /inspector/action/<name>` request body. */
|
|
174
|
+
declare const InspectorActionRequestSchema: z.ZodObject<{
|
|
175
|
+
args: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
176
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
177
|
+
}, z.core.$strip>;
|
|
178
|
+
/** `POST /inspector/action/<name>` response shape. */
|
|
179
|
+
declare const InspectorActionResponseSchema: z.ZodObject<{
|
|
180
|
+
output: z.ZodUnknown;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
/** `GET /inspector/rpcs` response shape — the list of action names. */
|
|
183
|
+
declare const InspectorRpcsResponseSchema: z.ZodObject<{
|
|
184
|
+
rpcs: z.ZodArray<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
|
+
/** One connection record in `GET /inspector/connections`. */
|
|
187
|
+
declare const InspectorConnectionSchema: z.ZodObject<{
|
|
188
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
189
|
+
id: z.ZodString;
|
|
190
|
+
details: z.ZodObject<{
|
|
191
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
192
|
+
params: z.ZodUnknown;
|
|
193
|
+
stateEnabled: z.ZodBoolean;
|
|
194
|
+
state: z.ZodUnknown;
|
|
195
|
+
subscriptions: z.ZodNumber;
|
|
196
|
+
isHibernatable: z.ZodBoolean;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
/** `GET /inspector/connections` response shape. */
|
|
200
|
+
declare const InspectorConnectionsResponseSchema: z.ZodObject<{
|
|
201
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
202
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
203
|
+
id: z.ZodString;
|
|
204
|
+
details: z.ZodObject<{
|
|
205
|
+
connectionType: z.ZodNullable<z.ZodString>;
|
|
206
|
+
params: z.ZodUnknown;
|
|
207
|
+
stateEnabled: z.ZodBoolean;
|
|
208
|
+
state: z.ZodUnknown;
|
|
209
|
+
subscriptions: z.ZodNumber;
|
|
210
|
+
isHibernatable: z.ZodBoolean;
|
|
211
|
+
}, z.core.$strip>;
|
|
212
|
+
}, z.core.$strip>>;
|
|
213
|
+
}, z.core.$strip>;
|
|
214
|
+
/** One queued message in `GET /inspector/queue`. */
|
|
215
|
+
declare const InspectorQueueMessageSchema: z.ZodObject<{
|
|
216
|
+
id: z.ZodString;
|
|
217
|
+
name: z.ZodString;
|
|
218
|
+
createdAtMs: z.ZodNumber;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
/** `GET /inspector/queue` response shape. */
|
|
221
|
+
declare const InspectorQueueResponseSchema: z.ZodObject<{
|
|
222
|
+
size: z.ZodNumber;
|
|
223
|
+
maxSize: z.ZodNumber;
|
|
224
|
+
truncated: z.ZodBoolean;
|
|
225
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
226
|
+
id: z.ZodString;
|
|
227
|
+
name: z.ZodString;
|
|
228
|
+
createdAtMs: z.ZodNumber;
|
|
229
|
+
}, z.core.$strip>>;
|
|
230
|
+
}, z.core.$strip>;
|
|
231
|
+
/** `GET /inspector/tab-config` response shape. */
|
|
232
|
+
declare const InspectorTabConfigResponseSchema: z.ZodObject<{
|
|
233
|
+
tabs: z.ZodArray<z.ZodObject<{
|
|
234
|
+
id: z.ZodString;
|
|
235
|
+
label: z.ZodOptional<z.ZodString>;
|
|
236
|
+
icon: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
237
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
238
|
+
}, z.core.$strip>>;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
type InspectorStateResponse = z.infer<typeof InspectorStateResponseSchema>;
|
|
241
|
+
type InspectorActionRequest = z.infer<typeof InspectorActionRequestSchema>;
|
|
242
|
+
type InspectorActionResponse = z.infer<typeof InspectorActionResponseSchema>;
|
|
243
|
+
type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;
|
|
244
|
+
type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;
|
|
245
|
+
type InspectorConnectionsResponse = z.infer<typeof InspectorConnectionsResponseSchema>;
|
|
246
|
+
type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;
|
|
247
|
+
type InspectorQueueResponse = z.infer<typeof InspectorQueueResponseSchema>;
|
|
248
|
+
type InspectorTabConfigResponse = z.infer<typeof InspectorTabConfigResponseSchema>;
|
|
249
|
+
|
|
250
|
+
export { ACTOR_ID_PARAM, type ActorCustomInspectorTabEntry, type ActorHideInspectorTabEntry, type ActorInspectorTabEntry, type BuiltinInspectorTabId, CustomInspectorTabEntrySchema, HideInspectorTabEntrySchema, type InspectorActionRequest, InspectorActionRequestSchema, type InspectorActionResponse, InspectorActionResponseSchema, type InspectorConnection, InspectorConnectionSchema, type InspectorConnectionsResponse, InspectorConnectionsResponseSchema, type InspectorQueueMessage, InspectorQueueMessageSchema, type InspectorQueueResponse, InspectorQueueResponseSchema, type InspectorRpcsResponse, InspectorRpcsResponseSchema, type InspectorStateResponse, InspectorStateResponseSchema, type InspectorTabConfigResponse, InspectorTabConfigResponseSchema, type InspectorTabDescriptor, InspectorTabDescriptorSchema, InspectorTabEntrySchema, POSTMESSAGE_PROTOCOL_VERSION, SHELL_ORIGIN_PARAM, type ShellToTabMessage, ShellToTabMessageSchema, type TabToShellMessage, TabToShellMessageSchema, type V1Init, V1InitSchema, type V1Ready, V1ReadySchema, type V1SetActiveTab, V1SetActiveTabSchema, type V1TabsAvailable, V1TabsAvailableSchema, type V1TokenRefreshNeeded, V1TokenRefreshNeededSchema };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActorInspectorConfigSchema,
|
|
3
|
+
BUILTIN_INSPECTOR_TAB_IDS,
|
|
4
|
+
BuiltinInspectorTabIdSchema,
|
|
5
|
+
CustomInspectorTabEntrySchema,
|
|
6
|
+
HideInspectorTabEntrySchema,
|
|
7
|
+
InspectorTabEntrySchema
|
|
8
|
+
} from "../chunk-DPIMKYNB.js";
|
|
9
|
+
|
|
10
|
+
// src/inspector-tab/mod.ts
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
var InspectorTabDescriptorSchema = z.object({
|
|
13
|
+
id: z.string(),
|
|
14
|
+
label: z.string(),
|
|
15
|
+
icon: z.string(),
|
|
16
|
+
/**
|
|
17
|
+
* `true` for author-shipped custom tabs; absent or `false` for
|
|
18
|
+
* built-in tabs the SPA renders. Lets the dashboard route the
|
|
19
|
+
* iframe `src` to `/inspector/custom-tabs/<id>/` for custom tabs and
|
|
20
|
+
* `/inspector/ui/` for built-ins without the dashboard needing to
|
|
21
|
+
* know which ids are built-in.
|
|
22
|
+
*/
|
|
23
|
+
isCustom: z.boolean().optional()
|
|
24
|
+
});
|
|
25
|
+
var V1InitSchema = z.object({
|
|
26
|
+
type: z.literal("init"),
|
|
27
|
+
v: z.literal(1),
|
|
28
|
+
/** The actor this tab is mounted for. */
|
|
29
|
+
actorId: z.string(),
|
|
30
|
+
/**
|
|
31
|
+
* Per-actor inspector bearer token. Tabs include it as
|
|
32
|
+
* `Authorization: Bearer ${authToken}` on every authenticated fetch.
|
|
33
|
+
*/
|
|
34
|
+
authToken: z.string(),
|
|
35
|
+
/**
|
|
36
|
+
* Outer Rivet API token. Optional; not required for inspector HTTP
|
|
37
|
+
* routes but available to tabs that want to call the engine REST API.
|
|
38
|
+
*/
|
|
39
|
+
rivetToken: z.string().optional(),
|
|
40
|
+
/**
|
|
41
|
+
* The tab id the dashboard wants active at mount time. Multi-view
|
|
42
|
+
* tabs may read this to seed their initial route; most tabs ignore it.
|
|
43
|
+
*/
|
|
44
|
+
activeTab: z.string().optional(),
|
|
45
|
+
/**
|
|
46
|
+
* Dashboard's currently active theme. Tabs that use the shared
|
|
47
|
+
* stylesheet (`/inspector/tab.css`) mirror it by toggling the `dark`
|
|
48
|
+
* class on `<html>`. Optional for backwards compatibility — tabs
|
|
49
|
+
* should default to `"dark"` if absent (the dashboard pinned dark
|
|
50
|
+
* mode before this field was added).
|
|
51
|
+
*/
|
|
52
|
+
theme: z.enum(["light", "dark"]).optional()
|
|
53
|
+
});
|
|
54
|
+
var V1SetActiveTabSchema = z.object({
|
|
55
|
+
type: z.literal("set-active-tab"),
|
|
56
|
+
v: z.literal(1),
|
|
57
|
+
tab: z.string()
|
|
58
|
+
});
|
|
59
|
+
var V1ReadySchema = z.object({
|
|
60
|
+
type: z.literal("ready"),
|
|
61
|
+
v: z.literal(1)
|
|
62
|
+
});
|
|
63
|
+
var V1TokenRefreshNeededSchema = z.object({
|
|
64
|
+
type: z.literal("token-refresh-needed"),
|
|
65
|
+
v: z.literal(1)
|
|
66
|
+
});
|
|
67
|
+
var V1TabsAvailableSchema = z.object({
|
|
68
|
+
type: z.literal("tabs-available"),
|
|
69
|
+
v: z.literal(1),
|
|
70
|
+
tabs: z.array(InspectorTabDescriptorSchema)
|
|
71
|
+
});
|
|
72
|
+
var ShellToTabMessageSchema = z.discriminatedUnion("type", [
|
|
73
|
+
V1InitSchema,
|
|
74
|
+
V1SetActiveTabSchema
|
|
75
|
+
]);
|
|
76
|
+
var TabToShellMessageSchema = z.discriminatedUnion("type", [
|
|
77
|
+
V1ReadySchema,
|
|
78
|
+
V1TabsAvailableSchema,
|
|
79
|
+
V1TokenRefreshNeededSchema
|
|
80
|
+
]);
|
|
81
|
+
var POSTMESSAGE_PROTOCOL_VERSION = 1;
|
|
82
|
+
var SHELL_ORIGIN_PARAM = "shellOrigin";
|
|
83
|
+
var ACTOR_ID_PARAM = "actorId";
|
|
84
|
+
var InspectorStateResponseSchema = z.object({
|
|
85
|
+
/** Current actor state (whatever shape the actor declared). */
|
|
86
|
+
state: z.unknown(),
|
|
87
|
+
/**
|
|
88
|
+
* `false` when the actor did not declare any state — `state` is then
|
|
89
|
+
* `null` and `PATCH /inspector/state` returns an error.
|
|
90
|
+
*/
|
|
91
|
+
isStateEnabled: z.boolean()
|
|
92
|
+
});
|
|
93
|
+
var InspectorActionRequestSchema = z.object({
|
|
94
|
+
/** Positional arguments. Mutually exclusive with `properties`. */
|
|
95
|
+
args: z.array(z.unknown()).optional(),
|
|
96
|
+
/** Keyed arguments. Mutually exclusive with `args`. */
|
|
97
|
+
properties: z.record(z.string(), z.unknown()).optional()
|
|
98
|
+
}).refine(
|
|
99
|
+
(body) => !(body.args !== void 0 && body.properties !== void 0),
|
|
100
|
+
"Use either `args` or `properties`, not both"
|
|
101
|
+
);
|
|
102
|
+
var InspectorActionResponseSchema = z.object({
|
|
103
|
+
output: z.unknown()
|
|
104
|
+
});
|
|
105
|
+
var InspectorRpcsResponseSchema = z.object({
|
|
106
|
+
rpcs: z.array(z.string())
|
|
107
|
+
});
|
|
108
|
+
var InspectorConnectionSchema = z.object({
|
|
109
|
+
connectionType: z.string().nullable(),
|
|
110
|
+
id: z.string(),
|
|
111
|
+
details: z.object({
|
|
112
|
+
connectionType: z.string().nullable(),
|
|
113
|
+
params: z.unknown(),
|
|
114
|
+
stateEnabled: z.boolean(),
|
|
115
|
+
state: z.unknown(),
|
|
116
|
+
subscriptions: z.number(),
|
|
117
|
+
isHibernatable: z.boolean()
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
var InspectorConnectionsResponseSchema = z.object({
|
|
121
|
+
connections: z.array(InspectorConnectionSchema)
|
|
122
|
+
});
|
|
123
|
+
var InspectorQueueMessageSchema = z.object({
|
|
124
|
+
id: z.string(),
|
|
125
|
+
name: z.string(),
|
|
126
|
+
createdAtMs: z.number()
|
|
127
|
+
});
|
|
128
|
+
var InspectorQueueResponseSchema = z.object({
|
|
129
|
+
size: z.number(),
|
|
130
|
+
maxSize: z.number(),
|
|
131
|
+
/** `true` if `?limit=N` truncated the message list below `size`. */
|
|
132
|
+
truncated: z.boolean(),
|
|
133
|
+
messages: z.array(InspectorQueueMessageSchema)
|
|
134
|
+
});
|
|
135
|
+
var InspectorTabConfigResponseSchema = z.object({
|
|
136
|
+
tabs: z.array(
|
|
137
|
+
z.object({
|
|
138
|
+
id: z.string(),
|
|
139
|
+
label: z.string().optional(),
|
|
140
|
+
icon: z.string().nullable().optional(),
|
|
141
|
+
hidden: z.boolean().optional()
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
});
|
|
145
|
+
export {
|
|
146
|
+
ACTOR_ID_PARAM,
|
|
147
|
+
ActorInspectorConfigSchema,
|
|
148
|
+
BUILTIN_INSPECTOR_TAB_IDS,
|
|
149
|
+
BuiltinInspectorTabIdSchema,
|
|
150
|
+
CustomInspectorTabEntrySchema,
|
|
151
|
+
HideInspectorTabEntrySchema,
|
|
152
|
+
InspectorActionRequestSchema,
|
|
153
|
+
InspectorActionResponseSchema,
|
|
154
|
+
InspectorConnectionSchema,
|
|
155
|
+
InspectorConnectionsResponseSchema,
|
|
156
|
+
InspectorQueueMessageSchema,
|
|
157
|
+
InspectorQueueResponseSchema,
|
|
158
|
+
InspectorRpcsResponseSchema,
|
|
159
|
+
InspectorStateResponseSchema,
|
|
160
|
+
InspectorTabConfigResponseSchema,
|
|
161
|
+
InspectorTabDescriptorSchema,
|
|
162
|
+
InspectorTabEntrySchema,
|
|
163
|
+
POSTMESSAGE_PROTOCOL_VERSION,
|
|
164
|
+
SHELL_ORIGIN_PARAM,
|
|
165
|
+
ShellToTabMessageSchema,
|
|
166
|
+
TabToShellMessageSchema,
|
|
167
|
+
V1InitSchema,
|
|
168
|
+
V1ReadySchema,
|
|
169
|
+
V1SetActiveTabSchema,
|
|
170
|
+
V1TabsAvailableSchema,
|
|
171
|
+
V1TokenRefreshNeededSchema
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=mod.js.map
|