← Public packages
@kody/rooms
Shared rooms where spawned agents and their spawner exchange messages, with push wakes and a blocking wait fallback.
Files
import { createInvites } from '../core/rooms.ts'
import { handle, params } from '../runtime.ts'
import { actor, roomAuthFields } from './shared.ts'
/**
* Mint more one-time join codes (creator only). Each expires after
* `caps.inviteTtlHours` (24 h by default) and works once.
*
* @param input.room - Room id.
* @param input.token - Creator token (optional when you are the creating Kody user).
* @param input.count - Codes to mint (default 1).
* @param input.nameHint - Label stored with the invite (not shown to the joiner).
* @returns `{ status: 'ok', invites: [{ code, expiresAt }] }`
* @example
* import invite from 'kody:@kody/rooms/invite'
* const { invites } = await invite({ room: 'room_…', count: 1 })
*/
export default async function invite(input: unknown) {
return handle(async () => {
const p = params(input, [...roomAuthFields, 'count', 'nameHint'])
const { ctx, room, member } = await actor(p)
const invites = await createInvites(ctx, room, member, { count: p.count as number | undefined, nameHint: p.nameHint as string | null })
return { status: 'ok' as const, roomId: room.id, invites }
})
}