diff --git a/rivetkit-typescript/packages/rivetkit/src/manager-api/actors.ts b/rivetkit-typescript/packages/rivetkit/src/manager-api/actors.ts index 8bdbdce334..aed3dac11d 100644 --- a/rivetkit-typescript/packages/rivetkit/src/manager-api/actors.ts +++ b/rivetkit-typescript/packages/rivetkit/src/manager-api/actors.ts @@ -15,6 +15,11 @@ export const ActorSchema = z.object({ }); export type Actor = z.infer; +export const ActorNameSchema = z.object({ + metadata: z.record(z.string(), z.unknown()), +}); +export type ActorName = z.infer; + // MARK: GET /actors export const ActorsListResponseSchema = z.object({ actors: z.array(ActorSchema), @@ -61,3 +66,11 @@ export type ActorsGetOrCreateResponse = z.infer< // MARK: DELETE /actors/{} export const ActorsDeleteResponseSchema = z.object({}); export type ActorsDeleteResponse = z.infer; + +// MARK: GET /actors/names +export const ActorsListNamesResponseSchema = z.object({ + names: z.record(z.string(), ActorNameSchema), +}); +export type ActorsListNamesResponse = z.infer< + typeof ActorsListNamesResponseSchema +>; diff --git a/rivetkit-typescript/packages/rivetkit/src/manager/router.ts b/rivetkit-typescript/packages/rivetkit/src/manager/router.ts index d6c4c455b4..6d1613697a 100644 --- a/rivetkit-typescript/packages/rivetkit/src/manager/router.ts +++ b/rivetkit-typescript/packages/rivetkit/src/manager/router.ts @@ -46,12 +46,14 @@ import { ActorsGetOrCreateRequestSchema, type ActorsGetOrCreateResponse, ActorsGetOrCreateResponseSchema, + type ActorsListNamesResponse, + ActorsListNamesResponseSchema, type ActorsListResponse, ActorsListResponseSchema, type Actor as ApiActor, } from "@/manager-api/actors"; import type { AnyClient } from "@/mod"; -import type { RegistryConfig } from "@/registry/config"; +import { buildActorNames, type RegistryConfig } from "@/registry/config"; import type { DriverConfig, RunnerConfig } from "@/registry/run-config"; import type { ActorOutput, ManagerDriver } from "./driver"; import { actorGateway, createTestWebSocketProxy } from "./gateway"; @@ -369,6 +371,27 @@ function addManagerRoutes( }); } + // GET /actors/names + { + const route = createRoute({ + method: "get", + path: "/actors/names", + request: { + query: z.object({ + namespace: z.string(), + }), + }, + responses: buildOpenApiResponses(ActorsListNamesResponseSchema), + }); + + router.openapi(route, async (c) => { + const names = buildActorNames(registryConfig); + return c.json({ + names, + }); + }); + } + // PUT /actors { const route = createRoute({