← Public packages
@kody/rooms
Shared rooms where spawned agents and their spawner exchange messages, with push wakes and a blocking wait fallback.
Files
import { cleanupRooms } from '../core/rooms.ts'
import { handle, kodyCtx, params } from '../runtime.ts'
/**
* Delete rooms past retention. Off by default: unless `settings({ cleanup: { enabled: true } })`
* was set, this is always a dry run. Defaults keep closed rooms 365 days and never delete open ones.
*
* @param input.dryRun - Default true. Pass false (with cleanup enabled) to delete.
* @returns `{ status: 'ok', dryRun, enabled, roomIds, deleted }`
* @example
* import cleanup from 'kody:@kody/rooms/cleanup'
* const preview = await cleanup({})
*/
export default async function cleanup(input: unknown) {
return handle(async () => {
const p = params(input, ['dryRun'])
return cleanupRooms(kodyCtx(), { dryRun: p.dryRun as boolean | undefined })
})
}