import { buildPromptSection } from '../core/prompts.ts' import { roomStatus } from '../core/rooms.ts' import { handle, params } from '../runtime.ts' import { actor, roomAuthFields } from './shared.ts' /** * The prompt section alone (no invite minted). Safe to log: env var names only. * * @param input.room - Room id. * @param input.token - Any member token (optional for the creating Kody user). * @returns `{ status: 'ok', id, promptSection }` * @example * import promptSection from 'kody:@kody/rooms/prompt-section' * const { promptSection: text } = await promptSection({ room: 'room_…' }) */ export default async function promptSection(input: unknown) { return handle(async () => { const { ctx, room } = await actor(params(input, roomAuthFields)) const { room: info } = await roomStatus(ctx, room, null) return { status: 'ok' as const, id: room.id, promptSection: buildPromptSection({ roomId: room.id, appUrl: info.appUrl, purpose: info.purpose, viewUrl: info.viewUrl }) } }) }