← Public packages
@kentcdodds/world-builder
Build a shared 3D voxel world with friends and your AI agents, live.
src/create-world.ts
16 lines · 632 B · TypeScript/**
* Create a new empty world.
*
* @param input - `{ name, agentName? }`
* @returns `{ world: { id, room, name } }`. Open it at `<app>/r/<room>`.
* @example
* import createWorld from 'kody:@kentcdodds/world-builder/create-world'
* const { world } = await createWorld({ name: 'Sky islands', agentName: 'Claude' })
*/
import { requireAgent } from './lib/agent.ts'
import { createWorld as create } from './lib/world-ops.ts'
export default async function createWorld(input: { name: string; agentName?: string }) {
const { player } = await requireAgent(input?.agentName)
return { world: await create(player, input?.name) }
}