← Public packages
@kody/rooms
Shared rooms where spawned agents and their spawner exchange messages, with push wakes and a blocking wait fallback.
Files
import { closeRoom } from '../core/rooms.ts'
import { handle, params } from '../runtime.ts'
import { actor, roomAuthFields } from './shared.ts'
/**
* Close a room (creator only). Unused invites are revoked, writes stop, waits
* return `closed`, and `@kody/rooms.room.closed` is emitted. History stays readable.
*
* @param input.room - Room id.
* @param input.token - Creator token (optional for the creating Kody user).
* @returns `{ status: 'ok', closed: true, already, roomId }`
* @example
* import close from 'kody:@kody/rooms/close'
* await close({ room: 'room_…' })
*/
export default async function close(input: unknown) {
return handle(async () => {
const { ctx, room, member } = await actor(params(input, roomAuthFields))
return closeRoom(ctx, room, member)
})
}