Module: routes/public
Interfaces
AgentEventCanonicalIdentity
Cross-host identity supplied to an event route without fabricated host
fields, plus the canonical payload of its family (#466): the fields at
least two hosts report — tool name, input, and response, session id,
transcript path, stop re-entry, prompt text, agent id and type, … — each
carrying the host's own key as provenance, and absent when the host did
not send it. E narrows payload to the family the route handles.
Type Parameters
E
E extends CanonicalAgentEvent = CanonicalAgentEvent
Properties
event
readonlyevent:E
idempotencyKey
readonlyidempotencyKey:string
observedAt
readonlyobservedAt:string
payload
readonlypayload:AgentEventPayload<E>
provenance
readonlyprovenance:AgentEventProvenance
sequence
readonlysequence:number
AgentEventProvenance
Properties
host
readonlyhost:string
hostContractRevision
readonlyhostContractRevision:string
nativeEvent
readonlynativeEvent:string
source
readonlysource:"native"
AgentEventRouteConfig
Statically extractable event-route configuration.
Properties
delivery?
readonlyoptionaldelivery?: readonly"immediate"[]
fallback?
readonlyoptionalfallback?:AgentEventFallbackMode
requires?
readonlyoptionalrequires?: readonlystring[]
Capability rows every projected host must support; mutually exclusive with targets.
runtime?
readonlyoptionalruntime?:AgentEventRuntimeMode
Standalone by default; shared explicitly reuses a generated MCP server.
targets?
readonlyoptionaltargets?: readonlystring[]
timeoutMs?
readonlyoptionaltimeoutMs?:number
Route budget within the adapter's stricter native-host deadline.
tools?
readonlyoptionaltools?: readonlystring[]
Canonical tool selectors for tool/before and tool/after routes.
AgentEventRouteProps
Props received by an event route's default Server Component.
canonical.payload is the cross-host reading of the envelope for the
route's family; native is the frozen host envelope itself, for the
host-specific fields the payload does not model; renderInput is strict JSON
passed by the event handler to ctx.render().
Read transport-owned request context with await agent() from
@agent-bundle/runtime. The invocation, host, session, actor, workspace,
and lineage axes are Observed, including typed unavailable reasons when
the host cannot know an axis. Business payload fields cannot override them.
lineage answers "who is my parent, what is the root, am I a subagent";
actor is the HTTP-authenticated client of a streamable MCP transport and
is unavailable on hook-driven event scopes. The framework never derives or
surfaces the operator's identity from a host payload.
Type Parameters
E
E extends CanonicalAgentEvent = CanonicalAgentEvent
RenderInput
RenderInput extends JsonValue = JsonValue
Properties
canonical
readonlycanonical:AgentEventCanonicalIdentity<E>
native
readonlynative:AgentEventNativePayload
renderInput?
readonlyoptionalrenderInput?:RenderInput
signal
readonlysignal:AbortSignal
AgentLayoutRoute
Stable identity of the route a layout is wrapping, baked at compile time
from the route graph. name is the protocol-facing name: the MCP tool,
resource, or prompt name, the space-joined CLI command path, or the script
name. The layout component's props type, AgentLayoutProps, ships from
@agent-bundle/runtime because it carries React's ReactNode children and
this package's root declarations stay React-free for config-only consumers.
Properties
id
readonlyid:string
kind
readonlykind:AgentLayoutRouteKind
name
readonlyname:string
serverId?
readonlyoptionalserverId?:string
The owning MCP server id (mcp:<name>); MCP route kinds only.
AgentProviderContext
Request-scoped inputs supplied to a conventional context provider factory.
Beyond the surface-specific invocation and the request signal, a
factory observes the request's identity axes (host, session,
workspace, plugin) and lineage exactly as the route will read them
from await agent() — the same Observed values, provenance included — plus
read-only views of the mounted state and notice handles (#459). Providers
run after the request's handles exist and before the route, outside the
request's async context: agent() throws outside-invocation there, and
nothing on this context can dispatch state or publish a notice.
Properties
host
readonlyhost:AgentProviderObserved<AgentProviderHostIdentity>
invocation
readonlyinvocation:AgentProviderInvocation
lineage
readonlylineage:AgentProviderObserved<AgentProviderLineage>
notices?
readonlyoptionalnotices?:AgentProviderNoticesHandle
Present only for projects with a mounted notice ledger.
plugin
readonlyplugin:AgentProviderObservedPluginRoot
The resolved plugin root, exactly what the route will read as (await agent()).plugin.
session
readonlysession:AgentProviderObserved<AgentProviderSessionIdentity>
signal
readonlysignal:AbortSignal
state?
readonlyoptionalstate?:AgentProviderStateHandle<unknown>
Present only for projects that declare src/state.ts.
workspace
readonlyworkspace:AgentProviderObserved<AgentProviderWorkspaceIdentity>
AgentProviderHostIdentity
Structurally the runtime's AgentHostIdentity: the host the request came through.
Properties
name
readonlyname:string
AgentProviderLineage
Structurally the runtime's AgentLineage: the request's own chain plus,
when the warm runtime's registry placed it, the live tree around it.
Properties
conversation
readonlyconversation:string
depth
readonlydepth:number
generation?
readonlyoptionalgeneration?:string
parent?
readonlyoptionalparent?:string
resolution
readonlyresolution:AgentProviderLineageResolution
root
readonlyroot:string
subagent?
readonlyoptionalsubagent?:AgentProviderLineageSubagent
tree?
readonlyoptionaltree?:AgentProviderLineageTree
AgentProviderLineagePeer
Structurally the runtime's AgentLineagePeer (#457): one other live conversation in the registry's tree.
Properties
conversation
readonlyconversation:string
depth
readonlydepth:number
parent?
readonlyoptionalparent?:string
resolution
readonlyresolution:AgentProviderLineageResolution
startedAt
readonlystartedAt:string
subagent?
readonlyoptionalsubagent?:AgentProviderLineageSubagent
AgentProviderLineageSubagent
Structurally the runtime's AgentLineageSubagent.
Properties
id
readonlyid:string
isParallelWorker?
readonlyoptionalisParallelWorker?:boolean
toolCallId?
readonlyoptionaltoolCallId?:string
type?
readonlyoptionaltype?:string
AgentProviderLineageTree
Structurally the runtime's AgentLineageTree (#457).
Properties
children
readonlychildren: readonlyAgentProviderLineagePeer[]
roots
readonlyroots: readonlyAgentProviderLineagePeer[]
siblings
readonlysiblings: readonlyAgentProviderLineagePeer[]
AgentProviderNotice
One notice as a provider reads it from inbox() or published(): every
field of the runtime's AgentNotice, spelled structurally. content is the
persisted Agent Document (the runtime's AgentDocument);
it is unknown here because the Agent Document types ship with the runtime,
so a provider that needs the authored text narrows it with the runtime's
types — a route reads the same notice through (await agent()).notices.
Properties
acknowledgement?
readonlyoptionalacknowledgement?:object
acknowledgedAt
readonlyacknowledgedAt:string
invocationId
readonlyinvocationId:string
attempts
readonlyattempts: readonlyAgentProviderNoticeAttempt[]
availability?
readonlyoptionalavailability?:object
channel
readonlychannel:"mcp-resource-updated"
count
readonlycount:number
firstAt
readonlyfirstAt:string
lastAt
readonlylastAt:string
availabilityReservation?
readonlyoptionalavailabilityReservation?:object
at
readonlyat:string
key
readonlykey:string
content
readonlycontent:unknown
createdAt
readonlycreatedAt:string
dedupeKey?
readonlyoptionaldedupeKey?:string
expiredAt?
readonlyoptionalexpiredAt?:string
expiresAt?
readonlyoptionalexpiresAt?:string
exposure?
readonlyoptionalexposure?:object
channel
readonlychannel:"mcp-inbox"
count
readonlycount:number
firstAt
readonlyfirstAt:string
lastAt
readonlylastAt:string
lastInvocationId
readonlylastInvocationId:string
id
readonlyid:string
nextAttemptAt?
readonlyoptionalnextAttemptAt?:string
priority
readonlypriority:"low"|"normal"|"high"
publisher?
readonlyoptionalpublisher?:AgentProviderNoticePublisher
recipient
readonlyrecipient:AgentProviderNoticeRecipient
retryBudget?
readonlyoptionalretryBudget?:number
sensitivity?
readonlyoptionalsensitivity?:"public"|"internal"|"secret"
state
readonlystate:AgentProviderNoticeState
unavailableAt?
readonlyoptionalunavailableAt?:string
unavailableReason?
readonlyoptionalunavailableReason?:"delivery-authorization-unavailable"
withdrawnAt?
readonlyoptionalwithdrawnAt?:string
withheld?
readonlyoptionalwithheld?:Readonly<Partial<Record<string,AgentProviderNoticeWithholding>>>
AgentProviderNoticeAttempt
Structurally the runtime's AgentNoticeAttemptReceipt.
Properties
attemptedAt
readonlyattemptedAt:string
channel
readonlychannel:"next-event"
invocationId
readonlyinvocationId:string
AgentProviderNoticePublisher
Structurally the runtime's AgentNoticePublisher: the identity publish() recorded (#460).
Properties
actor?
readonlyoptionalactor?:object
id
readonlyid:string
conversation?
readonlyoptionalconversation?:string
host?
readonlyoptionalhost?:AgentProviderHostIdentity
session?
readonlyoptionalsession?:AgentProviderSessionIdentity
workspace?
readonlyoptionalworkspace?:AgentProviderWorkspaceIdentity
AgentProviderNoticeRecipient
Structurally the runtime's AgentRecipient: the conjunction of identity
axes a notice is addressed to. conversation and root are lineage ids.
Properties
actor?
readonlyoptionalactor?:object
id
readonlyid:string
conversation?
readonlyoptionalconversation?:string
host?
readonlyoptionalhost?:AgentProviderHostIdentity
root?
readonlyoptionalroot?:string
session?
readonlyoptionalsession?:AgentProviderSessionIdentity
workspace?
readonlyoptionalworkspace?:AgentProviderWorkspaceIdentity
AgentProviderNoticesHandle
The read-only view of the request's notice handle a provider receives
(#459): the runtime's AgentNoticesHandle narrowed by construction to
inbox — pending notices addressed to this request's principal, as the
mcp-inbox route discloses them — and published — what became of the
notices this principal published, in every state (#460). Never publish,
acknowledge, or the admission-bound read. Absent when the project mounts
no notice ledger.
Methods
inbox()
inbox():
Promise<readonlyAgentProviderNotice[]>
Returns
Promise<readonly AgentProviderNotice[]>
published()
published():
Promise<readonlyAgentProviderNotice[]>
Returns
Promise<readonly AgentProviderNotice[]>
AgentProviderNoticeWithholding
Structurally the runtime's AgentNoticeWithholding: a route's refusal to disclose the notice.
Properties
count
readonlycount:number
firstAt
readonlyfirstAt:string
lastAt
readonlylastAt:string
reason
readonlyreason:"route-unavailable"|"sensitivity-exceeds-route"
AgentProviderPluginRoot
The plugin code root and framework state root a generated scope resolved
(#468), as (await agent()).plugin observes it: root is the code root —
the expanded AGENT_BUNDLE_PLUGIN_ROOT (source: 'native') or the shell's
fallback ('derived') — and stateRoot is the framework state root
(AGENT_BUNDLE_STATE_ROOT, else ~/.agent-bundle/state/<plugin>-<digest>
or $XDG_STATE_HOME/agent-bundle/<plugin>-<digest> for an installed
artifact; <root>/state for the npm package bin and the test harnesses),
where the SQLite kernel, the notice ledger, and the lineage journal live.
Structurally identical to the runtime's AgentPluginIdentity.
Properties
root
readonlyroot:string
stateRoot
readonlystateRoot:string
AgentProviderSessionIdentity
Structurally the runtime's AgentSessionIdentity: the host session the request belongs to.
Properties
sessionId
readonlysessionId:string
AgentProviderStateHandle
The read-only view of the project's mounted state handle a provider receives
(#459): the runtime's AgentStateHandle narrowed to lifetime and read
by construction, so a provider can derive a view of shared state but never
dispatch. Absent for stateless projects and for surfaces that mount none.
Type Parameters
TState
TState = unknown
Properties
lifetime
readonlylifetime:"request"|"process"|"workspace-durable"|"external"
Methods
read()
read(
options?):Promise<AgentProviderStateSnapshot<TState>>
Parameters
options?
revision?
number
signal?
AbortSignal
Returns
Promise<AgentProviderStateSnapshot<TState>>
AgentProviderStateSnapshot
The snapshot a provider's state.read() resolves; structurally the runtime's AgentStateSnapshot.
Type Parameters
TState
TState = unknown
Properties
revision
readonlyrevision:number
state
readonlystate:TState
AgentProviderWorkspaceIdentity
Structurally the runtime's AgentWorkspaceIdentity: the workspace root the request runs in.
Properties
root
readonlyroot:string
AppRouteConfig
Properties
_meta?
readonlyoptional_meta?:RouteMeta
resourceUri
readonlyresourceUri:string
targets?
readonlyoptionaltargets?: readonlystring[]
template?
readonlyoptionaltemplate?:string
Optional HTML shell for the compiled App. The path resolves relative to
the route module, the way its imports do ('./dashboard.html'). A missing
file fails the build with AB4827.
CliProjectionConfig
The config export of a tool's CLI surface projection module,
src/mcp/<server>/tools/<tool>.cli.{ts,tsx} (#596). The module is never a
route: it projects the sibling tool route onto one idiomatic command whose
identity stays the tool's. Every field must stay inside the static
route-config grammar; flags and positionals name canonical keys of the
tool's inputSchema, so declare it as
satisfies CliProjectionConfig<typeof inputSchema> with
import type { inputSchema } from './<tool>.js'. The module may also export
a sync or async mapInput(input) the shell awaits and applies to the parsed argv before
the canonical schema validates.
Type Parameters
Schema
Schema = RouteSchema<Readonly<Record<string, unknown>>>
Properties
aliases?
readonlyoptionalaliases?: readonlystring[]
Alternative command names at the same nesting level (the src/cli alias rules apply).
command?
readonlyoptionalcommand?: readonlystring[]
Command path segments; default [<tool>]. Each must be a safe identity segment.
confirm?
readonlyoptionalconfirm?:boolean
Require --yes before running; default: !(annotations.readOnlyHint === true) of the tool.
description?
readonlyoptionaldescription?:string
Help text; default: the tool's config.description.
exitCode?
readonlyoptionalexitCode?:"result"|"zero"
Exit-code policy; default: the tool's config.exitCode, else 'zero'.
flags?
readonlyoptionalflags?:Partial<Readonly<Record<RouteSchemaInputKey<Schema>,CliProjectionFlagConfig>>>
Per canonical key: the CLI spelling, aliases, description, default, and relaxed requirement.
input?
readonlyoptionalinput?:"json"
'json': the command takes the tool's canonical input as one JSON object
through --input '<json>' instead of per-field flags — for a schema the
bounded argv grammar cannot express (a nested object, a union, a
transform). The tool's own inputSchema still validates it. Cannot be
combined with flags, positionals, or a mapInput export.
positionals?
readonlyoptionalpositionals?: readonlyRouteSchemaInputKey<Schema>[]
Canonical keys consumed as bare arguments, in order (the src/cli positional rules apply).
CliProjectionFlagConfig
How a CLI projection spells one canonical input key on argv. Every field
is optional; an absent flag entry keeps the default policy (the kebab-cased
key as --option, the schema's .describe() and .default()).
Properties
aliases?
readonlyoptionalaliases?: readonlystring[]
Extra long-form spellings (kebab-case, no leading dashes) accepted beside name.
default?
readonlyoptionaldefault?:CliProjectionFlagDefault
A CLI-only default the shell fills in before the canonical inputSchema
reads the input; on a canonical-required key it is legal only when the
module exports mapInput, and the key is listed as relaxed.
description?
readonlyoptionaldescription?:string
Help text; overrides the schema's .describe().
name?
readonlyoptionalname?:string
The CLI spelling (kebab-case, no leading dashes); default: the kebab-cased key.
required?
readonlyoptionalrequired?:false
Relax a canonical-required key so the option may be omitted on argv;
legal only when the module exports mapInput, which must then supply
the key before the canonical schema validates.
CliRouteConfig
Static metadata of one src/cli/** command route (#102 stage 2). Every
field must stay inside the static route-config grammar; the command path
itself comes from the file path, never from config.
Properties
aliases?
readonlyoptionalaliases?: readonlystring[]
Alternative command names at the same nesting level.
description?
readonlyoptionaldescription?:string
exitCode?
readonlyoptionalexitCode?:"result"
Exit-code policy: omit for 0-on-success, or 'result' to read the
validated result's integer exitCode property (0-255).
input?
readonlyoptionalinput?:"json"
Take canonical input through --input JSON; the default when inputJsonSchema is absent.
inputJsonSchema?
readonlyoptionalinputJsonSchema?:RouteInputSchema
Execution-free input metadata for forms and CLI flags; the original schema owns validation.
positionals?
readonlyoptionalpositionals?: readonlystring[]
The inputSchema keys consumed as bare arguments, in order. All but the
last must be scalar; a trailing z.array(...) key is variadic. Keys not
named here become --options.
render?
readonlyoptionalrender?:RouteRenderConfig
The render budget of one rendered (.tsx) command run; plain commands ignore it.
CliRouteProps
Props received by every routed CLI command's default function.
Read transport-owned invocation, host, session, actor, and workspace axes
with await agent() from @agent-bundle/runtime. Every identity axis is
Observed; unavailable axes carry a typed reason, and parsed command input
cannot override request identity.
Type Parameters
InputSchema
InputSchema extends RouteSchema
Properties
input
readonlyinput:RouteSchemaOutput<InputSchema>
signal
readonlysignal:AbortSignal
ExecutableMainContext
The second argument the generated executable envelope passes to a plain
script's or bin's main(argv, context) (#511): the process's terminal
capability, probed once before main runs. A rendered route reads the same
shape from (await agent()).terminal; a plain script has no request scope,
so the envelope hands it the value directly.
Properties
terminal
readonlyterminal:AgentTerminal
PromptConfig
Properties
_meta?
readonlyoptional_meta?:RouteMeta
description?
readonlyoptionaldescription?:string
inputJsonSchema?
readonlyoptionalinputJsonSchema?:RouteInputSchema
Execution-free input metadata for forms and CLI flags; the original schema owns validation.
render?
readonlyoptionalrender?:RouteRenderConfig
The render budget of one get.
title?
readonlyoptionaltitle?:string
ResourceConfig
Properties
_meta?
readonlyoptional_meta?:RouteMeta
description?
readonlyoptionaldescription?:string
inputJsonSchema?
readonlyoptionalinputJsonSchema?:RouteInputSchema
Execution-free input metadata for forms and CLI flags; the original schema owns validation.
mimeType?
readonlyoptionalmimeType?:string
render?
readonlyoptionalrender?:RouteRenderConfig
The render budget of one read.
title?
readonlyoptionaltitle?:string
uri
readonlyuri:string
RouteRenderConfig
The render budget a rendered route declares statically in config.render.
Every rendered route runs inside one render session bounded by the runtime's
default limits; a long-running route (a build await, a long poll) raises
maxElapsedMs here instead of clamping its own waits. The compiler
validates the value (AB4835: a positive integer of milliseconds up to
MAX_ROUTE_RENDER_ELAPSED_MS), and the generated MCP server, the
routed CLI, and the route-unit harness apply it to that route's render
session — the host's own tool-call deadline still applies on top.
Properties
maxElapsedMs?
readonlyoptionalmaxElapsedMs?:number
Wall-clock budget of one render of this route, in milliseconds; the runtime default is 60 000.
RouteSchema
The structural schema surface route props infer without coupling to one schema library.
Type Parameters
Output
Output = unknown
Properties
_output
readonly_output:Output
RouteUiMeta
The MCP Apps _meta.ui block a tool, resource, or prompt stamps on its
listing so hosts open the referenced App beside the result. Set
resourceUri to appResourceUri of the App route instead of
repeating the App's ui:// literal: the compiler resolves the reference
to the App's static config.resourceUri, so the two can never drift. The
block stays open for the rest of the MCP Apps ui vocabulary
(prefersBorder, csp, permissions, …).
Indexable
[
key:string]:unknown
Properties
resourceUri?
readonlyoptionalresourceUri?:string
ScriptRouteProps
Props received by a rendered script's (src/scripts/<name>.tsx) async
default Server Component: the argv left after the framework reserved
--json / --ndjson, exactly as the generated executable passes it, and
the request abort signal.
Properties
argv
readonlyargv: readonlystring[]
signal
readonlysignal:AbortSignal
ToolConfig
Properties
_meta?
readonlyoptional_meta?:RouteMeta
annotations?
readonlyoptionalannotations?:Readonly<Record<string,boolean>>
description?
readonlyoptionaldescription?:string
excludeClients?
readonlyoptionalexcludeClients?: readonlystring[]
Case-insensitive negotiated MCP client-name prefixes where this tool is unavailable. Unknown clients retain tools; this is presentation, not authorization.
execution?
readonlyoptionalexecution?:ToolExecutionConfig
Task-augmented execution of this tool (execution.taskSupport); see ToolTaskSupport.
exitCode?
readonlyoptionalexitCode?:"result"
Project a validated result's integer exitCode when this tool is exposed through the generated CLI.
inputJsonSchema?
readonlyoptionalinputJsonSchema?:RouteInputSchema
Execution-free input metadata for forms and CLI flags; the original schema owns validation.
render?
readonlyoptionalrender?:RouteRenderConfig
The render budget of one call; also inherited by the tool's projected CLI command.
title?
readonlyoptionaltitle?:string
ToolExecutionConfig
The Tool.execution block a tool route declares statically in config.execution.
Properties
taskSupport?
readonlyoptionaltaskSupport?:ToolTaskSupport
ToolRouteProps
Props received by every executable MCP route's default Server Component.
Read transport-owned invocation, host, session, actor, and workspace axes
with await agent() from @agent-bundle/runtime. Every identity axis is
Observed; unavailable axes carry a typed reason, and input cannot
override request identity.
Type Parameters
InputSchema
InputSchema extends RouteSchema
Properties
input
readonlyinput:RouteSchemaOutput<InputSchema>
signal
readonlysignal:AbortSignal
Type Aliases
AgentEventDelivery
AgentEventDelivery =
"immediate"
AgentEventFallbackMode
AgentEventFallbackMode =
"none"|"standalone"
AgentEventNativePayload
AgentEventNativePayload =
Readonly<Record<string,unknown>>
Complete host envelope after the adapter's schema and byte-bound validation.
AgentEventRuntimeMode
AgentEventRuntimeMode =
"shared"|"standalone"
AgentLayoutRouteKind
AgentLayoutRouteKind =
"tool"|"resource"|"prompt"|"cli"|"script"
The route kinds a conventional layout wraps; event routes are host protocol responses and stay unwrapped.
AgentProviderFactory
AgentProviderFactory = (
context) =>unknown|Promise<unknown>
Default export contract for one src/providers/<name>.{ts,tsx} module.
Parameters
context
Returns
unknown | Promise<unknown>
AgentProviderLineageResolution
AgentProviderLineageResolution =
"native"|"registry"|"confirmed"|"transcript"|"inferred"
AgentProviderNoticeState
AgentProviderNoticeState =
"pending"|"attempted"|"expired"|"unavailable"|"withdrawn"|"acknowledged"
AgentProviderObserved
AgentProviderObserved<
Value> = {source:"native"|"receipt"|"derived";state:"available";value:Value; } | {reason:string;state:"unavailable"; }
An observed request axis as a provider receives it: the same shape as every
agent() identity axis, provenance included. Declared here so config-only
consumers need no @agent-bundle/runtime import; structurally the runtime's
Observed<T>.
Type Parameters
Value
Value
AgentProviderObservedPluginRoot
AgentProviderObservedPluginRoot =
AgentProviderObserved<AgentProviderPluginRoot>
The observed plugin root a provider receives; the same shape as every agent() identity axis.
CliProjectionFlagDefault
CliProjectionFlagDefault =
boolean|number|string| readonly (boolean|number|string)[]
A literal a CLI projection may declare as flags.<key>.default: what the argv grammar itself can spell.
RouteMeta
RouteMeta =
Readonly<Record<string,unknown>> &object
Listing-level _meta of an MCP route. It stays inside the static
route-config grammar (see the diagnostics reference), with ui typed so
_meta.ui.resourceUri can reference an App route.
Type Declaration
ui?
readonlyoptionalui?:RouteUiMeta
RouteSchemaInputKey
RouteSchemaInputKey<
Schema> =Schemaextendsobject? keyofInput&string:SchemaextendsRouteSchema<infer Output> ? keyofOutput&string:string
The keys of a schema's input object, as keyof z.input<Schema> reads them:
a zod schema declares _input; a schema declaring only _output (the
structural RouteSchema) falls back to its output keys.
Type Parameters
Schema
Schema
RouteSchemaOutput
RouteSchemaOutput<
Schema> =SchemaextendsRouteSchema<infer Output> ?Output:never
Type Parameters
Schema
Schema
ToolTaskSupport
ToolTaskSupport =
"forbidden"|"optional"|"required"
How a tool may be called as an MCP task (the 2025-11-25 Tasks utility,
Tool.execution.taskSupport). forbidden — the wire default when the
field is absent — means every call is an ordinary request. optional lets
a client that asks for task-augmented execution receive a CreateTaskResult
at once and poll tasks/get / tasks/result for the final CallToolResult
while the render continues; a client that does not ask sees no change.
required refuses an ordinary call with JSON-RPC -32601. The compiler
validates the value (AB4836); the generated server advertises it in
tools/list and declares the tasks capability only when at least one
tool opted in.
Variables
appResourceUri
constappResourceUri: (reference) =>string
References an MCP App route's config.resourceUri from another route's
static config (typically _meta.ui.resourceUri). The App must belong to
the same generated server as the referencing route — a generated server
registers only its own Apps. Accepted references:
'<app>'— the App routesrc/mcp/<server>/apps/<app>.{ts,tsx}of the referencing route's server;'<server>/<app>'or'app:<server>/<app>'— the same App by route id;'./…'or'../…'— the App route module relative to the referencing module, with or without its.ts/.tsxextension.
The compiler evaluates the call statically while extracting config and
replaces it with the target App's resourceUri; a reference to no App of
the same server is AB4826. The route module still evaluates at run time (generated entries
import it for its default export), where the call returns the reference
unchanged — generated servers read the compiled config, never this value.
Parameters
reference
string
Returns
string
MAX_ROUTE_RENDER_ELAPSED_MS
constMAX_ROUTE_RENDER_ELAPSED_MS:number
The ceiling config.render.maxElapsedMs may declare: 24 hours. The value
stays inside Claude Code's default per-call wall clock (MCP_TOOL_TIMEOUT,
about 28 hours); Codex (tool_timeout_sec, 60 s by default) and any
per-server host setting must be raised separately by the operator.
References
AgentEventPayload
Re-exports AgentEventPayload
AgentEventPayloadField
Re-exports AgentEventPayloadField
AgentEventPayloadFieldKind
Re-exports AgentEventPayloadFieldKind
agentEventPayloadFieldKinds
Re-exports agentEventPayloadFieldKinds
AgentEventPayloadFieldName
Re-exports AgentEventPayloadFieldName
agentEventPayloadFields
Re-exports agentEventPayloadFields
AgentEventPayloadFields
Re-exports AgentEventPayloadFields
AgentEventPayloadFieldTypes
Re-exports AgentEventPayloadFieldTypes
AgentEventPayloadHost
Re-exports AgentEventPayloadHost
AgentEventPayloadNativeKey
Re-exports AgentEventPayloadNativeKey
agentEventPayloadNativeKeys
Re-exports agentEventPayloadNativeKeys
AgentTerminal
Re-exports AgentTerminal
AgentTerminalColor
Re-exports AgentTerminalColor
AgentTerminalStream
Re-exports AgentTerminalStream
AgentTerminalStreamKind
Re-exports AgentTerminalStreamKind
AgentTerminalSurface
Re-exports AgentTerminalSurface
CanonicalAgentEvent
Re-exports CanonicalAgentEvent
canonicalAgentEvents
Re-exports canonicalAgentEvents