import type { InboxItem } from "@earendil-works/pi-durable"; import { imageSummary } from "@berry/api/images.ts"; import { api } from "./client.ts"; import { json, keyed, type Scope } from "./ui.ts"; import { event } from "./event.tsx"; // the order the harness places them in: every write at the next boundary, a steer at each boundary from there, and // the follow-ups once the run ends, each in the order they were queued const PLACED: Record = { write: 0, steer: 1, followUp: 2 }; /** Queued submissions retain their editors until the submission leaves the inbox. */ export function inbox(scope: Scope, tid: string) { const element =
as HTMLElement; const rows = keyed(element, (item: InboxItem) => item.id, (initial) => { const mode = ( {initial.mode === "write" ? "pending" : initial.mode === "followUp" ? "follow-up" : initial.mode} ); if (initial.mode === "write") { const content = initial.entry.kind === "berry.event" ? event(initial.entry.data) : (
{typeof initial.entry.kind === "string" ? initial.entry.kind : "event"}
{json(initial.entry)}
); return { node: , }; } let item = initial; let editing = false; let pending = false; let disposed = false; const content = as HTMLElement; const images = as HTMLElement; const error =