reference

Data structures

Leaf's state is JSON: the reading the server sends a page's browser, the events a page's log records, and the records Leaf keeps beside the log. Each table below lists one structure's fields with their types, whether each is required, and what it means.

The tables are generated from the schemas Leaf validates and tests against, so they change when the code does. An event kind's meaning is written once, in Events and threads, which each kind below links to. How the pieces fit together is on How it works.

Served state

The page's runtime reads the state from GET /api/state. The definitions at the end of this section are the JSON answers to its posts; a user-view or interaction post answers with no body. leaf page state prints a selection of the same reading.

GET /api/state

The answer GET /api/state serves a page's runtime, which the POST /api/event answer carries as state and leaf.page publishes as /_leaf/state/*.json: Reading, which served_state.page.read_served_page composes, with what the serving route adds. Leaf alone writes it, so nothing validates it in flight; the tests validate real readings against this schema, and the browser build generates its type from it (build/browser/contract-types.mjs) and holds it to the schema pages vendored at the current protocol read (build/browser/protocol.mjs). leaf:event refers to any kernel event record, leaf:event/<kind> to one kind's and leaf:verb to an x-state verb, as registry.schema.leaf_resources composes them; an object here adding served fields to an event record closes it again with unevaluatedProperties.

Type: Reading.

FieldTypeRequiredDescription
othersarray of objectyesThe machine's other live pages, each its compact row (server_rows.py), named by page_key and linked by url (presence.other_leaves). A row is open: a neighbor's Leaf may publish fields this one ignores. An export holds none.
others[].page_keystringyes
others[].urlstringyes
others[].titlestringyes
others[].session_cwdstring or nullyes
others[].activityobjectyes
readingstringyesThe news token of the facts this answer read (served_state.reading), which the tab's freshness reads compare.
leafProvenanceThe Leaf serving the page, as layer.payload_provenance reads it, sent only where it is another than the one that vendored the page.
releasestringThe leaf.page release that served the page.

Reading

One page's state as served_state.page.read_served_page composes it from one transaction, before the serving route adds its neighbors and token. Before the page has an active revision, active and browser are null.

FieldTypeRequiredDescription
layerobjectyesThe identity of the layer the shown revision was read under, or the vendored layer's before a revision exists (layer-registry.md). A layer another Leaf at this protocol vendored may carry more.
layer.generationstringyes
layer.fingerprintstringyes
layer.serverstring
layer.packagesarray of string
layer.producerProvenance
nowstringyesThe server clock used to calibrate browser timestamps and relative ages; a laptop an hour out would otherwise date new comments an hour out too. An edge host refreshes this and taken together at delivery; captured event timestamps and already-folded activity keep their original dates.
working_grace_msintegeryesHow long working may go unheard before it reads as quiet, measured on the now clock. activity is already folded; a package dating a worker's own reports asks quietSince, which reads this rather than a copy.
takennumberyesThe moment this answer was taken, for a tab holding two. Answers cross (two sockets, one held by a proxy or a test while a later one lands, a POST's answer beside a read), and the log's sequence orders everything in a state but the reading and its data, which are hashes with no order of their own. Live answers are stamped inside their page transaction; an edge host dates a fresh read of its stored publication at delivery. The wall clock rather than a counter, which would start over with the server and make a tab open across that restart refuse every answer until the count caught up.
activeRevision or nullyesThe revision the live root serves (files.document_descriptor), or null before the first.
versionsarray of objectyesEach public version with its revision and address (files.version_descriptors).
versions[].versionintegeryesThe public version number, vN's N.
versions[].revisionintegeryesThe immutable revision the version stamped.
versions[].urlstringyesThe version's address.
revision_labelsmap of stringyesEach revision's public name, vN or a draft's, by revision number (files.revision_label).
source_errorstring or nullyesWhy activating the page's authored source failed, or null.
dataobjectyesThe page's data sources as a browser reads them (data.browser_data_from). An answer to a tab that names this version in Leaf-Data-Version leaves out sources, which the tab restores from the reading it holds.
data.versionstringyes
data.sourcesmap of object
data.sources.*.contractstringyes
data.sources.*.revisionstring
data.sources.*.runstring
data.sources.*.updatedstring
data.sources.*.valueany
data.sources.*.errorstring
filesmap of stringyesEach bound file's stamp, by binding, which moves when the file may have: an editor reads its file only when this stamp does.
statusobjectyesThe agent's declaration, the newest status event (activity.declaration), as presence.presence_with_activity reads it; that module owns the presence fields below.
status.statestringyeswaiting on the user or idle, done with the page; waiting before the agent declares anything.
status.detailstringyesThe declaration's words; empty before the first declaration and where a start reopened an idle page.
status.tsstringWhen the agent declared it, or when a start reopened an idle page; absent before the first declaration.
listeningbooleanyesWhether a wait lease on the page is held: the active claimant session's, or the page's own where no session claims it.
session_aliveboolean or nullyesWhether the claimant's lifetime stands, or null where nothing claimed the page.
live_turnobject or nullyesWhat the claimant's harness says of its turn now (Harness.live_turn), or null.
live_turn when state is "busy" | "waiting" | "idle".
live_turn.state"busy" | "waiting" | "idle"yes
live_turn.sincestringyes
cursorintegeryesThe acknowledgement cursor, the greatest through a receipt in the log holds: the updates through it reached their durable consumer.
pendingintegeryesHow many of the user's events past the cursor the agent hasn't taken in.
agentstringyesThe name the page calls its agent (presence.page_agent).
claim_sessionstring or nullyesThe claimant session, or null.
claim_turnstring or nullyesThe claimant's current turn, which an opened delivery names, or null.
turn_closedstring or nullyesWhen the claimant's current turn closed, or null while it is open or nothing claims the page.
turn_openedstring or nullyesWhen that turn opened or was last renewed, or null where nothing claims the page.
turn_takes_inputbooleanyesWhether an open turn of the claimant's takes new input before it ends (Harness.turn_takes_input).
session_cwdstring or nullyesWhere the claimant was working when it claimed the page, or null for a page nothing claimed.
activityActivityyesWhere the agent's work on the whole page stands (activity.py), which the Leaf panel reads.
workflowsarray of WorkflowyesThe page's workflows, strongest first (served_state.work.served_workflows).
browserBrowser or nullyesThe browser's reading of the shown and active revisions (served_state.browser.browser_state), or null before the first revision.
eventsarray of EventyesThe log, as logged: a message's text is Markdown the page's vendored runtime renders, and its markup the fragment the CLI gate validated. The wire adds nothing, so the only vocabulary a page's frozen layer has to keep speaking is the log's own, which $events already stamps.
previewobjectThe identity a developer preview shows in browser chrome, as leaf-dev preview wrote it (server.preview_metadata); absent on a page that is not a preview.
preview.examplestringyesThe name of the source file the preview serves, without its extension.
preview.checkoutstringyesThe checkout whose Leaf serves it.
preview.interaction"user" | "author"yesuser for a --user preview, whose presses reach the session that claimed it; author for a plain one.
preview.startedstringyesWhen the preview started.
preview.inputobjectyesThe fixture publication the preview's watcher last applied.
preview.input.sourcestringyes
preview.input.authoredstringyes
publicationobjectOn leaf.page, who answers a published page and where to install Leaf; absent elsewhere.
publication.agentstringyesWho answers the published page.
publication.install_urlstringyesWhere to install Leaf.
publication.kindstringyes

Event

One logged event, exactly as $events declares its kind.

Type: event.

EventReference

The admitted gesture an answer or ending came from (obligations.event_reference).

FieldTypeRequiredDescription
idstringyes
kindstringyes
seqintegeryes
tsstringyes
authorstringyes

Provenance

Where a Leaf payload came from (layer.payload_provenance): its commit and dirty bit, and its age as committed or installed.

FieldTypeRequiredDescription
pathstring
commitstring
dirtyboolean
committedstring
installedstring

Revision

One revision's live address, public stamp or draft label, and captured identity (files.document_descriptor).

FieldTypeRequiredDescription
revisionintegeryesThe revision's number.
versioninteger or nullyesThe public version that stamped it, or null for a draft.
urlstringyesThe revision's address.
labelstringyesIts public name, vN or a draft's (files.revision_label).
executablestringyesThe capture's executable identity, independent of public stamps, which a client compares with its delivered document.
activated_atstringyesWhen it went live.

Subject

What a workflow or to-do stands on.

FieldTypeRequiredDescription
when kind is "thread" | "widget" | "element".
kind"thread" | "widget" | "element"yes
idstringyes
when kind is "page".
kind"page"yes

Activity

The page's one reading of agent activity (activity.canonical_activity), without its workflows and to-dos, which the state serves on their own.

FieldTypeRequiredDescription
kind"away" | "closed" | "unheld" | "working" | "stalled" | "listening"yes
heldbooleanyes
droppedbooleanyes
detailstringyes
detail_sourceobject or nullyes
detail_source.event_idstringyes
detail_source.itemstringyes
observedstringyes
observed_kindWorkKind or nullyes
awaitingbooleanyes
countsobjectyes
counts.activeintegeryes
counts.handlingintegeryes
counts.handling_commentsintegeryes
counts.queuedintegeryes
counts.picked_upintegeryes
counts.pendingintegeryes
counts.overdueintegeryes
counts.totalintegeryes
tsstring or nullyes
next_transition_atstring or nullyes
obligationsarray of stringyesThe ids of the update records whose next actor is the agent: the answers it owes (activity.canonical_activity).

WorkKind

The step a harness observed the agent taking (activity.WORK_KINDS, read from here): working, thinking, using a tool, waiting on the user in its own window for an approval, an answer or a dialog it does not name (the awaiting_ kinds), or replying. The browser words each one (runtime/activity-words.js).

Type: "working" | "thinking" | "tool" | "awaiting_approval" | "awaiting_input" | "awaiting_user" | "replying".

ReplyEvidence

A provisional reply's settlement evidence, without its text (activity._reply_evidence).

FieldTypeRequiredDescription
statestringyes
turnstringyes
settlesbooleanyes
attemptstringyes

Workflow

One update the user handed over that has not settled (workflows.py).

FieldTypeRequiredDescription
idstringyes
inputstringyes
messagestring or nullyesThe message a thread input is said in, which shows its delivery: its own, or for a revision the message it rewrote.
seqintegeryes
revisioninteger or nullyes
subjectSubjectyes
coordinatearray of stringyes
obligationstring or nullyesThe id of the obligation record this update serves (workflows.handed_over): its own, or for an older input in a run of turns the newest's; null for an update that owes nothing.
stageStageyes
tsstring or nullyes
delivery_seqinteger or nullyes
delivery_sessionstring or nullyes
delivery_turnstring or nullyes
detailstring or nullyes
detail_seqinteger or nullyesThe log position of the start whose line detail is, which places the thread's working message among its messages.
agentstring or nullyes
sessionstring or nullyes
activityarray of objectyes
activity[].kind"working" | "replying" | "response"yes
activity[].detailstring or nullyes
activity[].tsstring or nullyes
activity[].sessionstring or nullyes
activity[].turnstring or nullyes
conditionobject or nullyes
condition when kind is "ended" | "interrupted" | "stale" | "failed" and operation is "delivery" | "work" | "response".
condition.kind"ended" | "interrupted" | "stale" | "failed"yes
condition.operation"delivery" | "work" | "response"yes
responseobject or ReplyEvidence or nullyes
response when state is "failed". The failure record that answered the update.
response.idstringyes
response.attemptstring or nullyes
response.state"failed"yes
started_byarray of objectyesThe starts that take the update in hand, which the Stop hook reads.
started_by[].itemstringyes
started_by[].sessionstring or nullyes
started_by[].turnstring or nullyes
started_by[].seqintegeryes
at_workbooleanyesWhether the agent is at work on it: at working or replying, whatever its condition.
threadstring or nullyesThe thread it stands in: a thread input's own, a widget frozen into a message's thread, or null for a page widget.

Start

The start running on a to-do (todos.running).

FieldTypeRequiredDescription
idstringyes
itemstringyes
textstringyes
seqintegeryes
tsstringyes
agentstring or nullyes
sessionstring or nullyes
turnstring or nullyes

Todo

One to-do, open or ended (work_reading.WorkReading.page_todos). The start that holds an open one is running; one gone quiet holds nothing.

FieldTypeRequiredDescription
idstringyes
owner"agent" | "user"yes
subjectSubjectyes
titlestringyes
state"open" | "done" | "failed" | "dropped"yes
seqintegeryes
tsstringyes
agentstring or nullyes
sessionstring or nullyes
revisioninteger or nullyes
runningStart or nullyes
outcomeobject or nullyesHow it ended: the todo_end in force, or the stamped version that completed it.
outcome.idstringyes
outcome.seqintegeryes
outcome.tsstringyes
outcome.detailstring or nullyes
outcome.authorstringyes
outcome.agentstring or nullyes
outcome.sessionstring or nullyes
threadstring or nullyes

PlanStep

One step of the plan (plans.plan_reading): plain, or naming a to-do or obligation whose title, owner and state it shows; done of total counts its children, dropped ones left out.

FieldTypeRequiredDescription
titlestring or nullyes
state"open" | "working" | "done" | "failed" | "dropped"yes
owner"agent" | "user"yes
itemobject or nullyes
item when kind is "todo" | "obligation".
item.kind"todo" | "obligation"yes
item.idstringyes
runningStart or nullyes
sincestring or nullyes
stepsarray of PlanStepyes
doneintegeryes
totalintegeryes

HistoryRow

One logged event as a history feed reads it (history.history). Which of the optional fields a row carries follows its kind.

FieldTypeRequiredDescription
idstringyes
tsstringyes
kind"comment" | "reply" | "edit" | "resolve" | "unresolve" | "action" | "report" | "note" | "done"yes
authorstringyes
agentstring or nullyes
undonebooleanyes
threadobject or null
thread.idstringyes
anchorAnchor
aboutcomment's about or null
tokenstring
holdscomment's holds or null
drawingboolean
excerptstring or null
widgetstring
gestureobject
gesture.form"choice" | "move" | "edit" | "add" | "verb"yes
gesture.chosenarray of string
gesture.unitstring
gesture.tostring
gesture.wordsstring
gesture.verbstring
valueany
versioninteger

Browser

What the browser reads of the page's revisions and the work on them (served_state.browser.browser_state).

FieldTypeRequiredDescription
basisobjectyesThe log position the reading was taken through.
basis.through_seqintegeryes
historyarray of HistoryRowThe newest rows, newest first, sent only to a page holding a widget that declares x-history.
viewsmap of ViewyesEach projected revision's view, by revision number.
approval_historyarray of doneyesApprovals in force across every stamp, for Threads' event timeline. Current-version approval state lives only in its obligation.
todosarray of TodoyesEvery to-do, open and ended, the one record the browser reads each from.
planobject or nullyesThe agent's outline of the work, its steps naming to-dos and obligations by id (plans.plan_reading), or null.
plan.idstringyes
plan.tsstringyes
plan.agentstring or nullyes
plan.sessionstring or nullyes
plan.stepsarray of PlanStepyes
receiptsarray of EventyesEvery logged event a browser attempt wrote, which carries its attempt.
thread_membershipsmap of array of stringyesEvery thread whose history each logged event changes (thread_context.thread_memberships), which the browser reads for the gesture an unsent undo takes back or an unsent action replaces.
version_notesmap of stringyesEach version's note, by version.

View

One revision's view: its document, the frozen threads as its registry reads them, and the work and undo readings drawn on it.

FieldTypeRequiredDescription
basisobjectyes
basis.revisionintegeryes
basis.through_seqintegeryes
documentobjectyes
document.revisionintegeryes
document.projectionProjectionyes
threadobjectyesThe frozen threads as this revision reads them: its registry classifies their widgets' decisions, and so the obligations and attention those give.
thread.projectionProjectionyes
thread.threadsarray of Threadyes
obligationsarray of ObligationyesEvery obligation record of this view, its document's then its frozen threads', answered and withdrawn ones included. The one copy of each: a list row and approval_blocking name an obligation by id.
reportsarray of objectyesThe view's report feed, in log order (projection.canonical_reports).
reports[].idstringyes
reports[].targetobjectyes
reports[].target.kind"widget"yes
reports[].target.idstringyes
reports[].source"report"yes
reports[].actionstringyes
reports[].detailobjectyes
reports[].textstring or nullyes
reports[].tsstringyes
reports[].revisionintegeryes
reports[].seqintegeryes
reports[].agentstring or nullyes
reports[].sessionstring or nullyes
reports[].disposition"effective" | "outranked" | "settled"yes
undoarray of objectyesThe user's gestures this document can take back, newest first (served_state.document.browser_undo_candidates); newest marks the user's newest gesture.
undo[].eventEventyes
undo[].coordinatearray of string
undo[].newesttrue
coveragearray of objectyesEach widget event and undo with the coordinate it is classified at in this view, or null.
coverage[].eventEventyes
coverage[].coordinatearray of string or nullyes
published_atstring or nullyes
queuesobjectyesOn me and On <agent> and what each has finished (served_state.queues).
queues.on_userarray of QueueRowyes
queues.on_agentarray of QueueRowyes
queues.donearray of DoneRowyes
approval_blockingarray of stringyesThe obligations approving this version waits on (obligations.approval_blocking).

Projection

One declared state projection (served_state.wire.browser_projection).

FieldTypeRequiredDescription
entriesarray of objectyes
entries[].eventaction or reportyes
entries[].coordinate[string, string, string]yes
entries[].specx-state verbyesThe operation the event was admitted under, by the immutable registry of the revision that interpreted it, which may differ from the active document's. Browser folds read this rather than reinterpreting history through whichever registry the current DOM selected.
entries[].valueanyyes
entries[].scope"document" | "thread"yes
entries[].restatedarray of stringyes
entries[].absorbedbooleanyesWhether a later revision absorbed this move, whose markup places the unit.
entries[].standsbooleanyesWhether nothing has taken this action back or retracted it, so it stands at its coordinate once every newer one is withdrawn.
actionsarray of stringyes
reportsarray of stringyes
desiredarray of stringyes

Obligation

One request and its contained answer (obligations.py, which owns the statuses): what a widget or a version's sign-off waits on the user for, or what an update the user handed over is owed (workflows.handed_over). The source owns the canonical value; identity includes its kind so authored ids and message ids cannot collide.

FieldTypeRequiredDescription
idstringyes
sourceobjectyes
source when kind is "widget".
source.kind"widget"yes
source.idstringyes
source.tagstringyes
source when kind is "approval".
source.kind"approval"yes
source.versionintegeryes
source when kind is "update". An update the user handed over: id is the input's event, subject the thread or widget it stands on.
source.kind"update"yes
source.idstringyes
source.subjectSubjectyes
threadstring or nullyes
messagestring or nullyes
promptobjectyes
prompt.textstring or nullyes
prompt.targetstring or nullyesWhere the user goes to answer: the id of a widget's prompt context, or of the thread or widget an update stands on; null for an approval, which asks about the version as a whole.
answerobject or nullyes
answer.valueanyyes
answer.eventEventReference or nullyes
status"open" | "answered" | "answered_elsewhere" | "withdrawn"yes
endobject or nullyesThe agent's leaf task end that retired a question answered in words: where the answer is, or why the obligation no longer applies.
end.detailstring or nullyes
end.eventobjectyesThe ending's reference, which names no kind: every ending is a todo_end.
end.event.idstringyes
end.event.seqintegeryes
end.event.tsstringyes
end.event.authorstringyes
next_actor"user" | "agent" | nullyes

QueueRow

One row of On me or On <agent> (served_state.queues); owner names its list and live whether the agent has it in hand now. A record's row names its obligation by id, whose record is the view's obligations entry, and a to-do row names its to-do by id, whose record is the page's todos entry.

Type: ObligationRow or TodoRow.

ObligationRow

An obligation record's row in On me or On <agent> (served_state.queues).

FieldTypeRequiredDescription
kind"widget" | "approval" | "update"yesThe record's source.kind.
idstringyesThe obligation, whose record is the view's obligations entry.
owner"user" | "agent"yesThe list the row stands on.
subjectSubjectyes
threadstring or nullyesThe thread it stands in, or null.
livebooleanyesWhether the agent has it in hand now: an update it is at work on whose work has not gone quiet or stopped.

TodoRow

A to-do's row in On me or On <agent> (served_state.queues).

FieldTypeRequiredDescription
kind"todo"yes
idstringyesThe to-do, whose record is the page's todos entry.
owner"agent" | "user"yesThe list the row stands on.
subjectSubjectyes
threadstring or nullyesThe thread it stands in, or null.
livebooleanyesWhether a start holds the to-do now.

DoneRow

A row that left its list, in the Done of the list owner names: how it ended (state), when (ended, null going last), and the outcome's detail.

Type: ObligationRow or TodoRow.

FieldTypeRequiredDescription
state"done" | "failed" | "dropped"yes
endedstring or nullyes
detailstring or nullyes

Anchor

Where a thread stands on the page, as a comment, reply or reanchor names it, or null.

Type: comment's anchor or reply's anchor or reanchor's anchor.

Message

A message as a served thread holds it.

Type: comment or reply or object.

FieldTypeRequiredDescription
variant 1. A logged comment or reply, with its current content version (read_state.content_version), which the browser marks read once its words have been shown. An agent's message carries the name it is shown under as agent (schema.agent_name). An input's first answer carries key, the name a provisional reply and the answer that retires it share.
agentstring
keystring
content_versionstringyes
editedobjectThe user's latest rewrite, and the words it replaced.
edited.idstringyes
edited.seqintegeryes
edited.tsstringyes
edited.wasstringyes
when provisional is true and kind is "reply" and addressable is false and author is "agent". A provisional reply streaming under a delivery attempt, which joins its thread once it has words (served_state.thread.browser_thread).
idstringyes
content_versionstringyes
attemptstringyes
keystringyes
provisionaltrueyes
kind"reply"yes
addressablefalseyes
author"agent"yes
agentstring or nullyes
parentstringyes
textstringyes
tsstringyes
pendingbooleanyes

ContentVersion

One version of an agent message's content: the message, and its latest edit's id or else its own (read_state.content_version).

FieldTypeRequiredDescription
messagestringyesThe message's event id.
versionstringyesThe content version's id, which a read event names.

Attention

Whose turn a thread is (served_state.browser._thread_attention), read from the open obligation records in it: a widget's or an update's handed back on the user, else one on the agent, whose strongest serving workflow it names; or null for nobody's.

Type: object or null.

FieldTypeRequiredDescription
when kind is "needs_user" and reason is "widget" | "resend".
kind"needs_user"yes
reason"widget" | "resend"yes
workflowstring or nullyes
when kind is "waiting" and reason is "uncertain" | "workflow".
kind"waiting"yes
reason"uncertain" | "workflow"yes
workflowstringyes
when kind is "waiting" and reason is "todo".
kind"waiting"yes
reason"todo"yes
workflownullyes
todostringyesThe id of the to-do the thread waits on, whose record is the page's todos entry.

Thread

One thread, keyed by the comment that opened it (events.build_threads), as served_state.thread.browser_thread serves it.

FieldTypeRequiredDescription
idstringyes
rootMessageyes
titlestring or nullyes
anchorAnchoryes
detached_fromAnchoryes
rewritten_fromAnchoryes
msgsarray of Messageyes
revisionsarray of edityesThe user's edits in log order, each with was, the words it replaced.
revisions[].wasstringyes
resolvedresolve or action or nullyesWhat closed the thread, an agent's named by agent (schema.agent_name), or null while it is open.
resolved.agentstring
bare_reactionbooleanyes
seatstring or nullyesThe widget whose thread seat the root stands in (events.seat_root), or null.
summariesarray of objectyesThe thread's current summaries (events.active_summaries); protected lists the covered messages a summary must not hide.
summaries[].idstringyes
summaries[].seqintegeryes
summaries[].fromstringyes
summaries[].throughstringyes
summaries[].coversarray of stringyes
summaries[].textstringyes
summaries[].labelstringyes
summaries[].triggerstring
summaries[].protectedarray of stringyes
unreadarray of ContentVersionyesThe content versions the user hasn't read (read_state.unread_content).
attentionAttentionyes

Stage

How far an update has reached the agent; answered is only ever a retained failed response.

Type: "sent" | "queued" | "picked_up" | "working" | "replying" | "answered".

ViewAnswer

The answer GET /api/view gives (served_state.service.PageStateService.page_browser_view): one revision's browser reading at an exact log boundary, which version comparison folds.

FieldTypeRequiredDescription
browserBrowseryes

EventAnswer

The answer POST /api/event gives once its gates pass (event_endpoint).

FieldTypeRequiredDescription
when ok is true. Accepted, with the page's state, which holds the event's receipt.
oktrueyes
stateserved stateyes
when ok is false and final is true. Refused, and final: nothing was appended. error is the words the tab shows its user. A refusal admission made carries state, which restores the tab from current truth; a gate's refusal (http.PageEndpoint._refuse) carries none.
okfalseyes
finaltrueyes
errorstringyes
findingsarray of Findingyes
attemptanyThe posted attempt, echoed as it came.
stateserved state
when ok is false. A fault that may have landed either side of the append, so the next identical request finds out (event_endpoint.event_fault).
okfalseyes
errorstringyes
attemptanyThe posted attempt, echoed as it came.

Finding

What a refusal refused on (findings.Finding.json, less its words). The browser shows the refusal's error instead.

FieldTypeRequiredDescription
codestringyes
severity"error" | "advice"yes
atstring
valuesobject

SampleAnswer

The answer POST /api/samples gives: the new live sample's address, and its interaction page (http.PageEndpoint._create_sample).

FieldTypeRequiredDescription
urlstringyes
pagestringyes

MediaAnswer

The answer POST /api/media gives: the stored image's page-relative path (media.store_uploaded_media).

FieldTypeRequiredDescription
pathstringyes

FileSnapshot

One bound file as GET and a successful POST /api/files/<binding> answer it (file_bindings): its name, its text with LF line endings, and the revision a save names.

FieldTypeRequiredDescription
labelstringyes
textstringyes
revisionstringyes

StaleFile

A save refused because the file changed since the revision it named, with the file as it is now.

FieldTypeRequiredDescription
errorstringyes
currentFileSnapshotyes

Refusal

Any route's refusal of a request (http.PageEndpoint._refuse): the words the page shows.

FieldTypeRequiredDescription
errorstringyes

LayerAnswer

A write held because the tab speaks another layer (http.PageEndpoint._layer_gate): the generation it should speak, which the Leaf-Layer header also carries, so the tab reloads without reading this.

FieldTypeRequiredDescription
layerstringyes

Events

Each line of a page's events.jsonl is one event, admitted whole against its kind's schema. The first table lists the fields every kind shares; each kind's table lists the rest.

Every event

FieldTypeRequiredDescription
attentionbooleanyes
idstringyes
tsstringyes
seqintegeryes

comment

What it means. The browser may post it to POST /api/event. A message kind.

FieldTypeRequiredDescription
authorstringyes
kind"comment"yes
revisionintegeryes
textstring
tokenstring
anchorobject
anchor.sectionstring or null
anchor.quotestring
anchor.datumstring
anchor.sourcestring
anchor.source_revisionstring
anchor.identitystring
anchor.visualstring
anchor.prefixstring
anchor.suffixstring
anchor.detachedtrue
anchor.partstring
anchor one of: requires section; requires quote; requires datum.
drawingobject
drawing.strokesarray of array of [number, number]yes
drawing.box[number, number]yes
drawing.frameobject
drawing.frame.rootstringyes
drawing.frame.patharray of objectyes
drawing.frame.path[].tagstringyes
drawing.frame.path[].indexintegeryes
drawing.frame.path[].siblingsintegeryes
drawing.frame.path[].shadowboolean
drawing.saysstring
drawing.viewport[number, number]yes
drawing.scheme"light" | "dark"yes
suggestionboolean
about"design"
titlestring
agentstring
sessionstring
markupstring
attemptstring
holdsstring
one of: requires text; requires token; requires drawing and forbids text.

reply

What it means. The browser may post it to POST /api/event. A message kind.

FieldTypeRequiredDescription
authorstringyes
kind"reply"yes
parentstringyes
revisioninteger
publicationstring
textstring
tokenstring
anchorobject or null
anchor.sectionstring or null
anchor.quotestring
anchor.datumstring
anchor.sourcestring
anchor.source_revisionstring
anchor.identitystring
anchor.visualstring
anchor.prefixstring
anchor.suffixstring
anchor.detachedtrue
anchor.partstring
anchor one of: requires section; requires quote; requires datum.
titlestring
agentstring
sessionstring
markupstring
todostring
ephemeraltrue
startobject
start.itemstringyes
start.turnstring
failurestring
respondsstring
attemptstring
one of: requires text; requires token.

edit

What it means. The browser may post it to POST /api/event.

FieldTypeRequiredDescription
author"agent" | "user"yes
kind"edit"yes
attemptstring
messagestringyes
textstringyes
basestring
agentstring
sessionstring
when author is "agent", requires agent, session.
when author is "user", forbids agent, session.

summary

What it means.

FieldTypeRequiredDescription
author"agent"yes
kind"summary"yes
threadstringyes
fromstringyes
throughstringyes
textstringyes
labelstring
agentstringyes
sessionstringyes

read

What it means. The browser may post it to POST /api/event. A bookkeeping kind.

FieldTypeRequiredDescription
author"user"yes
kind"read"yes
messagesarray of objectyes
messages[].messagestringyes
messages[].versionstringyes
attemptstring

thread_title

What it means.

FieldTypeRequiredDescription
author"agent"yes
kind"thread_title"yes
threadstringyes
titlestringyes
agentstringyes
sessionstringyes

todo

What it means.

FieldTypeRequiredDescription
author"agent"yes
kind"todo"yes
owner"agent" | "user"yes
subjectobjectyes
subject when kind is "widget" | "element".
subject.kind"widget" | "element"yes
subject.idstringyes
subject when kind is "page".
subject.kind"page"yes
revisioninteger
titlestringyes
agentstring
sessionstring

start

What it means.

FieldTypeRequiredDescription
author"agent"yes
kind"start"yes
itemstringyes
textstringyes
turnstring
agentstring
sessionstring

status

What it means.

FieldTypeRequiredDescription
author"agent"yes
kind"status"yes
state"waiting" | "idle"yes
detailstringyes
agentstring
sessionstring

plan

What it means.

FieldTypeRequiredDescription
author"agent"yes
kind"plan"yes
stepsarray of objectyes
steps[] when state is "open" | "working" | "done" | "dropped".
steps[].depthintegeryes
steps[].titlestringyes
steps[].state"open" | "working" | "done" | "dropped"yes
steps[] variant 2.
steps[].depthintegeryes
steps[].itemstringyes
agentstring
sessionstring

todo_end

What it means. The browser may post it to POST /api/event. A undoable kind.

FieldTypeRequiredDescription
author"agent" | "user"yes
kind"todo_end"yes
todostringyes
outcome"done" | "failed" | "dropped"yes
attemptstring
detailstring
agentstring
sessionstring

reanchor

What it means. A bookkeeping kind.

FieldTypeRequiredDescription
author"page"yes
publicationstring
kind"reanchor"yes
threadstringyes
revisionintegeryes
anchorobject or nullyes
anchor.sectionstringyes

resolve

What it means. The browser may post it to POST /api/event. A undoable kind.

FieldTypeRequiredDescription
authorstringyes
kind"resolve"yes
parentstringyes
agentstring
sessionstring
attemptstring

unresolve

What it means. The browser may post it to POST /api/event. A undoable kind.

FieldTypeRequiredDescription
authorstringyes
kind"unresolve"yes
parentstringyes
attemptstring

done

What it means. The browser may post it to POST /api/event. A undoable kind.

FieldTypeRequiredDescription
authorstringyes
kind"done"yes
versionintegeryes
attemptstring

action

What it means. The browser may post it to POST /api/event. A undoable kind. Carries an x-state verb the user writes.

FieldTypeRequiredDescription
authorstringyes
kind"action"yes
widgetstringyes
actionstringyes
detailobjectyes
meaningobjectyes
meaning.scope"page" | "thread"yes
meaning.unitstringyes
meaning.dependsarray of stringyes
meaning.answerstring or null
meaning.createsstring
meaning.amongarray of string
meaning.stateobject
meaning.state.originstringyes
meaning.state.unitstringyes
meaning.state.recordobject or nullyes
meaning.state.createsobject or nullyes
meaning.state.detailobject or booleanyes
revisionintegeryes
attemptstring

pickup

What it means.

FieldTypeRequiredDescription
author"page"yes
kind"pickup"yes
eventsarray of stringyes
phase"queued" | "opened" | "failed"yes
sessionstring or nullyes
turnstring or nullyes
failurestring
refsmap of object
refs.*.refstringyes
refs.*.claimstring or nullyes
when phase is "failed", requires failure.
otherwise, forbids failure.

receipt

What it means.

FieldTypeRequiredDescription
author"page"yes
kind"receipt"yes
throughintegeryes

undo

What it means. The browser may post it to POST /api/event.

FieldTypeRequiredDescription
authorstringyes
kind"undo"yes
undoesstringyes
attemptstring

report

What it means. Carries an x-state verb the agent writes.

FieldTypeRequiredDescription
authorstringyes
kind"report"yes
widgetstringyes
actionstringyes
detailobjectyes
meaningobjectyes
meaning.scope"page" | "thread"yes
meaning.unitstringyes
meaning.dependsarray of stringyes
meaning.stateobject
meaning.state.originstringyes
meaning.state.unitstringyes
meaning.state.recordobject or nullyes
meaning.state.createsobject or nullyes
meaning.state.detailobject or booleanyes
revisionintegeryes
agentstring
sessionstring

note

What it means.

FieldTypeRequiredDescription
authorstringyes
kind"note"yes
versionintegeryes
revisionintegeryes
publicationstring
textstringyes
restatedarray of string
settlesarray of object
settles[].kind"report" | "todo"yes
settles[].idstringyes
agentstring
sessionstring

error

What it means. The browser may post it to POST /api/event.

FieldTypeRequiredDescription
authorstringyes
kind"error"yes
revisioninteger
textstringyes

Records

Leaf keeps these JSON files outside a page's log and document, in the page directory, the machine's state home, or the browser's storage. Each carries a format naming the protocol at which its shape last changed. delivery is the envelope an agent reads with leaf delivery read.

access

The key every page this machine serves is read with (host_key), in the state home's access.json.

Stored with format leaf-access/13.

FieldTypeRequiredDescription
tokenstringyes

bridge

Where an installed tree's running bridge listens, in the state home's bridge/<key>.json.

Stored with format leaf-bridge/13.

FieldTypeRequiredDescription
portintegeryesThe loopback port it listens on.
tokenstringyesThe token a request carries.
pidintegeryesThe bridge's process.

bridge-session

A session the bridge serves, in the state home's bridge/<key>.sessions/<digest>.json, with the fields of the lifetime it lives by (Harness.lifetime) beside its id.

Stored with format leaf-bridge-session/13.

FieldTypeRequiredDescription
idstringyesThe harness's session id.

claim

The session that receives a page's updates, in the state home's claims/<page key>.json (claim_path).

Stored with format leaf-claim/13.

FieldTypeRequiredDescription
pagestringyesThe page directory.
tsstring (date-time)yesWhen the claim was published.
idstringyesThe claimant session (state.SESSION).
generationstringyesThe generation of the session this claim names.
acquisitionstringyesThis publication's own identity (same_claim).
harnessstringyesThe claimant's Harness.name.
agentstringyesThe name the claimant shows.
cwdstringyesThe claimant's working directory.
messaged_endingstringThe turn ending after which input last messaged the session (note_messaged).

codex-adapter

A Codex task's running delivery adapter, written into the lease it holds at the state home's sessions/<digest>.adapter. A session can select a replacement runtime while this lease remains held (_running_adapter).

Stored with format leaf-codex-adapter/13.

FieldTypeRequiredDescription
app_serverstring or nullyesThe Codex App Server the adapter delivers through, or null for the task's queue.
launcherstringThe immutable runtime running the adapter.

codex-delivery

One delivery a Codex task is handing to its agent (DeliveryRecord), in the state home's sessions/<digest>.deliveries/<id>.json and, once nothing is owed on it, that directory's history/. A record at another format is ignored, and the events its page has not acknowledged are captured afresh.

Stored with format leaf-codex-delivery/14.

FieldTypeRequiredDescription
state"collecting" | "offering" | "hook" | "starting" | "queued" | "opened" | "abandoned"yesHow far the handoff has gone (RECORD_VARIANTS).
created_atnumberyesWhen it was captured, in seconds since the epoch.
batchesarray of objectyesOne per page.
batches[].pagestringyesThe page directory.
batches[].sessionstringyes
batches[].eventsarray of objectyesThe captured events, by id and seq.
batches[].events[].idstringyes
batches[].events[].seqintegeryes
when state is "collecting".
batches[].through_seqintegeryes
batches[].threadsarray of objectyes
batches[].threads[].idstringyes
batches[].threads[].titlestring or nullyes
batches[].events[].kindstringyes
batches[].events[].threadsarray of stringyes
batches[].events[].answerobject
batches[].events[].answer.kind"reply" | "markup"yes
batches[].events[].answer when kind is "reply".
batches[].events[].answer.parentstringyes
batches[].events[].answer.respondsstringyes
batches[].events[].answer when kind is "markup".
batches[].events[].answer.actionstringyes
when state is "queued" | "opened" | "abandoned".
pendingarray of integeryes
when state is "hook" | "opened".
turnstringyes

data-source

One source's publication, in the page directory's data/<source>.json, which leaf data set writes whole.

Stored with format leaf-data-source/16.

FieldTypeRequiredDescription
contractstringyesThe data contract the value was validated against at the write.
runstringyesAn opaque receipt naming the write, a rerun with the same value included.
updatedstring (date-time)yesWhen the value was written.
valueanyyesThe source's complete value.

delivery

The immutable envelope leaf delivery read prints (references/event-batches.md), in the state home's deliveries/<id>.json: the updates that need the agent's attention, one batch per page. Registry when clauses read its events, with an event's thread digest as thread (registry.contract.event_clauses).

Stored with format leaf-delivery/15.

FieldTypeRequiredDescription
idstringyesThe delivery id, eight hex characters, which the agent's pointer names.
created_atnumberyesWhen it was first collected, in seconds since the epoch.
acknowledgestring or nullyesHow the reader confirms receipt, or null where the harness did.
batchesarray of objectyesOne per page.
batches[].pagestringyesThe page directory.
batches[].claimstring or nullyesThe session that owned the page at capture.
batches[].through_seqintegeryesThe log position the batch was captured through; a correction keeps its original batch's.
batches[].threadsarray of objectyesThe threads the batch's events land in, each with its messages other than the batch's own (thread_context.batch_threads). A when clause reads an event's as its thread.
batches[].threads[].idstringyesThe thread's id, which the batch's events name.
batches[].threads[].titlestring or nullyesNull until the thread is named.
batches[].threads[].anchorcomment's anchor or reply's anchor or reanchor's anchoryesWhere the thread stands on the page.
batches[].threads[].detached_fromcomment's anchor or reply's anchor or reanchor's anchoryesThe anchor a detached thread last had, or null.
batches[].threads[].resolvedstring or nullyesWho closed the thread, or null while it is open.
batches[].threads[].elidedobjectyesHow many messages and gestures a long thread leaves out of messages and actions.
batches[].threads[].elided.messagesintegeryes
batches[].threads[].elided.actionsintegeryes
batches[].threads[].messagesarray of objectyesIts earlier messages (thread_context.MESSAGE_FIELDS), less the batch's own events: the first and the latest of a long thread.
batches[].threads[].messages[].idstringyesThe message's event id.
batches[].threads[].messages[].seqintegeryesIts event's place in the log.
batches[].threads[].messages[].authorstringyes
batches[].threads[].messages[].agentstringThe name an agent's message is shown under.
batches[].threads[].messages[].textstring
batches[].threads[].messages[].ephemeraltrueMarks a one-line progress reply, which answers nothing.
batches[].threads[].messages[].tokenstringA reaction's word, in place of text.
batches[].threads[].messages[].markupstringThe HTML an agent's message holds, such as a widget it sent.
batches[].threads[].messages[].drawingcomment's drawing
batches[].threads[].messages[].suggestionbooleanTrue where the comment is a suggestion.
batches[].threads[].messages[].editedobjectThe user's latest rewrite, and the words it replaced.
batches[].threads[].messages[].edited.idstringyes
batches[].threads[].messages[].edited.seqintegeryes
batches[].threads[].messages[].edited.tsstringyes
batches[].threads[].messages[].edited.wasstringyes
batches[].threads[].summariesarray of objectyesThe thread's summaries in force (events.active_summaries).
batches[].threads[].summaries[].idstringyes
batches[].threads[].summaries[].seqintegeryes
batches[].threads[].summaries[].fromstringyesThe first message the summary folds.
batches[].threads[].summaries[].throughstringyesThe last message it folds.
batches[].threads[].summaries[].coversarray of stringyesEvery message it folds, in thread order.
batches[].threads[].summaries[].textstringyesThe summary's Markdown, empty for a fold that only hides the messages.
batches[].threads[].summaries[].labelstringyesWhat the folded run reads as in the thread.
batches[].threads[].summaries[].triggerstringThe agent reply whose arrival folded earlier progress messages.
batches[].threads[].actionsarray of objectyesGestures in force on widgets sent in the thread, other than the batch's own (thread_context.ACTION_FIELDS).
batches[].threads[].actions[].idstringyes
batches[].threads[].actions[].seqintegeryes
batches[].threads[].actions[].authorstringyes
batches[].threads[].actions[].widgetstringyes
batches[].threads[].actions[].actionstringyes
batches[].threads[].actions[].detailobjectyes
batches[].threads[].summary_hintobjectAn earlier run of messages worth summarizing, from its first message through its last.
batches[].threads[].summary_hint.fromstringyes
batches[].threads[].summary_hint.throughstringyes
batches[].handlingmap of stringyesEach clause's text once, by an id only this batch's events use.
batches[].eventsarray of eventyesIn log order, each the logged record less the browser's attempt, with what the delivery reads of it (batch_data, handled).
batches[].events[].subjectobjectyesWhat the event changes.
batches[].events[].subject when kind is "thread" | "widget".
batches[].events[].subject.kind"thread" | "widget"yes
batches[].events[].subject.idstringyes
batches[].events[].subject when kind is "page".
batches[].events[].subject.kind"page"yes
batches[].events[].threadsarray of stringyesEvery thread the event belongs to.
batches[].events[].saysmap of stringThe words of each element the gesture names, by id, as the page it was made on wrote them.
batches[].events[].wasstringOn the user's rewrite of their own message, the words it replaced.
batches[].events[].suggestionbooleanA comment's own flag; beside an edit's was, true where the rewritten message is a suggestion, so its new text is the exact replacement it proposes.
batches[].events[].answerobjectThe response the event owed at capture (obligations.response_address); absent where it owes none.
batches[].events[].answer when kind is "reply" and writer is "agent" | "turn". A thread reply under parent answering the input responds, written by the agent or, for a Codex App Server turn, by the turn's final message.
batches[].events[].answer.kind"reply"yes
batches[].events[].answer.parentstringyes
batches[].events[].answer.respondsstringyes
batches[].events[].answer.refstringyesThe answer's address, which leaf response takes.
batches[].events[].answer.writer"agent" | "turn"yesWho is to write the reply when the delivery was frozen: the agent, or the final message of the turn carrying it.
batches[].events[].answer when kind is "markup". A stamped page revision recording the widget action action.
batches[].events[].answer.kind"markup"yes
batches[].events[].answer.actionstringyes
batches[].events[].answer.refstringyesThe answer's address, which leaf response takes.
batches[].events[].handlingarray of stringIds of the batch's handling clauses that apply, in reading order.
correctionobjectAsks again for one answer whose Codex turn final Leaf refused to post (codex.prepare_reply_correction).
correction.deliverystringyesThe delivery whose answer was refused.
correction.turnstringyesThe turn whose final was refused.
correction.claimobjectyesThe claim the refused final was written under.
correction.claim.idstringyesThe claimant session.
correction.claim.generationstringyesThe session generation the claim named.
correction.claim.acquisitionstringyesThe claim's own identity.
correction.diagnosticstringyesWhy Leaf refused it.
correction.instructionstringyesWhat the agent is to do: fix the failure and answer the same input again.

draft

The composer's draft of a comment, which each tab keeps in browser storage under the passage it is on (runtime/composing/selection.js): its words, the anchor and the revision it was captured on, whether it is a suggestion or about design, its drawing, and when it was last touched. A draft's drawing adds at, the matrix that stands it in its anchor's section, which the comment leaves out: here properties beside a leaf: reference add to the object it names, as the build writes it in for the protocol baseline (build/browser/contract-types.mjs). Its format, leaf-draft/<since>, names the protocol at which this shape last changed; a tab reading a draft at another format keeps its words and drops its drawing.

Stored with format leaf-draft/15.

FieldTypeRequiredDescription
formatstringyes
textstringyes
anchorcomment's anchor or nullyes
revisionintegeryes
suggestbooleanyes
aboutcomment's about or nullyes
drawingcomment's drawing or nullyes
drawing.atarray of number
touchednumberyes

file-bindings

The local text files a page may edit, in the page directory's files.json.

Stored with format leaf-file-bindings/13.

FieldTypeRequiredDescription
bindingsmap of stringyesEach binding id's file, by its canonical absolute path.

preview

What a developer preview shows in browser chrome, as leaf-dev preview writes it to the page directory's preview.json.

Stored with format leaf-preview/13.

FieldTypeRequiredDescription
examplestringyesThe name of the source file the preview serves, without its extension.
checkoutstringyesThe checkout whose Leaf serves it.
interaction"user" | "author"yesuser for a --user preview, whose presses reach the session that claimed it; author for a plain one.
startedstringyesWhen the preview started.
inputobjectyesThe fixture publication the preview's watcher last applied.
input.sourcestringyes
input.authoredstringyes

reconnect

The pages a session has been told to reconnect, one notice each per outage, in the state home's sessions/<digest>.reconnect.

Stored with format leaf-reconnect/13.

FieldTypeRequiredDescription
pagesarray of stringyesEach page directory the session was told about.

row

A serving page's row, which other pages show it by, in the state home's rows/<page key>.json.

Stored with format leaf-row/16.

FieldTypeRequiredDescription
pagestringyesThe page directory.
page_keystringyesThe page's key (state.page_key).
server_idstringyesThe server incarnation that published the row; a reader takes only the live service's own.
rowobjectyesWhat other pages show of it.
row.titlestringyesThe page's title.
row.session_cwdstring or nullyesThe claimant session's working directory, or null.
row.activityobjectyesThe page's activity, bounded to the fields a row shows (compact_activity).
row.activity.countsobjectyes
row.on_userintegeryesHow many rows On me holds.
row.threadsobjectyesWhat the Leaf panel's Threads mark counts (thread_counts): the open threads, and those the user hasn't read.
row.threads.openintegeryes
row.threads.unreadintegeryes

service

The page's desired service, in the page directory's service.json, which hosting.py writes.

Stored with format leaf-service/13.

FieldTypeRequiredDescription
hoststringyesThe address a URL names.
bindstringyesThe address the server binds.
portintegeryesThe port the server listens on.
enabledbooleanyesWhether the page should be served.
lifetime"session" | "persistent"yesWhether the server stops when no live session claims the page, or runs until leaf server stop.
runtimeobjectyesThe Leaf that served it (hosting.payload_provenance).
server_idstringyesThe serving incarnation the server lease names.
restartstringThe mark page init leaves while it holds a served page down to re-vendor it (hosting.restarting_server).

session

One harness session's lifecycle, in the state home's sessions/<digest>.lifecycle (session_file): the lifetime it lives by, whether it has ended, and its current turn.

Stored with format leaf-session/13.

FieldTypeRequiredDescription
idstringyesThe harness's own session id.
generationstringyesReplaced when a claim made before can no longer name this lifetime.
endednull or string (date-time)yesWhen the session ended, or null while it lives.
turnstring or nullyesThe id of the session's latest turn, or null before its first.
turn_openednull or string (date-time)yesWhen the latest turn opened or was last renewed.
turn_closednull or string (date-time)yesWhen the turn closed, or null while it is open.
revisionintegeryesIncremented by every write (write_session).
providerbooleanyesWhether the harness, rather than Leaf, names the turn.
lifetimeobjectyesWhat keeps the session alive (Harness.lifetime).
transcript_pathstringThe native chat a desktop Codex lifetime stands on (chat_exists).
launcherstringThe developer-selected delivery runtime (session_runtime).

stream

What the harness observes of the claimant's task as it runs, in the page directory's stream.json; no_stream while it observes nothing.

Stored with format leaf-stream/16.

FieldTypeRequiredDescription
activityobject or nullyesWhat the task is doing now (set_stream_activity), or null.
activity.sessionstringyesThe claimant session the harness observed.
activity.turnstringyesThe turn it observed.
activity.kindstringyesThe step observed; the page reads one of activity.WORK_KINDS.
activity.tsstring (date-time)yesWhen it was last observed.
activity.afterintegeryesThe log's last seq when it was observed.
activity.detailstringWhat the step names.
replyobject or nullyesThe reply it is drafting (set_stream_reply), or null.
reply.sessionstringyesThe claimant session the harness observed.
reply.turnstringyesThe turn it observed.
reply.attemptstringyesThe delivery attempt it is drafted under.
reply.parentstringyesThe thread it replies in.
reply.respondsstringyesThe input it answers.
reply.itemstring or nullyesThe harness's id for the message supplying the draft, or null while none is attached.
reply.textstringyesIts words so far.
reply.statestringyes
reply.settlesbooleanyes
reply.agentstringyesThe name the claimant shows.
reply.tsstring (date-time)yesWhen the draft began.
reply.updated_atstring (date-time)yesWhen the draft last changed.
reply_reservationsmap of objectyesEach open reply reservation, by the response address it holds (thread.reserve_delivery_reply).
reply_reservations.*.sessionstringyesThe claimant session the harness observed.
reply_reservations.*.turnstringyesThe turn it observed.
reply_reservations.*.attemptstringyes

user-views

The user's browser views of a page, in the page directory's user-views.json.

Stored with format leaf-user-views/16.

FieldTypeRequiredDescription
sessionsmap of objectyesEach document's latest report, by its session id.
sessions.*.sessionstringyesThe document's random session id.
sessions.*.sequenceintegeryesThe report's place among its session's reports.
sessions.*.visiblebooleanyesWhether the document was visible.
sessions.*.revisionintegeryesThe revision the document shows.
sessions.*.through_seqinteger or nullyesThe log position the tab's latest server reading was taken through, or null before one arrives.
sessions.*.viewportobjectyesThe layout viewport, in CSS pixels.
sessions.*.viewport.widthnumberyes
sessions.*.viewport.heightnumberyes
sessions.*.visual_viewportobjectyesThe visual viewport, as window.visualViewport reports it.
sessions.*.visual_viewport.widthnumberyes
sessions.*.visual_viewport.heightnumberyes
sessions.*.visual_viewport.offset_leftnumberyes
sessions.*.visual_viewport.offset_topnumberyes
sessions.*.visual_viewport.scalenumberyes
sessions.*.shown_windowobjectyes
sessions.*.shown_window.xnumberyes
sessions.*.shown_window.ynumberyes
sessions.*.shown_window.widthnumberyes
sessions.*.shown_window.heightnumberyes
sessions.*.color_scheme"light" | "dark"yesThe scheme the document is drawn in.
sessions.*.reduced_motionbooleanyesWhether the user prefers reduced motion.
sessions.*.pointer"coarse" | "fine"yesWhether the primary pointer is coarse, as a finger is, or fine.
sessions.*.scrollobjectyesThe document's scroll offset.
sessions.*.scroll.xnumberyes
sessions.*.scroll.ynumberyes
sessions.*.visible_regionsarray of stringyes
sessions.*.checksobject or nullyesThe document's latest view checks, with the revision, log position, viewport and scheme they read, or null.
sessions.*.checks.sequenceintegeryes
sessions.*.checks.revisionintegeryes
sessions.*.checks.through_seqinteger or nullyes
sessions.*.checks.viewportobjectyes
sessions.*.checks.viewport.widthnumberyes
sessions.*.checks.viewport.heightnumberyes
sessions.*.checks.visual_viewportobjectyes
sessions.*.checks.visual_viewport.widthnumberyes
sessions.*.checks.visual_viewport.heightnumberyes
sessions.*.checks.visual_viewport.offset_leftnumberyes
sessions.*.checks.visual_viewport.offset_topnumberyes
sessions.*.checks.visual_viewport.scalenumberyes
sessions.*.checks.shown_windowobjectyes
sessions.*.checks.shown_window.xnumberyes
sessions.*.checks.shown_window.ynumberyes
sessions.*.checks.shown_window.widthnumberyes
sessions.*.checks.shown_window.heightnumberyes
sessions.*.checks.color_scheme"light" | "dark"yes
sessions.*.checks.readingobjectyes
sessions.*.checks.checked_atstring (date-time)yesWhen the server first received these checks.
sessions.*.received_atstring (date-time)yesWhen the server received the report.
viewednumberWhen a report last said a document was visible, in POSIX seconds (viewed_at).

website-publication

What leaf.page's container last published of a page, in its state home's website-publications/<page key>.json, so an unchanged page is not published again.

Stored with format leaf-website-publication/13.

FieldTypeRequiredDescription
fingerprintstringyesThe page reading the publication was made from (record_reading).

Interaction batch

The browser posts what it observed of the user's session, such as DOM events, to the page's diagnostic trace, observations.jsonl. Nothing in the page's state is read from it.

POST /api/interaction

A batch of browser interaction observations as both doors admit it: the local server's /api/interaction (interaction_log.admit_batch) and leaf.page's Worker, whose zod schema (interactionBatch in worker/src/interactions.ts) worker/test/interactions.test.ts holds to this one. A batch that fails is refused whole. An entry's other fields stay open: the local server keeps them as the browser sent them (runtime/interaction-log.js), and the Worker keeps only the structural fields its projection declares.

FieldTypeRequiredDescription
sessionstringyesThe tab's diagnostic session, the runtime's one random identifier (runtime/ids.js).
entriesarray of objectyesThe observations, each numbered by sequence.
entries[].observed_atstringyesThe tab's wall clock, as Date.prototype.toISOString writes it.
entries[].monotonic_msnumberyesThe document's monotonic clock (performance.now).
entries[].sequenceintegeryesThe observation's place in its session, from 1.
entries[].visibility"visible" | "hidden"yesThe document's visibilityState when it observed the entry.
entries[].typestringyesWhat was observed, such as a DOM event's type.