import { z } from 'zod'; import { ac as CustomInspectorTabEntrySchema, aq as HideInspectorTabEntrySchema, at as InspectorTabEntrySchema } from '../config-BDdeBoxX.cjs'; export { F as ActorInspectorConfig, G as ActorInspectorConfigSchema, a3 as BUILTIN_INSPECTOR_TAB_IDS, a5 as BuiltinInspectorTabIdSchema } from '../config-BDdeBoxX.cjs'; import 'zod/v4'; import '../config-CBTr4IhE.cjs'; import '@rivetkit/rivetkit-wasm'; import 'pino'; import '@rivetkit/virtual-websocket'; import '../inspector/workflow.cjs'; import '@standard-schema/spec'; import '@rivetkit/engine-api-full'; import '../utils-C6b0aYUM.cjs'; import 'hono'; import '../utils-3rsE0JvI.cjs'; import 'hono/utils/http-status'; /** * Type and schema declarations for custom Rivet inspector tabs. * * Everything here is **derived from runtime Zod schemas** that the * dashboard and rivetkit itself use, so the published types cannot * drift from the wire format. There are three sources of truth: * * 1. The `inspector.tabs[]` actor-config Zod schemas in * `../actor/config.ts` — re-exported below. These validate the * authoring surface (`defineActor({ inspector: { tabs: [...] } })`). * 2. The dashboard ↔ tab postMessage envelopes defined in this file. * The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`) * imports the same schemas to validate messages at runtime, so any * change here lands on both ends in lockstep. * 3. The inspector HTTP endpoint response schemas defined in this * file. The dashboard parses every response through them; if the * Rust handler ever emits a different shape, the dashboard fails * loudly at the parse step instead of silently casting `unknown`. * * Tab bundles import these types for autocomplete and compile-time * safety: * * ```ts * import type { * ShellToTabMessage, * TabToShellMessage, * V1Init, * InspectorStateResponse, * } from "rivetkit/inspector-tab"; * ``` */ /** One entry in the actor's `inspector.tabs[]` declaration. */ type ActorInspectorTabEntry = z.input; /** A custom-tab entry — adds a new tab to the dashboard strip. */ type ActorCustomInspectorTabEntry = z.input; /** A hide modifier — removes a built-in tab from the strip. */ type ActorHideInspectorTabEntry = z.input; /** Union of the six built-in inspector tab ids. */ type BuiltinInspectorTabId = "workflow" | "database" | "state" | "queue" | "schedules" | "connections" | "console"; /** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */ declare const InspectorTabDescriptorSchema: z.ZodObject<{ id: z.ZodString; label: z.ZodString; icon: z.ZodString; isCustom: z.ZodOptional; }, z.core.$strip>; /** * Initial handshake from the dashboard. Sent on first mount and again on * every token refresh. Tabs MUST accept late `init` messages and replace * the cached token. */ declare const V1InitSchema: z.ZodObject<{ type: z.ZodLiteral<"init">; v: z.ZodLiteral<1>; actorId: z.ZodString; authToken: z.ZodString; rivetToken: z.ZodOptional; activeTab: z.ZodOptional; theme: z.ZodOptional>; }, z.core.$strip>; /** * Dashboard tells the inspector-ui SPA which built-in tab to render. Not * sent to custom tabs — when the user activates a custom tab the * dashboard navigates the outer iframe to a different `src`. */ declare const V1SetActiveTabSchema: z.ZodObject<{ type: z.ZodLiteral<"set-active-tab">; v: z.ZodLiteral<1>; tab: z.ZodString; }, z.core.$strip>; /** * Tab → dashboard. Sent once after the message listener is registered. * The dashboard hides the "Connecting to inspector…" overlay on receipt; * if it never arrives the overlay times out after 8 s. */ declare const V1ReadySchema: z.ZodObject<{ type: z.ZodLiteral<"ready">; v: z.ZodLiteral<1>; }, z.core.$strip>; /** * Tab → dashboard. Sent when the tab gets a 401 on an inspector data * call. The dashboard refreshes the token and re-issues `v1Init`. */ declare const V1TokenRefreshNeededSchema: z.ZodObject<{ type: z.ZodLiteral<"token-refresh-needed">; v: z.ZodLiteral<1>; }, z.core.$strip>; /** * Emitted by the inspector-ui SPA to tell the dashboard which tabs to * render in the strip. Custom tab bundles do NOT emit this — only the * SPA does. */ declare const V1TabsAvailableSchema: z.ZodObject<{ type: z.ZodLiteral<"tabs-available">; v: z.ZodLiteral<1>; tabs: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>; /** Discriminated union of messages a tab can RECEIVE from the dashboard. */ declare const ShellToTabMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"init">; v: z.ZodLiteral<1>; actorId: z.ZodString; authToken: z.ZodString; rivetToken: z.ZodOptional; activeTab: z.ZodOptional; theme: z.ZodOptional>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"set-active-tab">; v: z.ZodLiteral<1>; tab: z.ZodString; }, z.core.$strip>], "type">; /** Discriminated union of messages a tab can SEND to the dashboard. */ declare const TabToShellMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"ready">; v: z.ZodLiteral<1>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"tabs-available">; v: z.ZodLiteral<1>; tabs: z.ZodArray; }, z.core.$strip>>; }, z.core.$strip>, z.ZodObject<{ type: z.ZodLiteral<"token-refresh-needed">; v: z.ZodLiteral<1>; }, z.core.$strip>], "type">; type InspectorTabDescriptor = z.infer; type V1Init = z.infer; type V1SetActiveTab = z.infer; type V1Ready = z.infer; type V1TokenRefreshNeeded = z.infer; type V1TabsAvailable = z.infer; type ShellToTabMessage = z.infer; type TabToShellMessage = z.infer; /** Stable envelope protocol version. Bump only when introducing a v2 shape. */ declare const POSTMESSAGE_PROTOCOL_VERSION = 1; /** URL query parameters the dashboard sets on the tab iframe `src`. */ declare const SHELL_ORIGIN_PARAM = "shellOrigin"; declare const ACTOR_ID_PARAM = "actorId"; /** `GET /inspector/state` response shape. */ declare const InspectorStateResponseSchema: z.ZodObject<{ state: z.ZodUnknown; isStateEnabled: z.ZodBoolean; }, z.core.$strip>; /** `POST /inspector/action/` request body. */ declare const InspectorActionRequestSchema: z.ZodObject<{ args: z.ZodOptional>; properties: z.ZodOptional>; }, z.core.$strip>; /** `POST /inspector/action/` response shape. */ declare const InspectorActionResponseSchema: z.ZodObject<{ output: z.ZodUnknown; }, z.core.$strip>; /** `GET /inspector/rpcs` response shape — the list of action names. */ declare const InspectorRpcsResponseSchema: z.ZodObject<{ rpcs: z.ZodArray; }, z.core.$strip>; /** One connection record in `GET /inspector/connections`. */ declare const InspectorConnectionSchema: z.ZodObject<{ connectionType: z.ZodNullable; id: z.ZodString; details: z.ZodObject<{ connectionType: z.ZodNullable; params: z.ZodUnknown; stateEnabled: z.ZodBoolean; state: z.ZodUnknown; subscriptions: z.ZodNumber; isHibernatable: z.ZodBoolean; }, z.core.$strip>; }, z.core.$strip>; /** `GET /inspector/connections` response shape. */ declare const InspectorConnectionsResponseSchema: z.ZodObject<{ connections: z.ZodArray; id: z.ZodString; details: z.ZodObject<{ connectionType: z.ZodNullable; params: z.ZodUnknown; stateEnabled: z.ZodBoolean; state: z.ZodUnknown; subscriptions: z.ZodNumber; isHibernatable: z.ZodBoolean; }, z.core.$strip>; }, z.core.$strip>>; }, z.core.$strip>; /** One queued message in `GET /inspector/queue`. */ declare const InspectorQueueMessageSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; createdAtMs: z.ZodNumber; }, z.core.$strip>; /** `GET /inspector/queue` response shape. */ declare const InspectorQueueResponseSchema: z.ZodObject<{ size: z.ZodNumber; maxSize: z.ZodNumber; truncated: z.ZodBoolean; messages: z.ZodArray>; }, z.core.$strip>; type InspectorStateResponse = z.infer; type InspectorActionRequest = z.infer; type InspectorActionResponse = z.infer; type InspectorRpcsResponse = z.infer; type InspectorConnection = z.infer; type InspectorConnectionsResponse = z.infer; type InspectorQueueMessage = z.infer; type InspectorQueueResponse = z.infer; 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 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 };