Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 2992423

Browse files
committed
refactor: studio -> inspector
1 parent 28bfa65 commit 2992423

File tree

12 files changed

+50
-50
lines changed

12 files changed

+50
-50
lines changed

examples/next-js/src/app/api/registry/[...all]/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const server = registry.createServer({
66
// It should match the path in your Next.js API route
77
// For example, if your API route is at /api/registry/[...all], this should be "/api/registry"
88
basePath: "/api/registry",
9-
studio: {
10-
// Tell RivetKit Studio where to find RivetKit Registry
9+
inspector: {
10+
// Tell RivetKit Inspector where to find RivetKit Registry
1111
defaultEndpoint: "http://localhost:3000/api/registry",
1212
},
1313
});

packages/core/src/actor/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export function createActorRouter(
235235
}
236236
});
237237

238-
if (runConfig.studio.enabled) {
238+
if (runConfig.inspector.enabled) {
239239
router.route(
240240
"/inspect",
241241
new Hono<ActorInspectorRouterEnv & { Bindings: ActorRouterBindings }>()

packages/core/src/driver-test-suite/mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export async function createTestRuntime(
157157
const config: RunConfig = RunConfigSchema.parse({
158158
driver,
159159
getUpgradeWebSocket: () => upgradeWebSocket!,
160-
studio: {
160+
inspector: {
161161
enabled: true,
162162
token: () => "token",
163163
},

packages/core/src/drivers/engine/actor-driver.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class EngineActorDriver implements ActorDriver {
8585
runnerName: config.runnerName,
8686
runnerKey: config.runnerKey,
8787
metadata: {
88-
inspectorToken: this.#runConfig.studio.token(),
88+
inspectorToken: this.#runConfig.inspector.token(),
8989
},
9090
prepopulateActorNames: Object.fromEntries(
9191
Object.keys(this.#registryConfig.use).map((name) => [

packages/core/src/drivers/engine/manager-driver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ export class EngineManagerDriver implements ManagerDriver {
4040
constructor(config: Config, runConfig: RunConfig) {
4141
this.#config = config;
4242
this.#runConfig = runConfig;
43-
if (!this.#runConfig.studio.token()) {
43+
if (!this.#runConfig.inspector.token()) {
4444
const token = generateRandomString();
45-
this.#runConfig.studio.token = () => token;
45+
this.#runConfig.inspector.token = () => token;
4646
}
4747
this.#importWebSocketPromise = importWebSocket();
4848
}

packages/core/src/drivers/file-system/manager.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ export class FileSystemManagerDriver implements ManagerDriver {
5454
this.#state = state;
5555
this.#driverConfig = driverConfig;
5656

57-
if (runConfig.studio.enabled) {
58-
if (!this.#runConfig.studio.token()) {
59-
this.#runConfig.studio.token = () =>
57+
if (runConfig.inspector.enabled) {
58+
if (!this.#runConfig.inspector.token()) {
59+
this.#runConfig.inspector.token = () =>
6060
this.#state.getOrCreateInspectorAccessToken();
6161
}
6262
const startedAt = new Date().toISOString();

packages/core/src/inspector/config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getEnvUniversal } from "@/utils";
66
type CorsOptions = NonNullable<Parameters<typeof cors>[0]>;
77

88
const defaultTokenFn = () => {
9-
const envToken = getEnvUniversal("RIVETKIT_STUDIO_TOKEN");
9+
const envToken = getEnvUniversal("RIVETKIT_INSPECTOR_TOKEN");
1010

1111
if (envToken) {
1212
return envToken;
@@ -18,19 +18,19 @@ const defaultTokenFn = () => {
1818
const defaultEnabled = () => {
1919
return (
2020
getEnvUniversal("NODE_ENV") !== "production" ||
21-
!getEnvUniversal("RIVETKIT_STUDIO_DISABLE")
21+
!getEnvUniversal("RIVETKIT_INSPECTOR_DISABLE")
2222
);
2323
};
2424

25-
const defaultStudioOrigins = [
25+
const defaultInspectorOrigins = [
2626
"http://localhost:43708",
2727
"https://studio.rivet.gg",
2828
];
2929

3030
const defaultCors: CorsOptions = {
3131
origin: (origin) => {
3232
if (
33-
defaultStudioOrigins.includes(origin) ||
33+
defaultInspectorOrigins.includes(origin) ||
3434
(origin.startsWith("https://") && origin.endsWith("rivet-gg.vercel.app"))
3535
) {
3636
return origin;
@@ -59,7 +59,7 @@ export const InspectorConfigSchema = z
5959
.default(() => defaultCors),
6060

6161
/**
62-
* Token used to access the Studio.
62+
* Token used to access the Inspector.
6363
*/
6464
token: z
6565
.function()
@@ -68,9 +68,9 @@ export const InspectorConfigSchema = z
6868
.default(() => defaultTokenFn),
6969

7070
/**
71-
* Default RivetKit server endpoint for Rivet Studio to connect to. This should be the same endpoint as what you use for your Rivet client to connect to RivetKit.
71+
* Default RivetKit server endpoint for Rivet Inspector to connect to. This should be the same endpoint as what you use for your Rivet client to connect to RivetKit.
7272
*
73-
* This is a convenience property just for printing out the studio URL.
73+
* This is a convenience property just for printing out the inspector URL.
7474
*/
7575
defaultEndpoint: z.string().optional(),
7676
})

packages/core/src/inspector/utils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function compareSecrets(providedSecret: string, validSecret: string) {
2828

2929
export const secureInspector = (runConfig: RunConfig) =>
3030
createMiddleware(async (c, next) => {
31-
if (!runConfig.studio.enabled) {
31+
if (!runConfig.inspector.enabled) {
3232
return c.text("Inspector is not enabled", 503);
3333
}
3434

@@ -37,7 +37,7 @@ export const secureInspector = (runConfig: RunConfig) =>
3737
return c.text("Unauthorized", 401);
3838
}
3939

40-
const inspectorToken = runConfig.studio.token?.();
40+
const inspectorToken = runConfig.inspector.token?.();
4141
if (!inspectorToken) {
4242
return c.text("Unauthorized", 401);
4343
}
@@ -50,16 +50,16 @@ export const secureInspector = (runConfig: RunConfig) =>
5050
await next();
5151
});
5252

53-
export function getStudioUrl(runConfig: RunConfigInput | undefined) {
54-
if (!runConfig?.studio?.enabled) {
53+
export function getInspectorUrl(runConfig: RunConfigInput | undefined) {
54+
if (!runConfig?.inspector?.enabled) {
5555
return "disabled";
5656
}
5757

58-
const accessToken = runConfig?.studio?.token?.();
58+
const accessToken = runConfig?.inspector?.token?.();
5959

6060
if (!accessToken) {
6161
inspectorLogger().warn(
62-
"Studio Token is not set, but Studio is enabled. Please set it in the run configuration `inspector.token` or via `RIVETKIT_STUDIO_TOKEN` environment variable. Studio will not be accessible.",
62+
"Inspector Token is not set, but Inspector is enabled. Please set it in the run configuration `inspector.token` or via `RIVETKIT_INSPECTOR_TOKEN` environment variable. Inspector will not be accessible.",
6363
);
6464
return "disabled";
6565
}
@@ -68,8 +68,8 @@ export function getStudioUrl(runConfig: RunConfigInput | undefined) {
6868

6969
url.searchParams.set("t", accessToken);
7070

71-
if (runConfig?.studio?.defaultEndpoint) {
72-
url.searchParams.set("u", runConfig.studio.defaultEndpoint);
71+
if (runConfig?.inspector?.defaultEndpoint) {
72+
url.searchParams.set("u", runConfig.inspector.defaultEndpoint);
7373
}
7474

7575
return url.href;

packages/core/src/manager/router.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function createManagerRouter(
160160

161161
router.use("*", loggerMiddleware(logger()));
162162

163-
if (runConfig.cors || runConfig.studio?.cors) {
163+
if (runConfig.cors || runConfig.inspector?.cors) {
164164
router.use("*", async (c, next) => {
165165
// Don't apply to WebSocket routes
166166
// HACK: This could be insecure if we had a varargs path. We have to check the path suffix for WS since we don't know the path that this router was mounted.
@@ -179,19 +179,19 @@ export function createManagerRouter(
179179

180180
return cors({
181181
...(runConfig.cors ?? {}),
182-
...(runConfig.studio?.cors ?? {}),
182+
...(runConfig.inspector?.cors ?? {}),
183183
origin: (origin, c) => {
184-
const studioOrigin = runConfig.studio?.cors?.origin;
184+
const inspectorOrigin = runConfig.inspector?.cors?.origin;
185185

186-
if (studioOrigin !== undefined) {
187-
if (typeof studioOrigin === "function") {
188-
const allowed = studioOrigin(origin, c);
186+
if (inspectorOrigin !== undefined) {
187+
if (typeof inspectorOrigin === "function") {
188+
const allowed = inspectorOrigin(origin, c);
189189
if (allowed) return allowed;
190190
// Proceed to next CORS config if none provided
191-
} else if (Array.isArray(studioOrigin)) {
192-
return studioOrigin.includes(origin) ? origin : undefined;
191+
} else if (Array.isArray(inspectorOrigin)) {
192+
return inspectorOrigin.includes(origin) ? origin : undefined;
193193
} else {
194-
return studioOrigin;
194+
return inspectorOrigin;
195195
}
196196
}
197197

@@ -207,12 +207,12 @@ export function createManagerRouter(
207207
return null;
208208
},
209209
allowMethods: (origin, c) => {
210-
const studioMethods = runConfig.studio?.cors?.allowMethods;
211-
if (studioMethods) {
212-
if (typeof studioMethods === "function") {
213-
return studioMethods(origin, c);
210+
const inspectorMethods = runConfig.inspector?.cors?.allowMethods;
211+
if (inspectorMethods) {
212+
if (typeof inspectorMethods === "function") {
213+
return inspectorMethods(origin, c);
214214
}
215-
return studioMethods;
215+
return inspectorMethods;
216216
}
217217

218218
if (runConfig.cors?.allowMethods) {
@@ -226,14 +226,14 @@ export function createManagerRouter(
226226
},
227227
allowHeaders: [
228228
...(runConfig.cors?.allowHeaders ?? []),
229-
...(runConfig.studio?.cors?.allowHeaders ?? []),
229+
...(runConfig.inspector?.cors?.allowHeaders ?? []),
230230
...ALLOWED_PUBLIC_HEADERS,
231231
"Content-Type",
232232
"User-Agent",
233233
],
234234
credentials:
235235
runConfig.cors?.credentials ??
236-
runConfig.studio?.cors?.credentials ??
236+
runConfig.inspector?.cors?.credentials ??
237237
true,
238238
})(c, next);
239239
});
@@ -562,12 +562,12 @@ export function createManagerRouter(
562562
});
563563
}
564564

565-
if (runConfig.studio?.enabled) {
565+
if (runConfig.inspector?.enabled) {
566566
router.route(
567567
"/actors/inspect",
568568
new Hono()
569569
.use(
570-
cors(runConfig.studio.cors),
570+
cors(runConfig.inspector.cors),
571571
secureInspector(runConfig),
572572
universalActorProxy({
573573
registryConfig,
@@ -584,7 +584,7 @@ export function createManagerRouter(
584584
"/inspect",
585585
new Hono()
586586
.use(
587-
cors(runConfig.studio.cors),
587+
cors(runConfig.inspector.cors),
588588
secureInspector(runConfig),
589589
async (c, next) => {
590590
const inspector = managerDriver.inspector;

packages/core/src/registry/mod.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { createActorRouter } from "@/actor/router";
33
import { type Client, createClientWithDriver } from "@/client/client";
44
import { chooseDefaultDriver } from "@/drivers/default";
55
import { createInlineClientDriver } from "@/inline-client-driver/mod";
6-
import { getStudioUrl } from "@/inspector/utils";
6+
import { getInspectorUrl } from "@/inspector/utils";
77
import { createManagerRouter } from "@/manager/router";
88
import {
99
type RegistryActors,
@@ -73,9 +73,9 @@ export class Registry<A extends RegistryActors> {
7373
definitions: Object.keys(this.#config.use).length,
7474
...driverLog,
7575
});
76-
if (config.studio?.enabled) {
77-
logger().info("studio ready", {
78-
url: getStudioUrl(config),
76+
if (config.inspector?.enabled) {
77+
logger().info("inspector ready", {
78+
url: getInspectorUrl(config),
7979
});
8080
}
8181

0 commit comments

Comments
 (0)