Skip to content

Interface: WebServerOptions

Defined in: packages/aiui-claude-channel/src/web.ts:47

Properties

debug?

optional debug?: boolean

Defined in: packages/aiui-claude-channel/src/web.ts:112

Server-level debug mode (the standalone serve command sets it). Surfaced on /health, /debug/api/info, and every hello ack, so clients and tools can tell they are talking to a debug server whose prompts never reach a Claude Code session.


formats?

optional formats?: FormatRegistry

Defined in: packages/aiui-claude-channel/src/web.ts:54

Stream formats the websocket protocol accepts, keyed by the name clients declare in their hello. Defaults to defaultFormats.


frameSink?

optional frameSink?: FrameLogSink

Defined in: packages/aiui-claude-channel/src/web.ts:118

Observes every frame-log entry as it is recorded (see frame-log.ts) — the seam recording mode attaches its JSONL sink to (see recording.ts). The log itself is always kept, sink or not.


host?

optional host?: string

Defined in: packages/aiui-claude-channel/src/web.ts:105

Address to bind. Defaults to 127.0.0.1 — every channel route is unauthenticated, so loopback is the safe posture. 0.0.0.0 is the deliberate trusted-LAN choice (aiui claude --aiui-bind host / channel.bind: "host"): the whole surface — prompt injection, /debug, every sidecar (including the iPad pencil page) — becomes reachable by anyone on the network. See docs/guide/warning.md.


launchInfo?

optional launchInfo?: LaunchInfo

Defined in: packages/aiui-claude-channel/src/web.ts:73

Launcher-provided session summary (how the Chrome DevTools MCP was wired, etc. — see launch-info.ts), surfaced at GET /debug/api/info.


loadFormats?

optional loadFormats?: FormatLoader

Defined in: packages/aiui-claude-channel/src/web.ts:96

How WebServer.reload obtains a fresh base (untraced) format registry for each reload generation. Defaults to the hot loader (see hot.ts): a source run re-imports the lowering layer from disk; a packaged run rebuilds from the bundle. Tests inject a fake to drive the reload orchestration deterministically. Ignored when WebServerOptions.formats is set — those formats are caller-owned in-memory objects, not something to re-read from disk (a reload then simply re-wraps them and cycles connections).


log?

optional log?: (message) => void

Defined in: packages/aiui-claude-channel/src/web.ts:160

Log sink for server-level messages (sidecar mounts, etc.). Defaults to a stderr writer — never stdout, which the mcp command's MCP protocol owns.

Parameters

message

string

Returns

void


mode?

optional mode?: "dev" | "prod"

Defined in: packages/aiui-claude-channel/src/web.ts:155

Dev vs. prod, handed to each sidecar as SidecarContext.mode. Defaults to isSourceRun()"dev" when the channel runs off src/ (tsx), "prod" from an installed dist/ build. A web-serving sidecar reads it to pick a Vite dev server (dev) or a prebuilt static bundle (prod); the launcher can force it (--mode) to test the prod path in a source checkout.


onPrompt

onPrompt: PromptHandler

Defined in: packages/aiui-claude-channel/src/web.ts:49

Called with text arriving over POST /prompt or from a stream processor.


pageTools?

optional pageTools?: PageToolDirectory

Defined in: packages/aiui-claude-channel/src/web.ts:80

The registry of in-browser tools the /tools websocket feeds and the MCP layer reads (see PageToolDirectory). Pass the same instance the MCP server was built with so tool calls reach live pages; omitted, a fresh one is created (and returned on the handle).


port?

optional port?: number

Defined in: packages/aiui-claude-channel/src/web.ts:137

Fixed loopback port to bind. Defaults to 0 — an OS-assigned free port — which is right everywhere a human isn't typing the URL by hand (registered servers are discovered through the registry; parallel tests must never collide). A caller that wants a known address (a pinned debug channel, via serve --port) passes one, accepting that a taken port is a loud EADDRINUSE rejection rather than a silent drift elsewhere.


sessionHub?

optional sessionHub?: SessionHub

Defined in: packages/aiui-claude-channel/src/web.ts:86

The session bus the /session websocket feeds — shared arming + prompt preview + contributions across a session's tabs (see SessionHub). Omitted, a fresh one is created (and returned on the handle).


sidecars?

optional sidecars?: Sidecar[]

Defined in: packages/aiui-claude-channel/src/web.ts:147

Session sidecars to host alongside the channel's own endpoints — the intent client, the pencil surface (see Sidecar). Each is mounted on the Express app under its own base path AFTER the channel's routes (so /health, /prompt and the websocket upgrades always win), offered unclaimed websocket upgrades, and disposed on WebServer.close. Callers default to the channel's own standardSidecars (see standard-sidecars.ts); the channel still treats each one opaquely.


tag?

optional tag?: string

Defined in: packages/aiui-claude-channel/src/web.ts:68

The server's --tag, used only to name this process's trace session label (see sessionLabel; untagged servers label as "channel"). Every trace stamped with the label, and /debug/api/traces reports it, so trace lists can default-filter to this server's runs. Purely a human-facing dimension — nothing routes on it.


traceDir?

optional traceDir?: string

Defined in: packages/aiui-claude-channel/src/web.ts:60

Project-local cache directory (see projectCacheDir). When set, every websocket thread records a lowering trace there and the /debug viewer + API are served. Omit to disable tracing (e.g. in tests).


traceSink?

optional traceSink?: TraceStageSink

Defined in: packages/aiui-claude-channel/src/web.ts:128

Observes every lowering-trace stage as it is recorded (linter results, cost, transcription outcomes, composed intents — the pipeline's own IRs), across all threads. The one live seam for pipeline events that never reach the frame log; the mcp command has no use for it (its client reads traces over /debug), but the standalone serve command narrates a curated subset to stderr. Requires WebServerOptions.traceDir — no store, no stages. Best-effort: a throwing sink never breaks lowering (see TraceStageSink).