FIELD GUIDE / API
A small local
workspace API.
The versioned HTTP API connects the terminal client to the V server. It listens on loopback and currently covers health, capabilities, sessions, bounded workspace inspection, reviewed edits and commands, streaming chat, per-call MCP approval, and replayable events.
Endpoints
/v1/healthCheck the local server./v1/capabilitiesDiscover implemented features./v1/config/modelRead or update provider profiles; responses never include API keys./v1/config/models?provider={id}Fetch a bounded model list from the configured provider endpoint./v1/sessionsList sessions or create one for an existing directory./v1/sessions/{id}Read session metadata./v1/sessions/{id}/usageProvider-reported token totals for one session. Nothing is estimated; cost is USD only when every reported turn matches the pinned schedule, otherwise unavailable./v1/usageThe same reported-only aggregation across every session: session and turn counts, token, cache and reasoning totals, and the pinned-schedule cost label./v1/sessions/{id}/forkFork a session: its chat history is copied into a new session (title suffixed “ (fork)”) so you can explore another direction without losing the original. Usage and tool state stay with the source. In the TUI, run /fork to fork and switch in one step./v1/sessions/{id}/messagesPage chat history or complete and persist one exchange./v1/pluginsDiscover local plugin and Skill metadata./v1/skillsList standalone discovered Skills across configured roots./v1/mcp-serversList or upsert configured MCP servers (user/project; optional directory adds project + .mcp.json import;mcp.servers.configured)./v1/mcp-servers/{name}Enable/disable or remove; scope / directory select user or project./v1/mcp-credentialsNamed Streamable HTTP credentials (mcp.credentials; header names only in responses)./v1/mcp-credentials/{name}Remove a named MCP credential./v1/mcp-oauth/authorizePKCE S256 authorize (mcp.oauth); returns browser URL./v1/mcp-oauth/completeFinish OAuth with code/state or loopback callback_url./v1/plugins/componentsList or toggle plugin skill/MCP components (plugins.components)./v1/plugins/linksList or add local Agent Plugin directory links (no remote fetch)./v1/plugins/links/{name}Remove a managed plugin symlink by package name./v1/sessions/{id}/mcp-serversList or update per-session trust for MCP servers (configured/<name> for user-added servers)./v1/sessions/{id}/mcp-tool-callsList recent MCP tool call approvals and outcomes./v1/sessions/{id}/mcp-tool-calls/{call_id}Inspect bounded arguments and record review before approval./v1/sessions/{id}/mcp-tool-calls/{call_id}/approveApprove one inspected call for one execution./v1/sessions/{id}/mcp-tool-calls/{call_id}/rejectReject a pending call without sending it to the MCP server./v1/sessions/{id}/skillsList, enable, or disable Skills for one session./v1/sessions/{id}/workspace/filesList up to 500 workspace files; generated directories and symlinks are skipped./v1/sessions/{id}/workspace/fileRead one UTF-8 text file up to 512 KB within the selected root./v1/sessions/{id}/workspace/searchSearch literal text with bounded file, byte, and result counts./v1/sessions/{id}/workspace/mapExtractive repository map for context selection (also /map in the TUI)./v1/sessions/{id}/workspace/editsList saved proposals or save a bounded single-file diff for review./v1/sessions/{id}/workspace/edits/{edit_id}Open a proposal diff; this records that it was reviewed./v1/sessions/{id}/workspace/edits/{edit_id}/approveApply the reviewed proposal if the file has not changed./v1/sessions/{id}/workspace/edits/{edit_id}/rejectReject a pending proposal without writing./v1/sessions/{id}/workspace/commandsList proposed shell commands for review./v1/sessions/{id}/workspace/commands/{command_id}Open and inspect the exact command, working directory, and timeout./v1/sessions/{id}/workspace/commands/{command_id}/approveRun the command after its review is opened and approval recorded./v1/sessions/{id}/workspace/commands/{command_id}/rejectReject a proposed command./v1/sessions/{id}/workspace/git/worktreesList git worktrees (filesystem) or add one (argv-only git worktree)./v1/sessions/{id}/workspace/git/worktreesLock/unlock or remove a worktree by absolute path./v1/sessions/{id}/operations/{operation_id}Read durable status for an asynchronous session turn, scoped to its session./v1/sessions/{id}/operations/{operation_id}/cancelRequest cancellation of an active session turn./v1/operations/{operation_id}/cancelRequest cancellation of a completion operation./v1/chat/completionsRequest a provider response without a session./v1/eventsReplay events and continue with server-sent events.Page session history
GET /v1/sessions/{id}/messages returns the latest 100 messages by default, in chronological order. Set limit to a value from 1 to 100 to choose a page size. To fetch an earlier page, pass the first message ID from the current page as the exclusivebefore cursor:
curl 'http://127.0.0.1:4097/v1/sessions/SESSION_ID/messages?limit=100&before=101'An empty array means there are no earlier messages. In the terminal client, enter /history older to load and merge the previous page while keeping the messages already on screen.
Headless CLI
Run a single turn against the same local server. Default policy is ask (same review gates as the TUI):
veasel run --prompt "Explain the request flow in this repository" \
--workspace . --json
# sandbox-auto (danger: disposable sandboxes only; server must allow):
# VEASEL_ALLOW_AUTONOMOUS_EXECUTION=1 veasel serve
# veasel run --autonomous --prompt "…" --workspace . --json
HTTP turns accept optional execution_policy: ask (default), auto-edit, or sandbox-auto (autonomous: true aliases sandbox-auto). Server gates: VEASEL_ALLOW_AUTO_EDIT=1, VEASEL_ALLOW_AUTONOMOUS_EXECUTION=1. Prefer veasel serve when another client owns the API. Full OpenAPI contract: docs/openapi.yaml. Capability discovery lists agent.execution_policy (and .auto_edit / .sandbox_auto when enabled).
Resume the event stream
Events use increasing numeric IDs. Send the last event ID you handled to replay newer events after a reconnect. Last-Event-ID must be a digit-only non-negative integer (no sign, spaces, or leading zeros except 0); omit it or send 0 to start from the beginning. Catch-up returns at most 500 events per poll. Quiet streams emit event: heartbeat with data: {} about every 15 seconds so clients can detect a live connection without inventing session events.
curl -N -H 'Last-Event-ID: 12' \
http://127.0.0.1:4097/v1/eventsEach session event includes its session ID and type. Keep the cursor supplied by the server; IDs are created by the local event database.
Wait for an asynchronous turn
Session message requests are synchronous by default. SendPrefer: respond-async to receive 202 Acceptedand a durable operation ID immediately. Follow the replayable event stream for assistant.delta andsession.turn_completed, or query/v1/sessions/SESSION_ID/operations/OPERATION_ID after reconnecting. A completed turn stores its operation status and chat history together. Queued async turns resume after restart (at most 32 queued rows per session) when request, workspace, and model still validate. autonomous:true queued rows resume only when VEASEL_ALLOW_AUTONOMOUS_EXECUTION=1 is set — otherwise they cancel without claim. If the server restarts after a worker claimed the turn but before recording a result, the operation becomes uncertain; Veasel never repeats possible provider or tool effects. Operation history management and retention policy remain ahead.
curl -X POST \
-H 'Content-Type: application/json' \
-H 'Prefer: respond-async' \
-d '{"content":"Inspect this project"}' \
http://127.0.0.1:4097/v1/sessions/SESSION_ID/messagesApprove MCP calls individually
Add user- or project-scoped servers with POST /v1/mcp-servers or veasel mcp add [user|project] (see the MCP guide). Named credentials and OAuth PKCE use /v1/mcp-credentials and /v1/mcp-oauth/*. Per-session trust lets a configured server connect; it does not approve tool effects. Each model-requested call pauses the active turn. Inspect its exact arguments before approval. Rejected calls never reach the server and are not retried.
/mcp calls
Ctrl+R # select the call to inspect its arguments, approve, or rejectHeadless CLI companions
These commands talk to the same loopback API as the TUI (no invented scores):
veasel run --prompt "…" --workspace . --json
veasel mcp list
veasel mcp credentials list
veasel mcp oauth authorize <cred> … --listen # prints URL; no auto browser
veasel skills list [--directory .]
veasel worktrees list
veasel plugins components list