Wire
Source of truth: the //! header of engine/crates/taji/src/wire/mod.rs, served as GET /read/routes; every_dispatched_route_literal_is_in_the_header (engine/crates/taji/src/wire/tests.rs) fails when the router dispatches a route the header omits. This page holds the conventions.
The kernel's one interface is HTTP and WebSockets on loopback, used by the window, the MCP bridge (agent/), taji ui and scripts.
Listeners
- One listener,
127.0.0.1:<port>, opened only whenTAJI_WIRE=<port>is set;0takes a free port. A non-port value or a taken port ends the boot. Unset, clients use 7780 (configuration). - Files. Once bound, the kernel writes
wire-port, thenwire-tokenandagent-token(mode 0600 on Unix; Windows: the state dir's ACL), in the state dir (configuration). A connection made before the kernel serves waits rather than being refused. - Protocol. HTTP/1.1, one request per connection, bodies up to 16 MiB (413
too_large), a request head up to 64 KiB (431head_too_large). Every answer carriesx-taji-version. - Tokenless: the web page and sheet (
/app/) and a plugin's window half (/plugin/<id>/...). - Refused before any work: a
Hostother than127.0.0.1orlocalhost(421host); a proxy ask (405not_a_proxy); a missing or wrong token (401unauthorized). - A process plugin never dials it: it speaks
taji-plugin/1(protocol); the sandbox's limits are in security.
Token scopes
The token in x-taji-token names the caller: 32 random bytes in hex, new each launch.
local: the window's main process,taji-link,taji ui, scripts;<state dir>/wire-token.agent: the MCP bridge;<state dir>/agent-token. Budgeted at 600GETs and 120 other requests in a sliding minute (429rate_limited, namingbudgetandrest_after).page: the window's page; bought once with a nonce atPOST /app/token, kept in memory. Aui/opennonce with the window key buys the by-hand token.sheet: the sheet (keys, vault, installs); bought the same way, fromui/sheet's nonce.
Reads answer every scope, except GET /read/plugins/index and GET /read/agent/search (not agent), GET /read/ui/capture (not sheet), and /ws/agent and /ws/voice (local and page only); POST /fetch refuses sheet. Each refusal is 403 scope, and GETS in engine/crates/taji/src/wire/routes.rs is the list. Every POST is admitted by its route's scopes in the same file before any handler (403 scope; 404 unknown_route). schema/wire.json names each route's scopes. Gates may hold every send but the by-hand token's, which alone approves (approvals/<id>/approve).
Requests and answers
GET /is the root snapshot.GET /read/<node>reads a node of the state tree,GET /describe/<node>answers{"line"}.GET /get/<product>?...reads market data (data),GET /heldwhat the store holds,POST /fetchbuys. An item iskind:text(equity:AAPL).POST /verb/<node>/<verb>takes a JSON object. A plain verb answers 200Changed,{"node", "seq"?}; a route that names its own type answers that; 202 is an outcome that arrives later on/ws/live, orAwaiting, a verb parked for approval.- Times are UTC seconds in a field ending
_utc; a price or size is a decimal string; absent isnull.
A read with the local token, the port and token taken from the state dir:
curl -s -H "x-taji-token: $(cat "$TAJI_STATE_DIR/wire-token")" "http://127.0.0.1:$(cat "$TAJI_STATE_DIR/wire-port")/read/ui"
{
"display_tz": "America/New_York",
"stage": "paper"
}
Captured 2026-12-03 on a keyless headless kernel.
Refusals
Every refusal is {"error": <code>, "reason": <prose>} plus the fields a row names. error matches ^[a-z_]+$, one per condition; reason is for a person. 400 bad_ask is a bad word or body; 404 not found (no_node); 409 an ask the held state refuses (declined); 422 not_linked; 429 rate_limited; 500 io. A data read keeps its ReadError codes. The codes are a closed set, each answered with one status: schema Code in schema/wire.json (the Code union in @taji/wire) lists them, and GET /read/routes names the ones each route answers. A plugin's own refusal, marked by plugin, carries the plugin's own code and status.
Arrow answers
The typed data products (the header's GET /get/<word> rows, one per product) answer 200 application/vnd.apache.arrow.stream: one IPC stream of one batch, an empty answer a zero-row batch. Prices, sizes and volumes are Decimal128(38,10). Schema metadata carries source and provider per item, summary, missing beside served rows, and cursor on a clamped page, read again as GET /get/<product>?cursor=<id>; get/bars adds timeframe and adjustment. engine/crates/taji/scripts/wirearrow.py is a pyarrow reader.
WebSocket feeds
Every socket refuses a foreign Origin (403). The first message, within 5 s, is {"type":"auth","token":...}, else the socket closes 4401. Every kernel frame is binary: a u32 little-endian header length, the header's JSON, then Arrow IPC bytes where there are rows. A frame unread for 30 s closes the socket 4409. Past its auth, /ws/live, /ws/agent and /ws/market ping every 15 s (/ws/market every second) and close 4408 a client unheard for 45 s.
/ws/liveis the change feed.hellocarriesseq; thenchangedframes (at most every 16 ms) name the paths that moved, for a client to reread withGET;failedandlaggedframes follow, and a beat every 10 s. Auth may carrysince, the lastseqheard: the kernel answers the paths changed after it, orresync./ws/agentcarries the conversation's chats;/ws/voicethe page's audio to a voice provider, and its dispatch and replies back. Anagentorsheettoken closes either 4403scopeafter its auth./ws/marketcarries rows. It also takesx-taji-tokenon the upgrade, then needs no auth message. The client sendsstream,unsubscribeandget; the kernel answers Arrowrowsframes (history first, then live) andstatusframes.
Plugin routes
A plugin's verbs are rows in the same catalog: each manifest verb names a route and the scopes that may call it (local and page where it names none). A route that could bind a core verb's is refused at registration. GET /read/plugins lists the plugins (manifest).
Stability
The wire is schema/wire.json, an OpenAPI 3.1 document a kernel serves at GET /read/openapi; the plugin contract is schema/taji.json. What may change, and how a client learns of it, is Compatibility.
The MCP tools
agent/src/mcp/stdio.ts serves nine tools. A catalog row's effect names the tool that sends it (TOOL_OF in agent/src/mcp/catalog.ts); a plugin's verbs are asks rows and its products read rows, never tools of their own.
| Tool | Route kind |
|---|---|
describe | GET /read/routes, the catalog |
read | any GET route, effect read |
call | POST, effect write |
commit | POST, effect asks |
stage | POST, effect stage (trading routes no venue hears) |
order | POST, effect order (trading routes a venue hears) |
wait | /ws/live, a change under a path |
link_choose | GET /read/link; the bridge's own, no wire route |
ui_open | GET /read/flows; starts taji ui, no post |