Expand description
The model seam (seam registry ARCHITECTURE 3).
Every provider call carries a BuildingPolicy value; the policy is
defined here (kernel cannot name outer crates) and evaluated by
city::policy — dependency inversion, same as the ledger seam.
The part crates/kernel/spec/Model.lean specifies this module.
Structs§
- Account
Roster - The accounts an adapter can call as, in priority order, and the one
its next request goes out on. Answered once before a round opens
(
crates/kernel/spec/AccountRecovery.lean§8-86), never per attempt. - Building
Policy - Building-level constraints riding along the call. It carries the one load-bearing bit; further fields only grow, and each one is added at every construction site the compiler names.
- Ceiling
- The most a model may emit in one response, thinking included.
- Chat
Message - Chat
Request - The canonical request conversation (city dialect = Anthropic Messages). Both production dialects and the scripted model consume this one shape — the seam carries it so replay, citysim and the real gateway argue about the same object.
- Chat
Response - The canonical response: dialect output, endpoint input.
- Image
Ref - One picture, as everything except the wire refers to it.
- Model
Request - What the adapter needs to make one call.
segmentsare the frozen prefix hashes (same source asprompt_assembled);chatis the full canonical conversation the dialect puts on the wire. - Model
Return - One assistant turn.
messageis the in-window content;callsis the requested tool wave — empty means the turn loop may conclude the run.usage/stop/billed_usd_microsride along from real dialects and stayNonefor scripted adapters that predate cost accounting. - Model
Usage - Provider-reported token counts.
- Roster
Entry - One account of a roster, and whether its reference can be redeemed right now (kernel D55). Neither the key nor the reference is here.
- RunPolicy
- The four values one run works under, chosen when it is dispatched
and written into its
run_startedline. - System
Block - One frozen-prefix block on the wire.
cachemarks an explicit prompt cache breakpoint (breakpoints sit on segment edges). - ToolDef
- A tool as the provider sees it; sourced from catalog
tool_defsonly. - Window
- The most tokens one model reads in a single call, prompt and reply together.
Enums§
- Admission
Requirement - The evidence a run’s work must carry before a merge lets it into the building.
- Cache
Count - One cache count as a provider reported it: a number, or nothing at all.
- Content
Block - Canonical content block. Tool inputs are
Payload— the float ban holds here because these bytes become ledger payloads verbatim. - Dialect
Kind - Which wire the far side speaks. Closed: a fourth dialect is a
compile error at every entrance of
gateway::dialect, which is how it is kept from being approximated with the nearest of the three already written. - Effort
- How hard the provider should think, least to most, in the upstreams’ words. Which levels one
(Endpoint, model) offers is the upstream’s statement, answered by the gateway’s thinking
ladder and never by a table here (
crates/kernel/spec/Model.leanD56); a level outside the offer is refused, never moved to a neighbour. Check the vendors before changing the ladder: https://platform.claude.com/docs/en/build-with-claude/effort, https://developers.openai.com/api/docs/guides/reasoning. - Image
Type - The picture formats this city carries.
- Increment
- One piece of what a model is producing, before the call it belongs to has settled.
- Landing
Policy - Whether a run’s work takes the ordinary road or stays in an experiment that never lands.
- Message
Breakpoint - Which message of a request carries an explicit prompt-cache breakpoint.
- Mode
- Whether a run is talking with the person or carrying out work.
- Model
Tag - What a chosen model is for. Exhaustive rather than a free label: a tag exists because some code asks for a model by it, so a tag with no asker is a setting the person can fill in and never see used. It grows when a caller appears, not when a name is imagined.
- Role
- Message author on the canonical (Anthropic-shaped) conversation.
- Shared
Prefix - How many of a request’s leading system blocks every resident of one
building carries byte for byte (
crates/kernel/spec/Model.leanD60). - Stop
Reason - Why the provider stopped. Wire-borne and closed: a fourth reason has to be answered by every dialect that maps one (14.3).
Traits§
- Model
- The model port. Production adapter: gateway::endpoint; second adapter: citysim scripted model. Implementations never sample clocks or read global state.
Functions§
- content_
from_ message - The inverse of
message_payloadfor window folding and rebuild. - message_
payload - The account-side form of assistant content: the single authority for
how content blocks enter
model_returnedpayloads (and thus how the window is rebuilt offline, C16).
Type Aliases§
- Early
Calls - A tool call handed over the moment its block is complete, before the call it belongs to has settled.
- Increments
- Text arriving from a provider before the call has finished.