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

Commit a42b9c3

Browse files
committed
refactor: studio -> inspector (#1185)
### TL;DR Renamed all references from `studio` to `inspector` in the codebase to maintain consistent terminology. ### What changed? - Renamed the `studio` property to `inspector` in the `RunConfig` schema - Updated all references to this property throughout the codebase - Changed environment variable names from `RIVETKIT_STUDIO_TOKEN` to `RIVETKIT_INSPECTOR_TOKEN` and `RIVETKIT_STUDIO_DISABLE` to `RIVETKIT_INSPECTOR_DISABLE` - Renamed `getStudioUrl` function to `getInspectorUrl` - Updated log messages and comments to use "inspector" instead of "studio" - Renamed `defaultStudioOrigins` to `defaultInspectorOrigins` ### How to test? 1. Ensure the inspector functionality works correctly after the rename 2. Verify that environment variables using the new `RIVETKIT_INSPECTOR_*` naming pattern work as expected 3. Check that the inspector URL is correctly generated and displayed in logs 4. Confirm that CORS settings are properly applied for inspector endpoints ### Why make this change? This change standardizes terminology across the codebase by consistently using "inspector" instead of "studio". This improves code clarity, reduces confusion, and ensures that all references to this feature use the same naming convention. The rename aligns the code with the actual functionality being provided, which is an inspection tool rather than a studio.
1 parent 5c1019f commit a42b9c3

File tree

14 files changed

+71
-65
lines changed

14 files changed

+71
-65
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/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
"on-change": "^5.0.1",
168168
"p-retry": "^6.2.1",
169169
"zod": "^3.25.76",
170-
"@rivetkit/engine-runner": "https://pkg.pr.new/rivet-gg/engine/@rivetkit/engine-runner@4b0f765"
170+
"@rivetkit/engine-runner": "https://pkg.pr.new/rivet-gg/engine/@rivetkit/engine-runner@21dd4b4"
171171
},
172172
"devDependencies": {
173173
"@hono/node-server": "^1.18.2",

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 & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,11 @@ export class EngineActorDriver implements ActorDriver {
8080
endpoint: config.endpoint,
8181
pegboardEndpoint: config.pegboardEndpoint,
8282
namespace: config.namespace,
83-
addresses: config.addresses,
8483
totalSlots: config.totalSlots,
8584
runnerName: config.runnerName,
8685
runnerKey: config.runnerKey,
8786
metadata: {
88-
inspectorToken: this.#runConfig.studio.token(),
87+
inspectorToken: this.#runConfig.inspector.token(),
8988
},
9089
prepopulateActorNames: Object.fromEntries(
9190
Object.keys(this.#registryConfig.use).map((name) => [

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

Lines changed: 4 additions & 4 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
}
@@ -365,7 +365,7 @@ function buildGuardHeadersForHttp(
365365
// Add guard-specific headers
366366
headers.set("x-rivet-target", "actor");
367367
headers.set("x-rivet-actor", actorId);
368-
headers.set("x-rivet-addr", "main");
368+
headers.set("x-rivet-port", "main");
369369
return headers;
370370
}
371371

@@ -378,7 +378,7 @@ function buildGuardHeadersForWebSocket(
378378
const headers: Record<string, string> = {};
379379
headers["x-rivet-target"] = "actor";
380380
headers["x-rivet-actor"] = actorId;
381-
headers["x-rivet-addr"] = "main";
381+
headers["x-rivet-port"] = "main";
382382
headers[HEADER_EXPOSE_INTERNAL_ERROR] = "true";
383383
headers[HEADER_ENCODING] = encoding;
384384
if (params) {

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;

0 commit comments

Comments
 (0)