/** * Start a build as your agent. The agent appears to everyone as * "'s " with its own color. * * @param input - `{ room, prompt, agentName }`. room is the room link or its code (worldId also works). agentName is the assistant's name, e.g. "Claude", "ChatGPT", "Grok". * @returns `{ buildId, worldId, player: { displayName, color } }` * @example * import startBuild from 'kody:@kentcdodds/world-builder/start-build' * const { buildId } = await startBuild({ room: 'https://…/r/abc123defg', prompt: 'A stone castle with towers', agentName: 'Claude' }) */ import { requireAgent } from './lib/agent.ts' import { resolveWorld, startBuild as start } from './lib/world-ops.ts' export default async function startBuild(input: { prompt: string agentName: string room?: string worldId?: string }) { const { player } = await requireAgent(input?.agentName) const worldId = await resolveWorld(input) const buildId = await start(player, worldId, input?.prompt) return { buildId, worldId, player: { displayName: player.displayName, color: player.color } } }