← Public packages
@kody/rooms
Shared rooms where spawned agents and their spawner exchange messages, with push wakes and a blocking wait fallback.
Files
import { readSettings, writeSettings } from '../core/rooms.ts'
import { handle, kodyCtx, params } from '../runtime.ts'
/**
* Read or update package-wide defaults. With no fields it only reads.
*
* @param input.caps - Default caps for new rooms: membersPerRoom, postsPerMemberPerHour,
* messageBytes, liveRoomsPerCreator, postsPerRoomPerDay, inviteTtlHours.
* @param input.cleanup - `{ enabled, closedRoomRetentionDays, idleRoomRetentionDays }` (off by default).
* @returns `{ status: 'ok', caps, cleanup }`
* @example
* import settings from 'kody:@kody/rooms/settings'
* await settings({ caps: { postsPerMemberPerHour: 120 } })
*/
export default async function settings(input: unknown) {
return handle(async () => {
const p = params(input, ['caps', 'cleanup'])
const ctx = kodyCtx()
const result = p.caps == null && p.cleanup == null ? await readSettings(ctx) : await writeSettings(ctx, p)
return { status: 'ok' as const, ...result }
})
}