@weftjs/kernel
The document request path: the lifecycle, the two-phase envelope, routing, cache-key derivation, wave dispatch and the stream. It imports nothing but the WinterTC Minimum Common Web API, so the same kernel runs on Node, Deno, Bun, a worker and the edge unchanged — and everything a framework usually does that is not one of those jobs is a port on the other side of this module.
Read out of packages/kernel/src/index.ts, the package’s public entry, so this page is the surface itself rather than a description of it.
ackFrame
function
export function ackFrame(outcome: IntentOutcome, epoch?: string): Frame { … }The ACK. Carries the outcome rather than only the fact of arrival: a client that staged an optimistic epoch needs to know whether to commit it or discard it.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
Specified inspec/FINDINGS.md·spec/kernel/budgets.md
anchorFor
function
export function anchorFor(slot: string): Uint8Array { … }The comment left in a hole for out-of-order delivery, which the fill script finds by walking.
announceRegion
function
export function announceRegion(announcement: RegionAnnouncement): Frame { … }The other end of the check above: what a region says about itself before it says anything else. A REGION frame answering a probe carries the subtree instead — that form lives in region-tree.ts.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
applyDeferred
function
export function applyDeferred(envelope: Envelope, effects: readonly DeferredEffect[]): number { … }Applied at the top of phase A, which is the only place they can still be real headers.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
b64url
function
export function b64url(bytes: Uint8Array): string { … }Base64url, without Buffer: the kernel has the Minimum Common API and nothing else.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
baseKey
function
export function baseKey(tpl: string, id: string): string { … }Where a region's last render is held, so the next delta has something to be a delta against.
cacheHeaders
function
export function cacheHeaders(resolved: ResolvedKey, policy?: CachePolicy): Record<string, string> { … }Cache-Control and Vary, derived from the same effect signature that produced the key. A private class can never be emitted as public — the one header mistake that turns a caching bug into an identity leak.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
Specified inspec/kernel/cache.md
canonical
function
export function canonical(value: unknown): string { … }The payload, in one spelling.
A digest over JSON.stringify as it happens to come out would make a token that binds {a:1,b:2} refuse {b:2,a:1} — the same call, written by a client that iterated its own object in a different order. Keys are sorted at every depth, and arrays are left alone because their order is data.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
Specified inspec/kernel/authority.md·spec/kernel/static.md
chainSplitter
function
export function chainSplitter(links: readonly ShellLink[]): Splitter { … }A splitter for a route whose document is a chain of layouts. Built on the flat splitter: each layer is cut the way any document is, and the cuts are spliced together, so nothing downstream can tell a chain from a single document. A link whose at is not a boundary is left unspliced rather than throwing — that check already happened twice, in the plan layer and the generator.
Specified inspec/kernel/budgets.md·spec/kernel/routing.md
channelRegions
function
export function channelRegions(options: ChannelRegionOptions): ChannelRegions { … }Answers a REFRESH for a region, or nothing when the slot is not one — which is what lets a deployment chain this in front of its own slot source without either of them knowing about the other.
clientExecutor
function
export function clientExecutor(): KernelExecutor { … }The slot is not rendered on the server at all. The island ships and the browser renders it.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
covers
function
export function covers(grant: Grant, capability: string): boolean { … }True when grant covers capability. Exact, or a namespace ending in :*.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
createCapabilityModel
function
export function createCapabilityModel(options: CapabilityOptions): CapabilityModel { … }A model over a grant source. A source that is down is a refusal about the source, not the subject.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
createComposer
function
export function createComposer(options: ComposeOptions): Composer { … }A composer over this deployment's ports: a region is a local async function, and the boundary is the executor the registry named one level in.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
createEnvelope
function
export function createEnvelope(life: Lifecycle): Envelope { … }An envelope bound to one request's lifecycle, so a late write is a named refusal.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
createEpochs
function
export function createEpochs(maxOpen = 8): Epochs { … }An epoch table for one connection.
Raised in this fileE_NO_SUCH_EPOCH·E_STAGE_LIVE·E_TOO_MANY_EPOCHS
Specified inspec/kernel/locus.md
createExtender
function
export function createExtender(options: DiscoveryOptions): PlanExtender { … }Answers WARM plan= with a PLAN. A prefix matching nothing is an empty answer, not a silence.
createHub
function
export function createHub(options: HubOptions): ChannelHub { … }A hub over the ports and handlers a deployment bound.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
createIntentDispatch
function
export function createIntentDispatch(options: IntentDispatchOptions): IntentDispatch { … }A dispatch over a closed set. An id nothing answers is E_NO_SUCH_INTENT, never a 500.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
createIntentRouter
function
export function createIntentRouter(routes: readonly IntentRoute[]): IntentRouter { … }A router over a closed set. Refuses to be built from a GET: the oldest bug on the web.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
Specified inspec/kernel/intents.md
createIntentSigner
function
export function createIntentSigner(options: SignerOptions): IntentSigner { … }A signer over Ed25519. Minting is uncacheable by construction, which is why it is its own request.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
createIntentVerifier
function
export function createIntentVerifier(options: VerifierOptions): IntentVerifier { … }A verifier over a bundle of pinned public keys, so a key can be added before the old one retires.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
createKernel
function
export function createKernel(options: KernelOptions): Kernel { … }A kernel over a set of ports and a route table.
Raised in this fileE_NO_ROUTES·E_UNKNOWN_EXECUTOR
Specified inspec/FINDINGS.md·spec/kernel/budgets.md·spec/kernel/cache.md
createMailbox
function
export function createMailbox(maxConnections = 1024): DeferredMailbox { … }Where a deferred cookie or header waits for a connection's next response. Bounded on purpose.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
Specified inspec/kernel/lifecycle.md
createReads
function
export function createReads(facts: RequestFacts, ports: Ports, options: ReadOptions = {}): Reads { … }The runtime half of effect tracking: resolve each read, and remember that it happened.
createRenderDispatch
function
export function createRenderDispatch(options: RenderDispatchOptions): RenderDispatch { … }A dispatch over a catalogue. Separate from intents: an intent is the only thing allowed to *write*, and a render is the one thing that cannot.
Raised in this fileE_CAPABILITY_DENIED·E_NO_CAPABILITY_CHECK·E_NO_CATALOGUE·E_NO_RATE_LIMIT·E_NO_SUCH_RENDERABLE·E_NO_VERIFIER·E_RATE_LIMITED·E_RENDER_FAILED·E_RENDER_INPUT
Specified inspec/kernel/authority.md·spec/kernel/intents.md
createRouter
function
export function createRouter<T>(entries: readonly RouteEntry<T>[]): Router<T> { … }A table, checked at construction. Two patterns that can match the same paths are E_ROUTE_CONFLICT here rather than a surprise later.
Raised in this fileE_BAD_PATTERN·E_ROUTE_CONFLICT
Specified inspec/FINDINGS.md·spec/kernel/budgets.md·spec/kernel/routing.md
createStager
function
export function createStager(options: StageOptions): RouteStager { … }Answers WARM at=, which is a route staged and painted nowhere. Two decisions only this side can make: whether the target shares the client's shell, and each region's next state.
Raised in this fileE_NO_NEGOTIATION·E_NO_SUCH_ROUTE
createStaleRegistry
function
export function createStaleRegistry(): StaleRegistry { … }Which connections hold which keys, so an invalidation reaches the pages that showed them.
Specified inspec/kernel/ports.md·spec/kernel/surgical.md
criticalPath
function
export function criticalPath(nodes: readonly DagNode[]): CriticalPath { … }The chain that decides the page's floor, so a report can name what to make faster.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
Specified inspec/kernel/locus.md
deferredExecutor
function
export function deferredExecutor(telemetry?: TelemetryPort): KernelExecutor { … }A stand-in for a genuinely separate crash domain: the job runs on a fresh macrotask. Not a worker thread, and does not claim to be one.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
defineIntent
function
export function defineIntent<I>(intent: Intent<I>): Intent<I> { … }An identity function that exists for the types: it is what makes writes checkable.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
definePlugin
function
export function definePlugin(plugin: Plugin): Plugin { … }An identity function that exists for the types: it is what makes the declarations checkable.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
degrade
function
export function degrade(input: DegradeInput, failure: { code: string; message: string }): Uint8Array { … }What a breached budget actually produces. Every outcome here is visible.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
deltaKey
function
export function deltaKey(tpl: string, from: string, to: string): string { … }A delta keyed by the transition it encodes — which is what lets one computation serve every client.
deviceOf
function
export function deviceOf(facts: RequestFacts): string { … }Coarse on purpose. A high-cardinality device string would be a high-cardinality cache key.
digest
function
export async function digest(value: unknown): Promise<string> { … }SHA-256 of a canonical encoding, so the same payload digests the same on both tiers.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
dispatch
function
export async function dispatch(nodes: readonly DagNode[], options: DispatchOptions): Promise<void> { … }Waves with a concurrency ceiling — forty concurrent queries from one page will melt a database.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
Specified inspec/FINDINGS.md·spec/kernel/budgets.md·spec/kernel/locus.md
encodeRegionTree
function
export function encodeRegionTree(tree: readonly RegionNode[]): Uint8Array | undefined { … }What a region says about itself when it composed nothing: the empty tree, and its own count.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
envelopeContext
function
export function envelopeContext(reads: Reads, envelope: Envelope): EnvelopeContext { … }Phase A's context. The only one that can set a status, a cookie or a redirect.
errorFrame
function
export function errorFrame(code: string, detail: string): Frame { … }A refusal as a frame. A stage that silently did nothing is indistinguishable from one that worked.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
fillerBytes
function
export function fillerBytes(): Uint8Array { … }The fill script as bytes, sent once before the first out-of-order fill.
fillerSize
function
export function fillerSize(): number { … }How large it is, so a report can price out-of-order delivery honestly.
fillFor
function
export function fillFor(slot: string, content: Uint8Array): Uint8Array { … }A region arrives as inert template content plus a call to move it. Not inside a string literal, so nothing needs escaping for JavaScript.
formatRegionGraph
function
export function formatRegionGraph(tree: readonly RegionNode[], indent = ' '): string { … }A graph as something a person reads. Indented rather than boxed: the depth is the point.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/composition.md
grantsOf
function
export function grantsOf(roles: readonly string[], table: Record<string, readonly Grant[]>): Grant[] { … }The grants a set of role names amounts to. Exported because the closed-set check needs it — a capability nothing can grant is an intent permanently 403 with nothing saying why.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
guardReads
function
export function guardReads(plugin: Plugin, ctx: EnvelopeContext): EnvelopeContext { … }Declared reads, enforced reads. Dev-only, so it is not in the request entry — wire it explicitly: createKernel({ guard: guardReads }). See spec/plan/plan.md.
Raised in this fileE_PLUGIN_UNDECLARED_READ
Specified inspec/FINDINGS.md
heldFrame
function
export function heldFrame(held: readonly Held[], options: { only?: boolean } = {}): Frame { … }What the client is showing, per slot — and, with only, that this is the whole of it. only says the client has navigated: slot names belong to a page. See spec/kernel/transport.md.
inlineExecutor
function
export function inlineExecutor(telemetry?: TelemetryPort): KernelExecutor { … }The default, and the fastest thing for a cheap fragment. Abort is cooperative: the job is handed a signal and is expected to check it, which is exactly as strong a guarantee as the runtime can give here.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
isHardLimit
function
export function isHardLimit(preemption: Preemption): boolean { … }Whether a budget on this executor is a limit. Only a separate crash domain can promise one.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
keyMaterial
function
export function keyMaterial(
input: KeyInput,
components: Record<string, string>,
axes: Record<string, string>,
): string { … }The bytes a key is a hash of. Sorted, so it never depends on the order reads were written in.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
Specified inspec/kernel/cache.md
leaseCoalescer
function
export function leaseCoalescer(store: StorePort, options: CoalesceOptions = {}): Coalescer { … }One render per cold key, using the store's lease. Opt-in: the good version is store-specific, and a coalescer written into the request path would be one every deployment pays for.
Specified inspec/kernel/cache.md
lifecycle
function
export function lifecycle(): Lifecycle { … }One request's lifecycle, which is also the log of what it did.
Raised in this fileE_REQUEST_STATE
linkHeader
function
export function linkHeader(links: readonly PreloadLink[]): string { … }One Link header value. The per-link form is exported too: Node's writeEarlyHints wants an array, not a joined string.
Raised in this fileE_HINTS_AFTER_COMMIT
Specified inspec/FINDINGS.md
linkValue
function
export function linkValue(link: PreloadLink): string { … }103 Early Hints, and the reason the whole envelope design hangs off it: send it with the shell's critical links at effectively zero milliseconds, and the envelope stays open for phase A to finish. H2/H3 only. See spec/kernel/lifecycle.md.
Raised in this fileE_HINTS_AFTER_COMMIT
Specified inspec/FINDINGS.md
localeOf
function
export function localeOf(facts: RequestFacts): string { … }The locale, from Accept-Language. Coarse, because a high-cardinality key is a bad key.
parseCookies
function
export function parseCookies(header: string | null): Record<string, string> { … }A Cookie header as a map. Malformed pairs are skipped rather than throwing on a request.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
parseHeld
function
export function parseHeld(f: Frame): Held[] { … }What a HELD frame says this client is holding: templates, and the base render per region.
payloadKey
function
export function payloadKey(form: 'delta' | 'patch', tpl: string, from: string, to: string): string { … }A surgical payload is named by the transition it encodes rather than by the connection that asked, which is the whole of why one computation serves ten thousand clients. The form is in the key because a delta and a patch of one transition are two different answers.
Specified inspec/kernel/budgets.md
planFrame
function
export function planFrame(extension: PlanExtension): Frame { … }One PLAN frame. A JSON body, not headers: the routes are a list of records.
probeRegions
function
export async function probeRegions(
ports: ProbePorts,
regions: readonly string[],
depth: number = PROBE_DEPTH,
): Promise<readonly RegionNode[]> { … }The recursive half: what a deployment answers when *it* is the region being probed — its whole subtree, resolved through its own registry, one depth cheaper than asked. A region that cannot be reached becomes a node saying so rather than an exception.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/composition.md
readRegion
function
export function readRegion(region: string, bytes: Uint8Array, contract?: RegionContract): RegionFrames { … }Read what a region answered, and refuse anything it was not entitled to say.
Three checks, and the order matters. The stream has to announce itself, because an unannounced stream is an unattributable one. The announcement has to name the region that was *asked for*, because the alternative is a registry entry deciding which hole it fills. And every frame after it has to name a slot inside that region, because writing into a sibling's hole is the actual security hole in "rendering as a service", not a hypothetical one.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
Specified inspec/kernel/budgets.md
readRegionTree
function
export function readRegionTree(region: string, bytes: Uint8Array): readonly RegionNode[] { … }Read a subtree out of what a region announced, and check it against what the same frame counted. Every node is one deployment's claim about another, so what is checked is shape and arithmetic — hops was previously unverifiable and a mismatch now refuses.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
readsFor
function
export async function readsFor(
ctx: Reads,
contract?: RegionContract,
): Promise<Record<string, string> | undefined> { … }A region's declared reads, resolved through the same context a local fragment's would be — so the document's key and Vary describe the region's reads whether it is local or across a socket.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
Specified inspec/kernel/composition.md
recordBase
function
export async function recordBase(
store: StorePort,
ir: TemplateIR,
values: Values,
ttl: RefreshTtl = {},
): Promise<string> { … }Remember the render a client is about to be shown, so its first refresh can be a delta.
recoverBase
function
export async function recoverBase(store: StorePort, tpl: string, id: string): Promise<Values | null> { … }The values behind the base render a client named, or nothing — in which case html it is.
regionEffects
function
export function regionEffects(contract?: RegionContract): EffectSet { … }The effect set a composite uses for a region, which is where a region's cache class comes from.
Derived on the other side and carried in the contract, never declared here — the composite runs the region's reads through the same cacheClassOf and varyOn as a local fragment's. A region that described nothing reads opaque: uncacheable, private, and therefore unable to make the document containing it look shareable. Unknown is not nothing.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
Specified inspec/kernel/composition.md
regionGraph
function
export function regionGraph(composed: readonly RegionOutcome[]): readonly RegionNode[] { … }Every region a composer composed, as the graph to hand to whoever asked.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/composition.md
regionNode
function
export function regionNode(outcome: RegionOutcome): RegionNode { … }One outcome as a node: what a tier's own render actually composed. One level, deliberately — a render carries the count rather than a subtree, and the count is **measured**.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
regionProbe
function
export function regionProbe(
ports: Pick<Ports, 'executors'>,
depth = PROBE_DEPTH,
): (binding: RegionBinding) => Promise<Uint8Array> { … }Ask every region what it is actually serving, so weft verify can fail on a disagreement.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/composition.md
regionProbeStream
function
export function regionProbeStream(announcement: RegionAnnouncement, tree: readonly RegionNode[]): Uint8Array { … }What a region answers with when it was asked what it is rather than for a page. A leaf answers with no body: "composes nothing".
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
regionStream
function
export function regionStream(announcement: RegionAnnouncement, frames: readonly Frame[]): Uint8Array { … }A region's whole answer: the announcement, then its frames, as one Warp stream.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
renderContext
function
export function renderContext(reads: Reads, envelope: Envelope): RenderContext { … }Phase B's context. The same reads and no envelope methods, which is how a render cannot write.
requestFacts
function
export function requestFacts(request: Request, params: Record<string, string> = {}): RequestFacts { … }The request, reduced to what a read may see. Deliberately not the Request: a render that could reach the whole thing could read something the compiler never saw.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
resolveKey
function
export async function resolveKey(input: KeyInput, facts: RequestFacts, ports: Ports): Promise<ResolvedKey> { … }Reads to a key, by asking the ports for their values. There is no setter and there never will be.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
Specified inspec/compiler/effects.md
resolvePlugins
function
export function resolvePlugins(plugins: readonly Plugin[], options: ResolveOptions = {}): PluginSchedule { … }Plugins into an order, from what each declares it reads and provides. At build time, so a cycle and an ambiguity are both build errors rather than a race nobody can reproduce.
Raised in this fileE_PLUGIN_AMBIGUOUS·E_PLUGIN_CAPABILITY_UNGRANTABLE·E_PLUGIN_CYCLE·E_PLUGIN_DUPLICATE·E_PLUGIN_RESIDENCY
Specified inspec/FINDINGS.md·spec/kernel/budgets.md·spec/plan/plan.md
resolveRead
function
export async function resolveRead(read: string, facts: RequestFacts, ports: Ports): Promise<string> { … }Resolves one taint to the value that has to go in the key. time is absent: the clock is a TTL, not a key component.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
Specified inspec/kernel/cache.md
resolveScoped
function
export function resolveScoped(plugins: readonly Plugin[], options: ResolveOptions = {}): ScopedPlugins { … }One schedule per prefix, so a route carries the plugins that apply and pays nothing for the rest.
Raised in this fileE_PLUGIN_AMBIGUOUS·E_PLUGIN_CAPABILITY_UNGRANTABLE·E_PLUGIN_CYCLE·E_PLUGIN_DUPLICATE·E_PLUGIN_RESIDENCY
Specified inspec/plan/plan.md
roleGrants
function
export function roleGrants(options: RoleGrantOptions): GrantSource { … }Grants by role, which is the smallest source that is not a stub.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
runPlugins
function
export async function runPlugins(
schedule: PluginSchedule,
ctx: EnvelopeContext,
guard?: ReadGuard,
): Promise<PluginRunResult> { … }Run a schedule against one request, stopping at the first plugin that answers.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
schedule
function
export function schedule(nodes: readonly DagNode[]): Schedule { … }Slots into waves, from their declared dependencies. Watch the waves, not the sum.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
Specified inspec/FINDINGS.md·spec/kernel/budgets.md·spec/kernel/locus.md
selectForm
function
export function selectForm(input: FormInput): FormChoice { … }The degradation ladder: two rungs rather than the design's three. data was cut in IR 2.0.0 after measurement. See spec/FINDINGS.md.
Specified inspec/FINDINGS.md·spec/kernel/budgets.md·spec/kernel/surgical.md
sendEarlyHints
function
export async function sendEarlyHints(
life: Lifecycle,
transport: TransportPort | undefined,
links: readonly PreloadLink[],
): Promise<HintResult> { … }Send a 103 for a route's critical links, before the envelope settles.
Raised in this fileE_HINTS_AFTER_COMMIT
Specified inspec/kernel/lifecycle.md
serializeCookie
function
export function serializeCookie(c: SetCookie): string { … }A Set-Cookie header value. Attributes are emitted in the order the RFC lists them.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
serveIntent
function
export function serveIntent(options: ServeIntentOptions): IntentServer { … }Intents over HTTP, in phase A — where a real status, an HttpOnly cookie and a crawler-followable redirect are all still possible.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
serverCapabilities
function
export function serverCapabilities(overrides: Partial<ServerCapabilities> = {}): ServerCapabilities { … }What this build can actually serve. The two wire packages are versioned independently, so this is the only place that can state both.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
Specified inspec/FINDINGS.md
splitAtSlots
function
export function splitAtSlots(ir: TemplateIR, values: Values, resolve?: Resolver): SlotSplit { … }Cuts the shell at its slot holes, and at every instance the compiler isolated — bytes the server can send before it knows anything about the slow work. An isolated instance is the same cut for a different reason: the child is private and the shell is not.
Specified inspec/kernel/budgets.md·spec/kernel/routing.md·spec/kernel/streaming.md
storeJournal
function
export function storeJournal(store: StorePort, options: StoreJournalOptions = {}): StaleJournal { … }The journal over whatever store the deployment already bound. Cross-instance on a shared store, with no broker. A process-scoped store is refused at build time: E_TAGS_PROCESS_SCOPED.
Raised in this fileE_TAGS_PROCESS_SCOPED
streamRoute
function
export function streamRoute(route: Route, options: StreamOptions): ReadableStream<Uint8Array> { … }Two orders, and the difference between them is not a tuning knob. in-order needs no JavaScript and a slow slot holds back everything after it; out-of-order sends the shell first and fills whichever slot resolves first, at the cost of a fill mechanism. See spec/kernel/streaming.md.
surgicalRefresh
function
export async function surgicalRefresh(input: SurgicalInput): Promise<SurgicalResult> { … }The whole flow, end to end: recover, recompute, diff, memoize, emit — keyed by the transition, not the connection, so the ten-thousandth client making it pays a store read.
Specified inspec/kernel/surgical.md·spec/kernel/transport.md
treeHops
function
export function treeHops(tree: readonly RegionNode[]): number { … }Every boundary a tree crosses, which is the number that goes in the announcement beside it.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
unb64url
function
export function unb64url(text: string): Uint8Array<ArrayBuffer> { … }base64url back to bytes. Throws on anything that is not base64url, which a malformed token is.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
unimplemented
function
export function unimplemented(port: PortName): never { … }The body of a port that is declared and not bound. Refuses by name rather than approximating.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Classes
15AuthorityError
class
export class AuthorityError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'AuthorityError'
this.code = code
}
}An authority refusal, carrying the code so the HTTP status can be derived from it.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
CacheError
class
export class CacheError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'CacheError'
this.code = code
}
}Turning an inferred read set into an actual key. Nothing here is written by hand — a key that can be hand-set can drift from what the code reads. Resolved before the render, never after: on a hit there is no render. See spec/kernel/cache.md.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
ChannelError
class
export class ChannelError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'ChannelError'
this.code = code
}
}A channel refusal, carrying the code — which is also what goes into an ERROR frame.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
EnvelopeError
class
export class EnvelopeError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'EnvelopeError'
this.code = code
}
}The response envelope, and the two phases HTTP forces on it: phase A owns it, phase B streams with a context that has no envelope methods on it at all, so the mistake cannot be written. See spec/kernel/lifecycle.md.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
EpochError
class
export class EpochError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'EpochError'
this.code = code
}
}An epoch refusal: too many open, or a commit of one that does not exist.
Raised in this fileE_NO_SUCH_EPOCH·E_STAGE_LIVE·E_TOO_MANY_EPOCHS
IntentError
class
export class IntentError extends Error {
code: string
intent: string
constructor(code: string, intent: string, message: string) {
super(`${code} [${intent}] — ${message}`)
this.name = 'IntentError'
this.code = code
this.intent = intent
}
}Intents: the only thing in this framework allowed to write. A write is declared and an undeclared one throws, not in dev only. The client never names server code — an intent is addressed by an opaque id. See spec/kernel/intents.md.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
LifecycleError
class
export class LifecycleError extends Error {
code: string
state: RequestState
constructor(code: string, state: RequestState, message: string) {
super(`${code} in state ${state} — ${message}`)
this.name = 'LifecycleError'
this.code = code
this.state = state
}
}A transition the state machine does not have: E_REQUEST_STATE, naming both states.
Raised in this fileE_REQUEST_STATE
PlanGraphError
class
export class PlanGraphError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'PlanGraphError'
this.code = code
}
}A graph refusal: a cycle, or a dependency on a slot the plan does not have.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
PluginError
class
export class PluginError extends Error {
code: string
plugin: string
constructor(code: string, plugin: string, message: string) {
super(`${code} [${plugin}] — ${message}`)
this.name = 'PluginError'
this.code = code
this.plugin = plugin
}
}A plugin refusal, including the build-time ones: a cycle and an ambiguity are both this.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
PortError
class
export class PortError extends Error {
code: string
port: PortName
constructor(code: string, port: PortName, message: string) {
super(`${code} [${port}] — ${message}`)
this.name = 'PortError'
this.code = code
this.port = port
}
}A port refusal, carrying which port and which code, so a caller branches on neither the text.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
RegionError
class
export class RegionError extends Error {
code: string
region: string
constructor(code: string, region: string, message: string) {
super(`${code} [${region}] — ${message}`)
this.name = 'RegionError'
this.code = code
this.region = region
}
}Composition, which is the design's phase 9 and the one thing here that is not a new mechanism.
A region is a fragment that happens to live somewhere else. Everything that makes that work already exists: an executor is already a crash domain and a budget boundary, a registry is already a port, and the frames a render produces are already the frames that go to a client. What was missing is the name — a shell says search and something has to say where search is — and the check, because frames arriving from another deployment are somebody else's and a length prefix does not say whose.
So this file is two things and deliberately not a third. It resolves a region through the registry and runs it through the executor the registry named, and it checks what came back before any of it reaches a page. It is not a second render path: a region on inline takes the same executor every other slot takes, which is what keeps the collapsed monolith the best-tested shape rather than the one nobody runs.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
RenderIntentError
class
export class RenderIntentError extends Error {
code: string
renderable: string
constructor(code: string, renderable: string, message: string) {
super(`${code} [${renderable}] — ${message}`)
this.name = 'RenderIntentError'
this.code = code
this.renderable = renderable
}
}Render intents: a catalogue of fragments addressable by opaque id, gated the same way an intent is — createRenderDispatch calls the same CapabilityCheck, IntentVerifier and LimitPort. REFRESH with a source named rather than a frame of its own, for the same reason a render intent gets the same surgical ladder. See spec/kernel/composition.md.
Raised in this fileE_CAPABILITY_DENIED·E_NO_CAPABILITY_CHECK·E_NO_CATALOGUE·E_NO_RATE_LIMIT·E_NO_SUCH_RENDERABLE·E_NO_VERIFIER·E_RATE_LIMITED·E_RENDER_FAILED·E_RENDER_INPUT
RouterError
class
export class RouterError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'RouterError'
this.code = code
}
}Matching a URL to a plan. Knows nothing about plans, fragments or rendering: it maps a path to a value and a set of params. Specificity decides matches, never declaration order. See spec/kernel/routing.md.
Raised in this fileE_BAD_PATTERN·E_ROUTE_CONFLICT
SlotError
class
export class SlotError extends Error {
code: string
slot: string
constructor(code: string, slot: string, message: string) {
super(`${code} [${slot}] — ${message}`)
this.name = 'SlotError'
this.code = code
this.slot = slot
}
}A slot failure, carrying the code the degradation policy branches on.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
TokenError
class
export class TokenError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'TokenError'
this.code = code
}
}A signing or verification refusal, carrying the code so a caller branches on it.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
Interfaces
135AssetPort
interface
export interface AssetPort {
readonly name: string
/** Emitted in the 103, before the envelope is settled. */
criticalFor(route: string): PreloadLink[]
chunksFor(route: string): string[]
}What a route needs early: the links worth a 103, and the chunks a bundler would pack.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
CachePolicy
interface
export interface CachePolicy {
class: PolicyClass
ttlMs?: number
staleWhileRevalidateMs?: number
tags?: string[]
}What a route declares about holding its response: the class, a TTL, and tags.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
Specified inspec/kernel/cache.md
CapabilityModel
interface
export interface CapabilityModel {
/** The `CapabilityCheck` the intent dispatch takes. */
readonly check: CapabilityCheck
/** The same decision, with the reasons on it. What an audit page and a test read. */
decide(ctx: EnvelopeContext, capabilities: readonly string[]): Promise<Decision>
/** Decisions taken, newest last, capped. For devtools; never for a policy decision. */
recent(): readonly Decision[]
}Answers whether a caller may run an intent. An unchecked capability is refused, not allowed.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
CapabilityOptions
interface
export interface CapabilityOptions {
grants: GrantSource
/** Grants every caller holds, session or not. Where a public capability goes. */
ambient?: readonly Grant[]
/** Every decision, allowed and denied both — a log of denials only hides a successful escalation as silence. */
audit?(decision: Decision): void
telemetry?: TelemetryPort
}Where grants come from, and what every caller holds without asking.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
Channel
interface
export interface Channel {
readonly id: string
readonly binding: ChannelBinding
/** Null until RESIDENT arrives. Every form decision needs it. */
readonly hello: ClientHello | null
readonly negotiation: Negotiation | null
readonly epochs: Epochs
/** What the client holds per slot: updated by HELD, and by every refresh this channel serves. */
readonly held: ReadonlyMap<string, Held>
/** The last epoch this client reported committing. Set by RESUME. */
readonly resumedAt: string | null
readonly open: boolean
/** Frames handed to the sink. A dropped send does not count. */
readonly sent: number
send(frames: readonly Frame[]): Promise<number>
close(reason?: string): void
}One connection's state: what it negotiated, what it holds, and where it last committed.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
ChannelHub
interface
export interface ChannelHub {
/** Open a channel, or rebind an existing one under the same id: a frozen webview reconnects and
* keeps the base renders it was known to hold. */
open(sink: ChannelSink, id: string): Channel
get(id: string): Channel | undefined
/** Frames from a client, whatever binding carried them. Returns what went back down. */
receive(id: string, frames: readonly AnyFrame[]): Promise<Frame[]>
/** Invalidate tags, then tell every open channel holding one of the dropped keys. The client
* decides whether and when to refresh. */
invalidate(tags: string[], reason?: string): Promise<{ keys: string[]; notified: number }>
/** Tell connections about keys something else already dropped — the store is already cold by
* the time the channel sees the outcome. */
notify(keys: readonly string[], reason: string, options?: { except?: string }):
…Every open channel, and the frames that pass through them.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
ChannelRegionOptions
interface
export interface ChannelRegionOptions {
composer: Composer
/** What the shell declares about each region it composes, by name. */
regions: Record<string, RegionSpec>
/** The route this channel is on, for a region that renders per route. */
route?(channel: Channel): string | undefined
}A region refreshed over a live channel: the same region, a different question. The region is given what this client holds and makes the form choice on its own side. This module is the adapter between what a composer returns and what a channel needs. See spec/kernel/composition.md.
ChannelSink
interface
export interface ChannelSink {
readonly binding: ChannelBinding
/** False once the peer has gone. Sending to a closed sink is dropped and reported, never thrown. */
readonly open: boolean
/** True when the transport's buffer is above its watermark. See `spec/kernel/transport.md`. */
readonly saturated?: boolean
send(frames: readonly Frame[]): void | Promise<void>
close(reason?: string): void
}The transport underneath a channel, whichever of the four bindings it is. saturated is the field that matters — a sink that never reports it makes a slow consumer look like a fast one.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
CoalesceOptions
interface
export interface CoalesceOptions {
/** How long the winner holds the right to fill. Longer than a render, shorter than a page load. */
leaseMs?: number
/** How long a loser waits before rendering anyway. */
waitMs?: number
pollMs?: number
}A stampede lease. One renderer takes the lease; the rest wait for its result. This polls, because an isolate-local map cannot tell anybody a key was filled — a store with pub/sub would subscribe instead, which is why the kernel names the seam and this supplies the policy.
Two properties enforced rather than documented: the wait is **bounded** — on expiry the waiter renders too, since a duplicated render beats a hanging request — and the lease is released in a finally, so a render that throws does not hold it.
ComposeOptions
interface
export interface ComposeOptions {
/** Narrower than `Ports`: a composer needs a registry, somewhere to run, somewhere to report —
* the shape a nested tier has. */
ports: Pick<Ports, 'registry' | 'executors' | 'telemetry'>
/**
* Regions this process renders itself, keyed by region name — the monolith. A local region is
* not a special case here, it is a registry entry whose executor is `inline`.
*/
local?: Record<string, (request: RegionRequest, signal: AbortSignal) => Promise<Uint8Array> | Uint8Array>
}What composing needs: the registry, the executors, and the contract each region must satisfy.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
Composer
interface
export interface Composer {
compose(spec: RegionSpec, request?: RegionRequest): Promise<RegionOutcome>
/** Every region composed by this instance, in the order they were asked for. */
readonly composed: readonly RegionOutcome[]
/** Boundaries crossed serving this page. The number the design says should not be discovered under load. */
readonly hops: number
}Composes regions into a page, checking each one's frames before any of it reaches the reader.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
ConfigPort
interface
export interface ConfigPort {
readonly name: string
get(key: string): string | undefined
/** A setting the deployment cannot run without: missing is refused by name, never defaulted. */
required(key: string): string
/** Every key this source can answer. A build that has to prove a setting exists asks here. */
keys(): readonly string[]
}What this deployment was configured with. A setting is deliberately **not** a tracked read — a property of the deployment rather than of the request, so it never lands in a cache key.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
CriticalPath
interface
export interface CriticalPath {
path: string[]
ms: number
/** The number a root-to-leaf sequential walk would have produced, for contrast. */
sequentialMs: number
}The longest chain through the graph, which is the floor on how fast the page can be.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
DagNode
interface
export interface DagNode {
name: string
/** Slots whose *results* this one consumes. */
needs?: readonly string[]
/** Higher runs first inside a wave, when the scheduler has a choice. */
prio?: number
/** Measured or estimated cost, used for the critical path. */
ms?: number
executor?: string
/** A slot the page is complete without. Still scheduled, but cannot be the end of the critical path. */
optional?: boolean
}Render is a DAG, not a tree walk. needs is data dependency only; the critical path, not the sum, is the floor. Safe because render is provably read-only. See spec/kernel/locus.md.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
DbPort
interface
export interface DbPort {
readonly name: string
query<T>(query: DbQuery, run: (signal: AbortSignal) => Promise<T>): Promise<T>
/** Accesses this port has run, newest last. Read by the trace, never by a render. */
observed?(): readonly { name: string; ms: number; tags: readonly string[]; failed?: boolean }[]
}Where a loader's data comes from, named rather than anonymous — the framework never sees a .data.ts loader, so running its query through a port gives back a name, a deadline and tags. Not a query language: what runs is the caller's function.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
DbQuery
interface
export interface DbQuery {
/** What this access is, for telemetry and for a trace somebody has to read at 3am. */
name: string
/** What it reads, in the vocabulary an intent invalidates with. */
tags?: readonly string[]
timeoutMs?: number
}// ── db ───────────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Decision
interface
export interface Decision {
allowed: boolean
subject: string | null
via?: string
required: readonly string[]
held: readonly Grant[]
/** What was asked for and not held. Empty on an allow. */
missing: readonly string[]
/** Set when the decision was a denial for a reason other than a missing grant. */
code?: string
}Whether the call is allowed, what it needed, what it held, and what was missing.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
DeferredEffect
interface
export interface DeferredEffect {
kind: DeferrableKind
cookie?: SetCookie
header?: { name: string; value: string }
reason: string
}An effect that missed its window. Only idempotent, refreshable writes qualify. required() is the only door for consent.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
DeferredMailbox
interface
export interface DeferredMailbox {
owe(connection: string, effects: readonly DeferredEffect[]): void
claim(connection: string): DeferredEffect[]
readonly size: number
}Where a deferred effect waits. Keyed by connection; bounded, so an effect nobody comes back for does not accumulate.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
DegradeInput
interface
export interface DegradeInput {
slot: string
policy: ExceedPolicy
stale?: Uint8Array
fallback?: Uint8Array
placeholder?: Uint8Array
}What a failed slot has to choose from: a placeholder, a fallback, a stale entry, or nothing.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
DelegateRequest
interface
export interface DelegateRequest {
/** The token being narrowed. Verified, and its nonce spent, before anything is minted. */
token: string
/** Who is asking, from the session. The parent must have been for them, if it named anybody. */
subject: string | null
/** The intent the child authorises. Only the parent's own, which is what makes it not wider. */
intent: string
/** Bind the child to one payload. Legal when the parent bound none, or bound the same one. */
payload?: unknown
/** The child's lifetime. Clamped to what is left of the parent's, never extending it. */
ttlMs?: number
}A token minted from a token, and the four ways it may only be narrower.
Delegation exists for one shape of problem: something that is not the reader has to act on the reader's behalf, once, for less than the reader could. A region on another deployment is the case this framework has — a composite holds an authorisation and the region needs a strictly smaller one to do its part.
It happens at the **signing** tier and not by attenuating a signature, which is the decision everything else follows from. Macaroon-style caveats would need the verifier to hold the root secret, and the whole reason this tier is separable is that the verifier holds public keys only. So a delegate is a new signature over smaller claims, and the parent is *spent* producing it — one authorisation in, one out, and no way to fan a token into many.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
DeploymentPort
interface
export interface DeploymentPort {
readonly name: string
/** The build being served. `dev` where there is no build to name. */
readonly revision: string
readonly environment: string
readonly region?: string
/** This process or isolate, when the platform names one. */
readonly instance?: string
}Which build is answering, and where it is running. A port rather than environment variables read ad hoc: every runtime spells them differently.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/lifecycle.md
DiscoveredRoute
interface
export interface DiscoveredRoute {
/** The pattern, as the route table spells it: `/product/:sku`, `/checkout/*`. */
pattern: string
/** Which document it renders into, by the shell template's version — "is this the same document I am in". */
shell: string
/** True when this route's shell is the one this connection's page uses. */
shared: boolean
/** Region names, in the order the plan places them. */
slots?: readonly string[]
/** The stylesheet the route links, so a client can preload it before it is needed. */
css?: string
/** Template versions its regions need. A client asks for the ones it does not hold with `WARM tpl=`. */
tpl?: readonly string[]
/** Where readers of this route go next, from the profile. Worth staging once this route commits. */
next?: readonly string[]
}Lazy plan extension: the part of the plan a client does not have yet, asked for and answered — everything that would otherwise cost a request to learn. WARM plan= asks about a subtree; a PLAN also arrives unasked when a channel opens. See spec/client/navigation.md.
DiscoveryOptions
interface
export interface DiscoveryOptions {
resolve(request: ExtendRequest): Promise<PlanExtension | null> | PlanExtension | null
/** How many routes one frame may carry. A table of four thousand routes is not a prefetch hint. */
max?: number
telemetry?: TelemetryPort
}How a prefix becomes routes. Describing runs no loader, which is the difference from staging.
DispatchOptions
interface
export interface DispatchOptions {
maxConcurrency: number
/** Called for each node when its turn comes. Rejections are the caller's to police. */
run(node: DagNode): Promise<void>
/** The scheduler's say over what runs first inside a wave. Without one, priority then name. */
order?(ready: readonly DagNode[]): readonly DagNode[]
}How wide a wave may be, and what runs each slot.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
EntryMeta
interface
export interface EntryMeta {
/** The cache class the key was derived under. A private entry may never reach a shared tier. */
class: CacheClass
/** Milliseconds. Absent means the entry lives until it is invalidated or evicted. */
ttlMs?: number
tags?: string[]
storedAt: number
/** Bumped by the store on every invalidation, so a `generation` tier can detect staleness. */
generation?: number
}What the store knows about an entry besides its bytes. The class is the load-bearing field.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Envelope
interface
export interface Envelope {
status(code: number): void
redirect(location: string, code?: number): void
/** Ends the request in phase A with no body. A separate act from `status()`, or a guard and an error page would be indistinguishable. */
refuse(code: number): void
header(name: string, value: string): void
/** Sets a default without overwriting what phase A already decided. */
headerIfUnset(name: string, value: string): void
setCookie(cookie: SetCookie): void
cacheControl(value: string): void
vary(header: string): void
/** Phase A only. A write that must land on this response or the request is wrong. */
required(write: () => void): void
/** Legal in phase B. Queued for the next request on this connection, or dropped if there is none — why only idempotent effects qualify. */
deferrable(effect: DeferredEffect): void
seal(): ResponseInit
readon
…The response head, and the fact that it seals: a status, a cookie, a redirect, Vary — possible in phase A, impossible after.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
EnvelopeContext
interface
export interface EnvelopeContext extends Reads {
readonly phase: 'envelope'
setCookie(cookie: SetCookie): void
status(code: number): void
redirect(location: string, code?: number): void
/** Ends the request here, with no body. What a guard does when it says no. */
refuse(code: number): void
setHeader(name: string, value: string): void
}Phase A. The only context that can touch the envelope — deliberately a different type from the one a render receives, rather than the same object with a flag that could be checked wrongly.
Specified inspec/kernel/authority.md
Epochs
interface
export interface Epochs {
/** Stage a frame for a slot. The frame is rewritten to carry the epoch, so nothing paints. */
stage(epoch: string, slot: string, f: Frame): void
staged(epoch: string): Frame[]
slots(epoch: string): string[]
/** Every staged frame followed by the COMMIT that flips them, atomically. */
commit(epoch: string, transition?: Transition): Frame[]
discard(epoch: string): number
readonly open: string[]
}Staged writes, committed atomically or discarded. Bounded, because a staged epoch is memory.
Raised in this fileE_NO_SUCH_EPOCH·E_STAGE_LIVE·E_TOO_MANY_EPOCHS
ExecutorPort
interface
export interface ExecutorPort {
readonly name: string
readonly kind: ExecutorKind
run(job: RenderJob): Promise<RenderOutcome>
}One method, collapsing six mechanisms into one: same thread, a worker pool, an isolate, a binding, another pod, or the browser. Also the fault and budget boundary.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/composition.md·spec/kernel/locus.md
ExtendRequest
interface
export interface ExtendRequest {
/** The subtree asked about. Absent for the frame sent when a channel opens. */
prefix?: string
channel: Channel
}A prefix somebody asked about, and the connection asking.
FanoutPort
interface
export interface FanoutPort {
readonly name: string
/** An identity for this instance, so a message this process published is not acted on twice. */
readonly origin: string
/** Tell the other instances that these keys are known wrong. */
publish(keys: readonly string[], reason: string): Promise<void>
/**
* Start delivering what other instances publish. A failure to subscribe throws rather than being
* swallowed: believing you have cross-instance invalidation and not having it is worse than
* knowing you have none.
*/
subscribe(deliver: (keys: readonly string[], reason: string) => void): Promise<void>
close?(): Promise<void>
}Invalidation that crosses a process boundary. hub.notify alone is correct on exactly one instance; on two, half the readers are told and half are not. publish must not deliver back to the publisher — origin is for implementations that cannot suppress it. See spec/kernel/transport.md.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/transport.md
FlagPort
interface
export interface FlagPort {
readonly name: string
/** Every reachable value of every flag. This is what turns a combinatorial space into an enumerable one. */
axes(): Record<string, FlagValue[]>
resolve(flag: string, request: RequestFacts): Promise<FlagValue> | FlagValue
}Feature flags, and the one thing that makes them plannable: the complete axis set. A flag whose values are enumerable partitions the plan rather than branching inside a render.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
FormChoice
interface
export interface FormChoice {
form: WireForm
/** Why this form and not a smaller one. Every downgrade here is a named, visible step. */
reason: string
}The form chosen, and why. Every downgrade is a named step rather than a silent fallback.
FormInput
interface
export interface FormInput {
/** Forms the template can serve, derived by the compiler rather than declared. */
available: readonly WireForm[]
/** Forms this client accepted at negotiation. */
accepted: readonly WireForm[]
/** Does the client hold this template version. */
resident: boolean
/** Did the server recover the base render the client named. */
baseRecovered: boolean
prefer?: WireForm
fallback?: WireForm
/** Measured round trip. High RTT favours one payload over N chunk fetches. */
rttMs?: number
/**
* The frame will carry an epoch, so it is held unpainted until a commit. `patch` is refused
* here: it addresses a path another epoch's commit can move under it.
*/
staged?: boolean
/** Whether this deployment included the patch encoder. A seam: without one the rung is missing
* and says so, rather than silently degrading. */
…Everything the choice depends on. Nothing here is a preference except prefer and fallback.
Grants
interface
export interface Grants {
/** Who this is, for the audit line. Null for a caller with no session. */
subject: string | null
capabilities: readonly Grant[]
/** Where the grants came from — a role name, a token, a table. For the audit line, never the wire. */
via?: string
}What a caller holds, as the grant source answered.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
Held
interface
export interface Held {
slot: string
tpl: string
base: string
}Surgical updates without a stateful server: the client names the base render it holds, the server recomputes and emits the delta, and any stateless isolate can serve it. See spec/kernel/surgical.md.
HintResult
interface
export interface HintResult {
sent: boolean
links: readonly PreloadLink[]
reason?: string
}Whether a 103 went out, and what it pointed at.
Raised in this fileE_HINTS_AFTER_COMMIT
HubOptions
interface
export interface HubOptions {
store: StorePort
source: SlotSource
/** What answers an INTENT frame. Optional — its absence is `E_NO_INTENTS` rather than a silent drop. */
intents?: IntentDispatch
/** The envelope context an intent runs against. A channel has no request, so the caller supplies one. */
intentContext?(channel: Channel): EnvelopeContext | Promise<EnvelopeContext>
/** Templates a WARM frame may ask for. Without one, WARM is refused by name. */
templates?: (version: string) => TemplateIR | undefined
/**
* Who answers a `WARM` at each grain, by the header that names the grain. A table rather than one
* option per grain, so a deployment that binds none carries none of it. See `spec/kernel/budgets.md`.
*/
warm?: Record<string, WarmHandler>
/**
* Everyone this process cannot reach, told after the ones it can. One hook rather than the
…What a hub needs, and what each absent capability refuses by name rather than dropping.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
Intent
interface
export interface Intent<I = unknown> {
/** Human-readable, for logs and `weft why`. Never on the wire. */
name: string
/** Tags this intent may invalidate. The complete set; anything else throws. */
writes: readonly string[]
/** Request state this intent reads. Declared for the same reason a fragment's reads are. */
reads?: readonly string[]
/** Capabilities the caller must hold. Unchecked capabilities are refused, not waved through. */
capabilities?: readonly string[]
/**
* Reachable only with a signed, expiring token this deployment minted. A different question
* from a capability, and both are asked. Declared and unverifiable is `E_NO_VERIFIER`.
*/
signed?: boolean
/** Parse and validate the raw payload. Throwing here is `E_INTENT_INPUT`, a 422, not a 500. */
input?(raw: unknown): I
/**
* How much traffic this mutation can take, over
…A mutation, and the only thing in this framework allowed to write. writes is the complete set; an undeclared one throws.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
IntentClaims
interface
export interface IntentClaims {
/** Key id. Rotation is a key added to the verifier's bundle, never a redeploy of both tiers. */
kid: string
/** The intent, by the opaque id the compiler derived. A token for one intent cannot run another. */
i: string
/** The subject it was minted for. A token lifted from another reader's page is not this reader's. */
s?: string
/** SHA-256 of the canonical payload, when the token binds one. */
p?: string
/** Expiry, epoch milliseconds. */
x: number
/** Single-use nonce. */
n: string
/**
* Delegation depth. Absent means minted directly, `1` means minted from a token, and a verifier
* refuses anything past its own ceiling — which defaults to zero, so a deployment that never
* asked for delegation refuses a delegated token by name rather than by accident.
*/
d?: number
/** The nonce of the token this o
…What a signed intent token asserts. Every field narrows what the token can do.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
IntentContext
interface
export interface IntentContext extends EnvelopeContext {
readonly phase: 'envelope'
/** Invalidate a declared tag. Returns the keys the store dropped. */
revalidate(tag: string): Promise<string[]>
/** Which tags this intent actually invalidated, in order. */
invalidated(): string[]
}What an intent runs against: the envelope, still open, plus the one thing a render cannot do.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
IntentCredentials
interface
export interface IntentCredentials {
/** The signed token, from `INTENT t=` over a channel or the token field of a form post. */
token?: string
}What the caller presented that is not the payload. Credentials travel beside it, never in it.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
IntentDispatch
interface
export interface IntentDispatch {
/** The intent, its outcome, and what it invalidated. Never a Response — that is the caller's. */
run(id: string, raw: unknown, ctx: EnvelopeContext, credentials?: IntentCredentials): Promise<IntentOutcome>
}Runs one intent by its opaque id, having checked who may.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
Specified inspec/FINDINGS.md
IntentDispatchOptions
interface
export interface IntentDispatchOptions {
registry: Registry
store: StorePort
/** Required as soon as any intent declares a capability, or the declaration is decorative. */
capabilities?: CapabilityCheck
/** Required as soon as any intent declares `signed`: an intent that reads as authorised and
* is not is worse than one that reads as open. */
verify?: IntentVerifier
/** Required as soon as any intent declares a limit — what a call is counted against is a
* property of the deployment. */
limits?: LimitPort
}What a dispatch needs: the closed set of intents, and the gates every call passes.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
IntentLimit
interface
export interface IntentLimit {
/** Calls allowed inside the window. */
max: number
/** The window, in milliseconds. */
windowMs: number
}What an intent said about its own capacity. How much, over how long, and nothing about whom.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
IntentOutcome
interface
export interface IntentOutcome {
ok: boolean
id: string
/** The intent's declared name, when it resolved. */
name: string | null
/** Named refusal, when it did not run or failed. */
code?: string
detail?: string
/**
* Milliseconds until this call is worth making again. On the field rather than in the detail,
* so both bindings have somewhere to put it — a `Retry-After` header, a header on `ACK`.
*/
retryAfterMs?: number
invalidated: string[]
/** Keys the store actually dropped. What a channel turns into STALE frames. */
dropped: string[]
refresh: string[]
data?: unknown
}What the intent itself returned, and what it invalidated on the way.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
IntentResult
interface
export interface IntentResult {
/** Slots whose content this mutation is expected to have changed. Refreshed under the epoch. */
refresh?: string[]
/** Anything the caller wants back. Serialised into the ACK body. */
data?: unknown
}The outcome plus everything the dispatch decided: the refusal, the status, the tags.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
IntentRoute
interface
export interface IntentRoute {
method: string
/** `/cart`, `/product/:sku`. The same pattern language the document router uses. */
pattern: string
/** The opaque id the compiler derived for the intent's module and export. */
intent: string
}A mutation over plain HTTP: a form posts, the intent runs, and the response is a 303 back to where the form was — the no-JavaScript path. fetch gets the same dispatch and an ACK-shaped JSON body, chosen by Accept. See spec/kernel/intents.md.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
IntentRouter
interface
export interface IntentRouter {
match(method: string, url: URL | string): { intent: string; params: Record<string, string> } | null
readonly routes: readonly IntentRoute[]
}Which intent a method and path dispatch to. A GET that writes cannot be built.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
IntentServer
interface
export interface IntentServer {
handle(request: Request): Promise<Response>
readonly last: IntentOutcome | null
}Serves an intent over HTTP, as a form post or as fetch, chosen by Accept.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
IntentSigner
interface
export interface IntentSigner {
readonly kid: string
mint(request: MintRequest): Promise<string>
/**
* Narrow a token into a shorter-lived, more specific one.
*
* Needs a verifier because the parent has to be checked before it is trusted, and checking it is
* what spends it. Every refusal is named: `E_DELEGATE_LONGER` for a window that outlives its
* parent's, `E_DELEGATE_DEPTH` for a chain past the ceiling. There is deliberately no code for a
* claim that *grows* — see the note on the payload below: `verify` has already refused a child
* that binds anything other than its parent's payload, so the check would never fire and a guard
* that cannot fire is a guard nobody can trust.
*/
delegate(request: DelegateRequest, verifier: IntentVerifier): Promise<string>
/** The lifetime a minted token gets, so a page can say when what it is showing g
…Mints tokens, and narrows one into a leaf. Only a tier holding a private key has one.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
IntentVerifier
interface
export interface IntentVerifier {
verify(request: VerifyRequest): Promise<VerifyOutcome>
/** How far a spent nonce is remembered: `process` per isolate, `shared` everywhere. */
readonly replayScope: 'process' | 'shared'
readonly kids: readonly string[]
}Checks a token and spends its nonce. Verification is not a read: it consumes the token.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
Specified inspec/kernel/authority.md
JobAddress
interface
export interface JobAddress {
module: string
export: string
props?: unknown
}Where a render lives, as an address rather than as a function: a closure cannot cross a crash domain, which is why pool, isolate, binding and svc need a name they can resolve on their own side. See spec/kernel/locus.md.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/locus.md·spec/plan/plan.md
Kernel
interface
export interface Kernel {
/**
* Match a request against the route table and serve it. This is the whole entry point: a
* Request in, a Response out, and nothing else to mount.
*/
serve(request: Request): Promise<Response>
handle(request: Request, route: KernelRoute, params?: Record<string, string>): Promise<Response>
/** The trace of the last request. Kept separate from the Response so nothing leaks into bytes. */
readonly trace: KernelTrace | null
readonly mailbox: DeferredMailbox
}A Request in, a Response out, and nothing else to mount.
Raised in this fileE_NO_ROUTES·E_UNKNOWN_EXECUTOR
KernelOptions
interface
export interface KernelOptions {
ports: Ports
/**
* A schedule, not a list. Ordering, the cycle check and the ambiguity check are inferred
* from static declarations, so they belong to the build: call `resolvePlugins` once and
* hand the result here. It also keeps the graph out of the request path's bytes.
*/
plugins?: PluginSchedule
/**
* Dev-only enforcement of a plugin's declared reads. Pass `guardReads`; omit it in
* production, where the check has already had every chance to fire.
*/
guard?: ReadGuard
mailbox?: DeferredMailbox
clock?: () => number
/**
* Which connection this request belongs to, for deferred envelope effects. Without one,
* a deferrable effect has nowhere to wait and is dropped — which is stated, not hidden.
*/
connectionOf?(request: Request): string | null
/** The route table. Without one, `serve()` has
…Everything the kernel is given rather than knows: the ports, the table, and the policies.
Raised in this fileE_NO_ROUTES·E_UNKNOWN_EXECUTOR
KernelRoute
interface
export interface KernelRoute {
path: string
/** The shell. Its slot holes are the boundaries the kernel fills. */
template: TemplateIR
values: Values
resolve?: Resolver | undefined
/**
* How this document is cut, when the flat splitter is not how. A route wrapped in nested layouts
* carries `chainSplitter`; every other route carries nothing and gets `splitAtSlots`.
*
* A chain is spliced at stream time rather than compiled into one template, because a layout's
* holes are boundaries and boundaries are what the kernel exists to fill: flattening the chain
* into a single IR would have to rebase every hole path and every wiring entry of every layer,
* and would make one sealed template out of files that are versioned separately.
*/
split?: Splitter
/**
* The shell's own identity and inferred reads. A shell that reads a cookie contribut
…One request's worth of a route: the document, its values, and a slot per boundary.
What a plan lowers to, and the whole of what the kernel knows about a page. It contains no plan, no convention and no file tree — which is what lets a plan be generated, hand-written or measured without the kernel changing.
Raised in this fileE_NO_ROUTES·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/budgets.md
KernelSlot
interface
export interface KernelSlot {
name: string
/** Module and export. Stable across content changes, which is why it is not the version. */
id: string
version: string
effects: EffectSet
/** Data dependency on other slots. Existence dependency is not declared and does not block. */
needs?: string[]
prio?: number
executor?: string
cpuBudgetMs?: number
onExceed?: ExceedPolicy
policy?: CachePolicy
/** Emitted when the slot degrades. Honest, cheap, and visibly incomplete. */
placeholder?: Uint8Array
/**
* Where this slot's render lives, for an executor that runs it somewhere a closure cannot
* reach. Without one only same-thread executors can take the slot.
*/
address?: JobAddress
render(ctx: RenderContext): Promise<Uint8Array>
}The kernel does four things and nothing else: own the request lifecycle as a state machine, resolve a plan, execute it against ports, and own the stream.
Everything people normally call a framework feature — ISR, SWR, edge caching, cookie handling, worker pools — is a port implementation on the other side of this file. What stays here is only what cannot be replaced without losing a guarantee: the two phases of the envelope, the derivation of cache keys from effects, and the fact that a render cannot write anything.
Raised in this fileE_NO_ROUTES·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/composition.md
KernelTrace
interface
export interface KernelTrace {
states: readonly string[]
hints: HintResult
keys: Record<string, ResolvedKey>
/** The shell's own key, when the route declared its identity. */
document: ResolvedKey | null
hits: string[]
degraded: { slot: string; code: string; message: string }[]
/** Slots that missed, waited for another renderer's result, and got it. A stampede avoided. */
coalesced: string[]
deferred: number
/** Which pattern matched and with what params. Null when `handle` was called directly. */
matched: { pattern: string; params: Record<string, string> } | null
}What the last request did, kept beside the response so nothing about it leaks into bytes.
Raised in this fileE_NO_ROUTES·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/static.md
KeyInput
interface
export interface KeyInput {
/** The fragment's identity: module and export, stable across content changes. */
id: string
/** Its content address. A template edit is a different cached thing. */
version: string
effects: EffectSet
}What a key is derived from: the fragment's identity and the reads the compiler recorded.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
Lease
interface
export interface Lease {
key: string
release(): void
}A held claim on a key, and the only thing you can do with it. Releasing twice is harmless.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Lifecycle
interface
export interface Lifecycle {
readonly state: RequestState
readonly log: readonly RequestState[]
to(next: RequestState): void
/** Throws unless the machine is in one of these states. The only guard anything else uses. */
mustBe(states: readonly RequestState[], what: string, code: string): void
is(state: RequestState): boolean
}The request as a state machine, with declared transitions and nothing else permitted.
Raised in this fileE_REQUEST_STATE
LimitPort
interface
export interface LimitPort {
readonly name: string
/** Whether this call may proceed. Called before the signature is verified — the cheapest check,
* protecting the other two. */
check(request: LimitRequest): Promise<LimitDecision> | LimitDecision
}How often one caller may do something. The kernel cannot implement this: which of an address, a session or a subject to count against is a deployment's decision, and the intent declares how much traffic it can take. See spec/kernel/authority.md.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/authority.md
LimitRequest
interface
export interface LimitRequest {
/** The intent's opaque id, which is what travelled on the wire. */
id: string
/** Its declared name, for a message somebody has to read. */
intent: string
limit: IntentLimit
/** The subject, when there is one. Resolved once here rather than by every implementation. */
subject: string | null
/** For counting against an address, which is a header behind every real proxy. */
header(key: string): string | undefined
/** For counting against a session, which is where an unauthenticated caller has an identity. */
cookie(key: string): string | undefined
}What the port is told: exactly the three things a limit can be counted against, not the whole request — a limit counted against anything is a limit nobody can reason about.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Matched
interface
export interface Matched<T> {
value: T
pattern: string
params: Record<string, string>
}A match: the value, and the params captured on the way.
Raised in this fileE_BAD_PATTERN·E_ROUTE_CONFLICT
MintRequest
interface
export interface MintRequest {
/** The opaque intent id, as it travels. */
intent: string
subject?: string | null
/**
* The payload this token authorises. Given, the token is a receipt for one call; omitted, it
* authorises the intent for the window and the payload is the caller's.
*/
payload?: unknown
/** Overrides the signer's default lifetime for one token. */
ttlMs?: number
}What to mint a token for. Omitting the payload widens it from a receipt to a licence.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
PlanExtender
interface
export interface PlanExtender {
/** Answers `WARM plan=<prefix>`. */
warm: WarmHandler
/** Answers nothing: what a connection is told when it opens, because it cannot ask. */
open(channel: Channel): Promise<Frame[]>
}What a hub is given: the handler for the plan grain of a WARM, and the frames a connection is handed when it opens.
PlanExtension
interface
export interface PlanExtension {
/** What was asked about, echoed. `''` for the unasked frame that follows a handshake. */
prefix: string
routes: readonly DiscoveredRoute[]
/** False when the answer was truncated, so the client asks again rather than deciding silently. */
complete?: boolean
}What came back: the prefix, the routes described, and whether that was all of them.
Plugin
interface
export interface Plugin {
name: string
/** `filter` runs sequentially in phase A and may end the request; `enricher` runs in parallel waves. */
role: 'filter' | 'enricher'
/** Where this plugin's work happens. Checked: `client`/`build` may not carry an `onRequest` — `E_PLUGIN_RESIDENCY`. */
residency?: PluginResidency
/**
* The path prefix this plugin applies to. Absent means every route. Resolved at build time by
* `resolveScoped`: a scope is a different graph, so two ambiguous plugins are not ambiguous
* under different prefixes.
*/
scope?: string
before?: readonly string[]
after?: readonly string[]
reads?: readonly string[]
provides?: readonly string[]
/** A new cache dimension. The kernel folds it into the derived key; the plugin never sees the key. */
planAxis?(): Record<string, string[]>
critical?: boolean
timeoutMs?: number
…Something that extends a request without replacing anything.
Ordering is *inferred* from what a plugin declares it reads and provides, so a cycle or an ambiguity is a build error rather than a race. What no plugin may do is write a cache key.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
PluginResult
interface
export interface PluginResult {
/** Values contributed to the context. Keys must be declared in `provides`. */
provided?: Record<string, unknown>
/** A filter may end the request. An enricher may not, and one that tries is an error. */
response?: Response
}What one plugin did: what it provided, and whether it ended the request.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
PluginRunResult
interface
export interface PluginRunResult {
provided: Record<string, unknown>
/** Set when a filter ended the request. */
response?: Response
/** Non-critical plugins that failed. Reported, never fatal. */
skipped: { plugin: string; reason: string }[]
axes: Record<string, string[]>
}What the whole schedule did, and the response if one of them produced it.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
PluginSchedule
interface
export interface PluginSchedule {
/** Filters, in declared dependency order. Sequential, because short-circuiting requires sequence. */
filters: Plugin[]
/** Enrichers, in waves. Disjoint reads and provides run at once. */
waves: Plugin[][]
/** Every contributed cache axis, collected once. `planAxis()` takes no request, so it is not per-request work. */
axes: Record<string, string[]>
}A resolved order. Produced once at build time, because ordering is not a per-request question.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
Specified inspec/FINDINGS.md
Ports
interface
export interface Ports {
store: StorePort
flags: FlagPort
session: SessionPort
executors: Record<string, ExecutorPort>
scheduler?: SchedulerPort
assets?: AssetPort
telemetry?: TelemetryPort
transport?: TransportPort
render?: RenderPort
registry?: Registry
config?: ConfigPort
db?: DbPort
deployment?: DeploymentPort
limits?: LimitPort
}Everything the kernel refuses to implement. Fourteen capabilities; the first four are required and the rest absent-or-bound. Neither a port nor a plugin may write a cache key.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Preemptible
interface
export interface Preemptible {
readonly preemption: Preemption
}Whether this executor can stop a render, which is what makes a CPU budget a limit.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
PreloadLink
interface
export interface PreloadLink {
href: string
as: 'script' | 'style' | 'font' | 'image' | 'fetch'
crossOrigin?: boolean
/** `modulepreload` for a module graph entry, `preload` for everything else. */
rel: 'preload' | 'modulepreload'
}// ── assets ───────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
ReadOptions
interface
export interface ReadOptions {
clock?: () => number
}What a read surface needs beyond the ports: a clock, so a build can freeze it.
Reads
interface
export interface Reads {
flag(name: string): Promise<FlagValue>
cookie(key: string): string | undefined
header(key: string): string | undefined
param(key: string): string | undefined
query(key: string): string | undefined
locale(): string
device(): string
user(): Promise<string | null>
now(): number
/** The escape hatch. Taints `opaque`, which makes the fragment private and uncacheable. */
raw<T>(fn: (facts: RequestFacts) => T): T
/** Everything actually read, in the order it was read. */
taints(): string[]
}The runtime half of effect tracking. The compiler records *which* reads taint a fragment; this resolves their values, and has to mirror the compiler's read surface exactly.
Specified inspec/kernel/static.md
RefreshTtl
interface
export interface RefreshTtl {
/** Default fifteen minutes: long enough for an idle tab, short enough to bound the store. */
baseMs?: number
deltaMs?: number
}How long a recovered base render and a memoized delta live. A TTL here is safe in a way a cache TTL is not: an expired base costs a **form**, never correctness. See spec/kernel/surgical.md.
RegionAnnouncement
interface
export interface RegionAnnouncement {
region: string
contract?: RegionContract
revision?: string
/** Boundaries the region crossed on its own account. A region composing regions is a tree. */
hops: number
}What a region said about itself, taken from the one frame it is allowed to open with.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
RegionBinding
interface
export interface RegionBinding {
/** The name the shell used, which is the only name a client or a sibling region ever sees. */
region: string
/** The bound executor that reaches it. `inline` for a region this process renders itself. */
executor: string
/**
* Module and export on the other side. Required by every executor that is not this thread,
* for the reason `JobAddress` exists at all: a closure does not cross a crash domain.
*/
address?: JobAddress
/** The revision currently serving it. A roll is a write here, and it appears in the trace. */
revision?: string
/** What the shell expects this deployment to serve. A mismatch degrades rather than renders. */
contract?: RegionContract
/**
* A shared secret this region's deployment presents to tell the composite it went stale. The
* missing half is not a protocol, it is an authority — a d
…What a region's name resolves to. The whole difference between the design's four topologies is in executor: inline is the monolith; binding:/svc: is a tier boundary and a crash domain.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/composition.md
RegionContract
interface
export interface RegionContract {
id: string
version: string
/**
* What the region's own compiler inferred it reads — the field that makes a composed page
* cacheable at all. Still derived, never declared. Absent reads `opaque`: uncacheable, private.
* See `spec/kernel/composition.md`.
*/
reads?: readonly string[]
}What a region promises, as an id and a version — the version actually serving right now, against what the shell was built expecting. See spec/kernel/composition.md.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
RegionFrames
interface
export interface RegionFrames {
announced: RegionAnnouncement
/** Markup for the shell's hole: the bodies of the region's own `HTML` frames, in order. */
html: Uint8Array
/** Everything else the region sent, checked and safe to forward to a client. */
frames: Frame[]
/** Set when the region itself reported a failure, which is a degradation and not a protocol error. */
error?: { code: string; message: string }
}The frames a region answered with, before anything in them has been trusted.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
RegionNode
interface
export interface RegionNode {
region: string
/** Where it ran, as the registry that resolved it named it — its registry, not this deployment's. */
executor: string
/** Boundaries crossed to reach it, and everything under it. */
hops: number
revision?: string
/** `id@version`, as it was announced rather than as a shell expected. */
contract?: string
/** The code it degraded with. A graph with a hole in it says which hole. */
failed?: string
children?: readonly RegionNode[]
}A composite's regions as a graph rather than as a total. hops answers "how much latency"; this answers "made of what". Its own file: the request path never sees one — a region announces its subtree only when weft verify --probe asks. See spec/kernel/composition.md.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
RegionOutcome
interface
export interface RegionOutcome {
region: string
/** Markup for the hole. Empty when the region degraded to nothing, which `optional` means. */
bytes: Uint8Array
/** Frames for the client: templates, modules, stylesheets, signals the region exposed. */
frames: readonly Frame[]
ms: number
/** Deployment boundaries crossed, including the region's own. Zero in a monolith. */
hops: number
executor: string
revision?: string
failure?: { code: string; message: string }
}What one region cost and where it ran, including a failure and what it degraded to.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
RegionRequest
interface
export interface RegionRequest {
/** The route the composite is serving. A region renders per route like every other fragment. */
route?: string
params?: Record<string, string>
/**
* The reads the region's contract declared, resolved for this request by the composite. A region
* is *given* its reads rather than taking them — the whole reason a composed page can be cached.
* See `spec/kernel/composition.md`.
*/
reads?: Record<string, string>
/** Template versions the client already holds, so a region can answer with a delta. */
held?: readonly string[]
/** Set when the composite is staging rather than painting. A region does not decide this. */
epoch?: string
/**
* Set when the region is being asked *what it is* rather than for a page. `weft verify --probe`
* only. The depth bounds a recursive composition from the side that started it.
…What a region is being asked to render. Data, because it has to survive a serialisation.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
RegionSpec
interface
export interface RegionSpec {
region: string
onExceed?: ExceedPolicy
fallback?: Uint8Array
placeholder?: Uint8Array
/** Milliseconds. On `inline` a report; on a binding or service a deadline on *waiting* — the render keeps running where it lives. */
cpuBudgetMs?: number
/** What this shell was built expecting. Checked against what the region says it serves. */
contract?: RegionContract
}What the shell declares about a region: everything about *failure* and nothing about where it runs. optional and fallback are the same onExceed vocabulary a slot already has.
Raised in this fileE_NO_LOCAL_REGION·E_NO_REGION_REGISTRY·E_NO_SUCH_REGION·E_REGION_CONTRACT·E_REGION_ESCAPE·E_REGION_FAILED·E_REGION_FRAME·E_REGION_NOT_LOCAL·E_REGION_UNANNOUNCED·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR·E_UNRESOLVABLE_READ·E_WRONG_DIRECTION
Registry
interface
export interface Registry {
readonly name: string
intent(id: string): Promise<Intent | undefined> | Intent | undefined
/** Every registered id. For `weft why`, and for refusing a build whose wiring names nothing. */
intents(): readonly string[]
/**
* A region name to the deployment serving it. Optional — `E_NO_REGION_REGISTRY` rather than
* approximated elsewhere. The indirection composition's topology rests on: a roll is a registry
* write, not a shell redeploy. See `spec/kernel/composition.md`.
*/
region?(name: string): Promise<RegionBinding | undefined> | RegionBinding | undefined
/** Every region this registry can resolve. For a build report, and for `weft verify`. */
regions?(): readonly string[]
/**
* An opaque id to a fragment a client may ask to have rendered — the design's module catalogue.
* The name on the wire discloses no serv
…An opaque id to the thing it names. A port rather than a module-level map: a build-time manifest, a live module graph and a remote service are all legitimate answers.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/composition.md
Renderable
interface
export interface Renderable {
/** Human-readable, for a log and for `weft why`. Never on the wire. */
name: string
/** Capabilities the caller must hold. Unchecked capabilities are refused, not waved through. */
capabilities?: readonly string[]
/** Reachable only with a signed, expiring token this deployment minted. */
signed?: boolean
/** How much of this one caller may ask for — the one call that costs server work without writing anything. */
limit?: IntentLimit
/** Parse and validate the raw params. Throwing here is `E_RENDER_INPUT`, not a 500. */
input?(raw: unknown): unknown
/**
* What goes in the slot: something this process renders, or frames somebody else produced — the
* same union a refresh already branches on.
*/
render(request: RenderRequest): Promise<SlotRender | SlotFrames> | SlotRender | SlotFrames
}A catalogue entry: something a client may ask to have rendered, by a name that is not its name. The declarations are the intent's, one for one — a render does not declare writes, but every other reason to refuse a call applies unchanged.
Raised in this fileE_CAPABILITY_DENIED·E_NO_CAPABILITY_CHECK·E_NO_CATALOGUE·E_NO_RATE_LIMIT·E_NO_SUCH_RENDERABLE·E_NO_VERIFIER·E_RATE_LIMITED·E_RENDER_FAILED·E_RENDER_INPUT
RenderContext
interface
export interface RenderContext extends Reads {
readonly phase: 'render'
defer(effect: DeferredEffect): void
}Phase B. No envelope methods, except the one that admits it is late: a deferrable effect queued for the next request.
Specified inspec/kernel/authority.md·spec/kernel/lifecycle.md
RenderDispatch
interface
export interface RenderDispatch {
run(
request: {
id: string
slot: string
raw: unknown
/** The read surface the entry's own loader runs against. See `RenderRequest.ctx`. */
ctx: RenderContext
held?: readonly string[]
epoch?: string
},
/**
* The context the *gates* run against, which is the envelope's — the entry's own loader gets a
* different one that may only read. See `spec/kernel/authority.md`.
*/
ctx: EnvelopeContext,
credentials?: IntentCredentials,
): Promise<RenderIntentOutcome>
}Renders a fragment a client named by opaque id. Deliberately not the intent path.
Raised in this fileE_CAPABILITY_DENIED·E_NO_CAPABILITY_CHECK·E_NO_CATALOGUE·E_NO_RATE_LIMIT·E_NO_SUCH_RENDERABLE·E_NO_VERIFIER·E_RATE_LIMITED·E_RENDER_FAILED·E_RENDER_INPUT
RenderDispatchOptions
interface
export interface RenderDispatchOptions {
registry: Registry
/** Required as soon as a renderable declares a capability. */
capabilities?: CapabilityCheck
/** Required as soon as a renderable declares `signed`. */
verify?: IntentVerifier
/** Required as soon as a renderable declares a limit. */
limits?: LimitPort
}The catalogue, and the gates a render request passes — the same ones an intent does.
Raised in this fileE_CAPABILITY_DENIED·E_NO_CAPABILITY_CHECK·E_NO_CATALOGUE·E_NO_RATE_LIMIT·E_NO_SUCH_RENDERABLE·E_NO_VERIFIER·E_RATE_LIMITED·E_RENDER_FAILED·E_RENDER_INPUT
RenderIntentOutcome
interface
export interface RenderIntentOutcome {
ok: boolean
/** The opaque id that was asked for. */
id: string
/** The entry's declared name, when it resolved. */
name: string | null
slot: string
code?: string
detail?: string
retryAfterMs?: number
/** What to put in the slot. Absent on every refusal. */
source?: SlotRender | SlotFrames
}What a render request produced, or the refusal that replaced it.
Raised in this fileE_CAPABILITY_DENIED·E_NO_CAPABILITY_CHECK·E_NO_CATALOGUE·E_NO_RATE_LIMIT·E_NO_SUCH_RENDERABLE·E_NO_VERIFIER·E_RATE_LIMITED·E_RENDER_FAILED·E_RENDER_INPUT
RenderJob
interface
export interface RenderJob {
slot: string
/** Milliseconds of CPU this slot is allowed before it is killed and degraded. */
cpuBudgetMs?: number
/** Set when the slot can be named rather than only called. Required off-thread — `E_JOB_NOT_ADDRESSABLE`. */
address?: JobAddress
run(signal: AbortSignal): Promise<Uint8Array>
}One slot's render, as an executor sees it: a budget, an optional address, and a function.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
RenderJobIR
interface
export interface RenderJobIR {
slot: string
template: TemplateIR
values: Values
/** Nested templates a hole names. Without it a list row or an instance renders nothing. */
resolve?: Resolver
}// ── render ───────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
RenderOutcome
interface
export interface RenderOutcome {
slot: string
bytes: Uint8Array
/** Wall-clock, measured by the executor rather than reported by the job. */
ms: number
/**
* CPU this render actually consumed, where that is separable. Absent on the request thread —
* several renders interleave there. See `spec/kernel/locus.md`.
*/
cpuMs?: number
/** Set when the job was killed or threw. The slot degrades; the request does not fail. */
failure?: { code: string; message: string }
}What came back from an executor: the bytes, what they cost, and how the render ended.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
RenderPort
interface
export interface RenderPort {
readonly name: string
render(job: RenderJobIR): Promise<Uint8Array> | Uint8Array
}Who turns a fragment and a value set into bytes. The job carries the template, since one slot renders a different fragment on every route. Bound rather than assumed — remote is another implementation of this port, not a second render path.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
RenderRequest
interface
export interface RenderRequest {
/** The slot the answer is going into, so a renderable that addresses frames can name it. */
slot: string
/** The validated params. Whatever `input` returned, or the raw payload when it declared none. */
params: unknown
/**
* The read surface a local renderable's loader runs against. Read-only by type: a render
* cannot write, the same guarantee every other render has.
*/
ctx: RenderContext
/** Template versions the client already holds, so a renderable can answer with a delta. */
held?: readonly string[]
/** Set when the answer is being staged rather than painted. */
epoch?: string
}What a renderable is being asked for.
Raised in this fileE_CAPABILITY_DENIED·E_NO_CAPABILITY_CHECK·E_NO_CATALOGUE·E_NO_RATE_LIMIT·E_NO_SUCH_RENDERABLE·E_NO_VERIFIER·E_RATE_LIMITED·E_RENDER_FAILED·E_RENDER_INPUT
RequestFacts
interface
export interface RequestFacts {
url: URL
method: string
headers: Headers
cookies: Record<string, string>
params: Record<string, string>
}// ── the set ──────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/authority.md
ResolvedKey
interface
export interface ResolvedKey {
/** Null when the fragment is uncacheable, which today means it read `opaque`. */
key: string | null
class: CacheClass
/** Read to resolved value, for the reads whose value the key depends on. */
components: Record<string, string>
/** Flag to resolved value. An axis partitions the plan; it is still part of the key. */
axes: Record<string, string>
vary: string[]
ttlRequired: boolean
/** One line saying why the key is what it is. This is what `weft why` prints. */
reason: string
}The key, its class, what went into it, and one line saying why — which is what weft why prints.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
Specified inspec/FINDINGS.md·spec/kernel/cache.md
ResolveOptions
interface
export interface ResolveOptions {
/**
* Capabilities this deployment's roles can actually grant. Given, a plugin declaring one
* nothing can grant is refused at registration — the same rule an intent lives by.
*/
grantable?: readonly string[]
}Build-time, and deliberately not in the request path. The dependency graph is inferred from reads and provides; hand-declared edges stay for what data flow cannot express. See spec/plan/plan.md.
Raised in this fileE_PLUGIN_AMBIGUOUS·E_PLUGIN_CAPABILITY_UNGRANTABLE·E_PLUGIN_CYCLE·E_PLUGIN_DUPLICATE·E_PLUGIN_RESIDENCY
RoleGrantOptions
interface
export interface RoleGrantOptions {
/**
* What a subject's roles are. An unknown subject has none — a denial, not an error. Never called
* with a null subject: that caller has the anonymous role.
*/
roles(subject: string): Promise<readonly string[]> | readonly string[]
/** What each role grants. A role nothing maps to grants nothing. */
table: Record<string, readonly Grant[]>
/** The role a caller with no session has. Defaults to `anonymous`. */
anonymous?: string
}Grants from the session's identity, through a role table — the smallest thing that is a real model. Anonymous is a subject of null with the anonymous role, a row an operator can edit.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
Route
interface
export interface Route {
template: TemplateIR
values: Values
resolve?: Resolver | undefined
/**
* How to cut this document, when the flat splitter is not it: a route whose layouts are nested
* carries `chainSplitter`. See `split-chain.ts`. `| undefined` is deliberate under
* `exactOptionalPropertyTypes`, so the kernel can copy this field across unconditionally.
*/
split?: Splitter | undefined
/** One resolver per slot. Whatever it awaits is what the shell refused to wait for. */
slots: Record<string, () => Promise<SlotContent>>
}What streaming needs: the document, its values, and a resolver per slot.
Specified inspec/kernel/budgets.md·spec/kernel/streaming.md
RouteEntry
interface
export interface RouteEntry<T> {
/** `/cart`, `/product/:sku`, `/checkout/*`. */
pattern: string
value: T
}One row of the table: a pattern, and whatever it resolves to.
Raised in this fileE_BAD_PATTERN·E_ROUTE_CONFLICT
Router
interface
export interface Router<T> {
match(url: URL | string): Matched<T> | null
/** The patterns in the order they will be tried. Where two could match one path, the more specific comes first. */
readonly patterns: readonly string[]
}A path to a value, by specificity rather than by declaration order.
Raised in this fileE_BAD_PATTERN·E_ROUTE_CONFLICT
SchedulableSlot
interface
export interface SchedulableSlot {
name: string
prio?: number
/** Slots whose results this one needs. Data dependency, never existence dependency. */
needs?: readonly string[]
}// ── scheduler ────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Schedule
interface
export interface Schedule {
waves: string[][]
/** The widest wave. Compared against the scheduler's concurrency ceiling. */
width: number
}The waves, in order. A slot lands in the first wave after everything it needs.
Raised in this fileE_PLAN_CYCLE·E_UNKNOWN_SLOT
SchedulerPort
interface
export interface SchedulerPort {
readonly name: string
/**
* Given one wave's worth of ready slots, decide what order to dispatch them in. A scheduler
* **reorders what it was handed** — it may not invent, drop or add a slot.
*/
order<T extends SchedulableSlot>(ready: readonly T[]): readonly T[]
/** Hard ceiling on concurrent renders per request. Forty parallel queries will melt a database. */
readonly maxConcurrency: number
}Who decides the order within a wave, and how wide a wave may be.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/FINDINGS.md·spec/kernel/budgets.md
ScopedPlugins
interface
export interface ScopedPlugins {
/** The schedule a path is subject to. Memoised per distinct prefix set, not per path. */
forPath(path: string): PluginSchedule
/** Every declared scope, longest first, which is the order a path is matched in. */
readonly scopes: readonly string[]
}One schedule per scope, resolved once. Encapsulation is a property of the graph, not a check on the request — a page under /shop pays no prefix comparison for a plugin under /admin.
Raised in this fileE_PLUGIN_AMBIGUOUS·E_PLUGIN_CAPABILITY_UNGRANTABLE·E_PLUGIN_CYCLE·E_PLUGIN_DUPLICATE·E_PLUGIN_RESIDENCY
ServeIntentOptions
interface
export interface ServeIntentOptions extends IntentDispatchOptions {
routes: IntentRouter
clock?: () => number
ports: Ports
/** Where a form post goes when the intent did not redirect. Defaults to the Referer, then `/`. */
returnTo?(request: Request): string
}What the HTTP half needs: the dispatch, plus how a payload and a token are read.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
SessionPort
interface
export interface SessionPort {
readonly name: string
/** Null for an anonymous request. Reading this taints `identity`, which forces a private class. */
identity(request: RequestFacts): Promise<string | null> | string | null
cookie(request: RequestFacts, key: string): string | undefined
/**
* Phase A only. Returns the cookies to write, if any — the port never touches the
* envelope itself, because only the envelope knows whether it is still open.
*/
rotateIfStale?(request: RequestFacts): Promise<SetCookie[]> | SetCookie[]
}Who is asking, and the cookies that say so. The one port whose reads change a cache key — identity forces a private class. Writing is phase A only; the port returns cookies rather than setting them.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
SetCookie
interface
export interface SetCookie {
name: string
value: string
maxAge?: number
path?: string
domain?: string
httpOnly?: boolean
secure?: boolean
sameSite?: 'Strict' | 'Lax' | 'None'
}A cookie the envelope will write. Only phase A can produce one, which is the point of the type.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
ShellLink
interface
export interface ShellLink {
at: string
template: TemplateIR
}One document nested inside another: a layout chain, outermost first. at is the slot hole of the enclosing template this link fills — a slot rather than a component instance, since a component hole is rendered inline and its slots would never be seen. Every link shares the enclosing render's value set and resolver.
SignerOptions
interface
export interface SignerOptions {
kid: string
/** A private Ed25519 key. `usages` must include `sign`; the signer never imports one itself. */
key: CryptoKey
/** Default lifetime. Short on purpose: a token is for one interaction, not for a session. */
ttlMs?: number
clock?(): number
nonce?(): string
/**
* How deep a delegation chain this signer will mint. One by default: a token may be narrowed
* once, and the narrowed one is a leaf.
*
* A chain is the part of delegation that gets away from people — every link is another place an
* authorisation could have been narrowed wrongly, and the audit is only as good as somebody's
* willingness to walk it. One link is a shape a person can hold in their head.
*/
maxDepth?: number
}What a signer needs: a key, an id for it, and the ceilings it will not mint past.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
SlotBudget
interface
export interface SlotBudget {
cpuMs?: number
onExceed?: ExceedPolicy
}What one slot may spend, and what happens when it does not fit.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
SlotFrames
interface
export interface SlotFrames {
paint?: Frame
also?: readonly Frame[]
}A slot this channel does not render: frames somebody else produced, ready to go down the wire — a second shape of SlotSource answer rather than a second option, to keep the byte budget in one place. paint is what an epoch stages; also travels immediately. See spec/kernel/budgets.md.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
SlotRender
interface
export interface SlotRender {
ir: TemplateIR
values: Values
resolve?: Resolver
/** The cache key this slot resolved to, so an invalidation can name the connections holding it. */
key?: string
prefer?: WireForm
fallback?: WireForm
}What a slot is, from the channel's point of view. Route knowledge, which a channel has none of.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
SlotRequest
interface
export interface SlotRequest {
slot: string
channel: Channel
/**
* The frame that asked, for a source that needs another header off it: a bare `REFRESH` asks for
* current state, one carrying `r=<id>` asks to put a catalogue entry in the slot.
*/
frame?: Frame
}A region asked for over the channel, with the epoch it is being staged into.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
Specified inspec/kernel/authority.md·spec/kernel/budgets.md
SlotSplit
interface
export interface SlotSplit {
/** Constant regions of the shell. There is always one more chunk than there are slots. */
chunks: Uint8Array[]
/** The binding name of each slot, in document order. */
slots: string[]
}A document cut at its boundaries: the constant chunks, and the slot between each pair.
StagedRoute
interface
export interface StagedRoute {
/** The pattern that matched, for a client that wants to name what it staged. */
route: string
/** Whether the target shares this connection's shell. Only the server can decide: only it knows both shells. */
shared: boolean
title?: string
/** The stylesheet the target links, so a commit can put the cascade in place before it paints. */
css?: string
/** Routes worth staging from the target once it is committed. A profile's own numbers. */
next?: readonly string[]
/**
* What each of the target's regions is: something to render here, or frames somebody else
* produced — the same union a refresh already branches on. The stage adds the epoch.
*/
slots?: Record<string, SlotRender | SlotFrames>
/** Why the client is being sent to the document, when it is. */
why?: string
}A whole route, staged and painting nothing — REFRESH for a page the client is not on. The held map is not touched; nothing is committed until the reader clicks. See spec/client/navigation.md.
Raised in this fileE_NO_NEGOTIATION·E_NO_SUCH_ROUTE
StageOptions
interface
export interface StageOptions {
store: StorePort
/** What the path resolves to, which is route knowledge a channel does not have. */
resolve(request: StageRequest): Promise<StagedRoute | null> | StagedRoute | null
ttl?: RefreshTtl
telemetry?: TelemetryPort
}How to resolve a route, and how to tell whether it shares this client's document.
Raised in this fileE_NO_NEGOTIATION·E_NO_SUCH_ROUTE
StageRequest
interface
export interface StageRequest {
path: string
channel: Channel
/** The epoch the client wants this staged into. Without one there is nowhere to put it. */
epoch?: string
}A route asked for before anybody clicked, and the epoch it is being staged into.
Raised in this fileE_NO_NEGOTIATION·E_NO_SUCH_ROUTE
StaleEntry
interface
export interface StaleEntry {
/** When the key was dropped, by the clock of whichever instance dropped it. */
at: number
reason: string
}One recorded invalidation: when the key was dropped, and what dropped it.
Raised in this fileE_TAGS_PROCESS_SCOPED
StaleJournal
interface
export interface StaleJournal {
readonly name: string
/** Record that these keys are known wrong. Called by `invalidate`, after the store has dropped them. */
record(keys: readonly string[], reason: string): Promise<void>
/** Which of these keys are known wrong, and when each was dropped. */
lookup(keys: readonly string[]): Promise<Map<string, StaleEntry>>
}A record of which keys are known wrong, readable by whoever asks next. Not a queue: reading does not consume, and the instant on the entry — sent back as since — separates a retelling from a rewrite.
Raised in this fileE_TAGS_PROCESS_SCOPED
Specified inspec/kernel/transport.md
StaleRegistry
interface
export interface StaleRegistry {
hold(connection: string, slot: string, key: string): void
release(connection: string): void
/** Frames to push, grouped by connection. */
staleFor(keys: readonly string[], reason: string): Map<string, Frame[]>
/**
* The slots one connection holds under any of these keys — the same question `staleFor` answers,
* for the connection it is always asked to skip. See `spec/kernel/transport.md`.
*/
holding(connection: string, keys: readonly string[]): string[]
readonly connections: number
}Invalidation travelling the other way: every connection holding a dropped key is told, and the client decides whether to refresh. See spec/kernel/transport.md.
Specified inspec/FINDINGS.md
StoreEntry
interface
export interface StoreEntry {
value: Uint8Array
meta: EntryMeta
}Bytes and what is known about them. Returned together because a class without bytes decides nothing.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
StoreJournalOptions
interface
export interface StoreJournalOptions {
/** How long an entry is worth keeping: long enough for an ordinary reader coming back to a tab,
* short enough not to become a second invalidation history. */
windowMs?: number
}How long a written-down invalidation is worth keeping.
Raised in this fileE_TAGS_PROCESS_SCOPED
StorePort
interface
export interface StorePort {
readonly name: string
readonly consistency: Consistency
readonly maxValueBytes: number
readonly coherence: Coherence
readonly scope: Scope
/**
* `stale: true` asks for an entry past its TTL rather than nothing — the one caller entitled to
* ask is a slot whose degradation is `stale`. An *invalidated* entry is never recoverable this
* way. See `spec/kernel/cache.md`.
*/
get(key: string, options?: { stale?: boolean }): Promise<StoreEntry | null>
set(
key: string,
value: Uint8Array | ReadableStream<Uint8Array>,
meta: Omit<EntryMeta, 'storedAt'>,
): Promise<void>
/** Tag to keys index. Returns the keys it dropped, so a caller can report rather than guess. */
invalidate(tags: string[]): Promise<string[]>
/** Stampede lease. A null return means somebody else holds it and this caller should wait or serve s
…Where rendered bytes are held, and what the deployment can honestly claim about them. The four readonly properties are checked at build time, so strong against an eventual store is a build error rather than a guarantee nobody keeps.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/authority.md·spec/kernel/surgical.md·spec/kernel/transport.md
StreamOptions
interface
export interface StreamOptions {
order: Order
prelude?: SlotContent
postlude?: SlotContent
/**
* Emitted once before the first fill. Defaults to the built-in filler — not a convenience:
* `fillFor` emits a call to `__w`, and without a fill mechanism that markup references a
* function nobody defined. Once shipped as `__w is not defined` when this was left optional
* and unwired; no test caught it because every test read the body as bytes.
*/
filler?: SlotContent
}The order, what wraps the document, and the fill script for out-of-order delivery.
SurgicalInput
interface
export interface SurgicalInput {
slot: string
ir: TemplateIR
/** The values this refresh produced. The base is what the client is holding. */
next: Values
held?: Held
store: StorePort
accepted: readonly WireForm[]
resolve?: (version: string) => TemplateIR | undefined
prefer?: WireForm
fallback?: WireForm
rttMs?: number
/** How long a base render and a memoized delta live. Expiry costs a form, never correctness. */
ttl?: RefreshTtl
/** The frame will carry an epoch. See `FormInput.staged`: a patch is not held. */
staged?: boolean
/** The patch encoder, when this deployment includes it. `patchPayload` from `@weftjs/ir`. */
patch?: PatchEncoder
}What a refresh needs to produce the smallest honest update for one region.
SurgicalResult
interface
export interface SurgicalResult {
frame: Frame
choice: FormChoice
/** Present only on the delta path. */
delta?: DeltaPayload
/** Present only on the patch path. */
patch?: PatchPayload
/** True when the payload came out of the store rather than being computed for this client. */
memoized: boolean
nextBase: string
}The update, the form it took, and why that form — so a report can explain a large payload.
TelemetryPort
interface
export interface TelemetryPort {
readonly name: string
mark(name: string, at: number): void
measure(name: string, ms: number, attrs?: Record<string, string | number>): void
}Where the marks and the measures go. Two methods: an instant something happened, and how long something took. The kernel measures whether or not one is bound.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/composition.md·spec/kernel/locus.md·spec/plan/profile.md
TransportPort
interface
export interface TransportPort {
readonly name: string
/** 103 Early Hints. H2/H3 only; returns whether it actually went out rather than void. */
earlyHints?(links: PreloadLink[]): Promise<boolean> | boolean
}What the runtime underneath can do that the Fetch API cannot express. Small on purpose: Request and Response cover everything else, and this is the exceptions.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
VerifierOptions
interface
export interface VerifierOptions {
/**
* How deep a delegation chain this verifier accepts. **Zero by default** — a deployment that
* never asked for delegation refuses one as `E_DELEGATE_DEPTH` rather than accepting it by accident.
*/
maxDepth?: number
/** The pinned public key bundle, by key id. An unknown `kid` is refused rather than resolved. */
keys: Record<string, CryptoKey>
/** Where a spent nonce is recorded. A lease nobody releases is the record. */
store: StorePort
clock?(): number
/** Tolerated clock skew between the tier that minted and the tier that checks. */
skewMs?: number
}What a verifier needs: the public keys it will accept, and where spent nonces are remembered.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
VerifyRequest
interface
export interface VerifyRequest {
/** The intent actually being dispatched. The token has to agree with it. */
id: string
token?: string
/** The payload as it arrived, before `input()`. What a bound token is checked against. */
raw: unknown
/** Who is asking, from the session. A token minted for somebody else is not this caller's. */
subject: string | null
}A token presented for one call, with the call it claims to authorise.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
WarmRequest
interface
export interface WarmRequest {
/** The grain's value: a path for `at`, a plan prefix for `plan`. */
value: string
/** The frame itself, for a handler that needs another header off it — `epoch`, say. */
frame: Frame
channel: Channel
}What a WARM asked about at one grain, and everything a handler needs to answer it.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
Specified inspec/kernel/authority.md·spec/kernel/budgets.md
Types
32CapabilityCheck
type
export type CapabilityCheck = (
ctx: EnvelopeContext,
capabilities: readonly string[],
) => Promise<boolean> | booleanWho may run this intent. createCapabilityModel in authority.ts is the model behind it.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_FAILED·E_INTENT_INPUT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_UNDECLARED_WRITE
Specified inspec/kernel/authority.md
ChannelBinding
type
export type ChannelBinding = 'stream' | 'sse' | 'socket' | 'turn'The channel: one client, one Warp frame stream, and none of the four bindings. Binding-agnostic on purpose — a streamed response, SSE and a WebSocket are ChannelSink implementations and one state machine here; turn is the fourth, the one that is not a connection. See spec/kernel/transport.md.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
ChannelRegions
type
export type ChannelRegions = (asked: {
slot: string
channel: Channel
/**
* Anything the caller knows that a channel does not — the same composition with a different
* request, whether it is a refresh of this route or a different one being staged.
*/
request?: RegionRequest
}) => Promise<SlotFrames | null>How a channel reaches a region's renderer, which may be on another deployment.
Coalescer
type
export type Coalescer = (
key: string,
render: () => Promise<Uint8Array>,
) => Promise<{ bytes: Uint8Array; waited: boolean }>What runs a render that might be duplicated. The kernel supplies the key and the render; whether to lease, how long to wait, and whether waiting polls are the store's. waited distinguishes a render that happened from one handed to you.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Specified inspec/kernel/budgets.md·spec/kernel/cache.md
Coherence
type
export type Coherence = 'ttl' | 'generation' | 'pubsub' | 'tracking' | 'warp'How a tier learns that something it holds is now wrong. See spec/kernel/ports.md.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Consistency
type
export type Consistency = 'eventual' | 'strong'// ── store ────────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
DeferrableKind
type
export type DeferrableKind = 'cookie' | 'header'What can wait for the next response when this one's envelope is already sealed.
Raised in this fileE_ENVELOPE_REQUIRED_LATE·E_ENVELOPE_SEALED·E_NOT_DEFERRABLE
ExceedPolicy
type
export type ExceedPolicy = 'stale' | 'client' | 'fallback' | 'placeholder' | 'fail'Where a render executes, and what happens when it costs more than it was allowed. The executor boundary is also the fault and budget boundary. See spec/kernel/locus.md.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
ExecutorKind
type
export type ExecutorKind = 'inline' | 'pool' | 'isolate' | 'binding' | 'svc' | 'client'// ── executor ─────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
FlagValue
type
export type FlagValue = string | number | boolean// ── flags ────────────────────────────────────────────────────────────────────────────
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Grant
type
export type Grant = stringA capability a caller holds. Either exact (cart:write) or a namespace (cart:*).
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
GrantSource
type
export type GrantSource = (ctx: EnvelopeContext) => Promise<Grants> | GrantsWhere a caller's grants come from. An EnvelopeContext: reading identity through it taints identity.
Raised in this fileE_GRANT_EMPTY·E_GRANT_TOO_BROAD·E_GRANTS_UNAVAILABLE
KernelExecutor
type
export type KernelExecutor = ExecutorPort & PreemptibleAn executor that also says whether it can be stopped.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
LimitDecision
type
export type LimitDecision =
| { ok: true; remaining?: number }
| {
ok: false
/** What the call was counted against, for a log. Never for the caller: it identifies them. */
counted: string
/** Milliseconds until the window rolls, when the implementation can say. */
retryAfterMs?: number
}Whether a call is within its limit. A refusal says what it was counted against, for a log only.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Order
type
export type Order = 'in-order' | 'out-of-order'Whether a slow slot holds back the ones after it, or the fastest fills first. Derived, not declared.
PatchEncoder
type
export type PatchEncoder = (
ir: TemplateIR,
base: string,
prev: Values,
next: Values,
resolve?: (version: string) => TemplateIR | undefined,
) => PatchPayloadHow a patch is encoded, supplied rather than imported — a seam for the byte budget.
PluginResidency
type
export type PluginResidency = 'server' | 'client' | 'both' | 'build'Ports replace, plugins extend. Reads are declared and enforced; a plugin may add a cache axis but never write a key. What is here is what a request pays for — ordering is plugin-graph.ts's, build time. See spec/plan/plan.md.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
PolicyClass
type
export type PolicyClass = 'public' | 'private'What a response may advertise. Checked against the class its reads derive, never trusted.
Raised in this fileE_PRIVATE_AS_PUBLIC·E_TTL_REQUIRED·E_UNRESOLVABLE_READ
PortName
type
export type PortName =
| 'render'
| 'store'
| 'flags'
| 'session'
| 'transport'
| 'scheduler'
| 'assets'
| 'telemetry'
| 'executor'
| 'registry'
| 'config'
| 'db'
| 'deployment'
| 'limits'The ports. One active implementation each, and the kernel knows nothing else about the outside world. A port is not a plugin: it answers "who does this job", and replacing it cannot change any invariant. See spec/kernel/ports.md.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
Preemption
type
export type Preemption =
/** Same task, no yield. A budget is a report. */
| 'never'
/** Yields first, so an abort lands at an await. A synchronous render still runs to completion. */
| 'at-await'
/** A separate crash domain that can be stopped mid-instruction. A budget is a limit. */
| 'always'How far a render can be interrupted, which decides whether a CPU budget is a limit or a report. Three states because a boolean could not tell the truth about deferred. See spec/kernel/locus.md.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
ProbePorts
type
export type ProbePorts = Pick<Ports, 'registry' | 'executors'>What asking needs: somewhere to run and, for the recursive half, something to resolve a name.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
ReadGuard
type
export type ReadGuard = (plugin: Plugin, ctx: EnvelopeContext) => EnvelopeContextWraps a context so a plugin's undeclared reads throw. Dev-only by design, so it is passed in rather than imported: see plugin-guard.ts.
Raised in this fileE_ENRICHER_RESPONDED·E_PLUGIN_RESIDENCY·E_PLUGIN_TIMEOUT·E_PLUGIN_UNDECLARED_PROVIDE
RequestState
type
export type RequestState =
/** Nothing has run. Early Hints may go out from here. */
| 'received'
/** Phase A. Filters, guards, envelope effects. The envelope is open. */
| 'envelope'
/** The envelope is sealed: status and headers are frozen and the plan is resolved. */
| 'planned'
/** Phase B. Slots render. `ctx` here has no envelope methods at all. */
| 'streaming'
/** The body is closed. Deferred envelope effects, if any, are now owed to a later request. */
| 'settled'
| 'failed'The request lifecycle, as a state machine rather than a convention — the machine is the thing that refuses, and every refusal is a named code. See spec/kernel/lifecycle.md.
Raised in this fileE_REQUEST_STATE
RouteResolver
type
export type RouteResolver = (params: Record<string, string>, url?: URL) => KernelRoute | Promise<KernelRoute>A plan, resolved for one request.
params is what the router matched. url is the request's, and it is here because "resolved per request" is not a meaningful phrase if the resolver cannot see the request: a page whose subject is a per-slot budget or a delivery order has to be able to read a control, and a control on a server-rendered page is a query parameter.
This decides *placement*, which is the plan's own business. It cannot smuggle an unkeyed read into a render: what a cache key contains still comes from the effect set the compiler inferred, and nothing here can add to it.
Raised in this fileE_NO_ROUTES·E_UNKNOWN_EXECUTOR
RouteStager
type
export type RouteStager = WarmHandlerWhat the hub calls. A WARM carrying at= is one grain of one frame, and this answers it.
Raised in this fileE_NO_NEGOTIATION·E_NO_SUCH_ROUTE
Scope
type
export type Scope = 'process' | 'shared'Who can read this tier. Not the same question as consistency or coherence — conflating them is how a private entry ends up served to the wrong person.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
SlotContent
type
export type SlotContent = Uint8Array | stringWhat fills a slot. A string is encoded; bytes are written as they are.
SlotSource
type
export type SlotSource = (
request: SlotRequest,
) => Promise<SlotRender | SlotFrames | null> | SlotRender | SlotFrames | nullHow the hub reaches a region's renderer. The channel has no request, so this is supplied.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
Specified inspec/kernel/budgets.md
Splitter
type
export type Splitter = (ir: TemplateIR, values: Values, resolve?: Resolver) => SlotSplitHow a document is cut into what can be sent now and what has to wait. A type rather than a call: a route wrapped in nested layouts is cut across the whole chain in split-chain.ts, so a deployment whose layouts are flat does not import it. See spec/kernel/budgets.md.
Transition
type
export type Transition = 'view' | 'instant'Fresh data without a changed view. live is what is painted; any number of staged epochs may exist alongside it, fully resolved and invisible, until a COMMIT flips them all at once. See spec/kernel/locus.md.
Raised in this fileE_NO_SUCH_EPOCH·E_STAGE_LIVE·E_TOO_MANY_EPOCHS
VerifyOutcome
type
export type VerifyOutcome =
{ ok: true; claims: IntentClaims; boundPayload: boolean } | { ok: false; code: string; detail: string }Whether this token authorises this call, and if not, which refusal applies.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
WarmHandler
type
export type WarmHandler = (request: WarmRequest) => Promise<Frame[]>What answers a WARM grain the hub does not handle itself. Templates are the one it does.
Raised in this fileE_INTENT_UNNAMED·E_NO_DOWNSTREAM·E_NO_INTENTS·E_NO_NEGOTIATION·E_NO_SUCH_CHANNEL·E_NO_SUCH_SLOT·E_NO_SUCH_TEMPLATE·E_NO_TEMPLATE_REGISTRY·E_NO_WARM_HANDLER·E_SLOW_CONSUMER·E_UNEXPECTED_FRAME·E_WARP_MAJOR
DEFAULT_REFRESH_TTL
const
export const DEFAULT_REFRESH_TTL: Required<RefreshTtl> = {
baseMs: 15 * 60_000,
deltaMs: 15 * 60_000,
}How long a base render and a memoised delta are kept. A memory-for-bytes trade, never a correctness one.
DISCOVER_MAX
const
export const DISCOVER_MAX = 32How many routes one answer may describe. A truncated answer says so rather than looking complete.
FILLER
const
export const FILLER = `<script>window.__w=function(n){var t=document.querySelector('template[data-w="'+n+'"]');if(!t)return;var w=document.createTreeWalker(document.body,128),c;while(c=w.nextNode())if(c.data==='w:'+n)break;if(!c)return;c.parentNode.insertBefore(t.content,c.nextSibling);t.remove();var s=document.currentScript;if(s)s.remove()}</script>`The fill mechanism, inline and tiny: it has to run while the response is still streaming, before any module could have loaded. Deliberately not in the client runtime, to keep it out of the runtime's byte budget.
LIVE
const
export const LIVE = 'live'The epoch that is on screen. Writing to it is what a refresh does; everything else is staged.
Raised in this fileE_NO_SUCH_EPOCH·E_STAGE_LIVE·E_TOO_MANY_EPOCHS
NO_PLUGINS
const
export const NO_PLUGINS: PluginSchedule = { filters: [], waves: [], axes: {} }An empty schedule, for a kernel with no plugins at all.
Raised in this fileE_PLUGIN_AMBIGUOUS·E_PLUGIN_CAPABILITY_UNGRANTABLE·E_PLUGIN_CYCLE·E_PLUGIN_DUPLICATE·E_PLUGIN_RESIDENCY
PORTS
const
export const PORTS: readonly PortName[] = [
'render',
'store',
'flags',
'session',
'transport',
'scheduler',
'assets',
'telemetry',
'executor',
'registry',
'config',
'db',
'deployment',
'limits',
]Fourteen ports are declared. None of them is approximated: an unbound one refuses by name.
Raised in this fileE_JOB_NOT_ADDRESSABLE·E_NO_CATALOGUE·E_NO_REGION_REGISTRY·E_PORT_UNIMPLEMENTED
PROBE_DEPTH
const
export const PROBE_DEPTH = 8How many tiers a probe walks before it stops asking. See probeRegions.
Raised in this fileE_NO_SUCH_REGION·E_REGION_NOT_LOCAL·E_REGION_TOO_DEEP·E_REGION_TREE·E_REGION_UNREACHABLE·E_REGION_UNREADABLE·E_UNKNOWN_EXECUTOR
TOKEN_ALG
const
export const TOKEN_ALG = 'Ed25519'Signed intents: the discipline mobile server-driven UI has used for years, on the intent catalogue that already exists.
The capability model answers "may this caller do this". A signature answers a different question that no capability check can: **was this call authorised by the server that rendered the page**. A capability is a property of the caller, so a caller who holds cart:write may write any cart the payload names; a token binds the intent, the subject, the payload and a deadline, so a high-value flow can be reached only through a page the server actually served.
Ed25519 rather than an HMAC, and asymmetric for the reason the design gives it a tier of its own: the verifier holds public keys only. An edge that can check a token cannot mint one, so the thing that has to be small and auditable is the thing that has to be small and auditable, and the signing key stays where the pages are rendered.
What it does not do, stated where a reader will meet it:
- **A token is not a capability.** Both are checked, in that order, and neither substitutes for the other. A signature says the server issued this call; a grant says this caller may make it. - **Replay protection is exactly as strong as the store's lease.** A nonce is spent by taking a lease nobody releases, so a store whose leases are process-scoped gives per-process protection and says so — replayScope reports it rather than leaving a deployment to assume the stronger reading. It reads the store's leaseScope, which is deliberately a different field from scope: how far a lease is agreed and how far an entry may travel are two questions, and a deployment should not have to make its cache shared in order to make its nonces single-use. - **A token without p binds no payload.** It says "this reader may run this intent before this time", which is weaker than it looks: the quantity can be edited. Minting with the payload is the one that makes a token a receipt.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
TOKEN_FIELD
const
export const TOKEN_FIELD = '_weft_token'The form field a signed intent's token travels in, beside the payload and never inside it.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
TOKEN_HEADER
const
export const TOKEN_HEADER = 'x-weft-intent-token'The header a fetch carries a signature in, and the field a form has to use instead.
Raised in this fileE_CAPABILITY_DENIED·E_INTENT_EXPIRED·E_INTENT_INPUT·E_INTENT_ON_SAFE_METHOD·E_INTENT_PAYLOAD·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_CAPABILITY_CHECK·E_NO_ED25519·E_NO_RATE_LIMIT·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_RATE_LIMITED·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT·E_UNDECLARED_WRITE
TOKEN_PREFIX
const
export const TOKEN_PREFIX = 'weft1'The first segment of every token, so a malformed one is refused before any crypto runs.
Raised in this fileE_DELEGATE_DEPTH·E_DELEGATE_LONGER·E_INTENT_EXPIRED·E_INTENT_REPLAYED·E_INTENT_SIGNATURE·E_INTENT_TOKEN_MALFORMED·E_INTENT_UNSIGNED·E_NO_ED25519·E_REPLAY_UNKNOWN·E_TOKEN_KEY_UNKNOWN·E_TOKEN_WRONG_INTENT·E_TOKEN_WRONG_PAYLOAD·E_TOKEN_WRONG_SUBJECT
W_CPU_BUDGET_ADVISORY
const
export const W_CPU_BUDGET_ADVISORY =
'W_CPU_BUDGET_ADVISORY: a cpu budget is only a hard limit on a separate crash domain, and this ' +
'slot is not on one. The breach will be reported and the render will finish. ' +
'Move it to pool:, isolate, binding:, or svc: for a limit that stops the work'Warned when a slot declares a CPU budget on an executor that cannot enforce it.
Raised in this fileE_CLIENT_RENDER·E_CPU_BUDGET·E_SLOT_FAILED·W_CPU_BUDGET_ADVISORY
Specified inspec/FINDINGS.md·spec/kernel/locus.md·spec/kernel/ports.md·spec/plan/plan.md