Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
← Public packages

@kody/rooms

Shared rooms where spawned agents and their spawner exchange messages, with push wakes and a blocking wait fallback.

FollowForkOpen app

Files

prompt-section.ts

22 lines · 1002 B · TypeScript
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 }) }
	})
}