rivetkit 2.3.0-rc.9 → 2.3.1
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 +511 -62
- package/dist/browser/client.js +230 -174
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +53 -23
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +4 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +1 -1
- package/dist/tsup/actor/errors.d.ts +1 -1
- package/dist/tsup/actor/errors.js +3 -1
- package/dist/tsup/agent-os/index.cjs +2163 -2087
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +509 -69
- package/dist/tsup/agent-os/index.d.ts +509 -69
- package/dist/tsup/agent-os/index.js +2163 -2087
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-WQ4HNA4W.cjs → chunk-3MHDOUD7.cjs} +73 -3
- package/dist/tsup/chunk-3MHDOUD7.cjs.map +1 -0
- package/dist/tsup/{chunk-QAZLM4WT.cjs → chunk-4FC7TVS6.cjs} +8 -4
- package/dist/tsup/chunk-4FC7TVS6.cjs.map +1 -0
- package/dist/tsup/{chunk-4CGA6QJO.cjs → chunk-4UUEB43Y.cjs} +24 -9
- package/dist/tsup/chunk-4UUEB43Y.cjs.map +1 -0
- package/dist/tsup/{chunk-GVTOE34S.cjs → chunk-5IWLUJ6W.cjs} +222 -235
- package/dist/tsup/chunk-5IWLUJ6W.cjs.map +1 -0
- package/dist/tsup/{chunk-MMMEZM5J.js → chunk-H6VVZMWN.js} +4 -4
- package/dist/tsup/chunk-H6VVZMWN.js.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-H7P7WR2Y.js → chunk-I35VSLEM.js} +6 -6
- package/dist/tsup/chunk-I35VSLEM.js.map +1 -0
- package/dist/tsup/{chunk-H37XQU3I.js → chunk-JBUZRPY5.js} +2 -2
- package/dist/tsup/{chunk-CPA4Y3RG.cjs → chunk-JLJJZYCJ.cjs} +10 -10
- package/dist/tsup/chunk-JLJJZYCJ.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-VRCIXJRN.js → chunk-L2X3YFER.js} +64 -10
- package/dist/tsup/chunk-L2X3YFER.js.map +1 -0
- package/dist/tsup/{chunk-Y5NSCZA2.cjs → chunk-MNHKOS6L.cjs} +72 -18
- package/dist/tsup/chunk-MNHKOS6L.cjs.map +1 -0
- package/dist/tsup/{chunk-KJTA3ATT.js → chunk-NERUIBOT.js} +22 -7
- package/dist/tsup/chunk-NERUIBOT.js.map +1 -0
- package/dist/tsup/{chunk-4WPEZBK4.cjs → chunk-OST76LRW.cjs} +10 -10
- package/dist/tsup/chunk-OST76LRW.cjs.map +1 -0
- package/dist/tsup/{chunk-MALSPBAF.cjs → chunk-OZBCXBVP.cjs} +3 -3
- package/dist/tsup/{chunk-MALSPBAF.cjs.map → chunk-OZBCXBVP.cjs.map} +1 -1
- package/dist/tsup/{chunk-F3Q5BFQ6.js → chunk-PT6OIW5E.js} +66 -79
- package/dist/tsup/chunk-PT6OIW5E.js.map +1 -0
- package/dist/tsup/{chunk-W7EYSYVI.js → chunk-R6KPN5EW.js} +134 -20
- package/dist/tsup/chunk-R6KPN5EW.js.map +1 -0
- package/dist/tsup/{chunk-VJFRBJVQ.cjs → chunk-V5KMAMX3.cjs} +138 -24
- package/dist/tsup/chunk-V5KMAMX3.cjs.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-T6YVRM4K.js → chunk-XIX5DOZN.js} +72 -2
- package/dist/tsup/chunk-XIX5DOZN.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-ZA7FLHKH.cjs} +1 -1
- package/dist/tsup/chunk-ZA7FLHKH.cjs.map +1 -0
- package/dist/tsup/{chunk-KIWH5H3K.js → chunk-ZZ3WBRPD.js} +7 -3
- package/dist/tsup/chunk-ZZ3WBRPD.js.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-Ca8dN4cS.d.cts → config-CzvopP5m.d.cts} +544 -23
- package/dist/tsup/{config-CxjGYf4K.d.cts → config-D49x8NpL.d.cts} +1 -2
- package/dist/tsup/{config-CxjGYf4K.d.ts → config-D49x8NpL.d.ts} +1 -2
- package/dist/tsup/{config-0Ta55UV0.d.ts → config-DZuT7tcp.d.ts} +544 -23
- package/dist/tsup/context-CyAdY-aA.d.ts +128 -0
- package/dist/tsup/context-sNB28g0N.d.cts +128 -0
- 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 +758 -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 +662 -252
- 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-CqDnC_PS.d.cts} +2 -1
- package/dist/tsup/{utils-DVekpm4I.d.ts → utils-CqDnC_PS.d.ts} +2 -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 +383 -322
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +8 -8
- package/dist/tsup/workflow/mod.d.ts +8 -8
- package/dist/tsup/workflow/mod.js +360 -299
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +35 -14
- package/src/actor/config.ts +173 -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 +20 -3
- 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/actor/session.ts +2 -2
- package/src/agent-os/config.ts +1 -1
- package/src/agent-os/fs/database-vfs.ts +1 -1
- package/src/agent-os/index.ts +16 -15
- package/src/client/actor-common.ts +87 -54
- package/src/client/actor-conn.ts +8 -36
- package/src/client/actor-handle.ts +69 -51
- 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 -3
- package/src/client/raw-utils.ts +8 -6
- package/src/client/resolve-gateway-target.ts +1 -1
- package/src/client/utils.ts +2 -7
- 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 +250 -16
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/log.ts +1 -0
- package/src/common/router.ts +13 -17
- package/src/common/utils.ts +1 -150
- 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 +58 -56
- 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 +6 -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 +6 -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 +209 -73
- package/src/registry/napi-runtime.ts +29 -2
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +433 -198
- package/src/registry/process-metrics.ts +250 -0
- package/src/registry/runtime.ts +52 -1
- package/src/registry/wasm-runtime.ts +29 -2
- package/src/registry/write-through-proxy.ts +40 -0
- package/src/serde.ts +2 -2
- 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 +37 -0
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +1 -2
- package/src/workflow/context.ts +699 -240
- package/src/workflow/driver.ts +23 -12
- package/src/workflow/inspector.ts +4 -3
- package/src/workflow/mod.ts +37 -23
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3YY5S6TV.js.map +0 -1
- package/dist/tsup/chunk-4CGA6QJO.cjs.map +0 -1
- package/dist/tsup/chunk-4WPEZBK4.cjs.map +0 -1
- package/dist/tsup/chunk-CPA4Y3RG.cjs.map +0 -1
- package/dist/tsup/chunk-F3Q5BFQ6.js.map +0 -1
- package/dist/tsup/chunk-GVTOE34S.cjs.map +0 -1
- package/dist/tsup/chunk-H7P7WR2Y.js.map +0 -1
- package/dist/tsup/chunk-KIWH5H3K.js.map +0 -1
- package/dist/tsup/chunk-KJTA3ATT.js.map +0 -1
- package/dist/tsup/chunk-MMMEZM5J.js.map +0 -1
- package/dist/tsup/chunk-PCBNKI2J.js.map +0 -1
- package/dist/tsup/chunk-QAZLM4WT.cjs.map +0 -1
- package/dist/tsup/chunk-T6YVRM4K.js.map +0 -1
- package/dist/tsup/chunk-VJFRBJVQ.cjs.map +0 -1
- package/dist/tsup/chunk-VRCIXJRN.js.map +0 -1
- package/dist/tsup/chunk-W7EYSYVI.js.map +0 -1
- package/dist/tsup/chunk-WQ4HNA4W.cjs.map +0 -1
- package/dist/tsup/chunk-Y5NSCZA2.cjs.map +0 -1
- package/dist/tsup/context-B_IWbWne.d.ts +0 -92
- package/dist/tsup/context-CUrQ9MHc.d.cts +0 -92
- package/src/utils/serve.ts +0 -217
- /package/dist/tsup/{chunk-H37XQU3I.js.map → chunk-JBUZRPY5.js.map} +0 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk3MHDOUD7cjs = require('../chunk-3MHDOUD7.cjs');
|
|
9
|
+
|
|
10
|
+
// src/inspector-tab/mod.ts
|
|
11
|
+
var _zod = require('zod');
|
|
12
|
+
var InspectorTabDescriptorSchema = _zod.z.object({
|
|
13
|
+
id: _zod.z.string(),
|
|
14
|
+
label: _zod.z.string(),
|
|
15
|
+
icon: _zod.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: _zod.z.boolean().optional()
|
|
24
|
+
});
|
|
25
|
+
var V1InitSchema = _zod.z.object({
|
|
26
|
+
type: _zod.z.literal("init"),
|
|
27
|
+
v: _zod.z.literal(1),
|
|
28
|
+
/** The actor this tab is mounted for. */
|
|
29
|
+
actorId: _zod.z.string(),
|
|
30
|
+
/**
|
|
31
|
+
* Per-actor inspector bearer token. Tabs include it as
|
|
32
|
+
* `Authorization: Bearer ${authToken}` on every authenticated fetch.
|
|
33
|
+
*/
|
|
34
|
+
authToken: _zod.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: _zod.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: _zod.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: _zod.z.enum(["light", "dark"]).optional()
|
|
53
|
+
});
|
|
54
|
+
var V1SetActiveTabSchema = _zod.z.object({
|
|
55
|
+
type: _zod.z.literal("set-active-tab"),
|
|
56
|
+
v: _zod.z.literal(1),
|
|
57
|
+
tab: _zod.z.string()
|
|
58
|
+
});
|
|
59
|
+
var V1ReadySchema = _zod.z.object({
|
|
60
|
+
type: _zod.z.literal("ready"),
|
|
61
|
+
v: _zod.z.literal(1)
|
|
62
|
+
});
|
|
63
|
+
var V1TokenRefreshNeededSchema = _zod.z.object({
|
|
64
|
+
type: _zod.z.literal("token-refresh-needed"),
|
|
65
|
+
v: _zod.z.literal(1)
|
|
66
|
+
});
|
|
67
|
+
var V1TabsAvailableSchema = _zod.z.object({
|
|
68
|
+
type: _zod.z.literal("tabs-available"),
|
|
69
|
+
v: _zod.z.literal(1),
|
|
70
|
+
tabs: _zod.z.array(InspectorTabDescriptorSchema)
|
|
71
|
+
});
|
|
72
|
+
var ShellToTabMessageSchema = _zod.z.discriminatedUnion("type", [
|
|
73
|
+
V1InitSchema,
|
|
74
|
+
V1SetActiveTabSchema
|
|
75
|
+
]);
|
|
76
|
+
var TabToShellMessageSchema = _zod.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 = _zod.z.object({
|
|
85
|
+
/** Current actor state (whatever shape the actor declared). */
|
|
86
|
+
state: _zod.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: _zod.z.boolean()
|
|
92
|
+
});
|
|
93
|
+
var InspectorActionRequestSchema = _zod.z.object({
|
|
94
|
+
/** Positional arguments. Mutually exclusive with `properties`. */
|
|
95
|
+
args: _zod.z.array(_zod.z.unknown()).optional(),
|
|
96
|
+
/** Keyed arguments. Mutually exclusive with `args`. */
|
|
97
|
+
properties: _zod.z.record(_zod.z.string(), _zod.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 = _zod.z.object({
|
|
103
|
+
output: _zod.z.unknown()
|
|
104
|
+
});
|
|
105
|
+
var InspectorRpcsResponseSchema = _zod.z.object({
|
|
106
|
+
rpcs: _zod.z.array(_zod.z.string())
|
|
107
|
+
});
|
|
108
|
+
var InspectorConnectionSchema = _zod.z.object({
|
|
109
|
+
connectionType: _zod.z.string().nullable(),
|
|
110
|
+
id: _zod.z.string(),
|
|
111
|
+
details: _zod.z.object({
|
|
112
|
+
connectionType: _zod.z.string().nullable(),
|
|
113
|
+
params: _zod.z.unknown(),
|
|
114
|
+
stateEnabled: _zod.z.boolean(),
|
|
115
|
+
state: _zod.z.unknown(),
|
|
116
|
+
subscriptions: _zod.z.number(),
|
|
117
|
+
isHibernatable: _zod.z.boolean()
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
var InspectorConnectionsResponseSchema = _zod.z.object({
|
|
121
|
+
connections: _zod.z.array(InspectorConnectionSchema)
|
|
122
|
+
});
|
|
123
|
+
var InspectorQueueMessageSchema = _zod.z.object({
|
|
124
|
+
id: _zod.z.string(),
|
|
125
|
+
name: _zod.z.string(),
|
|
126
|
+
createdAtMs: _zod.z.number()
|
|
127
|
+
});
|
|
128
|
+
var InspectorQueueResponseSchema = _zod.z.object({
|
|
129
|
+
size: _zod.z.number(),
|
|
130
|
+
maxSize: _zod.z.number(),
|
|
131
|
+
/** `true` if `?limit=N` truncated the message list below `size`. */
|
|
132
|
+
truncated: _zod.z.boolean(),
|
|
133
|
+
messages: _zod.z.array(InspectorQueueMessageSchema)
|
|
134
|
+
});
|
|
135
|
+
var InspectorTabConfigResponseSchema = _zod.z.object({
|
|
136
|
+
tabs: _zod.z.array(
|
|
137
|
+
_zod.z.object({
|
|
138
|
+
id: _zod.z.string(),
|
|
139
|
+
label: _zod.z.string().optional(),
|
|
140
|
+
icon: _zod.z.string().nullable().optional(),
|
|
141
|
+
hidden: _zod.z.boolean().optional()
|
|
142
|
+
})
|
|
143
|
+
)
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
exports.ACTOR_ID_PARAM = ACTOR_ID_PARAM; exports.ActorInspectorConfigSchema = _chunk3MHDOUD7cjs.ActorInspectorConfigSchema; exports.BUILTIN_INSPECTOR_TAB_IDS = _chunk3MHDOUD7cjs.BUILTIN_INSPECTOR_TAB_IDS; exports.BuiltinInspectorTabIdSchema = _chunk3MHDOUD7cjs.BuiltinInspectorTabIdSchema; exports.CustomInspectorTabEntrySchema = _chunk3MHDOUD7cjs.CustomInspectorTabEntrySchema; exports.HideInspectorTabEntrySchema = _chunk3MHDOUD7cjs.HideInspectorTabEntrySchema; exports.InspectorActionRequestSchema = InspectorActionRequestSchema; exports.InspectorActionResponseSchema = InspectorActionResponseSchema; exports.InspectorConnectionSchema = InspectorConnectionSchema; exports.InspectorConnectionsResponseSchema = InspectorConnectionsResponseSchema; exports.InspectorQueueMessageSchema = InspectorQueueMessageSchema; exports.InspectorQueueResponseSchema = InspectorQueueResponseSchema; exports.InspectorRpcsResponseSchema = InspectorRpcsResponseSchema; exports.InspectorStateResponseSchema = InspectorStateResponseSchema; exports.InspectorTabConfigResponseSchema = InspectorTabConfigResponseSchema; exports.InspectorTabDescriptorSchema = InspectorTabDescriptorSchema; exports.InspectorTabEntrySchema = _chunk3MHDOUD7cjs.InspectorTabEntrySchema; exports.POSTMESSAGE_PROTOCOL_VERSION = POSTMESSAGE_PROTOCOL_VERSION; exports.SHELL_ORIGIN_PARAM = SHELL_ORIGIN_PARAM; exports.ShellToTabMessageSchema = ShellToTabMessageSchema; exports.TabToShellMessageSchema = TabToShellMessageSchema; exports.V1InitSchema = V1InitSchema; exports.V1ReadySchema = V1ReadySchema; exports.V1SetActiveTabSchema = V1SetActiveTabSchema; exports.V1TabsAvailableSchema = V1TabsAvailableSchema; exports.V1TokenRefreshNeededSchema = V1TokenRefreshNeededSchema;
|
|
173
|
+
//# sourceMappingURL=mod.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/inspector-tab/mod.cjs","../../../src/inspector-tab/mod.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACF,yDAA8B;AAC9B;AACA;ACuBA,0BAAkB;AAmDX,IAAM,6BAAA,EAA+B,MAAA,CAAE,MAAA,CAAO;AAAA,EACpD,EAAA,EAAI,MAAA,CAAE,MAAA,CAAO,CAAA;AAAA,EACb,KAAA,EAAO,MAAA,CAAE,MAAA,CAAO,CAAA;AAAA,EAChB,IAAA,EAAM,MAAA,CAAE,MAAA,CAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQf,QAAA,EAAU,MAAA,CAAE,OAAA,CAAQ,CAAA,CAAE,QAAA,CAAS;AAChC,CAAC,CAAA;AAOM,IAAM,aAAA,EAAe,MAAA,CAAE,MAAA,CAAO;AAAA,EACpC,IAAA,EAAM,MAAA,CAAE,OAAA,CAAQ,MAAM,CAAA;AAAA,EACtB,CAAA,EAAG,MAAA,CAAE,OAAA,CAAQ,CAAC,CAAA;AAAA;AAAA,EAEd,OAAA,EAAS,MAAA,CAAE,MAAA,CAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,SAAA,EAAW,MAAA,CAAE,MAAA,CAAO,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKpB,UAAA,EAAY,MAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKhC,SAAA,EAAW,MAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CAAA;AAAA;AAAA;AAAA;A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AAE,MAAA,CAAO;AAAA,MACR,EAAA,EAAI,MAAA,CAAE,MAAA,CAAO,CAAA;AAAA,MACb,KAAA,EAAO,MAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CAAA;AAAA,MAC3B,IAAA,EAAM,MAAA,CAAE,MAAA,CAAO,CAAA,CAAE,QAAA,CAAS,CAAA,CAAE,QAAA,CAAS,CAAA;AAAA,MACrC,MAAA,EAAQ,MAAA,CAAE,OAAA,CAAQ,CAAA,CAAE,QAAA,CAAS;AAAA,IAC9B,CAAC;AAAA,EACF;AACD,CAAC,CAAA;ADpJD;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,+rDAAC","file":"/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/inspector-tab/mod.cjs","sourcesContent":[null,"/**\n * Type and schema declarations for custom Rivet inspector tabs.\n *\n * Everything here is **derived from runtime Zod schemas** that the\n * dashboard and rivetkit itself use, so the published types cannot\n * drift from the wire format. There are three sources of truth:\n *\n * 1. The `inspector.tabs[]` actor-config Zod schemas in\n * `../actor/config.ts` — re-exported below. These validate the\n * authoring surface (`defineActor({ inspector: { tabs: [...] } })`).\n * 2. The dashboard ↔ tab postMessage envelopes defined in this file.\n * The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`)\n * imports the same schemas to validate messages at runtime, so any\n * change here lands on both ends in lockstep.\n * 3. The inspector HTTP endpoint response schemas defined in this\n * file. The dashboard parses every response through them; if the\n * Rust handler ever emits a different shape, the dashboard fails\n * loudly at the parse step instead of silently casting `unknown`.\n *\n * Tab bundles import these types for autocomplete and compile-time\n * safety:\n *\n * ```ts\n * import type {\n * ShellToTabMessage,\n * TabToShellMessage,\n * V1Init,\n * InspectorStateResponse,\n * } from \"rivetkit/inspector-tab\";\n * ```\n */\n\nimport { z } from \"zod\";\n\n// ============================================================================\n// Re-exported from `../actor/config.ts` — the authoring schema for\n// `defineActor({ inspector: { tabs: [...] } })`.\n// ============================================================================\n\nexport type { ActorInspectorConfig } from \"../actor/config\";\nexport {\n\tActorInspectorConfigSchema,\n\tBUILTIN_INSPECTOR_TAB_IDS,\n\tBuiltinInspectorTabIdSchema,\n\tCustomInspectorTabEntrySchema,\n\tHideInspectorTabEntrySchema,\n\tInspectorTabEntrySchema,\n} from \"../actor/config\";\n\nimport type {\n\tCustomInspectorTabEntrySchema,\n\tHideInspectorTabEntrySchema,\n\tInspectorTabEntrySchema,\n} from \"../actor/config\";\n\n/** One entry in the actor's `inspector.tabs[]` declaration. */\nexport type ActorInspectorTabEntry = z.input<typeof InspectorTabEntrySchema>;\n/** A custom-tab entry — adds a new tab to the dashboard strip. */\nexport type ActorCustomInspectorTabEntry = z.input<\n\ttypeof CustomInspectorTabEntrySchema\n>;\n/** A hide modifier — removes a built-in tab from the strip. */\nexport type ActorHideInspectorTabEntry = z.input<\n\ttypeof HideInspectorTabEntrySchema\n>;\n/** Union of the six built-in inspector tab ids. */\nexport type BuiltinInspectorTabId =\n\t| \"workflow\"\n\t| \"database\"\n\t| \"state\"\n\t| \"queue\"\n\t| \"connections\"\n\t| \"console\";\n\n// ============================================================================\n// Dashboard ↔ tab postMessage envelope (source of truth).\n//\n// These Zod schemas are imported by `frontend/apps/inspector-ui/src/bridge.ts`\n// and used to validate inbound messages at runtime. Changes here flow to\n// both sides in a single commit.\n// ============================================================================\n\n/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */\nexport const InspectorTabDescriptorSchema = z.object({\n\tid: z.string(),\n\tlabel: z.string(),\n\ticon: z.string(),\n\t/**\n\t * `true` for author-shipped custom tabs; absent or `false` for\n\t * built-in tabs the SPA renders. Lets the dashboard route the\n\t * iframe `src` to `/inspector/custom-tabs/<id>/` for custom tabs and\n\t * `/inspector/ui/` for built-ins without the dashboard needing to\n\t * know which ids are built-in.\n\t */\n\tisCustom: z.boolean().optional(),\n});\n\n/**\n * Initial handshake from the dashboard. Sent on first mount and again on\n * every token refresh. Tabs MUST accept late `init` messages and replace\n * the cached token.\n */\nexport const V1InitSchema = z.object({\n\ttype: z.literal(\"init\"),\n\tv: z.literal(1),\n\t/** The actor this tab is mounted for. */\n\tactorId: z.string(),\n\t/**\n\t * Per-actor inspector bearer token. Tabs include it as\n\t * `Authorization: Bearer ${authToken}` on every authenticated fetch.\n\t */\n\tauthToken: z.string(),\n\t/**\n\t * Outer Rivet API token. Optional; not required for inspector HTTP\n\t * routes but available to tabs that want to call the engine REST API.\n\t */\n\trivetToken: z.string().optional(),\n\t/**\n\t * The tab id the dashboard wants active at mount time. Multi-view\n\t * tabs may read this to seed their initial route; most tabs ignore it.\n\t */\n\tactiveTab: z.string().optional(),\n\t/**\n\t * Dashboard's currently active theme. Tabs that use the shared\n\t * stylesheet (`/inspector/tab.css`) mirror it by toggling the `dark`\n\t * class on `<html>`. Optional for backwards compatibility — tabs\n\t * should default to `\"dark\"` if absent (the dashboard pinned dark\n\t * mode before this field was added).\n\t */\n\ttheme: z.enum([\"light\", \"dark\"]).optional(),\n});\n\n/**\n * Dashboard tells the inspector-ui SPA which built-in tab to render. Not\n * sent to custom tabs — when the user activates a custom tab the\n * dashboard navigates the outer iframe to a different `src`.\n */\nexport const V1SetActiveTabSchema = z.object({\n\ttype: z.literal(\"set-active-tab\"),\n\tv: z.literal(1),\n\ttab: z.string(),\n});\n\n/**\n * Tab → dashboard. Sent once after the message listener is registered.\n * The dashboard hides the \"Connecting to inspector…\" overlay on receipt;\n * if it never arrives the overlay times out after 8 s.\n */\nexport const V1ReadySchema = z.object({\n\ttype: z.literal(\"ready\"),\n\tv: z.literal(1),\n});\n\n/**\n * Tab → dashboard. Sent when the tab gets a 401 on an inspector data\n * call. The dashboard refreshes the token and re-issues `v1Init`.\n */\nexport const V1TokenRefreshNeededSchema = z.object({\n\ttype: z.literal(\"token-refresh-needed\"),\n\tv: z.literal(1),\n});\n\n/**\n * Emitted by the inspector-ui SPA to tell the dashboard which tabs to\n * render in the strip. Custom tab bundles do NOT emit this — only the\n * SPA does.\n */\nexport const V1TabsAvailableSchema = z.object({\n\ttype: z.literal(\"tabs-available\"),\n\tv: z.literal(1),\n\ttabs: z.array(InspectorTabDescriptorSchema),\n});\n\n/** Discriminated union of messages a tab can RECEIVE from the dashboard. */\nexport const ShellToTabMessageSchema = z.discriminatedUnion(\"type\", [\n\tV1InitSchema,\n\tV1SetActiveTabSchema,\n]);\n\n/** Discriminated union of messages a tab can SEND to the dashboard. */\nexport const TabToShellMessageSchema = z.discriminatedUnion(\"type\", [\n\tV1ReadySchema,\n\tV1TabsAvailableSchema,\n\tV1TokenRefreshNeededSchema,\n]);\n\nexport type InspectorTabDescriptor = z.infer<\n\ttypeof InspectorTabDescriptorSchema\n>;\nexport type V1Init = z.infer<typeof V1InitSchema>;\nexport type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;\nexport type V1Ready = z.infer<typeof V1ReadySchema>;\nexport type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;\nexport type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;\nexport type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;\nexport type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;\n\n/** Stable envelope protocol version. Bump only when introducing a v2 shape. */\nexport const POSTMESSAGE_PROTOCOL_VERSION = 1;\n\n/** URL query parameters the dashboard sets on the tab iframe `src`. */\nexport const SHELL_ORIGIN_PARAM = \"shellOrigin\";\nexport const ACTOR_ID_PARAM = \"actorId\";\n\n// ============================================================================\n// Inspector HTTP endpoint response schemas (source of truth).\n//\n// The dashboard parses every authenticated inspector response through\n// these schemas (`frontend/src/components/actors/actor-inspector-context.tsx`).\n// If the Rust handler emits a different shape the parse fails and the\n// dashboard surfaces an error — drift is loud.\n// ============================================================================\n\n/** `GET /inspector/state` response shape. */\nexport const InspectorStateResponseSchema = z.object({\n\t/** Current actor state (whatever shape the actor declared). */\n\tstate: z.unknown(),\n\t/**\n\t * `false` when the actor did not declare any state — `state` is then\n\t * `null` and `PATCH /inspector/state` returns an error.\n\t */\n\tisStateEnabled: z.boolean(),\n});\n\n/** `POST /inspector/action/<name>` request body. */\nexport const InspectorActionRequestSchema = z\n\t.object({\n\t\t/** Positional arguments. Mutually exclusive with `properties`. */\n\t\targs: z.array(z.unknown()).optional(),\n\t\t/** Keyed arguments. Mutually exclusive with `args`. */\n\t\tproperties: z.record(z.string(), z.unknown()).optional(),\n\t})\n\t.refine(\n\t\t(body) => !(body.args !== undefined && body.properties !== undefined),\n\t\t\"Use either `args` or `properties`, not both\",\n\t);\n\n/** `POST /inspector/action/<name>` response shape. */\nexport const InspectorActionResponseSchema = z.object({\n\toutput: z.unknown(),\n});\n\n/** `GET /inspector/rpcs` response shape — the list of action names. */\nexport const InspectorRpcsResponseSchema = z.object({\n\trpcs: z.array(z.string()),\n});\n\n/** One connection record in `GET /inspector/connections`. */\nexport const InspectorConnectionSchema = z.object({\n\tconnectionType: z.string().nullable(),\n\tid: z.string(),\n\tdetails: z.object({\n\t\tconnectionType: z.string().nullable(),\n\t\tparams: z.unknown(),\n\t\tstateEnabled: z.boolean(),\n\t\tstate: z.unknown(),\n\t\tsubscriptions: z.number(),\n\t\tisHibernatable: z.boolean(),\n\t}),\n});\n\n/** `GET /inspector/connections` response shape. */\nexport const InspectorConnectionsResponseSchema = z.object({\n\tconnections: z.array(InspectorConnectionSchema),\n});\n\n/** One queued message in `GET /inspector/queue`. */\nexport const InspectorQueueMessageSchema = z.object({\n\tid: z.string(),\n\tname: z.string(),\n\tcreatedAtMs: z.number(),\n});\n\n/** `GET /inspector/queue` response shape. */\nexport const InspectorQueueResponseSchema = z.object({\n\tsize: z.number(),\n\tmaxSize: z.number(),\n\t/** `true` if `?limit=N` truncated the message list below `size`. */\n\ttruncated: z.boolean(),\n\tmessages: z.array(InspectorQueueMessageSchema),\n});\n\n/** `GET /inspector/tab-config` response shape. */\nexport const InspectorTabConfigResponseSchema = z.object({\n\ttabs: z.array(\n\t\tz.object({\n\t\t\tid: z.string(),\n\t\t\tlabel: z.string().optional(),\n\t\t\ticon: z.string().nullable().optional(),\n\t\t\thidden: z.boolean().optional(),\n\t\t}),\n\t),\n});\n\nexport type InspectorStateResponse = z.infer<\n\ttypeof InspectorStateResponseSchema\n>;\nexport type InspectorActionRequest = z.infer<\n\ttypeof InspectorActionRequestSchema\n>;\nexport type InspectorActionResponse = z.infer<\n\ttypeof InspectorActionResponseSchema\n>;\nexport type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;\nexport type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;\nexport type InspectorConnectionsResponse = z.infer<\n\ttypeof InspectorConnectionsResponseSchema\n>;\nexport type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;\nexport type InspectorQueueResponse = z.infer<\n\ttypeof InspectorQueueResponseSchema\n>;\nexport type InspectorTabConfigResponse = z.infer<\n\ttypeof InspectorTabConfigResponseSchema\n>;\n"]}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a0 as CustomInspectorTabEntrySchema, ae as HideInspectorTabEntrySchema, af as InspectorTabEntrySchema } from '../config-CzvopP5m.cjs';
|
|
3
|
+
export { s as ActorInspectorConfig, t as ActorInspectorConfigSchema, U as BUILTIN_INSPECTOR_TAB_IDS, X as BuiltinInspectorTabIdSchema } from '../config-CzvopP5m.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-CqDnC_PS.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 };
|