@weftjs/core
The authoring surface, and the only module an application’s own code has to know about. Everything here is either a declaration the compiler reads statically or a typed identity function.
Read out of packages/weft/src/index.ts, the package’s public entry, so this page is the surface itself rather than a description of it.
Functions
238accepts
function
export function accepts(
doc: { spec?: unknown; irVersion?: unknown },
reader = {
spec: TEMPLATE_IR_SPEC,
version: TEMPLATE_IR_VERSION,
},
): AcceptResult { … }The compatibility contract. Major is a hard wire break; minor is additive. See spec/VERSIONING.md.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
acceptWebSocket
function
export function acceptWebSocket(
req: IncomingMessage,
socket: Duplex,
head: Buffer,
): WebSocketConnection | null { … }Complete an upgrade by hand, because the framework does not depend on a WebSocket library.
Raised in this fileE_WS_FRAME_TOO_LARGE
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
adoptScript
function
export function adoptScript(
slot: string,
fragment: CompiledFragment,
values: Values,
options: AdoptOptions = {},
): string | null { … }The payload that binds a slot's template to the markup this render produced, or null for a slot nothing on the client could act on. See spec/client/adoption.md.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
ageOf
function
export function ageOf(profile: Profile, now = Date.now()): string { … }How old a profile is, in words, because a stale one looks exactly like a current one.
allFragments
function
export function allFragments(): Record<string, CompiledFragment> { … }Every compiled fragment, by the name the convention gave it.
For a page whose subject is the application rather than a part of it — a coverage table, a count of sealed templates, a validator run over every fragment's facts. Reaching for one fragment is fragmentIR; this is for the questions that are about all of them.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
allTemplates
function
export function allTemplates(): CompiledApp['templates'] { … }Every sealed template the application has, for a page that wants to count them.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
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
applyDelta
function
export function applyDelta(base: Values, delta: DeltaPayload, ir?: TemplateIR, resolve?: Resolver): Values { … }Applies a path-keyed delta (rows[3].qty) onto a base value set, inverting projections given a template. See spec/ir/template-ir-2.md.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
Specified inspec/FINDINGS.md·spec/ir/template-ir-2.md
appPorts
function
export function appPorts(): Ports { … }What this deployment bound, for a page whose subject is the deployment.
The inspector's ports station used to construct its own store and session and describe those, which is a page about a plausible application rather than about the one serving it. Reading the live record means the row for the store is the store answering the request that rendered it.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
appProfile
function
export function appProfile(): { profile: Profile; decisions: Decisions } | null { … }The recording this application's plan was generated from, or null.
Null is the common case and is not an error: a deployment that was not asked to record has nothing to show, and a page about a profile should say so rather than describe one it invented.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
assertSameTemplate
function
export function assertSameTemplate(ir: TemplateIR, payload: { tpl: string }): void { … }A delta is only applicable to the template version it was computed against.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
assertValidTemplate
function
export function assertValidTemplate(ir: TemplateIR): TemplateIR { … }The same rules as a gate. A validator that accepted an invalid document would be a spec bug.
Raised in this fileE_ANCHOR_KIND·E_ANCHOR_OP·E_ANCHOR_SHAPE·E_CHILDREN_KIND·E_CHILDREN_SHAPE·E_COMPONENT_NESTED·E_COMPONENT_PROPS·E_DERIVED_DUPLICATE·E_DERIVED_EXPR·E_DERIVED_FORWARD_READ·E_DERIVED_ID·E_FORM_FLOOR·E_FORM_UNPROVABLE·E_HOLE_ATTR·E_HOLE_BINDING·E_HOLE_INDEX·E_ID_MISSING·E_ISOLATED_KIND·E_NESTED_KIND·E_NESTED_SHAPE·E_PATH_SHAPE·E_PROPS_KIND·E_RAW_UNVOUCHED·E_RESIDENCY·E_SEGMENT_COUNT·E_VERSION_MISMATCH·E_VERSION_SHAPE·E_VERSION_UNSEALED·E_WIRING_ATTR·E_WIRING_EVENT·E_WIRING_INTENT·E_WIRING_UNKNOWN_BINDING
asset
function
export function asset(path: string): string { … }A file from public/, by the path you wrote it at.
The URL comes back with a digest of the file's contents in it, so it can be cached for a year — which is the entire reason to call this rather than writing the path by hand. An unknown path throws: a typo should fail the render that made it, not become a 404 nobody notices until it is in production.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
Specified inspec/kernel/static.md
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.
baseRenderId
function
export function baseRenderId(ir: TemplateIR, values: Values): string { … }The content address of one render, which is what a client names when it asks for a delta.
bindingExecutor
function
export function bindingExecutor(options: BindingExecutorOptions): KernelExecutor { … }A render on the other side of a binding: same datacentre, no visible network hop, a separate crash domain. Cannot terminate the other side, so the budget is a deadline on *waiting*. See spec/kernel/locus.md.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
boundedDb
function
export function boundedDb(options: BoundedDbOptions = {}): BoundedDb { … }A database access that has to name a deadline and the tags it reads. Neither is bureaucracy.
Raised in this fileE_QUERY_TIMEOUT
Specified inspec/kernel/ports.md
byAddress
function
export function byAddress(header = 'x-forwarded-for'): CountingLimitOptions['counted'] { … }Counted against the caller's address, which behind any real proxy is a header.
Specified inspec/kernel/authority.md
bySession
function
export function bySession(cookie = 'sid'): CountingLimitOptions['counted'] { … }Counted against the session, which is where an unauthenticated caller still has an identity.
Specified inspec/kernel/authority.md
bySubject
function
export function bySubject(): CountingLimitOptions['counted'] { … }Counted against the subject, and unlimited before anybody signs in — no silent address fallback.
Specified inspec/kernel/authority.md
byteLength
function
export function byteLength(
ir: TemplateIR,
supplied: Values,
resolve?: Resolver,
frame?: ChildrenFrame,
): number { … }How many bytes a render would produce, without producing them.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
cacheClassOf
function
export function cacheClassOf(effects: EffectSet): CacheClass { … }Everything about cacheability is derived from what a render read, never declared by an author.
Specified inspec/compiler/effects.md·spec/kernel/cache.md·spec/kernel/composition.md
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
canonicalJson
function
export function canonicalJson(value: Json | undefined): string { … }Deterministic JSON: object keys sorted, so a hash is stable across emitters.
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
changedBindings
function
export function changedBindings(prev: Values, next: Values): Set<BindingId> { … }Top-level bindings whose values differ. Canonical JSON, so key order is not a change.
Raised in this fileE_NESTED_UNRESOLVED
channelHandlers
function
export function channelHandlers(options: ChannelRouteOptions): ChannelHandlers { … }The endpoints a channel needs over Node's HTTP server: upgrade, stream, post-up, and turn.
Raised in this fileE_NO_ADDRESS
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.
childrenFrame
function
export function childrenFrame(
hole: Hole,
values: Values,
resolve: ((version: string) => TemplateIR | undefined) | undefined,
outer: ChildrenFrame | undefined,
): ChildrenFrame | undefined { … }The frame a component hole opens for its instance: absent when the call site wrote none.
Raised in this fileE_NESTED_UNRESOLVED
clearMigrations
function
export function clearMigrations(): void { … }Drops every registered step. For tests: a migration table that leaks between them proves nothing.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
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
clientOwned
function
export function clientOwned(
decls: readonly DerivedDecl[],
signals: readonly { id: BindingId }[],
): Set<BindingId> { … }The derived ids the client owns: those that reach a signal, directly or through another derived value. See spec/ir/template-ir-2.md.
clientView
function
export function clientView(ir: TemplateIR): ClientView { … }The template as a client needs it, and no more. See spec/ir/template-ir-2.md.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
Specified inspec/ir/template-ir-2.md
collectingTelemetry
function
export function collectingTelemetry(): CollectingTelemetry { … }An in-memory telemetry port. For tests and for the devtools' own timeline.
Specified inspec/kernel/ports.md
compareVersions
function
export function compareVersions(a: string, b: string): number { … }Negative, zero or positive, by major then minor then patch.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
compileApp
function
export async function compileApp(
discovered: Discovered,
options: { outDir: string; types?: boolean },
): Promise<CompiledApp> { … }Compile everything the convention found, in dependency order, with the framework's own files staged.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
componentValues
function
export function componentValues(hole: Hole, values: Values): Values { … }The values a component instance is rendered with. A missing prop is null rather than absent, so the child renders a hole, not "undefined".
Raised in this fileE_NESTED_UNRESOLVED
composedIn
function
export function composedIn(app: CompiledApp, fragment: CompiledFragment): CompiledFragment[] { … }Which named fragments a fragment renders, read from the templates it was sealed with — a page composing <Card/> needs card.css, and matching template versions answers that without a second dependency graph.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
concat
function
export function concat(parts: Uint8Array[]): Uint8Array { … }Several buffers as one.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
cookieSession
function
export function cookieSession(options: CookieSessionOptions = {}): SessionPort { … }Identity and cookies from a signed cookie. The default, and a real one.
Specified inspec/kernel/ports.md
countingLimits
function
export function countingLimits(options: CountingLimitOptions): LimitPort { … }A fixed-window counter, and it says fixed on purpose: StorePort has a lease, not a counter, so a sliding window is not available here. See spec/kernel/authority.md.
Specified inspec/kernel/authority.md·spec/kernel/ports.md
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.
createRecorder
function
export function createRecorder(now: () => number = () => Date.now()): Recorder { … }The recorder, which is deliberately not a telemetry port: a TelemetryPort sees a slot name and no route, and the front door knows both.
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
createSegmentMemo
function
export function createSegmentMemo(options: SegmentMemoOptions = {}): SegmentMemo { … }A content-addressed memo over nested templates — list rows and component instances. See spec/kernel/surgical.md.
Raised in this fileE_NESTED_UNRESOLVED
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
decide
function
export function decide(profile: Profile): Decisions { … }What the numbers decide, and — as importantly — what they refuse to. See spec/plan/profile.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
defineConfig
function
export function defineConfig(config: WeftConfig): WeftConfig { … }An identity function that exists for the types, so a config file is checked as it is written.
Raised in this fileE_BLOCKED_PORT·E_CONFIG_NO_DEFAULT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_REGION·E_NO_VERIFIER·E_TAGS_PROCESS_SCOPED
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
defineRenderable
function
export function defineRenderable<I>(declaration: RenderableDeclaration<I>): RenderableDeclaration<I> { … }Identity, typed. The build reads the object; nothing here runs on a request.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
defineRoute
function
export function defineRoute(route: RouteModule): RouteModule { … }Identity, typed. The build reads the object; nothing here runs on a request.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
Specified inspec/kernel/static.md
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.
deltaPayload
function
export function deltaPayload(
ir: TemplateIR,
base: string,
prev: Values,
next: Values,
resolve?: (version: string) => TemplateIR | undefined,
): DeltaPayload { … }The delta between two value sets for one template. See spec/kernel/surgical.md: a pure function of two content-addressed states.
Raised in this fileE_NESTED_UNRESOLVED
derivableForms
function
export function derivableForms(holes: Hole[]): WireForm[] { … }Which wire forms this template can serve, derived rather than declared. See spec/ir/template-ir-2.md.
Raised in this fileE_NESTED_UNRESOLVED
Specified inspec/kernel/surgical.md
derivedPlan
function
export function derivedPlan(decls: readonly DerivedDecl[]): DerivedPlan { … }Which derived values a change can reach, computed once per template rather than per render. See spec/kernel/surgical.md.
Raised in this fileE_NESTED_UNRESOLVED
Specified inspec/kernel/surgical.md
deviceOf
function
export function deviceOf(facts: RequestFacts): string { … }Coarse on purpose. A high-cardinality device string would be a high-cardinality cache key.
diffValues
function
export function diffValues(prev: Values, next: Values, prefix = ''): Values { … }Path-keyed diff (rows[3].qty). A length change is structural and sends the list whole. See spec/ir/template-ir-2.md.
Raised in this fileE_NESTED_UNRESOLVED
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
draftTemplate
function
export function draftTemplate(t: DraftTemplate): TemplateIR { … }An unsealed template: everything but the content-addressed version.
Raised in this fileE_NESTED_UNRESOLVED
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
envConfig
function
export function envConfig(options: EnvConfigOptions = {}): ConfigPort { … }Configuration from the environment, through a declared allow-list — a render reading process.env directly is a read the compiler never saw.
Raised in this fileE_CONFIG_MISSING
Specified inspec/kernel/ports.md
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
escapeBytes
function
export function escapeBytes(s: string, attr: boolean): Uint8Array { … }Escapes only when a scan proves it necessary — the runtime half of escape elision. See spec/ir/template-ir-2.md.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
escapeString
function
export function escapeString(s: string, attr: boolean): string { … }HTML-escape, with the attribute rules where they differ. Called only when a scan proved it necessary.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
evalDerived
function
export function evalDerived(expr: DerivedExpr, read: (id: BindingId) => Json | undefined): Json { … }Total: a binding that is not there reads as null rather than throwing. See spec/ir/template-ir-2.md.
Specified inspec/FINDINGS.md·spec/kernel/budgets.md
explain
function
export function explain(effects: EffectSet): string { … }A one-line account of why a fragment is cacheable the way it is.
Specified inspec/compiler/effects.md
fastHash
function
export function fastHash(input: string): string { … }FNV-1a over two 32-bit lanes. Used only where a collision is cheap. See spec/ir/template-ir-2.md.
fifoScheduler
function
export function fifoScheduler(options: PrioSchedulerOptions = {}): SchedulerPort { … }A ceiling and nothing else: the order a plan produced is kept exactly as it was.
Specified inspec/kernel/ports.md
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.
flagAxes
function
export function flagAxes(effects: EffectSet): string[] { … }Flag axes partition the graph, so they are listed separately from the key.
Specified inspec/compiler/effects.md
formatProfile
function
export function formatProfile(profile: Profile, decisions: Decisions): string { … }The recording as weft profile prints it: what was seen, what it decided, what it refused to.
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
fragment
function
export function fragment(render: (ctx: Ctx) => unknown): (ctx: Ctx) => JSX.ElementA fragment is a slot: it has a cache key, a wire form, an executor, and a budget. It returns a component so that one fragment can render another — the return type has to be JSX.Element for the checker to accept <Widget/>, even though the value is never called at runtime and the compiler resolves the tag statically.
Raised in this fileE_NOT_LOWERED
Specified inspec/compiler/supported-subset.md
fragmentIR
function
export function fragmentIR(name: string): CompiledFragment { … }A compiled fragment, by the name the convention gave it.
fragmentIR('card') is app/fragments/card.tsx; fragmentIR('layout') is the document. This is the framework's own table rather than a second compilation, which is the only version worth exposing: a page that reads a hole, a read set or an escape decision here is reading the one the renderer beside it used, so the two cannot disagree.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
frameworkStyles
function
export async function frameworkStyles(): Promise<string> { … }The framework's own stylesheet, which an application's is appended after.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
fromJSON
function
export function fromJSON(input: unknown): ParseResult { … }A plain object back to a template, applying whatever migrations the version needs.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
generateRoutes
function
export async function generateRoutes(options: GenerateOptions): Promise<Generated> { … }The convention into plans. The two hundred lines of wiring per application that became one file.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
generateSigningKeys
function
export async function generateSigningKeys(): Promise<{ privateKey: string; publicKey: string }> { … }An Ed25519 pair, base64'd the way the config wants them. For a deployment with no key yet.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
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.
hostDeployment
function
export function hostDeployment(options: HostDeploymentOptions = {}): DeploymentPort { … }A deployment that reads its identity from the platform's own variables.
Specified inspec/kernel/ports.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
irRenderer
function
export function irRenderer(): RenderPort { … }Who turns a fragment and a value set into bytes. See spec/kernel/ports.md.
Specified inspec/kernel/ports.md
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
isolateExecutor
function
export function isolateExecutor(options: IsolateExecutorOptions = {}): KernelExecutor { … }One render, one isolate, and nothing carried between them: a fresh thread has an empty module registry, so the first import is paid on every render — the cost of a guarantee that nothing can leak between renders. Measured p50 27.8 ms. See spec/kernel/locus.md.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
isStatic
function
export function isStatic(effects: EffectSet): boolean { … }Reads nothing, so its key is its content address and it could be a file.
isTruthy
function
export function isTruthy(v: Json | undefined): boolean { … }Whether a boolean or presence attribute is written at all.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
keyComponents
function
export function keyComponents(effects: EffectSet): string[] { … }The reads a cache key has to include the *values* of. See spec/kernel/cache.md.
Specified inspec/FINDINGS.md·spec/compiler/effects.md·spec/kernel/cache.md
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
kvStore
function
export function kvStore(namespace: KvNamespace, options: KvStoreOptions = {}): StorePort { … }A store over Workers KV. Eventually consistent, and it declares that rather than hoping.
Raised in this fileE_NO_ATOMIC_LEASE
Specified inspec/kernel/ports.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
likelyNext
function
export function likelyNext(profile: Profile): Record<string, string[]> { … }The transitions, read the other way round: the profile records where a request came from, and a navigation needs the opposite. Inverted once, here, rather than by every reader.
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
listHole
function
export function listHole(fragment: CompiledFragment): string { … }The binding name of a fragment's list hole, taken from the IR rather than written down, so a rename in the .tsx cannot leave a loader filling a hole that no longer exists.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
loadCatalogue
function
export async function loadCatalogue(options: CatalogueOptions): Promise<Catalogue> { … }Load app/renderables/** into a closed set, refusing a collision rather than picking one.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
loadConfig
function
export async function loadConfig(root: string, overrides: WeftConfig = {}): Promise<ResolvedConfig> { … }Load weft.config.ts, apply overrides, and fill in the defaults. An absent file is fine.
Raised in this fileE_BLOCKED_PORT·E_CONFIG_NO_DEFAULT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_REGION·E_NO_VERIFIER·E_TAGS_PROCESS_SCOPED
localeOf
function
export function localeOf(facts: RequestFacts): string { … }The locale, from Accept-Language. Coarse, because a high-cardinality key is a bad key.
manifestRegistry
function
export function manifestRegistry(
entries: readonly ManifestEntry[],
options: ManifestOptions = {},
): ManifestRegistry { … }Region names to deployments, from a manifest. Ids derived with the same function the compiler used.
Raised in this fileE_INTENT_ID_COLLISION·E_REGION_DECLARED_TWICE
Specified inspec/kernel/composition.md·spec/kernel/intents.md
memoryBus
function
export function memoryBus(): FanoutBus { … }One bus. Every port built on it hears what every other port on it publishes, and not itself.
memoryFanout
function
export function memoryFanout(options: MemoryFanoutOptions = {}): FanoutPort { … }A FanoutPort over a bus in this process.
memoryStore
function
export function memoryStore(options: MemoryStoreOptions = {}): MemoryStore { … }The default store: one process, a byte ceiling, and LRU eviction. Real, and not shared.
Raised in this fileE_VALUE_TOO_LARGE
Specified inspec/FINDINGS.md·spec/kernel/authority.md·spec/kernel/cache.md·spec/kernel/ports.md
migrate
function
export function migrate(
doc: Record<string, unknown>,
target = TEMPLATE_IR_VERSION,
): { doc: Record<string, unknown>; applied: string[] } { … }Chains registered migrations until the document reaches the reader's version.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
Specified inspec/VERSIONING.md
mountChannel
function
export async function mountChannel(options: ChannelRouteOptions): Promise<{
url: string
channelUrl(id: string, binding?: ChannelBinding): string
close(): Promise<void>
}> { … }Mounts every binding on one path: the same hub, slot source and store, with only the bytes' path varying.
Raised in this fileE_NO_ADDRESS
mountKernel
function
export async function mountKernel(options: MountOptions): Promise<Mounted> { … }A kernel on a Node HTTP server. The one place web-standard Request meets node:http.
Raised in this fileE_NO_ADDRESS
Specified inspec/FINDINGS.md
nodeTransport
function
export function nodeTransport(res: ServerResponse): TransportPort { … }Request in, Response out — the whole of running the kernel on Node. See spec/kernel/lifecycle.md for 103 Early Hints.
Raised in this fileE_NO_ADDRESS
Specified inspec/FINDINGS.md·spec/kernel/lifecycle.md·spec/kernel/ports.md
parse
function
export function parse(text: string): ParseResult { … }Text back to a template.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
Specified inspec/VERSIONING.md
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.
parseVersion
function
export function parseVersion(v: string): SemVer { … }A version string as numbers. Refuses anything that is not major.minor.patch.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
patchPayload
function
export function patchPayload(
ir: TemplateIR,
base: string,
prev: Values,
next: Values,
resolve?: (version: string) => TemplateIR | undefined,
): PatchPayload { … }What changed between two renders of one template, as writes into the DOM the first one produced.
Raised in this fileE_PATCH_UNADDRESSABLE
Specified inspec/kernel/surgical.md
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
permutations
function
export function permutations(axes: Record<string, FlagValue[]>): Record<string, FlagValue>[] { … }Every reachable combination of the declared axes. What the plan is partitioned over.
Raised in this fileE_FLAG_OFF_AXIS·E_UNKNOWN_FLAG
planFrame
function
export function planFrame(extension: PlanExtension): Frame { … }One PLAN frame. A JSON body, not headers: the routes are a list of records.
prioScheduler
function
export function prioScheduler(options: PrioSchedulerOptions = {}): SchedulerPort { … }Orders a wave by declared priority. It reorders what it was handed and can add nothing.
Specified inspec/kernel/ports.md
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
raw
function
export function raw(_value: unknown): unknown { … }Interpolates without escaping. The compiler records the source text as provenance.
Raised in this fileE_NOT_LOWERED
Specified inspec/VERSIONING.md·spec/compiler/supported-subset.md·spec/ir/template-ir-2.md·spec/kernel/surgical.md
rawValue
function
export function rawValue(h: Hole): boolean { … }A hole whose *value* is markup: raw(). The nested kinds are trusted-raw as well and are not this case — their markup comes from a template, which is what makes it addressable.
Raised in this fileE_NESTED_UNRESOLVED
readProfile
function
export async function readProfile(root: string, outDir: string): Promise<Profile | null> { … }The profile on disk, or null. A different format version is ignored rather than half-read.
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
readsOf
function
export function readsOf(expr: DerivedExpr, out: BindingId[] = []): BindingId[] { … }Every binding the expression reads, in first-seen order and without duplicates.
Specified inspec/compiler/supported-subset.md·spec/ir/template-ir-2.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.
redisLeases
function
export function redisLeases(base: StorePort, options: RedisLeaseOptions = {}): LeasedStore { … }Leases over Redis, so stampede coalescing works across processes rather than once per isolate.
Raised in this fileE_LEASE_CLOSED·E_LEASE_PROTOCOL·E_LEASE_REFUSED·E_LEASE_TIMEOUT·E_LEASE_UNREACHABLE·E_REPLAY_UNKNOWN
Specified inspec/kernel/authority.md·spec/kernel/ports.md
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
regionService
function
export function regionService(options: RegionServiceOptions = {}): (request: Request) => Promise<Response> { … }The other side of a composed region: the render tier, as something a fetch can reach. Same handler shape as renderService, answering frames rather than bytes — the claim that the internal protocol *is* the wire protocol. See spec/kernel/composition.md.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
Specified inspec/kernel/composition.md
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
registerMigration
function
export function registerMigration(from: string, to: string, run: Migration): void { … }Register a step from one minor to the next. Refuses a step that does not go forward, or crosses a major.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
Specified inspec/VERSIONING.md
render
function
export function render(ir: TemplateIR, values: Values, resolve?: Resolver): Uint8Array { … }The one rendering function, called by both server (html) and client (data) — what makes the two provably equal. See spec/kernel/surgical.md.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
Specified inspec/FINDINGS.md·spec/ir/template-ir-2.md·spec/kernel/ports.md·spec/kernel/surgical.md
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.
renderHole
function
export function renderHole(hole: Hole, value: Json | undefined, resolve?: Resolver): Uint8Array { … }One hole's bytes, for a consumer that walks a template itself rather than rendering it. See spec/ir/template-ir-2.md.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
Specified inspec/ir/template-ir-2.md
renderHoleIn
function
export function renderHoleIn(
hole: Hole,
values: Values,
resolve?: Resolver,
frame?: ChildrenFrame,
): Uint8Array { … }One hole's bytes, given the template's **whole** value set — unlike renderHole, this also handles component, variant and children holes. See spec/ir/template-ir-2.md. The values must already have been through resolveDerived; a caller that walks the template owns that step.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
Specified inspec/ir/template-ir-2.md
renderIncremental
function
export function renderIncremental(input: IncrementalInput): IncrementalRender { … }A render that consults the memo for nested templates and recomputes only reachable derived values. Byte-identical to render(), gated.
Raised in this fileE_NESTED_UNRESOLVED
renderInto
function
export function renderInto(
ir: TemplateIR,
values: Values,
out: Uint8Array,
offset = 0,
resolve?: Resolver,
): number { … }Writes into a caller-owned buffer and returns the byte count. Throws OVERFLOW if it does not fit.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
renderService
function
export function renderService(options: RenderServiceOptions = {}): (request: Request) => Promise<Response> { … }A handler that answers render requests for a catalogue, which is the far side of a region.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
Specified inspec/kernel/locus.md
renderSubtree
function
export function renderSubtree(
ir: TemplateIR,
index: number,
supplied: Values,
resolve?: Resolver,
): Uint8Array { … }The markup one hole produced, including a nested template's. What the patch form sends and compares.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
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
requiresTtl
function
export function requiresTtl(effects: EffectSet): boolean { … }Reading the clock forces a TTL: a cache policy without one would never expire.
Specified inspec/compiler/effects.md·spec/kernel/cache.md·spec/kernel/composition.md
resetMigrations
function
export function resetMigrations(): void { … }Clears test-local migrations and puts the built-in chain back.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
resolveAuthority
function
export async function resolveAuthority(
config: AuthorityConfig | undefined,
intents: IntentManifest,
store: StorePort,
ports: Ports,
): Promise<Authority> { … }Turn the config's authority block into the ports, refusing a half-configured one by name.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
resolveDerived
function
export function resolveDerived(decls: readonly DerivedDecl[], values: Values): Values { … }Fills every derived binding into the value set, in declaration order. Always recomputed, never trusted from a reused value set.
resolveDerivedFrom
function
export function resolveDerivedFrom(
plan: DerivedPlan,
previousResolved: Values,
next: Values,
changed: ReadonlySet<BindingId>,
): IncrementalDerived { … }Resolve derived values against a previous resolved set. Identical to a full resolveDerived, gated by a fixture.
Raised in this fileE_NESTED_UNRESOLVED
Specified inspec/kernel/surgical.md
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
scopedSheets
function
export function scopedSheets(discovered: Discovered): string[] { … }Every .scoped.css the convention found, wherever in the tree. One place that knows all six kinds of sheet.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
seal
function
export async function seal(ir: TemplateIR): Promise<TemplateIR> { … }Stamp a template with a hash of its own content. After this, its version *is* its identity.
segmentKey
function
export function segmentKey(tpl: string, values: Values): string { … }The content address of a rendered nested template. Pure function in, pure function out.
Raised in this fileE_NESTED_UNRESOLVED
Specified inspec/kernel/surgical.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
serveRoute
function
export async function serveRoute(route: Route, options: ServeOptions, path = '/'): Promise<Serving> { … }A route, served. Headers and the shell go out before any slot is awaited, which is the only property here that matters: a slow region cannot delay the first byte.
Raised in this fileE_NO_ADDRESS
Specified inspec/FINDINGS.md·spec/kernel/ports.md
serveToken
function
export async function serveToken(options: TokenRequest): Promise<Response> { … }A token, minted for one reader and one call — and the reason it is a request rather than markup: a cache key is derived from what the compiler saw a fragment read, and a token is not a read, so a region carrying one would be cached under a key that does not describe it. See spec/kernel/authority.md.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
services
function
export function services(ports: Ports): Services { … }The half of the ports a loader may use — the services, never the store or the session directly.
setAssets
function
export function setAssets(table: AssetTable): void { … }Publish the asset table once the bundle exists and its hrefs can be resolved.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
setCompiled
function
export function setCompiled(app: CompiledApp): void { … }Publish the compiled templates so fragmentIR can answer. Called before route modules load.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
setPorts
function
export function setPorts(ports: Ports): void { … }Publish the bound ports, so a loader reaches the deployment's rather than a second set.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
setProfile
function
export function setProfile(recorded: { profile: Profile; decisions: Decisions } | null): void { … }Publish the recording a page can display. Null when this process was not asked to plan from one.
Raised in this fileE_NO_APP·E_NO_FRAGMENT
short
function
export function short(hash: string, n = 6): string { … }A hash shortened for a log or a report. Never for a key.
signal
function
export function signal<T>(_initial: T): Signal<T> { … }Client-owned state, declared.
A declaration the compiler reads, not a function that runs: calling one at runtime is a bug worth naming rather than a fallback worth having, which is why it throws.
Raised in this fileE_NOT_LOWERED
Specified inspec/compiler/supported-subset.md
slotHoles
function
export function slotHoles(fragment: CompiledFragment): string[] { … }Slot boundaries a fragment leaves for somebody else to fill, in document order.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
socketSink
function
export function socketSink(connection: WebSocketConnection): ChannelSink { … }A sink over a WebSocket. Reports saturation, which is what makes backpressure a close.
Raised in this fileE_NO_ADDRESS
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
sseSink
function
export function sseSink(res: ServerResponse): ChannelSink { … }A sink over an event stream, for a client whose upgrade was refused.
Raised in this fileE_NO_ADDRESS
stageAssets
function
export async function stageAssets(root: string, outDir: string): Promise<Record<string, string>> { … }Stage them, and answer with where each one went. Beside assets/ rather than inside it: that directory is published, and these are working copies of framework source — a scratch directory that is also the deployment shipped .tsx files and a tsconfig.json at the site root once.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
staticConfig
function
export function staticConfig(values: Record<string, string | undefined>): ConfigPort { … }Settings from an object: a Worker's env, a test, or a config file that already read them.
Raised in this fileE_CONFIG_MISSING
Specified inspec/kernel/ports.md
staticDeployment
function
export function staticDeployment(options: DeploymentOptions = {}): DeploymentPort { … }A deployment that knows its own identity because somebody wrote it down.
Specified inspec/kernel/ports.md
staticFlags
function
export function staticFlags(options: StaticFlagsOptions): FlagPort { … }Flags from a declared axis set: an undeclared flag is a build error, not a silent dead branch.
Raised in this fileE_FLAG_OFF_AXIS·E_UNKNOWN_FLAG
Specified inspec/kernel/ports.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.
streamSink
function
export function streamSink(res: ServerResponse): ChannelSink { … }The four bindings the design names, over a real socket — and the one that needs no socket. Each is a ChannelSink; the state machine above them does not know which it is talking to. See spec/kernel/transport.md.
Raised in this fileE_NO_ADDRESS
stringify
function
export function stringify(ir: TemplateIR, forward?: Record<string, Json>): string { … }A template as text. Keys are ordered, so the same template is always the same bytes.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
Specified inspec/VERSIONING.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
svcExecutor
function
export function svcExecutor(options: SvcExecutorOptions): KernelExecutor { … }A render on another pod, over the network. Identical in shape to a binding, different in every failure mode: a network exists, so the deadline does real work.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
templateFingerprint
function
export function templateFingerprint(ir: TemplateIR): Uint8Array { … }The bytes a template version is a hash of. meta is excluded on purpose. See spec/ir/template-ir-2.md.
templateVersion
function
export async function templateVersion(ir: TemplateIR): Promise<string> { … }Template versions get a real digest: SHA-256 truncated to 128 bits. See spec/ir/template-ir-2.md.
tieredStore
function
export function tieredStore(tiers: readonly StorePort[], name = 'tiered'): StorePort { … }Several stores as one, nearest first. Reports the weakest tier's coherence, not the nearest.
Raised in this fileE_NO_TIERS
Specified inspec/kernel/ports.md
toJSON
function
export function toJSON(ir: TemplateIR, forward: Record<string, Json> = {}): SerializedTemplate { … }A template as a plain object. forward carries fields a newer reader added, unchanged.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
topology
function
export function topology(name: TopologyName, options: TopologyOptions): Topology { … }One of the design's named topologies, built so switching between them is a config change.
Raised in this fileE_NO_REGION_ADDRESS·E_NO_TIER
Specified inspec/kernel/composition.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
turnSink
function
export function turnSink(): ChannelSink & { taken(): readonly Frame[] } { … }A sink that holds frames instead of writing them, for a binding whose downstream is a response body not yet written. Taking the buffer rather than receive's return value is what makes a turn carry the same set a socket would have seen. No saturated: the peer of a turn is not reading yet at all. See spec/kernel/transport.md.
Raised in this fileE_NO_ADDRESS
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
unionEffects
function
export function unionEffects(sets: readonly EffectSet[]): EffectSet { … }What a fragment reads includes what the fragments it renders read. See spec/compiler/effects.md.
upFrames
function
export function upFrames(frames: readonly Frame[]): Uint8Array<ArrayBuffer> { … }The upstream body: a preamble and the frames — a discrete POST is its own stream. Returned over a real ArrayBuffer: fetch and WebSocket.send both want the narrow type Node's typings widen.
Raised in this fileE_NO_ADDRESS
validateTemplate
function
export function validateTemplate(ir: TemplateIR): ValidationResult { … }Every structural rule, against one template. Returns findings rather than throwing.
Raised in this fileE_ANCHOR_KIND·E_ANCHOR_OP·E_ANCHOR_SHAPE·E_CHILDREN_KIND·E_CHILDREN_SHAPE·E_COMPONENT_NESTED·E_COMPONENT_PROPS·E_DERIVED_DUPLICATE·E_DERIVED_EXPR·E_DERIVED_FORWARD_READ·E_DERIVED_ID·E_FORM_FLOOR·E_FORM_UNPROVABLE·E_HOLE_ATTR·E_HOLE_BINDING·E_HOLE_INDEX·E_ID_MISSING·E_ISOLATED_KIND·E_NESTED_KIND·E_NESTED_SHAPE·E_PATH_SHAPE·E_PROPS_KIND·E_RAW_UNVOUCHED·E_RESIDENCY·E_SEGMENT_COUNT·E_VERSION_MISMATCH·E_VERSION_SHAPE·E_VERSION_UNSEALED·E_WIRING_ATTR·E_WIRING_EVENT·E_WIRING_INTENT·E_WIRING_UNKNOWN_BINDING
valueText
function
export function valueText(v: Json | undefined): string { … }The text a value contributes, before escaping. Exported for a consumer writing through a DOM API — the patch form's writes.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
varyOn
function
export function varyOn(effects: EffectSet): string[] { … }A shared response keyed by a request value has to say so, or a CDN will serve it to everyone.
Specified inspec/compiler/effects.md·spec/kernel/cache.md·spec/kernel/composition.md
verifySealed
function
export async function verifySealed(ir: TemplateIR): Promise<ValidationResult> { … }Confirms the content address actually addresses this content.
Raised in this fileE_ANCHOR_KIND·E_ANCHOR_OP·E_ANCHOR_SHAPE·E_CHILDREN_KIND·E_CHILDREN_SHAPE·E_COMPONENT_NESTED·E_COMPONENT_PROPS·E_DERIVED_DUPLICATE·E_DERIVED_EXPR·E_DERIVED_FORWARD_READ·E_DERIVED_ID·E_FORM_FLOOR·E_FORM_UNPROVABLE·E_HOLE_ATTR·E_HOLE_BINDING·E_HOLE_INDEX·E_ID_MISSING·E_ISOLATED_KIND·E_NESTED_KIND·E_NESTED_SHAPE·E_PATH_SHAPE·E_PROPS_KIND·E_RAW_UNVOUCHED·E_RESIDENCY·E_SEGMENT_COUNT·E_VERSION_MISMATCH·E_VERSION_SHAPE·E_VERSION_UNSEALED·E_WIRING_ATTR·E_WIRING_EVENT·E_WIRING_INTENT·E_WIRING_UNKNOWN_BINDING
withServices
function
export function withServices(ctx: RenderContext, ports: Ports): LoaderContext { … }The kernel's context, with the deployment's services on it.
Wrapped rather than replaced: what the kernel handed in is what tracks reads and what the cache key comes from, and nothing here can add to it. That is the property worth keeping — a loader gains a database and a settings table and still cannot smuggle an unkeyed read into a render.
Specified inspec/kernel/ports.md
workerEntry
function
export function workerEntry(from: string): string { … }The worker's own entry module, resolved from wherever the caller is.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_POOL_CLOSED·E_SLOT_FAILED
workerPool
function
export function workerPool(options: WorkerPoolOptions = {}): WorkerPool { … }Renders on worker threads, which is what makes a CPU budget a limit rather than advisory.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_POOL_CLOSED·E_SLOT_FAILED
workersHandler
function
export function workersHandler(options: WorkersHandlerOptions): {
fetch(request: Request, env?: unknown, ctx?: ExecutionContext): Promise<Response>
} { … }export default workersHandler({ serve, store }) and nothing else. An isolate is torn down when its response settles, so an absent ctx is reported rather than ignored — the drain still happens inline where it can.
Raised in this fileE_NO_ATOMIC_LEASE
Specified inspec/kernel/ports.md
writeProfile
function
export async function writeProfile(root: string, outDir: string, profile: Profile): Promise<string> { … }Write the recording out. Called on the way down, so a killed process loses only the tail.
Classes
21AuthorityConfigError
class
export class AuthorityConfigError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code}: ${message}`)
this.name = 'AuthorityConfigError'
this.code = code
}
}A configuration refusal: a key that will not load, or a grant naming nothing.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
AuthorityError
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
CatalogueError
class
export class CatalogueError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'CatalogueError'
this.code = code
}
}A catalogue refusal — a duplicate id, an unreadable module, a declaration with no fragment.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
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
ConfigError
class
export class ConfigError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'ConfigError'
this.code = code
}
}What the deployment was configured with. Two implementations, genuinely different shapes: a Node process reads its environment, a Worker is handed an env object per request. See ConfigPort in @weftjs/kernel.
Raised in this fileE_CONFIG_MISSING
DbError
class
export class DbError extends Error {
code: string
query: string
constructor(code: string, query: string, message: string) {
super(`${code} [${query}] — ${message}`)
this.name = 'DbError'
this.code = code
this.query = query
}
}A database refusal: a deadline passed, or an access that declared no tags.
Raised in this fileE_QUERY_TIMEOUT
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
FlagError
class
export class FlagError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'FlagError'
this.code = code
}
}A flag refusal: an undeclared flag, or a bucket that returned a value off the axis.
Raised in this fileE_FLAG_OFF_AXIS·E_UNKNOWN_FLAG
GenerateError
class
export class GenerateError extends Error {
code: string
constructor(code: string, message: string) {
super(`${code} — ${message}`)
this.name = 'GenerateError'
this.code = code
}
}A generation refusal, naming the file rather than the mechanism.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
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
236AdoptOptions
interface
export interface AdoptOptions {
/** Extra value names beyond the ones a client-owned derived expression is seen to read. */
expose?: readonly string[]
/** Refreshable over the channel, which is what tells the client to connect on load. */
live?: boolean
/** What the client queries to find the region. Defaults to the slot's own wrapper. */
selector?: string
/**
* `refresh(everyMs, { when })` from the plan: the design's stated fallback for push invalidation
* across a tier boundary. See `spec/kernel/composition.md`.
*/
refresh?: { everyMs: number; when?: readonly string[] }
}The adopt payload, derived rather than written, from what the compiler put in the template.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
AssetPort
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
Authority
interface
export interface Authority {
model: CapabilityModel | null
signer: IntentSigner | null
verifier: IntentVerifier | null
/** Every capability any intent declares, which is the closed set the grants are checked against. */
declared: string[]
/** Intent ids that require a signature, for the page prelude. */
signed: string[]
diagnostics: string[]
}What this deployment bound of the authority tier: the checks, the signer, the verifier.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
AuthorityConfig
interface
export interface AuthorityConfig {
/** What each role holds. `cart:*` covers every capability under `cart:`; a bare `*` is refused. */
grants?: Record<string, readonly Grant[]>
/** Which roles a subject has. Without one, a caller with a session is `user`, without is `anonymous`. */
roles?(subject: string): Promise<readonly string[]> | readonly string[]
/** Capabilities every caller holds, session or not. Where a deliberately public one goes. */
ambient?: readonly Grant[]
/** The role of a caller with no session. Defaults to `anonymous`. */
anonymous?: string
/**
* Ed25519 keys, for the intents that declare `signed`. Base64 of PKCS#8 / SPKI, or already-imported
* `CryptoKey`s. `publicKeys` is a bundle by key id, so rotation is a key added.
*/
signing?: {
kid: string
privateKey?: string | CryptoKey
publicKeys?: Record<string, string | C
…What a deployment binds when its intents declare authority, resolved once: the capability model and verifier wired into both intent bindings, the signer (optional — a tier with no private key can check tokens and mint none), and the closed-set check. See spec/kernel/authority.md.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
BindingExecutorOptions
interface
export interface BindingExecutorOptions {
/** The binding — `env.RENDERER.fetch` on Workers, a sidecar client on a mesh. A `fetch` because that is the one shape all of them share. */
binding: BoundFetch
/** Where the job is posted. Only meaningful to the other side. */
path?: string
timeoutMs?: number
telemetry?: TelemetryPort
name?: string
}A region over a platform binding — a real crash domain with no network in it.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
BoundedDb
interface
export interface BoundedDb extends DbPort {
observed(): readonly Observed[]
/** Every tag any query has declared. What an invalidation can be checked against. */
tags(): readonly string[]
forget(): void
}A database with a deadline and declared tags, plus what it observed.
Raised in this fileE_QUERY_TIMEOUT
BoundedDbOptions
interface
export interface BoundedDbOptions {
/** The deadline a query gets when it does not ask for one. Ten seconds, which is generous. */
timeoutMs?: number
telemetry?: TelemetryPort
/** How many accesses to remember for the trace. Zero keeps none. */
history?: number
now?(): number
}Where a loader's data comes from, named rather than anonymous. See DbPort in @weftjs/kernel. The deadline is an AbortSignal the caller is expected to honour — this port cannot cancel work it did not start.
Raised in this fileE_QUERY_TIMEOUT
BudgetDeclaration
interface
export interface BudgetDeclaration {
/** CPU this slot may spend before the exceed policy applies. `'120ms'`, or milliseconds. */
cpu?: string | number
/** JavaScript this slot may add to the page. `'8kb'`, or bytes. A ceiling on what was *built*, which is why `budgetFor` cannot override it. */
js?: string | number
/** How much the ceiling above may grow before the build fails. A growth cap is a diff. */
grow?: string | number
/** What happens when the slot does not fit: `stale`, `client`, `fallback`, `placeholder` or `fail`. */
onExceed?: ExceedPolicy
}What a slot may spend, in the spellings a person writes: '120ms', '8kb'. See spec/kernel/budgets.md.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
CacheDeclaration
interface
export interface CacheDeclaration {
/** `public` or `private`. Checked against the class this slot's reads derive, never trusted. */
class: PolicyClass
/** How long an entry may be served. `'5m'`, `'1h'`, or milliseconds. Required wherever a fragment read the clock. */
ttl?: string | number
/** Stale-while-revalidate: how long past the TTL an entry may answer while it refreshes. Same spellings as `ttl`. */
swr?: string | number
/** What invalidates this. An intent that declares one of these tags drops this entry when it runs. */
tags?: string[]
/** What the bound store can honestly claim. Defaults to `eventual`; a slot needing `strong` is refused on a store that cannot promise it. */
consistency?: 'eventual' | 'strong'
}What a slot declares about being held. Checked against what its fragment reads — spec/kernel/cache.md.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
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
Catalogue
interface
export interface Catalogue {
entries: CatalogueEntry[]
/** By opaque id, which is what the registry answers with. */
byId: Map<string, Renderable>
/** Name to id, so a page can name one in markup a person wrote. */
names: Record<string, string>
}The closed set of fragments a browser may name.
Closed on purpose: an id that resolves to nothing is a refusal, so a client cannot reach a fragment somebody forgot was reachable. The ids are derived the same way an intent's are, so the wire never carries a function name.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
CatalogueEntry
interface
export interface CatalogueEntry {
module: string
export: string
/** Six hex characters, derived from the two fields above and from nothing else. */
id: string
name: string
/** What renders it: a compiled fragment in this process, or a region the registry resolves. */
by: string
capabilities: string[]
signed: boolean
limit?: IntentLimit
}One entry: its id, what renders it, and what a caller must hold to ask for it.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
CatalogueOptions
interface
export interface CatalogueOptions {
root: string
files: readonly string[]
compiled: CompiledApp
ports: Ports
/** How a region-served entry is composed. Supplied by the front door, which owns the composer. */
compose?(region: string, request: RenderRequest): Promise<SlotFrames | null>
moduleIdOf(file: string): string
}Where the catalogue comes from: the renderables/ directory, and what checks a request.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
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
ChannelHandlers
interface
export interface ChannelHandlers {
/** True when the request was a channel request and has been answered. */
http(req: IncomingMessage, res: ServerResponse): boolean
/** True when the upgrade was a channel upgrade and has been taken. */
upgrade(req: IncomingMessage, socket: Duplex, head: Buffer): boolean
}The bindings as a pair of handlers rather than a server, so an application can mount them beside its own routes. mountChannel is this plus a createServer call.
Raised in this fileE_NO_ADDRESS
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.
ChannelRouteOptions
interface
export interface ChannelRouteOptions {
hub: ChannelHub
/** Mount point. `?c=<id>` names the channel on every binding. */
path?: string
/** Called when a channel's socket drops, so a caller can release its holds. */
onClose?(id: string, binding: ChannelBinding): void
}What the channel routes need: the hub, and how a connection is identified.
Raised in this fileE_NO_ADDRESS
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
ChildrenFrame
interface
export interface ChildrenFrame {
ir: TemplateIR
values: Values
outer?: ChildrenFrame
}The markup a call site wrote between a component's tags, and the value set it reads. A frame, not a hole value — see spec/ir/template-ir-2.md.
Raised in this fileE_NESTED_UNRESOLVED
ClientView
interface
export interface ClientView {
version: string
holes: Hole[]
wiring: WiringEntry[]
derived: DerivedDecl[]
}What a TPL frame carries: addressing and wiring, deliberately not the segments or the effect set. See spec/ir/template-ir-2.md.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
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.
CollectingTelemetry
interface
export interface CollectingTelemetry extends TelemetryPort {
readonly marks: { name: string; at: number }[]
readonly measures: Recorded[]
breaches(): Recorded[]
reset(): void
}Telemetry that keeps what it was told, so a test can assert on marks rather than on logs.
CompiledApp
interface
export interface CompiledApp {
/**
* By logical name: `layout`, `error`, `markup`, `route:/blog/:slug`, `slot:header`,
* `fragment:card`, and `nested:/dashboard` for a layout scoped to a subtree of the route table.
*/
fragments: Record<string, CompiledFragment>
diagnostics: string[]
/** Every sealed template, for a build artifact and for the channel's template lookup. */
templates: TemplateIR[]
}Every sealed template this application has, by the name the convention gave it.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
CompiledFragment
interface
export interface CompiledFragment {
entry: TemplateIR
templates: TemplateIR[]
resolve: Resolver
/** Project-relative, for a diagnostic that has to name a file. */
file: string
/**
* The bytes on disk that produced this IR. Carried rather than left for the caller to read: a
* caller reading the path itself could read a file that has since changed.
*/
source: string
}The application's own fragments, compiled by the real compiler, once. Nothing downstream holds a hand-written IR — a cache class, a read set or a hole is the one the compiler inferred.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
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
CookieSessionOptions
interface
export interface CookieSessionOptions {
cookie?: string
/** Maps the cookie's value to an identity. A real implementation verifies a signature. */
identify?(token: string): Promise<string | null> | string | null
/** Tokens older than this are rotated in phase A, where a Set-Cookie is still a real header. */
rotateAfterMs?: number
clock?: () => number
}Cookies, tokens, identity — and nothing else. See spec/kernel/ports.md: SessionPort.
CountingLimitOptions
interface
export interface CountingLimitOptions {
/** Where counts live. A single-process store means a limit per process. */
store: StorePort
/**
* What a call is counted against, or null for a call this deployment does not limit — an intent
* with an internal caller (a queue worker, a migration) needs to say "not this one".
*/
counted(request: LimitRequest): Promise<string | null> | string | null
/** For a test that needs a clock it controls. */
now?(): number
}A rate limiter, and the shape of the one decision the kernel refused to make: counted is the whole port, since *whose* traffic this is differs per deployment. See spec/kernel/authority.md.
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
Ctx
interface
export interface Ctx {
/** Taints `flag:name`. Becomes a plan axis: only the resolved branch is reachable. */
flag(flag: unknown): Promise<boolean>
/** Taints `cookie:key`. Shared, keyed by value, and adds to Vary. */
cookie(key: string): string | undefined
/** Taints `header:key`. Shared, keyed by value, and adds to Vary. */
header(key: string): string | undefined
/** Taints `route:key`. Already part of the route key. */
param(key: string): string | undefined
query(key: string): string | undefined
/** Low cardinality, so ideal for ahead-of-time permutations. */
locale(): string
device(): 'low-end' | 'mid' | 'hi'
/** Taints `identity`. Private: never shared, never a CDN entry. */
user(): Promise<{ id: string } | null>
/** Taints `time`, which forces a TTL — a cache policy without one is a build error. */
now(): number
/**
* The escape hat
…Every call here taints the fragment, and nothing else does. The taint set becomes the cache key, so the compiler refuses a read it cannot name statically.
Raised in this fileE_NOT_LOWERED
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
Decisions
interface
export interface Decisions {
routes: RouteDecision[]
/**
* Which routes are worth describing before anybody looks at them. Too few descriptions to say is
* absent rather than defaulted. See `spec/plan/profile.md`.
*/
discover: DiscoverDecision[]
/** Slots the profile saw too little of to say anything about. */
thin: { route: string; slot: string; renders: number }[]
/** What a profile cannot decide here, and why. Printed rather than left as a silence. */
refused: { what: string; why: string }[]
}Everything a recording decided, and what it refused to decide. Placement, cache classes and keys are untouched — a recording has no standing over what the compiler inferred.
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
DeltaPayload
interface
export interface DeltaPayload {
spec: typeof PAYLOAD_SPEC
irVersion: string
form: 'delta'
tpl: string
base: string
changed: Values
}The changed values of a region, against the base render the client says it holds.
Raised in this fileE_NESTED_UNRESOLVED
DeploymentOptions
interface
export interface DeploymentOptions {
revision?: string
environment?: string
region?: string
instance?: string
}Which build is answering, and where it is running. See DeploymentPort in @weftjs/kernel. Deliberately not for cache keys: a key already contains the template's content address.
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
DerivedDecl
interface
export interface DerivedDecl {
id: BindingId
expr: DerivedExpr
}A value computed from other bindings, as a tree rather than as code — no closure on the wire, no hydration to recompute.
DerivedPlan
interface
export interface DerivedPlan {
/** Derived ids to recompute, in declaration order, for a given set of changed bindings. */
affectedBy(changed: ReadonlySet<BindingId>): BindingId[]
readonly order: readonly DerivedDecl[]
}// ── level two: derived values ────────────────────────────────────────────────────────
Raised in this fileE_NESTED_UNRESOLVED
DiscoverDecision
interface
export interface DiscoverDecision {
route: string
/** Whether describing this route to a client that has not been to it is worth the bytes. */
describe: boolean
described: number
followed: number
because: string
}Whether describing this route to a client that has not been to it pays for the bytes.
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
DraftTemplate
interface
export interface DraftTemplate {
id: string
segments: (Uint8Array | string)[]
holes: Hole[]
wiring?: WiringEntry[]
signals?: SignalDecl[]
derived?: DerivedDecl[]
forms?: WireForm[]
effects?: EffectSet
meta?: Record<string, Json>
}A template before it is sealed. seal fills in the version, which is why that is absent here.
Raised in this fileE_NESTED_UNRESOLVED
EffectSet
interface
export interface EffectSet {
reads: string[]
writes: string[]
envelope: string[]
residency: 'server' | 'client' | 'either'
}What a fragment reads, writes and does to the envelope, inferred by the compiler. See spec/kernel/cache.md.
Raised in this fileE_NESTED_UNRESOLVED
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
EnvConfigOptions
interface
export interface EnvConfigOptions {
/**
* Only keys under this prefix are visible, and they are asked for without it. Defaults to
* `WEFT_`: no prefix would hand every fragment the whole environment.
*/
prefix?: string
/** The environment to read. Defaults to this process's. */
env?: Record<string, string | undefined>
}Which environment variables are readable, and what a missing one does.
Raised in this fileE_CONFIG_MISSING
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
ExecutionContext
interface
export interface ExecutionContext {
waitUntil(promise: Promise<unknown>): void
passThroughOnException?(): void
}What a Workers runtime hands a fetch handler. Structural, so no platform types are imported.
Raised in this fileE_NO_ATOMIC_LEASE
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.
FanoutBus
interface
export interface FanoutBus {
send(origin: string, keys: readonly string[], reason: string): void
listen(listener: (origin: string, keys: readonly string[], reason: string) => void): () => void
}Cross-instance invalidation, in memory — the default, and the shape every other binding copies. A Redis, Valkey or NATS binding replaces this without touching the hub. See spec/kernel/transport.md.
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.
Generated
interface
export interface Generated {
routes: GeneratedRoute[]
facts: Record<string, SlotFacts>
/** Which layout hole each route fills with what, for `weft build`'s report. */
layoutSlots: string[]
}Every route, the compiler's facts, and which holes the documents left.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
GeneratedRoute
interface
export interface GeneratedRoute {
pattern: string
plan: Plan
entry: RouteEntry<RouteResolver>
module: RouteModule
/** Slots this route can refresh over the channel, by slot name. */
live: Record<string, LiveSlot>
/**
* Every region of this route, live or not, by slot name. `live` gates a *refresh*; staging a
* route needs every region regardless, because the reader is about to see the whole page.
*/
regions: Record<string, LiveSlot>
/**
* Regions of this route that render on another deployment, by slot name. Carried on the route
* because a region is composed on three paths, and all three have to reach the same deployment
* with the same budget and contract. Derived by the plan layer's `regionSpecOf`.
*/
remote: Record<string, RegionSpec>
/**
* The shell values this route offers its regions, resolved for a set of params — read fr
…The generated plan: a route file and its declaration become a Plan and a RouteBindings. Nothing here invents a fact — cache classes, read sets and escape decisions come from the compiler, placement from the declaration, and the plan is validated against the former.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
GenerateOptions
interface
export interface GenerateOptions {
discovered: Discovered
compiled: CompiledApp
config: ResolvedConfig
/** The one stylesheet a page links, resolved when the page renders — the href does not exist yet at generation time. */
styleHref(pattern: string): string
/** A fragment file's colocated stylesheets, in cascade order: global `.css`, then `.scoped.css`. */
styleOf(file: string): readonly string[]
/** Where a live slot's base render is recorded, so its first refresh can be a delta. */
store: StorePort
/** Every cache tag some intent writes. See `StaticInput.written`. */
written?: ReadonlySet<string>
/** What this deployment bound. A loader is handed the services half of it. */
ports: Ports
/** What a recording decided about delivery. Placement stays the convention's; a profile decides
* only whether a region is worth arriving separately. */
p
…What generation needs: the file tree, the compiled templates, the ports, and the late bindings.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
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
HeadDeclaration
interface
export interface HeadDeclaration {
/** The document's `<title>`. */
title?: string
/** The `<meta name="description">`, and what a share card says. */
description?: string
/** Any other `<meta name=… content=…>` pair. `og:` and `twitter:` names are written as given. */
meta?: Record<string, string>
}What goes in the document head for this route. A function of the params, never of the request.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
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
Hole
interface
export interface Hole {
index: number
kind: HoleKind
escape: EscapeClass
binding: BindingId
path: number[]
attr?: string
provenance?: string
/** For `list`: the version items project through. For `component`/`variant`: the version rendered/written. See `spec/ir/template-ir-2.md`. */
nested?: string
/** For `component`/`variant`: child prop name to the parent binding that supplies it. See `spec/ir/template-ir-2.md`. */
props?: Record<string, BindingId>
/** For `component`: the template version holding the markup the call site wrote between the tags. See `spec/ir/template-ir-2.md`. */
children?: string
/** For `component`: the instance is its own cache unit and the parent does not render it. See `spec/ir/template-ir-2.md`. */
isolated?: boolean
/** For `list`: the binding each item is supplied as, when a row interpolates the item itself. See `sp
…One gap in a sealed template: what fills it, how it escapes, and where it is in the DOM.
Raised in this fileE_NESTED_UNRESOLVED
HostDeploymentOptions
interface
export interface HostDeploymentOptions extends DeploymentOptions {
env?: Record<string, string | undefined>
/** Read `WEFT_`-prefixed settings from a config port instead of the raw environment. */
config?: ConfigPort
}Where this deployment thinks it is, when the host tells it rather than the config.
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
IncrementalDerived
interface
export interface IncrementalDerived {
values: Values
recomputed: BindingId[]
reused: BindingId[]
}Which derived values a recompute could skip, because nothing they read changed.
Raised in this fileE_NESTED_UNRESOLVED
IncrementalInput
interface
export interface IncrementalInput {
ir: TemplateIR
values: Values
memo: SegmentMemo
resolve?: Resolver
/** The previous render's resolved values, for level two. Without one every derived value is recomputed. */
previous?: { resolved: Values; supplied: Values }
/** Precomputed dependency graph. Built from `ir.derived` when absent. */
plan?: DerivedPlan
}The previous values and the memo, which is everything an incremental render needs extra.
Raised in this fileE_NESTED_UNRESOLVED
IncrementalRender
interface
export interface IncrementalRender {
bytes: Uint8Array
stats: IncrementalStats
/** The resolved value set, so the next round has a previous to compare against. */
resolved: Values
}The bytes, plus how many nested templates were reused rather than rendered.
Raised in this fileE_NESTED_UNRESOLVED
IncrementalStats
interface
export interface IncrementalStats {
/** Nested templates served from the memo, and rendered. */
segments: { reused: number; rendered: number }
derived: { reused: number; recomputed: number }
/** Holes whose shape changed rather than whose values did. See `spec/kernel/surgical.md`. */
structural: string[]
}// ── level three: template segments ───────────────────────────────────────────────────
Raised in this fileE_NESTED_UNRESOLVED
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
IrError
interface
export interface IrError {
code: string
at: string
message: string
}One thing wrong with a document: the code, where it is, and a sentence.
Raised in this fileE_ANCHOR_KIND·E_ANCHOR_OP·E_ANCHOR_SHAPE·E_CHILDREN_KIND·E_CHILDREN_SHAPE·E_COMPONENT_NESTED·E_COMPONENT_PROPS·E_DERIVED_DUPLICATE·E_DERIVED_EXPR·E_DERIVED_FORWARD_READ·E_DERIVED_ID·E_FORM_FLOOR·E_FORM_UNPROVABLE·E_HOLE_ATTR·E_HOLE_BINDING·E_HOLE_INDEX·E_ID_MISSING·E_ISOLATED_KIND·E_NESTED_KIND·E_NESTED_SHAPE·E_PATH_SHAPE·E_PROPS_KIND·E_RAW_UNVOUCHED·E_RESIDENCY·E_SEGMENT_COUNT·E_VERSION_MISMATCH·E_VERSION_SHAPE·E_VERSION_UNSEALED·E_WIRING_ATTR·E_WIRING_EVENT·E_WIRING_INTENT·E_WIRING_UNKNOWN_BINDING
IsolateExecutorOptions
interface
export interface IsolateExecutorOptions {
/** Resolves a relative module specifier in an address. Defaults to the adapters directory. */
root?: string
telemetry?: TelemetryPort
/** The deadline a job gets when the slot declared no budget. */
timeoutMs?: number
}A region in a separate isolate on this machine.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
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
KvNamespace
interface
export interface KvNamespace {
get(key: string, options?: { type: 'arrayBuffer' }): Promise<ArrayBuffer | null>
put(
key: string,
value: ArrayBuffer | Uint8Array | string,
options?: { expirationTtl?: number; metadata?: unknown },
): Promise<void>
delete(key: string): Promise<void>
list(options?: { prefix?: string; cursor?: string }): Promise<{
keys: { name: string; metadata?: unknown }[]
list_complete?: boolean
cursor?: string
}>
}The shape of an edge key-value namespace, deliberately not one provider's client — Workers KV, Deno KV, an R2 bucket, a Redis REST proxy are all this. A binding is passed in rather than constructed.
Raised in this fileE_NO_ATOMIC_LEASE
KvStoreOptions
interface
export interface KvStoreOptions {
name?: string
/** Where a lease is taken, when needed. Unbound is `E_NO_ATOMIC_LEASE`. `redisLeases` is the implementation that exists. */
leases?: Pick<StorePort, 'lease' | 'leaseScope'>
/** Bytes a single entry may be, from the platform's own limit. */
maxValueBytes?: number
clock?(): number
}What a KV-backed store needs to know about the namespace it was handed.
Raised in this fileE_NO_ATOMIC_LEASE
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
LiveSlot
interface
export interface LiveSlot {
fragment: CompiledFragment
load: (ctx: RenderContext, params: Record<string, string>) => Promise<Values>
key: string
tags: string[]
}A region the framework can render again later: its fragment, its loader, and its cache tags.
Raised in this fileE_CONSISTENCY_MISMATCH·E_DUPLICATE_LAYOUT_HOLE·E_ETAG_STREAMS·E_LAYOUT_HOLE_UNFILLED·E_NO_BODY_SLOT·E_NO_DEFAULT_ROUTE·E_NO_NESTING_SLOT·E_NO_PAGE·E_NO_SLOTS·E_NO_SUCH_FRAGMENT·E_NO_SUCH_LAYOUT·E_REGION_EXECUTOR
ManifestEntry
interface
export interface ManifestEntry {
module: string
export: string
intent: Intent<never>
}A registry built from a manifest: every intent the build found, keyed by the opaque id the compiler derived. Derived here, not declared — a manifest that spelled its own ids could disagree with the templates.
Raised in this fileE_INTENT_ID_COLLISION·E_REGION_DECLARED_TWICE
ManifestOptions
interface
export interface ManifestOptions {
/**
* Region name to the deployment serving it. Separate from the intent entries: an intent id
* changes with the code, a region binding changes when somebody rolls a tier.
*/
regions?: readonly RegionBinding[]
}The manifest a registry resolves against, and what a name it does not know does.
Raised in this fileE_INTENT_ID_COLLISION·E_REGION_DECLARED_TWICE
ManifestRegistry
interface
export interface ManifestRegistry extends Registry {
/** The id an entry got, for a build report and for `weft why`. */
idFor(module: string, exportName: string): string
/** Point a region somewhere else, without rebuilding the shell that composes it. See `spec/kernel/composition.md`. */
roll(binding: RegionBinding): void
/** Narrowed from the port's optional, possibly-async shape: a manifest is a map and answers now. */
region(name: string): RegionBinding | undefined
regions(): readonly string[]
}A registry plus the manifest it answered from, for a build report and for weft verify.
Raised in this fileE_INTENT_ID_COLLISION·E_REGION_DECLARED_TWICE
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
MemoryFanoutOptions
interface
export interface MemoryFanoutOptions {
/** Shared to make two ports talk to each other. Its own bus otherwise, which talks to nobody. */
bus?: FanoutBus
/** This instance's identity. Generated unless a deployment has a better name for itself. */
origin?: string
}What a memory fanout needs: a bus to talk on, and a name to not hear itself by.
MemoryStore
interface
export interface MemoryStore extends StorePort {
/** Runs the tasks handed to `revalidateAfterResponse`. See `spec/kernel/ports.md`. */
drain(): Promise<void>
}An in-process store, plus the drain a deployment has to call for deferred revalidation.
Raised in this fileE_VALUE_TOO_LARGE
MemoryStoreOptions
interface
export interface MemoryStoreOptions {
maxBytes?: number
name?: string
clock?: () => number
}L1: isolate-local memory. Byte-bounded and LRU-evicted, never an unbounded Map — inside a 128 MB Workers isolate an unbounded cache is an outage waiting for traffic. Coherence is generation: a process-local tier can't be told from outside that it holds something wrong. See spec/kernel/ports.md.
Raised in this fileE_VALUE_TOO_LARGE
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
Mounted
interface
export interface Mounted {
url: string
close(): Promise<void>
}A mounted kernel: the server, the URL it answers on, and how to close it.
Raised in this fileE_NO_ADDRESS
MountOptions
interface
export interface MountOptions {
path?: string
/** Built per request, so the transport can hold the response object it must write 103 to. */
kernel(transport: TransportPort): Kernel
route(): KernelRoute
}What mounting needs: the kernel, the port, and the handlers around it.
Raised in this fileE_NO_ADDRESS
Observed
interface
export interface Observed {
name: string
ms: number
tags: readonly string[]
failed?: boolean
}What one access cost and what it touched, so a slow query has a name in a report.
Raised in this fileE_QUERY_TIMEOUT
ParseResult
interface
export interface ParseResult {
ir: TemplateIR
/** Fields a newer minor added. Kept so a re-emit does not silently drop them. */
forward: Record<string, Json>
migrationsApplied: string[]
mode: 'exact' | 'upgrade' | 'forward'
}A parsed document, plus how it was accepted — exact, migrated, or read forward.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
PatchPayload
interface
export interface PatchPayload {
spec: typeof PAYLOAD_SPEC
irVersion: string
form: 'patch'
tpl: string
base: string
/** Paths of the holes whose subtree owns its own markers, so a client with no template arrives at the same ordinals. */
opaque: number[][]
writes: PatchWrite[]
}A patch: the markup of the holes that changed, and nothing about the ones that did not.
Raised in this fileE_PATCH_UNADDRESSABLE
PatchWrite
interface
export interface PatchWrite {
/** Element children only, from the region root — the address adoption already walks. */
path: number[]
op: PatchOp
attr?: string
/** Marker ordinal, for a text hole that is not the only child of its element. */
anchor?: number
/** Absent means remove: a boolean that went false, or a presence attribute with no value. */
value?: string
}One hole's markup, addressed by path — the rung that needs no resident template.
Raised in this fileE_PATCH_UNADDRESSABLE
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
PrioSchedulerOptions
interface
export interface PrioSchedulerOptions {
/** Defaults to six, which is the kernel's own default and the number the plan warns against. */
maxConcurrency?: number
}Who decides what runs first, and how much of it runs at once. prioScheduler is exactly the behaviour that was already there, named as a port so a deployment can change it. See spec/kernel/ports.md.
Profile
interface
export interface Profile {
version: string
/** When it was written, absolute, so an old profile can say how old it is. */
recordedAt: number
/** Wall-clock the recorder was collecting for. */
forMs: number
routes: Record<string, RouteObservation>
}A recording, as written to disk. Versioned: an older one is ignored rather than half-read.
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
Recorded
interface
export interface Recorded {
name: string
ms: number
attrs?: Record<string, string | number>
}Every budget outcome is an event class of its own. See spec/kernel/locus.md.
Recorder
interface
export interface Recorder {
/** A document request arrived for this route. */
request(route: string, from?: string): void
/** This route was described to a client that had not been to it, in a `PLAN` frame. Recorded per
* described route rather than per frame. */
described(route: string): void
/** A described route was then asked for. */
followed(route: string): void
/** A slot rendered, which means the store did not already have it. */
render(route: string, slot: string, ms: number, bytes: number): void
/** A slot the store answered for. */
hit(route: string, slot: string): void
/** What has been observed so far, as the file would be written. */
profile(): Profile
readonly renders: number
}What every render, cache hit and description reports to while a process is recording.
RedisLeaseOptions
interface
export interface RedisLeaseOptions {
/** `redis://[user:password@]host[:port][/db]`, or `rediss://` for TLS — the string a platform hands you. */
url?: string
host?: string
port?: number
password?: string
username?: string
db?: number
tls?: boolean
/** Prepended to every lease key. Empty by default: the keys arriving here are already namespaced. */
prefix?: string
/** How long to wait for the connection itself. */
connectTimeoutMs?: number
/**
* How long to wait for a reply before treating the connection as gone. Short by default: this is
* on the request path. A timeout destroys the socket, since replies are matched by order and an
* abandoned one would answer the next caller instead.
*/
timeoutMs?: number
name?: string
}Leases a whole deployment agrees about, over a socket — the bottom row of the table in spec/kernel/authority.md. SET key value NX PX ttl is one round trip, atomic, expiring on its own. A store that cannot be reached throws rather than returning "free": E_REPLAY_UNKNOWN rather than a signed intent replayable for the length of an outage.
Raised in this fileE_LEASE_CLOSED·E_LEASE_PROTOCOL·E_LEASE_REFUSED·E_LEASE_TIMEOUT·E_LEASE_UNREACHABLE·E_REPLAY_UNKNOWN
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
RegionAnswer
interface
export interface RegionAnswer {
frames?: readonly Frame[]
/** Markup, when the region has no frames to send. Announced as one `HTML` frame for this region. */
html?: Uint8Array | string
/** The regions this render composed, as this region's own composer reported them. */
composed?: readonly RegionNode[]
}A render, plus what it took to produce — the shape a region that composes regions answers with.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
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
RegionDeclaration
interface
export interface RegionDeclaration {
/** It crosses a deployment boundary, and what the shell expects to find. `true` describes nothing, so the region reads `opaque`. */
remote?: boolean | RegionContract
/** A fragment rendered in this region's place when it fails, by name under `app/fragments/`. */
fallback?: string
/** Failure is invisible: an empty hole and nobody paged. */
optional?: boolean
/** Directives this region needs. Merged into the document's one policy, and refused on conflict. */
csp?: Record<string, readonly string[]>
/** Shell signals this region reads. Checked against `defineRoute({ exposes })`. */
consumes?: string[]
/** Ours, and in the first flush. A remote region may not be critical: the flush cannot wait. */
critical?: boolean
}A slot that is a fragment living somewhere else.
Declares that there is a boundary, never where the other side is: the deployment says where in weft.config.ts. See spec/kernel/composition.md.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
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
RegionRenderer
interface
export interface RegionRenderer {
region: string
contract?: RegionContract
/**
* Frames for a client, or markup, announced as one `HTML` frame. A region that composed regions
* of its own returns `RegionAnswer` instead, with `composed` from its own composer — measured
* rather than the hop count it was configured with.
*/
render(
request: RegionRequest,
): Promise<Frame[] | Uint8Array | string | RegionAnswer> | Frame[] | Uint8Array | string | RegionAnswer
/**
* What this region composes, answered without rendering it. The recursive half of
* `weft verify --probe`. See `spec/kernel/composition.md`.
*/
probe?(depth: number): Promise<readonly RegionNode[]> | readonly RegionNode[]
}What a module has to export to be a region: the name it serves, and how to render it. region is here rather than taken from the request — the whole security property, since a service that echoed back whatever it was asked would make E_REGION_ESCAPE unfalsifiable. See spec/kernel/composition.md.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
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
RegionServiceOptions
interface
export interface RegionServiceOptions {
/** Resolves a relative module specifier. Defaults to the adapters directory. */
root?: string
/** The build answering, announced on every region it serves. */
revision?: string
/**
* Boundaries this service crosses on its own account, for a region reaching something this
* framework did not resolve. Declared rather than measured — the fallback for a region whose own
* regions don't go through a composer.
*/
hops?: number
}The other end: what a deployment serving regions needs to answer with Warp frames.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
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
RenderableDeclaration
interface
export interface RenderableDeclaration<I = unknown> {
/** Human-readable, for a log and for the build report. Never on the wire. */
name: string
/** Which fragment renders it, by name under `app/fragments/`. */
fragment?: string
/**
* Or: the region that serves it, by name, resolved through the registry like any other region.
*
* The half that makes this a catalogue. An entry named here is rendered by whichever deployment the
* registry currently points that region at, so moving it is a registry write — and the client, which
* only ever had an opaque id, is not involved in either arrangement.
*/
region?: 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
/**
…A fragment a client may ask for by opaque id, and the gates that ask applies.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
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
RenderServiceOptions
interface
export interface RenderServiceOptions {
/** Resolves a relative module specifier. Defaults to the adapters directory. */
root?: string
}The other side of a binding or a service, so this repository can test both against something real. The worker entry's contract over HTTP: resolve a module and export by name, call it, answer with bytes.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
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
ResolvedConfig
interface
export interface ResolvedConfig extends Required<Pick<WeftConfig, 'srcDir' | 'outDir' | 'port' | 'host'>> {
root: string
css: string[]
nav?: { href: string; label: string }[]
flags: Record<string, string[]>
session: { cookie: string }
executors: Record<string, KernelExecutor>
channelPath: string
/** False on a deployment with no process to hold a connection. See `WeftConfig.channel`. */
channelHold: boolean
/** How many instances run at once. See `WeftConfig.instances`. */
instances: number
/** Where this application is served from. See `WeftConfig.site`. */
origin?: string
/** Cross-instance invalidation. See `WeftConfig.fanout`. */
fanout?: FanoutPort
/** Where an invalidation waits for a turn. See `WeftConfig.journal`. */
journal?: StaleJournal
/** Where a route change lands when the framework answers a link. See `WeftConfig.navigation`
…The config with every default filled in, so nothing downstream has to know what a default is.
Raised in this fileE_BLOCKED_PORT·E_CONFIG_NO_DEFAULT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_REGION·E_NO_VERIFIER·E_TAGS_PROCESS_SCOPED
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
RouteDecision
interface
export interface RouteDecision {
route: string
slots: SlotDecision[]
/** Routes worth staging from this one, most likely first. */
stage: string[]
}One route's decisions: its slots' delivery, and which pages it is worth staging from.
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
RouteModule
interface
export interface RouteModule {
/** Which document wraps this page: `app/layouts/<name>.tsx`. Without one it is `app/layout.tsx`. */
layout?: string
/**
* The title, the description and any other meta tag, as a value or a function of the params.
*
* Never a function of the request: a head that varied per request would vary the document, whose
* cache key is derived from what its fragments read.
*/
head?: HeadDeclaration | ((params: Record<string, string>) => HeadDeclaration)
/**
* Extra values for the layout's own holes, beyond the six the framework always supplies. Declaring
* them here is what makes the unfilled-hole check possible: a hole nothing supplies fails the build.
*/
layoutValues?: Record<string, unknown> | ((params: Record<string, string>) => Record<string, unknown>)
/** The `body` slot's values. */
load?: RouteLoad
/** Th
…What a .data.ts default-exports.
Read at build time, so every field here becomes part of the generated plan rather than a branch taken per request — and every field is validated against what the compiler inferred.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
RouteObservation
interface
export interface RouteObservation {
requests: number
slots: Record<string, SlotObservation>
/** Which route a reader came from, by pattern, and how often. What a nav should stage. */
from: Record<string, number>
/**
* Times this route was *described* to a client that had not been to it, and times a description
* was then used. See `spec/plan/profile.md`.
*/
described: number
followed: number
}What one route cost, and where its readers came from — which is what a Referer says.
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
SegmentMemo
interface
export interface SegmentMemo {
get(key: string): Uint8Array | undefined
set(key: string, bytes: Uint8Array): void
readonly hits: number
readonly misses: number
readonly size: number
}The design's second and third memoisation levels — opt-in, per-slot. See spec/kernel/surgical.md.
Raised in this fileE_NESTED_UNRESOLVED
SegmentMemoOptions
interface
export interface SegmentMemoOptions {
/** Bytes. An unbounded memo inside a 128 MB isolate is an outage waiting for traffic. */
maxBytes?: number
}How much of the memo to keep, which is a memory-for-renders trade and nothing else.
Raised in this fileE_NESTED_UNRESOLVED
SemVer
interface
export interface SemVer {
major: number
minor: number
patch: number
}A parsed version. Nothing here compares versions as strings, because 2.10 sorts wrong.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
SerializedTemplate
interface
export interface SerializedTemplate {
spec: string
irVersion: string
id: string
version: string
encoding: 'base64'
segments: string[]
holes: Json
wiring: Json
signals: Json
derived: Json
forms: Json
effects: Json
meta?: Json
[k: string]: Json | undefined
}A sealed template as JSON: segments base64, everything else as written.
Raised in this fileE_ENCODING_UNSUPPORTED·E_INVALID_DOCUMENT·E_NOT_A_DOCUMENT
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
ServeOptions
interface
export interface ServeOptions {
order: Order
prelude?: SlotContent
postlude?: SlotContent
}Where to listen, and what handles a request the kernel does not.
Raised in this fileE_NO_ADDRESS
Services
interface
export interface Services {
setting(key: string): string | undefined
/** A setting the deployment cannot run without. Missing is refused, never defaulted. */
required(key: string): string
data<T>(query: DbQuery, run: (signal: AbortSignal) => Promise<T>): Promise<T>
}What a route's own code may reach that is not a read of the request.
Everything on the kernel's context taints: it is a property of the request, so it lands in the cache key. These two are properties of the *deployment*. A setting is the same for every request the process serves, and a query says where the data came from rather than which data was asked for — so neither may taint, and a setting that did would put a database URL in a key nobody could safely log.
They live here rather than in the kernel for a reason the byte budget made unarguable. A loader is a front-door concept — a .data.ts the compiler never reads — and the kernel's document request path has 134 bytes of headroom against a figure the design fixed. A new capability does not draw on that headroom; it goes where its consumer already is, which is here.
Both refuse by name when their port is unbound. Returning undefined for a setting nobody configured would turn a deployment mistake into a rendering one three files away.
Serving
interface
export interface Serving {
url: string
close(): Promise<void>
}A running server: its URL, and how to stop it.
Raised in this fileE_NO_ADDRESS
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.
Signal
interface
export interface Signal<T> {
(): T
set(next: T): void
}The authoring surface, and the only module an application's own code has to know about.
Everything here is either a declaration the compiler reads statically or a typed identity function. Nothing in this file runs during a render: fragment is lowered to a sealed template at build time, and calling one at runtime is a bug worth naming rather than a fallback worth having.
Raised in this fileE_NOT_LOWERED
SignalDecl
interface
export interface SignalDecl {
id: BindingId
type: 'string' | 'number' | 'boolean' | 'json'
init?: Json
}Client-owned state the server renders at its initial value and then stops owning.
Raised in this fileE_NESTED_UNRESOLVED
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
SlotDecision
interface
export interface SlotDecision {
route: string
slot: string
/** What the plan should say, or null where the profile has nothing to say about it. */
delivery: 'stream' | 'buffered' | null
prio?: number
/** The evidence, in one line. This is what `weft profile` prints and `weft why` attributes. */
because: string
}What the numbers decided about one slot's delivery, and the sentence explaining it.
SlotDeclaration
interface
export interface SlotDeclaration {
/**
* Which fragment renders it, by name under `app/fragments/`. Omitted for the `body` slot,
* which is the route's own file, and for a slot with `html`.
*/
fragment?: string
/**
* Where this slot's values come from. Runs in phase B, after the envelope is sealed, so it cannot
* redirect and cannot set a header — that is `guard`'s job.
*/
load?: RouteLoad
/** Markup rather than content — a control panel, a readout. Goes through `raw()`, and says so. */
html?: string | ((ctx: RenderContext, params: Record<string, string>) => string | Promise<string>)
/** How long this region may be held and what invalidates it. See `CacheDeclaration`. */
cache?: CacheDeclaration
/** Streamed with an optional priority. `false` buffers, which derives in-order delivery. */
stream?: boolean | { prio?: number }
/**
* Re-
…Everything a route says about one hole: what fills it, when it arrives, what it may spend.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
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
SlotObservation
interface
export interface SlotObservation {
/** Renders observed. A hit is not a render, which is why this is not the request count. */
renders: number
/** Milliseconds to produce the bytes, including the loader. */
p50: number
p95: number
/** The largest render seen, in bytes. Streaming a small region buys nothing. */
bytes: number
/** Requests that did not render it, because the store already had it. */
hits: number
}What one slot cost, over every render the recording saw. Renders and cache hits kept apart.
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
StaticFlagsOptions
interface
export interface StaticFlagsOptions {
/** Flag to every value it can take. The first entry is the default. */
axes: Record<string, FlagValue[]>
/** Optional per-request bucketing. Whatever it returns must be one of the declared values. */
bucket?(flag: string, request: RequestFacts): FlagValue | undefined
}A flag is a graph partition rather than a runtime if. See spec/kernel/ports.md: axes() is not optional.
Raised in this fileE_FLAG_OFF_AXIS·E_UNKNOWN_FLAG
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.
SvcExecutorOptions
interface
export interface SvcExecutorOptions {
/** Where the renderer lives. Another pod, another region, another team's service. */
url: string
timeoutMs?: number
telemetry?: TelemetryPort
name?: string
fetch?: typeof globalThis.fetch
}A region over HTTP: where it lives, what it may spend, and what a failure degrades to.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
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
TemplateIR
interface
export interface TemplateIR {
spec: typeof TEMPLATE_IR_SPEC
irVersion: string
id: string
version: string
segments: Uint8Array[]
holes: Hole[]
wiring: WiringEntry[]
signals: SignalDecl[]
/** Values computed from other bindings. See `spec/ir/template-ir-2.md`: ownership follows the reads. */
derived: DerivedDecl[]
forms: WireForm[]
effects: EffectSet
meta?: Record<string, Json>
}A sealed template: pre-encoded UTF-8 segments with holes between them, and a version that is a hash of its own content. See spec/ir/template-ir-2.md.
Raised in this fileE_NESTED_UNRESOLVED
TokenRequest
interface
export interface TokenRequest {
request: Request
authority: Authority
intents: IntentManifest
ports: Ports
}What a page asks for when it needs a signed intent minted for one reader.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
Topology
interface
export interface Topology {
name: TopologyName
registry: ManifestRegistry
executors: Record<string, KernelExecutor>
/** One line per region: where it runs and what reaches it. What an incident needs. */
describe(): string
}A named arrangement of regions across deployments, and the registry that resolves it.
Raised in this fileE_NO_REGION_ADDRESS·E_NO_TIER
TopologyOptions
interface
export interface TopologyOptions {
regions: readonly TopologyRegion[]
/**
* The one render tier `split-render` and `edge-regional` send every region to. A URL for a pod,
* a binding for a platform that has them.
*/
render?: { url?: string; binding?: BoundFetch; timeoutMs?: number }
/** Applied to every remote region. A deadline on waiting, which is what a boundary can promise. */
timeoutMs?: number
}What a topology needs: its regions, and how each one is reached.
Raised in this fileE_NO_REGION_ADDRESS·E_NO_TIER
TopologyRegion
interface
export interface TopologyRegion {
region: string
/** Module and export on the far side. Required by every shape except the monolith. */
address?: JobAddress
/** Where this region's own service is, for `mesh`. */
url?: string
/** A binding, for a platform where one tier reaches another without a network. */
binding?: BoundFetch
contract?: RegionContract
revision?: string
}One region in a named topology: what serves it, and at what revision.
Raised in this fileE_NO_REGION_ADDRESS·E_NO_TIER
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
ValidationResult
interface
export interface ValidationResult {
ok: boolean
errors: IrError[]
}Whether a document is valid, and everything wrong with it if not.
Raised in this fileE_ANCHOR_KIND·E_ANCHOR_OP·E_ANCHOR_SHAPE·E_CHILDREN_KIND·E_CHILDREN_SHAPE·E_COMPONENT_NESTED·E_COMPONENT_PROPS·E_DERIVED_DUPLICATE·E_DERIVED_EXPR·E_DERIVED_FORWARD_READ·E_DERIVED_ID·E_FORM_FLOOR·E_FORM_UNPROVABLE·E_HOLE_ATTR·E_HOLE_BINDING·E_HOLE_INDEX·E_ID_MISSING·E_ISOLATED_KIND·E_NESTED_KIND·E_NESTED_SHAPE·E_PATH_SHAPE·E_PROPS_KIND·E_RAW_UNVOUCHED·E_RESIDENCY·E_SEGMENT_COUNT·E_VERSION_MISMATCH·E_VERSION_SHAPE·E_VERSION_UNSEALED·E_WIRING_ATTR·E_WIRING_EVENT·E_WIRING_INTENT·E_WIRING_UNKNOWN_BINDING
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
WebSocketConnection
interface
export interface WebSocketConnection {
readonly open: boolean
/** True when the socket buffer is above its watermark: the peer is not reading. */
readonly saturated: boolean
send(bytes: Uint8Array): void
sendText(text: string): void
onMessage(handler: (bytes: Uint8Array, isText: boolean) => void | Promise<void>): void
onClose(handler: (code: number, reason: string) => void): void
close(code?: number, reason?: string): void
}One upgraded connection, with the buffer depth a sink needs to report saturation.
Raised in this fileE_WS_FRAME_TOO_LARGE
WeftConfig
interface
export interface WeftConfig {
/** Defaults to `app`. */
srcDir?: string
/** Where `weft build` writes. Defaults to `.weft`. */
outDir?: string
/**
* Defaults to 3000. A port on the WHATWG bad-port list is `E_BLOCKED_PORT` rather than a
* deployment whose documents serve perfectly and whose channel silently never connects.
*/
port?: number
/** What the server binds to. Defaults to `localhost`, which is not reachable from another host. */
host?: string
/** Extra stylesheets, in order, after the framework's own. Paths are relative to the project. */
css?: string[]
/**
* What the layout's nav links to. Without one it is derived from every route with no parameter,
* which is right for a small application and editorial the moment there are forty pages.
*/
nav?: { href: string; label: string }[]
/**
* How long a shared cache may serve
…The one file a deployment writes, and the only place it states what it binds.
This is KernelOptions with a front door. Everything is optional: an application with no config file gets an in-process store, a cookie session, no flag axes and inline as the only executor — which is a real deployment for one process and an honest starting point for any other, because the moment a port is bound here nothing else in the application changes.
Raised in this fileE_BLOCKED_PORT·E_CONFIG_NO_DEFAULT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_REGION·E_NO_VERIFIER·E_TAGS_PROCESS_SCOPED
WiringEntry
interface
export interface WiringEntry {
/**
* Indices into *element* children, not childNodes. Element positions do not move
* when a text value renders empty, so an element path is stable across value sets.
*/
path: number[]
op: WiringOp
/** Unused for `event` ops, which name an intent instead. */
binding: BindingId
attr?: string
event?: string
intent?: string
/** For `text`: the ordinal of the marker comment this binding writes after. Absent means the only text child. */
anchor?: number
}One binding the client attaches on adoption. The cost model is the number of these.
Raised in this fileE_NESTED_UNRESOLVED
WorkerPool
interface
export interface WorkerPool extends KernelExecutor {
/** Workers replaced because a job of theirs was killed. A budget breach is not free. */
readonly replaced: number
readonly size: number
close(): Promise<void>
}A pool of worker threads, plus the shutdown a process has to perform.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_POOL_CLOSED·E_SLOT_FAILED
WorkerPoolOptions
interface
export interface WorkerPoolOptions {
/** Threads. Defaults to four, which is a small number on purpose: renders are I/O-shaped more often than not. */
size?: number
/** Resolves a relative module specifier in an address. Defaults to the adapters directory. */
root?: string
telemetry?: TelemetryPort
/** Milliseconds to wait for a worker to exit after `terminate()` before giving up on it. */
drainMs?: number
}A real worker pool, which is what makes .budget({ cpu }) a limit rather than a report: a worker's own event loop lets terminate() stop a render mid-loop, mid-anything. A job must be addressable, a terminated worker is replaced and counted, and props must survive structured clone. See spec/kernel/locus.md.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_POOL_CLOSED·E_SLOT_FAILED
WorkersHandlerOptions
interface
export interface WorkersHandlerOptions {
/** Anything that answers a Request. `createKernel(...).serve` is the one this exists for. */
serve(request: Request): Promise<Response>
/** The store whose after-response queue the platform is asked to wait for. */
store: Pick<StorePort, 'drain'>
/** Told when a revalidation queue could not be handed to the platform, which is a silent failure. */
onOrphaned?(reason: string): void
}What the Workers entry needs, including the waitUntil that lets work outlive a response.
Raised in this fileE_NO_ATOMIC_LEASE
Types
56AcceptMode
type
export type AcceptMode = 'exact' | 'upgrade' | 'forward'How a document was accepted: unchanged, migrated up, or read as-is by a newer reader. See spec/VERSIONING.md.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
AcceptResult
type
export type AcceptResult =
| { ok: true; mode: AcceptMode; from: string; to: string }
| { ok: false; code: 'E_SPEC_MISMATCH' | 'E_MAJOR_UNSUPPORTED' | 'E_VERSION_MALFORMED'; reason: string }Whether this reader can read that document, and if not, which refusal applies.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
BinaryOp
type
export type BinaryOp =
'+' | '-' | '*' | '/' | '%' | '**' | '<' | '>' | '<=' | '>=' | '===' | '!==' | '==' | '!='The binary operators a derived expression may use. Also closed, and for the same reason.
BindingId
type
export type BindingId = stringA value's name inside a template. Holes and wiring entries both address values by it.
Raised in this fileE_NESTED_UNRESOLVED
BoundFetch
type
export type BoundFetch = (request: Request) => Promise<Response> | ResponseWhat a service binding is, reduced to the one thing every platform's version of it has.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_NO_SUCH_EXPORT·E_NOT_A_REGION·E_REGION_ESCAPE·E_REGION_FAILED·E_SLOT_FAILED
BudgetFor
type
export type BudgetFor = (request: { params: Record<string, string>; query: URLSearchParams }) => {
cpu?: string | number
onExceed?: ExceedPolicy
}A budget stated per request rather than per build, for a page whose subject *is* the budget.
The plan keeps the declared values, so weft why and the build report still show a real declaration. Only cpu and onExceed can vary — see spec/kernel/budgets.md.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
CacheClass
type
export type CacheClass = 'static' | 'shared' | 'private'What a read set makes a fragment. Derived, never declared — a class you can assert is one you can assert wrongly.
CapabilityCheck
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
CountedAgainst
type
export type CountedAgainst = CountingLimitOptions['counted']The one decision the limits port exists to refuse to make. See WeftConfig.limits.
Raised in this fileE_BLOCKED_PORT·E_CONFIG_NO_DEFAULT·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SUCH_REGION·E_NO_VERIFIER·E_TAGS_PROCESS_SCOPED
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
DerivedExpr
type
export type DerivedExpr =
| { k: 'ref'; id: BindingId }
| { k: 'lit'; v: Json }
| { k: 'un'; op: UnaryOp; a: DerivedExpr }
| { k: 'bin'; op: BinaryOp; a: DerivedExpr; b: DerivedExpr }
/** A choice between two values — `a ? b : c`, with `a ?? b` and `a || b` lowered to it. See `spec/ir/template-ir-2.md`. */
| { k: 'cond'; a: DerivedExpr; b: DerivedExpr; c: DerivedExpr }A computed value, encoded rather than compiled to a function. See spec/ir/template-ir-2.md.
EscapeClass
type
export type EscapeClass = 'escape' | 'proven-safe' | 'trusted-raw'The compiler's escape-elision decision. trusted-raw must name its provenance. See spec/ir/template-ir-2.md.
Raised in this fileE_NESTED_UNRESOLVED
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
HoleKind
type
export type HoleKind =
| 'text'
| 'attr'
| 'attr-bool'
| 'attr-presence'
| 'node'
| 'list'
| 'slot'
| 'component'
| 'children'
/** A shape that renders only when its binding is truthy. See `spec/ir/template-ir-2.md`. */
| 'variant'What a hole is, which decides who produces its bytes. See spec/ir/template-ir-2.md.
Raised in this fileE_NESTED_UNRESOLVED
Json
type
export type Json = string | number | boolean | null | Json[] | { [k: string]: Json }What can be a hole's value. A template is data, so its values have to be data too.
Raised in this fileE_NESTED_UNRESOLVED
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
LeasedStore
type
export type LeasedStore = StorePort & {
/** Close the connection. A socket outlives a request by design, so something has to end it. */
close(): void
}A store with real leases, plus the connection lifecycle a network client needs.
Raised in this fileE_LEASE_CLOSED·E_LEASE_PROTOCOL·E_LEASE_REFUSED·E_LEASE_TIMEOUT·E_LEASE_UNREACHABLE·E_REPLAY_UNKNOWN
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
LoaderContext
type
export type LoaderContext = RenderContext & ServicesWhat a route's loader receives: the kernel's reads, plus what the deployment bound.
Migration
type
export type Migration = (doc: Record<string, unknown>) => Record<string, unknown>One version step. Pure: it takes a document and returns the next one, and never mutates.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
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.
PatchOp
type
export type PatchOp =
/** Write text into a text node: `.data`, so what travels is unescaped. */
| 'text'
/** Replace an element's children with parsed markup: a raw value, or a call site's children. */
| 'markup'
/** Replace the element itself: a component instance, or one row of a list. */
| 'replace'
/** Add rows to the end of a list. */
| 'append'
/** Drop the rows past `value` from a list. */
| 'truncate'
| 'attr'
| 'bool'
| 'presence'The rung between delta and html, and the one the ladder was missing. See spec/kernel/surgical.md.
Raised in this fileE_PATCH_UNADDRESSABLE
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
RenderableLoad
type
export type RenderableLoad<I> = (
ctx: LoaderContext,
params: I,
) => Values | Promise<Values> | Record<string, unknown> | Promise<Record<string, unknown>>The catalogue, generated from a directory.
app/renderables/**.ts is to a render intent what app/intents/**.ts is to a mutation, down to the derivation: the id is intentId(module, export), the same six hex characters the compiler writes into a template's wiring, so nothing states an id twice and moving the file changes the wire — deliberately, because a renderable's location is part of its address.
Two things make this a catalogue rather than an open render endpoint, and both are the reason it needed the registry before it could exist at all.
**A fragment is not renderable because it is compiled.** app/fragments/ holds everything a page composes; this directory holds what a *browser* may ask for. Making the second set the first one would turn every component in an application into a public endpoint taking arbitrary props.
**The id resolves through a port.** So an entry served by this process today can be served by a region on another deployment tomorrow, and the client cannot tell — which is the design's "rendering as a service, by passing component names over the wire" with the two properties that make it safe: the name is opaque and derived, and what comes back is checked before it reaches a page.
Raised in this fileE_NO_SUCH_FRAGMENT·E_NO_SUCH_REGION·E_RENDER_INPUT·E_RENDERABLE_ID_COLLISION·E_RENDERABLE_NAME_TAKEN·E_RENDERABLE_TWO_SOURCES
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
Resolver
type
export type Resolver = (version: string) => TemplateIR | undefinedResolves a nested template by version, which is how a list of fragments is projected.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
RouteLoad
type
export type RouteLoad = (
ctx: LoaderContext,
params: Record<string, string>,
) => Values | Promise<Values> | Record<string, unknown> | Promise<Record<string, unknown>>Where a slot's values come from. Its result is what the fragment renders with.
weft build turns a route module into a Plan and a RouteBindings. What a route may and may not declare — and why there is deliberately no cache key here — is spec/plan/plan.md.
Raised in this fileE_ETAG_STREAMS·E_UNKNOWN_EXECUTOR
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.
TopologyName
type
export type TopologyName = 'monolith' | 'split-render' | 'edge-regional' | 'mesh'The design's four named topologies, as configuration rather than as modes. See spec/kernel/composition.md.
Raised in this fileE_NO_REGION_ADDRESS·E_NO_TIER
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
UnaryOp
type
export type UnaryOp = '!' | '-' | '+' | '~'The unary operators a derived expression may use. A closed set, because the client evaluates it.
Values
type
export type Values = Record<BindingId, Json>One render's values, by binding. Everything a template needs that is not in its segments.
Raised in this fileE_NESTED_UNRESOLVED
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
WireForm
type
export type WireForm = 'html' | 'bundle' | 'split' | 'patch' | 'delta' | 'remote'How a fragment's update can be encoded. Every form must produce identical bytes. See spec/ir/template-ir-2.md.
Raised in this fileE_NESTED_UNRESOLVED
WiringOp
type
export type WiringOp = 'text' | 'attr' | 'prop' | 'bool' | 'event' | 'list'What a binding writes. prop exists because an attribute and a live value stop agreeing once somebody types.
Raised in this fileE_NESTED_UNRESOLVED
ALL_FORMS
const
export const ALL_FORMS: readonly WireForm[] = ['html', 'bundle', 'split', 'patch', 'delta', 'remote']Every form, in the order the spec lists them. A template declares the subset it can serve.
Raised in this fileE_NESTED_UNRESOLVED
BINARY_OPS
const
export const BINARY_OPS: readonly BinaryOp[] = [
'+',
'-',
'*',
'/',
'%',
'**',
'<',
'>',
'<=',
'>=',
'===',
'!==',
'==',
'!=',
]Every binary operator, for the validator.
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.
EMPTY_EFFECTS
const
export const EMPTY_EFFECTS: EffectSet = { reads: [], writes: [], envelope: [], residency: 'server' }Reads nothing. server rather than either because a fixture is not a claim about residency.
Raised in this fileE_NESTED_UNRESOLVED
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
MIN_DESCRIBED
const
export const MIN_DESCRIBED = 8How many times a route has to have been described before the number says anything.
MIN_SAMPLES
const
export const MIN_SAMPLES = 8How many renders a slot needs before its number decides anything.
MIN_STREAM_BYTES
const
export const MIN_STREAM_BYTES = 512A region smaller than this gains nothing from arriving separately.
MIN_TRANSITIONS
const
export const MIN_TRANSITIONS = 4A transition seen at least this often, and this much of a route's departures, is worth staging.
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
PAYLOAD_SPEC
const
export const PAYLOAD_SPEC = 'weft.payload/2'The format name for a delta or patch payload, versioned separately from the template.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
PAYLOAD_VERSION
const
export const PAYLOAD_VERSION = '2.6.0'The payload version this build writes.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
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
PROFILE_FILE
const
export const PROFILE_FILE = 'profile.json'Where a recording is written, inside the out directory so it travels with the build.
PROFILE_VERSION
const
export const PROFILE_VERSION = '2'Bumped to '2' when a recording started counting discoveries. See spec/plan/profile.md.
renderHtml
const
export const renderHtml = renderrender under the name the html wire form goes by, so a form table can name all of them.
Raised in this fileE_DELTA_NOT_INVERTIBLE·E_DELTA_PATH·E_NESTED_UNRESOLVED·E_TPL_MISMATCH
SLOW_MS
const
export const SLOW_MS = 40A slot slower than this is worth streaming, if something on the page is faster.
STAGED_DIR
const
export const STAGED_DIR = 'staged'The framework's own .tsx files are copied into the project's out directory before they are compiled: a template id is stated relative to the compile root, so compiling them where they are installed would make a version depend on how deep node_modules happens to be.
Raised in this fileE_NO_FRAGMENT·E_NO_LIST_HOLE·E_NOT_COMPILED
TEMPLATE_IR_SPEC
const
export const TEMPLATE_IR_SPEC = 'weft.template-ir/2'The format name, carried in every document. A different name is a different format, not a version.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
TEMPLATE_IR_VERSION
const
export const TEMPLATE_IR_VERSION = '2.6.0'The version this build writes. Minors are forward-compatible; a major is refused.
Raised in this fileE_MAJOR_UNSUPPORTED·E_MIGRATION_CYCLE·E_MIGRATION_DIRECTION·E_MIGRATION_MAJOR·E_MIGRATION_MISSING·E_SPEC_MISMATCH·E_VERSION_MALFORMED
Specified inspec/FINDINGS.md
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_PATH
const
export const TOKEN_PATH = '/_weft/token'Where a client asks for a token. Its own path, because minting is not dispatching.
Raised in this fileE_BAD_SIGNING_KEY·E_CAPABILITY_DENIED·E_CAPABILITY_UNGRANTABLE·E_INTENT_NOT_SIGNED·E_NO_CAPABILITY_CHECK·E_NO_RATE_LIMIT·E_NO_SIGNER·E_NO_SUCH_INTENT·E_NO_VERIFIER·E_TOKEN_REQUEST·W_GRANT_UNUSED·W_NO_CAPABILITY_MODEL·W_NO_PUBLIC_KEYS·W_NO_RATE_LIMIT·W_NO_SIGNER·W_NO_VERIFIER·W_REPLAY_PROCESS_LOCAL
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
UNARY_OPS
const
export const UNARY_OPS: readonly UnaryOp[] = ['!', '-', '+', '~']Every unary operator, for the validator.
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
WORKER_ENTRY
const
export const WORKER_ENTRY = workerEntry(import.meta.url)The module a worker starts on, resolved by what is next to this file: .ts beside these sources, .js beside the compiled ones. A hard-coded extension was wrong in the built case, where the pool could not start a worker and reported it as the render failing.
Raised in this fileE_CPU_BUDGET·E_JOB_NOT_ADDRESSABLE·E_POOL_CLOSED·E_SLOT_FAILED