rivetkit 0.0.0-active-actors-fix-active-count.253e406 → 0.0.0-bisect-sync-sqlite-1.910d1c7
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 +1286 -89
- package/dist/browser/client.js +1699 -704
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.d.ts +252 -129
- package/dist/browser/inspector/client.js +2083 -236
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +8 -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 +7 -1
- package/dist/tsup/agent-os/index.cjs +3 -2289
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +1 -1813
- package/dist/tsup/agent-os/index.d.ts +1 -1813
- package/dist/tsup/agent-os/index.js +3 -2289
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/chunk-2JJU7IQ7.cjs +14 -0
- package/dist/tsup/chunk-2JJU7IQ7.cjs.map +1 -0
- package/dist/tsup/{chunk-DZJZLZ4R.js → chunk-2MXBZGUP.js} +2 -2
- package/dist/tsup/{chunk-L4FVS7GY.js → chunk-47IS5ZFI.js} +6 -6
- package/dist/tsup/chunk-47IS5ZFI.js.map +1 -0
- package/dist/tsup/{chunk-DXWOGCZY.js → chunk-5XWY5CBA.js} +70 -8
- package/dist/tsup/chunk-5XWY5CBA.js.map +1 -0
- package/dist/tsup/{chunk-OQEEZDIK.cjs → chunk-6XVNZKKP.cjs} +506 -31
- package/dist/tsup/chunk-6XVNZKKP.cjs.map +1 -0
- package/dist/tsup/{chunk-3YY5S6TV.js → chunk-A2CF6PFH.js} +20 -12
- package/dist/tsup/chunk-A2CF6PFH.js.map +1 -0
- package/dist/tsup/{chunk-WQ4HNA4W.cjs → chunk-AQJFKHBK.cjs} +276 -27
- package/dist/tsup/chunk-AQJFKHBK.cjs.map +1 -0
- package/dist/tsup/chunk-DPWLASMC.cjs +244 -0
- package/dist/tsup/chunk-DPWLASMC.cjs.map +1 -0
- package/dist/tsup/{chunk-VUF2YEF4.cjs → chunk-DYJOU3MF.cjs} +10 -10
- package/dist/tsup/chunk-DYJOU3MF.cjs.map +1 -0
- package/dist/tsup/{chunk-7WXCRV25.cjs → chunk-ELZ6MT3V.cjs} +18 -11
- package/dist/tsup/chunk-ELZ6MT3V.cjs.map +1 -0
- package/dist/tsup/chunk-HYIVSH5X.js +244 -0
- package/dist/tsup/chunk-HYIVSH5X.js.map +1 -0
- package/dist/tsup/{chunk-T6YVRM4K.js → chunk-IHEO5OT3.js} +275 -26
- package/dist/tsup/chunk-IHEO5OT3.js.map +1 -0
- package/dist/tsup/chunk-IWACVNN5.js +14 -0
- package/dist/tsup/chunk-IWACVNN5.js.map +1 -0
- package/dist/tsup/{chunk-PCBNKI2J.js → chunk-JTHHCZCZ.js} +24 -1
- package/dist/tsup/chunk-JTHHCZCZ.js.map +1 -0
- package/dist/tsup/{chunk-V4JUWAT6.js → chunk-K3AJOPSF.js} +498 -23
- package/dist/tsup/chunk-K3AJOPSF.js.map +1 -0
- package/dist/tsup/{chunk-2NDZ7JCR.cjs → chunk-KVFIONKQ.cjs} +25 -2
- package/dist/tsup/chunk-KVFIONKQ.cjs.map +1 -0
- package/dist/tsup/{chunk-QAZLM4WT.cjs → chunk-MGI2VVF6.cjs} +45 -9
- package/dist/tsup/chunk-MGI2VVF6.cjs.map +1 -0
- package/dist/tsup/{chunk-QNLGOTQP.js → chunk-NPHTIUUJ.js} +1291 -420
- package/dist/tsup/chunk-NPHTIUUJ.js.map +1 -0
- package/dist/tsup/{chunk-7GKQJFSB.cjs → chunk-POCSZXPQ.cjs} +72 -10
- package/dist/tsup/chunk-POCSZXPQ.cjs.map +1 -0
- package/dist/tsup/{chunk-LD5YASJU.cjs → chunk-RTWH3AX3.cjs} +19 -11
- package/dist/tsup/chunk-RTWH3AX3.cjs.map +1 -0
- package/dist/tsup/{chunk-ARRBQTAR.cjs → chunk-X76BM5JS.cjs} +1420 -549
- package/dist/tsup/chunk-X76BM5JS.cjs.map +1 -0
- package/dist/tsup/{chunk-AGBP757I.js → chunk-X7SYKFPM.js} +16 -9
- package/dist/tsup/chunk-X7SYKFPM.js.map +1 -0
- package/dist/tsup/{chunk-GKAMEBTZ.cjs → chunk-XLDJSZ3B.cjs} +3 -3
- package/dist/tsup/{chunk-GKAMEBTZ.cjs.map → chunk-XLDJSZ3B.cjs.map} +1 -1
- package/dist/tsup/{chunk-KIWH5H3K.js → chunk-ZOVJDAOW.js} +44 -8
- package/dist/tsup/chunk-ZOVJDAOW.js.map +1 -0
- package/dist/tsup/client/mod.cjs +8 -9
- package/dist/tsup/client/mod.cjs.map +1 -1
- package/dist/tsup/client/mod.d.cts +33 -7
- package/dist/tsup/client/mod.d.ts +33 -7
- package/dist/tsup/client/mod.js +7 -8
- package/dist/tsup/common/log.cjs +5 -3
- package/dist/tsup/common/log.cjs.map +1 -1
- package/dist/tsup/common/log.d.cts +5 -1
- package/dist/tsup/common/log.d.ts +5 -1
- package/dist/tsup/common/log.js +6 -4
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-nlTlOKaE.d.cts → config-BMGUEKMZ.d.cts} +1252 -75
- package/dist/tsup/config-CBTr4IhE.d.cts +224 -0
- package/dist/tsup/config-CBTr4IhE.d.ts +224 -0
- package/dist/tsup/{config-D7ykAntK.d.ts → config-iBpXyITj.d.ts} +1252 -75
- package/dist/tsup/context-hyVakgnU.d.ts +136 -0
- package/dist/tsup/context-qfvLuF0P.d.cts +136 -0
- package/dist/tsup/db/drizzle.cjs +127 -67
- package/dist/tsup/db/drizzle.cjs.map +1 -1
- package/dist/tsup/db/drizzle.d.cts +8 -4
- package/dist/tsup/db/drizzle.d.ts +8 -4
- package/dist/tsup/db/drizzle.js +127 -67
- package/dist/tsup/db/drizzle.js.map +1 -1
- package/dist/tsup/db/mod.cjs +6 -124
- package/dist/tsup/db/mod.cjs.map +1 -1
- package/dist/tsup/db/mod.d.cts +12 -4
- package/dist/tsup/db/mod.d.ts +12 -4
- package/dist/tsup/db/mod.js +5 -123
- package/dist/tsup/db/mod.js.map +1 -1
- package/dist/tsup/dynamic/mod.cjs +24 -0
- package/dist/tsup/dynamic/mod.cjs.map +1 -0
- package/dist/tsup/dynamic/mod.d.cts +39 -0
- package/dist/tsup/dynamic/mod.d.ts +39 -0
- package/dist/tsup/dynamic/mod.js +24 -0
- package/dist/tsup/dynamic/mod.js.map +1 -0
- package/dist/tsup/inspector/mod.cjs +47 -12
- package/dist/tsup/inspector/mod.cjs.map +1 -1
- package/dist/tsup/inspector/mod.d.cts +26 -136
- package/dist/tsup/inspector/mod.d.ts +26 -136
- package/dist/tsup/inspector/mod.js +46 -11
- package/dist/tsup/inspector/mod.js.map +1 -1
- package/dist/tsup/inspector/workflow.cjs +21 -0
- package/dist/tsup/inspector/workflow.cjs.map +1 -0
- package/dist/tsup/inspector/workflow.d.cts +144 -0
- package/dist/tsup/inspector/workflow.d.ts +144 -0
- package/dist/tsup/inspector/workflow.js +21 -0
- package/dist/tsup/inspector/workflow.js.map +1 -0
- package/dist/tsup/inspector-tab/mod.cjs +162 -0
- package/dist/tsup/inspector-tab/mod.cjs.map +1 -0
- package/dist/tsup/inspector-tab/mod.d.cts +242 -0
- package/dist/tsup/inspector-tab/mod.d.ts +242 -0
- package/dist/tsup/inspector-tab/mod.js +162 -0
- package/dist/tsup/inspector-tab/mod.js.map +1 -0
- package/dist/tsup/mod.cjs +3527 -753
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +11 -7
- package/dist/tsup/mod.d.ts +11 -7
- package/dist/tsup/mod.js +3468 -694
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +26 -21
- package/dist/tsup/test/mod.cjs.map +1 -1
- package/dist/tsup/test/mod.d.cts +7 -5
- package/dist/tsup/test/mod.d.ts +7 -5
- package/dist/tsup/test/mod.js +25 -20
- package/dist/tsup/test/mod.js.map +1 -1
- package/dist/tsup/unstable/migrations.cjs +101 -0
- package/dist/tsup/unstable/migrations.cjs.map +1 -0
- package/dist/tsup/unstable/migrations.d.cts +29 -0
- package/dist/tsup/unstable/migrations.d.ts +29 -0
- package/dist/tsup/unstable/migrations.js +101 -0
- package/dist/tsup/unstable/migrations.js.map +1 -0
- package/dist/tsup/{utils-DVekpm4I.d.ts → utils-3rsE0JvI.d.cts} +26 -2
- package/dist/tsup/{utils-DVekpm4I.d.cts → utils-3rsE0JvI.d.ts} +26 -2
- package/dist/tsup/utils-C1O-SklO.d.ts +162 -0
- package/dist/tsup/utils-C6b0aYUM.d.cts +162 -0
- package/dist/tsup/utils.cjs +7 -3
- package/dist/tsup/utils.cjs.map +1 -1
- package/dist/tsup/utils.d.cts +4 -147
- package/dist/tsup/utils.d.ts +4 -147
- package/dist/tsup/utils.js +6 -2
- package/dist/tsup/workflow/mod.cjs +557 -410
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +11 -9
- package/dist/tsup/workflow/mod.d.ts +11 -9
- package/dist/tsup/workflow/mod.js +551 -404
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +67 -18
- package/src/actor/actions.ts +155 -0
- package/src/actor/config.ts +679 -101
- package/src/actor/contexts/index.ts +9 -2
- package/src/actor/definition.ts +75 -26
- package/src/actor/errors.ts +107 -8
- package/src/actor/keys.ts +87 -1
- package/src/actor/mod.ts +36 -20
- package/src/actor/schema.ts +6 -2
- package/src/actor/tracing.ts +28 -0
- package/src/agent-os/index.ts +5 -64
- package/src/client/actor-common.ts +84 -54
- package/src/client/actor-conn.ts +231 -68
- package/src/client/actor-handle.ts +283 -89
- package/src/client/actor-query.ts +13 -6
- package/src/client/auth.ts +37 -0
- package/src/client/client.ts +182 -21
- package/src/client/config.ts +28 -3
- package/src/client/errors.ts +15 -2
- package/src/client/lifecycle-errors.ts +63 -5
- package/src/client/mod.ts +10 -0
- package/src/client/outbound-telemetry.ts +66 -0
- package/src/client/query.ts +3 -1
- package/src/client/queue.ts +13 -3
- package/src/client/raw-utils.ts +59 -14
- package/src/client/resolve-gateway-target.ts +3 -1
- package/src/client/retry-budget.ts +81 -0
- package/src/client/token-provider.ts +93 -0
- package/src/client/utils.ts +22 -9
- package/src/common/actor-router-consts.ts +6 -0
- package/src/common/actor-telemetry-context.ts +19 -0
- package/src/common/actor-websocket.ts +3 -1
- package/src/common/bare/actor-persist/v1.ts +205 -163
- package/src/common/bare/actor-persist/v2.ts +265 -213
- package/src/common/bare/actor-persist/v3.ts +176 -172
- package/src/common/bare/actor-persist/v4.ts +254 -253
- package/src/common/bare/generated/inspector/v5.ts +1016 -0
- package/src/common/bare/generated/inspector/v6.ts +1367 -0
- package/src/common/bare/transport/v1.ts +694 -542
- package/src/common/client-protocol-versioned.ts +66 -64
- package/src/common/database/config.ts +175 -9
- package/src/common/database/mod.ts +262 -77
- package/src/common/database/native-database.ts +442 -20
- package/src/common/database/shared.ts +25 -0
- package/src/common/encoding.ts +278 -34
- package/src/common/engine.ts +28 -1
- package/src/common/eventsource.ts +1 -1
- package/src/common/fetch-like.ts +63 -0
- package/src/common/inline-websocket-adapter.ts +14 -13
- package/src/common/inspector-transport.ts +12 -2
- package/src/common/log.ts +15 -8
- package/src/common/otel-context.ts +99 -0
- package/src/common/router.ts +14 -18
- package/src/common/utils.ts +8 -169
- package/src/common/websocket-interface.ts +1 -1
- package/src/db/drizzle.ts +182 -80
- package/src/db/mod.ts +5 -1
- package/src/devtools-loader/index.ts +4 -7
- package/src/devtools-loader/serve-devtools.ts +26 -0
- package/src/dynamic/instance.ts +32 -0
- package/src/dynamic/internal.ts +50 -0
- package/src/dynamic/isolate-runtime.ts +64 -0
- package/src/dynamic/mod.ts +32 -0
- package/src/engine-api/actors.ts +15 -3
- package/src/engine-client/actor-http-client.ts +37 -22
- package/src/engine-client/actor-websocket-client.ts +37 -9
- package/src/engine-client/api-endpoints.ts +128 -5
- package/src/engine-client/api-utils.ts +2 -2
- package/src/engine-client/driver.ts +21 -16
- package/src/engine-client/mod.ts +280 -111
- package/src/engine-client/ws-proxy.ts +9 -4
- package/src/inspector/client.browser.ts +127 -15
- package/src/inspector/mod.ts +2 -4
- package/src/inspector/workflow.ts +61 -0
- package/src/inspector-tab/mod.ts +301 -0
- package/src/registry/config/envoy.ts +3 -20
- package/src/registry/config/index.ts +91 -74
- package/src/registry/index.ts +702 -80
- package/src/registry/napi-runtime.ts +643 -42
- package/src/registry/native-http.ts +225 -0
- package/src/registry/native-validation.ts +10 -12
- package/src/registry/native.ts +1881 -582
- package/src/registry/run-handler-coordinator.ts +219 -0
- package/src/registry/runtime.ts +441 -7
- package/src/registry/wasm-runtime.ts +516 -23
- package/src/registry/write-through-proxy.ts +141 -0
- package/src/serde.ts +2 -2
- package/src/serverless/configure.ts +18 -7
- package/src/test/mod.ts +2 -17
- package/src/test/ready.ts +22 -0
- package/src/unstable/migrations.ts +141 -0
- package/src/utils/endpoint-parser.ts +1 -1
- package/src/utils/env-vars.ts +50 -2
- package/src/utils/node.ts +44 -28
- package/src/utils/router.ts +1 -1
- package/src/utils.ts +4 -2
- package/src/workflow/context.ts +703 -242
- package/src/workflow/driver.ts +284 -125
- package/src/workflow/inspector.ts +24 -24
- package/src/workflow/mod.ts +76 -84
- package/dist/tsup/chunk-2NDZ7JCR.cjs.map +0 -1
- package/dist/tsup/chunk-3YY5S6TV.js.map +0 -1
- package/dist/tsup/chunk-6NT2LIFN.cjs +0 -268
- package/dist/tsup/chunk-6NT2LIFN.cjs.map +0 -1
- package/dist/tsup/chunk-7GKQJFSB.cjs.map +0 -1
- package/dist/tsup/chunk-7WXCRV25.cjs.map +0 -1
- package/dist/tsup/chunk-AGBP757I.js.map +0 -1
- package/dist/tsup/chunk-ARRBQTAR.cjs.map +0 -1
- package/dist/tsup/chunk-DXWOGCZY.js.map +0 -1
- package/dist/tsup/chunk-JGIPV3QU.js +0 -268
- package/dist/tsup/chunk-JGIPV3QU.js.map +0 -1
- package/dist/tsup/chunk-KIWH5H3K.js.map +0 -1
- package/dist/tsup/chunk-L4FVS7GY.js.map +0 -1
- package/dist/tsup/chunk-LD5YASJU.cjs.map +0 -1
- package/dist/tsup/chunk-OQEEZDIK.cjs.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-QNLGOTQP.js.map +0 -1
- package/dist/tsup/chunk-T6YVRM4K.js.map +0 -1
- package/dist/tsup/chunk-V4JUWAT6.js.map +0 -1
- package/dist/tsup/chunk-VUF2YEF4.cjs.map +0 -1
- package/dist/tsup/chunk-WQ4HNA4W.cjs.map +0 -1
- package/dist/tsup/config-CxjGYf4K.d.cts +0 -121
- package/dist/tsup/config-CxjGYf4K.d.ts +0 -121
- package/dist/tsup/context-88opQsfZ.d.cts +0 -92
- package/dist/tsup/context-CVEG5zfg.d.ts +0 -92
- package/src/actor/driver.ts +0 -141
- package/src/actor/instance/mod.ts +0 -2492
- package/src/actor/keys.test.ts +0 -275
- package/src/actor/utils.test.ts +0 -48
- package/src/agent-os/actor/cron.ts +0 -84
- package/src/agent-os/actor/db.ts +0 -54
- package/src/agent-os/actor/filesystem.ts +0 -131
- package/src/agent-os/actor/index.ts +0 -265
- package/src/agent-os/actor/network.ts +0 -58
- package/src/agent-os/actor/preview.ts +0 -191
- package/src/agent-os/actor/process.ts +0 -177
- package/src/agent-os/actor/session.ts +0 -518
- package/src/agent-os/actor/shell.ts +0 -60
- package/src/agent-os/config.ts +0 -79
- package/src/agent-os/fs/database-vfs.ts +0 -624
- package/src/agent-os/types.ts +0 -148
- package/src/client/test.ts +0 -44
- package/src/common/database/mod.test.ts +0 -137
- package/src/common/database/native-database.test.ts +0 -211
- package/src/common/inline-websocket-adapter.test.ts +0 -51
- package/src/drivers/engine/actor-driver.ts +0 -2460
- package/src/registry/runtime.test.ts +0 -50
- package/src/utils/endpoint-parser.test.ts +0 -206
- package/src/utils/serve.ts +0 -217
- package/src/utils.test.ts +0 -34
- /package/dist/tsup/{chunk-DZJZLZ4R.js.map → chunk-2MXBZGUP.js.map} +0 -0
|
@@ -3,22 +3,25 @@ import * as v1 from "@/common/bare/generated/inspector/v1";
|
|
|
3
3
|
import * as v2 from "@/common/bare/generated/inspector/v2";
|
|
4
4
|
import * as v3 from "@/common/bare/generated/inspector/v3";
|
|
5
5
|
import * as v4 from "@/common/bare/generated/inspector/v4";
|
|
6
|
+
import * as v5 from "@/common/bare/generated/inspector/v5";
|
|
7
|
+
import * as v6 from "@/common/bare/generated/inspector/v6";
|
|
6
8
|
import {
|
|
7
9
|
decodeWorkflowHistoryTransport,
|
|
8
10
|
encodeWorkflowHistoryTransport,
|
|
9
11
|
} from "@/common/inspector-transport";
|
|
10
12
|
|
|
11
|
-
export * from "@/common/bare/generated/inspector/
|
|
13
|
+
export * from "@/common/bare/generated/inspector/v6";
|
|
12
14
|
export { decodeWorkflowHistoryTransport, encodeWorkflowHistoryTransport };
|
|
13
15
|
export type { WorkflowHistory as TransportWorkflowHistory } from "@/common/bare/transport/v1";
|
|
14
16
|
|
|
15
|
-
export const CURRENT_VERSION =
|
|
17
|
+
export const CURRENT_VERSION = 6;
|
|
16
18
|
|
|
17
19
|
const EVENTS_DROPPED_ERROR = "inspector.events_dropped";
|
|
18
20
|
const WORKFLOW_HISTORY_DROPPED_ERROR = "inspector.workflow_history_dropped";
|
|
19
21
|
const QUEUE_DROPPED_ERROR = "inspector.queue_dropped";
|
|
20
22
|
const TRACE_DROPPED_ERROR = "inspector.trace_dropped";
|
|
21
23
|
const DATABASE_DROPPED_ERROR = "inspector.database_dropped";
|
|
24
|
+
const SCHEDULES_DROPPED_ERROR = "inspector.schedules_dropped";
|
|
22
25
|
|
|
23
26
|
const v1ToClientToV2 = (v1Data: v1.ToClient): v2.ToClient => {
|
|
24
27
|
if (v1Data.body.tag === "Init") {
|
|
@@ -156,6 +159,89 @@ const v4ToClientToV3 = (v4Data: v4.ToClient): v3.ToClient => {
|
|
|
156
159
|
return v4Data as unknown as v3.ToClient;
|
|
157
160
|
};
|
|
158
161
|
|
|
162
|
+
const v4ToClientToV5 = (v4Data: v4.ToClient): v5.ToClient => {
|
|
163
|
+
if (v4Data.body.tag === "Init") {
|
|
164
|
+
// A v4 runtime predates tab config in Init; default to an empty list.
|
|
165
|
+
// The client reads that as "no custom tabs" (built-in tabs only).
|
|
166
|
+
const init = v4Data.body.val;
|
|
167
|
+
return {
|
|
168
|
+
body: {
|
|
169
|
+
tag: "Init",
|
|
170
|
+
val: { ...init, tabConfig: [] },
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return v4Data as unknown as v5.ToClient;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const v5ToClientToV4 = (v5Data: v5.ToClient): v4.ToClient => {
|
|
179
|
+
if (v5Data.body.tag === "Init") {
|
|
180
|
+
const { tabConfig: _tabConfig, ...rest } = v5Data.body.val;
|
|
181
|
+
return {
|
|
182
|
+
body: {
|
|
183
|
+
tag: "Init",
|
|
184
|
+
val: rest,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return v5Data as unknown as v4.ToClient;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
const v5ToClientToV6 = (v5Data: v5.ToClient): v6.ToClient => {
|
|
193
|
+
if (v5Data.body.tag === "Init") {
|
|
194
|
+
return {
|
|
195
|
+
body: {
|
|
196
|
+
tag: "Init",
|
|
197
|
+
val: { ...v5Data.body.val, schedules: [] },
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
return v5Data as unknown as v6.ToClient;
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
const v6ToClientToV5 = (v6Data: v6.ToClient): v5.ToClient => {
|
|
205
|
+
if (v6Data.body.tag === "Init") {
|
|
206
|
+
const { schedules: _schedules, ...rest } = v6Data.body.val;
|
|
207
|
+
return { body: { tag: "Init", val: rest } };
|
|
208
|
+
}
|
|
209
|
+
if (
|
|
210
|
+
v6Data.body.tag === "SchedulesUpdated" ||
|
|
211
|
+
v6Data.body.tag === "SchedulesResponse" ||
|
|
212
|
+
v6Data.body.tag === "ScheduleHistoryResponse" ||
|
|
213
|
+
v6Data.body.tag === "ScheduleDeleteResponse"
|
|
214
|
+
) {
|
|
215
|
+
return {
|
|
216
|
+
body: {
|
|
217
|
+
tag: "Error",
|
|
218
|
+
val: { message: SCHEDULES_DROPPED_ERROR },
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
return v6Data as unknown as v5.ToClient;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const v4ToServerToV5 = (v4Data: v4.ToServer): v5.ToServer =>
|
|
226
|
+
v4Data as unknown as v5.ToServer;
|
|
227
|
+
|
|
228
|
+
const v5ToServerToV4 = (v5Data: v5.ToServer): v4.ToServer =>
|
|
229
|
+
v5Data as unknown as v4.ToServer;
|
|
230
|
+
|
|
231
|
+
const v5ToServerToV6 = (v5Data: v5.ToServer): v6.ToServer =>
|
|
232
|
+
v5Data as unknown as v6.ToServer;
|
|
233
|
+
|
|
234
|
+
const v6ToServerToV5 = (v6Data: v6.ToServer): v5.ToServer => {
|
|
235
|
+
if (
|
|
236
|
+
v6Data.body.tag === "SchedulesRequest" ||
|
|
237
|
+
v6Data.body.tag === "ScheduleHistoryRequest" ||
|
|
238
|
+
v6Data.body.tag === "ScheduleDeleteRequest"
|
|
239
|
+
) {
|
|
240
|
+
throw new Error("Cannot convert v6-only schedule requests to v5");
|
|
241
|
+
}
|
|
242
|
+
return v6Data as unknown as v5.ToServer;
|
|
243
|
+
};
|
|
244
|
+
|
|
159
245
|
const v1ToServerToV2 = (v1Data: v1.ToServer): v2.ToServer => {
|
|
160
246
|
if (
|
|
161
247
|
v1Data.body.tag === "EventsRequest" ||
|
|
@@ -198,13 +284,15 @@ const v3ToServerToV4 = (v3Data: v3.ToServer): v4.ToServer =>
|
|
|
198
284
|
|
|
199
285
|
const v4ToServerToV3 = (v4Data: v4.ToServer): v3.ToServer => {
|
|
200
286
|
if (v4Data.body.tag === "WorkflowReplayRequest") {
|
|
201
|
-
throw new Error(
|
|
287
|
+
throw new Error(
|
|
288
|
+
"Cannot convert v4-only workflow replay requests to v3",
|
|
289
|
+
);
|
|
202
290
|
}
|
|
203
291
|
|
|
204
292
|
return v4Data as unknown as v3.ToServer;
|
|
205
293
|
};
|
|
206
294
|
|
|
207
|
-
export const TO_SERVER_VERSIONED = createVersionedDataHandler<
|
|
295
|
+
export const TO_SERVER_VERSIONED = createVersionedDataHandler<v6.ToServer>({
|
|
208
296
|
serializeVersion: (data, version) => {
|
|
209
297
|
switch (version) {
|
|
210
298
|
case 1:
|
|
@@ -214,7 +302,11 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
|
|
|
214
302
|
case 3:
|
|
215
303
|
return v3.encodeToServer(data as unknown as v3.ToServer);
|
|
216
304
|
case 4:
|
|
217
|
-
return v4.encodeToServer(data);
|
|
305
|
+
return v4.encodeToServer(data as unknown as v4.ToServer);
|
|
306
|
+
case 5:
|
|
307
|
+
return v5.encodeToServer(data as unknown as v5.ToServer);
|
|
308
|
+
case 6:
|
|
309
|
+
return v6.encodeToServer(data);
|
|
218
310
|
default:
|
|
219
311
|
throw new Error(`Unknown version ${version}`);
|
|
220
312
|
}
|
|
@@ -222,13 +314,17 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
|
|
|
222
314
|
deserializeVersion: (bytes, version) => {
|
|
223
315
|
switch (version) {
|
|
224
316
|
case 1:
|
|
225
|
-
return v1.decodeToServer(bytes) as unknown as
|
|
317
|
+
return v1.decodeToServer(bytes) as unknown as v5.ToServer;
|
|
226
318
|
case 2:
|
|
227
|
-
return v2.decodeToServer(bytes) as unknown as
|
|
319
|
+
return v2.decodeToServer(bytes) as unknown as v5.ToServer;
|
|
228
320
|
case 3:
|
|
229
|
-
return v3.decodeToServer(bytes) as unknown as
|
|
321
|
+
return v3.decodeToServer(bytes) as unknown as v5.ToServer;
|
|
230
322
|
case 4:
|
|
231
|
-
return v4.decodeToServer(bytes);
|
|
323
|
+
return v4.decodeToServer(bytes) as unknown as v5.ToServer;
|
|
324
|
+
case 5:
|
|
325
|
+
return v5.decodeToServer(bytes) as unknown as v6.ToServer;
|
|
326
|
+
case 6:
|
|
327
|
+
return v6.decodeToServer(bytes);
|
|
232
328
|
default:
|
|
233
329
|
throw new Error(`Unknown version ${version}`);
|
|
234
330
|
}
|
|
@@ -237,15 +333,19 @@ export const TO_SERVER_VERSIONED = createVersionedDataHandler<v4.ToServer>({
|
|
|
237
333
|
v1ToServerToV2,
|
|
238
334
|
v2ToServerToV3,
|
|
239
335
|
v3ToServerToV4,
|
|
336
|
+
v4ToServerToV5,
|
|
337
|
+
v5ToServerToV6,
|
|
240
338
|
],
|
|
241
339
|
serializeConverters: () => [
|
|
340
|
+
v6ToServerToV5,
|
|
341
|
+
v5ToServerToV4,
|
|
242
342
|
v4ToServerToV3,
|
|
243
343
|
v3ToServerToV2,
|
|
244
344
|
v2ToServerToV1,
|
|
245
345
|
],
|
|
246
346
|
});
|
|
247
347
|
|
|
248
|
-
export const TO_CLIENT_VERSIONED = createVersionedDataHandler<
|
|
348
|
+
export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v6.ToClient>({
|
|
249
349
|
serializeVersion: (data, version) => {
|
|
250
350
|
switch (version) {
|
|
251
351
|
case 1:
|
|
@@ -255,7 +355,11 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
|
|
|
255
355
|
case 3:
|
|
256
356
|
return v3.encodeToClient(data as unknown as v3.ToClient);
|
|
257
357
|
case 4:
|
|
258
|
-
return v4.encodeToClient(data);
|
|
358
|
+
return v4.encodeToClient(data as unknown as v4.ToClient);
|
|
359
|
+
case 5:
|
|
360
|
+
return v5.encodeToClient(data as unknown as v5.ToClient);
|
|
361
|
+
case 6:
|
|
362
|
+
return v6.encodeToClient(data);
|
|
259
363
|
default:
|
|
260
364
|
throw new Error(`Unknown version ${version}`);
|
|
261
365
|
}
|
|
@@ -263,13 +367,17 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
|
|
|
263
367
|
deserializeVersion: (bytes, version) => {
|
|
264
368
|
switch (version) {
|
|
265
369
|
case 1:
|
|
266
|
-
return v1.decodeToClient(bytes) as unknown as
|
|
370
|
+
return v1.decodeToClient(bytes) as unknown as v5.ToClient;
|
|
267
371
|
case 2:
|
|
268
|
-
return v2.decodeToClient(bytes) as unknown as
|
|
372
|
+
return v2.decodeToClient(bytes) as unknown as v5.ToClient;
|
|
269
373
|
case 3:
|
|
270
|
-
return v3.decodeToClient(bytes) as unknown as
|
|
374
|
+
return v3.decodeToClient(bytes) as unknown as v5.ToClient;
|
|
271
375
|
case 4:
|
|
272
|
-
return v4.decodeToClient(bytes);
|
|
376
|
+
return v4.decodeToClient(bytes) as unknown as v5.ToClient;
|
|
377
|
+
case 5:
|
|
378
|
+
return v5.decodeToClient(bytes) as unknown as v6.ToClient;
|
|
379
|
+
case 6:
|
|
380
|
+
return v6.decodeToClient(bytes);
|
|
273
381
|
default:
|
|
274
382
|
throw new Error(`Unknown version ${version}`);
|
|
275
383
|
}
|
|
@@ -278,8 +386,12 @@ export const TO_CLIENT_VERSIONED = createVersionedDataHandler<v4.ToClient>({
|
|
|
278
386
|
v1ToClientToV2,
|
|
279
387
|
v2ToClientToV3,
|
|
280
388
|
v3ToClientToV4,
|
|
389
|
+
v4ToClientToV5,
|
|
390
|
+
v5ToClientToV6,
|
|
281
391
|
],
|
|
282
392
|
serializeConverters: () => [
|
|
393
|
+
v6ToClientToV5,
|
|
394
|
+
v5ToClientToV4,
|
|
283
395
|
v4ToClientToV3,
|
|
284
396
|
v3ToClientToV2,
|
|
285
397
|
v2ToClientToV1,
|
package/src/inspector/mod.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export * from "@/common/bare/generated/inspector/
|
|
1
|
+
export * from "@/common/bare/generated/inspector/v5";
|
|
2
|
+
export type { WorkflowHistory as TransportWorkflowHistory } from "@/common/bare/transport/v1";
|
|
2
3
|
export {
|
|
3
4
|
decodeWorkflowHistoryTransport,
|
|
4
5
|
encodeWorkflowHistoryTransport,
|
|
@@ -7,6 +8,3 @@ export {
|
|
|
7
8
|
createWorkflowInspectorAdapter,
|
|
8
9
|
type WorkflowInspectorAdapter,
|
|
9
10
|
} from "@/workflow/inspector";
|
|
10
|
-
export type {
|
|
11
|
-
WorkflowHistory as TransportWorkflowHistory,
|
|
12
|
-
} from "@/common/bare/transport/v1";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { JsonCompatValue } from "@/common/encoding";
|
|
2
|
+
import type { WorkflowHistoryBytes } from "@/common/inspector-transport";
|
|
3
|
+
import { encodeCborCompat } from "@/serde";
|
|
4
|
+
import { bufferToArrayBuffer } from "@/utils";
|
|
5
|
+
|
|
6
|
+
export type {
|
|
7
|
+
WorkflowBranchStatus,
|
|
8
|
+
WorkflowCbor,
|
|
9
|
+
WorkflowEntry,
|
|
10
|
+
WorkflowEntryKind,
|
|
11
|
+
WorkflowEntryMetadata,
|
|
12
|
+
WorkflowHistory,
|
|
13
|
+
WorkflowJoinEntry,
|
|
14
|
+
WorkflowLocation,
|
|
15
|
+
WorkflowLoopEntry,
|
|
16
|
+
WorkflowLoopIterationMarker,
|
|
17
|
+
WorkflowMessageEntry,
|
|
18
|
+
WorkflowNameIndex,
|
|
19
|
+
WorkflowPathSegment,
|
|
20
|
+
WorkflowRaceEntry,
|
|
21
|
+
WorkflowRemovedEntry,
|
|
22
|
+
WorkflowRollbackCheckpointEntry,
|
|
23
|
+
WorkflowSleepEntry,
|
|
24
|
+
WorkflowStepEntry,
|
|
25
|
+
WorkflowVersionCheckEntry,
|
|
26
|
+
} from "@/common/bare/transport/v1";
|
|
27
|
+
export {
|
|
28
|
+
WorkflowBranchStatusType,
|
|
29
|
+
WorkflowEntryStatus,
|
|
30
|
+
WorkflowSleepState,
|
|
31
|
+
} from "@/common/bare/transport/v1";
|
|
32
|
+
export type { WorkflowHistoryBytes } from "@/common/inspector-transport";
|
|
33
|
+
export {
|
|
34
|
+
decodeWorkflowHistoryTransport,
|
|
35
|
+
encodeWorkflowHistoryTransport,
|
|
36
|
+
} from "@/common/inspector-transport";
|
|
37
|
+
|
|
38
|
+
/** @experimental State exposed by a durable workflow run handler to the Inspector. */
|
|
39
|
+
export type WorkflowState =
|
|
40
|
+
| "pending"
|
|
41
|
+
| "running"
|
|
42
|
+
| "sleeping"
|
|
43
|
+
| "failed"
|
|
44
|
+
| "completed"
|
|
45
|
+
| "cancelled"
|
|
46
|
+
| "rolling_back";
|
|
47
|
+
|
|
48
|
+
/** @experimental The raw workflow Inspector adapter consumed by RivetKit's transport. */
|
|
49
|
+
export interface WorkflowInspectorAdapter {
|
|
50
|
+
getHistory: () => WorkflowHistoryBytes | null;
|
|
51
|
+
getState: () => Promise<WorkflowState | null>;
|
|
52
|
+
onHistoryUpdated: (
|
|
53
|
+
listener: (history: WorkflowHistoryBytes) => void,
|
|
54
|
+
) => () => void;
|
|
55
|
+
replayFromStep: (entryId?: string) => Promise<WorkflowHistoryBytes | null>;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** @experimental Encodes a workflow Inspector value with RivetKit's CBOR-compatible codec. */
|
|
59
|
+
export function encodeWorkflowInspectorValue(value: unknown): ArrayBuffer {
|
|
60
|
+
return bufferToArrayBuffer(encodeCborCompat(value as JsonCompatValue));
|
|
61
|
+
}
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type and schema declarations for custom Rivet inspector tabs.
|
|
3
|
+
*
|
|
4
|
+
* Everything here is **derived from runtime Zod schemas** that the
|
|
5
|
+
* dashboard and rivetkit itself use, so the published types cannot
|
|
6
|
+
* drift from the wire format. There are three sources of truth:
|
|
7
|
+
*
|
|
8
|
+
* 1. The `inspector.tabs[]` actor-config Zod schemas in
|
|
9
|
+
* `../actor/config.ts` — re-exported below. These validate the
|
|
10
|
+
* authoring surface (`defineActor({ inspector: { tabs: [...] } })`).
|
|
11
|
+
* 2. The dashboard ↔ tab postMessage envelopes defined in this file.
|
|
12
|
+
* The inspector-ui SPA (`frontend/apps/inspector-ui/src/bridge.ts`)
|
|
13
|
+
* imports the same schemas to validate messages at runtime, so any
|
|
14
|
+
* change here lands on both ends in lockstep.
|
|
15
|
+
* 3. The inspector HTTP endpoint response schemas defined in this
|
|
16
|
+
* file. The dashboard parses every response through them; if the
|
|
17
|
+
* Rust handler ever emits a different shape, the dashboard fails
|
|
18
|
+
* loudly at the parse step instead of silently casting `unknown`.
|
|
19
|
+
*
|
|
20
|
+
* Tab bundles import these types for autocomplete and compile-time
|
|
21
|
+
* safety:
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* import type {
|
|
25
|
+
* ShellToTabMessage,
|
|
26
|
+
* TabToShellMessage,
|
|
27
|
+
* V1Init,
|
|
28
|
+
* InspectorStateResponse,
|
|
29
|
+
* } from "rivetkit/inspector-tab";
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
import { z } from "zod";
|
|
34
|
+
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Re-exported from `../actor/config.ts` — the authoring schema for
|
|
37
|
+
// `defineActor({ inspector: { tabs: [...] } })`.
|
|
38
|
+
// ============================================================================
|
|
39
|
+
|
|
40
|
+
export type { ActorInspectorConfig } from "../actor/config";
|
|
41
|
+
export {
|
|
42
|
+
ActorInspectorConfigSchema,
|
|
43
|
+
BUILTIN_INSPECTOR_TAB_IDS,
|
|
44
|
+
BuiltinInspectorTabIdSchema,
|
|
45
|
+
CustomInspectorTabEntrySchema,
|
|
46
|
+
HideInspectorTabEntrySchema,
|
|
47
|
+
InspectorTabEntrySchema,
|
|
48
|
+
} from "../actor/config";
|
|
49
|
+
|
|
50
|
+
import type {
|
|
51
|
+
CustomInspectorTabEntrySchema,
|
|
52
|
+
HideInspectorTabEntrySchema,
|
|
53
|
+
InspectorTabEntrySchema,
|
|
54
|
+
} from "../actor/config";
|
|
55
|
+
|
|
56
|
+
/** One entry in the actor's `inspector.tabs[]` declaration. */
|
|
57
|
+
export type ActorInspectorTabEntry = z.input<typeof InspectorTabEntrySchema>;
|
|
58
|
+
/** A custom-tab entry — adds a new tab to the dashboard strip. */
|
|
59
|
+
export type ActorCustomInspectorTabEntry = z.input<
|
|
60
|
+
typeof CustomInspectorTabEntrySchema
|
|
61
|
+
>;
|
|
62
|
+
/** A hide modifier — removes a built-in tab from the strip. */
|
|
63
|
+
export type ActorHideInspectorTabEntry = z.input<
|
|
64
|
+
typeof HideInspectorTabEntrySchema
|
|
65
|
+
>;
|
|
66
|
+
/** Union of the six built-in inspector tab ids. */
|
|
67
|
+
export type BuiltinInspectorTabId =
|
|
68
|
+
| "workflow"
|
|
69
|
+
| "database"
|
|
70
|
+
| "state"
|
|
71
|
+
| "queue"
|
|
72
|
+
| "schedules"
|
|
73
|
+
| "connections"
|
|
74
|
+
| "console";
|
|
75
|
+
|
|
76
|
+
// ============================================================================
|
|
77
|
+
// Dashboard ↔ tab postMessage envelope (source of truth).
|
|
78
|
+
//
|
|
79
|
+
// These Zod schemas are imported by `frontend/apps/inspector-ui/src/bridge.ts`
|
|
80
|
+
// and used to validate inbound messages at runtime. Changes here flow to
|
|
81
|
+
// both sides in a single commit.
|
|
82
|
+
// ============================================================================
|
|
83
|
+
|
|
84
|
+
/** Public tab descriptor that crosses the dashboard ↔ inspector-ui bridge. */
|
|
85
|
+
export const InspectorTabDescriptorSchema = z.object({
|
|
86
|
+
id: z.string(),
|
|
87
|
+
label: z.string(),
|
|
88
|
+
icon: z.string(),
|
|
89
|
+
/**
|
|
90
|
+
* `true` for author-shipped custom tabs; absent or `false` for
|
|
91
|
+
* built-in tabs the SPA renders. Lets the dashboard route the
|
|
92
|
+
* iframe `src` to `/inspector/custom-tabs/<id>/` for custom tabs and
|
|
93
|
+
* `/inspector/ui/` for built-ins without the dashboard needing to
|
|
94
|
+
* know which ids are built-in.
|
|
95
|
+
*/
|
|
96
|
+
isCustom: z.boolean().optional(),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Initial handshake from the dashboard. Sent on first mount and again on
|
|
101
|
+
* every token refresh. Tabs MUST accept late `init` messages and replace
|
|
102
|
+
* the cached token.
|
|
103
|
+
*/
|
|
104
|
+
export const V1InitSchema = z.object({
|
|
105
|
+
type: z.literal("init"),
|
|
106
|
+
v: z.literal(1),
|
|
107
|
+
/** The actor this tab is mounted for. */
|
|
108
|
+
actorId: z.string(),
|
|
109
|
+
/**
|
|
110
|
+
* Per-actor inspector bearer token. Tabs include it as
|
|
111
|
+
* `Authorization: Bearer ${authToken}` on every authenticated fetch.
|
|
112
|
+
*/
|
|
113
|
+
authToken: z.string(),
|
|
114
|
+
/**
|
|
115
|
+
* Outer Rivet API token. Optional; not required for inspector HTTP
|
|
116
|
+
* routes but available to tabs that want to call the engine REST API.
|
|
117
|
+
*/
|
|
118
|
+
rivetToken: z.string().optional(),
|
|
119
|
+
/**
|
|
120
|
+
* The tab id the dashboard wants active at mount time. Multi-view
|
|
121
|
+
* tabs may read this to seed their initial route; most tabs ignore it.
|
|
122
|
+
*/
|
|
123
|
+
activeTab: z.string().optional(),
|
|
124
|
+
/**
|
|
125
|
+
* Dashboard's currently active theme. Tabs that use the shared
|
|
126
|
+
* stylesheet (`/inspector/tab.css`) mirror it by toggling the `dark`
|
|
127
|
+
* class on `<html>`. Optional for backwards compatibility — tabs
|
|
128
|
+
* should default to `"dark"` if absent (the dashboard pinned dark
|
|
129
|
+
* mode before this field was added).
|
|
130
|
+
*/
|
|
131
|
+
theme: z.enum(["light", "dark"]).optional(),
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Dashboard tells the inspector-ui SPA which built-in tab to render. Not
|
|
136
|
+
* sent to custom tabs — when the user activates a custom tab the
|
|
137
|
+
* dashboard navigates the outer iframe to a different `src`.
|
|
138
|
+
*/
|
|
139
|
+
export const V1SetActiveTabSchema = z.object({
|
|
140
|
+
type: z.literal("set-active-tab"),
|
|
141
|
+
v: z.literal(1),
|
|
142
|
+
tab: z.string(),
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Tab → dashboard. Sent once after the message listener is registered.
|
|
147
|
+
* The dashboard hides the "Connecting to inspector…" overlay on receipt;
|
|
148
|
+
* if it never arrives the overlay times out after 8 s.
|
|
149
|
+
*/
|
|
150
|
+
export const V1ReadySchema = z.object({
|
|
151
|
+
type: z.literal("ready"),
|
|
152
|
+
v: z.literal(1),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Tab → dashboard. Sent when the tab gets a 401 on an inspector data
|
|
157
|
+
* call. The dashboard refreshes the token and re-issues `v1Init`.
|
|
158
|
+
*/
|
|
159
|
+
export const V1TokenRefreshNeededSchema = z.object({
|
|
160
|
+
type: z.literal("token-refresh-needed"),
|
|
161
|
+
v: z.literal(1),
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Emitted by the inspector-ui SPA to tell the dashboard which tabs to
|
|
166
|
+
* render in the strip. Custom tab bundles do NOT emit this — only the
|
|
167
|
+
* SPA does.
|
|
168
|
+
*/
|
|
169
|
+
export const V1TabsAvailableSchema = z.object({
|
|
170
|
+
type: z.literal("tabs-available"),
|
|
171
|
+
v: z.literal(1),
|
|
172
|
+
tabs: z.array(InspectorTabDescriptorSchema),
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
/** Discriminated union of messages a tab can RECEIVE from the dashboard. */
|
|
176
|
+
export const ShellToTabMessageSchema = z.discriminatedUnion("type", [
|
|
177
|
+
V1InitSchema,
|
|
178
|
+
V1SetActiveTabSchema,
|
|
179
|
+
]);
|
|
180
|
+
|
|
181
|
+
/** Discriminated union of messages a tab can SEND to the dashboard. */
|
|
182
|
+
export const TabToShellMessageSchema = z.discriminatedUnion("type", [
|
|
183
|
+
V1ReadySchema,
|
|
184
|
+
V1TabsAvailableSchema,
|
|
185
|
+
V1TokenRefreshNeededSchema,
|
|
186
|
+
]);
|
|
187
|
+
|
|
188
|
+
export type InspectorTabDescriptor = z.infer<
|
|
189
|
+
typeof InspectorTabDescriptorSchema
|
|
190
|
+
>;
|
|
191
|
+
export type V1Init = z.infer<typeof V1InitSchema>;
|
|
192
|
+
export type V1SetActiveTab = z.infer<typeof V1SetActiveTabSchema>;
|
|
193
|
+
export type V1Ready = z.infer<typeof V1ReadySchema>;
|
|
194
|
+
export type V1TokenRefreshNeeded = z.infer<typeof V1TokenRefreshNeededSchema>;
|
|
195
|
+
export type V1TabsAvailable = z.infer<typeof V1TabsAvailableSchema>;
|
|
196
|
+
export type ShellToTabMessage = z.infer<typeof ShellToTabMessageSchema>;
|
|
197
|
+
export type TabToShellMessage = z.infer<typeof TabToShellMessageSchema>;
|
|
198
|
+
|
|
199
|
+
/** Stable envelope protocol version. Bump only when introducing a v2 shape. */
|
|
200
|
+
export const POSTMESSAGE_PROTOCOL_VERSION = 1;
|
|
201
|
+
|
|
202
|
+
/** URL query parameters the dashboard sets on the tab iframe `src`. */
|
|
203
|
+
export const SHELL_ORIGIN_PARAM = "shellOrigin";
|
|
204
|
+
export const ACTOR_ID_PARAM = "actorId";
|
|
205
|
+
|
|
206
|
+
// ============================================================================
|
|
207
|
+
// Inspector HTTP endpoint response schemas (source of truth).
|
|
208
|
+
//
|
|
209
|
+
// The dashboard parses every authenticated inspector response through
|
|
210
|
+
// these schemas (`frontend/src/components/actors/actor-inspector-context.tsx`).
|
|
211
|
+
// If the Rust handler emits a different shape the parse fails and the
|
|
212
|
+
// dashboard surfaces an error — drift is loud.
|
|
213
|
+
// ============================================================================
|
|
214
|
+
|
|
215
|
+
/** `GET /inspector/state` response shape. */
|
|
216
|
+
export const InspectorStateResponseSchema = z.object({
|
|
217
|
+
/** Current actor state (whatever shape the actor declared). */
|
|
218
|
+
state: z.unknown(),
|
|
219
|
+
/**
|
|
220
|
+
* `false` when the actor did not declare any state — `state` is then
|
|
221
|
+
* `null` and `PATCH /inspector/state` returns an error.
|
|
222
|
+
*/
|
|
223
|
+
isStateEnabled: z.boolean(),
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
/** `POST /inspector/action/<name>` request body. */
|
|
227
|
+
export const InspectorActionRequestSchema = z
|
|
228
|
+
.object({
|
|
229
|
+
/** Positional arguments. Mutually exclusive with `properties`. */
|
|
230
|
+
args: z.array(z.unknown()).optional(),
|
|
231
|
+
/** Keyed arguments. Mutually exclusive with `args`. */
|
|
232
|
+
properties: z.record(z.string(), z.unknown()).optional(),
|
|
233
|
+
})
|
|
234
|
+
.refine(
|
|
235
|
+
(body) => !(body.args !== undefined && body.properties !== undefined),
|
|
236
|
+
"Use either `args` or `properties`, not both",
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
/** `POST /inspector/action/<name>` response shape. */
|
|
240
|
+
export const InspectorActionResponseSchema = z.object({
|
|
241
|
+
output: z.unknown(),
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
/** `GET /inspector/rpcs` response shape — the list of action names. */
|
|
245
|
+
export const InspectorRpcsResponseSchema = z.object({
|
|
246
|
+
rpcs: z.array(z.string()),
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
/** One connection record in `GET /inspector/connections`. */
|
|
250
|
+
export const InspectorConnectionSchema = z.object({
|
|
251
|
+
connectionType: z.string().nullable(),
|
|
252
|
+
id: z.string(),
|
|
253
|
+
details: z.object({
|
|
254
|
+
connectionType: z.string().nullable(),
|
|
255
|
+
params: z.unknown(),
|
|
256
|
+
stateEnabled: z.boolean(),
|
|
257
|
+
state: z.unknown(),
|
|
258
|
+
subscriptions: z.number(),
|
|
259
|
+
isHibernatable: z.boolean(),
|
|
260
|
+
}),
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
/** `GET /inspector/connections` response shape. */
|
|
264
|
+
export const InspectorConnectionsResponseSchema = z.object({
|
|
265
|
+
connections: z.array(InspectorConnectionSchema),
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
/** One queued message in `GET /inspector/queue`. */
|
|
269
|
+
export const InspectorQueueMessageSchema = z.object({
|
|
270
|
+
id: z.string(),
|
|
271
|
+
name: z.string(),
|
|
272
|
+
createdAtMs: z.number(),
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
/** `GET /inspector/queue` response shape. */
|
|
276
|
+
export const InspectorQueueResponseSchema = z.object({
|
|
277
|
+
size: z.number(),
|
|
278
|
+
maxSize: z.number(),
|
|
279
|
+
/** `true` if `?limit=N` truncated the message list below `size`. */
|
|
280
|
+
truncated: z.boolean(),
|
|
281
|
+
messages: z.array(InspectorQueueMessageSchema),
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
export type InspectorStateResponse = z.infer<
|
|
285
|
+
typeof InspectorStateResponseSchema
|
|
286
|
+
>;
|
|
287
|
+
export type InspectorActionRequest = z.infer<
|
|
288
|
+
typeof InspectorActionRequestSchema
|
|
289
|
+
>;
|
|
290
|
+
export type InspectorActionResponse = z.infer<
|
|
291
|
+
typeof InspectorActionResponseSchema
|
|
292
|
+
>;
|
|
293
|
+
export type InspectorRpcsResponse = z.infer<typeof InspectorRpcsResponseSchema>;
|
|
294
|
+
export type InspectorConnection = z.infer<typeof InspectorConnectionSchema>;
|
|
295
|
+
export type InspectorConnectionsResponse = z.infer<
|
|
296
|
+
typeof InspectorConnectionsResponseSchema
|
|
297
|
+
>;
|
|
298
|
+
export type InspectorQueueMessage = z.infer<typeof InspectorQueueMessageSchema>;
|
|
299
|
+
export type InspectorQueueResponse = z.infer<
|
|
300
|
+
typeof InspectorQueueResponseSchema
|
|
301
|
+
>;
|
|
@@ -1,34 +1,17 @@
|
|
|
1
1
|
import { z } from "zod/v4";
|
|
2
|
-
import { getLogger } from "@/common/log";
|
|
3
2
|
import {
|
|
4
|
-
|
|
5
|
-
getNodeEnv,
|
|
3
|
+
getRivetEnvoyVersion,
|
|
6
4
|
getRivetPool,
|
|
7
5
|
getRivetTotalSlots,
|
|
8
|
-
getRivetEnvoyVersion,
|
|
9
6
|
} from "@/utils/env-vars";
|
|
10
7
|
|
|
11
|
-
let warnedMissingVersion = false;
|
|
12
|
-
|
|
13
8
|
export const EnvoyConfigSchema = z.object({
|
|
14
9
|
poolName: z.string().default(() => getRivetPool() ?? "default"),
|
|
15
|
-
version: z.number().default(() =>
|
|
16
|
-
const version = getRivetEnvoyVersion();
|
|
17
|
-
if (version !== undefined) return version;
|
|
18
|
-
|
|
19
|
-
if (getNodeEnv() === "production" && !warnedMissingVersion) {
|
|
20
|
-
warnedMissingVersion = true;
|
|
21
|
-
getLogger("rivetkit").error(
|
|
22
|
-
"RIVET_ENVOY_VERSION is not set. Actors will not be versioned, which means they won't be drained on deploy. This is only needed when self-hosting or using a custom envoy (not needed for Rivet Compute). Set this as a build arg in your Dockerfile. See https://rivet.dev/docs/actors/versions",
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return 1;
|
|
27
|
-
}),
|
|
10
|
+
version: z.number().default(() => getRivetEnvoyVersion() ?? 1),
|
|
28
11
|
|
|
29
12
|
// Deprecated.
|
|
30
13
|
totalSlots: z.number().default(() => getRivetTotalSlots() ?? 100000),
|
|
31
|
-
|
|
14
|
+
nodeKey: z.string().optional(),
|
|
32
15
|
});
|
|
33
16
|
export type EnvoyConfigInput = z.input<typeof EnvoyConfigSchema>;
|
|
34
17
|
export type EnvoyConfig = z.infer<typeof EnvoyConfigSchema>;
|