oficina / docs Public
Delegated Docs access
This branch adds docs_list, docs_get, docs_create and docs_update to the shared Oficina connection. The same operation contracts serve the Oficina CLI, Paseo, ChatGPT and Claude through the connection service. They require a configured Home identity link to an existing local account and current document permission. Addressless Home-only people retain browser access but are not supported by this initial agent adapter.
Set DOCS_AGENT_ISSUER to the connection service HTTPS origin and DOCS_AGENT_TEAM to the instance team. Both are required together with the existing Home configuration. In team mode the team must match its provisioned binding. The verifier expects this app's exact origin plus /api/v1 as audience and the configured Home issuer as identity authority. Browser login and native routes retain their existing guards.
Export deployment contracts with go run ./cmd/docs-contract. The protected endpoints are GET /api/v1/operations and POST /api/v1/operations/{name}. App credentials come from the connection service; cookies and personal browser sessions do not authenticate this API.
Create requires activated content sealing and a nonzero canonical UUID client_id. Supply a title and up to 200 literal paragraph/heading blocks, with 128 KiB of text total. Paragraphs have type: paragraph and text; headings have type: heading, text and level from 1 to 6. Reuse the UUID only to retry the identical initial content. A successful response contains the document ID, URL and current body revision; read content separately with docs_get.
Get returns text and ProseMirror JSON from the same replay, with a decimal body_revision string. Responses are capped at 1 MiB. List uses 20 items by default, up to 100, and returns an opaque next_cursor.
Update requires docs:write and current document write permission. Pass {team,id,client_id,expected_revision,edits}: copy expected_revision exactly from the last get's body_revision. Each edit is {index,delete_count,blocks}, using zero-based positions in content.content. Use 1–32 nonoverlapping edits in descending index order, all referring to that original body. Insert/delete at most 200 blocks and insert at most 128 KiB of literal paragraph/heading text. Other structures keep their positions and must remain untouched; this operation refuses to flatten them. Keep at least one block, using an empty paragraph if needed.
The edit response is {id,url,revision}, where revision is the originally applied body sequence even on retries. Retry the exact request with the same UUID after an interrupted response; later browser edits are never overwritten by a retry. A new stale edit returns 409 with no changes: read again and submit fresh edits with a new UUID. Title-only changes do not change the body revision. Editing pending/incompletely received CRDT history is refused until its missing updates arrive. Sharing, export, comments, title edits and deletion remain outside these delegated operations.
The receipt marker binds the Home key, Home issuer, connection issuer and team. Changing any requires an explicit operator migration; never erase receipt state to make retries appear new. Enabling access does not activate or convert legacy content storage. All content writes use the existing sealed collaborative core.
See the reviewed design in the agent access spec. This branch is not a claim of deployment or live client certification.
October 30 compatibility: this branch includes main's one-way adoption of Docs links into home_identity_links. Use the normal boot migration; never restore the retired tables or deploy the October 25 binary over a migrated store. Agent admission, writer checks and response chunks use the shared keyed binding resolver. Completed retries repeat final authority checks. In team mode, docs_list returns 503 while standing is Unknown because its schema has no partial-result indicator; docs_get can still read an explicit share.