rivetkit 2.3.0-rc.9 → 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.
Files changed (222) hide show
  1. package/dist/browser/client.d.ts +498 -62
  2. package/dist/browser/client.js +227 -171
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +50 -20
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/actor/errors.cjs +2 -2
  7. package/dist/tsup/actor/errors.d.cts +1 -1
  8. package/dist/tsup/actor/errors.d.ts +1 -1
  9. package/dist/tsup/actor/errors.js +1 -1
  10. package/dist/tsup/agent-os/index.cjs +2163 -2087
  11. package/dist/tsup/agent-os/index.cjs.map +1 -1
  12. package/dist/tsup/agent-os/index.d.cts +496 -69
  13. package/dist/tsup/agent-os/index.d.ts +496 -69
  14. package/dist/tsup/agent-os/index.js +2163 -2087
  15. package/dist/tsup/agent-os/index.js.map +1 -1
  16. package/dist/tsup/{chunk-W7EYSYVI.js → chunk-2OTRTA3J.js} +134 -20
  17. package/dist/tsup/chunk-2OTRTA3J.js.map +1 -0
  18. package/dist/tsup/{chunk-VJFRBJVQ.cjs → chunk-3677IIOV.cjs} +138 -24
  19. package/dist/tsup/chunk-3677IIOV.cjs.map +1 -0
  20. package/dist/tsup/{chunk-4CGA6QJO.cjs → chunk-47HHIEXH.cjs} +24 -9
  21. package/dist/tsup/chunk-47HHIEXH.cjs.map +1 -0
  22. package/dist/tsup/{chunk-F3Q5BFQ6.js → chunk-4JDSFJS5.js} +66 -79
  23. package/dist/tsup/chunk-4JDSFJS5.js.map +1 -0
  24. package/dist/tsup/{chunk-GVTOE34S.cjs → chunk-7QKCIVAY.cjs} +222 -235
  25. package/dist/tsup/chunk-7QKCIVAY.cjs.map +1 -0
  26. package/dist/tsup/{chunk-CPA4Y3RG.cjs → chunk-B6VUNZUD.cjs} +10 -10
  27. package/dist/tsup/chunk-B6VUNZUD.cjs.map +1 -0
  28. package/dist/tsup/{chunk-H37XQU3I.js → chunk-BEI24WTI.js} +2 -2
  29. package/dist/tsup/{chunk-KIWH5H3K.js → chunk-BRP62GZC.js} +3 -3
  30. package/dist/tsup/chunk-BRP62GZC.js.map +1 -0
  31. package/dist/tsup/{chunk-T6YVRM4K.js → chunk-DPIMKYNB.js} +63 -2
  32. package/dist/tsup/chunk-DPIMKYNB.js.map +1 -0
  33. package/dist/tsup/{chunk-Y5NSCZA2.cjs → chunk-DXXJPH55.cjs} +44 -15
  34. package/dist/tsup/chunk-DXXJPH55.cjs.map +1 -0
  35. package/dist/tsup/{chunk-3YY5S6TV.js → chunk-HXUEHHJF.js} +2 -2
  36. package/dist/tsup/chunk-HXUEHHJF.js.map +1 -0
  37. package/dist/tsup/{chunk-4WPEZBK4.cjs → chunk-I4LN3FNT.cjs} +10 -10
  38. package/dist/tsup/chunk-I4LN3FNT.cjs.map +1 -0
  39. package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JZ7TWV65.js} +1 -1
  40. package/dist/tsup/chunk-JZ7TWV65.js.map +1 -0
  41. package/dist/tsup/{chunk-QAZLM4WT.cjs → chunk-KORQB2IR.cjs} +3 -3
  42. package/dist/tsup/{chunk-QAZLM4WT.cjs.map → chunk-KORQB2IR.cjs.map} +1 -1
  43. package/dist/tsup/{chunk-MALSPBAF.cjs → chunk-LVTBW2RE.cjs} +3 -3
  44. package/dist/tsup/{chunk-MALSPBAF.cjs.map → chunk-LVTBW2RE.cjs.map} +1 -1
  45. package/dist/tsup/{chunk-H7P7WR2Y.js → chunk-MEHBWPLJ.js} +6 -6
  46. package/dist/tsup/chunk-MEHBWPLJ.js.map +1 -0
  47. package/dist/tsup/{chunk-WQ4HNA4W.cjs → chunk-NIY3RSPX.cjs} +64 -3
  48. package/dist/tsup/chunk-NIY3RSPX.cjs.map +1 -0
  49. package/dist/tsup/{chunk-MMMEZM5J.js → chunk-P2GNQ4RN.js} +4 -4
  50. package/dist/tsup/chunk-P2GNQ4RN.js.map +1 -0
  51. package/dist/tsup/{chunk-KJTA3ATT.js → chunk-UMZVD6DQ.js} +22 -7
  52. package/dist/tsup/chunk-UMZVD6DQ.js.map +1 -0
  53. package/dist/tsup/{chunk-LD5YASJU.cjs → chunk-VE2X4KMG.cjs} +2 -2
  54. package/dist/tsup/{chunk-LD5YASJU.cjs.map → chunk-VE2X4KMG.cjs.map} +1 -1
  55. package/dist/tsup/{chunk-VRCIXJRN.js → chunk-VTTFNQQI.js} +36 -7
  56. package/dist/tsup/chunk-VTTFNQQI.js.map +1 -0
  57. package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
  58. package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
  59. package/dist/tsup/client/mod.cjs +9 -9
  60. package/dist/tsup/client/mod.d.cts +5 -5
  61. package/dist/tsup/client/mod.d.ts +5 -5
  62. package/dist/tsup/client/mod.js +8 -8
  63. package/dist/tsup/common/log.cjs +3 -3
  64. package/dist/tsup/common/log.js +2 -2
  65. package/dist/tsup/common/websocket.cjs +4 -4
  66. package/dist/tsup/common/websocket.js +3 -3
  67. package/dist/tsup/{config-0Ta55UV0.d.ts → config-BxWAw3iH.d.ts} +529 -23
  68. package/dist/tsup/{config-Ca8dN4cS.d.cts → config-CZQQ-mso.d.cts} +529 -23
  69. package/dist/tsup/{config-CxjGYf4K.d.cts → config-D49x8NpL.d.cts} +1 -2
  70. package/dist/tsup/{config-CxjGYf4K.d.ts → config-D49x8NpL.d.ts} +1 -2
  71. package/dist/tsup/{context-B_IWbWne.d.ts → context-Bw7xq8w3.d.cts} +8 -8
  72. package/dist/tsup/{context-CUrQ9MHc.d.cts → context-D8QA76sV.d.ts} +8 -8
  73. package/dist/tsup/db/drizzle.cjs +3 -3
  74. package/dist/tsup/db/drizzle.d.cts +1 -1
  75. package/dist/tsup/db/drizzle.d.ts +1 -1
  76. package/dist/tsup/db/drizzle.js +1 -1
  77. package/dist/tsup/db/mod.cjs +2 -2
  78. package/dist/tsup/db/mod.d.cts +2 -2
  79. package/dist/tsup/db/mod.d.ts +2 -2
  80. package/dist/tsup/db/mod.js +1 -1
  81. package/dist/tsup/dynamic/mod.cjs +24 -0
  82. package/dist/tsup/dynamic/mod.cjs.map +1 -0
  83. package/dist/tsup/dynamic/mod.d.cts +37 -0
  84. package/dist/tsup/dynamic/mod.d.ts +37 -0
  85. package/dist/tsup/dynamic/mod.js +24 -0
  86. package/dist/tsup/dynamic/mod.js.map +1 -0
  87. package/dist/tsup/inspector/mod.cjs +6 -6
  88. package/dist/tsup/inspector/mod.js +5 -5
  89. package/dist/tsup/inspector-tab/mod.cjs +173 -0
  90. package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
  91. package/dist/tsup/inspector-tab/mod.d.cts +250 -0
  92. package/dist/tsup/inspector-tab/mod.d.ts +250 -0
  93. package/dist/tsup/inspector-tab/mod.js +173 -0
  94. package/dist/tsup/inspector-tab/mod.js.map +1 -0
  95. package/dist/tsup/mod.cjs +730 -336
  96. package/dist/tsup/mod.cjs.map +1 -1
  97. package/dist/tsup/mod.d.cts +5 -5
  98. package/dist/tsup/mod.d.ts +5 -5
  99. package/dist/tsup/mod.js +633 -239
  100. package/dist/tsup/mod.js.map +1 -1
  101. package/dist/tsup/test/mod.cjs +21 -18
  102. package/dist/tsup/test/mod.cjs.map +1 -1
  103. package/dist/tsup/test/mod.d.cts +4 -4
  104. package/dist/tsup/test/mod.d.ts +4 -4
  105. package/dist/tsup/test/mod.js +18 -15
  106. package/dist/tsup/test/mod.js.map +1 -1
  107. package/dist/tsup/{utils-DVekpm4I.d.cts → utils-DQosb24I.d.cts} +1 -1
  108. package/dist/tsup/{utils-DVekpm4I.d.ts → utils-DQosb24I.d.ts} +1 -1
  109. package/dist/tsup/utils.cjs +3 -3
  110. package/dist/tsup/utils.d.cts +1 -1
  111. package/dist/tsup/utils.d.ts +1 -1
  112. package/dist/tsup/utils.js +2 -2
  113. package/dist/tsup/workflow/mod.cjs +307 -282
  114. package/dist/tsup/workflow/mod.cjs.map +1 -1
  115. package/dist/tsup/workflow/mod.d.cts +6 -6
  116. package/dist/tsup/workflow/mod.d.ts +6 -6
  117. package/dist/tsup/workflow/mod.js +501 -476
  118. package/dist/tsup/workflow/mod.js.map +1 -1
  119. package/package.json +32 -11
  120. package/src/actor/config.ts +159 -51
  121. package/src/actor/contexts/index.ts +7 -2
  122. package/src/actor/definition.ts +17 -19
  123. package/src/actor/driver.ts +3 -3
  124. package/src/actor/errors.ts +9 -3
  125. package/src/actor/instance/mod.ts +26 -34
  126. package/src/actor/keys.ts +1 -1
  127. package/src/actor/mod.ts +22 -20
  128. package/src/actor/schema.ts +2 -2
  129. package/src/agent-os/actor/index.ts +38 -18
  130. package/src/agent-os/actor/preview.ts +1 -2
  131. package/src/agent-os/actor/session.ts +2 -2
  132. package/src/agent-os/config.ts +1 -1
  133. package/src/agent-os/fs/database-vfs.ts +1 -1
  134. package/src/agent-os/index.ts +16 -15
  135. package/src/client/actor-common.ts +87 -54
  136. package/src/client/actor-conn.ts +8 -36
  137. package/src/client/actor-handle.ts +69 -51
  138. package/src/client/actor-query.ts +5 -5
  139. package/src/client/errors.ts +1 -1
  140. package/src/client/lifecycle-errors.ts +2 -4
  141. package/src/client/query.ts +1 -1
  142. package/src/client/queue.ts +8 -3
  143. package/src/client/raw-utils.ts +8 -6
  144. package/src/client/resolve-gateway-target.ts +1 -1
  145. package/src/client/utils.ts +2 -7
  146. package/src/common/actor-websocket.ts +3 -1
  147. package/src/common/bare/actor-persist/v1.ts +205 -163
  148. package/src/common/bare/actor-persist/v2.ts +265 -213
  149. package/src/common/bare/actor-persist/v3.ts +176 -172
  150. package/src/common/bare/actor-persist/v4.ts +254 -253
  151. package/src/common/bare/transport/v1.ts +659 -543
  152. package/src/common/client-protocol-versioned.ts +66 -64
  153. package/src/common/database/config.ts +2 -8
  154. package/src/common/database/native-database.ts +1 -1
  155. package/src/common/database/shared.ts +1 -0
  156. package/src/common/encoding.ts +250 -16
  157. package/src/common/engine.ts +28 -1
  158. package/src/common/eventsource.ts +1 -1
  159. package/src/common/inline-websocket-adapter.ts +14 -13
  160. package/src/common/log.ts +1 -0
  161. package/src/common/router.ts +13 -17
  162. package/src/common/utils.ts +1 -150
  163. package/src/common/websocket-interface.ts +1 -1
  164. package/src/db/mod.ts +1 -1
  165. package/src/devtools-loader/index.ts +4 -7
  166. package/src/devtools-loader/serve-devtools.ts +26 -0
  167. package/src/drivers/engine/actor-driver.ts +58 -56
  168. package/src/dynamic/instance.ts +32 -0
  169. package/src/dynamic/internal.ts +50 -0
  170. package/src/dynamic/isolate-runtime.ts +66 -0
  171. package/src/dynamic/mod.ts +32 -0
  172. package/src/engine-client/actor-http-client.ts +3 -3
  173. package/src/engine-client/actor-websocket-client.ts +6 -5
  174. package/src/engine-client/api-endpoints.ts +51 -2
  175. package/src/engine-client/api-utils.ts +2 -2
  176. package/src/engine-client/driver.ts +1 -1
  177. package/src/engine-client/mod.ts +6 -3
  178. package/src/engine-client/ws-proxy.ts +9 -4
  179. package/src/inspector/client.browser.ts +5 -11
  180. package/src/inspector/mod.ts +1 -3
  181. package/src/inspector-tab/mod.ts +315 -0
  182. package/src/registry/config/envoy.ts +1 -2
  183. package/src/registry/config/index.ts +40 -16
  184. package/src/registry/index.ts +154 -74
  185. package/src/registry/napi-runtime.ts +13 -2
  186. package/src/registry/native-validation.ts +10 -12
  187. package/src/registry/native.ts +367 -181
  188. package/src/registry/process-metrics.ts +250 -0
  189. package/src/registry/runtime.ts +41 -1
  190. package/src/registry/wasm-runtime.ts +18 -2
  191. package/src/registry/write-through-proxy.ts +40 -0
  192. package/src/serde.ts +2 -2
  193. package/src/serverless/configure.ts +18 -7
  194. package/src/test/mod.ts +11 -8
  195. package/src/utils/endpoint-parser.ts +1 -1
  196. package/src/utils/env-vars.ts +6 -0
  197. package/src/utils/router.ts +1 -1
  198. package/src/utils/serve.ts +4 -5
  199. package/src/utils.ts +1 -2
  200. package/src/workflow/context.ts +61 -33
  201. package/src/workflow/driver.ts +4 -6
  202. package/src/workflow/inspector.ts +4 -3
  203. package/src/workflow/mod.ts +15 -17
  204. package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
  205. package/dist/tsup/chunk-3YY5S6TV.js.map +0 -1
  206. package/dist/tsup/chunk-4CGA6QJO.cjs.map +0 -1
  207. package/dist/tsup/chunk-4WPEZBK4.cjs.map +0 -1
  208. package/dist/tsup/chunk-CPA4Y3RG.cjs.map +0 -1
  209. package/dist/tsup/chunk-F3Q5BFQ6.js.map +0 -1
  210. package/dist/tsup/chunk-GVTOE34S.cjs.map +0 -1
  211. package/dist/tsup/chunk-H7P7WR2Y.js.map +0 -1
  212. package/dist/tsup/chunk-KIWH5H3K.js.map +0 -1
  213. package/dist/tsup/chunk-KJTA3ATT.js.map +0 -1
  214. package/dist/tsup/chunk-MMMEZM5J.js.map +0 -1
  215. package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
  216. package/dist/tsup/chunk-T6YVRM4K.js.map +0 -1
  217. package/dist/tsup/chunk-VJFRBJVQ.cjs.map +0 -1
  218. package/dist/tsup/chunk-VRCIXJRN.js.map +0 -1
  219. package/dist/tsup/chunk-W7EYSYVI.js.map +0 -1
  220. package/dist/tsup/chunk-WQ4HNA4W.cjs.map +0 -1
  221. package/dist/tsup/chunk-Y5NSCZA2.cjs.map +0 -1
  222. /package/dist/tsup/{chunk-H37XQU3I.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