M8: agent API server. Spec §12.3.
HTTP/JSON server exposing the same operations as the CLI. The server
is stateful (it owns a Store instance) so agents don't pay sandbox
startup cost per request.
Endpoints:
POST /v1/parse { source } → CanonicalAst | [SyntaxError]
POST /v1/check { source } → { ok: true } | [TypeError]
POST /v1/publish { source, activate? } → [{ stage_id, sig_id, status }]
GET /v1/stage/ → { metadata, ast, status }
GET /v1/stage//attestations → { attestations: [Attestation] }
POST /v1/run { source, fn, args, policy } → { run_id, output | error }
GET /v1/trace/<run_id> → TraceTree
POST /v1/replay { source, fn, args, policy, overrides } → { run_id, output | error }
GET /v1/diff?a=&b= → Divergence | { divergence: null }
POST /v1/merge/start { src_branch, dst_branch } → { merge_id, conflicts, ... }
POST /v1/merge//resolve { resolutions: [...] } → { verdicts, remaining_conflicts }
POST /v1/merge//commit → { new_head_op, dst_branch } | 422 conflicts remaining
POST /v1/ops/batch [OperationRecord] → { received, added, skipped, added_ids }
POST /v1/attestations/batch [Attestation] → { received, added, skipped, added_ids }
GET /v1/branches//head → { branch, head_op } (probe for lex op push)
GET /v1/health → { ok: true }
Web (lex-tea v2, read-only HTML; human-only audit + triage): GET / → activity stream (recent attestations) GET /web/attention → exceptions queue (Failed / Inconclusive, stale merge sessions) GET /web/trust → per-producer rollup (pass rate, latest failure) GET /web/branches → branch list GET /web/branch/ → fns on a branch (detail) GET /web/stage/ → stage info + attestation trail (detail)