oficina / sheets Public

Clone
git clone https://amadan.net/oficina/sheets

Plain git — no account needed to clone.

Download

Download this file

1# Delegated Sheets access
2
3The Oficina connection exposes `sheets_list`, `sheets_list_tabs`,
4`sheets_get_range`, `sheets_create` and `sheets_set_range`. CLI, Paseo, ChatGPT and Claude use the
5same contracts. Existing Home links and current app permissions are required.
6
7Set `SHEETS_AGENT_ISSUER` to the HTTPS connection-service origin and
8`SHEETS_AGENT_TEAM` to this instance's team, alongside existing Home settings.
9Both settings are required together. Credentials must target this app's exact
10origin plus `/api/v1` and name the configured Home identity issuer.
11
12Export contracts with `go run ./cmd/sheets-contract`. The bearer endpoints are
13`GET /api/v1/operations` and `POST /api/v1/operations/{name}`. The connection
14service obtains app credentials; browser cookies do not authenticate them.
15Read operations require `sheets:read`; create requires `sheets:write` and current
16team membership. Explicitly granted guests can read their permitted sheets. In roster team mode,
17creation uses current Home membership; stored local roles do not grant standing.
18The configured agent team must match the provisioned roster team. Full lists
19return a retryable failure when roster authority is unavailable, while exact
20items independently shared with the caller remain readable. This initial API
21requires an existing Home-linked local account.
22
23IDs, revisions and pagination cursors are decimal JSON strings. IDs must be
24positive, canonical and at most 9223372036854775807. Omit the cursor on the first
25page. Sheet listing descends by ID; tab listing ascends. Both default to 20
26items and permit at most 100.
27
28Create accepts a nonzero canonical UUID `client_id`, a title and `tab_name`
29(up to 200 Unicode characters each), and `cells` containing up to 500 distinct
30`row`, `column`, `raw` entries. Coordinates are zero-based: rows 0–4999 and
31columns 0–599. Raw cell input is at most 8 KiB and uses the browser's formula
32parser and calculator. The entire sheet, first tab, owner grant, initial cells,
33sealed attribution and receipt commit together. Create returns sheet/tab IDs,
34a browser URL and current revision; reuse the UUID only for an identical retry.
35A retry preserves intervening browser edits and never recreates a deleted sheet.
36
37Range reads return raw input, calculated value/type, default display text and a
38coherent revision for at most 500 cells. Incomplete calculation is an explicit
39failure. Inputs and encoded responses are capped at 1 MiB; oversized results
40fail without truncation. Formula error values are returned as cell errors.
41The revision is the store's next-stamp watermark, shared with range reads.
42
43The receipt marker binds the Home key, Home issuer, connection issuer and team.
44Changes require an explicit operator migration. Never delete the marker or
45receipts to make old requests appear new. Creation does not send invitations.
46Formatting, additional tabs, comments, sharing and import/export remain
47separate capability slices.
48
49See [the reviewed specification](superpowers/specs/2026-10-25-agent-access.md).
50This branch does not claim deployment or live client certification.
51
52`sheets_set_range` requires `team`, `sheet_id`, `tab_id`, `expected_revision`,
53`client_id` and an ordered `cells` array of 1–500 `{row,column,raw}` entries.
54Read a range first and copy its revision string into `expected_revision`.
55The native batch updates exactly those cells, recalculates formulas atomically
56and blanks a cell when raw is empty. Current editor permission is required;
57an independent editor share works under the same roster rules as browser edits.
58
59A stale revision returns `conflict` without changing cells. After an uncertain
60response, repeat the same UUID, revision and ordered cell values. The response
61contains sheet/tab IDs, URL and the original **applied** revision, even when
62later edits advanced the tab. It never replays the cell writes; read again for
63current values and revision. Choose a new UUID for a changed edit.
64