small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo docs http-api-design.md
108 kB · 1,792 lines
Markdown

# HTTP API design Status: implemented contract for daemon protocol 3. [openapi.yaml](openapi.yaml) owns the exact request, response, parameter, header, and SSE payload shapes. This document owns behavior: ordering, atomicity, retry, recovery, and resource ownership. Both documents must agree. The OpenAPI version is a document-format version; daemon protocol 3 is a separate compatibility decision. [API architecture](http-api-architecture.md) explains state ownership and settings crash recovery. This document defines daemon protocol 3. The daemon and CLI use this contract together. It defines no compatibility aliases or legacy response readers. Changes to this contract require an update here, a client impact review, and behavioral tests before implementation. The API serves terminal, web, and desktop clients. All current TUI features remain available. Installation discovery, local launch, and the interactive restart offer remain application policy, outside the API connection. The [resource map](#resource-map) lists routes. The [HTTP rules](#http-rules) define authentication, errors, and retries. [Sessions](#sessions-and-durable-input) and [SSE](#sse-delivery-and-recovery) define chat and recovery. [Extension contracts](#extension-contracts) define optional domain operations. The [feature checklist](#existing-feature-coverage) and [behavioral verification](#verification) describe the supported workflows. ## Design decisions - Resources own their data and operations. A screen does not get its own route. - A session read includes the state needed to open a chat. A collection read includes the state needed to browse sessions or draw an agent family. - Ordinary HTTP requests perform changes. SSE delivers live updates. - JSON and SSE use the same session resource URL, selected by `Accept`. - Input IDs identify user intent across retries. Stream cursors identify an actor lifetime and position. Transcript checkpoints identify durable history. These identities are separate. - Core operations have named, typed …