import type { TRPCRootObject } from '@trpc/server/unstable-core-do-not-import'
import { getAgentFactories } from '../lib/get-agent-factories'
import { getRootPath } from '../lib/get-root-path'
import type { TrpcContext } from '../lib/trpc-context'

export function createRolePlayRouter(t: TRPCRootObject<TrpcContext, any, any>) {
	return t.router({
		list: t.procedure.query(async () => {
			const rootPath = await getRootPath()
			const agentFactories = await getAgentFactories(rootPath)
			return Object.keys(agentFactories.factories)
		})
	})
}
