Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/counter-serverless/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { registry } from "./registry";

registry.start({
runnerKind: "serverless",
runEngine: true,
autoConfigureServerless: true,
autoConfigureServerless: { url: "http://localhost:8080" },
endpoint: "http://localhost:6420",
});
9 changes: 8 additions & 1 deletion packages/rivetkit/src/common/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
getRequestEncoding,
getRequestExposeInternalError,
} from "@/actor/router-endpoints";
import { buildActorNames, type RegistryConfig } from "@/registry/config";
import type { RunnerConfig } from "@/registry/run-config";
import { getEndpoint } from "@/remote-manager-driver/api-utils";
import { HttpResponseError } from "@/schemas/client-protocol/mod";
Expand Down Expand Up @@ -93,6 +94,7 @@ export interface MetadataResponse {
| { serverless: Record<never, never> }
| { normal: Record<never, never> };
};
actorNames: ReturnType<typeof buildActorNames>;
/**
* Endpoint that the client should connect to to access this runner.
*
Expand All @@ -105,7 +107,11 @@ export interface MetadataResponse {
clientEndpoint?: string;
}

export function handleMetadataRequest(c: HonoContext, runConfig: RunnerConfig) {
export function handleMetadataRequest(
c: HonoContext,
registryConfig: RegistryConfig,
runConfig: RunnerConfig,
) {
const response: MetadataResponse = {
runtime: "rivetkit",
version: VERSION,
Expand All @@ -115,6 +121,7 @@ export function handleMetadataRequest(c: HonoContext, runConfig: RunnerConfig) {
? { serverless: {} }
: { normal: {} },
},
actorNames: buildActorNames(registryConfig),
// Do not return client endpoint if default server disabled
clientEndpoint:
runConfig.overrideServerAddress ??
Expand Down
9 changes: 2 additions & 7 deletions packages/rivetkit/src/drivers/engine/actor-driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
type ManagerDriver,
serializeEmptyPersistData,
} from "@/driver-helpers/mod";
import type { RegistryConfig } from "@/registry/config";
import { buildActorNames, type RegistryConfig } from "@/registry/config";
import type { RunnerConfig } from "@/registry/run-config";
import { getEndpoint } from "@/remote-manager-driver/api-utils";
import {
Expand Down Expand Up @@ -103,12 +103,7 @@ export class EngineActorDriver implements ActorDriver {
metadata: {
inspectorToken: this.#runConfig.inspector.token(),
},
prepopulateActorNames: Object.fromEntries(
Object.keys(this.#registryConfig.use).map((name) => [
name,
{ metadata: {} },
]),
),
prepopulateActorNames: buildActorNames(registryConfig),
onConnected: () => {
if (hasDisconnected) {
logger().info({
Expand Down
8 changes: 6 additions & 2 deletions packages/rivetkit/src/manager/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ function addServerlessRoutes(

router.get("/health", (c) => handleHealthRequest(c));

router.get("/metadata", (c) => handleMetadataRequest(c, runConfig));
router.get("/metadata", (c) =>
handleMetadataRequest(c, registryConfig, runConfig),
);
}

function addManagerRoutes(
Expand Down Expand Up @@ -643,7 +645,9 @@ function addManagerRoutes(

router.get("/health", (c) => handleHealthRequest(c));

router.get("/metadata", (c) => handleMetadataRequest(c, runConfig));
router.get("/metadata", (c) =>
handleMetadataRequest(c, registryConfig, runConfig),
);

managerDriver.modifyManagerRouter?.(
registryConfig,
Expand Down
8 changes: 8 additions & 0 deletions packages/rivetkit/src/registry/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ export type RegistryConfigInput<A extends RegistryActors> = Omit<
z.input<typeof RegistryConfigSchema>,
"use"
> & { use: A };

export function buildActorNames(
registryConfig: RegistryConfig,
): Record<string, { metadata: Record<string, any> }> {
return Object.fromEntries(
Object.keys(registryConfig.use).map((name) => [name, { metadata: {} }]),
);
}
Loading