Something went wrong. Try again.
small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334// Rules for editing a message this client sent while it still waits in the// session's queue. The transcript runs the requests; these decide what they mean.
/** * The daemon's answer for a message it no longer holds: read or cancelled * (`input_not_waiting`, from hold and edit), or gone from the queue * (`queue_item_not_found`, from a cancel). */export function isNotWaiting(error: unknown): boolean { const code = (error as { code?: unknown } | null)?.code; return code === 'input_not_waiting' || code === 'queue_item_not_found';}
/** When to renew a hold: a third of its lease, never more often than once a second. */export function renewalDelay(leaseMs: number): number { return Math.max(1000, Math.floor(leaseMs / 3));}
/** A send this client can edit or cancel: accepted by the daemon and still in the queue. */export function waitingSend( send: | { id: string; accepted?: boolean; continuation?: boolean; error?: string } | undefined, queued: readonly { id: string }[],): boolean { return ( !!send && !!send.accepted && !send.continuation && !send.error && queued.some((item) => item.id === send.id) );}