Apps that read, and published pages
How an app reads live workspace data, and how the owner publishes an app's files as a page.
Both features can be switched off on a workspace. When one is off, its endpoints answer exactly as an unknown path does, so a client can't tell a switched-off endpoint from one that doesn't exist.
Apps read live data
A core.app.v1 record can declare what it reads:
{ "reads": { "kinds": ["core.task.record.v1"], "threads": [] } }The declaration is checked when the app is saved. A bad one is 422 APP_READS_INVALID {field, reason}. The rules:
kindsis an exact list of the record kinds the app may read. Account, keyring, private, connection, run, workspace-settings, assistant-memory and site kinds can never be read by an app.- Built-in system threads (
th_site*,th_alerts, and the like) can never be read by an app. - Each thread must be one the person saving the app can read.
- A new version of an app can't widen
readsunless it is saved by the same person as the current version, or by the owner. Aventure updatethat widens an app'sreadsis refused withUPDATE_WIDENING_NOT_ACCEPTEDunless you accept the change. - Package apps declare kinds only.
POST /v1/apps/{app_id}/read (feature flag apps_read, scope records:read) returns only what the viewer is allowed to read and what the app's current version declares in reads.
| Status | Code | Meaning |
|---|---|---|
404 | APP_NOT_FOUND | One answer for an unknown, unreachable or hidden app. |
404 | APP_HAS_NO_READS | The app declares no reads. |
403 | APP_READ_UNDECLARED | The request names something the app didn't declare. |
A read by ID of anything missing, unreachable or undeclared answers {record: null}. An answer holds at most 200 rows and 1 MiB, with read.truncated {at, next} when it is cut short. The next cursor works only for the same viewer, app and filter. A read through an app counts as the viewer's own read: the owner's GET /v1/reads lists it with reader_kind: app, app:<id>, and app {id, title}, via and for_name.
An app receives the actor ids of the records it reads, exactly as POST /v1/records/query would serve them to that viewer.
Suggested wording to show people:
APP_READS_INVALID: "This app's list of what it reads has a problem, so it wasn't saved." followed by the reason line.APP_NOT_FOUND: "This app isn't available to you."APP_READ_UNDECLARED: "This app tried to read something it didn't say it would, so nothing was read."APP_HAS_NO_READS: "This app doesn't read anything." (never shown on screen; the command line and developers only)
Publishing pages
The owner can publish an app's files as a page at the workspace's own address. The sites feature flag turns this on.
core.app.v1has aslug, the label in the page's address, set by the owner. Only one app can hold a slug.POST /v1/sites/proposeraises a publish proposal (proposal.proposes: "publish"). The owner's yes atPOST /v1/decisions/{id}/decidesettles it. The proposal is tied to{site, version, manifest_digest}and is checked again when accepted.GET /v1/siteslists published sites.POST /v1/sites/unpublishandPOST /v1/sites/checkedfinish the set.- A page's history lives on a thread named
th_site_<label>, which only the workspace itself can write to. A client write to any thread whose id startsth_site_is403 SITE_THREAD_KERNEL_ONLY. Use a different thread name for your own records. - Records:
core.site.publish.v1,core.site.publish_result.v1,core.site.purge.v1(written by the workspace) andcore.site.checked.v1(written by the owner). Only the owner can read them. - A file's first write also writes a
core.data.revision.v1(prev_hash: null) naming its writer. An older file uploaded without one can't be published and answersSITE_FILE_NOT_OWNERS. Re-save the file, then publish it. - A site file removed by an erase is served as
{path: null, sha256: null, removed_by_erase: true}everywhere, to the owner too. - Settings:
SPL_SITES_DOOR_URL(the address of the publishing service) andSITES_RECEIPT_PUBLIC_KEY(normally fetched fromGET /v1/sites/keys).
A file that only certain people can read is never published (SITE_SOURCE_PRIVATE).
Known limits: if two apps claim one address after an import, the older claim wins. The assistant can't publish; only the owner can propose a publish.
Suggested wording to show people for each code:
SITE_THREAD_KERNEL_ONLY: "Only the workspace itself writes a page's history, so this wasn't saved."SITE_FILE_NOT_OWNERS: "That file wasn't added by the owner, so it can't go on a page."SITE_SOURCE_PRIVATE: "Only some people can read that file, so it can't go on a page."SITE_PUBLISH_STALE: "The files changed since this was asked, or it was asked more than a day ago, so nothing was published. Ask again."
See also
- Reads, budgets and cursors: the read rules apps follow.
- API reference: the other endpoints.
- Release notes: what changed in each release.
Reads, budgets and cursors
What a read costs the server, the refusals it can answer, how counts and page cursors behave, and which callers can filter on which fields.
Body kinds
Reference for the built-in `body.kind` values you can subscribe to and query, written during dispatch, inference, work loops, and sharing.