Skip to main content
The Local Composer (core/local-composer.mjs) is used by the Codex, Claude Code, and OpenCode adapters. It serves ui/composer.html and exposes an API under /api/*. The Antigravity adapter does not use it; Antigravity uses MCP App tools over stdio instead.
These endpoints are internal to the composer UI and host adapters. They are not a stable public API and may change between releases.

Server

  • Base URL: http://127.0.0.1:<port>. The port is ephemeral (0) unless an adapter passes one.
  • Binding: 127.0.0.1 only.
  • Lifetime: startLocalComposerServer has no idle timeout by default (idleTimeoutMs = 0). The launcher used by the Codex and Claude Code hooks (core/launch-local-composer.mjs) sets 30 minutes, configurable with --idle-ms. Each request resets the timer. The OpenCode plugin starts the server without an idle timeout and closes the previous server when a new prompt is intercepted.

Request checks

Checks run in this order:
  1. Host header (all requests): must be 127.0.0.1:<port> or localhost:<port>. Otherwise 403 Invalid Host header.
  2. Origin and Referer (/api/*): if present, must be http://127.0.0.1:<port> or http://localhost:<port>. Otherwise 403 Cross-origin request rejected. or Cross-origin referer rejected.
  3. Session token (/api/*): the X-EISPATCH-Token header must equal the per-session token (constant-time comparison). Otherwise 401 Missing or invalid EISPATCH session token.
The token is injected into the served page as window.__EISPATCH_LOCAL_SESSION__, together with host, hostLabel, and initialPrompt. Request bodies larger than 5 MB are rejected. Unhandled errors, including oversized bodies and library errors, return 500 with { "error": "<message>" }. Unknown routes return 404.

Endpoints

Compose

Body fields: prompt (defaults to the initial prompt), workspacePath, tasks (optional seed tasks). Response fields: host, hostLabel, prompt, projectContext, suggestedMetadata, counts, telemetry, graph, tasks, preview (a compile result).

Breakdown

Body fields: prompt, workspacePath, tasks. If tasks is empty, EISPATCH suggests tasks from the prompt. Response fields: prompt, tasks, preview.

Compile

Body fields: prompt, selectedNodes, tasks, globalNotes, manualFinalPrompt. Response: the compile result (compiledPrompt, generatedPrompt, manifest, summary). See Compiled prompt.

Approve

Body: { "compiledPrompt": "<exact text>" }. An empty prompt returns 400 Cannot approve an empty prompt.
boolean
true on success.
string
Random token required by the next dispatch. Only one approval is active at a time; a new approval replaces the previous one.
string
SHA-256 hex digest of compiledPrompt.

Revoke approval

Body: { "approvalToken": "<token>" } (optional). The token, or the active token if none is given, is marked as consumed and the active approval is cleared. Returns { "ok": true }.

Dispatch

Body: { "compiledPrompt": "<exact text>", "approvalToken": "<token>" }. On success, the token is consumed before the adapter’s dispatch handler runs.
  • With an adapter dispatch handler (OpenCode): { dispatchId: "disp_<timestamp>", host, promptHash, ...result }. The OpenCode result mode is opencode-session-prompt, opencode-http-session, or clipboard-fallback.
  • Without a handler (Codex and Claude Code): { dispatchId: "copy_<timestamp>", host, promptHash, mode: "clipboard-fallback", note }. The composer UI then copies the prompt for you to paste.

Library endpoints

These call the functions in core/library.mjs. See Prompt library for the entry schema.

Getting help

If an endpoint returns an unexpected status, check that the request carries the session token from the page that the composer served, that it is sent from the same loopback origin, and that the server is still running. For persistent issues, open an issue at github.com/FrameScope/eispatch/issues.