# API and behavior
Node types, legacy JSON decoding, and full-node body formatting are delegated
to `kcode-kweb-context-node` and re-exported from this crate. `Context` retains
explicitly loaded nodes. Its optional compatibility mode also retains their
fixed connections as full nodes; explicitly loaded nodes take precedence over
that fixed role.
`Context::apply_load` accepts one fetched node. In compatibility mode it also
requires the full nodes fetched for that node's fixed connections.
`Context::restore` reconstructs the same mode-specific state from stored nodes
and the ordered IDs established by prior `LoadNodes` invocations.
`Context::projection` returns the complete current provider-facing sections as
stable logical keys, names, and text without opening or changing Session
History. Every full node keeps its node ID as its stable key. Every connection
map marker is a separate replaceable item keyed by canonical connection ID, so
a consumer using ordinary keyed-state reconciliation emits nothing for an
unchanged reload, adds only newly discovered map markers, and replaces only a
node or map marker whose rendered text changed. This is the projection boundary
for box-free subagent contexts; it never emits one cumulative connection state.
The model-facing terminology is **connection map marker**. Fresh visible
rendering uses the names `Kweb connection map markers` and
`Kweb connection map marker`, and aggregate canonical text starts with the
heading `Connection map markers`. Existing canonical text headed exactly
`Connection summaries` remains readable and is rewritten with the new heading
during an ordinary synchronization. No other legacy or approximate heading is
accepted.
The terminology change does not change implementation or compatibility
identifiers. The logical slots `connection-summaries` and
`connection-summaries:<id>`, metadata key `kwebConnectionSummaryIds`, role value
`connection-summary`, and node fields `short_name` and `short_description`
remain exact. Box membership, box IDs, logical slots, metadata,
representations, storage and wire values, deduplication, permanent-box
behavior, and eight-per-box allocation are unchanged.
`Context::sync_chatend` accepts an already-open Session History session, the
caller's timestamp, and staged updates and creates. It reconciles the complete
provider-facing Kweb projection:
1. one `Loaded` full-node box per explicitly loaded node;
2. in compatibility mode only, one `Fixed` full-node box per distinct fixed
connection not already loaded;
3. one `Staged` full-node box per staged create; and
4. permanent connection-map-marker boxes containing at most eight globally
deduplicated fixed and recent connections each.
Loaded, compatibility-fixed, and staged boxes share the same body formatter.
They differ only in their declared box name and typed metadata. There is no
active-node role or active-connection field.
For every full node, fixed connections are visited in stored order before
recent connections. The combined stream is globally deduplicated by canonical
ID in first-seen order. Each synchronization places newly discovered map
markers in new boxes instead of filling an existing partial or empty box. Every
map-marker box retains its exact membership once created. Existing map-marker
boxes are never retired. When an existing connection's rendered node name or
map marker changes, its current box receives the new canonical text without
changing membership; an unchanged marker does not revise its box.
Caller-selected summarized or dehydrated representations survive canonical
updates. The returned box IDs are exactly the boxes whose active name or
canonical revision changed, in current projection order.
The compatibility flag has no persistence format and is chosen by the caller.
The caller remains responsible for fetching Kweb data, choosing roots and
staged mutations, deciding when to synchronize, and committing the resulting
Kweb transaction. The crate uses the supplied Session History handle only to
apply its projection; it does not open persistence, use HTTP, or access Kweb.